[pLog-svn] r461 - in plog/trunk/class: action bayesian controller dao data/validator data/validator/rules gallery/dao gallery/resizers net object plugin security summary/action summary/view template template/smarty/plugins view

subaochen at devel.plogworld.net subaochen at devel.plogworld.net
Fri Dec 10 07:59:23 GMT 2004


Author: subaochen
Date: 2004-12-10 07:59:23 +0000 (Fri, 10 Dec 2004)
New Revision: 461

Modified:
   plog/trunk/class/action/blogaction.class.php
   plog/trunk/class/bayesian/bayesianfiltercore.class.php
   plog/trunk/class/controller/controller.class.php
   plog/trunk/class/dao/articlecomments.class.php
   plog/trunk/class/dao/articlecommentstatus.class.php
   plog/trunk/class/dao/articles.class.php
   plog/trunk/class/dao/model.class.php
   plog/trunk/class/dao/trackbacks.class.php
   plog/trunk/class/dao/users.class.php
   plog/trunk/class/data/validator/emailvalidator.class.php
   plog/trunk/class/data/validator/ipmatchvalidator.class.php
   plog/trunk/class/data/validator/rules/urlformatrule.class.php
   plog/trunk/class/gallery/dao/galleryalbums.class.php
   plog/trunk/class/gallery/dao/galleryresourcequotas.class.php
   plog/trunk/class/gallery/dao/galleryresources.class.php
   plog/trunk/class/gallery/dao/galleryresourcestorage.class.php
   plog/trunk/class/gallery/resizers/gallerygdresizer.class.php
   plog/trunk/class/gallery/resizers/galleryimagemagickresizer.class.php
   plog/trunk/class/gallery/resizers/galleryresizer.class.php
   plog/trunk/class/net/linkparser.class.php
   plog/trunk/class/object/object.class.php
   plog/trunk/class/plugin/pluginbase.class.php
   plog/trunk/class/plugin/pluginmanager.class.php
   plog/trunk/class/security/bayesianfilter.class.php
   plog/trunk/class/summary/action/summarydefaultaction.class.php
   plog/trunk/class/summary/action/summarysetnewpassword.class.php
   plog/trunk/class/summary/action/summaryupdatepassword.class.php
   plog/trunk/class/summary/view/summarycachedview.class.php
   plog/trunk/class/template/cachecontrol.class.php
   plog/trunk/class/template/cachedtemplate.class.php
   plog/trunk/class/template/smarty/plugins/function.debug.php
   plog/trunk/class/template/template.class.php
   plog/trunk/class/template/templateservice.class.php
   plog/trunk/class/view/resourceserverview.class.php
Log:
replace _debug with $this->log->debug


Modified: plog/trunk/class/action/blogaction.class.php
===================================================================
--- plog/trunk/class/action/blogaction.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/action/blogaction.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -141,7 +141,7 @@
 				if( $result["blogname"] != "" && $this->_request->getValue( 'blogId' ) == "" ) 
 					$this->_request->setValue( 'blogId', $result["blogname"] );
 				
-				_debug($result);
+				$this->log->debug($result);
 			}
 			
             // if there is a "blogId" parameter, it takes precedence over the

Modified: plog/trunk/class/bayesian/bayesianfiltercore.class.php
===================================================================
--- plog/trunk/class/bayesian/bayesianfiltercore.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/bayesian/bayesianfiltercore.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -124,13 +124,13 @@
             
             if ($spam)
             {
-				//_debug("untraining previous spam!");
+				//$this->log->debug("untraining previous spam!");
                 $bayesianTokens->decSpamOccurrencesFromTokensArray($blogId, $tokens, $totalSpam, $totalNonSpam);
                 $bayesianFilterInfos->decTotalSpam($bayesianFilterInfo->getId());
             }
             else
             {
-				//_debug("untraining previous non-spam!!!");
+				//$this->log->debug("untraining previous non-spam!!!");
                 $bayesianTokens->decNonSpamOccurrencesFromTokensArray($blogId, $tokens, $totalSpam, $totalNonSpam);
                 $bayesianFilterInfos->decTotalNonSpam($bayesianFilterInfo->getId());
             }

Modified: plog/trunk/class/controller/controller.class.php
===================================================================
--- plog/trunk/class/controller/controller.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/controller/controller.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -103,7 +103,7 @@
 		 */
 		function setActionFolderPath( $newActionFolderPath )
 		{
-			_debug("new folder path = $newActionFolderPath" );
+			$this->log->debug("new folder path = $newActionFolderPath" );
 			$this->actionFolderPath = $newActionFolderPath;
 		}
 
