3 include( 'class.ezpdf.php' );
\r
4 define('AT_INCLUDE_PATH', '../../include/');
\r
5 require (AT_INCLUDE_PATH.'vitals.inc.php');
\r
7 if(isset($_GET['cid'])){
\r
8 $sql = "SELECT * FROM ".TABLE_PREFIX."content WHERE content_id=$_GET[cid]";
\r
9 $result = mysql_query($sql);
\r
10 if(mysql_num_rows($result)!=0){
\r
11 $content_row = mysql_fetch_assoc($result);
\r
12 //$titulo = strip_tags($content_row['title']);
\r
13 $titulo = $content_row['title'];
\r
14 //$contenido = strip_tags($content_row['text']);
\r
15 $contenido = $content_row['text'];
\r
18 //$params = new mosParameters( $row->attribs );
\r
19 //$params->def( 'author', !$mainframe->getCfg( 'hideAuthor' ) );
\r
20 //$params->def( 'createdate', !$mainframe->getCfg( 'hideCreateDate' ) );
\r
21 //$params->def( 'modifydate', !$mainframe->getCfg( 'hideModifyDate' ) );
\r
23 $titulo = strip_tags(pdfCleaner( $titulo ));
\r
24 $contenido = trim(strip_tags(pdfCleaner( $contenido )));
\r
27 $pdf = new Cezpdf( 'a4', 'P' ); //A4 Portrait
\r
28 $pdf -> ezSetCmMargins( 2, 1.5, 1, 1);
\r
29 $pdf->selectFont( './fonts/Helvetica.afm' ); //choose font
\r
31 $all = $pdf->openObject();
\r
33 $pdf->setStrokeColor( 0, 0, 0, 1 );
\r
36 //$pdf->addText( 250, 822, 6, $mosConfig_sitename );
\r
37 $pdf->line( 10, 40, 578, 40 );
\r
38 $pdf->line( 10, 818, 578, 818 );
\r
39 //$pdf->addText( 30, 34, 6, $mosConfig_live_site );
\r
40 //$pdf->addText( 250, 34, 6, _PDF_POWERED );
\r
41 //$pdf->addText( 450, 34, 6, _PDF_GENERATED .' '. date( 'j F, Y, H:i', time() + $mosConfig_offset * 60 * 60 ) );
\r
43 $pdf->restoreState();
\r
44 $pdf->closeObject();
\r
45 $pdf->addObject( $all, 'all' );
\r
46 $pdf->ezSetDy( 30 );
\r
49 $pdf->ezText( $txt1, 14 );
\r
51 //$txt2 = AuthorDateLine( $row, $params );
\r
54 $pdf->ezText( $txt2, 8 );
\r
56 //$txt3 = $row->introtext ."\n". $row->fulltext;
\r
57 //$pdf->ezText( $txt3, 10 );
\r
63 $titulo = strip_tags(pdfCleaner( $titulo ));
\r
64 $contenido = trim(strip_tags(pdfCleaner( $contenido )));
\r
65 //$contenido = str_word_count($contenido,1);
\r
66 //$contenido = implode(" ",$contenido);
\r
69 $muestra_pdf = 'muestra_pdf.txt';
\r
70 $f=fopen($muestra_pdf,'w');
\r
71 fwrite($f,$contenido);
\r
73 $f=fopen($muestra_pdf,'r+');
\r
76 $pdf->SetFont('Arial','',10);
\r
78 //$pdf->Cell(0,5,$titulo);
\r
80 $pdf->MultiCell(0,3,$contenido);
\r
89 function decodeHTML( $string ) {
\r
90 $string = strtr( $string, array_flip(get_html_translation_table( HTML_ENTITIES ) ) );
\r
91 $string = preg_replace( "/&#([0-9]+);/me", "chr('\\1')", $string );
\r
97 function pdfCleaner( $text ) {
\r
98 // Ugly but needed to get rid of all the stuff the PDF class cant handle
\r
100 $text = str_replace( '<p>', "\n\n", $text );
\r
101 $text = str_replace( '<P>', "\n\n", $text );
\r
102 $text = str_replace( '<br />', "\n", $text );
\r
103 $text = str_replace( '<br>', "\n", $text );
\r
104 $text = str_replace( '<BR />', "\n", $text );
\r
105 $text = str_replace( '<BR>', "\n", $text );
\r
106 $text = str_replace( '<li>', "\n - ", $text );
\r
107 $text = str_replace( '<LI>', "\n - ", $text );
\r
108 $text = str_replace( '{mosimage}', '', $text );
\r
109 $text = str_replace( '{mospagebreak}', '', $text );
\r
110 $text = str_replace( '<table>','',$text );
\r
111 $text = str_replace( '<TABLE>','',$text );
\r
112 $text = str_replace( '</table>','',$text );
\r
113 $text = str_replace( '</TABLE>','',$text );
\r
114 $text = str_replace( '<tr>','',$text );
\r
115 $text = str_replace( '</tr>','',$text );
\r
116 $text = str_replace( '<TR>','',$text );
\r
117 $text = str_replace( '</TR>','',$text );
\r
118 $text = str_replace( ' ','',$text );
\r
122 $text = strip_tags( $text );
\r
123 $text = decodeHTML( $text );
\r