+++ /dev/null
-<?php\r
-require('fpdf.php');\r
-include( 'class.ezpdf.php' );\r
-define('AT_INCLUDE_PATH', '../../include/');\r
-require (AT_INCLUDE_PATH.'vitals.inc.php');\r
-\r
-if(isset($_GET['cid'])){\r
- $sql = "SELECT * FROM ".TABLE_PREFIX."content WHERE content_id=$_GET[cid]";\r
- $result = mysql_query($sql);\r
- if(mysql_num_rows($result)!=0){\r
- $content_row = mysql_fetch_assoc($result);\r
- //$titulo = strip_tags($content_row['title']);\r
- $titulo = $content_row['title'];\r
- //$contenido = strip_tags($content_row['text']);\r
- $contenido = $content_row['text'];\r
-/*\r
- ///JOOMLA\r
- //$params = new mosParameters( $row->attribs );\r
- //$params->def( 'author', !$mainframe->getCfg( 'hideAuthor' ) );\r
- //$params->def( 'createdate', !$mainframe->getCfg( 'hideCreateDate' ) );\r
- //$params->def( 'modifydate', !$mainframe->getCfg( 'hideModifyDate' ) );\r
-\r
- $titulo = strip_tags(pdfCleaner( $titulo ));\r
- $contenido = trim(strip_tags(pdfCleaner( $contenido )));\r
-\r
-\r
- $pdf = new Cezpdf( 'a4', 'P' ); //A4 Portrait\r
- $pdf -> ezSetCmMargins( 2, 1.5, 1, 1);\r
- $pdf->selectFont( './fonts/Helvetica.afm' ); //choose font\r
-\r
- $all = $pdf->openObject();\r
- $pdf->saveState();\r
- $pdf->setStrokeColor( 0, 0, 0, 1 );\r
-\r
- // footer\r
- //$pdf->addText( 250, 822, 6, $mosConfig_sitename );\r
- $pdf->line( 10, 40, 578, 40 );\r
- $pdf->line( 10, 818, 578, 818 );\r
- //$pdf->addText( 30, 34, 6, $mosConfig_live_site );\r
- //$pdf->addText( 250, 34, 6, _PDF_POWERED );\r
- //$pdf->addText( 450, 34, 6, _PDF_GENERATED .' '. date( 'j F, Y, H:i', time() + $mosConfig_offset * 60 * 60 ) );\r
-\r
- $pdf->restoreState();\r
- $pdf->closeObject();\r
- $pdf->addObject( $all, 'all' );\r
- $pdf->ezSetDy( 30 );\r
-\r
- $txt1 = $titulo;\r
- $pdf->ezText( $txt1, 14 );\r
-\r
- //$txt2 = AuthorDateLine( $row, $params );\r
- $txt2 = $contenido;\r
-\r
- $pdf->ezText( $txt2, 8 );\r
-\r
- //$txt3 = $row->introtext ."\n". $row->fulltext;\r
- //$pdf->ezText( $txt3, 10 );\r
-\r
- $pdf->ezStream();\r
-\r
- //FIN JOOMLA\r
-*/\r
- $titulo = strip_tags(pdfCleaner( $titulo ));\r
- $contenido = trim(strip_tags(pdfCleaner( $contenido )));\r
- //$contenido = str_word_count($contenido,1);\r
- //$contenido = implode(" ",$contenido);\r
-\r
- //Leemos el fichero\r
- $muestra_pdf = 'muestra_pdf.txt';\r
- $f=fopen($muestra_pdf,'w');\r
- fwrite($f,$contenido);\r
- fclose($f);\r
- $f=fopen($muestra_pdf,'r+');\r
- $pdf=new FPDF();\r
- $pdf->AddPage();\r
- $pdf->SetFont('Arial','',10);\r
- fclose($f);\r
- //$pdf->Cell(0,5,$titulo);\r
- //$pdf->Ln(10);\r
- $pdf->MultiCell(0,3,$contenido);\r
- $pdf->Output();\r
- }\r
- else{\r
- echo(_AT('error'));\r
-\r
- }\r
-}\r
-\r
-function decodeHTML( $string ) {\r
- $string = strtr( $string, array_flip(get_html_translation_table( HTML_ENTITIES ) ) );\r
- $string = preg_replace( "/&#([0-9]+);/me", "chr('\\1')", $string );\r
-\r
- return $string;\r
-}\r
-\r
-\r
-function pdfCleaner( $text ) {\r
- // Ugly but needed to get rid of all the stuff the PDF class cant handle\r
-\r
- $text = str_replace( '<p>', "\n\n", $text );\r
- $text = str_replace( '<P>', "\n\n", $text );\r
- $text = str_replace( '<br />', "\n", $text );\r
- $text = str_replace( '<br>', "\n", $text );\r
- $text = str_replace( '<BR />', "\n", $text );\r
- $text = str_replace( '<BR>', "\n", $text );\r
- $text = str_replace( '<li>', "\n - ", $text );\r
- $text = str_replace( '<LI>', "\n - ", $text );\r
- $text = str_replace( '{mosimage}', '', $text );\r
- $text = str_replace( '{mospagebreak}', '', $text );\r
- $text = str_replace( '<table>','',$text );\r
- $text = str_replace( '<TABLE>','',$text );\r
- $text = str_replace( '</table>','',$text );\r
- $text = str_replace( '</TABLE>','',$text );\r
- $text = str_replace( '<tr>','',$text );\r
- $text = str_replace( '</tr>','',$text );\r
- $text = str_replace( '<TR>','',$text );\r
- $text = str_replace( '</TR>','',$text );\r
- $text = str_replace( ' ','',$text );\r
-\r
-\r
-\r
- $text = strip_tags( $text );\r
- $text = decodeHTML( $text );\r
-\r
- return $text;\r
-}\r
-?>
\ No newline at end of file