@@ -257,4 +257,4 @@
                 $view->render();
         }
     }
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/dao/articlecomments.class.php
===================================================================
--- plog/trunk/class/dao/articlecomments.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/dao/articlecomments.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -89,7 +89,7 @@
 				// find out the blogInfo object (after all, all these comments belong to the same
 				// blog so there is no risk of finding different blog_ids anywhere!
 				if( $this->blogSettings == null ) {
-					_debug("CALCULATING time_diff FOR COMMENT!!");
+					$this->log->debug("CALCULATING time_diff FOR COMMENT!!");
 					$prefix = $this->getPrefix();
 					$articleId = $row["article_id"];
 					
@@ -152,7 +152,7 @@
 				// find out the blogInfo object (after all, all these comments belong to the same
 				// blog so there is no risk of finding different blog_ids anywhere!
 				if( $this->blogSettings == null ) {
-					_debug("CALCULATING time_diff FOR COMMENT!!");
+					$this->log->debug("CALCULATING time_diff FOR COMMENT!!");
 					$prefix = $this->getPrefix();
 					$articleId = $row["article_id"];
 					

Modified: plog/trunk/class/dao/articlecommentstatus.class.php
===================================================================
--- plog/trunk/class/dao/articlecommentstatus.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/dao/articlecommentstatus.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -40,7 +40,7 @@
 
             foreach( $constants as $constant => $value ) {
                 if( substr( $constant, 0, 15 ) == "COMMENT_STATUS_" && $constant != "COMMENT_STATUS_ALL" ) {
-					_debug("Adding $constant");
+					$this->log->debug("Adding $constant");
 					$constant = strtolower($constant);
                     $statusList[ "$constant" ] = $value;
                 }

Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/dao/articles.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -20,6 +20,8 @@
     include_once( PLOG_CLASS_PATH.'class/dao/customfields/customfieldsvalues.class.php' );
     include_once( PLOG_CLASS_PATH.'class/dao/customfields/customfields.class.php' );
 
+    include_once( PLOG_CLASS_PATH.'class/logger/LogUtil.php' );
+
     /**
      * Model for the Articles
      */
@@ -643,19 +645,22 @@
         {
             // first, we build up the query
             $filter = new Textfilter();
-            $query = "INSERT INTO ".$this->getPrefix()."articles( user_id,blog_id,status,date,properties, slug)
+            $query = "INSERT INTO ".$this->getPrefix()."articles( user_id,blog_id,status,date,properties, slug )
                       VALUES ( ".$newArticle->getUser().",".
                       $newArticle->getBlog().",'".
-                      $newArticle->getStatus()."', '".
+                      $newArticle->getStatus()."','".
                       $newArticle->getDate()."','".
-                      serialize($newArticle->getProperties())."', '".
+                      serialize($newArticle->getProperties())."','".
 					  $newArticle->getPostSlug()."');";
             // and then we send it to the db
             //$this->_db->debug=true;
             $result = $this->Execute( $query );
 
-            if( !$result )
+            if( !$result ){
+                $this->log->error("Add article failed! article object is ".
+                    LogUtil::format($newArticle));
                 return false;
+            }
 
             // get id of the post from the database
             $postId = $this->_db->Insert_ID();
@@ -1072,7 +1077,7 @@
             $date = Timestamp::getDateWithOffset( $query_result['date'], $timeDiff );
 
 			$articleCategories = $this->getArticleCategories( $query_result['id'] );
-			//_debug($articleCategories);
+			//$this->log->debug($articleCategories);
             $categoryIds = Array();
 			foreach( $articleCategories as $category )
 				array_push( $categoryIds, $category->getId());
@@ -1190,4 +1195,4 @@
             return true;
         }
     }
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/dao/model.class.php
===================================================================
--- plog/trunk/class/dao/model.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/dao/model.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -120,16 +120,16 @@
 			// we should only cache 'SELECT' queries
 			if( substr($query, 0, 6) == "SELECT" ) {
 				if( empty($queryCache[$query])) {
-					//_debug("Not cached! query = $query<hr/>");
+					//$this->log->debug("Not cached! query = $query<hr/>");
 					$queryCache[$query] = $this->_db->Execute( $query );
 				}
 				else
-					//_debug("CACHED! query = <b>$query</b><hr/>");
+					//$this->log->debug("CACHED! query = <b>$query</b><hr/>");
 					
 				$result = $queryCache[$query];
 			}
 			else {
-				//_debug("NOT CACHING");
+				//$this->log->debug("NOT CACHING");
 				$result = $this->_db->Execute( $query );
 			}
 			

Modified: plog/trunk/class/dao/trackbacks.class.php
===================================================================
--- plog/trunk/class/dao/trackbacks.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/dao/trackbacks.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -87,7 +87,7 @@
 				// find out the blogInfo object (after all, all these comments belong to the same
 				// blog so there is no risk of finding different blog_ids anywhere!
 				if( $this->blogSettings == null ) {
-					_debug("CALCULATING time_diff FOR TRACKBACK!!");
+					$this->log->debug("CALCULATING time_diff FOR TRACKBACK!!");
 					$prefix = $this->getPrefix();
 					$articleId = $row["article_id"];
 					
@@ -144,7 +144,7 @@
 				// find out the blogInfo object (after all, all these comments belong to the same
 				// blog so there is no risk of finding different blog_ids anywhere!
 				if( $this->blogSettings == null ) {
-					_debug("CALCULATING time_diff FOR TRACKBACK!!");
+					$this->log->debug("CALCULATING time_diff FOR TRACKBACK!!");
 					$prefix = $this->getPrefix();
 					$articleId = $row["article_id"];
 					

Modified: plog/trunk/class/dao/users.class.php
===================================================================
--- plog/trunk/class/dao/users.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/dao/users.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -419,5 +419,29 @@
         {
 	    	return( $this->getUserInfoFromUsername( $userName ));   
         }
+
+        /**
+         * get the blogid of user own
+         */
+		function getUserBlogId( $username )
+		{
+            // default blog id
+            $blogId = 1;
+
+			$usersBlogs = Array();
+            $blogs = new Blogs();
+
+            $userinfo = $this->getUserInfoFromUsername($username);
+            $userid = $userinfo->getId();
+
+        	// check if the user is the owner of any blog
+            $owner = "SELECT id FROM ".$this->getPrefix()."blogs WHERE owner_id = ".$userid.";";
+            $result = $this->_db->Execute( $owner );
+            while( $row = $result->FetchRow($result)) {
+            	$blogId = $row["id"];
+            }
+
+            return $blogId;
+		}
     }
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/data/validator/emailvalidator.class.php
===================================================================
--- plog/trunk/class/data/validator/emailvalidator.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/data/validator/emailvalidator.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -24,7 +24,7 @@
             $config =& Config::getConfig();
 
             if ( $config->getValue( "check_email_address_validity" )) {
-				_debug("checking email address validity...");
+				$this->log->debug("checking email address validity...");
                 $this->addRule(new EmailDnsRule());
             }
         }

Modified: plog/trunk/class/data/validator/ipmatchvalidator.class.php
===================================================================
--- plog/trunk/class/data/validator/ipmatchvalidator.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/data/validator/ipmatchvalidator.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -25,7 +25,7 @@
 
         function checkip($ip , $csiext)
         {
-        	//_debug( "validating ip = $ip - csiext = $csiext<br/>" );
+        	//$this->log->debug( "validating ip = $ip - csiext = $csiext<br/>" );
         	$counter = 0;
 
             $range = explode("/",$csiext);

Modified: plog/trunk/class/data/validator/rules/urlformatrule.class.php
===================================================================
--- plog/trunk/class/data/validator/rules/urlformatrule.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/data/validator/rules/urlformatrule.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -32,7 +32,7 @@
 		{
 			$result = $this->_valURL( $value, $this->_options );
 			
-			_debug($result);
+			$this->log->debug($result);
 			
 			return( $result['Result'] == EW_OK );
 		}

Modified: plog/trunk/class/gallery/dao/galleryalbums.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryalbums.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/gallery/dao/galleryalbums.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -445,7 +445,7 @@
 
             // fetch the resources that belong to this album
             /*if( $fetchResources ) {
-				_debug("fetching resources for album id = $id<br/>");
+				$this->log->debug("fetching resources for album id = $id<br/>");
 				if( $this->resources == "" )
 					$this->resources = new GalleryResources();				
                 $albumResources = $this->resources->getUserResources( $row["owner_id"], $id );

Modified: plog/trunk/class/gallery/dao/galleryresourcequotas.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresourcequotas.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/gallery/dao/galleryresourcequotas.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -67,7 +67,7 @@
 			// current allocated quota
 			$blogQuota = GalleryResourceQuotas::getBlogResourceQuota( $blogId );
 			
-			_debug( "quota for blog $blogId is $blogQuota");
+			$this->log->debug( "quota for blog $blogId is $blogQuota");
 			
 			// but if the quota is 0, then for sure we won't be over the quota :)
 			if( $blogQuota == 0 )

Modified: plog/trunk/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresources.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/gallery/dao/galleryresources.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -254,7 +254,7 @@
 				$resourceType = $this->_extensionToType[ $fileExt ];
 			else
 				$resourceType = GALLERY_RESOURCE_UNKNOWN;
-			_debug( "getResourceType: Resource type = $resourceType" );
+			$this->log->debug( "getResourceType: Resource type = $resourceType" );
 			
 			return $resourceType;	
 		}
@@ -301,7 +301,7 @@
 
 			// get the id that was given to the record
 			$resourceId = $this->_db->Insert_ID();
-			_debug( "Resource added to db successfully! Resource ID = $resourceId" );			
+			$this->log->debug( "Resource added to db successfully! Resource ID = $resourceId" );			
 
 			// check if we have two resources with the same filename now
 			// check if there already exists a file with the same name
@@ -347,12 +347,12 @@
 			GalleryResourceStorage::checkPreviewsStorageFolder( $ownerId );
 			$outFile = GalleryResourceStorage::getPreviewsFolder( $ownerId ).$fileName;
 			
-			_debug( "** generateResourceThumbnail" );
-			_debug( "   outFile = $outFile" );
-			_debug( "   resFile = $resFile" );
-			_debug( "   fileExt = $fileExt" );
-			_debug( "   ownerId = $ownerId" );
-			_debug( "   resourceId = $resourceId" );
+			$this->log->debug( "** generateResourceThumbnail" );
+			$this->log->debug( "   outFile = $outFile" );
+			$this->log->debug( "   resFile = $resFile" );
+			$this->log->debug( "   fileExt = $fileExt" );
+			$this->log->debug( "   ownerId = $ownerId" );
+			$this->log->debug( "   resourceId = $resourceId" );
 			
 			// and finally, we can generate the preview!
 			$result = $resizer->generate( $outFile, $previewHeight, $previewWidth, $previewKeepAspectRatio );
@@ -386,12 +386,12 @@
 			GalleryResourceStorage::checkMediumSizePreviewsStorageFolder( $ownerId );
 			$outFile = GalleryResourceStorage::getMediumSizePreviewsFolder( $ownerId ).$fileName;
 			
-			_debug( "** generateResourceMediumSizeThumbnail" );
-			_debug( "   outFile = $outFile" );
-			_debug( "   resFile = $resFile" );
-			_debug( "   fileExt = $fileExt" );
-			_debug( "   ownerId = $ownerId" );
-			_debug( "   resourceId = $resourceId" );
+			$this->log->debug( "** generateResourceMediumSizeThumbnail" );
+			$this->log->debug( "   outFile = $outFile" );
+			$this->log->debug( "   resFile = $resFile" );
+			$this->log->debug( "   fileExt = $fileExt" );
+			$this->log->debug( "   ownerId = $ownerId" );
+			$this->log->debug( "   resourceId = $resourceId" );
 			
 			// and finally, we can generate the preview!
 			$result = $resizer->generate( $outFile, $previewHeight, $previewWidth, $previewKeepAspectRatio );
@@ -421,12 +421,12 @@
             if( $error < 0 )
                 return $error;
 			
-            _debug( "New resource validated ok!" );
+            $this->log->debug( "New resource validated ok!" );
             
             // get the metadata
             $getId3 = new GetID3();
             $metadata = $getId3->analyze( $upload->getTmpName());
-            _debug( "Resource metadata fetched!" );
+            $this->log->debug( "Resource metadata fetched!" );
 			
 			// find out the right resource type based on the extension
 			$resourceType = $this->getResourceType( $upload->getFileName());
@@ -446,7 +446,7 @@
             // move the file to disk
             $storage = new GalleryResourceStorage();
             $resFile = $storage->storeUpload( $resourceId, $ownerId, $upload );
-            _debug("res file = $resFile");
+            $this->log->debug("res file = $resFile");
             
             // if the file cannot be read, we will also remove the record from the
             // database so that we don't screw up
@@ -490,12 +490,12 @@
             $fileName = basename( $fullFilePath );
             $filePath = dirname( $fullFilePath );
             
-            _debug( "fileName = $fileName - filePath = $filePath - fullFilePath = $fullFilePath" );
+            $this->log->debug( "fileName = $fileName - filePath = $filePath - fullFilePath = $fullFilePath" );
         
             // get the metadata
             $getId3 = new GetID3();
             $metadata = $getId3->analyze( $fullFilePath );
-            _debug( "Resource metadata fetched!" );
+            $this->log->debug( "Resource metadata fetched!" );
     
             // find out the right resource type based on the extension
             $resourceType = $this->getResourceType( $fileName );
@@ -511,20 +511,20 @@
             if( !$resourceId )
                 return false;
                 
-            _debug( "Resource added to the database with id $resourceId" );
+            $this->log->debug( "Resource added to the database with id $resourceId" );
     
             // and finally move the file to the right place in disk
             // move the file to disk
             $storage = new GalleryResourceStorage();
             $resFile = $storage->storeFile( $resourceId, $ownerId, $fullFilePath );
-            _debug("res file = $resFile");
+            $this->log->debug("res file = $resFile");
             
             // if the file cannot be read, we will also remove the record from the
             // database so that we don't screw up
             $fileReadable = File::isReadable( $resFile );
             if( !$resFile || $resFile < 0 || !$fileReadable ) {
                 // if something went wrong, we should not keep the record in the db
-                _debug( "Error storing the file!" );
+                $this->log->debug( "Error storing the file!" );
                 $query = "DELETE FROM ".$this->getPrefix()."gallery_resources
                           WHERE id = $resourceId";
     
@@ -535,7 +535,7 @@
     
             // and finally, we can generate the thumbnail only if the file is an image, of course :)
             if( $resourceType == GALLERY_RESOURCE_IMAGE ) {
-                _debug( "Generating thumbnail..." );
+                $this->log->debug( "Generating thumbnail..." );
                 $this->generateResourceThumbnail( $resFile, $resourceId, $ownerId );
             }
             

Modified: plog/trunk/class/gallery/dao/galleryresourcestorage.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresourcestorage.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/gallery/dao/galleryresourcestorage.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -53,30 +53,30 @@
 			$baseFolder = GalleryResourceStorage::getResourcesStorageFolder();
 			if( $baseFolder[strlen($baseFolder)-1] == "/") {
         	   $baseFolder = substr($baseFolder,0,strlen($baseFolder)-1);
-        	   _debug("base folder = $baseFolder");
+        	   $this->log->debug("base folder = $baseFolder");
             }			
 						
-			_debug( "Checking if base gallery folder exists = $baseFolder" );
+			$this->log->debug( "Checking if base gallery folder exists = $baseFolder" );
         	if( !File::isDir( $baseFolder )) {
             	// folder does not exist, so we should try to create it
                 if( !File::createDir( $baseFolder, 0755 )) {
-					_debug( "There was an error creating the folder!" );
+					$this->log->debug( "There was an error creating the folder!" );
                 	throw( new Exception( "Could not create storage folder for resources: ".$baseFolder));
 					return false;
                     //die();
                 }
 				
-				_debug( "Folder created ok!" );
+				$this->log->debug( "Folder created ok!" );
             }
 
             if( !File::isReadable( $baseFolder )) {
-				_debug( "Folder exists but it is not readable!" );
+				$this->log->debug( "Folder exists but it is not readable!" );
             	throw( new Exception( $baseFolder." storage folder exists but it is not readable!" ));
 				return false;
                 //die();
             }
 			
-			_debug( "Base folder exists and it is readable." );
+			$this->log->debug( "Base folder exists and it is readable." );
 
             return true;
         }
@@ -126,7 +126,7 @@
 			$baseFolder = GalleryResourceStorage::getResourcesStorageFolder();
 			if( $baseFolder[strlen($baseFolder)-1] == "/") {
         	   $baseFolder = substr($baseFolder,0,strlen($baseFolder)-1);
-        	   _debug("base folder = $baseFolder");
+        	   $this->log->debug("base folder = $baseFolder");
             }			
 
         	$userFolder = GalleryResourceStorage::getUserFolder( $ownerId );
@@ -134,11 +134,11 @@
         	   $userFolder = substr($userFolder,0,strlen($userFolder)-1);
             }
 			
-			_debug("user folder = $userFolder");			
+			$this->log->debug("user folder = $userFolder");			
         	if( !File::isDir( $userFolder )) {
             	// folder does not exist, so we should try to create it
                 if( !File::createDir( $userFolder, 0755 )) {
-					_debug("could not create folder!");
+					$this->log->debug("could not create folder!");
                 	throw( new Exception( "Could not create user storage folder for resources: ".$userFolder ));
 					return false;
                     //die();
@@ -146,7 +146,7 @@
             }
 
             if( !File::isReadable( $userFolder )) {
-				_debug( "User storage folder exists but it is not readable!" );
+				$this->log->debug( "User storage folder exists but it is not readable!" );
             	throw( new Exception( $userFolder." user storage folder exists but it is not readable!" ));
 				return false;
                 //die();
@@ -168,20 +168,20 @@
             $previewsFolder = GalleryResourceStorage::getPreviewsFolder( $ownerId );
         	if( $previewsFolder[strlen($previewsFolder)-1] == "/") {
         	   $previewsFolder = substr($previewsFolder,0,strlen($previewsFolder)-1);
-				_debug("previews folder = $previewsFolder");			   
+				$this->log->debug("previews folder = $previewsFolder");			   
             }
 
-			_debug( "Checking if previews folder exists = $previewsFolder" );
+			$this->log->debug( "Checking if previews folder exists = $previewsFolder" );
         	if( !File::isDir( $previewsFolder )) {
             	// folder does not exist, so we should try to create it
                 if( !File::createDir( $previewsFolder, 0755 )) {
-					_debug("Error creating $previewsFolder!");
+					$this->log->debug("Error creating $previewsFolder!");
                 	throw( new Exception( "Could not create user storage folder for previews: ".$previewsFolder ));
                     //die();
 					return false;
                 }
 				
-				_debug( "Previews folder created ok!" );
+				$this->log->debug( "Previews folder created ok!" );
             }
 
             if( !File::isReadable( $previewsFolder )) {
@@ -190,7 +190,7 @@
 				return false;
             }
 
-			_debug( "Previews folder checked ok!" );
+			$this->log->debug( "Previews folder checked ok!" );
             return true;
         }
 		
@@ -202,20 +202,20 @@
             $previewsFolder = GalleryResourceStorage::getMediumSizePreviewsFolder( $ownerId );
         	if( $previewsFolder[strlen($previewsFolder)-1] == "/") {
         	   $previewsFolder = substr($previewsFolder,0,strlen($previewsFolder)-1);
-				_debug("medium size previews folder = $previewsFolder");			   
+				$this->log->debug("medium size previews folder = $previewsFolder");			   
             }
 
-			_debug( "Checking if medium size previews folder exists = $previewsFolder" );
+			$this->log->debug( "Checking if medium size previews folder exists = $previewsFolder" );
         	if( !File::isDir( $previewsFolder )) {
             	// folder does not exist, so we should try to create it
                 if( !File::createDir( $previewsFolder, 0755 )) {
-					_debug("Error creating medium size folder $previewsFolder!");
+					$this->log->debug("Error creating medium size folder $previewsFolder!");
                 	throw( new Exception( "Could not create user storage folder for medium size previews: ".$previewsFolder ));
                     //die();
 					return false;
                 }
 				
-				_debug( "Previews folder created ok!" );
+				$this->log->debug( "Previews folder created ok!" );
             }
 
             if( !File::isReadable( $previewsFolder )) {
@@ -224,7 +224,7 @@
 				return false;
             }
 
-			_debug( "Previews folder checked ok!" );
+			$this->log->debug( "Previews folder checked ok!" );
             return true;
         }		
 
@@ -250,7 +250,7 @@
             $fileName = "$ownerId-$resourceId.$fileExt";
             $filePath = $this->getUserFolder( $ownerId );
 			
-			_debug( "storeUpload: fileExt = $fileExt - fileName = $fileName - filePath = $filePath" );
+			$this->log->debug( "storeUpload: fileExt = $fileExt - fileName = $fileName - filePath = $filePath" );
 
             // move the file to the temporaray folder first
             $config =& Config::getConfig();
@@ -266,7 +266,7 @@
             }
 
             // rename it while it's there
-            _debug("moving ".$tmpFolder."/".$upload->getFileName()." to $destFile");
+            $this->log->debug("moving ".$tmpFolder."/".$upload->getFileName()." to $destFile");
 			$origFile = $tmpFolder."/".$upload->getFileName();
 			$destFile = $this->storeFile( $resourceId, $ownerId, $origFile, RESOURCE_STORAGE_STORE_MOVE );
 
@@ -296,27 +296,27 @@
             $destFile = "$ownerId-$resourceId.$fileExt";
             $destPath = $this->getUserFolder( $ownerId );
 
-			_debug( "storeFile: fileExt = $fileExt - fileName = $fileName - destFile = $destFile - destPath = $destPath" );
+			$this->log->debug( "storeFile: fileExt = $fileExt - fileName = $fileName - destFile = $destFile - destPath = $destPath" );
 
 			// first of all, check if the file is readable and if not, quit	
 			if( !File::isReadable($fileName)) {
-				_debug( "storeFile: file $fileName is not readable!" ); 
+				$this->log->debug( "storeFile: file $fileName is not readable!" ); 
 				return false;
 			}
 
 			$destFile = $destPath.$destFile;
-            _debug(" copying $fileName to $destFile" );
+            $this->log->debug(" copying $fileName to $destFile" );
 			if( $mode == RESOURCE_STORAGE_STORE_COPY )
             		$res = File::copy( $fileName, $destFile );
 			else 
 				$res = File::rename( $fileName, $destFile );
             
 			if( !$res ) {
-				_debug( "There was an error copying the file!" );
+				$this->log->debug( "There was an error copying the file!" );
             	return false;
 			}			
 			// check that the permissions are correct
-			_debug( "chmodding file to 0777" );
+			$this->log->debug( "chmodding file to 0777" );
 			File::chMod( $destFile, 0755 );
 
             return $destFile;
@@ -339,7 +339,7 @@
                 $filePath = $this->getUserFolder( $resource->getOwnerId());
 				$fullName = $filePath.$fileName;
 
-                _debug( "removing resource ".$fullName );
+                $this->log->debug( "removing resource ".$fullName );
 				if( File::isReadable( $fullName)) {
 					$result = File::delete( $fullName );
 				}
@@ -347,13 +347,13 @@
 				// and now if preview images are available, remove them too!
 				if( $resource->hasPreview()) {
 					// delete the small thumbnail
-					_debug( "Removing preview!" );
+					$this->log->debug( "Removing preview!" );
 					$previewFile = $resource->getPreviewFileName();
 					if( File::isReadable( $previewFile ))
 						File::delete( $previewFile );
 						
 					// and the medium-sized thumbnail
-					_debug( "Removing medium-size preview!");
+					$this->log->debug( "Removing medium-size preview!");
 					$medPreviewFile = $resource->getMediumSizePreviewFileName();
 					if( File::isReadable( $medPreviewFile ))
 						File::delete( $medPreviewFile );

Modified: plog/trunk/class/gallery/resizers/gallerygdresizer.class.php
===================================================================
--- plog/trunk/class/gallery/resizers/gallerygdresizer.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/gallery/resizers/gallerygdresizer.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -160,22 +160,22 @@
             // say that gd2 is not available
             $config =& Config::getConfig();
             if( $config->getValue( "thumbnail_generator_force_use_gd1" )) {
-                _debug("Forcing GD1");
+                $this->log->debug("Forcing GD1");
                 return false;
             }
             
             // if not, we still check in case the user made a mistake...
             $testGD = get_extension_funcs("gd"); // Grab function list
             if ( !$testGD ) { 
-                _debug("There is no GD installed!");
+                $this->log->debug("There is no GD installed!");
                 return false;
             }
             if (in_array ("imagegd2",$testGD)) {
-                _debug("Using GD2");
+                $this->log->debug("Using GD2");
                 return true;
             }
             else { 
-                _debug("Using GD1");
+                $this->log->debug("Using GD1");
                 return false; 
             }
         }
@@ -194,11 +194,11 @@
                                    $resample = GD_RESIZER_NO_SMOOTHING_MODE ) {
            $pxls = intval($src_w / $dst_w)-1;
 		   if( $resample == GD_RESIZER_PHP_IMAGECOPYRESAMPLED ) {
-				_debug("Using ImageCopyResapmled!");
+				$this->log->debug("Using ImageCopyResapmled!");
 				imagecopyresampled($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);				
 		   }
            elseif( $resample == GD_RESIZER_BILINEAR_MODE  ) { //slow but better quality
-                _debug( "Using Bi-linear filter!" );
+                $this->log->debug( "Using Bi-linear filter!" );
                 ImageTrueColorToPalette( $src_img, false, 256 );
                 ImagePaletteCopy ($dst_img, $src_img);
                 $rX = $src_w / $dst_w;
@@ -222,7 +222,7 @@
                 }
            } 
            elseif ( $resample == GD_RESIZER_BICUBIC_MODE ) { // veeeeeery slow but better quality
-                    _debug( "Using Bi-cubic filter!" );
+                    $this->log->debug( "Using Bi-cubic filter!" );
                      ImagePaletteCopy ($dst_img, $src_img);
                      $rX = $src_w / $dst_w;
                      $rY = $src_h / $dst_h;
@@ -249,7 +249,7 @@
                      }
            } 
            else {
-             _debug("Using no filter!");
+             $this->log->debug("Using no filter!");
              $dst_w++; $dst_h++; //->no black border
              imagecopyresized($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
            }
@@ -263,11 +263,11 @@
 		
             //if( function_exists("imagecreatetruecolor")) {
             if( $this->isGD2Available()) {
-                _debug("using GD2");
+                $this->log->debug("using GD2");
             	$this->img["des"] = @ImageCreateTrueColor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);
             }
             else {
-                _debug("Using GD1");
+                $this->log->debug("Using GD1");
             	$this->img["des"] = @ImageCreate($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);
             }
 
@@ -301,7 +301,7 @@
 					}
 				}
 				
-			_debug("image saved?");
+			$this->log->debug("image saved?");
 
             return $result;
         }

Modified: plog/trunk/class/gallery/resizers/galleryimagemagickresizer.class.php
===================================================================
--- plog/trunk/class/gallery/resizers/galleryimagemagickresizer.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/gallery/resizers/galleryimagemagickresizer.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -24,7 +24,7 @@
 
             // run the command
         	$command = $convertPath." -geometry ".$width." x ".$height." ".$this->_image." ".$outFile;
-            //_debug( "ImageMagick resizer: ".$command );
+            //$this->log->debug( "ImageMagick resizer: ".$command );
         	$cmdOuput = system($command, $retval);
 
             // check if there was an error creating the thubmnail

Modified: plog/trunk/class/gallery/resizers/galleryresizer.class.php
===================================================================
--- plog/trunk/class/gallery/resizers/galleryresizer.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/gallery/resizers/galleryresizer.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -108,7 +108,7 @@
             if( $height == "" || $height < 0 )
             	$height = DEFAULT_THUMB_HEIGHT;
 
-            //_debug("input file = ".$this->_image."<br/>");
+            //$this->log->debug("input file = ".$this->_image."<br/>");
 
             // we can get into this 'else' if the image was not stored *or* we do not
             // wish to use the cached version
@@ -124,9 +124,9 @@
 				$fileNoExt = implode( ".", $fileParts );
 				$outFile = $fileNoExt.".".$this->_defaultOutputFormat;
 			}
-			//_debug("outfile = $outFile");
+			//$this->log->debug("outfile = $outFile");
 
-            //_debug("<br/>thumbnail::generate: width:".$width." - height: ".$height."<br/>");
+            //$this->log->debug("<br/>thumbnail::generate: width:".$width." - height: ".$height."<br/>");
             $imgThumb = $generatorClassObject->generate( $outFile, $width, $height );
 			
             return $imgThumb;

Modified: plog/trunk/class/net/linkparser.class.php
===================================================================
--- plog/trunk/class/net/linkparser.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/net/linkparser.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -49,7 +49,7 @@
         {
             $uri = $url;	
             
-            _debug( "URL = $uri - Format = ".$this->_linkFormat );
+            $this->log->debug( "URL = $uri - Format = ".$this->_linkFormat );
                 
             global $urlRewriteTags;
             $rewritecode = array_keys( $urlRewriteTags );
@@ -59,7 +59,7 @@
             $matchre = str_replace( "/", "/", $this->_linkFormat );
             $matchre = str_replace( "$", "\$", $matchre );
             $matchre = str_replace( $rewritecode, $rewritereplace, $matchre );
-            _debug("<b>matchre = $matchre</b>");            
+            $this->log->debug("<b>matchre = $matchre</b>");            
         
             // Extract the key values from the uri:
             $count = preg_match("#$matchre#",$uri,$values);
@@ -80,4 +80,4 @@
             return $result;
         }
     }
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/object/object.class.php
===================================================================
--- plog/trunk/class/object/object.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/object/object.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -22,6 +22,7 @@
 	    include_once( PLOG_CLASS_PATH."class/object/exception.class.php" );
 
     include_once( PLOG_CLASS_PATH."class/logger/log4php/LoggerManager.php" );
+    include_once( PLOG_CLASS_PATH."class/logger/LogUtil.php" );
     include_once( PLOG_CLASS_PATH."debug.php" );
 
 	/**

Modified: plog/trunk/class/plugin/pluginbase.class.php
===================================================================
--- plog/trunk/class/plugin/pluginbase.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/plugin/pluginbase.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -126,7 +126,7 @@
     	function PluginBase()
         {
         	$this->Object();
-            //_debug( "PluginBase::constructor being called!" );        	
+            //$this->log->debug( "PluginBase::constructor being called!" );        	
         }
 
         /**

Modified: plog/trunk/class/plugin/pluginmanager.class.php
===================================================================
--- plog/trunk/class/plugin/pluginmanager.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/plugin/pluginmanager.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -55,7 +55,6 @@
             $config =& Config::getConfig();
 
             // initialize the arrays used to keep track of plugins and events
-            $this->_pluginList =  Array();
             $this->_pluginEventList = Array();
 		$this->_pluginInstances = Array();
 
@@ -76,7 +75,7 @@
          */
         function setBlogInfo( &$blogInfo )
         {
-            //_debug( "Setting blog info!" );
+            //$this->log->debug( "Setting blog info!" );
             $this->_blogInfo = $blogInfo;
         }
 
@@ -87,7 +86,7 @@
          */
         function setUserInfo( &$userInfo )
         {
-            //_debug( "Setting user info!" );
+            //$this->log->debug( "Setting user info!" );
             $this->_userInfo = $userInfo;
         }
 
@@ -163,7 +162,7 @@
                        die();
                     }
 
-                   //_debug( "Registering plugin $name with class $className from file $pluginFile" );
+                   //$this->log->debug( "Registering plugin $name with class $className from file $pluginFile" );
                    if( $this->_pluginList["$name"] != "" ) {
                         // problem! somebody has already registered a plugin with the same id!
                         $errorMsg = "Plugin class $className: plugin id $name is already being used!";
@@ -360,4 +359,4 @@
             return $events;
         }
     }
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/security/bayesianfilter.class.php
===================================================================
--- plog/trunk/class/security/bayesianfilter.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/security/bayesianfilter.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -48,7 +48,7 @@
         	
         	if (!$config->getValue("bayesian_filter_enabled"))
         	{
-        		//_debug( "bayesian filter is disabled<br/>");
+        		//$this->log->debug( "bayesian filter is disabled<br/>");
         		return new PipelineResult(true);
 			}
 		
@@ -56,13 +56,13 @@
             $blogInfo = $this->_pipelineRequest->getBlogInfo();
             $request  = $this->_pipelineRequest->getHttpRequest();
 
-        	//_debug( "processing bayesian filter...<br/>");
+        	//$this->log->debug( "processing bayesian filter...<br/>");
 			
             // we only have to filter the contents if the user is posting a comment
             // so there's no point in doing anything else if that's not the case
             if( $request->getValue( "op" ) != "AddComment" ) {
             	$result = new PipelineResult();
-                //_debug( "nothing to filter!<br/>");
+                //$this->log->debug( "nothing to filter!<br/>");
                 return $result;
             }
             
@@ -94,11 +94,11 @@
                     $comments->addComment( $commentTopic, $commentText, $articleId, $parentId,
                                            $userName, $userEmail, $userUrl,
                                            $clientIp, true );
-                    //_debug("comment has been kept in the database marked as spam!<br/>");
+                    //$this->log->debug("comment has been kept in the database marked as spam!<br/>");
                 }
                 else {
                 	// nothing to do here, simply throw the comment away
-                    //_debug("comment has been thrown away!<br/>");
+                    //$this->log->debug("comment has been thrown away!<br/>");
                 }
 				$spam = true;
             }
