Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r7855 -r8358 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 7855) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 8358) @@ -4,14 +4,20 @@ function SubCatCount($params) { - $cat_object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params); - $sql = ' SELECT COUNT(*) - 1 - FROM '.$cat_object->TableName.' - WHERE ParentPath LIKE "'.$cat_object->GetDBField('ParentPath').'%"'; - if (isset($params['today'])) { - $sql .= ' AND CreatedOn > '.(adodb_mktime()-86400); + $object =& $this->getObject($params); + + $sql = 'SELECT COUNT(*) + FROM '.$object->TableName.' + WHERE ParentPath LIKE "'.$object->GetDBField('ParentPath').'%"'; + + if (isset($params['today']) && $params['today']) { + $sql .= ' AND CreatedOn > '.(adodb_mktime() - 86400); } - return $this->Conn->GetOne($sql); + + if (!$this->Application->IsAdmin()) { + $sql .= ' AND Status = '.STATUS_ACTIVE; + } + return $this->Conn->GetOne($sql) - 1; } function IsNew($params) @@ -510,10 +516,21 @@ function IsActive($params) { - $cat_id = $this->Application->GetVar('c_id'); - $current_cat = $this->getObject($params); - $current_path = $current_cat->GetDBField('ParentPath'); + $cat_id = isset($params['cat_id']) && $params['cat_id'] ? $params['cat_id'] : false; + if ($cat_id === false) { + // category not supplied -> get current from PrintList + $cat_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + $current_cat =& $this->getObject($params); + } + else { + if ("$cat_id" == 'Root') { + $cat_id = $this->Application->findModule('Name', $params['module'], 'RootCat'); + } + $current_cat =& $this->Application->recallObject($this->Prefix.'.-c'.$cat_id, $this->Prefix, Array ('skip_autoload' => true)); + $current_cat->Load($cat_id); + } + $current_path = $current_cat->GetDBField('ParentPath'); static $parent_path = null; if (!isset($parent_path)) { $parent_path = $this->Conn->GetOne('SELECT ParentPath FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$this->Application->GetVar('m_cat_id'));