111
irmtfan
Re: News 1.67 Final released for XOOPS 2.5.5
  • 2012/8/13 6:19

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


I test Xlanguage 3.04 and the bugs have been solved.
So i take a look at its code and see the ML functionality for PDF can be done for it very easy in makepdf.php files.
So now if you use Xlanguage you can have ML in pdf.

Please see the updated newbb/makepdf.php + RTL + ML (EMLH and Xlanguage)
// $Id: makepdf.php,v 1.1.1.1 2005/10/19 15:58:07 phppp Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                                                    //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
//  Author: phppp (D.J., infomax@gmail.com)                                  //
//  URL: http://xoopsforge.com, https://xoops.org.cn                          //
//  Project: Article Project                                                 //
//  ------------------------------------------------------------------------ //

// a complete rewrite by irmtfan to enhance: 1- RTL 2- Multilanguage (EMLH and Xlanguage)
error_reporting(0);
 
include_once 
dirname(__FILE__) . "/header.php";

$forum         = isset($_GET['forum']) ? intval($_GET['forum']) : 0;
$topic_id     = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : 0;
$post_id     = !empty($_GET['post_id']) ? intval($_GET['post_id']) : 0;
if (!
is_file(XOOPS_ROOT_PATH.'/Frameworks/tcpdf/tcpdf.php')) {
    
redirect_header(XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewtopic.php?topic_id='.$topic_id,3,'TCPF for Xoops not installed');
}
 
if ( empty(
$post_id) )  die(_MD_ERRORTOPIC);

$post_handler xoops_getmodulehandler('post''newbb');
$post $post_handler->get($post_id);
if(!
$approved $post->getVar('approved'))    die(_MD_NORIGHTTOVIEW);

$post_data $post_handler->getPostForPDF($post);
//$post_edit = $post->displayPostEdit();  //reserve for future versions to display edit records  
$topic_handler xoops_getmodulehandler('topic''newbb');
$forumtopic $topic_handler->getByPost($post_id);
$topic_id $forumtopic->getVar('topic_id');
if(!
$approved $forumtopic->getVar('approved'))    die(_MD_NORIGHTTOVIEW);

$forum_handler xoops_getmodulehandler('forum''newbb');
$forum = ($forum) ? $forum $forumtopic->getVar('forum_id');
$viewtopic_forum $forum_handler->get($forum);
if (!
$forum_handler->getPermission($viewtopic_forum))    die(_MD_NORIGHTTOACCESS);
if (!
$topic_handler->getPermission($viewtopic_forum$forumtopic->getVar('topic_status'), "view"))   die(_MD_NORIGHTTOVIEW);
$category_handler xoops_getmodulehandler('category''newbb');
$cat $viewtopic_forum->getVar('cat_id');
$viewtopic_cat $category_handler->get($cat);

$GLOBALS["xoopsOption"]["pdf_cache"] = 0;

$pdf_data['author'] = $myts->undoHtmlSpecialChars($post_data['author']);
$pdf_data['title'] = $myts->undoHtmlSpecialChars($post_data['subject']);
$content '';
$content .= ''.$pdf_data['title'].''
;
$content .= _MD_AUTHORC.' ' $pdf_data['author'].'';
$content .= _MD_POSTEDON ' ' formatTimestamp($post_data['date']).'';
$content .= $myts->undoHtmlSpecialChars($post_data['text']) . '';
//$content .= $post_edit . ''; //reserve for future versions to display edit records
$pdf_data['content'] = str_replace('[pagebreak]','',$content);
$pdf_data['topic_title']=$forumtopic->getVar('topic_title');
$pdf_data['forum_title']=$viewtopic_forum->getVar('forum_name');
$pdf_data['cat_title']=$viewtopic_cat->getVar('cat_title');
$pdf_data['subject']=NEWBB_PDF_SUBJECT.': '.$pdf_data['topic_title'];
$pdf_data['keywords']=XOOPS_URL ', '.'SIMPLE-XOOPS, '.$pdf_data['topic_title'];
$pdf_data['HeadFirstLine']=$xoopsConfig['sitename'].' - '.$xoopsConfig['slogan'];
$pdf_data['HeadSecondLine']=$xoopsModule->getVar('name').' - '.$pdf_data['cat_title'].' - '.$pdf_data['forum_title'].' - '.$pdf_data['topic_title'];

// START irmtfan to implement EMLH by GIJ
if (function_exists('easiestml')) {
    
$pdf_data easiestml($pdf_data);
// END irmtfan to implement EMLH by GIJ
// START irmtfan to implement Xlanguage by phppp(DJ)
} elseif (function_exists('xlanguage_ml')) {
    
$pdf_data xlanguage_ml($pdf_data);
}
// END irmtfan to implement Xlanguage by phppp(DJ)

require_once (XOOPS_ROOT_PATH.'/Frameworks/tcpdf/tcpdf.php');

//create the A4-PDF...
$pdf=new TCPDF(PDF_PAGE_ORIENTATIONPDF_UNITPDF_PAGE_FORMATtrue_CHARSETfalse);
// START irmtfan hack to add RTL-LTR local
// until _RTL added to core 2.6.0
if (!defined('_RTL')) {
    
define('_RTL',false);
}
$pdf->setRTL(_RTL);
// END irmtfan hack to add RTL-LTR local

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(PDF_AUTHOR);
$pdf->SetTitle($pdf_data['forum_title'].' - '.$pdf_data['subject']);
$pdf->SetSubject($pdf_data['subject']);
$pdf->SetKeywords($pdf_data['keywords']);

$pdf->SetHeaderData('''5'$pdf_data['HeadFirstLine'], $pdf_data['HeadSecondLine']);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFTPDF_MARGIN_TOP PDF_MARGIN_RIGHT);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(true25);

$pdf->setHeaderFont(Array(PDF_FONT_NAME_SUB''PDF_FONT_SIZE_SUB));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA''PDF_FONT_SIZE_DATA));
$pdf->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));

$pdf->Open();
$pdf->AddPage();
$pdf->SetFont(PDF_FONT_NAME_MAIN,PDF_FONT_STYLE_MAINPDF_FONT_SIZE_MAIN);
$pdf->writeHTML($pdf_data['content'], true0);
$pdf->Output($pdf_data['topic_title'].'_'.$post_id.'.pdf');
?>


Also as you can see i add post edit records to the pdf. then i comment this feature because i dont know of it is required in pdf. IMO it is not required or can be an additional feature.

As always having pdf from the whole topic is really necessary. If somebody can work on it it would be great.

112
Mamba
Re: News 1.67 Final released for XOOPS 2.5.5
  • 2012/8/13 7:07

  • Mamba

  • Moderator

  • Posts: 11412

  • Since: 2004/4/23


Quote:
I test Xlanguage 3.04 and the bugs have been solved.
So i take a look at its code and see the ML functionality for PDF can be done for it very easy in makepdf.php files.

Thanks for the test and for reporting back.

Quote:
As always having pdf from the whole topic is really necessary. If somebody can work on it it would be great.

Hopefully somebody will take on this challenge!
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

113
black_beard
Re: News 1.67 Final released for XOOPS 2.5.5

Quote:

If somebody can work on it it would be great.


a new version is under preparation.
- tcpdf class : 5.9176 -> 5.9.179
- gestion of multi-language

I would see to incorporate certain features or wishes listed here

Expected release: next Monday


114
irmtfan
Re: News 1.67 Final released for XOOPS 2.5.5
  • 2012/8/13 8:03

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


black_beard:
Good to hear that you work on it. I like to find your idea about my changes in newbb/makepdf.php

IMO if XOOPS move tcpdf to xoops_lib folder it would be safer and easier for implementation without thinking about the security like this:
if (!defined('XOOPS_ROOT_PATH')) {
    die(
"XOOPS root path not defined");
}


everybody
I need to know whether adding post edit records to the pdf is good idea?
i mean this:

edited by XXXX at YYYY/MM/DD 11:07:09

115
Mamba
Re: News 1.67 Final released for XOOPS 2.5.5
  • 2012/8/13 8:45

  • Mamba

  • Moderator

  • Posts: 11412

  • Since: 2004/4/23


@ Black_beard:
Quote:
a new version is under preparation.
- tcpdf class : 5.9176 -> 5.9.179
- gestion of multi-language

Awesome! That's great news!

@ Irmtfan:
Quote:
I need to know whether adding post edit records to the pdf is good idea?

I'm not sure. I don't think that I would be using it. I think, if possible, it would be better to have a special report for the Admin, to show edits and their times/authors.

Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

116
Roby73
Re: News 1.67 Final released for XOOPS 2.5.5
  • 2012/8/14 0:05

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


I upgrade news to 1.67... deprecated funcion /class/xoopstory.php and /class/xoopstopic.php will that correct?


117
Mamba
Re: News 1.67 Final released for XOOPS 2.5.5
  • 2012/8/14 1:01

  • Mamba

  • Moderator

  • Posts: 11412

  • Since: 2004/4/23


It should be fixed in News 1.68 Beta.

Please test it and let me know if it works for you now.

But in general, you can ignore "deprecated" notices. They are meant more as a notice for the module developers to update their modules for future versions (like XOOPS 2.6.0).

But the module itself should work fine in XOOPS 2.5.5.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

118
Roby73
Re: News 1.67 Final released for XOOPS 2.5.5
  • 2012/8/14 2:49

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


Thanks Mamba!

I have modified all old (some very old) modules, fixing all deprecated function, and add new admin gui and upgrade for PHP 5.3

I want only look as fixing this deprecated message, xoopstree also
Now i have only included in the module the /class/xoopstory.php and /class/xoopstopic.php removed the deprecated message and rename class.
This mode resolved the problem but is not the best solution... I was not able to do better




119
Roby73
Re: News 1.67 Final released for XOOPS 2.5.5
  • 2012/8/14 21:57

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


i see now, News 1.68 Beta if not mistake the deprecated class is my modify....

I use this metode for other module changing the name in the single module..


Login

Who's Online

159 user(s) are online (47 user(s) are browsing Support Forums)


Members: 0


Guests: 159


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Dec 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits