Index: trunk/core/kernel/application.php =================================================================== diff -u -r1674 -r1677 --- trunk/core/kernel/application.php (.../application.php) (revision 1674) +++ trunk/core/kernel/application.php (.../application.php) (revision 1677) @@ -165,8 +165,6 @@ if( !$this->GetVar('m_theme') ) $this->SetVar('m_theme', $this->GetDefaultThemeId() ); $this->SetVar('theme.current_id', $this->GetVar('m_theme') ); - if ( $this->GetVar('m_cat_id') === false ) $this->SetVar('m_cat_id', 3); //need to rewrite - if( !$this->RecallVar('UserGroups') ) { $this->StoreVar('UserGroups', $this->ConfigValue('User_GuestGroup')); @@ -1275,17 +1273,24 @@ function CheckPermission($name, $cat_id = null) { - if(!$cat_id) + if( !isset($cat_id) ) { $cat_id = $this->GetVar('m_cat_id'); } - $sql = 'SELECT ParentPath FROM '.$this->getUnitOption('c', 'TableName').' - WHERE CategoryId = '.$cat_id; - $cat_hierarchy = $this->DB->GetOne($sql); - $cat_hierarchy = explode('|', $cat_hierarchy); - array_shift($cat_hierarchy); - array_pop($cat_hierarchy); - $cat_hierarchy = array_reverse($cat_hierarchy); + if( $cat_id == 0 ) + { + $cat_hierarchy = Array(0); + } + else + { + $sql = 'SELECT ParentPath FROM '.$this->getUnitOption('c', 'TableName').' WHERE CategoryId = '.$cat_id; + $cat_hierarchy = $this->DB->GetOne($sql); + $cat_hierarchy = explode('|', $cat_hierarchy); + array_shift($cat_hierarchy); + array_pop($cat_hierarchy); + $cat_hierarchy = array_reverse($cat_hierarchy); + array_push($cat_hierarchy, 0); + } $groups = $this->RecallVar('UserGroups'); @@ -1296,7 +1301,7 @@ AND CatId = '.$category_id.' AND GroupId IN ('.$groups.')'; $res = $this->DB->GetOne($sql); - if( $res !== false ) + if($res !== false) { return $res; }