Index: trunk/admin/install.php
===================================================================
diff -u -r311 -r315
--- trunk/admin/install.php (.../install.php) (revision 311)
+++ trunk/admin/install.php (.../install.php) (revision 315)
@@ -7,15 +7,6 @@
define('BACKUP_NAME', 'dump(.*).txt'); // how backup dump files are named
$general_error = '';
-if ($_POST['install_type'] != '') {
- $install_type = $_POST['install_type'];
-}
-else if ($_GET['install_type'] != '') {
- $install_type = $_GET['install_type'];
-}
-
-$force_finish = isset($_REQUEST['ff']) ? true : false;
-
$pathtoroot = "";
if(!strlen($pathtoroot))
{
@@ -86,11 +77,14 @@
$state = isset($_GET["state"]) ? $_GET["state"] : '';
if(!strlen($state))
{
- $state = $_POST["state"];
+ $state = isset($_POST['state']) ? $_POST['state'] : '';
}
include($pathtoroot.$admin."/install/install_lib.php");
+$install_type = GetVar('install_type', true);
+$force_finish = isset($_REQUEST['ff']) ? true : false;
+
$ini_file = $pathtoroot."config.php";
if(file_exists($ini_file))
{
@@ -145,7 +139,7 @@
// simulate rootURL variable: end
$db_savings = Array('dbinfo', 'db_config_save', 'db_reconfig_save'); //, 'reinstall_process'
-if(strlen($g_DBType)>0 && strlen($state)>0 && !in_array($state, $db_savings) )
+if( isset($g_DBType) && $g_DBType && strlen($state)>0 && !in_array($state, $db_savings) )
{
require_once($pathtoroot."kernel/startup.php");
$localURL=$rootURL."kernel/";
@@ -255,10 +249,7 @@
if(strlen($state)==0)
{
$ado = inst_GetADODBConnection();
- if($ado)
- {
- $installed = TableExists($ado,"ConfigurationAdmin,Category,Permissions");
- }
+ $installed = $ado ? TableExists($ado,"ConfigurationAdmin,Category,Permissions") : false;
if(!minimum_php_version("4.1.2"))
{
@@ -323,6 +314,8 @@
if($state=="reinstall_process")
{
+ $login_err_mesg = ''; // always init vars before use
+ if( !isset($g_License) ) $g_License = '';
$lic = base64_decode($g_License);
if(strlen($lic))
{
@@ -691,7 +684,11 @@
if ($state == "download_license") {
$ValidLicense = FALSE;
- if ($_POST['login'] != '' && $_POST['password'] != '') {
+
+ $lic_login = isset($_POST['login']) ? $_POST['login'] : '';
+ $lic_password = isset($_POST['password']) ? $_POST['password'] : '';
+
+ if ($lic_login != '' && $lic_password != '') {
// Here we determine weather login is ok & check available licenses
$rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['login'])."&password=".md5($_POST['password'])."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r");
@@ -753,6 +750,12 @@
}
else {
// Here we download license
+ echo "LICENSE_ID: ".md5($_POST['licenses'])."
";
+ echo "DLOG: ".md5($_POST['dlog'])."
";
+ echo "DPASS: ".md5($_POST['dpass'])."
";
+ echo "VERSION: ".GetMaxPortalVersion($pathtoroot.$admin)."
";
+ echo "DOMAIN: ".base64_encode($_POST['domain'])."
";
+
$rfile = @fopen(GET_LICENSE_URL."?license_id=".md5($_POST['licenses'])."&dlog=".md5($_POST['dlog'])."&dpass=".md5($_POST['dpass'])."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".base64_encode($_POST['domain']), "r");
if (!$rfile) {
$get_license_error = "Unable to connect to the Intechnic server! Please try again later!";
@@ -781,7 +784,8 @@
if($ValidLicense)
{
set_ini_value("Intechnic","License",base64_encode($data));
- set_ini_value("Intechnic","LicenseCode",$tmp_data[1]);
+ // old licensing script doen't return 2nd parameter (licanse code)
+ if( isset($tmp_data[1]) ) set_ini_value("Intechnic","LicenseCode",$tmp_data[1]);
save_values();
$state="domain_select";
}
@@ -800,7 +804,8 @@
if($state=="license_process")
{
$ValidLicense = FALSE;
- switch($_POST["lic_opt"])
+ $tmp_lic_opt = GetVar('lic_opt', true);
+ switch($tmp_lic_opt)
{
case 1: /* download from intechnic */
$include_file = $pathtoroot.$admin."/install/get_license.php";
@@ -935,7 +940,7 @@
}
}
- if ($install_type == '') {
+ if ( !isset($install_type) || $install_type == '') {
$install_type = 2;
}
@@ -976,7 +981,7 @@
if($state=="set_domain")
{
- if(!is_array($i_Keys))
+ if( !is_array($i_Keys) || !count($i_Keys) )
{
$lic = base64_decode($g_License);
if(strlen($lic))
@@ -1196,13 +1201,14 @@
if(is_object($l))
{
$LangId = $l->Get("LanguageId");
+ $NewLang = false;
}
else
{
$l = new clsLanguage();
$l->Set("Enabled",1);
$l->Create();
- $NewLang = TRUE;
+ $NewLang = true;
$LangId = $l->Get("LanguageId");
}
foreach($LangRoot->children as $tag)
@@ -1300,12 +1306,7 @@
$Status=1;
}
- if ($_POST['next_step']) {
- $next_step = $_POST['next_step'];
- }
- else if ($_GET['next_step']) {
- $next_step = $_GET['next_step'];
- }
+ $next_step = GetVar('next_step', true);
if($force_finish == true) $next_step = 3;
$NextUrl = $_SERVER['PHP_SELF']."?Offset=$Offset&Status=$Status&state=lang_install&next_step=$next_step&install_type=$install_type";
@@ -1322,12 +1323,8 @@
if($Offset>$Total)
{
- if ($_POST['next_step']) {
- $next_step = $_POST['next_step'];
- }
- else if ($_GET['next_step']) {
- $next_step = $_GET['next_step'];
- }
+ $next_step = GetVar('next_step', true);
+
if($force_finish == true) $next_step = 3;
$NextUrl = $_SERVER['PHP_SELF']."?Offset=$Offset&Status=$Status&State=lang_install&next_step=$next_step&install_type=$install_type";
if($force_finish == true) $NextUrl .= '&ff=1';
@@ -1389,7 +1386,7 @@
{
$ado = inst_GetADODBConnection();
require_once $pathtoroot.'kernel/include/tag-class.php';
- if( !is_object($objTagList) ) $objTagList = new clsTagList();
+ if( !isset($objTagList) || !is_object($objTagList) ) $objTagList = new clsTagList();
foreach($doms as $p)
{
$filename = $pathtoroot.$p."/admin/install.php";
@@ -1588,6 +1585,10 @@
echo "";
}
+// init variables
+$vars = Array('db_error','restore_error','PassError','DomainError','login_error','inst_error');
+foreach($vars as $var_name) ReSetVar($var_name);
+
switch($state)
{
case "modselect":
@@ -1713,18 +1714,13 @@
break;
}
-if ($_POST['next_step']) {
- $tmp_step = $_POST['next_step'];
-}
-else if ($_GET['next_step']) {
- $tmp_step = $_GET['next_step'];
-}
+$tmp_step = GetVar('next_step', true);
if (!$tmp_step) {
$tmp_step = 1;
}
-if ($got_license == 1) {
+if ( isset($got_license) && $got_license == 1) {
$tmp_step++;
}
@@ -1787,12 +1783,15 @@
+ | |
+ |