[pLog-svn] r2808 - plog/trunk/class/dao
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Tue Jan 17 20:30:49 GMT 2006
Author: oscar
Date: 2006-01-17 20:30:49 +0000 (Tue, 17 Jan 2006)
New Revision: 2808
Modified:
plog/trunk/class/dao/blogs.class.php
Log:
Added some checks for our own security.
Modified: plog/trunk/class/dao/blogs.class.php
===================================================================
--- plog/trunk/class/dao/blogs.class.php 2006-01-17 20:30:36 UTC (rev 2807)
+++ plog/trunk/class/dao/blogs.class.php 2006-01-17 20:30:49 UTC (rev 2808)
@@ -71,17 +71,21 @@
if( $prevVersion->getBlogCategoryId() != $blog->getBlogCategoryId()) {
// remove one item from the old category
$oldCategory = $prevVersion->getBlogCategory();
- if( $prevVersion->getStatus() == BLOG_STATUS_ACTIVE )
- $oldCategory->setNumActiveBlogs( $oldCategory->getNumActiveBlogs() - 1 );
- elseif( $prevVersion->getStatus() == BLOG_STATUS_DISABLED )
- $oldCategory->setNumBlogs( $oldCategory->getNumBlogs() + 1 );
+ if( $oldCategory ) {
+ if( $prevVersion->getStatus() == BLOG_STATUS_ACTIVE )
+ $oldCategory->setNumActiveBlogs( $oldCategory->getNumActiveBlogs() - 1 );
+ elseif( $prevVersion->getStatus() == BLOG_STATUS_DISABLED )
+ $oldCategory->setNumBlogs( $oldCategory->getNumBlogs() + 1 );
+ }
// add one item to the new one
$newCategory = $blog->getBlogCategory();
- if( $blog->getStatus() == BLOG_STATUS_ACTIVE )
- $newCategory->setNumActiveBlogs( $newCategory->getNumActiveBlogs() - 1 );
- elseif( $blog->getStatus() == BLOG_STATUS_DISABLED )
- $newCategory->setNumBlogs( $newCategory->getNumBlogs() + 1 );
+ if( $newCategory ) {
+ if( $blog->getStatus() == BLOG_STATUS_ACTIVE )
+ $newCategory->setNumActiveBlogs( $newCategory->getNumActiveBlogs() - 1 );
+ elseif( $blog->getStatus() == BLOG_STATUS_DISABLED )
+ $newCategory->setNumBlogs( $newCategory->getNumBlogs() + 1 );
+ }
// finally, update the categories
include_once( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );
More information about the pLog-svn
mailing list