Index: branches/unlabeled/unlabeled-1.55.2/core/kernel/session/session.php =================================================================== diff -u -r7657 -r7828 --- branches/unlabeled/unlabeled-1.55.2/core/kernel/session/session.php (.../session.php) (revision 7657) +++ branches/unlabeled/unlabeled-1.55.2/core/kernel/session/session.php (.../session.php) (revision 7828) @@ -366,9 +366,9 @@ $this->CookieName = $cookie_name; } - function InitStorage() + function InitStorage($special) { - $this->Storage =& $this->Application->recallObject('SessionStorage'); + $this->Storage =& $this->Application->recallObject('SessionStorage.'.$special); $this->Storage->setSessionTimeout($this->SessionTimeout); } @@ -380,7 +380,7 @@ if ($this->CookiesEnabled) $_COOKIE['cookies_on'] = 1; $this->Checkers = Array(); - $this->InitStorage(); + $this->InitStorage($special); $this->Data =& new Params(); $tmp_sid = $this->GetPassedSIDValue(); @@ -389,10 +389,10 @@ if( !(defined('IS_INSTALL') && IS_INSTALL) ) { $expired_sids = $this->DeleteExpired(); - if( ( $expired_sids && in_array($tmp_sid,$expired_sids) ) || ( $tmp_sid && !$check ) ) - { + if ( ( $expired_sids && in_array($tmp_sid,$expired_sids) ) || ( $tmp_sid && !$check ) ) { $this->SetSession(); $this->Application->HandleEvent($event, 'u:OnSessionExpire'); + return ; } } @@ -650,6 +650,15 @@ break; } $this->Storage->StoreSession($this); + + if ($this->Application->IsAdmin() || $this->Special == 'admin') { + $this->StoreVar('admin', 1); + } + + if ($this->Special != '') { + // front-session called from admin or otherwise, then save it's data + $this->SaveData(); + } } /** @@ -859,7 +868,23 @@ { return $this->Storage->DeleteExpired(); } + + /** + * Allows to check if user in this session is logged in or not + * + * @return bool + */ + function LoggedIn() + { + $user_id = $this->RecallVar('user_id'); + $ret = $user_id > 0; + if ($this->RecallVar('admin') == 1 && ($user_id == -1)) { + $ret = true; + } + return $ret; + } + } ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.82.2/core/kernel/db/db_event_handler.php =================================================================== diff -u -r7754 -r7828 --- branches/unlabeled/unlabeled-1.82.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 7754) +++ branches/unlabeled/unlabeled-1.82.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 7828) @@ -910,10 +910,10 @@ function OnCreate(&$event) { $object =& $event->getObject( Array('skip_autoload' => true) ); - + /* @var $object kDBItem */ + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); - if($items_info) - { + if ($items_info) { list($id,$field_values) = each($items_info); $object->SetFieldsFromHash($field_values); } Index: branches/unlabeled/unlabeled-1.65.2/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -r7816 -r7828 --- branches/unlabeled/unlabeled-1.65.2/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 7816) +++ branches/unlabeled/unlabeled-1.65.2/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 7828) @@ -370,6 +370,11 @@ foreach ($res as $field) { $f_name = $field['Field']; if (getArrayValue($config, 'Fields')) { + if (preg_match('/l[\d]+_[\w]/', $f_name)) { + // skip multilingual fields + continue; + } + if (!array_key_exists ($f_name, $config['Fields'])) { $debugger->appendHTML("Config Warning: Field $f_name exists in the database, but is not defined in config file for prefix ".$config['Prefix']." !"); safeDefine('DBG_RAISE_ON_WARNINGS', 1); @@ -392,10 +397,12 @@ safeDefine('DBG_RAISE_ON_WARNINGS', 1); } else if ($options['default'] != '#NOW#' && $field['Default'] !== (string)$options['default']) { - $debugger->appendHTML("Config Error: Default value for field $f_name (".$options['default'].") in config for prefix ".$config['Prefix']." differs from default value from field in database (".$field['Default'].") !"); + $debugger->appendHTML("Config Error: Default value for field $f_name (".var_export($options['default'], true).") in config for prefix ".$config['Prefix']." differs from default value from field in database (".var_export($field['Default'], true).") !"); $debugger->dumpVars($field['Default'], $options['default'], 'STRICT'); safeDefine('DBG_RAISE_ON_WARNINGS', 1); } + + // check that all idfields have default values & are not_null!!! } } Index: branches/unlabeled/unlabeled-1.71.2/core/units/users/users_event_handler.php =================================================================== diff -u -r7765 -r7828 --- branches/unlabeled/unlabeled-1.71.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 7765) +++ branches/unlabeled/unlabeled-1.71.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 7828) @@ -109,17 +109,25 @@ function OnSessionExpire() { - if( $this->Application->IsAdmin() ) { + if ($this->Application->IsAdmin()) { $this->Application->Redirect('index', Array('expired' => 1), '', 'index.php'); } - else { - $http_query =& $this->Application->recallObject('HTTPQuery'); - $get = $http_query->getRedirectParams(); - - $t = $this->Application->GetVar('t'); - $get['js_redirect'] = $this->Application->ConfigValue('UseJSRedirect'); - $this->Application->Redirect($t ? $t : 'index', $get); + + if ($this->Application->GetVar('admin') == 1) { + $session_admin =& $this->Application->recallObject('Session.admin'); + /* @var $session_admin Session */ + + if (!$session_admin->LoggedIn()) { + // front-end session created from admin session & both expired + $this->Application->DeleteVar('admin'); + $this->Application->Redirect('index', Array('expired' => 1), '', 'admin/index.php'); + } } + + $get = $this->Application->HttpQuery->getRedirectParams(); + $t = $this->Application->GetVar('t'); + $get['js_redirect'] = $this->Application->ConfigValue('UseJSRedirect'); + $this->Application->Redirect($t ? $t : 'index', $get); } /** Index: branches/unlabeled/unlabeled-1.170.2/core/kernel/application.php =================================================================== diff -u -r7781 -r7828 --- branches/unlabeled/unlabeled-1.170.2/core/kernel/application.php (.../application.php) (revision 7781) +++ branches/unlabeled/unlabeled-1.170.2/core/kernel/application.php (.../application.php) (revision 7828) @@ -1584,11 +1584,13 @@ } ob_end_flush(); + // session expiration is called from session initialization, // that's why $this->Session may be not defined here - if (is_object($this->Session)) { - $this->Session->SaveData(); - } + $session =& $this->Application->recallObject('Session'); + /* @var $session Session */ + + $session->SaveData(); exit; } @@ -2231,16 +2233,14 @@ return $event; } - + /** + * Allows to check if user in this session is logged in or not + * + * @return bool + */ function LoggedIn() { - $user_id = $this->Application->RecallVar('user_id'); - - $ret = $user_id > 0; - if ($this->IsAdmin() && ($user_id == -1)) { - $ret = true; - } - return $ret; + return $this->Session->LoggedIn(); } /**