Index: trunk/core/kernel/application.php =================================================================== diff -u -r3124 -r3137 --- trunk/core/kernel/application.php (.../application.php) (revision 3124) +++ trunk/core/kernel/application.php (.../application.php) (revision 3137) @@ -156,12 +156,12 @@ // 1. to read configs before doing any recallObject (called from "SetDefaultConstants" anyway) $config_reader =& $this->recallObject('kUnitConfigReader'); - + $this->VerifyLanguageId(); $this->VerifyThemeId(); - + if( $this->GetVar('m_cat_id') === false ) $this->SetVar('m_cat_id', 0); - + $this->Phrases = new PhrasesCache( $this->GetVar('m_lang') ); $this->SetVar('lang.current_id', $this->GetVar('m_lang') ); @@ -179,7 +179,7 @@ } if( !$this->RecallVar('curr_iso') ) $this->StoreVar('curr_iso', $this->GetPrimaryCurrency() ); - + $this->SetVar('visits_id', $this->RecallVar('visit_id') ); $this->ValidateLogin(); // TODO: write that method @@ -197,7 +197,7 @@ $this->InitDone = true; return true; } - + /** * Checks if passed language id if valid and sets it to primary otherwise * @@ -211,10 +211,14 @@ $id_field = $this->getUnitOption('lang','IDField'); $language_ids = $this->DB->GetCol('SELECT '.$id_field.' FROM '.$table); } - - if(!$language_id || !in_array($language_id, $language_ids) ) $this->SetVar('m_lang', $this->GetDefaultLanguageId() ); + + if(!$language_id || !in_array($language_id, $language_ids) ) { + $def_lang = $this->GetDefaultLanguageId(); + $this->SetVar('m_lang', $def_lang ); + $this->StoreVar('m_lang', $def_lang ); + } } - + /** * Checks if passed theme id if valid and sets it to primary otherwise * @@ -228,10 +232,10 @@ $id_field = $this->getUnitOption('theme','IDField'); $theme_ids = $this->DB->GetCol('SELECT '.$id_field.' FROM '.$table); } - + if(!$theme_id || !in_array($theme_id, $theme_ids) ) $this->SetVar('m_theme', $this->GetDefaultThemeId() ); } - + function GetDefaultLanguageId() { $table = $this->getUnitOption('lang','TableName'); @@ -696,7 +700,7 @@ function HREF($t, $prefix='', $params=null, $index_file=null) { if(!$t) $t = $this->GetVar('t'); // moved from MainProcessor->T() - + if ( $this->IsAdmin() && $prefix == '') $prefix='/admin'; if ( $this->IsAdmin() && $prefix == '_FRONT_END_') $prefix = ''; $index_file = isset($index_file) ? $index_file : (defined('INDEX_FILE') ? INDEX_FILE : basename($_SERVER['SCRIPT_NAME'])); @@ -887,7 +891,7 @@ { $this->Debugger->appendHTML('Apache Responce Headers'); $this->Debugger->dumpVars( apache_response_headers() ); - + $this->Debugger->appendHTML('Apache Request Headers'); $this->Debugger->dumpVars( apache_request_headers() ); }*/ @@ -927,9 +931,10 @@ */ function ReplaceLanguageTags($text, $force_escape=null) { + // !!!!!!!! return $this->Phrases->ReplaceLanguageTags($text,$force_escape); } - + /** * Checks if user is logged in, and creates * user object if so. User object can be recalled @@ -1287,8 +1292,8 @@ function NextResourceId() { $table_name = TABLE_PREFIX.'IdGenerator'; - - $this->DB->Query('LOCK TABLES '.$table_name.' WRITE'); + + $this->DB->Query('LOCK TABLES '.$table_name.' WRITE'); $this->DB->Query('UPDATE '.$table_name.' SET lastid = lastid + 1'); $id = $this->DB->GetOne('SELECT lastid FROM '.$table_name); if($id === false)