@@ -109,7 +109,7 @@
             }
 			
 			// train the filter with the message, be it spam or not...
-			//_debug("training the filter with spam = $spam<br/>");
+			//$this->log->debug("training the filter with spam = $spam<br/>");
 			BayesianFilterCore::train( $blogInfo->getId(), $commentTopic, $commentText, $userName, $userEmail,
 			                           $userUrl, $spam );
 
@@ -154,7 +154,7 @@
             
             foreach ($tokens as $token)
             {
-				//_debug("updating occurrences for token $token<br/>");
+				//$this->log->debug("updating occurrences for token $token<br/>");
             	$bayesianTokens->updateOccurrences($blogId, $token, 0, 0, $totalSpam, $totalNonSpam, false);
             }
             

Modified: plog/trunk/class/summary/action/summarydefaultaction.class.php
===================================================================
--- plog/trunk/class/summary/action/summarydefaultaction.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/summary/action/summarydefaultaction.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -4,6 +4,7 @@
     include_once( PLOG_CLASS_PATH."class/summary/dao/summarystats.class.php" );
     include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
     include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+    include_once( PLOG_CLASS_PATH."class/logger/LogUtil.php" );
 
      /**
       * This is the one and only default action. It simply fetches all the most recent
@@ -35,6 +36,7 @@
 			
             $blogs       = new Blogs();
             $stats       = new SummaryStats();
+            $this->log->debug("stats is ".$stats);
 
             // load the posts, filtering out all those registration messages...
 			$registerTopic = $this->_locale->tr( "register_default_article_topic" );
@@ -48,9 +50,6 @@
             $commentedPosts = $stats->getMostCommentedArticles( $this->_numPosts, $registerTopic, $registerText );
             $readestBlogs   = $stats->getMostReadArticles( $this->_numPosts, $registerTopic, $registerText );
 
-            if( !$recentPosts ) {
-				$recentPosts = Array();
-            }
 			
 			// export all these things to the view
 			$this->_view->setValue( "posts", $recentPosts );
@@ -72,4 +71,4 @@
             return true;
         }
      }
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/summary/action/summarysetnewpassword.class.php
===================================================================
--- plog/trunk/class/summary/action/summarysetnewpassword.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/summary/action/summarysetnewpassword.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -28,7 +28,7 @@
 			// check that the parameters are there...
 			$val = new StringValidator();
 			if( !$val->validate( $this->_userNameHash ) || !$val->validate( $this->_requestHash )) {
-				_debug("1");			
+				$this->log->debug("1");			
 				$this->_view = new SummaryView( "error" );
 				$this->_view->setValue( "message",  $this->_locale->tr("error_incorrect_request" ));
 				$this->_view->setValue( "locale", $this->_locale );
@@ -59,4 +59,4 @@
 			return true;
 		}
 	}
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/summary/action/summaryupdatepassword.class.php
===================================================================
--- plog/trunk/class/summary/action/summaryupdatepassword.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/summary/action/summaryupdatepassword.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -27,7 +27,7 @@
 			// check that the parameters are there...
 			$val = new StringValidator();
 			if( !$val->validate( $this->_userNameHash ) || !$val->validate( $this->_requestHash )) {
-				_debug("1");			
+				$this->log->debug("1");			
 				$this->_view = new SummaryView( "error" );
 				$this->_view->setValue( "message",  $this->_locale->tr("error_incorrect_request" ));
 				$this->_view->setValue( "locale", $this->_locale );
@@ -36,7 +36,7 @@
 			
 			// check if the passwords are correct and are the same
 			if( !$val->validate( $this->_newPassword ) || !$val->validate( $this->_retypeNewPassword )) {
-				_debug("2");			
+				$this->log->debug("2");			
 				$this->_view = new SummaryView( "error" );
 				$message = $this->_locale->tr("error_passwords_do_not_match" )."<br/><br/>";
 				$message .= "<a href=\"javascript:history.go(-1);\">".$this->_locale->tr("back")."</a>";
@@ -75,4 +75,4 @@
 			return true;
 		}	
 	}
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/summary/view/summarycachedview.class.php
===================================================================
--- plog/trunk/class/summary/view/summarycachedview.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/summary/view/summarycachedview.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -39,10 +39,10 @@
 		{
 			foreach( $this->_data as $key => $value )
 			$cacheId .= "$key=$value";
-			_debug("cacheId pre-md5 = ".$cacheId);
+			$this->log->debug("cacheId pre-md5 = ".$cacheId);
 			$cacheId = md5($cacheId);
 			
-			_debug("MD5(cacheId) = $cacheId" );
+			$this->log->debug("MD5(cacheId) = $cacheId" );
 			
 			return $cacheId;
 		}
@@ -54,10 +54,10 @@
 		
 		function isCached()
 		{
-			_debug("checking if ".$this->_templateName." is cached -- cacheId = ".$this->_viewId );
+			$this->log->debug("checking if ".$this->_templateName." is cached -- cacheId = ".$this->_viewId );
 			$isCached = $this->_template->isCached( $this->_viewId );
 			
-			_debug("isCached = $isCached");
+			$this->log->debug("isCached = $isCached");
 			
 			return $isCached;
 		}
@@ -83,7 +83,7 @@
 			if( $config->getValue( "template_http_cache_enabled" )) {
 				// some debug information
 				$timestamp = $this->_template->getCreationTimestamp();
-				_debug("cache creation timestamp: ".$timestamp);
+				$this->log->debug("cache creation timestamp: ".$timestamp);
 				// and now send the correct headers
 				if( HttpCache::httpConditional( $timestamp ))
 					$sendOutput = false;
@@ -100,4 +100,4 @@
 			}
         }
     }
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/template/cachecontrol.class.php
===================================================================
--- plog/trunk/class/template/cachecontrol.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/template/cachecontrol.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -22,7 +22,7 @@
 		 */
 		function resetAllCaches()
 		{
-			_debug("ALL CACHES EMPTIED!" );
+			$this->log->debug("ALL CACHES EMPTIED!" );
 			
 			// get a list of all the blogs
 			$blogs = new Blogs();
@@ -60,7 +60,7 @@
 			
 			$t->clear_cache( null );
 			
-			_debug( "SUMMARY CACHE EMPTIED!" );
+			$this->log->debug( "SUMMARY CACHE EMPTIED!" );
 			
 			return true;		
 		}
