removed mods directory from the ATutor codebase
[atutor.git] / mods / pdf_converter / pdf.php
diff --git a/mods/pdf_converter/pdf.php b/mods/pdf_converter/pdf.php
deleted file mode 100644 (file)
index 1ab3808..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-<?php\r
-/**\r
-* @version $Id: pdf.php 4562 2006-08-18 23:26:32Z stingrey $\r
-* @package Joomla\r
-* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.\r
-* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php\r
-* Joomla! is free software. This version may have been modified pursuant\r
-* to the GNU General Public License, and as distributed it includes or\r
-* is derivative of works licensed under the GNU General Public License or\r
-* other free or open source software licenses.\r
-* See COPYRIGHT.php for copyright notices and details.\r
-* Created by Phil Taylor me@phil-taylor.com\r
-* Support file to display PDF Text Only using class from - http://www.ros.co.nz/pdf/readme.pdf\r
-* HTMLDoc is available from: http://www.easysw.com/htmldoc and needs installing on the server for better HTML to PDF conversion\r
-**/\r
-\r
-// no direct access\r
-defined( '_VALID_MOS' ) or die( 'Restricted access' );\r
-\r
-function dofreePDF() {\r
-       global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_offset;\r
-       global $mainframe, $database, $my;\r
-       \r
-       $id             = intval( mosGetParam( $_REQUEST, 'id', 1 ) );\r
-       \r
-       $gid            = $my->gid;\r
-       $now            = _CURRENT_SERVER_TIME;\r
-       $nullDate       = $database->getNullDate();\r
-       \r
-       // query to check for state and access levels\r
-       $query = "SELECT a.*, cc.name AS category, s.name AS section, s.published AS sec_pub, cc.published AS cat_pub,"\r
-       . "\n  s.access AS sec_access, cc.access AS cat_access, s.id AS sec_id, cc.id as cat_id"\r
-       . "\n FROM #__content AS a"\r
-       . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid"\r
-       . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'"\r
-       . "\n WHERE a.id = $id"\r
-       . "\n AND a.state = 1"\r
-       . "\n AND a.access <= $gid"\r
-       . "\n AND ( a.publish_up = '$nullDate' OR a.publish_up <= '$now' )"\r
-       . "\n AND ( a.publish_down = '$nullDate' OR a.publish_down >= '$now' )" \r
-       ;       \r
-       $database->setQuery( $query );\r
-       $row = NULL;\r
-       \r
-       if ( $database->loadObject( $row ) ) {\r
-               /*\r
-               * check whether category is published\r
-               */\r
-               if ( !$row->cat_pub && $row->catid ) {\r
-                       mosNotAuth();  \r
-                       return;\r
-               }\r
-               /*\r
-               * check whether section is published\r
-               */\r
-               if ( !$row->sec_pub && $row->sectionid ) {\r
-                       mosNotAuth(); \r
-                       return;\r
-               }\r
-               /*\r
-               * check whether category access level allows access\r
-               */\r
-               if ( ($row->cat_access > $gid) && $row->catid ) {\r
-                       mosNotAuth();  \r
-                       return;\r
-               }\r
-               /*\r
-               * check whether section access level allows access\r
-               */\r
-               if ( ($row->sec_access > $gid) && $row->sectionid ) {\r
-                       mosNotAuth();  \r
-                       return;\r
-               }\r
-               \r
-               include( 'includes/class.ezpdf.php' );\r
-       \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
-               $row->fulltext  = pdfCleaner( $row->fulltext );\r
-               $row->introtext = pdfCleaner( $row->introtext );\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 = $row->title;\r
-               $pdf->ezText( $txt1, 14 );\r
-       \r
-               $txt2 = AuthorDateLine( $row, $params );\r
-       \r
-               $pdf->ezText( $txt2, 8 );\r
-               \r
-               $txt3 = $row->introtext ."\n". $row->fulltext;\r
-               $pdf->ezText( $txt3, 10 );\r
-               \r
-               $pdf->ezStream();\r
-       } else {\r
-               mosNotAuth();\r
-               return;\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
-function get_php_setting ($val ) {\r
-       $r = ( ini_get( $val ) == '1' ? 1 : 0 );\r
-       \r
-       return $r ? 'ON' : 'OFF';\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
-       \r
-       $text = strip_tags( $text );\r
-       $text = decodeHTML( $text );\r
-\r
-       return $text;\r
-}\r
-\r
-function AuthorDateLine( &$row, &$params ) {\r
-       global $database;\r
-       \r
-       $text = '';\r
-       \r
-       if ( $params->get( 'author' ) ) {\r
-               // Display Author name\r
-               \r
-               //Find Author Name\r
-               $users_rows = new mosUser( $database );\r
-               $users_rows->load( $row->created_by );\r
-               $row->author    = $users_rows->name;\r
-               $row->usertype  = $users_rows->usertype;                \r
-               \r
-               if ($row->usertype == 'administrator' || $row->usertype == 'superadministrator') {\r
-                       $text .= "\n";\r
-                       $text .=  _WRITTEN_BY .' '. ( $row->created_by_alias ? $row->created_by_alias : $row->author );\r
-               } else {\r
-                       $text .= "\n";\r
-                       $text .=  _AUTHOR_BY .' '. ( $row->created_by_alias ? $row->created_by_alias : $row->author );\r
-               }\r
-       }\r
-       \r
-       if ( $params->get( 'createdate' ) && $params->get( 'author' ) ) {\r
-               // Display Separator\r
-               $text .= "\n";\r
-       }\r
-       \r
-       if ( $params->get( 'createdate' ) ) {\r
-               // Display Created Date\r
-               if ( intval( $row->created ) ) {\r
-                       $create_date    = mosFormatDate( $row->created );\r
-                       $text                   .= $create_date;\r
-               }                               \r
-       }       \r
-       \r
-       if ( $params->get( 'modifydate' ) && ( $params->get( 'author' ) || $params->get( 'createdate' ) ) ) {\r
-               // Display Separator\r
-               $text .= "\n";\r
-       }\r
-       \r
-       if ( $params->get( 'modifydate' ) ) {\r
-               // Display Modified Date\r
-               if ( intval( $row->modified ) ) {\r
-                       $mod_date       = mosFormatDate( $row->modified );\r
-                       $text           .= _LAST_UPDATED .' '. $mod_date;\r
-                       \r
-               }\r
-       }       \r
-       \r
-       $text .= "\n\n";\r
-\r
-       return $text;\r
-}\r
-\r
-dofreePDF();\r
-?>
\ No newline at end of file