Index: branches/5.2.x/core/install.php =================================================================== diff -u -N -r13840 -r14095 --- branches/5.2.x/core/install.php (.../install.php) (revision 13840) +++ branches/5.2.x/core/install.php (.../install.php) (revision 14095) @@ -1,6 +1,6 @@ Application->GetVar('next_preset'); if ($next_preset !== false) { - if ($this->Application->GetVar('login') == 'root') { - // verify "root" user using configuration settings - $login_event = new kEvent('u.current:OnLogin'); - $this->Application->HandleEvent($login_event); + $user_helper =& $this->Application->recallObject('UserHelper'); + /* @var $user_helper UserHelper */ - if ($login_event->status != erSUCCESS) { - $user =& $this->Application->recallObject('u.current'); - /* @var $user UsersItem */ + $username = $this->Application->GetVar('login'); + $password = $this->Application->GetVar('password'); - $this->errorMessage = $user->GetErrorMsg('ValidateLogin') . '. If you don\'t know your username or password, contact Intechnic Support'; + if ($username == 'root') { + // verify "root" user using configuration settings + $login_result = $user_helper->loginUser($username, $password); + + if ($login_result != LoginResult::OK) { + $error_phrase = $login_result == LoginResult::NO_PERMISSION ? 'la_no_permissions' : 'la_invalid_password'; + $this->errorMessage = $this->Application->Phrase($error_phrase) . '. If you don\'t know your username or password, contact Intechnic Support'; } } else { // non "root" user -> verify using licensing server $url_params = Array ( - 'login=' . md5( $this->GetVar('login') ), - 'password=' . md5( $this->GetVar('password') ), - 'action=check', - 'license_code=' . base64_encode( $this->toolkit->getSystemConfig('Intechnic', 'LicenseCode') ), - 'version=' . '4.3.0',//$this->toolkit->GetMaxModuleVersion('core/'), - 'domain=' . base64_encode($_SERVER['HTTP_HOST']), + 'login' => md5($username), + 'password' => md5($password), + 'action' => 'check', + 'license_code' => base64_encode( $this->toolkit->getSystemConfig('Intechnic', 'LicenseCode') ), + 'version' => '4.3.0',//$this->toolkit->GetMaxModuleVersion('core/'), + 'domain' => base64_encode($_SERVER['HTTP_HOST']), ); - $license_url = GET_LICENSE_URL . '?' . implode('&', $url_params); - $file_data = curl_post($license_url, '', null, 'GET'); + $curl_helper =& $this->Application->recallObject('CurlHelper'); + /* @var $curl_helper kCurlHelper */ + $curl_helper->SetRequestData($url_params); + $file_data = $curl_helper->Send(GET_LICENSE_URL); + if (substr($file_data, 0, 5) == 'Error') { $this->errorMessage = substr($file_data, 6) . ' If you don\'t know your username or password, contact Intechnic Support'; } if ($this->errorMessage == '') { - $user_id = USER_ROOT; - $session =& $this->Application->recallObject('Session'); - $session->SetField('PortalUserId', $user_id); - $this->Application->SetVar('u.current_id', $user_id); - $this->Application->StoreVar('user_id', $user_id); + $user_helper->loginUserById(USER_ROOT); } } @@ -664,17 +666,21 @@ $license_password = $this->GetVar('password'); $license_id = $this->GetVar('licenses'); + $curl_helper =& $this->Application->recallObject('CurlHelper'); + /* @var $curl_helper kCurlHelper */ + if (strlen($license_login) && strlen($license_password) && !$license_id) { // Here we determine weather login is ok & check available licenses $url_params = Array ( - 'login=' . md5($license_login), - 'password=' . md5($license_password), - 'version=' . $this->toolkit->GetMaxModuleVersion('core/'), - 'domain=' . base64_encode($_SERVER['HTTP_HOST']), + 'login' => md5($license_login), + 'password' => md5($license_password), + 'version' => $this->toolkit->GetMaxModuleVersion('core/'), + 'domain' => base64_encode($_SERVER['HTTP_HOST']), ); - $license_url = GET_LICENSE_URL . '?' . implode('&', $url_params); - $file_data = curl_post($license_url, '', null, 'GET'); + $curl_helper->SetRequestData($url_params); + $file_data = $curl_helper->Send(GET_LICENSE_URL); + if (!$file_data) { // error connecting to licensing server $this->errorMessage = 'Unable to connect to the Intechnic server! Please try again later!'; @@ -705,15 +711,15 @@ else { // Here we download license $url_params = Array ( - 'license_id=' . md5($license_id), - 'dlog=' . md5($license_login), - 'dpass=' . md5($license_password), - 'version=' . $this->toolkit->GetMaxModuleVersion('core/'), - 'domain=' . base64_encode($_SERVER['HTTP_HOST']), + 'license_id' => md5($license_id), + 'dlog' => md5($license_login), + 'dpass' => md5($license_password), + 'version' => $this->toolkit->GetMaxModuleVersion('core/'), + 'domain' => base64_encode($_SERVER['HTTP_HOST']), ); - $license_url = GET_LICENSE_URL . '?' . implode('&', $url_params); - $file_data = curl_post($license_url, '', null, 'GET'); + $curl_helper->SetRequestData($url_params); + $file_data = $curl_helper->Send(GET_LICENSE_URL); if (!$file_data) { // error connecting to licensing server @@ -816,7 +822,7 @@ } // update category cache - $updater =& $this->Application->recallObject('kPermCacheUpdater'); + $updater =& $this->Application->makeClass('kPermCacheUpdater'); /* @var $updater kPermCacheUpdater */ $updater->OneStepRun(); @@ -1167,7 +1173,7 @@ { if (($force || !in_array($this->currentStep, $this->skipApplicationSteps)) && !isset($this->Application)) { // step is allowed for application usage & it was not initialized in previous step - global $start, $debugger, $dbg_options, $vars; + global $start, $debugger, $dbg_options; include_once(FULL_PATH.'/core/kernel/startup.php'); $this->Application =& kApplication::Instance(); @@ -1419,7 +1425,7 @@ 'ToVersion' => $to_version, ); - $ret[ strtolower($module_name) ] = array_merge_recursive2($module_info, $version_info); + $ret[ strtolower($module_name) ] = array_merge($module_info, $version_info); } }