Index: branches/5.3.x/core/install/step_templates/db_config.tpl =================================================================== diff -u -N -r15931 -r15962 --- branches/5.3.x/core/install/step_templates/db_config.tpl (.../db_config.tpl) (revision 15931) +++ branches/5.3.x/core/install/step_templates/db_config.tpl (.../db_config.tpl) (revision 15962) @@ -7,7 +7,7 @@ $option_tpl = ''."\n"; foreach ($options as $option_key => $option_title) { - $selected = $option_key == $this->toolkit->getSystemConfig('Database', 'DBType') ? ' selected' : ''; + $selected = $option_key == $this->toolkit->systemConfig->get('DBType', 'Database') ? ' selected' : ''; echo sprintf($option_tpl, $option_key, $selected, $option_title); } ?> @@ -18,28 +18,28 @@ Database Hostname *: - + Database Name *: - + Database User Name *: - + Database User Password: - + @@ -51,7 +51,7 @@ $option_tpl = ''."\n"; $collations = Array ('utf8_general_ci', 'latin1_swedish_ci'); foreach ($collations as $collation) { - $selected = ($collation == $this->toolkit->getSystemConfig('Database', 'DBCollation')) ? ' selected="selected"' : ''; + $selected = ($collation == $this->toolkit->systemConfig->get('DBCollation', 'Database')) ? ' selected="selected"' : ''; echo sprintf($option_tpl, $collation, $selected); } ?> @@ -62,7 +62,7 @@ Prefix for Table Names: - + Index: branches/5.3.x/core/install/install_toolkit.php =================================================================== diff -u -N -r15928 -r15962 --- branches/5.3.x/core/install/install_toolkit.php (.../install_toolkit.php) (revision 15928) +++ branches/5.3.x/core/install/install_toolkit.php (.../install_toolkit.php) (revision 15962) @@ -1,6 +1,6 @@ defaultWritablePath = DIRECTORY_SEPARATOR . 'system'; + $this->systemConfig = new kSystemConfig(true, false); if ( class_exists('kApplication') ) { // auto-setup in case of separate module install @@ -107,10 +85,6 @@ $this->Conn =& $this->Application->GetADODBConnection(); } - - $this->INIFile = FULL_PATH . $this->defaultWritablePath . DIRECTORY_SEPARATOR . 'config.php'; - - $this->systemConfig = $this->ParseConfig(true); } /** @@ -209,14 +183,14 @@ $file_data = array_map('trim', $file_data); if ($modules_helper->verifyLicense($file_data[0])) { - $this->setSystemConfig('Intechnic', 'License', $file_data[0]); + $this->systemConfig->set('License', 'Intechnic', $file_data[0]); if (array_key_exists(1, $file_data)) { - $this->setSystemConfig('Intechnic', 'LicenseCode', $file_data[1]); + $this->systemConfig->set('LicenseCode', 'Intechnic', $file_data[1]); } else { - $this->setSystemConfig('Intechnic', 'LicenseCode'); + $this->systemConfig->set('LicenseCode', 'Intechnic'); } - $this->SaveConfig(); + $this->systemConfig->save(); } else { // invalid license received from licensing server @@ -257,7 +231,7 @@ } // get table prefix from config, because application may not be available here - $table_prefix = $this->getSystemConfig('Database', 'TablePrefix'); + $table_prefix = $this->systemConfig->get('TablePrefix', 'Database'); if ($module_name == 'kernel') { $module_name = 'in-portal'; @@ -278,7 +252,7 @@ function SetModuleRootCategory($module_name, $category_id = 0) { // get table prefix from config, because application may not be available here - $table_prefix = $this->getSystemConfig('Database', 'TablePrefix'); + $table_prefix = $this->systemConfig->get('TablePrefix', 'Database'); if ($module_name == 'kernel') { $module_name = 'in-portal'; @@ -355,11 +329,12 @@ */ function RunSQLText(&$sqls, $replace_from = null, $replace_to = null, $start_from = 0) { - $table_prefix = $this->getSystemConfig('Database', 'TablePrefix'); + $table_prefix = $this->systemConfig->get('TablePrefix', 'Database'); // add prefix to all tables if (strlen($table_prefix) > 0) { $replacements = Array ('INSERT INTO ', 'UPDATE ', 'ALTER TABLE ', 'DELETE FROM ', 'REPLACE INTO '); + foreach ($replacements as $replacement) { $sqls = str_replace($replacement, $replacement . $table_prefix, $sqls); } @@ -394,7 +369,7 @@ } $sql_count = count($sqls); - $db_collation = $this->getSystemConfig('Database', 'DBCollation'); + $db_collation = $this->systemConfig->get('DBCollation', 'Database'); for ($i = $start_from; $i < $sql_count; $i++) { $sql = $sqls[$i]; @@ -502,147 +477,14 @@ return $this->Conn->GetCol($sql, $id_field); } - function ParseConfig($parse_section = false) - { - if (!file_exists($this->INIFile)) { - return Array (); - } - - if (file_exists($this->INIFile) && !is_readable($this->INIFile)) { - die('Could Not Open Ini File'); - } - - $contents = file($this->INIFile); - - if ($contents && $contents[0] == '<' . '?' . 'php die() ?' . ">\n") { - // format of "config.php" file before 5.1.0 version - array_shift($contents); - - return $this->parseIniString(implode('', $contents), $parse_section); - } - - $_CONFIG = Array (); - require($this->INIFile); - - if ($parse_section) { - return $_CONFIG; - } - - $ret = Array (); - - foreach ($_CONFIG as $section => $section_variables) { - $ret = array_merge($ret, $section_variables); - } - - return $ret; - } - /** - * Equivalent for "parse_ini_string" function available since PHP 5.3.0 - * - * @param string $ini - * @param bool $process_sections - * @param int $scanner_mode - * @return Array - */ - function parseIniString($ini, $process_sections = false, $scanner_mode = null) - { - # Generate a temporary file. - $tempname = tempnam('/tmp', 'ini'); - $fp = fopen($tempname, 'w'); - fwrite($fp, $ini); - $ini = parse_ini_file($tempname, !empty($process_sections)); - fclose($fp); - @unlink($tempname); - - return $ini; - } - - function SaveConfig($silent = false) - { - if (!is_writable($this->INIFile) && !is_writable(dirname($this->INIFile))) { - $error_msg = 'Cannot write to "' . $this->INIFile . '" file'; - - if ($silent) { - trigger_error($error_msg, E_USER_WARNING); - } - else { - throw new Exception($error_msg); - } - - return ; - } - - $fp = fopen($this->INIFile, 'w'); - fwrite($fp, '<' . '?' . 'php' . "\n\n"); - - foreach ($this->systemConfig as $section_name => $section_data) { - foreach ($section_data as $key => $value) { - fwrite($fp, '$_CONFIG[\'' . $section_name . '\'][\'' . $key . '\'] = \'' . addslashes($value) . '\';' . "\n"); - } - - fwrite($fp, "\n"); - } - - fclose($fp); - - $this->systemConfigChanged = false; - } - - /** - * Sets value to system config (yet SaveConfig must be called to write it to file) - * - * @param string $section - * @param string $key - * @param string $value - */ - function setSystemConfig($section, $key, $value = null) - { - $this->systemConfigChanged = true; - - if (isset($value)) { - if (!array_key_exists($section, $this->systemConfig)) { - // create section, when missing - $this->systemConfig[$section] = Array (); - } - - // create key in section - $this->systemConfig[$section][$key] = $value; - return ; - } - - unset($this->systemConfig[$section][$key]); - } - - /** - * Returns information from system config - * - * @param string $section - * @param string $key - * @param mixed $default - * @return string|bool - */ - function getSystemConfig($section, $key, $default = false) - { - if ( !array_key_exists($section, $this->systemConfig) ) { - return $default; - } - - if ( !array_key_exists($key, $this->systemConfig[$section]) ) { - return $default; - } - - return isset($this->systemConfig[$section][$key]) ? $this->systemConfig[$section][$key] : $default; - } - - /** * Checks if system config is present and is not empty * * @return bool */ function systemConfigFound() { - return file_exists($this->INIFile) && $this->systemConfig; + return $this->systemConfig->exists(); } /** @@ -653,7 +495,7 @@ */ function sectionFound($section) { - return array_key_exists($section, $this->systemConfig); + return $this->systemConfig->sectionFound($section); } /** @@ -912,7 +754,7 @@ */ function deleteEditTables() { - $table_prefix = $this->getSystemConfig('Database', 'TablePrefix'); + $table_prefix = $this->systemConfig->get('TablePrefix', 'Database'); $tables = $this->Conn->GetCol('SHOW TABLES'); $mask_edit_table = '/' . $table_prefix . 'ses_(.*)_edit_(.*)/'; @@ -1124,7 +966,7 @@ public function getWorkingCacheHandlers($current = null) { if ( !isset($current) ) { - $current = $this->getSystemConfig('Misc', 'CacheHandler'); + $current = $this->systemConfig->get('CacheHandler', 'Misc'); } $cache_handler = $this->Application->makeClass('kCache'); @@ -1166,7 +1008,7 @@ public function getWorkingCompressionEngines($current = null) { if ( !isset($current) ) { - $current = $this->getSystemConfig('Misc', 'CompressionEngine'); + $current = $this->systemConfig->get('CompressionEngine', 'Misc'); } $output = shell_exec('java -version 2>&1'); Index: branches/5.3.x/core/kernel/utility/http_query.php =================================================================== diff -u -N -r15957 -r15962 --- branches/5.3.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 15957) +++ branches/5.3.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 15962) @@ -1,6 +1,6 @@ _trustProxy = isset($vars['TrustProxy']) ? (bool)$vars['TrustProxy'] : false; + $this->_trustProxy = kUtil::getSystemConfig()->get('TrustProxy'); } /** Index: branches/5.3.x/core/kernel/startup.php =================================================================== diff -u -N -r15931 -r15962 --- branches/5.3.x/core/kernel/startup.php (.../startup.php) (revision 15931) +++ branches/5.3.x/core/kernel/startup.php (.../startup.php) (revision 15962) @@ -1,6 +1,6 @@ getData(); + } + catch ( kSystemConfigException $e ) { + echo 'In-Portal is probably not installed, or configuration file is missing.
'; + echo 'Please use the installation script to fix the problem.

'; - $charset = isset($vars['WebsiteCharset']) ? $vars['WebsiteCharset'] : 'utf-8'; - define('CHARSET', $charset); + $base_path = rtrim(str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])), '/'); + echo 'Go to installation script

'; + flush(); + exit; + } - $admin_directory = isset($vars['AdminDirectory']) ? $vars['AdminDirectory'] : '/admin'; - define('ADMIN_DIRECTORY', $admin_directory); + define('CHARSET', $vars['WebsiteCharset']); + define('ADMIN_DIRECTORY', $vars['AdminDirectory']); + define('ADMIN_PRESETS_DIRECTORY', $vars['AdminPresetsDirectory']); - $admin_Presets_directory = isset($vars['AdminPresetsDirectory']) ? $vars['AdminPresetsDirectory'] : ADMIN_DIRECTORY; - define('ADMIN_PRESETS_DIRECTORY', $admin_Presets_directory); - $https_mark = getArrayValue($_SERVER, 'HTTPS'); define('PROTOCOL', ($https_mark == 'on') || ($https_mark == '1') ? 'https://' : 'http://'); @@ -58,21 +65,11 @@ define('SERVER_NAME', $http_host); - if (!$vars) { - echo 'In-Portal is probably not installed, or configuration file is missing.
'; - echo 'Please use the installation script to fix the problem.

'; - - $base_path = rtrim(preg_replace('/'.preg_quote(rtrim($admin_directory, '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); - echo 'Go to installation script

