Index: trunk/admin/install.php =================================================================== diff -u -N -r4590 -r4790 --- trunk/admin/install.php (.../install.php) (revision 4590) +++ trunk/admin/install.php (.../install.php) (revision 4790) @@ -161,7 +161,7 @@ //require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once ($pathtolocal."admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); - + set_cookie(SESSION_COOKIE_NAME, '', adodb_mktime() - 3600, rtrim(BASE_PATH, '/') ); } @@ -365,33 +365,36 @@ $login_err_mesg = ''; // always init vars before use if( !isset($g_License) ) $g_License = ''; $lic = base64_decode($g_License); - if(strlen($lic)) - { - a83570933e44bc66b31dd7127cf3f23a($lic); - $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); - } + if(strlen($lic)) + { + a83570933e44bc66b31dd7127cf3f23a($lic); + $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); + } - $LoggedIn = FALSE; - if($_POST["UserName"]=="root") - { - $ado =& inst_GetADODBConnection(); - $sql = "SELECT * FROM ".$g_TablePrefix."ConfigurationValues WHERE VariableName='RootPass'"; + $LoggedIn = FALSE; + if($_POST["UserName"]=="root") + { + $ado =& inst_GetADODBConnection(); + $sql = "SELECT * FROM ".$g_TablePrefix."ConfigurationValues WHERE VariableName='RootPass'"; - $rs = $ado->Execute($sql); - if($rs && !$rs->EOF) - { - $RootPass = $rs->fields["VariableValue"]; + $rs = $ado->Execute($sql); + if($rs && !$rs->EOF) + { + $RootPass = $rs->fields["VariableValue"]; - if(strlen($RootPass)>0) - $LoggedIn = ($RootPass==md5($_POST["UserPass"])); - } - } - else - { - $act = ''; - if (ConvertVersion($g_InPortal) >= ConvertVersion("1.0.5")) { - $act = 'check'; - } + if(strlen($RootPass)>0) + $LoggedIn = ($RootPass==md5($_POST["UserPass"])); + } + else { + $login_err_mesg = 'Invalid username or password'; + } + } + else + { + $act = ''; + if (ConvertVersion($g_InPortal) >= ConvertVersion("1.0.5")) { + $act = 'check'; + } $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['UserName'])."&password=".md5($_POST['UserPass'])."&action=$act&license_code=".base64_encode($g_LicenseCode)."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".base64_encode($_SERVER['HTTP_HOST']), "r"); if (!$rfile) { $login_err_mesg = "Unable to connect to the Intechnic server!"; @@ -413,79 +416,79 @@ $LoggedIn = true; } } - //$LoggedIn = ($i_User == $_POST["UserName"] && ($i_Pswd == $_POST["UserPass"]) && strlen($i_User)>0) || strlen($i_User)==0; - } + //$LoggedIn = ($i_User == $_POST["UserName"] && ($i_Pswd == $_POST["UserPass"]) && strlen($i_User)>0) || strlen($i_User)==0; + } - if($LoggedIn) - { - if (!(int)$_POST["inp_opt"]) { - $state="reinstall"; - $inst_error = "Please select one of the options above!"; - } - else { - switch((int)$_POST["inp_opt"]) - { - case 0: - $inst_error = "Please select an option above"; - break; - case 1: - /* clean out all tables */ - $install_type = 4; - $ado =& inst_GetADODBConnection(); - $filename = $pathtoroot.$admin."/install/inportal_remove.sql"; - RunSchemaFile($ado,$filename); + if($LoggedIn) + { + if (!(int)$_POST["inp_opt"]) { + $state="reinstall"; + $inst_error = "Please select one of the options above!"; + } + else { + switch((int)$_POST["inp_opt"]) + { + case 0: + $inst_error = "Please select an option above"; + break; + case 1: + /* clean out all tables */ + $install_type = 4; + $ado =& inst_GetADODBConnection(); + $filename = $pathtoroot.$admin."/install/inportal_remove.sql"; + RunSchemaFile($ado,$filename); - // removing other tables - $tables = $ado->MetaTables(); + // removing other tables + $tables = $ado->MetaTables(); - foreach($tables as $tab_name) { - if (stristr($tab_name, $g_TablePrefix."ses_")) { - $sql = "DROP TABLE IF EXISTS $tab_name"; - $ado->Execute($sql); - } - } + foreach($tables as $tab_name) { + if (stristr($tab_name, $g_TablePrefix."ses_")) { + $sql = "DROP TABLE IF EXISTS $tab_name"; + $ado->Execute($sql); + } + } - /* run install again */ - $state="license"; - break; - case 2: - $install_type = 3; - $state="dbinfo"; - break; - case 3: - $install_type = 5; - $state="license"; - break; - case 4: - $install_type = 6; - /* clean out all tables */ - $ado =& inst_GetADODBConnection(); - //$filename = $pathtoroot.$admin."/install/inportal_remove.sql"; - //RunSchemaFile($ado,$filename); - /* run install again */ - $state="restore_select"; - break; - case 5: - $install_type = 7; - /* change DB config */ - $state="db_reconfig"; - break; - case 6: - $install_type = 8; - $state = "upgrade"; - break; - case 7: - $install_type = 9; - $state = "fix_paths"; - break; - } - } - } - else - { - $state="reinstall"; - $login_error = $login_err_mesg;//"Invalid Username or Password - Try Again"; - } + /* run install again */ + $state="license"; + break; + case 2: + $install_type = 3; + $state="dbinfo"; + break; + case 3: + $install_type = 5; + $state="license"; + break; + case 4: + $install_type = 6; + /* clean out all tables */ + $ado =& inst_GetADODBConnection(); + //$filename = $pathtoroot.$admin."/install/inportal_remove.sql"; + //RunSchemaFile($ado,$filename); + /* run install again */ + $state="restore_select"; + break; + case 5: + $install_type = 7; + /* change DB config */ + $state="db_reconfig"; + break; + case 6: + $install_type = 8; + $state = "upgrade"; + break; + case 7: + $install_type = 9; + $state = "fix_paths"; + break; + } + } + } + else + { + $state="reinstall"; + $login_error = $login_err_mesg;//"Invalid Username or Password - Try Again"; + } } if ($state == "upgrade") { @@ -594,10 +597,10 @@ $rs->MoveNext(); } - + $sql = 'DELETE FROM '.$g_TablePrefix.'Cache WHERE VarName = "config_files"'; $ado->Execute($sql); - + $include_file = $pathtoroot.$admin."/install/upgrade.php"; } } @@ -608,15 +611,15 @@ define('FULL_PATH', realpath(dirname(__FILE__).'/..')); define('APPLICATION_CLASS', 'MyApplication'); } - + include_once(FULL_PATH.'/kernel/kernel4/startup.php'); $application =& kApplication::Instance(); $application->Init(); - + // force rereading of configs $unit_config_reader =& $application->recallObject('kUnitConfigReader'); - $unit_config_reader->scanModules(MODULES_PATH); - + $unit_config_reader->scanModules(MODULES_PATH); + $ado =& inst_GetADODBConnection(); $mod_arr = $_POST['modules']; @@ -704,7 +707,7 @@ $application->Init(); $objThemes->CreateMissingThemes(false); - + $css_hash = $application->Conn->GetCol('SELECT LOWER(Name) AS Name, StylesheetId FROM '.TABLE_PREFIX.'Stylesheets', 'StylesheetId'); $application->setUnitOption('css', 'AutoLoad', false); @@ -722,7 +725,7 @@ $css_item->Compile(); $application->Conn->Query( sprintf($theme_update_sql, $stylesheet_id, $application->Conn->qstr( getArrayValue($css_hash,$stylesheet_id) ) ) ); } - + // do redirect, because upgrade scripts can eat a lot or memory used for language pack upgrade operation $application->Redirect('install', Array('state' => 'languagepack_upgrade'), '', 'install.php'); // compile stylesheets: end @@ -1134,7 +1137,7 @@ if( preg_match('/inportal_upgrade_v(.*).(php|sql)$/', $file, $rets) ) { if($p == '') $p = 'in-portal'; - + $sql = "SELECT Version FROM ".$g_TablePrefix."Modules WHERE Name = '".$p."'"; $rs = $ado->Execute($sql);