[geeklog-cvs] geeklog-1.3/public_html pdfgenerator.php,1.4,1.5

tony at iowaoutdoors.org tony at iowaoutdoors.org
Mon Jun 7 15:04:49 EDT 2004


Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv30847

Modified Files:
	pdfgenerator.php 
Log Message:
Added further security and error handling as well as I moved the templates into a sane location

Index: pdfgenerator.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/pdfgenerator.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pdfgenerator.php	7 Jun 2004 16:04:42 -0000	1.4
--- pdfgenerator.php	7 Jun 2004 19:04:45 -0000	1.5
***************
*** 35,40 ****
  require_once 'lib-common.php';
  
! // Need ot add error message here from language file
! if ($_CONF['pdf_enabled'] == 0) {
      echo COM_siteHeader();
      echo $LANG_PDF[1];
--- 35,41 ----
  require_once 'lib-common.php';
  
! // Ensure the PDF feature is even enabled
! if ($_CONF['pdf_enabled'] == 0 OR
!     (($_CONF['pdf_enabled'] == 1) AND ($_CONF['pdf_adhoc_enabled'] == 0) AND (!SEC_inGroup('Root')))) {
      echo COM_siteHeader();
      echo $LANG_PDF[1];
***************
*** 42,45 ****
--- 43,47 ----
      exit;
  } else {
+     // Ensure we got a handle to a valid HTMLDoc binary
      if (!is_file($_CONF['path_to_htmldoc']) OR !is_executable($_CONF['path_to_htmldoc'])) {
          echo COM_siteHeader();
***************
*** 48,51 ****
--- 50,60 ----
          exit;
      }
+     // Ensure we can open URL's using fopen
+     if (!ini_get('allow_url_fopen')) {
+         echo COM_siteHeader();
+         echo $LANG_PDF[13];
+         echo COM_siteFooter();
+         exit;
+     }
  }
  
***************
*** 162,166 ****
              COM_errorLog($LANG_PDF . ' COMMAND EXECUTED: ' . $cmd);
          } else {
!             $pdf = new Template( $_CONF['path_layout'] );
              $pdf->set_file( array(
              'pdf'         => 'pdf.thtml'
--- 171,175 ----
              COM_errorLog($LANG_PDF . ' COMMAND EXECUTED: ' . $cmd);
          } else {
!             $pdf = new Template( $_CONF['path_layout'] . 'pdfgenerator/');
              $pdf->set_file( array(
              'pdf'         => 'pdf.thtml'
***************
*** 187,191 ****
      } else {
          if (!$_REQUEST['pageData']) {
!             echo $LANG_PDF[4];
          } else {
              echo $LANG_PDF[3];
--- 196,215 ----
      } else {
          if (!$_REQUEST['pageData']) {
!             $pdf = new Template( $_CONF['path_layout'] . 'pdfgenerator/');
!             $pdf->set_file( array(
!             'pdf'         => 'pdf_form.thtml'
!             ));
! 
!             $pdf->set_var('layout_url', $_CONF['layout_url']);
!             $pdf->set_var('site_url', $_CONF['site_url']);
!             $pdf->set_var('lang_error_msg', $LANG_PDF[4]);
!             $pdf->set_var('lang_pdf_generator', $LANG_PDF[9]);
!             $pdf->set_var('lang_instructions', $LANG_PDF[10]);
!             $pdf->set_var('lang_URL', $LANG_PDF[11]);
!             $pdf->set_var('lang_generate_pdf', $LANG_PDF[12]);
!             $pdf->parse('page', 'pdf' );
!             echo $pdf->finish($pdf->get_var('page'));
!             echo ;
!             
          } else {
              echo $LANG_PDF[3];




More information about the geeklog-cvs mailing list