'; - flush(); - exit; - } - // variable WebsitePath is auto-detected once during installation/upgrade define('BASE_PATH', $vars['WebsitePath']); - define('APPLICATION_CLASS', isset($vars['ApplicationClass']) ? $vars['ApplicationClass'] : 'kApplication'); - define('APPLICATION_PATH', isset($vars['ApplicationPath']) ? $vars['ApplicationPath'] : '/core/kernel/application.php'); + define('APPLICATION_CLASS', $vars['ApplicationClass']); + define('APPLICATION_PATH', $vars['ApplicationPath']); if (isset($vars['WriteablePath'])) { define('WRITEABLE', FULL_PATH . $vars['WriteablePath']); @@ -113,7 +110,7 @@ define('IMAGES_PENDING_PATH', IMAGES_PATH . 'pending/'); define('MAX_UPLOAD_SIZE', min(ini_get('upload_max_filesize'), ini_get('post_max_size'))*1024*1024); - define('EDITOR_PATH', isset($vars['EditorPath']) ? $vars['EditorPath'] : '/core/ckeditor/'); + define('EDITOR_PATH', $vars['EditorPath']); // caching types define('CACHING_TYPE_NONE', 0); @@ -129,12 +126,12 @@ static public $domainsParsedRebuildTime; } - CacheSettings::$unitCacheRebuildTime = isset($vars['UnitCacheRebuildTime']) ? $vars['UnitCacheRebuildTime'] : 10; - CacheSettings::$structureTreeRebuildTime = isset($vars['StructureTreeRebuildTime']) ? $vars['StructureTreeRebuildTime'] : 10; - CacheSettings::$cmsMenuRebuildTime = isset($vars['CmsMenuRebuildTime']) ? $vars['CmsMenuRebuildTime'] : 10; - CacheSettings::$templateMappingRebuildTime = isset($vars['TemplateMappingRebuildTime']) ? $vars['TemplateMappingRebuildTime'] : 5; - CacheSettings::$sectionsParsedRebuildTime = isset($vars['SectionsParsedRebuildTime']) ? $vars['SectionsParsedRebuildTime'] : 10; - CacheSettings::$domainsParsedRebuildTime = isset($vars['DomainsParsedRebuildTime']) ? $vars['DomainsParsedRebuildTime'] : 2; + CacheSettings::$unitCacheRebuildTime = $vars['UnitCacheRebuildTime']; + CacheSettings::$structureTreeRebuildTime = $vars['StructureTreeRebuildTime']; + CacheSettings::$cmsMenuRebuildTime = $vars['CmsMenuRebuildTime']; + CacheSettings::$templateMappingRebuildTime = $vars['TemplateMappingRebuildTime']; + CacheSettings::$sectionsParsedRebuildTime = $vars['SectionsParsedRebuildTime']; + CacheSettings::$domainsParsedRebuildTime = $vars['DomainsParsedRebuildTime']; class MaintenanceMode { const NONE = 0; Index: branches/5.3.x/core/install/step_templates/select_license.tpl =================================================================== diff -u -N -r15483 -r15962 --- branches/5.3.x/core/install/step_templates/select_license.tpl (.../select_license.tpl) (revision 15483) +++ branches/5.3.x/core/install/step_templates/select_license.tpl (.../select_license.tpl) (revision 15962) @@ -1,5 +1,5 @@ toolkit->getSystemConfig('Intechnic', 'License'); + $license_found = $this->toolkit->systemConfig->get('License', 'Intechnic'); $license_source = $this->GetVar('license_source'); if ( ($license_source === false) && $license_found ) { Index: branches/5.3.x/core/install/step_templates/security.tpl =================================================================== diff -u -N -r15483 -r15962 --- branches/5.3.x/core/install/step_templates/security.tpl (.../security.tpl) (revision 15483) +++ branches/5.3.x/core/install/step_templates/security.tpl (.../security.tpl) (revision 15962) @@ -12,7 +12,7 @@ $output = ''; $write_check = true; - $check_paths = Array ('/', '/index.php', $this->toolkit->defaultWritablePath . '/config.php', ADMIN_DIRECTORY . '/index.php'); + $check_paths = Array ('/', '/index.php', $this->toolkit->systemConfig->get('WriteablePath', 'Misc') . '/config.php', ADMIN_DIRECTORY . '/index.php'); foreach ($check_paths as $check_path) { $path_secure = true; Index: branches/5.3.x/core/kernel/utility/cache.php =================================================================== diff -u -N -r15902 -r15962 --- branches/5.3.x/core/kernel/utility/cache.php (.../cache.php) (revision 15902) +++ branches/5.3.x/core/kernel/utility/cache.php (.../cache.php) (revision 15962) @@ -1,6 +1,6 @@ siteKeyName = 'site_serial:' . crc32(SQL_TYPE . '://' . SQL_USER . ':' . SQL_PASS . '@' . SQL_SERVER . ':' . TABLE_PREFIX . ':' . SQL_DB); // get cache handler class to use - $handler_class = (isset($vars['CacheHandler']) ? $vars['CacheHandler'] : '') . 'CacheHandler'; + $handler_class = kUtil::getSystemConfig()->get('CacheHandler', '') . 'CacheHandler'; // defined cache handler doesn't exist -> use default if ( !class_exists($handler_class) ) { @@ -743,8 +742,7 @@ $this->cachingType = CACHING_TYPE_MEMORY; - $vars = kUtil::getConfigVars(); - $memcached_servers = isset($vars['MemcacheServers']) ? $vars['MemcacheServers'] : $default_servers; + $memcached_servers = kUtil::getSystemConfig()->get('MemcacheServers', $default_servers); if ( $memcached_servers && class_exists('Memcache') ) { $this->_enabled = true; Index: branches/5.3.x/core/units/helpers/modules_helper.php =================================================================== diff -u -N -r15698 -r15962 --- branches/5.3.x/core/units/helpers/modules_helper.php (.../modules_helper.php) (revision 15698) +++ branches/5.3.x/core/units/helpers/modules_helper.php (.../modules_helper.php) (revision 15962) @@ -1,6 +1,6 @@ get('License') ? base64_decode($system_config->get('License')) : false; + if ($license) { list ( , , $i_Keys) = $this->_ParseLicense($license); - $domain = $this->_GetDomain($vars); + $domain = $this->_GetDomain($system_config); if (!$this->_IsLocalSite($domain)) { for ($x = 0; $x < count($i_Keys); $x++) { $key = $i_Keys[$x]; @@ -204,7 +205,7 @@ // all modules starting from "in-" doesn't require license $base_modules = Array ('Core', 'In-Portal', 'Custom'); - $modules = array_merge($modules, $base_modules, $this->_getFreeModules($vars)); + $modules = array_merge($modules, $base_modules, $this->_getFreeModules($system_config)); $modules = array_unique( array_map('strtolower', $modules) ); return $modules; @@ -213,13 +214,13 @@ /** * Get all modules, that don't require licensing * - * @param Array $vars + * @param kSystemConfig $system_config * @return Array * @access protected */ - protected function _getFreeModules($vars) + protected function _getFreeModules(kSystemConfig $system_config) { - $domain = $this->_GetDomain($vars); + $domain = $this->_GetDomain($system_config); $modules = array_map('strtolower', $this->getModules()); if ( !$this->_IsLocalSite($domain) ) { @@ -244,12 +245,12 @@ /** * Returns domain from licences (and direct in case of install script) * - * @param Array $vars + * @param kSystemConfig $system_config * @return string */ - function _GetDomain($vars) + function _GetDomain(kSystemConfig $system_config) { - return isset($vars['Domain']) ? $vars['Domain'] : SERVER_NAME; + return $system_config->get('Domain', SERVER_NAME); } function _keyED($txt, $encrypt_key) Index: branches/5.3.x/core/units/helpers/minifiers/minify_helper.php =================================================================== diff -u -N -r15928 -r15962 --- branches/5.3.x/core/units/helpers/minifiers/minify_helper.php (.../minify_helper.php) (revision 15928) +++ branches/5.3.x/core/units/helpers/minifiers/minify_helper.php (.../minify_helper.php) (revision 15962) @@ -1,6 +1,6 @@ get('CompressionEngine'); - if ( !array_key_exists('CompressionEngine', $vars) ) { + if ( !$compression_engine ) { // compression method not specified - use none return; } - switch ( $vars['CompressionEngine'] ) { + switch ( $compression_engine ) { case 'yui': $this->compressViaJava($string, $extension); break; Index: branches/5.3.x/core/kernel/utility/debugger.php =================================================================== diff -u -N -r15948 -r15962 --- branches/5.3.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 15948) +++ branches/5.3.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 15962) @@ -1,6 +1,6 @@ get('TrustProxy'); } // check IP before enabling debug mode Index: branches/5.3.x/core/install/step_templates/db_reconfig.tpl =================================================================== diff -u -N -r15931 -r15962 --- branches/5.3.x/core/install/step_templates/db_reconfig.tpl (.../db_reconfig.tpl) (revision 15931) +++ branches/5.3.x/core/install/step_templates/db_reconfig.tpl (.../db_reconfig.tpl) (revision 15962) @@ -7,7 +7,7 @@ $option_tpl = ''."\n"; foreach ($options as $option_key => $option_title) { - $selected = $option_key == $this->toolkit->getSystemConfig('Database', 'DBType') ? ' selected' : ''; + $selected = $option_key == $this->toolkit->systemConfig->get('DBType', 'Database') ? ' selected' : ''; echo sprintf($option_tpl, $option_key, $selected, $option_title); } ?> @@ -18,28 +18,28 @@ Database Hostname *: - + Database Name *: - + Database User Name *: - + Database User Password: - + @@ -51,7 +51,7 @@ $option_tpl = ''."\n"; $collations = Array ('utf8_general_ci', 'latin1_swedish_ci'); foreach ($collations as $collation) { - $selected = ($collation == $this->toolkit->getSystemConfig('Database', 'DBCollation')) ? ' selected="selected"' : ''; + $selected = ($collation == $this->toolkit->systemConfig->get('DBCollation', 'Database')) ? ' selected="selected"' : ''; echo sprintf($option_tpl, $collation, $selected); } ?> @@ -62,6 +62,6 @@ Prefix for Table Names: - + \ No newline at end of file Index: branches/5.3.x/core/install/step_templates/check_paths.tpl =================================================================== diff -u -N -r15483 -r15962 --- branches/5.3.x/core/install/step_templates/check_paths.tpl (.../check_paths.tpl) (revision 15483) +++ branches/5.3.x/core/install/step_templates/check_paths.tpl (.../check_paths.tpl) (revision 15962) @@ -8,7 +8,7 @@ toolkit->getSystemConfig('Misc', 'WriteablePath'); + $writeable_base = $this->toolkit->systemConfig->get('WriteablePath', 'Misc'); foreach ($this->writeableFolders as $folder_path) { $file_path = str_replace('$1', $writeable_base, $folder_path); if (file_exists(FULL_PATH . $file_path)) { Index: branches/5.3.x/core/install.php =================================================================== diff -u -N -r15929 -r15962 --- branches/5.3.x/core/install.php (.../install.php) (revision 15929) +++ branches/5.3.x/core/install.php (.../install.php) (revision 15962) @@ -1,6 +1,6 @@ toolkit = new kInstallToolkit(); $this->toolkit->setInstallator($this); - $this->StepDBFile = FULL_PATH.'/'.REL_PATH.'/install/steps_db.xml'; - - $base_path = rtrim(preg_replace('/'.preg_quote(rtrim(REL_PATH, '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); - $this->baseURL = 'http://'.$_SERVER['HTTP_HOST'].$base_path.'/core/install/'; - + $this->baseURL = 'http://' . $_SERVER['HTTP_HOST'] . $this->toolkit->systemConfig->get('WebsitePath', 'Misc') . '/core/install/'; set_error_handler( Array(&$this, 'ErrorHandler') ); - if (file_exists($this->toolkit->INIFile)) { + if ( $this->toolkit->systemConfigFound() ) { // if config.php found, then check his write permission too - $this->writeableFolders[] = $this->toolkit->defaultWritablePath . '/config.php'; + $this->writeableFolders[] = $this->toolkit->systemConfig->get('WriteablePath', 'Misc') . '/config.php'; } - if ( !$this->toolkit->getSystemConfig('Misc', 'WriteablePath') ) { - $this->toolkit->setSystemConfig('Misc', 'WriteablePath', $this->toolkit->defaultWritablePath); - } - - if ( !$this->toolkit->getSystemConfig('Misc', 'RestrictedPath') ) { - $this->toolkit->setSystemConfig('Misc', 'RestrictedPath', $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . DIRECTORY_SEPARATOR . '.restricted'); - } - - if ( !$this->toolkit->getSystemConfig('Misc', 'WebsitePath') ) { - $this->toolkit->setSystemConfig('Misc', 'WebsitePath', $base_path); - } - - if ( $this->toolkit->systemConfigChanged ) { - // immediately save, because this paths will be used in kApplication class later - $this->toolkit->SaveConfig(true); - } - $this->currentStep = $this->GetVar('step'); // can't check login on steps where no application present anyways :) @@ -310,7 +291,7 @@ break; case 'check_paths': - $writeable_base = $this->toolkit->getSystemConfig('Misc', 'WriteablePath'); + $writeable_base = $this->toolkit->systemConfig->get('WriteablePath', 'Misc'); foreach ($this->writeableFolders as $folder_path) { $file_path = FULL_PATH . str_replace('$1', $writeable_base, $folder_path); if (file_exists($file_path) && !is_writable($file_path)) { @@ -350,10 +331,10 @@ $submit_value = $this->GetVar($field_name); if ($submit_value !== false) { - $this->toolkit->setSystemConfig('Database', $field_name, $submit_value); + $this->toolkit->systemConfig->set($field_name, 'Database', $submit_value); } /*else { - $this->toolkit->setSystemConfig('Database', $field_name, ''); + $this->toolkit->systemConfig->set($field_name, 'Database', ''); }*/ } break; @@ -425,7 +406,7 @@ 'login' => md5($username), 'password' => md5($password), 'action' => 'check', - 'license_code' => base64_encode( $this->toolkit->getSystemConfig('Intechnic', 'LicenseCode') ), + 'license_code' => base64_encode( $this->toolkit->systemConfig->get('LicenseCode', 'Intechnic') ), 'version' => '4.3.0',//$this->toolkit->GetMaxModuleVersion('core/'), 'domain' => base64_encode($_SERVER['HTTP_HOST']), ); @@ -472,7 +453,8 @@ } $write_check = true; - $check_paths = Array ('/', '/index.php', $this->toolkit->defaultWritablePath . '/config.php', ADMIN_DIRECTORY . '/index.php'); + $check_paths = Array ('/', '/index.php', $this->toolkit->systemConfig->get('WriteablePath', 'Misc') . '/config.php', ADMIN_DIRECTORY . '/index.php'); + foreach ($check_paths as $check_path) { $path_check_status = $this->toolkit->checkWritePermissions(FULL_PATH . $check_path); @@ -542,7 +524,7 @@ $section_name = 'Database'; $required_fields = Array ('DBType', 'DBHost', 'DBName', 'DBUser', 'DBCollation'); foreach ($required_fields as $required_field) { - if (!$this->toolkit->getSystemConfig($section_name, $required_field)) { + if (!$this->toolkit->systemConfig->get($required_field, $section_name)) { $status = false; $this->errorMessage = 'Please fill all required fields'; break; @@ -629,16 +611,16 @@ case 'db_reconfig': // store db configuration $sql = 'SHOW COLLATION - LIKE \''.$this->toolkit->getSystemConfig('Database', 'DBCollation').'\''; + LIKE \''.$this->toolkit->systemConfig->get('DBCollation', 'Database').'\''; $collation_info = $this->Conn->Query($sql); if ($collation_info) { - $this->toolkit->setSystemConfig('Database', 'DBCharset', $collation_info[0]['Charset']); + $this->toolkit->systemConfig->set('DBCharset', 'Database', $collation_info[0]['Charset']); // database is already connected, that's why set collation on the fly - $this->Conn->Query('SET NAMES \''.$this->toolkit->getSystemConfig('Database', 'DBCharset').'\' COLLATE \''.$this->toolkit->getSystemConfig('Database', 'DBCollation').'\''); + $this->Conn->Query('SET NAMES \''.$this->toolkit->systemConfig->get('DBCharset', 'Database').'\' COLLATE \''.$this->toolkit->systemConfig->get('DBCollation', 'Database').'\''); } - $this->toolkit->SaveConfig(); + $this->toolkit->systemConfig->save(); if ($this->currentStep == 'db_config') { if ($this->GetVar('UseExistingSetup')) { @@ -652,7 +634,7 @@ $this->toolkit->RunSQL('/core/install/install_data.sql'); // create category using sql, because Application is not available here - $table_name = $this->toolkit->getSystemConfig('Database', 'TablePrefix') . 'IdGenerator'; + $table_name = $this->toolkit->systemConfig->get('TablePrefix', 'Database') . 'IdGenerator'; $this->Conn->Query('UPDATE ' . $table_name . ' SET lastid = lastid + 1'); $resource_id = $this->Conn->GetOne('SELECT lastid FROM ' . $table_name); if ($resource_id === false) { @@ -667,7 +649,7 @@ 'ResourceId' => $resource_id - 1, 'l1_Description' => 'Content', 'Status' => 4, ); - $this->Conn->doInsert($fields_hash, $this->toolkit->getSystemConfig('Database', 'TablePrefix') . 'Categories'); + $this->Conn->doInsert($fields_hash, $this->toolkit->systemConfig->get('TablePrefix', 'Database') . 'Categories'); $this->toolkit->SetModuleRootCategory('Core', $this->Conn->getInsertID()); @@ -696,9 +678,9 @@ /* @var $modules_helper kModulesHelper */ if ($modules_helper->verifyLicense($file_data[1])) { - $this->toolkit->setSystemConfig('Intechnic', 'License', $file_data[1]); - $this->toolkit->setSystemConfig('Intechnic', 'LicenseCode', $file_data[2]); - $this->toolkit->SaveConfig(); + $this->toolkit->systemConfig->set('License', 'Intechnic', $file_data[1]); + $this->toolkit->systemConfig->set('LicenseCode', 'Intechnic', $file_data[2]); + $this->toolkit->systemConfig->save(); } else { $this->errorMessage = 'Invalid License File'; @@ -710,7 +692,7 @@ break; case 3: // Use Existing License - $license_hash = $this->toolkit->getSystemConfig('Intechnic', 'License'); + $license_hash = $this->toolkit->systemConfig->get('License', 'Intechnic'); if ($license_hash) { $modules_helper = $this->Application->recallObject('ModulesHelper'); /* @var $modules_helper kModulesHelper */ @@ -728,9 +710,9 @@ case 4: // Skip License (Local Domain Installation) if ($this->toolkit->sectionFound('Intechnic')) { // remove any previous license information - $this->toolkit->setSystemConfig('Intechnic', 'License'); - $this->toolkit->setSystemConfig('Intechnic', 'LicenseCode'); - $this->toolkit->SaveConfig(); + $this->toolkit->systemConfig->set('License', 'Intechnic'); + $this->toolkit->systemConfig->set('LicenseCode', 'Intechnic'); + $this->toolkit->systemConfig->save(); } break; } @@ -819,7 +801,7 @@ // get domain name as entered by user on the form $domain = $this->GetVar('domain') == 1 ? $_SERVER['HTTP_HOST'] : str_replace(' ', '', $this->GetVar('other')); - $license_hash = $this->toolkit->getSystemConfig('Intechnic', 'License'); + $license_hash = $this->toolkit->systemConfig->get('License', 'Intechnic'); if ($license_hash) { // when license present, then extract domain from it $license_hash = base64_decode($license_hash); @@ -833,8 +815,8 @@ if ($domain != '') { if (strstr($domain, $license_domain) || $modules_helper->_IsLocalSite($domain)) { - $this->toolkit->setSystemConfig('Misc', 'Domain', $domain); - $this->toolkit->SaveConfig(); + $this->toolkit->systemConfig->set('Domain', 'Misc', $domain); + $this->toolkit->systemConfig->save(); } else { $this->errorMessage = 'Domain name entered does not match domain name in the license!'; @@ -850,11 +832,11 @@ foreach ($config_data as $section => $section_vars) { foreach ($section_vars as $var_name => $var_value) { - $this->toolkit->setSystemConfig($section, $var_name, $var_value); + $this->toolkit->systemConfig->set($var_name, $section, $var_value); } } - $this->toolkit->SaveConfig(); + $this->toolkit->systemConfig->save(); break; case 'root_password': @@ -864,8 +846,8 @@ $config_values = Array ( 'RootPass' => $password_formatter->hashPassword($this->Application->GetVar('root_password')), - 'Backup_Path' => FULL_PATH . $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . DIRECTORY_SEPARATOR . 'backupdata', - 'DefaultEmailSender' => 'portal@' . $this->toolkit->getSystemConfig('Misc', 'Domain') + 'Backup_Path' => FULL_PATH . $this->toolkit->systemConfig->get('WriteablePath', 'Misc') . DIRECTORY_SEPARATOR . 'backupdata', + 'DefaultEmailSender' => 'portal@' . $this->toolkit->systemConfig->get('Domain', 'Misc') ); $site_timezone = date_default_timezone_get(); @@ -939,7 +921,7 @@ FROM ' . $theme_table . ' WHERE ' . $theme_id_field . ' = ' . $theme_id; $theme_name = $this->Conn->GetOne($sql); - $site_path = $this->toolkit->getSystemConfig('Misc', 'WebsitePath') . '/'; + $site_path = $this->toolkit->systemConfig->get('WebsitePath','Misc') . '/'; $file_helper = $this->Application->recallObject('FileHelper'); /* @var $file_helper FileHelper */ @@ -1350,14 +1332,14 @@ $required_keys = Array ('DBType', 'DBUser', 'DBName'); foreach ($required_keys as $required_key) { - if (!$this->toolkit->getSystemConfig('Database', $required_key)) { + if (!$this->toolkit->systemConfig->get($required_key, 'Database')) { // one of required db connection settings missing -> abort connection return false; } } - $this->Conn = new kDBConnection($this->toolkit->getSystemConfig('Database', 'DBType'), Array(&$this, 'DBErrorHandler')); - $this->Conn->setup( $this->toolkit->systemConfig ); + $this->Conn = new kDBConnection($this->toolkit->systemConfig->get('DBType', 'Database'), Array(&$this, 'DBErrorHandler')); + $this->Conn->setup($this->toolkit->systemConfig->getData()); // setup toolkit too $this->toolkit->Conn =& $this->Conn; @@ -1372,7 +1354,7 @@ */ function AlreadyInstalled() { - $table_prefix = $this->toolkit->getSystemConfig('Database', 'TablePrefix'); + $table_prefix = $this->toolkit->systemConfig->get('TablePrefix', 'Database'); $settings_table = $this->TableExists('ConfigurationValues') ? 'ConfigurationValues' : 'SystemSettings'; $sql = 'SELECT VariableValue @@ -1389,7 +1371,7 @@ // 2. user has all types of permissions in database // 3. database environment settings met minimum requirements - if (mb_strlen($this->toolkit->getSystemConfig('Database', 'TablePrefix')) > 7) { + if (mb_strlen($this->toolkit->systemConfig->get('TablePrefix', 'Database')) > 7) { $this->errorMessage = 'Table prefix should not be longer than 7 characters'; return false; } @@ -1464,7 +1446,7 @@ */ function TableExists($tables) { - $prefix = $this->toolkit->getSystemConfig('Database', 'TablePrefix'); + $prefix = $this->toolkit->systemConfig->get('TablePrefix', 'Database'); $all_found = true; $tables = explode(',', $tables); Index: branches/5.3.x/core/kernel/utility/system_config.php =================================================================== diff -u -N --- branches/5.3.x/core/kernel/utility/system_config.php (revision 0) +++ branches/5.3.x/core/kernel/utility/system_config.php (revision 15962) @@ -0,0 +1,283 @@ +parseSections = $parse_section; + $this->strictMode = $strict; + $this->file = FULL_PATH . DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR . 'config.php'; + } + + /** + * Returns default config values. + * + * @return array + */ + protected function getDefaults() + { + $ret = array( + 'AdminDirectory' => '/admin', + 'AdminPresetsDirectory' => '/admin', + 'ApplicationClass' => 'kApplication', + 'ApplicationPath' => '/core/kernel/application.php', + 'CacheHandler' => 'Fake', + 'CmsMenuRebuildTime' => 10, + 'DomainsParsedRebuildTime' => 2, + 'EditorPath' => '/core/ckeditor/', + 'EnableSystemLog' => '0', + 'MemcacheServers' => 'localhost:11211', + 'CompressionEngine' => '', + 'RestrictedPath' => DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR . '.restricted', + 'SectionsParsedRebuildTime' => 5, + 'StructureTreeRebuildTime' => 10, + 'SystemLogMaxLevel' => 5, + 'TemplateMappingRebuildTime' => 5, + 'TrustProxy' => '0', + 'UnitCacheRebuildTime' => 10, + 'WebsiteCharset' => 'utf-8', + 'WebsitePath' => rtrim(preg_replace('/'.preg_quote(rtrim(defined('REL_PATH') ? REL_PATH : '', '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'), + 'WriteablePath' => DIRECTORY_SEPARATOR . 'system', + ); + + return $this->parseSections ? array('Misc' => $ret) : $ret; + } + + /** + * Parses "/system/config.php" file and writes the result to the data variable + * + * @return array + * @throws kSystemConfigException When something goes wrong. + */ + public function parse() + { + if ( !$this->exists() ) { + if ( $this->strictMode ) { + throw new kSystemConfigException(sprintf('System config at "%s" not found', $this->file)); + } + + return array(); + } + elseif ( !is_readable($this->file) ) { + throw new kSystemConfigException(sprintf('System config at "%s" could not be opened', $this->file)); + } + + $contents = file($this->file); + + if ( $contents && $contents[0] == '<' . '?' . 'php die() ?' . ">\n" ) { + // format of "config.php" file before 5.1.0 version + array_shift($contents); + + return parse_ini_string(implode('', $contents), $this->parseSections); + } + + $_CONFIG = array(); + require($this->file); + + if ( $this->parseSections ) { + if ( isset($_CONFIG['Database']['LoadBalancing']) && $_CONFIG['Database']['LoadBalancing'] ) { + require FULL_PATH . DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR . 'db_servers.php'; + } + + return $_CONFIG; + } + + $ret = array(); + + foreach ($_CONFIG as $section_variables) { + $ret = array_merge($ret, $section_variables); + } + + if ( !count($ret) && $this->strictMode ) { + throw new kSystemConfigException(sprintf('System config at "%s" could is empty', $this->file)); + } + + return $ret; + } + + /** + * Returns parsed variables from "config.php" file + * + * @return array + */ + public function getData() + { + if ( !$this->data ) { + $this->data = array_merge($this->getDefaults(), $this->parse()); + } + + return $this->data; + } + + /** + * Checks if given section is present in config. + * + * @param string $section + * + * @return boolean + */ + function sectionFound($section) + { + return $this->parseSections ? array_key_exists($section, $this->getData()) : false; + } + + /** + * Returns config value + * + * @param string $key Key name. + * @param string $section Section name. + * @param mixed $default Default value. + * + * @return string + */ + public function get($key, $section = null, $default = false) + { + $data = $this->getData(); + + if ( $this->parseSections ) { + return isset($data[$section][$key]) ? $data[$section][$key] : $default; + } + + return isset($data[$key]) ? $data[$key] : (isset($section) ? $section : $default); + } + + /** + * Checks, if a configuration file exists on disk. + * + * @return boolean + */ + public function exists() + { + return file_exists($this->file); + } + + /** + * Returns config status - is changed or not changed + * + * @return bool + */ + public function isChanged() + { + return $this->isChanged; + } + + /** + * Sets value to system config (yet saveConfig must be called to write it to file) + * + * @param string $key Key name. + * @param string $section Section name. + * @param mixed $value Value. + * + * @return void + */ + public function set($key, $section, $value = null) + { + $this->getData(); + $this->isChanged = true; + + if ( isset($value) ) { + // create section, when missing + if ( !array_key_exists($section, $this->data) ) { + $this->data[$section] = array(); + } + + // create key in section + $this->data[$section][$key] = $value; + + return; + } + + unset($this->data[$section][$key]); + } + + /** + * Saves config data to the file + * + * @param boolean $silent + * + * @return void + * @throws Exception + */ + public function save($silent = false) + { + if ( !is_writable($this->file) && !is_writable(dirname($this->file)) ) { + $error_msg = 'Cannot write to "' . $this->file . '" file'; + + if ( $silent ) { + trigger_error($error_msg, E_USER_WARNING); + + return; + } + + throw new Exception($error_msg); + } + + $fp = fopen($this->file, 'w'); + fwrite($fp, '<' . '?' . 'php' . "\n\n"); + + foreach ( $this->getData() as $section_name => $section_data ) { + foreach ( $section_data as $key => $value ) { + fwrite($fp, '$_CONFIG[\'' . $section_name . '\'][\'' . $key . '\'] = \'' . addslashes($value) . '\';' . "\n"); + } + + fwrite($fp, "\n"); + } + + fclose($fp); + + $this->isChanged = false; + } + +} + + +class kSystemConfigException extends Exception +{ + +} \ No newline at end of file Index: branches/5.3.x/core/kernel/application.php =================================================================== diff -u -N -r15957 -r15962 --- branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15957) +++ branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15962) @@ -1,6 +1,6 @@ Factory = new $factory_class(); $this->registerDefaultClasses(); - $vars = kUtil::parseConfig(true); + $system_config = new kSystemConfig(true); + $vars = $system_config->getData(); $db_class = isset($vars['Databases']) ? 'kDBLoadBalancer' : ($this->isDebugMode() ? 'kDBConnectionDebug' : 'kDBConnection'); $this->Conn = $this->Factory->makeClass($db_class, Array (SQL_TYPE, Array ($this->_logger, 'handleSQLError'))); $this->Conn->setup($vars); Index: branches/5.3.x/core/kernel/globals.php =================================================================== diff -u -N -r15902 -r15962 --- branches/5.3.x/core/kernel/globals.php (.../globals.php) (revision 15902) +++ branches/5.3.x/core/kernel/globals.php (.../globals.php) (revision 15962) @@ -1,6 +1,6 @@ \n" ) { - // format of "config.php" file before 5.1.0 version - array_shift($contents); - - return parse_ini_string(implode('', $contents), $parse_section); - } - - $_CONFIG = Array (); - require($file); - - if ( $parse_section ) { - if ( isset($_CONFIG['Database']['LoadBalancing']) && $_CONFIG['Database']['LoadBalancing'] ) { - require FULL_PATH . DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR . 'db_servers.php'; - } - - return $_CONFIG; - } - - $ret = Array (); - - foreach ($_CONFIG as $section => $section_variables) { - $ret = array_merge($ret, $section_variables); - } - - return $ret; + return $system_config; } /** - * Returns parsed variables from "config.php" file - * - * @return Array - * @access public - */ - public static function getConfigVars() - { - static $vars = NULL; - - if ( !isset($vars) ) { - $vars = self::parseConfig(); - } - - return $vars; - } - - /** * Same as "include_once", but also profiles file includes in debug mode and DBG_PROFILE_INCLUDES constant is set * * @param string $file Index: branches/5.3.x/core/install/step_templates/sys_config.tpl =================================================================== diff -u -N -r15677 -r15962 --- branches/5.3.x/core/install/step_templates/sys_config.tpl (.../sys_config.tpl) (revision 15677) +++ branches/5.3.x/core/install/step_templates/sys_config.tpl (.../sys_config.tpl) (revision 15962) @@ -1,19 +1,19 @@ Array ('type' => 'text', 'title' => 'Web Path to Installation', 'section' => 'Misc', 'required' => 1, 'default' => ''), - 'WriteablePath' => Array ('type' => 'text', 'title' => 'Path to Writable folder', 'section' => 'Misc', 'required' => 1, 'default' => '/system'), - 'RestrictedPath' => Array ('type' => 'text', 'title' => 'Path to Restricted folder', 'section' => 'Misc', 'required' => 1, 'default' => '/system/.restricted'), - 'AdminDirectory' => Array ('type' => 'text', 'title' => 'Path to Admin folder', 'section' => 'Misc', 'default' => '/admin'), - 'AdminPresetsDirectory' => Array ('type' => 'text', 'title' => 'Path to Admin Interface Presets folder', 'section' => 'Misc', 'default' => '/admin'), - 'ApplicationClass' => Array ('type' => 'text', 'title' => 'Name of Base Application Class', 'section' => 'Misc', 'default' => 'kApplication'), - 'ApplicationPath' => Array ('type' => 'text', 'title' => 'Path to Base Application Class file', 'section' => 'Misc', 'default' => '/core/kernel/application.php'), - 'CacheHandler' => Array ('type' => 'select', 'title' => 'Output Caching Engine', 'section' => 'Misc', 'default' => 'Fake'), - 'MemcacheServers' => Array ('type' => 'text', 'title' => 'Location of Memcache Servers', 'section' => 'Misc', 'default' => 'localhost:11211'), - 'CompressionEngine' => Array ('type' => 'select', 'title' => 'CSS/JS Compression Engine', 'section' => 'Misc', 'default' => ''), - 'WebsiteCharset' => Array ('type' => 'text', 'title' => 'Website Charset', 'section' => 'Misc', 'required' => 1, 'default' => 'utf-8'), - 'EnableSystemLog' => Array ('type' => 'radio', 'title' => 'Enable "System Log"', 'section' => 'Misc', 'required' => 1, 'default' => '0'), - 'SystemLogMaxLevel' => Array ('type' => 'select', 'title' => 'Highest "Log Level", that will be saved in "System Log"', 'section' => 'Misc', 'required' => 1, 'default' => '5'), - 'TrustProxy' => Array ('type' => 'radio', 'title' => 'Trust Proxy', 'section' => 'Misc', 'required' => 1, 'default' => '0'), + 'WebsitePath' => Array ('type' => 'text', 'title' => 'Web Path to Installation', 'section' => 'Misc', 'required' => 1), + 'WriteablePath' => Array ('type' => 'text', 'title' => 'Path to Writable folder', 'section' => 'Misc', 'required' => 1), + 'RestrictedPath' => Array ('type' => 'text', 'title' => 'Path to Restricted folder', 'section' => 'Misc', 'required' => 1), + 'AdminDirectory' => Array ('type' => 'text', 'title' => 'Path to Admin folder', 'section' => 'Misc'), + 'AdminPresetsDirectory' => Array ('type' => 'text', 'title' => 'Path to Admin Interface Presets folder', 'section' => 'Misc'), + 'ApplicationClass' => Array ('type' => 'text', 'title' => 'Name of Base Application Class', 'section' => 'Misc'), + 'ApplicationPath' => Array ('type' => 'text', 'title' => 'Path to Base Application Class file', 'section' => 'Misc'), + 'CacheHandler' => Array ('type' => 'select', 'title' => 'Output Caching Engine', 'section' => 'Misc'), + 'MemcacheServers' => Array ('type' => 'text', 'title' => 'Location of Memcache Servers', 'section' => 'Misc'), + 'CompressionEngine' => Array ('type' => 'select', 'title' => 'CSS/JS Compression Engine', 'section' => 'Misc'), + 'WebsiteCharset' => Array ('type' => 'text', 'title' => 'Website Charset', 'section' => 'Misc', 'required' => 1), + 'EnableSystemLog' => Array ('type' => 'radio', 'title' => 'Enable "System Log"', 'section' => 'Misc', 'required' => 1), + 'SystemLogMaxLevel' => Array ('type' => 'select', 'title' => 'Highest "Log Level", that will be saved in "System Log"', 'section' => 'Misc', 'required' => 1), + 'TrustProxy' => Array ('type' => 'radio', 'title' => 'Trust Proxy', 'section' => 'Misc', 'required' => 1), ); $settings['CacheHandler']['options'] = $this->toolkit->getWorkingCacheHandlers(); @@ -36,7 +36,7 @@ toolkit->getSystemConfig($output_params['section'], $config_var, $output_params['default']); + $config_value = $this->toolkit->systemConfig->get($config_var, $output_params['section'], ''); switch ( $output_params['type'] ) { case 'text': Index: branches/5.3.x/core/kernel/utility/logger.php =================================================================== diff -u -N -r15957 -r15962 --- branches/5.3.x/core/kernel/utility/logger.php (.../logger.php) (revision 15957) +++ branches/5.3.x/core/kernel/utility/logger.php (.../logger.php) (revision 15962) @@ -1,6 +1,6 @@ _debugMode = $this->Application->isDebugMode(); - $this->setState(isset($vars['EnableSystemLog']) ? $vars['EnableSystemLog'] : self::STATE_DISABLED); - $this->_maxLogLevel = isset($vars['SystemLogMaxLevel']) ? (int)$vars['SystemLogMaxLevel'] : self::LL_NOTICE; + $this->setState($system_config->get('EnableSystemLog', self::STATE_DISABLED)); + $this->_maxLogLevel = $system_config->get('SystemLogMaxLevel', self::LL_NOTICE); foreach ($methods_to_call as $method_to_call) { call_user_func_array(Array ($this, $method_to_call[0]), $method_to_call[1]);