@@ -94,7 +94,7 @@
 			
 			$t->clear_cache( null );
 			
-			_debug( "CACHE FOR BLOG $blogId EMPTIED!" );
+			$this->log->debug( "CACHE FOR BLOG $blogId EMPTIED!" );
 			
 			// we need to clear the contents of the summary caches because we have added or removed
 			// posts or done something that might affect the summary!
@@ -103,4 +103,4 @@
 			return true;
 		}
 	}
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/template/cachedtemplate.class.php
===================================================================
--- plog/trunk/class/template/cachedtemplate.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/template/cachedtemplate.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -52,7 +52,7 @@
 		 */
 		function isCached( $cacheId )
 		{
-			_debug("checking if ".$this->_templateFile." is cached! (2) -- cacheId = $cacheId" );
+			$this->log->debug("checking if ".$this->_templateFile." is cached! (2) -- cacheId = $cacheId" );
 			$isCached = $this->is_cached( $this->_templateFile, $cacheId );
 			
 			return $isCached;

Modified: plog/trunk/class/template/smarty/plugins/function.debug.php
===================================================================
--- plog/trunk/class/template/smarty/plugins/function.debug.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/template/smarty/plugins/function.debug.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -21,7 +21,7 @@
  * @param Smarty
  * @return string output from {@link Smarty::_generate_debug_output()}
  */
-function smarty_function_debug($params, &$smarty)
+function smarty_function$this->log->debug($params, &$smarty)
 {
     if($params['output']) {
         $smarty->assign('_smarty_debug_output',$params['output']);

Modified: plog/trunk/class/template/template.class.php
===================================================================
--- plog/trunk/class/template/template.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/template/template.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -9,6 +9,13 @@
     include_once( PLOG_CLASS_PATH.'class/config/config.class.php' );
 
     /**
+     * path to the configuration file for log4php. This needs to be done *before* we
+     * even include the LoggerManage from log4php
+     */
+    define( LOG4PHP_CONFIGURATION, PLOG_CLASS_PATH."config/log4php.properties" ); 
+    include_once( PLOG_CLASS_PATH."class/logger/log4php/LoggerManager.php" );
+
+    /**
      * Wrapper around the Smarty class, inspired by the article
      * http://zend.com/zend/tut/tutorial-stump.php
      *
@@ -21,6 +28,9 @@
 	{
 
 		var $_templateFile;
+        
+        // logger object
+        var $log;
 
     	/**
          * Constructor. By default, activates the security mode of Smarty,
@@ -33,6 +43,9 @@
          */
 		function Template( $templateFile )
         {
+			// initialize logging
+			$this->log =& LoggerManager::getLogger( get_class($this));
+
         	// create the Smarty object and set the security values
 			$this->Smarty();
             $this->caching = false;

Modified: plog/trunk/class/template/templateservice.class.php
===================================================================
--- plog/trunk/class/template/templateservice.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/template/templateservice.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -219,7 +219,7 @@
 			else { 
 				$blogTmpFolder = $tmpFolder.'/'.$blogInfo->getId();
 				if( !File::isDir( $blogTmpFolder )) {
-					_debug( "creating temporary folder $blogTmpFolder" );
+					$this->log->debug( "creating temporary folder $blogTmpFolder" );
 					File::createDir( $blogTmpFolder );
 				}
 			}

Modified: plog/trunk/class/view/resourceserverview.class.php
===================================================================
--- plog/trunk/class/view/resourceserverview.class.php	2004-12-10 02:39:01 UTC (rev 460)
+++ plog/trunk/class/view/resourceserverview.class.php	2004-12-10 07:59:23 UTC (rev 461)
@@ -69,7 +69,7 @@
 			$config =& Config::getConfig();
 			$useCaching = $config->getValue( 'resource_server_http_cache_enabled' );
 			if( $useCaching ) {
-				_debug( "Using HTTP caching for resources!" );
+				$this->log->debug( "Using HTTP caching for resources!" );
 				// send the "Last-Modified" header
 				$resDate = $this->_resource->getTimestamp();
 				$lastModified = $resDate->getDate( DATE_FORMAT_UNIXTIME );




More information about the pLog-svn mailing list