[pLog-svn] r2384 - in plog/branches/plog-1.0.2: . class/dao class/data class/gallery/dao class/locale class/net

pwestbro at devel.plogworld.net pwestbro at devel.plogworld.net
Mon Aug 1 22:31:04 GMT 2005


Author: pwestbro
Date: 2005-08-01 22:31:04 +0000 (Mon, 01 Aug 2005)
New Revision: 2384

Modified:
   plog/branches/plog-1.0.2/blog.php
   plog/branches/plog-1.0.2/class/dao/article.class.php
   plog/branches/plog-1.0.2/class/dao/articles.class.php
   plog/branches/plog-1.0.2/class/dao/searchengine.class.php
   plog/branches/plog-1.0.2/class/data/plogcalendar.class.php
   plog/branches/plog-1.0.2/class/gallery/dao/galleryalbums.class.php
   plog/branches/plog-1.0.2/class/gallery/dao/galleryresource.class.php
   plog/branches/plog-1.0.2/class/locale/pluginlocale.class.php
   plog/branches/plog-1.0.2/class/net/customurlhandler.class.php
   plog/branches/plog-1.0.2/class/net/linkparser.class.php
Log:
Fixed errors in pLog core when running PHP5.  This has been written up in
bug http://bugs.plogworld.net/view.php?id=668

This checkin does not include all of the fixes in
customurlhandler.class.php.  I am not sure the "right" way to fix this file


Modified: plog/branches/plog-1.0.2/blog.php
===================================================================
--- plog/branches/plog-1.0.2/blog.php	2005-08-01 16:24:23 UTC (rev 2383)
+++ plog/branches/plog-1.0.2/blog.php	2005-08-01 22:31:04 UTC (rev 2384)
@@ -30,7 +30,7 @@
 	//
 	$vars["op"] = "op";
 	foreach( $vars as $key => $value ) {
-		if( $params["$key"] != "" ) 
+		if( is_array( $params ) && array_key_exists( $key, $params ) && $params["$key"] != "" ) 
 			HttpVars::setRequestValue( $vars["$key"], $params["$key"] );
 	}
 

