Index: branches/unlabeled/unlabeled-1.6.2/core/install.php =================================================================== diff -u -r7025 -r7059 --- branches/unlabeled/unlabeled-1.6.2/core/install.php (.../install.php) (revision 7025) +++ branches/unlabeled/unlabeled-1.6.2/core/install.php (.../install.php) (revision 7059) @@ -92,7 +92,7 @@ * * @var Array */ - var $writeableFolders = Array ('/', '/system'); + var $writeableFolders = Array ('/system'); /** * Contains last error message text @@ -122,6 +122,9 @@ // if config.php found, then check his write permission too $this->writeableFolders[] = '/config.php'; } + else { + $this->writeableFolders[] = '/'; + } $this->systemConfig = $this->ParseConfig(true); $this->systemConfig['Misc']['WriteablePath'] = '/system'; // for development purposes @@ -150,7 +153,7 @@ if ($preset === false) { $preset = 'fresh_install'; // default preset - if (file_exists($this->INIFile)) { + if (file_exists($this->INIFile) && $this->systemConfig) { // only at installation first step $status = $this->CheckDatabase(false); if ($status && $this->AlreadyInstalled()) { @@ -321,17 +324,17 @@ // update root password in database $password = md5( md5($this->Application->GetVar('root_password')) . 'b38'); $this->SetConfigValue('RootPass', $password); - + // set Site_Path (for SSL & old in-portal code) $this->SetConfigValue('Site_Path', BASE_PATH.'/'); - + // import base language for core (english) $this->ImportLanguage('/core/install/english'); - + // set imported language as primary $lang =& $this->Application->recallObject('lang.-item', null, Array('skip_autoload' => true)); /* @var $lang LanguagesItem */ - + $lang->Load(1); // fresh install => ID=1 $lang->setPrimary(); break; @@ -345,17 +348,17 @@ include_once($install_file); } } - + // scan themes $themes_helper =& $this->Application->recallObject('ThemesHelper'); /* @var $themes_helper kThemesHelper */ - + $themes_helper->refreshThemes(); - + // update categories cache $updater =& $this->Application->recallObject('kPermCacheUpdater'); /* @var $updater kPermCacheUpdater */ - + $updater->OneStepRun(); break; } @@ -389,7 +392,7 @@ WHERE VariableName = '.$this->Conn->qstr($name); $this->Conn->Query($sql); } - + function InitApplication() { if (!in_array($this->currentStep, $this->skipApplicationSteps) && !isset($this->Application)) { @@ -433,6 +436,14 @@ { include_once FULL_PATH.'/core/kernel/db/db_connection.php'; + if (!isset($this->systemConfig['Database']['DBType']) || + !isset($this->systemConfig['Database']['DBUser']) || + !isset($this->systemConfig['Database']['DBName']) + ) { + return false; + } + + $this->Conn = new kDBConnection($this->systemConfig['Database']['DBType'], Array(&$this, 'DBErrorHandler')); $this->Conn->Connect($this->systemConfig['Database']['DBHost'], $this->systemConfig['Database']['DBUser'], $this->systemConfig['Database']['DBUserPassword'], $this->systemConfig['Database']['DBName']); return $this->Conn->errorCode == 0; @@ -498,6 +509,7 @@ } else { // was error while connecting + if (!$this->Conn) return false; $this->errorMessage = 'Connection Error: ('.$this->Conn->getErrorCode().') '.$this->Conn->getErrorMsg(); return false; }