| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @author Mambo Foundation Inc see README.php 5 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 6 * See COPYRIGHT.php for copyright notices and details. 7 * @license GNU/GPL Version 2, see LICENSE.php 8 * 9 * Redistributions of files must retain the above copyright notice. 10 * 11 * Mambo is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; version 2 of the License. 14 */ 15 16 /** ensure this file is being included by a parent file */ 17 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 18 19 require_once ($mosConfig_absolute_path.'/components/com_content/content.class.php'); 20 global $mosConfig_offset, $mosConfig_hideAuthor, $mosConfig_hideModifyDate, $mosConfig_hideCreateDate, $mosConfig_live_site; 21 22 function dofreePDF ( $database ) { 23 global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_offset, $mosConfig_hideCreateDate, $mosConfig_hideAuthor, $mosConfig_hideModifyDate; 24 25 $id = intval( mosGetParam( $_REQUEST, 'id', 1 ) ); 26 27 // Access check 28 global $gid; 29 $now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); 30 $query = "SELECT COUNT(a.id)" 31 . "\n FROM #__content AS a" 32 . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" 33 . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope='content'" 34 . "\n LEFT JOIN #__users AS u ON u.id = a.created_by" 35 . "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" 36 . "\n LEFT JOIN #__groups AS g ON a.access = g.id" 37 . "\n WHERE a.id='". $id ."' " 38 . "\n AND (a.state = '1' OR a.state = '-1')" 39 . "\n AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now')" 40 . "\n AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now')" 41 . "\n AND a.access <= ". intval($gid) 42 ; 43 $database->setQuery( $query ); 44 if (!$database->loadResult() ) { 45 exit(T_('You are not authorized to view this resource.')); 46 } 47 48 include ( 'includes/class.ezpdf.php' ); 49 $row = new mosContent( $database ); 50 $row->load( $id ); 51 //Find Author Name 52 $users_rows = new mosUser( $database ); 53 $users_rows->load( $row->created_by ); 54 $row->author = $users_rows->name; 55 $row->usertype = $users_rows->usertype; 56 57 // Ugly but needed to get rid of all the stuff the PDF class cant handle 58 $row->fulltext = str_replace( '<p>', "\n\n" , $row->fulltext ); 59 $row->fulltext = str_replace( '<P>', "\n\n" , $row->fulltext ); 60 $row->fulltext = str_replace( '<br />', "\n" , $row->fulltext ); 61 $row->fulltext = str_replace( '<br>', "\n" , $row->fulltext ); 62 $row->fulltext = str_replace( '<BR />', "\n" , $row->fulltext ); 63 $row->fulltext = str_replace( '<BR>', "\n" , $row->fulltext ); 64 $row->fulltext = str_replace( '<li>', "\n - " , $row->fulltext ); 65 $row->fulltext = str_replace( '<LI>', "\n - " , $row->fulltext ); 66 $row->fulltext = strip_tags( $row->fulltext ); 67 $row->fulltext = str_replace( '{mosimage}', '', $row->fulltext ); 68 $row->fulltext = str_replace( '{mospagebreak}', '', $row->fulltext ); 69 $row->fulltext = decodeHTML( $row->fulltext ); 70 71 $row->introtext = str_replace( '<p>', "\n\n", $row->introtext ); 72 $row->introtext = str_replace( '<P>', "\n\n", $row->introtext ); 73 $row->introtext = str_replace( '<li>', "\n - " , $row->introtext ); 74 $row->introtext = str_replace( '<LI>', "\n - " , $row->introtext ); 75 $row->introtext = strip_tags( $row->introtext ); 76 $row->introtext = str_replace( '{mosimage}', '', $row->introtext ); 77 $row->introtext = str_replace( '{mospagebreak}', '', $row->introtext ); 78 $row->introtext = decodeHTML( $row->introtext ); 79 80 $pdf =& new Cezpdf( 'a4', 'P' ); //A4 Portrait 81 $pdf -> ezSetCmMargins( 2, 1.5, 1, 1); 82 $pdf->selectFont( './fonts/Helvetica.afm' ); //choose font 83 84 $all = $pdf->openObject(); 85 $pdf->saveState(); 86 $pdf->setStrokeColor( 0, 0, 0, 1 ); 87 88 // footer 89 $pdf->line( 10, 40, 578, 40 ); 90 $pdf->line( 10, 822, 578, 822 ); 91 $pdf->addText( 30, 34, 6, $mosConfig_live_site .' - '. $mosConfig_sitename ); 92 $pdf->addText( 250, 34, 6, T_('Powered by Mambo') ); 93 $pdf->addText( 450, 34, 6, T_('Generated:'). date( 'j F, Y, H:i', time() + $mosConfig_offset*60*60 ) ); 94 95 $pdf->restoreState(); 96 $pdf->closeObject(); 97 $pdf->addObject( $all, 'all' ); 98 $pdf->ezSetDy( 30 ); 99 100 $txt1 = $row->title; 101 $pdf->ezText( $txt1, 14 ); 102 103 $txt2 = NULL; 104 $mod_date = NULL; 105 $create_date = NULL; 106 if ( intval( $row->modified ) <> 0 ) { 107 $mod_date = mosFormatDate( $row->modified ); 108 } 109 if ( intval( $row->created ) <> 0 ) { 110 $create_date = mosFormatDate( $row->created ); 111 } 112 113 if ( $mosConfig_hideCreateDate == '0' ) { 114 $txt2 .= '('. $create_date .') - '; 115 } 116 117 if ( $mosConfig_hideAuthor == "0" ) { 118 if ( $row->author != '' && $mosConfig_hideAuthor == '0' ) { 119 if ($row->usertype == 'administrator' || $row->usertype == 'superadministrator') { 120 $txt2 .= T_('Written by') .' '. ( $row->created_by_alias ? $row->created_by_alias : $row->author ); 121 } else { 122 $txt2 .= T_('Contributed by') .' '. ( $row->created_by_alias ? $row->created_by_alias : $row->author ); 123 } 124 } 125 } 126 127 if ( $mosConfig_hideModifyDate == "0" ) { 128 $txt2 .= ' - '. T_('Last Updated') .' ('. $mod_date .') '; 129 } 130 131 $txt2 .= "\n\n"; 132 $pdf->ezText( $txt2, 8 ); 133 $txt3 = $row->introtext ."\n". $row->fulltext; 134 $pdf->ezText( $txt3, 10 ); 135 $pdf->ezStream(); 136 } 137 138 function decodeHTML( $string ) { 139 $string = strtr( $string, array_flip(get_html_translation_table( HTML_ENTITIES ) ) ); 140 $string = preg_replace( "/&#([0-9]+);/me", "chr('\\1')", $string ); 141 return $string; 142 } 143 144 function get_php_setting ($val ) { 145 $r = ( ini_get( $val ) == '1' ? 1 : 0 ); 146 return $r ? T_('ON') : T_('OFF'); 147 } 148 149 dofreePDF ( $database ); 150 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |