Index: branches/5.2.x/core/install.php =================================================================== diff -u -N -r16432 -r16435 --- branches/5.2.x/core/install.php (.../install.php) (revision 16432) +++ branches/5.2.x/core/install.php (.../install.php) (revision 16435) @@ -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(); @@ -938,7 +920,7 @@ FROM ' . $theme_table . ' WHERE ' . $theme_idfield . ' = ' . $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 */ @@ -1338,14 +1320,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; @@ -1360,7 +1342,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 @@ -1377,7 +1359,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; } @@ -1452,7 +1434,7 @@ */ function TableExists($tables) { - $prefix = $this->toolkit->getSystemConfig('Database', 'TablePrefix'); + $prefix = $this->toolkit->systemConfig->get('TablePrefix', 'Database'); $all_found = true; $tables = explode(',', $tables);