Index: trunk/core/kernel/application.php =================================================================== diff -u -r3282 -r3287 --- trunk/core/kernel/application.php (.../application.php) (revision 3282) +++ trunk/core/kernel/application.php (.../application.php) (revision 3287) @@ -61,7 +61,7 @@ * @access private */ var $ConfigHash = Array(); - + /** * Reference to debugger * @@ -83,7 +83,7 @@ * @var Array */ var $ModuleInfo = Array(); - + /** * Holds DBConnection * @@ -152,7 +152,7 @@ } return $found ? $module_info : false; } - + /** * Initializes the Application * @@ -165,12 +165,12 @@ function Init() { if($this->InitDone) return false; - + if( $this->isDebugMode() && dbg_ConstOn('DBG_PROFILE_MEMORY') ) { $this->Debugger->appendMemoryUsage('Application before Init:'); } - + if( !$this->isDebugMode() && !constOn('DBG_ZEND_PRESENT') ) { error_reporting(0); @@ -182,18 +182,18 @@ $error_handler = set_error_handler( Array(&$this,'handleError') ); if($error_handler) $this->errorHandlers[] = $error_handler; } - + $this->DB = new kDBConnection(SQL_TYPE, Array(&$this,'handleSQLError') ); $this->DB->Connect(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB); $this->DB->debugMode = $this->isDebugMode(); $this->ModuleInfo = $this->DB->Query('SELECT * FROM '.TABLE_PREFIX.'Modules ORDER BY LoadOrder', 'Name'); $this->ConfigHash = $this->DB->GetCol('SELECT VariableValue, VariableName FROM '.TABLE_PREFIX.'ConfigurationValues', 'VariableName'); - + $rewrite_on = $this->ConfigValue('UseModRewrite'); $admin_on = getArrayValue($_REQUEST, 'admin') || $this->IsAdmin(); define('MOD_REWRITE', ($rewrite_on || constOn('CMS') ) && !$admin_on ? 1 : 0); - + $this->Factory = new kFactory(); $this->registerDefaultClasses(); @@ -229,7 +229,7 @@ $this->SetVar('theme.current_id', $this->GetVar('m_theme') ); if( $this->GetVar('m_cat_id') === false ) $this->SetVar('m_cat_id', 0); $language =& $this->recallObject( 'lang.current', null, Array('live_table' => true) ); - + $this->ValidateLogin(); // TODO: write that method if( $this->isDebugMode() ) @@ -280,26 +280,26 @@ $this->SetVar('m_theme', $this->GetDefaultThemeId() ); } } - + function GetDefaultLanguageId() { static $language_id = 0; - + if($language_id > 0) return $language_id; - + $table = $this->getUnitOption('lang','TableName'); $id_field = $this->getUnitOption('lang','IDField'); $language_id = $this->DB->GetOne('SELECT '.$id_field.' FROM '.$table.' WHERE PrimaryLang = 1'); - + return $language_id; } function GetDefaultThemeId() { static $theme_id = 0; - + if($theme_id > 0) return $theme_id; - + if ( constOn('DBG_FORCE_THEME') ) { $theme_id = DBG_FORCE_THEME; @@ -340,7 +340,7 @@ $this->registerClass('Params', KERNEL_PATH.'/utility/params.php'); $this->registerClass('Params', KERNEL_PATH.'/utility/params.php', 'kFilenamesCache'); - + $this->registerClass('HTTPQuery', KERNEL_PATH.'/utility/http_query.php', 'HTTPQuery', Array('Params') ); $this->registerClass('Session', KERNEL_PATH.'/session/session.php'); @@ -373,7 +373,7 @@ $this->registerClass('TemplateParser', KERNEL_PATH.'/parser/template_parser.php'); $this->registerClass('MainProcessor', KERNEL_PATH.'/processors/main_processor.php','m_TagProcessor'); - + $this->registerClass('kMultipleFilter', KERNEL_PATH.'/utility/filters.php'); $this->registerClass('kDBList', KERNEL_PATH.'/db/dblist.php'); $this->registerClass('kDBItem', KERNEL_PATH.'/db/dbitem.php'); @@ -413,7 +413,7 @@ } return $filename; } - + /** * Defines default constants if it's not defined before - in config.php * @@ -784,7 +784,7 @@ if(!$t) $t = $this->GetVar('t'); // moved from MainProcessor->T() if( substr($t, -4) == '.tpl' ) $t = substr($t, 0, strlen($t) - 4 ); - + 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'])); @@ -831,14 +831,14 @@ $pass = isset($params['pass']) ? $params['pass'] : ''; $pass_events = isset($params['pass_events']) ? $params['pass_events'] : false; // pass events with url - + $map_link = ''; if( isset($params['anchor']) ) { $map_link = '#'.$params['anchor']; unset($params['anchor']); } - + if ( $this->RewriteURLs() ) { $session =& $this->recallObject('Session'); @@ -855,17 +855,17 @@ return $ret; } - + function BuildEnv_NEW($t, $params, $pass = 'all', $pass_events = false) { // $session =& $this->recallObject('Session'); $force_admin = getArrayValue($params,'admin') || $this->GetVar('admin'); - + // if($force_admin) $sid = $this->GetSID(); $ret = ''; $env = ''; - + $encode = false; if (isset($params['__URLENCODE__'])) { @@ -896,11 +896,11 @@ $env .= ':'.$this->BuildModuleEnv($pass_element, $params, $pass_events); } } - + $ret = trim($ret, '/').'.html'; if($env) $params[ENV_VAR_NAME] = ltrim($env, ':'); } - + unset($params['pass'], $params['opener'], $params['m_event']); if ($force_admin) $params['admin'] = 1; @@ -909,14 +909,14 @@ $ret = addslashes($ret); unset($params['escape']); } - + $params_str = ''; foreach ($params as $param => $value) { - $params_str .= '&'.$param.'='.$value; + $params_str .= '&'.$param.'='.$value; } - $ret .= preg_replace('/^&(.*)/', '?\\1', $params_str); - + $ret .= preg_replace('/^&(.*)/', '?\\1', $params_str); + if ($encode) $ret = str_replace('\\', '%5C', $ret); return $ret; } @@ -940,7 +940,7 @@ } if(!$query_vars) return ''; - + $tmp_string = Array(0 => $prefix_special); foreach($query_vars as $index => $var_name) { @@ -962,7 +962,7 @@ } return $ret; } - + function BuildEnv($t, $params, $pass='all', $pass_events=false, $env_var=true) { $session =& $this->recallObject('Session'); @@ -1007,7 +1007,7 @@ foreach ($params as $param => $value) { - $ret .= '&'.$param.'='.$value; + $ret .= '&'.$param.'='.$value; } if ($encode) $ret = str_replace('\\', '%5C', $ret); @@ -1036,7 +1036,7 @@ // pass prefixes and special from previous url $js_redirect = getArrayValue($params, 'js_redirect'); if( isset($params['js_redirect']) ) unset($params['js_redirect']); - + if (!isset($params['pass'])) $params['pass'] = 'all'; $params['__URLENCODE__'] = 1; $location = $this->HREF($t, $prefix, $params, $index_file); @@ -1308,7 +1308,7 @@ { return constOn('MOD_REWRITE'); } - + /** * Reads unit (specified by $prefix) * option specified by $option