[pLog-svn] r613 - in plog/trunk/class: action/admin dao
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Wed Dec 29 23:10:31 GMT 2004
Author: oscar
Date: 2004-12-29 23:10:30 +0000 (Wed, 29 Dec 2004)
New Revision: 613
Modified:
plog/trunk/class/action/admin/admindeletelinkcategoryaction.class.php
plog/trunk/class/dao/mylinkscategories.class.php
Log:
fixed a bug in MyLinksCategories::getNumLinksCategory, the sql query was incorrect and it was allowing users to remove categories that had links in them... Also, replaced a call to MyLinksCategories::getNumLinksCategory with MyLinksCategory::getNumLinks() in AdminDeleteLinkCategoryAction (we're actually saving one extra sql query :)))
Modified: plog/trunk/class/action/admin/admindeletelinkcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeletelinkcategoryaction.class.php 2004-12-29 22:06:02 UTC (rev 612)
+++ plog/trunk/class/action/admin/admindeletelinkcategoryaction.class.php 2004-12-29 23:10:30 UTC (rev 613)
@@ -69,8 +69,9 @@
// fetch the category
$linkCategory = $categories->getMyLinksCategory( $categoryId, $this->_blogInfo->getId());
if( $linkCategory ) {
- if( $categories->getNumMyLinksCategory( $categoryId ) > 0 ) {
- $errorMessage .= $this->_locale->pr("error_links_in_link_category",$linkCategory->getName())."<br/><br/>";
+ //if( $categories->getNumMyLinksCategory( $categoryId ) > 0 ) {
+ if( $linkCategory->getNumLinks() > 0 ) {
+ $errorMessage .= $this->_locale->pr("error_links_in_link_category",$linkCategory->getName())."<br/>";
}
else {
// if all correct, now delete it and check how it went
@@ -78,11 +79,11 @@
$errorMessage .= $this->_locale->pr("error_removing_link_category", $linkCategory->getName());
}
else
- $successMessage .= $this->_locale->pr( "link_category_deleted_ok", $linkCategory->getName())."<br/><br/>";
+ $successMessage .= $this->_locale->pr( "link_category_deleted_ok", $linkCategory->getName())."<br/>";
}
}
else {
- $errorMessage .= $this->_locale->pr("error_removing_link_category_2", $categoryId )."<br/><br/>";
+ $errorMessage .= $this->_locale->pr("error_removing_link_category_2", $categoryId )."<br/>";
}
}
@@ -98,4 +99,4 @@
return true;
}
}
-?>
+?>
\ No newline at end of file
Modified: plog/trunk/class/dao/mylinkscategories.class.php
===================================================================
--- plog/trunk/class/dao/mylinkscategories.class.php 2004-12-29 22:06:02 UTC (rev 612)
+++ plog/trunk/class/dao/mylinkscategories.class.php 2004-12-29 23:10:30 UTC (rev 613)
@@ -216,7 +216,7 @@
function getNumMyLinksCategory( $categoryId )
{
$prefix = $this->getPrefix();
- $table = "{$prefix}mylinks_categories";
+ $table = "{$prefix}mylinks";
$cond = "category_id = '".Db::qstr($categoryId)."';";
return( $this->getNumItems( $table, $cond ));
More information about the pLog-svn
mailing list