Modified: plog/branches/plog-1.0.2/class/dao/article.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/article.class.php	2005-08-01 16:24:23 UTC (rev 2383)
+++ plog/branches/plog-1.0.2/class/dao/article.class.php	2005-08-01 22:31:04 UTC (rev 2384)
@@ -151,8 +151,13 @@
 		 */
         function getExtendedText()
         {
-        	$postParts = explode( POST_EXTENDED_TEXT_MODIFIER, $this->_text );
-            return $postParts[1];
+            $postParts = explode( POST_EXTENDED_TEXT_MODIFIER, $this->_text );
+            $extendedText = "";
+            if ( count($postParts) > 1 )
+            {
+                $extendedText = $postParts[1];
+            }
+            return $extendedText;
         }
 		
         /**
@@ -700,6 +705,11 @@
 			if( $this->_fields == null )
 				$this->getFields();
 		
+			if ( !array_key_exists(  $fieldName, $this->_fields ) )
+			{
+				return null;
+			}
+			
 			return $this->_fields["$fieldName"];
 		}
 		

Modified: plog/branches/plog-1.0.2/class/dao/articles.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/articles.class.php	2005-08-01 16:24:23 UTC (rev 2383)
+++ plog/branches/plog-1.0.2/class/dao/articles.class.php	2005-08-01 22:31:04 UTC (rev 2384)
@@ -628,7 +628,7 @@
             if( $result == false )
                 return 0;
 
-            $postPerDay = Array();
+            $postsPerDay = Array();
             while( $row = $result->FetchRow()) {
                 $postsPerDay[$row["day"]] = $row["count"];
             }

Modified: plog/branches/plog-1.0.2/class/dao/searchengine.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/searchengine.class.php	2005-08-01 16:24:23 UTC (rev 2383)
+++ plog/branches/plog-1.0.2/class/dao/searchengine.class.php	2005-08-01 22:31:04 UTC (rev 2384)
@@ -344,7 +344,7 @@
 			
 			foreach( $results as $item ) {
 				$article = $item->getArticle();
-				if( $alreadySeen[$article->getId()] == false ) {
+				if( !array_key_exists( $article->getId(), $alreadySeen ) || $alreadySeen[$article->getId()] == false ) {
 					array_push( $result, $item );
 					$alreadySeen[$article->getId()] = true;
 				}

Modified: plog/branches/plog-1.0.2/class/data/plogcalendar.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/data/plogcalendar.class.php	2005-08-01 16:24:23 UTC (rev 2383)
+++ plog/branches/plog-1.0.2/class/data/plogcalendar.class.php	2005-08-01 22:31:04 UTC (rev 2384)
@@ -89,7 +89,7 @@
         	if( $this->_dayPosts == null )
             	return "";
 
-            if( $this->_dayPosts[$day] > 0 ) {
+            if( array_key_exists( $day, $this->_dayPosts) && $this->_dayPosts[$day] > 0 ) {
             	if( $day < 10 ) $day = "0".$day;
                 $date = "$year$month$day";
 

Modified: plog/branches/plog-1.0.2/class/gallery/dao/galleryalbums.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/gallery/dao/galleryalbums.class.php	2005-08-01 16:24:23 UTC (rev 2383)
+++ plog/branches/plog-1.0.2/class/gallery/dao/galleryalbums.class.php	2005-08-01 22:31:04 UTC (rev 2384)
@@ -334,8 +334,11 @@
 				}
 			}
 			
-			$total = $this->_counts[$albumId];
-			
+            $total = "";
+            if ( array_key_exists( $albumId, $this->_counts ) )
+            {
+                $total = $this->_counts[$albumId];
+            }
 			if( $total == "" ) $total = 0;
 			
 			return $total;

Modified: plog/branches/plog-1.0.2/class/gallery/dao/galleryresource.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/gallery/dao/galleryresource.class.php	2005-08-01 16:24:23 UTC (rev 2383)
+++ plog/branches/plog-1.0.2/class/gallery/dao/galleryresource.class.php	2005-08-01 22:31:04 UTC (rev 2384)
@@ -255,7 +255,7 @@
 		 if (!$this->_fileDescriptor)
 		 return false;
 		 }
-		 return $this->_getDataChunk(&$this->_fileDescriptor,$chunksize);
+		 return $this->_getDataChunk($this->_fileDescriptor,$chunksize);
 		 }        
 
 		/**

Modified: plog/branches/plog-1.0.2/class/locale/pluginlocale.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/locale/pluginlocale.class.php	2005-08-01 16:24:23 UTC (rev 2383)
+++ plog/branches/plog-1.0.2/class/locale/pluginlocale.class.php	2005-08-01 22:31:04 UTC (rev 2384)
@@ -46,8 +46,18 @@
 		{
 			$fileName = PLOG_CLASS_PATH."plugins/".$this->_pluginId."/locale/locale_".$this->_code.".php";
 
-			include( $fileName );
-
+			if( File::isReadable( $fileName ))
+			{
+				include( $fileName );
+			}
+	
+			// The following is just to handle the case where a plugin doesn't
+			// have a valid local file.
+			if ( !isset($messages) || !is_array( $messages ) )
+			{
+				$messages = array();
+			}
+			
 			$this->_messages = $messages;
 		}		
 	}

Modified: plog/branches/plog-1.0.2/class/net/customurlhandler.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/net/customurlhandler.class.php	2005-08-01 16:24:23 UTC (rev 2383)
+++ plog/branches/plog-1.0.2/class/net/customurlhandler.class.php	2005-08-01 22:31:04 UTC (rev 2384)
@@ -62,7 +62,7 @@
 			// if the url did not match any of the current settings, then let's try to parse it as an old
 			// "search engine friendly" url
 			$this->_fallback = Array( "permalink_format" => "/post/{blogid}/{postid}",
-									 "category_link_format" => "/category/{$blogid}/{postid}",
+									 "category_link_format" => "/category/{blogid}/{postid}",
 									 "blog_link_format" => "/blogid}",
 									 "archive_link_format" => "/archives/{blogid}/{year}/{month}/{day}",
 									 "user_posts_link_format" => "/user/{blogid}/{userid}",

Modified: plog/branches/plog-1.0.2/class/net/linkparser.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/net/linkparser.class.php	2005-08-01 16:24:23 UTC (rev 2383)
+++ plog/branches/plog-1.0.2/class/net/linkparser.class.php	2005-08-01 22:31:04 UTC (rev 2384)
@@ -77,10 +77,10 @@
             // Extract the token names from the structure:
             preg_match_all("#\{(.+?)\}#", $this->_linkFormat, $tokens);
         
+        	$result = array();
             for($i = 0; $i < count($tokens[1]); $i++) {
                 $name = $tokens[1][$i];
                 $value = $values[$i+1];
-        
                 $result["$name"] = $value;
             }
             




More information about the pLog-svn mailing list