[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.258,1.259

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Sat Sep 13 11:35:01 EDT 2003


Update of /usr/cvs/geeklog/geeklog-1.3/public_html
In directory geeklog_prod:/tmp/cvs-serv10015/public_html

Modified Files:
	lib-common.php 
Log Message:
Changed COM_rdfImport() to display a generic error message if there was a problem importing a feed (details will be available in error.log).
Also eliminated an unnecessary eval() in COM_showBlocks().


Index: lib-common.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.258
retrieving revision 1.259
diff -C2 -d -r1.258 -r1.259
*** lib-common.php	12 Sep 2003 09:31:34 -0000	1.258
--- lib-common.php	13 Sep 2003 15:34:59 -0000	1.259
***************
*** 3331,3338 ****
                      {
                          // show error message
-                         $errmsg = $LANG21[31];
-                         eval( "\$errmsg = \"$errmsg\";" );
                          $retval .= $blkheader;
!                         $retval .= $errmsg;
                          $retval .= $blkfooter;
                      }
--- 3331,3336 ----
                      {
                          // show error message
                          $retval .= $blkheader;
!                         $retval .= sprintf( $LANG21[31], $function );
                          $retval .= $blkfooter;
                      }
***************
*** 3464,3468 ****
  function COM_rdfImport( $bid, $rdfurl )
  {
!     global $_TABLES, $RDFinsideitem, $RDFtag, $RDFtitle, $RDFlink, $RDFheadlines;
  
      $RDFinsideitem = false;
--- 3462,3467 ----
  function COM_rdfImport( $bid, $rdfurl )
  {
!     global $_TABLES, $LANG21,
!            $RDFinsideitem, $RDFtag, $RDFtitle, $RDFlink, $RDFheadlines;
  
      $RDFinsideitem = false;
***************
*** 3472,3483 ****
      $RDFheadlines = array();
  
!     $update = date( "Y-m-d H:i:s" );
  
!     $result = DB_change( $_TABLES['blocks'], 'rdfupdated', "$update", 'bid', $bid );
      clearstatcache();
  
      $rdferror = false;
      $xml_parser = xml_parser_create();
!     xml_set_element_handler($xml_parser, 'COM_rdfStartElement', 'COM_rdfEndElement');
      xml_set_character_data_handler( $xml_parser, 'COM_rdfCharacterData' );
  
--- 3471,3484 ----
      $RDFheadlines = array();
  
!     $update = date( 'Y-m-d H:i:s' );
  
!     $result = DB_change( $_TABLES['blocks'], 'rdfupdated', $update,
!                          'bid', $bid );
      clearstatcache();
  
      $rdferror = false;
      $xml_parser = xml_parser_create();
!     xml_set_element_handler( $xml_parser, 'COM_rdfStartElement',
!                              'COM_rdfEndElement');
      xml_set_character_data_handler( $xml_parser, 'COM_rdfCharacterData' );
  
***************
*** 3490,3493 ****
--- 3491,3498 ----
              {
                  $data = ltrim( $data );
+                 if( empty( $data ))
+                 {
+                     break;
+                 }
                  $startoffeed = false;
              }
***************
*** 3503,3510 ****
                  COM_errorLog( $errmsg, 1 );
                  $rdferror = true;
!                 $result = DB_change( $_TABLES['blocks'], 'content', addslashes ($errmsg), 'bid', "$bid" );
                  break;
              }
          }
  
          fclose( $fp );
--- 3508,3525 ----
                  COM_errorLog( $errmsg, 1 );
                  $rdferror = true;
!                 $result = DB_change( $_TABLES['blocks'], 'content',
!                                      addslashes( $LANG21[4] ), 'bid', $bid );
                  break;
              }
          }
+         if( $startoffeed && empty( $data ))
+         {
+             $errmsg = sprintf( 'The feed at %s exists but is currently empty.',
+                                $rdfurl );
+             COM_errorLog( $errmsg, 1 );
+             $rdferror = true;
+             $result = DB_change( $_TABLES['blocks'], 'content',
+                                  addslashes( $LANG21[4] ), 'bid', $bid );
+         }
  
          fclose( $fp );
***************
*** 3515,3536 ****
              $blockcontent = COM_makeList( $RDFheadlines );
              $RDFheadlines = array();
!             $blockcontent = preg_replace( "/(\015\012)|(\015)|(\012)/", "", $blockcontent );
!             $result = DB_change( $_TABLES['blocks'], 'content', "$blockcontent", 'bid', $bid);
          }
      }
      else
      {
          $rdferror = true;
-         COM_errorLog( "Can not reach $rdfurl", 1 );
  
!         $result = DB_change(
!             $_TABLES['blocks'],
!             'content',
!             "GeekLog can not reach the supplied RDF file at $update. "
!             . "Please double check the URL provided.  Make sure your url is correctly entered and it begins with "
!             . "http://. GeekLog will try in one hour to fetch the file again.",
!             'bid',
!             "$bid"
!             );
      }
  }
--- 3530,3547 ----
              $blockcontent = COM_makeList( $RDFheadlines );
              $RDFheadlines = array();
!             $blockcontent = preg_replace( "/(\015\012)|(\015)|(\012)/", '',
!                                           $blockcontent );
!             $result = DB_change( $_TABLES['blocks'], 'content', $blockcontent,
!                                  'bid', $bid);
          }
      }
      else
      {
+         $errmsg = sprintf( 'Geeklog can not reach the feed at %s.', $rdfurl );
+         COM_errorLog( $errmsg, 1 );
          $rdferror = true;
  
!         $result = DB_change( $_TABLES['blocks'], 'content',
!                              addslashes( $LANG21[4] ), 'bid', $bid );
      }
  }





More information about the geeklog-cvs mailing list