Index: trunk/core/kernel/application.php =================================================================== diff -u -r4471 -r4490 --- trunk/core/kernel/application.php (.../application.php) (revision 4471) +++ trunk/core/kernel/application.php (.../application.php) (revision 4490) @@ -940,10 +940,11 @@ */ function getPassInfo($pass = 'all') { + $pass = str_replace('all', trim($this->GetVar('passed'), ','), $pass); + if (!$pass) { return Array(); } - $pass = str_replace('all', trim($this->GetVar('passed'), ','), $pass); $pass_info = array_unique( explode(',', $pass) ); // array( prefix[.special], prefix[.special] ... sort($pass_info, SORT_STRING); // to be prefix1,prefix1.special1,prefix1.special2,prefix3.specialX @@ -1276,9 +1277,14 @@ { $session =& $this->recallObject('Session'); $user_id = $session->GetField('PortalUserId'); - if (!$user_id) $user_id = -2; + if (!$user_id && $user_id != -1) $user_id = -2; $this->SetVar('u_id', $user_id); $this->StoreVar('user_id', $user_id); + + if ($this->GetVar('expired') == 1) { + $user =& $this->recallObject('u'); + $user->SetError('ValidateLogin', 'session_expired', 'la_text_sess_expired'); + } } /** @@ -1712,21 +1718,28 @@ function LoggedIn() { $user =& $this->recallObject('u'); - return ($user->GetDBField('PortalUserId') > 0); + $user_id = $user->GetID(); + + $ret = $user_id > 0; + if ($this->IsAdmin() && ($user_id == -1)) { + $ret = true; + } + return $ret; } function CheckPermission($name, $cat_id = null) { - if( !isset($cat_id) ) - { + if ($this->GetVar('u_id') == -1 && ($name == 'ADMIN' || $name == 'LOGIN')) { + return 1; + } + + if (!isset($cat_id)) { $cat_id = $this->GetVar('m_cat_id'); } - if( $cat_id == 0 ) - { + if ($cat_id == 0) { $cat_hierarchy = Array(0); } - else - { + else { $sql = 'SELECT ParentPath FROM '.$this->getUnitOption('c', 'TableName').' WHERE CategoryId = '.$cat_id; $cat_hierarchy = $this->DB->GetOne($sql); $cat_hierarchy = explode('|', $cat_hierarchy); @@ -1738,15 +1751,13 @@ $groups = $this->RecallVar('UserGroups'); - foreach($cat_hierarchy as $category_id) - { + foreach ($cat_hierarchy as $category_id) { $sql = 'SELECT PermissionValue FROM '.TABLE_PREFIX.'Permissions WHERE Permission = "'.$name.'" AND CatId = '.$category_id.' AND GroupId IN ('.$groups.')'; $res = $this->DB->GetOne($sql); - if($res !== false) - { + if ($res !== false) { return $res; } }