Index: branches/RC/core/units/sections/sections_config.php =================================================================== diff -u -N -r10749 -r10780 --- branches/RC/core/units/sections/sections_config.php (.../sections_config.php) (revision 10749) +++ branches/RC/core/units/sections/sections_config.php (.../sections_config.php) (revision 10780) @@ -289,6 +289,26 @@ 'SectionPrefix' => 'adm', ), + 'in-portal:backup' => Array ( + 'parent' => 'in-portal:tools', + 'icon' => 'in-portal:tool_backup', + 'label' => 'la_tab_Backup', + 'url' => Array ('t' => 'tools/backup1', 'section' => 'in-portal:configure_general', 'module' => 'In-Portal', 'pass' => 'm'), + 'permissions' => Array ('view'), + 'priority' => 2, + 'type' => stTREE, + ), + + 'in-portal:restore' => Array ( + 'parent' => 'in-portal:tools', + 'icon' => 'in-portal:tool_restore', + 'label' => 'la_tab_Restore', + 'url' => Array ('t' => 'tools/restore1', 'pass' => 'm'), + 'permissions' => Array ('view'), + 'priority' => 3, + 'type' => stTREE, + ), + 'in-portal:main_import' => Array ( 'parent' => 'in-portal:tools', 'icon' => 'in-portal:tool_import', @@ -299,5 +319,24 @@ 'type' => stTREE, ), + 'in-portal:sql_query' => Array ( + 'parent' => 'in-portal:tools', + 'icon' => 'in-portal:tool_import', + 'label' => 'la_tab_QueryDB', + 'url' => Array ('t' => 'tools/sql_query', 'pass' => 'm'), + 'permissions' => Array ('view', 'edit'), + 'priority' => 5, + 'type' => stTREE, + ), + + 'in-portal:server_info' => Array ( + 'parent' => 'in-portal:tools', + 'icon' => 'in-portal:server_info', + 'label' => 'la_tab_ServerInfo', + 'url' => Array ('t' => 'tools/server_info', 'pass' => 'm'), + 'permissions' => Array ('view'), + 'priority' => 6, + 'type' => stTREE, + ), ), ); \ No newline at end of file Index: branches/RC/core/units/admin/admin_config.php =================================================================== diff -u -N -r10749 -r10780 --- branches/RC/core/units/admin/admin_config.php (.../admin_config.php) (revision 10749) +++ branches/RC/core/units/admin/admin_config.php (.../admin_config.php) (revision 10780) @@ -1,132 +1,78 @@ 'adm', - 'ItemClass' => Array('class' => 'kDBItem','file'=>'','build_event'=>'OnItemBuild'), - 'EventHandlerClass' => Array('class' => 'AdminEventsHandler', 'file' => 'admin_events_handler.php', 'build_event' => 'OnBuild'), - 'TagProcessorClass' => Array('class' => 'AdminTagProcessor', 'file' => 'admin_tag_processor.php', 'build_event' => 'OnBuild'), + $config = Array ( + 'Prefix' => 'adm', + 'ItemClass' => Array ('class' => 'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'EventHandlerClass' => Array ('class' => 'AdminEventsHandler', 'file' => 'admin_events_handler.php', 'build_event' => 'OnBuild'), + 'TagProcessorClass' => Array ('class' => 'AdminTagProcessor', 'file' => 'admin_tag_processor.php', 'build_event' => 'OnBuild'), - 'QueryString' => Array( - 1 => 'event', - ), + 'QueryString' => Array ( + 1 => 'event', + ), - 'TitlePresets' => Array( - 'tree_root' => Array('format' => '!la_section_overview!'), + 'TitlePresets' => Array ( + 'tree_root' => Array ('format' => '!la_section_overview!'), - 'tree_reports' => Array('format' => '!la_section_overview!'), + 'tree_reports' => Array ('format' => '!la_section_overview!'), - 'tree_system' => Array('format' => '!la_section_overview!'), + 'tree_system' => Array ('format' => '!la_section_overview!'), - 'tree_tools' => Array('format' => '!la_section_overview!'), + 'tree_tools' => Array ('format' => '!la_section_overview!'), - 'system_tools' => Array('format' => '!la_title_SystemTools!'), - - 'backup' => Array('format' => '!la_performing_backup!'), - 'restore' => Array('format' => '!la_performing_restore!'), - 'server_info' => Array('format' => '!la_tab_ServerInfo!'), - 'sql_query' => Array('format' => '!la_tab_QueryDB!'), + 'system_tools' => Array ('format' => '!la_title_SystemTools!'), - 'no_permissions' => Array('format' => '!la_title_NoPermissions!'), + 'backup' => Array ('format' => '!la_performing_backup!'), + 'restore' => Array ('format' => '!la_performing_restore!'), + 'server_info' => Array ('format' => '!la_tab_ServerInfo!'), + 'sql_query' => Array ('format' => '!la_tab_QueryDB!'), - 'column_picker' => Array('format' => '!la_title_ColumnPicker!'), - 'csv_export' => Array('format' => '!la_title_CSVExport!'), - 'csv_import' => Array('format' => '!la_title_CSVImport!'), - ), + 'no_permissions' => Array ('format' => '!la_title_NoPermissions!'), + 'column_picker' => Array ('format' => '!la_title_ColumnPicker!'), + 'csv_export' => Array ('format' => '!la_title_CSVExport!'), + 'csv_import' => Array ('format' => '!la_title_CSVImport!'), + ), - 'PermSection' => array('main' => 'in-portal:service'), - 'Sections' => Array( - 'in-portal:root' => Array( - 'parent' => null, - 'icon' => 'site', - 'label' => $this->Application->ConfigValue('Site_Name'), - 'url' => Array('t' => 'sections_list', 'pass' => 'm', 'pass_section' => true, 'no_amp' => 1), - 'permissions' => Array('advanced:admin_login', 'advanced:front_login'), - 'priority' => 0, - 'type' => stTREE, - 'icon_module' => 'in-portal', - ), - 'in-portal:service' => Array( - 'parent' => 'in-portal:tools', - 'icon' => 'conf_general', - 'label' => 'la_tab_Service', - 'url' => Array('t' => 'tools/system_tools', 'pass' => 'm'), - 'permissions' => Array('view'), - 'priority' => 10, - 'show_mode' => smDEBUG, - 'type' => stTREE, - ), - - 'in-portal:backup' => Array ( - 'parent' => 'in-portal:tools', - 'icon' => 'in-portal:tool_backup', - 'label' => 'la_tab_Backup', - 'url' => Array ('t' => 'tools/backup1', 'pass' => 'm'), - 'permissions' => Array ('view'), - 'priority' => 2, - 'type' => stTREE, - ), - - 'in-portal:restore' => Array ( - 'parent' => 'in-portal:tools', - 'icon' => 'in-portal:tool_restore', - 'label' => 'la_tab_Restore', - 'url' => Array ('t' => 'tools/restore1', 'pass' => 'm'), - 'permissions' => Array ('view'), - 'priority' => 3, - 'type' => stTREE, - ), - - 'in-portal:sql_query' => Array ( - 'parent' => 'in-portal:tools', - 'icon' => 'in-portal:tool_import', - 'label' => 'la_tab_QueryDB', - 'url' => Array ('t' => 'tools/sql_query', 'pass' => 'm'), - 'permissions' => Array ('view', 'edit'), - 'priority' => 5, - 'type' => stTREE, - ), - - - 'in-portal:server_info' => Array ( - 'parent' => 'in-portal:tools', - 'icon' => 'in-portal:server_info', - 'label' => 'la_tab_ServerInfo', - 'url' => Array ('t' => 'tools/server_info', 'pass' => 'm'), - 'permissions' => Array ('view'), - 'priority' => 6, - 'type' => stTREE, - ), - - - 'in-portal:service' => Array( - 'parent' => 'in-portal:tools', - 'icon' => 'conf_general', - 'label' => 'la_tab_Service', - 'url' => Array('t' => 'tools/system_tools', 'pass' => 'm'), - 'permissions' => Array('view'), - 'priority' => 10, - 'show_mode' => smDEBUG, - 'type' => stTREE, - ), - ), + 'PermSection' => Array ('main' => 'in-portal:service'), - 'Fields' => Array(), // we need empty array because kernel doesn't use virtual fields else - 'VirtualFields' => Array ( - 'ImportFile' => Array ( - 'type' => 'string', - 'formatter' => 'kUploadFormatter', 'max_size' => MAX_UPLOAD_SIZE, // in Bytes ! - 'error_msgs' => Array ( - 'cant_open_file' => '!la_error_CantOpenFile!', - 'no_matching_columns' => '!la_error_NoMatchingColumns!', - ), - 'file_types' => '*.csv', 'files_description' => '!la_CSVFiles!', - 'upload_dir' => '/system/import/', // relative to project's home - 'multiple' => false, 'direct_links' => false, - 'default' => null, - ), - ), - ); + 'Sections' => Array ( + 'in-portal:root' => Array ( + 'parent' => null, + 'icon' => 'site', + 'label' => $this->Application->ConfigValue('Site_Name'), + 'url' => Array ('t' => 'sections_list', 'pass' => 'm', 'pass_section' => true, 'no_amp' => 1), + 'permissions' => Array ('advanced:admin_login', 'advanced:front_login'), + 'priority' => 0, + 'type' => stTREE, + 'icon_module' => 'in-portal', + ), -?> \ No newline at end of file + 'in-portal:service' => Array ( + 'parent' => 'in-portal:tools', + 'icon' => 'conf_general', + 'label' => 'la_tab_Service', + 'url' => Array ('t' => 'tools/system_tools', 'pass' => 'm'), + 'permissions' => Array ('view'), + 'priority' => 10, + 'show_mode' => smDEBUG, + 'type' => stTREE, + ), + ), + + 'Fields' => Array (), // we need empty array because kernel doesn't use virtual fields else + 'VirtualFields' => Array ( + 'ImportFile' => Array ( + 'type' => 'string', + 'formatter' => 'kUploadFormatter', 'max_size' => MAX_UPLOAD_SIZE, // in Bytes ! + 'error_msgs' => Array ( + 'cant_open_file' => '!la_error_CantOpenFile!', + 'no_matching_columns' => '!la_error_NoMatchingColumns!', + ), + 'file_types' => '*.csv', 'files_description' => '!la_CSVFiles!', + 'upload_dir' => '/system/import/', // relative to project's home + 'multiple' => false, 'direct_links' => false, + 'default' => null, + ), + ), + ); Index: branches/RC/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r10653 -r10780 --- branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 10653) +++ branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 10780) @@ -1778,6 +1778,16 @@ } /** + * Occures after list is queried + * + * @param kEvent $event + */ + function OnAfterListQuery(&$event) + { + + } + + /** * Ensures that popup will be closed automatically * and parent window will be refreshed with template * passed @@ -2139,6 +2149,14 @@ if ($event->status == erSUCCESS) { $this->Application->SetVar('m_lang', $this->Application->GetVar('language')); + + $pass_vars = Array ('st_id', 'cms_id'); + foreach ($pass_vars as $pass_var) { + $data = $this->Application->GetVar($pass_var); + if ($data) { + $event->SetRedirectParam($pass_var, $data); + } + } } } Index: branches/RC/core/units/categories/categories_item.php =================================================================== diff -u -N -r10098 -r10780 --- branches/RC/core/units/categories/categories_item.php (.../categories_item.php) (revision 10098) +++ branches/RC/core/units/categories/categories_item.php (.../categories_item.php) (revision 10780) @@ -88,12 +88,8 @@ if(!$filename) return $filename; $item_id = !$this->GetID() ? 0 : $this->GetID(); + $check_in_parent_cat_only = $item_id ? ' AND ParentId = '.$this->GetDBField("ParentId") : ''; - if ($item_id) { - $parent_cat_id = $this->GetDBField("ParentId"); - $check_in_parent_cat_only = ' AND ParentId = '.$parent_cat_id; - } - // check temp table $sql_temp = 'SELECT '.$this->IDField.' FROM '.$this->TableName.' WHERE Filename = '.$this->Conn->qstr($filename).$check_in_parent_cat_only; $found_temp_ids = $this->Conn->GetCol($sql_temp); Index: branches/RC/core/units/general/helpers/controls/edit_picker_helper.php =================================================================== diff -u -N -r10528 -r10780 --- branches/RC/core/units/general/helpers/controls/edit_picker_helper.php (.../edit_picker_helper.php) (revision 10528) +++ branches/RC/core/units/general/helpers/controls/edit_picker_helper.php (.../edit_picker_helper.php) (revision 10780) @@ -75,6 +75,8 @@ function SaveValues(&$sub_event, $store_field, $sub_prefix_field) { $main_object =& $sub_event->MasterEvent->getObject(); + /* @var $main_object kDBItem */ + $affected_field = $main_object->GetDBField($store_field); $object =& $this->Application->recallObject($sub_event->getPrefixSpecial(), null, Array('skip_autoload' => true)); @@ -95,7 +97,7 @@ $records_to_add = array_diff($new_values, $old_values); $records_to_delete = array_diff($old_values, $new_values); - if ($records_to_delete) { + if ($records_to_delete && $main_object->Loaded) { $where_clause = Array ( $foreign_key . ' = ' . $main_object->GetID(), $sub_prefix_field . ' IN (' . implode(',', $records_to_delete) . ')', Index: branches/RC/kernel/units/sections/sections_config.php =================================================================== diff -u -N -r10749 -r10780 --- branches/RC/kernel/units/sections/sections_config.php (.../sections_config.php) (revision 10749) +++ branches/RC/kernel/units/sections/sections_config.php (.../sections_config.php) (revision 10780) @@ -289,6 +289,26 @@ 'SectionPrefix' => 'adm', ), + 'in-portal:backup' => Array ( + 'parent' => 'in-portal:tools', + 'icon' => 'in-portal:tool_backup', + 'label' => 'la_tab_Backup', + 'url' => Array ('t' => 'tools/backup1', 'section' => 'in-portal:configure_general', 'module' => 'In-Portal', 'pass' => 'm'), + 'permissions' => Array ('view'), + 'priority' => 2, + 'type' => stTREE, + ), + + 'in-portal:restore' => Array ( + 'parent' => 'in-portal:tools', + 'icon' => 'in-portal:tool_restore', + 'label' => 'la_tab_Restore', + 'url' => Array ('t' => 'tools/restore1', 'pass' => 'm'), + 'permissions' => Array ('view'), + 'priority' => 3, + 'type' => stTREE, + ), + 'in-portal:main_import' => Array ( 'parent' => 'in-portal:tools', 'icon' => 'in-portal:tool_import', @@ -299,5 +319,24 @@ 'type' => stTREE, ), + 'in-portal:sql_query' => Array ( + 'parent' => 'in-portal:tools', + 'icon' => 'in-portal:tool_import', + 'label' => 'la_tab_QueryDB', + 'url' => Array ('t' => 'tools/sql_query', 'pass' => 'm'), + 'permissions' => Array ('view', 'edit'), + 'priority' => 5, + 'type' => stTREE, + ), + + 'in-portal:server_info' => Array ( + 'parent' => 'in-portal:tools', + 'icon' => 'in-portal:server_info', + 'label' => 'la_tab_ServerInfo', + 'url' => Array ('t' => 'tools/server_info', 'pass' => 'm'), + 'permissions' => Array ('view'), + 'priority' => 6, + 'type' => stTREE, + ), ), ); \ No newline at end of file Index: branches/RC/core/units/admin/admin_events_handler.php =================================================================== diff -u -N -r10751 -r10780 --- branches/RC/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 10751) +++ branches/RC/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 10780) @@ -14,7 +14,7 @@ 'OnGetCSV' => Array('self' => true), 'OnCSVImportBegin' => Array('self' => true), 'OnCSVImportStep' => Array('self' => true), - 'OnDropTempTablesByWID' => array('self' => true), + 'OnDropTempTablesByWID' => Array('self' => true), ); $this->permMapping = array_merge($this->permMapping, $permissions); } @@ -36,6 +36,23 @@ return true; } + $tools_events = Array ( + 'OnBackup' => 'in-portal:backup.view', + 'OnBackupProgress' => 'in-portal:backup.view', + 'OnDeleteBackup' => 'in-portal:backup.view', + 'OnBackupCancel' => 'in-portal:backup.view', + + 'OnRestore' => 'in-portal:restore.view', + 'OnRestoreProgress' => 'in-portal:restore.view', + 'OnRestoreCancel' => 'in-portal:backup.view', + + 'OnSqlQuery' => 'in-portal:sql_query.view', + ); + + if (array_key_exists($event->Name, $tools_events)) { + return $this->Application->CheckPermission($tools_events[$event->Name]); + } + return parent::CheckPermission($event); } Index: branches/RC/core/admin_templates/tools/restore2.tpl =================================================================== diff -u -N -r10739 -r10780 --- branches/RC/core/admin_templates/tools/restore2.tpl (.../restore2.tpl) (revision 10739) +++ branches/RC/core/admin_templates/tools/restore2.tpl (.../restore2.tpl) (revision 10780) @@ -65,17 +65,17 @@ "> - + - "> - - - ( M) - - + "> + + + ( M) + + Index: branches/RC/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r10709 -r10780 --- branches/RC/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 10709) +++ branches/RC/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 10780) @@ -325,8 +325,12 @@ } $rel_table = $this->Application->getUnitOption('rel', 'TableName'); - $item_type = $this->Application->getUnitOption($event->Prefix, 'ItemType'); + $item_type = (int)$this->Application->getUnitOption($event->Prefix, 'ItemType'); + if ($item_type == 0) { + trigger_error('ItemType not defined for prefix ' . $event->Prefix . '', E_USER_WARNING); + } + // process case, then this list is called inside another list $prefix_special = $event->getEventParam('PrefixSpecial'); if (!$prefix_special) { Index: branches/RC/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r10671 -r10780 --- branches/RC/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 10671) +++ branches/RC/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 10780) @@ -224,8 +224,12 @@ } $rel_table = $this->Application->getUnitOption('rel', 'TableName'); - $item_type = $this->Application->getUnitOption($event->Prefix, 'ItemType'); + $item_type = (int)$this->Application->getUnitOption($event->Prefix, 'ItemType'); + if ($item_type == 0) { + trigger_error('ItemType not defined for prefix ' . $event->Prefix . '', E_USER_WARNING); + } + // process case, then this list is called inside another list $prefix_special = $event->getEventParam('PrefixSpecial'); if (!$prefix_special) { Index: branches/RC/core/admin_templates/tools/restore4.tpl =================================================================== diff -u -N -r10721 -r10780 --- branches/RC/core/admin_templates/tools/restore4.tpl (.../restore4.tpl) (revision 10721) +++ branches/RC/core/admin_templates/tools/restore4.tpl (.../restore4.tpl) (revision 10780) @@ -61,9 +61,9 @@ "> - + - + Index: branches/RC/core/kernel/db/dblist.php =================================================================== diff -u -N -r10660 -r10780 --- branches/RC/core/kernel/db/dblist.php (.../dblist.php) (revision 10660) +++ branches/RC/core/kernel/db/dblist.php (.../dblist.php) (revision 10780) @@ -367,9 +367,25 @@ return false; } $this->Queried = true; + + $query_event = new kEvent($this->getPrefixSpecial() . ':OnAfterListQuery'); + $this->Application->HandleEvent($query_event); + return true; } + /** + * Adds one more record to list virtually and updates all counters + * + * @param Array $record + */ + function addRecord($record) + { + $this->Records[] = $record; + $this->SelectedCount++; + $this->RecordsCount++; + } + function CalculateTotals() { $this->Totals = Array(); Index: branches/RC/core/kernel/session/session.php =================================================================== diff -u -N -r10591 -r10780 --- branches/RC/core/kernel/session/session.php (.../session.php) (revision 10591) +++ branches/RC/core/kernel/session/session.php (.../session.php) (revision 10780) @@ -245,7 +245,9 @@ WHERE '.$this->IDField.' = '.$sessionlog_table.'.SessionId ) WHERE Status = 0 AND SessionId IN ('.join(',', $expired_sids).')'; - $this->Conn->Query($session_log_sql); + if ($sessionlog_table) { + $this->Conn->Query($session_log_sql); + } $where_clause = ' WHERE '.$this->IDField.' IN ("'.implode('","',$expired_sids).'")'; $sql = 'DELETE FROM '.$this->SessionDataTable.$where_clause; @@ -395,6 +397,8 @@ var $Expiration; var $SID; + + var $SessionSet = false; /** * Enter description here... @@ -405,7 +409,19 @@ var $CachedNeedQueryString = null; + /** + * Session Data array + * + * @var Params + */ var $Data; + + /** + * Names of optional session keys (which does not need to be always stored + * + * @var array + */ + var $OptionalData = array(); function Session($mode=smAUTO) @@ -464,19 +480,8 @@ $this->Data = new Params(); $tmp_sid = $this->GetPassedSIDValue(); -// if (!$tmp_sid) return; $check = $this->Check(); - if( !(defined('IS_INSTALL') && IS_INSTALL) ) - { - $expired_sids = $this->DeleteExpired(); - if ( ( $expired_sids && in_array($tmp_sid,$expired_sids) ) || ( $tmp_sid && !$check ) ) { - $this->SetSession(); - $this->Application->HandleEvent($event, 'u:OnSessionExpire'); - return ; - } - } - if ($check) { $this->SID = $this->GetPassedSIDValue(); $this->Refresh(); @@ -488,6 +493,21 @@ if (!is_null($this->OriginalMode)) $this->SetMode($this->OriginalMode); } + + function ValidateExpired() { + if( !(defined('IS_INSTALL') && IS_INSTALL) ) + { + $expired_sids = $this->DeleteExpired(); + if ( ( $expired_sids && in_array($this->CachedSID,$expired_sids) ) || ( $this->CachedSID && !$this->SessionSet ) ) { + $this->RemoveSessionCookie(); + // true was here to force new session creation, but I used RemoveCookie a line above, to avoid redirect loop with expired sid not being removed + // setSession with true was used before, to set NEW session cookie + $this->SetSession(); + $this->Application->HandleEvent($event, 'u:OnSessionExpire'); + return ; + } + } + } function IsHTTPSRedirect() { @@ -607,6 +627,8 @@ //try to load session by sid, if everything is fine $result = $this->LoadSession($sid); + $this->SessionSet = $result; + return $result; } @@ -712,10 +734,25 @@ $this->SID=$new_sid; $this->Application->SetVar($this->GETName,$new_sid); } + + function NeedSession() + { + $data = $this->Data->GetParams(); + $data_keys = array_keys($data); + $optional_keys = array_unique($this->OptionalData); + $real_keys = array_diff($data_keys, $optional_keys); + return $real_keys ? true : false; + } - function SetSession() + function SetSession($force = false) { - $this->GenerateSID(); + if ($this->SessionSet && !$force) return true; + if (!$force && !($this->Application->IsAdmin() || $this->Application->GetVar('admin')) && !$this->NeedSession()) { + $this->GenerateSID(); + return false; + } + + if (!$this->SID || $force) $this->GenerateSID(); $this->Expiration = adodb_mktime() + $this->SessionTimeout; switch ($this->Mode) { case smAUTO: @@ -742,6 +779,8 @@ } $this->Application->resetCounters('UserSession'); + $this->SessionSet = true; + return true; } /** @@ -781,6 +820,13 @@ $this->SetCookie($this->CookieName.'_live', $this->SID); $_COOKIE[$this->CookieName] = $this->SID; // for compatibility with in-portal } + + function RemoveSessionCookie() + { + $this->SetCookie($this->CookieName, ''); + $this->SetCookie($this->CookieName.'_live', ''); + $_COOKIE[$this->CookieName] = null; // for compatibility with in-portal + } /** * Refreshes session expiration time @@ -806,7 +852,7 @@ $this->Data = new Params(); $this->SID = ''; if ($this->CookiesEnabled) $this->SetSessionCookie(); //will remove the cookie due to value (sid) is empty - $this->SetSession(); //will create a new session + $this->SetSession(true); //will create a new session, true to force } function NeedQueryString($use_cache = 1) @@ -867,6 +913,9 @@ function SaveData() { + if (!$this->SetSession()) { // call it here - it may be not set before, because there was no need; if there is a need, it will be set here + return; + } if (!$this->Application->GetVar('skip_last_template') && $this->Application->GetVar('ajax') != 'yes') { $this->SaveLastTemplate( $this->Application->GetVar('t') ); } @@ -940,9 +989,12 @@ return $ret; } - function StoreVar($name, $value) + function StoreVar($name, $value, $optional = false) { $this->Data->Set($name, $value); + if ($optional) { + $this->OptionalData[] = $name; + } } function StorePersistentVar($name, $value) @@ -955,12 +1007,12 @@ $this->Storage->LoadPersistentVars($this); } - function StoreVarDefault($name, $value) + function StoreVarDefault($name, $value, $optional=false) { $tmp = $this->RecallVar($name); if($tmp === false || $tmp == '') { - $this->StoreVar($name, $value); + $this->StoreVar($name, $value, $optional); } } Index: branches/RC/core/kernel/application.php =================================================================== diff -u -N -r10779 -r10780 --- branches/RC/core/kernel/application.php (.../application.php) (revision 10779) +++ branches/RC/core/kernel/application.php (.../application.php) (revision 10780) @@ -326,6 +326,8 @@ } $this->HttpQuery->AfterInit(); + + $this->Session->ValidateExpired(); if( defined('DEBUG_MODE') && $this->isDebugMode() ) { $this->Debugger->appendTimestamp('Processed HTTPQuery AfterInit'); @@ -1148,21 +1150,21 @@ * @param string $var Variable name * @param mixed $val Variable value */ - function StoreVar($var, $val) + function StoreVar($var, $val, $optional = false) { $session =& $this->recallObject('Session'); - $this->Session->StoreVar($var, $val); + $this->Session->StoreVar($var, $val, $optional); } function StorePersistentVar($var, $val) { $this->Session->StorePersistentVar($var, $val); } - function StoreVarDefault($var, $val) + function StoreVarDefault($var, $val, $optional=false) { $session =& $this->recallObject('Session'); - $this->Session->StoreVarDefault($var, $val); + $this->Session->StoreVarDefault($var, $val, $optional); } /** @@ -1179,11 +1181,11 @@ * @param mixed $ses_var Session variable name * @param mixed $default Default variable value */ - function LinkVar($var, $ses_var = null, $default = '') + function LinkVar($var, $ses_var = null, $default = '', $optional = false) { if (!isset($ses_var)) $ses_var = $var; if ($this->GetVar($var) !== false) { - $this->StoreVar($ses_var, $this->GetVar($var)); + $this->StoreVar($ses_var, $this->GetVar($var), $optional); } else { $this->SetVar($var, $this->RecallVar($ses_var, $default));