Index: trunk/core/units/users/users_syncronize.php =================================================================== diff -u -N -r3576 -r3834 --- trunk/core/units/users/users_syncronize.php (.../users_syncronize.php) (revision 3576) +++ trunk/core/units/users/users_syncronize.php (.../users_syncronize.php) (revision 3834) @@ -65,7 +65,8 @@ */ function &makeClass($skip_class) { - return new UsersSyncronizeManager($skip_class); + $sync_manager = new UsersSyncronizeManager($skip_class); + return $sync_manager; } } Index: trunk/kernel/units/users/users_syncronize.php =================================================================== diff -u -N -r3576 -r3834 --- trunk/kernel/units/users/users_syncronize.php (.../users_syncronize.php) (revision 3576) +++ trunk/kernel/units/users/users_syncronize.php (.../users_syncronize.php) (revision 3834) @@ -65,7 +65,8 @@ */ function &makeClass($skip_class) { - return new UsersSyncronizeManager($skip_class); + $sync_manager = new UsersSyncronizeManager($skip_class); + return $sync_manager; } } Index: trunk/kernel/units/users/users_event_handler.php =================================================================== diff -u -N -r3799 -r3834 --- trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 3799) +++ trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 3834) @@ -68,6 +68,10 @@ $this->Application->SetVar('u_id', $user_id); $this->Application->StoreVar('user_id', $user_id); $this->Application->setVisitField('PortalUserId', $user_id); + + $this_login = (int)$object->getPersistantVar('ThisLogin'); + $object->setPersistantVar('LastLogin', $this_login); + $object->setPersistantVar('ThisLogin', adodb_mktime()); } else { Index: trunk/globals.php =================================================================== diff -u -N -r3830 -r3834 --- trunk/globals.php (.../globals.php) (revision 3830) +++ trunk/globals.php (.../globals.php) (revision 3834) @@ -534,7 +534,7 @@ if ($datestamp <= 0) return ''; $formats = Array( 'month' => 'm', 'day' => 'd', 'year' => 'Y', - 'time_24hr' => 'H:i', 'time_12hr' => 'g:i a', 'time' => GetTimeFormat() ); + 'time_24hr' => 'H:i', 'time_12hr' => 'g:i a', 'time' => GetTimeFormat(), 'date' => GetDateFormat() ); $format = isset($formats[$part]) ? $formats[$part] : $part; return adodb_date($format, $datestamp); Index: trunk/core/kernel/utility/http_query.php =================================================================== diff -u -N -r3822 -r3834 --- trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 3822) +++ trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 3834) @@ -278,18 +278,17 @@ } } - function finalizeParsing($passed, $module_params = Array() ) + function finalizeParsing($passed = Array(), $module_params = Array() ) { - if( !is_array($passed) ) $passed = explode(',', $passed); - $prev_passed = $this->Get('passed'); - if($prev_passed) - { - $prev_passed = explode(',', $prev_passed); - $passed = array_unique( array_merge($passed, $prev_passed) ); + if ($passed) { + $event_manger =& $this->Application->recallObject('EventManager'); + foreach ($passed as $passed_prefix) { + $event_manger->setQueryMap($passed_prefix); + } } - $passed = implode(',', $passed); - $this->Set('passed', $passed); - + + // get joined version (env var + mod rewrite parsed) + $passed = $this->Application->GetVar('passed'); $env = $this->Application->BuildEnv( $this->Get('t'), $module_params, $passed, false, false ); $this->Set(ENV_VAR_NAME, $env); $_REQUEST['env'] = $_GET['env'] = $env; // for capability with old in-portal code @@ -496,20 +495,16 @@ // pass params left to module $this->Application->Phrases->Init('phrases'); - $passed = Array('m'); $module_params = Array(); - - if( isset($module_prefix) ) - { + if ( isset($module_prefix) ) { $passed[] = $module_prefix; $module_event = new kEvent($module_prefix.':ParseEnv', Array('url_parts' => $url_parts) ); $this->Application->HandleEvent($module_event); $item_id = $this->Get($module_prefix.'_id'); $module_params = Array($module_prefix.'_id' => $item_id ? $item_id : '0' ); - if($module_event->status == erFAIL) - { + if ($module_event->status == erFAIL) { $not_found = $this->Application->ConfigValue('ErrorTemplate'); $this->Set('t', $not_found ? $not_found : 'error_notfound' ); } @@ -599,30 +594,19 @@ } $prefix_special = array_shift($mixed_part); // l.pick, l - list($prefix) = explode('.', $prefix_special); - - $query_maps[$prefix_special] = $this->Application->getUnitOption($prefix,'QueryString'); - + $query_map = $event_manger->setQueryMap($prefix_special); + // if config is not defined for prefix in QueryString, then don't process it - if( $query_maps[$prefix_special] ) - { - array_push($passed, $prefix); - foreach($query_maps[$prefix_special] as $index => $var_name) + if ($query_map) { + foreach($query_map as $index => $var_name) { // l_id, l_page, l_bla-bla-bla $val = $mixed_part[$index - 1]; if ($val == '') $val = false; $this->Set($prefix_special.'_'.$var_name, $val); } } - else - { - unset($query_maps[$prefix_special]); - } - } - $this->Set('passed', implode(',', $passed) ); - $event_manger->setQueryMaps($query_maps); } } else Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u -N -r3799 -r3834 --- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 3799) +++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 3834) @@ -68,6 +68,10 @@ $this->Application->SetVar('u_id', $user_id); $this->Application->StoreVar('user_id', $user_id); $this->Application->setVisitField('PortalUserId', $user_id); + + $this_login = (int)$object->getPersistantVar('ThisLogin'); + $object->setPersistantVar('LastLogin', $this_login); + $object->setPersistantVar('ThisLogin', adodb_mktime()); } else { Index: trunk/core/units/users/users_item.php =================================================================== diff -u -N -r3576 -r3834 --- trunk/core/units/users/users_item.php (.../users_item.php) (revision 3576) +++ trunk/core/units/users/users_item.php (.../users_item.php) (revision 3834) @@ -2,7 +2,8 @@ class UsersItem extends kDBItem { var $CustomFields = Array(); - + var $persistantVars = Array(); + function Init($prefix, $special, $event_params = null) { parent::Init($prefix, $special, $event_params); @@ -56,6 +57,30 @@ return true; } + function LoadPersistantVars() + { + $sql = 'SELECT VariableValue, VariableName + FROM '.TABLE_PREFIX.'PersistantSessionData + WHERE PortalUserId = '.$this->GetID(); + $this->persistantVars = $this->Conn->GetCol($sql, 'VariableName'); + } + + function setPersistantVar($var_name, $var_value) + { + $this->persistantVars[$var_name] = $var_value; + + $replace_hash = Array( 'PortalUserId' => $this->GetID(), + 'VariableName' => $var_name, + 'VariableValue' => $var_value + ); + $this->Conn->doInsert($replace_hash, TABLE_PREFIX.'PersistantSessionData', 'REPLACE'); + } + + function getPersistantVar($var_name) + { + return getArrayValue($this->persistantVars, $var_name); + } + function UpdateCustomFields() { $data_table = TABLE_PREFIX.'CustomMetaData'; @@ -91,6 +116,7 @@ if($ret) { $this->LoadCustomFields(); + $this->LoadPersistantVars(); } return $ret; } Index: trunk/kernel/units/users/users_item.php =================================================================== diff -u -N -r3576 -r3834 --- trunk/kernel/units/users/users_item.php (.../users_item.php) (revision 3576) +++ trunk/kernel/units/users/users_item.php (.../users_item.php) (revision 3834) @@ -2,7 +2,8 @@ class UsersItem extends kDBItem { var $CustomFields = Array(); - + var $persistantVars = Array(); + function Init($prefix, $special, $event_params = null) { parent::Init($prefix, $special, $event_params); @@ -56,6 +57,30 @@ return true; } + function LoadPersistantVars() + { + $sql = 'SELECT VariableValue, VariableName + FROM '.TABLE_PREFIX.'PersistantSessionData + WHERE PortalUserId = '.$this->GetID(); + $this->persistantVars = $this->Conn->GetCol($sql, 'VariableName'); + } + + function setPersistantVar($var_name, $var_value) + { + $this->persistantVars[$var_name] = $var_value; + + $replace_hash = Array( 'PortalUserId' => $this->GetID(), + 'VariableName' => $var_name, + 'VariableValue' => $var_value + ); + $this->Conn->doInsert($replace_hash, TABLE_PREFIX.'PersistantSessionData', 'REPLACE'); + } + + function getPersistantVar($var_name) + { + return getArrayValue($this->persistantVars, $var_name); + } + function UpdateCustomFields() { $data_table = TABLE_PREFIX.'CustomMetaData'; @@ -91,6 +116,7 @@ if($ret) { $this->LoadCustomFields(); + $this->LoadPersistantVars(); } return $ret; } Index: trunk/core/kernel/event_handler.php =================================================================== diff -u -N -r3236 -r3834 --- trunk/core/kernel/event_handler.php (.../event_handler.php) (revision 3236) +++ trunk/core/kernel/event_handler.php (.../event_handler.php) (revision 3834) @@ -153,7 +153,12 @@ $pass_events = $event->getEventParam('pass_events'); $query_vars = $this->Application->getUnitOption($event->Prefix, 'QueryString'); -// unset( $query_vars[ array_search('event', $query_vars) ] ); + + $event_key = array_search('event', $query_vars); + if ($event_key) { + unset($query_vars[$event_key]); + } + //if pass events is off and event is not implicity passed if ( !$pass_events && !isset($url_params[$prefix_special.'_event']) ) { @@ -249,7 +254,6 @@ { $event->status = erFAIL; } - } } Index: trunk/kernel/units/themes/themes_tag_processor.php =================================================================== diff -u -N -r2600 -r3834 --- trunk/kernel/units/themes/themes_tag_processor.php (.../themes_tag_processor.php) (revision 2600) +++ trunk/kernel/units/themes/themes_tag_processor.php (.../themes_tag_processor.php) (revision 3834) @@ -5,7 +5,11 @@ function StylesheetFile($params) { $object =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params ); - + if (!$object->GetDBField('StyleName')) { + // no stylesheet is associated with current theme + return ''; + } + $css_url = $this->Application->BaseURL('/kernel/stylesheets'); $css_path = rtrim( str_replace( $this->Application->BaseURL(), FULL_PATH.'/', $css_url), '/' ); Index: trunk/core/kernel/event_manager.php =================================================================== diff -u -N -r3559 -r3834 --- trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 3559) +++ trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 3834) @@ -83,9 +83,29 @@ * @param Array $new_query_maps * @access public */ - function setQueryMaps($new_query_maps) + /*function setQueryMaps($new_query_maps) { $this->queryMaps = $new_query_maps; + }*/ + + /** + * Adds new query map to already parsed query maps + * + * @param string $prefix + */ + function setQueryMap($prefix_special) + { + list($prefix) = explode('.', $prefix_special); + $query_map = $this->Application->getUnitOption($prefix, 'QueryString'); + if ($query_map) { + $this->queryMaps[$prefix_special] = $query_map; + } + else { + unset($this->queryMaps[$prefix]); + } + + $this->Application->SetVar('passed', implode(',', array_keys($this->queryMaps)) ); + return $query_map; } /** @@ -175,10 +195,10 @@ // if we got $_GET type submit (links, not javascript) foreach($this->queryMaps as $prefix_special => $query_map) { - $query_map=array_flip($query_map); + $query_map = array_flip($query_map); if(isset($query_map['event'])) { - $events[$prefix_special]=$this->Application->GetVar($prefix_special.'_event'); + $events[$prefix_special] = $this->Application->GetVar($prefix_special.'_event'); } } $actions = $this->Application->GetVar('do'); Index: trunk/core/units/themes/themes_tag_processor.php =================================================================== diff -u -N -r2600 -r3834 --- trunk/core/units/themes/themes_tag_processor.php (.../themes_tag_processor.php) (revision 2600) +++ trunk/core/units/themes/themes_tag_processor.php (.../themes_tag_processor.php) (revision 3834) @@ -5,7 +5,11 @@ function StylesheetFile($params) { $object =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params ); - + if (!$object->GetDBField('StyleName')) { + // no stylesheet is associated with current theme + return ''; + } + $css_url = $this->Application->BaseURL('/kernel/stylesheets'); $css_path = rtrim( str_replace( $this->Application->BaseURL(), FULL_PATH.'/', $css_url), '/' ); Index: trunk/core/kernel/db/db_connection.php =================================================================== diff -u -N -r3576 -r3834 --- trunk/core/kernel/db/db_connection.php (.../db_connection.php) (revision 3576) +++ trunk/core/kernel/db/db_connection.php (.../db_connection.php) (revision 3834) @@ -539,7 +539,7 @@ return $this->errorMessage; } - function doInsert($fields_hash, $table) + function doInsert($fields_hash, $table, $type = 'INSERT') { $fields_sql = ''; $values_sql = ''; @@ -550,7 +550,7 @@ $fields_sql = preg_replace('/(.*),$/', '\\1', $fields_sql); $values_sql = preg_replace('/(.*),$/', '\\1', $values_sql); - $sql = 'INSERT INTO `'.$table.'` ('.$fields_sql.') VALUES ('.$values_sql.')'; + $sql = strtoupper($type).' INTO `'.$table.'` ('.$fields_sql.') VALUES ('.$values_sql.')'; return $this->ChangeQuery($sql); }