[pLog-svn] r6852 - plog/branches/lifetype-1.2/class/template/templatesets

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sat Apr 11 14:16:41 EDT 2009


Author: jondaley
Date: 2009-04-11 14:16:41 -0400 (Sat, 11 Apr 2009)
New Revision: 6852

Modified:
   plog/branches/lifetype-1.2/class/template/templatesets/templatesets.class.php
Log:
if you screw up your config table, by setting some bad values for templates, etc. php will crash.  If you've really messed it up, you're dead anyway, but might as well put in a little error checking

Modified: plog/branches/lifetype-1.2/class/template/templatesets/templatesets.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/templatesets/templatesets.class.php	2009-04-11 17:24:13 UTC (rev 6851)
+++ plog/branches/lifetype-1.2/class/template/templatesets/templatesets.class.php	2009-04-11 18:16:41 UTC (rev 6852)
@@ -149,7 +149,7 @@
 		{
 			if( $this->isTemplate( $templateName ))
 				$templateSet = new TemplateSet( $templateName, TEMPLATE_SET_GLOBAL, 0 );
-			elseif( $this->isBlogTemplate( $templateName, $blogId ))
+			elseif( $blogId && $this->isBlogTemplate( $templateName, $blogId ))
 				$templateSet = new TemplateSet( $templateName, TEMPLATE_SET_BLOG_SPECIFIC, $blogId );
 			else {
 				$templateSet = null;
@@ -186,6 +186,9 @@
         	lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );        
         	$blogs = new Blogs();
         	$blog = $blogs->getBlogInfo( $blogId );
+            if(!$blog)
+                return false;
+            
             $blogSettings = $blog->getSettings( $blogId );
 
             // get the array with the template names stored in the settings
@@ -204,7 +207,11 @@
         function getDefaultTemplateSet()
         {
 	     	$config =& Config::getConfig();
-	     	return( $this->getTemplateSet( $config->getValue( "default_template" )));
+	     	$default_template_name = $config->getValue("default_template");
+            $default_template = $this->getTemplateSet($default_template_name);
+            if(!$default_template)
+                $default_template = $this->getTemplateSet("standard");
+            return $default_template;
         }
 	}
 ?>
\ No newline at end of file



More information about the pLog-svn mailing list