Index: trunk/admin/install.php
===================================================================
diff -u -r103 -r105
--- trunk/admin/install.php (.../install.php) (revision 103)
+++ trunk/admin/install.php (.../install.php) (revision 105)
@@ -3,7 +3,8 @@
//$new_version = '1.0.2';
-define("GET_LICENSE_URL", "http://www.intechnic.com/myaccount/license.php");
+//define("GET_LICENSE_URL", "http://www.intechnic.com/myaccount/license.php");
+define("GET_LICENSE_URL", "http://maris.prod.intechnic.lv/in-business/license.php");
define('BACKUP_NAME', 'dump(.*).txt'); // how backup dump files are named
$general_error = '';
@@ -70,10 +71,11 @@
}
}
-if( file_exists($pathtoroot.'debug.php') ) include_once($pathtoroot.'debug.php');
+if( file_exists($pathtoroot.'debug.php') && !defined('DEBUG_MODE') ) include_once($pathtoroot.'debug.php');
if( defined('DEBUG_MODE') )
{
error_reporting(E_ALL & E_NOTICE);
+ ini_set('display_errors', 1);
}
else
error_reporting(0);
@@ -95,7 +97,7 @@
$state = $_POST["state"];
}
-include("install/install_lib.php");
+include($pathtoroot.$admin."/install/install_lib.php");
$ini_file = $pathtoroot."config.php";
if(file_exists($ini_file))
@@ -244,7 +246,7 @@
|
 |
- In-Portal Version 1.0.0: English US |
+ In-Portal Version : English US |

|

|
@@ -351,7 +353,7 @@
}
else
{
- $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['UserName'])."&password=".md5($_POST['UserPass'])."&domain=".$_SERVER['SERVER_NAME'], "r");
+ $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['UserName'])."&password=".md5($_POST['UserPass'])."&license_code=".base64_encode($g_LicenseCode)."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r");
if (!$rfile) {
$LoggedIn = false;
}
@@ -495,7 +497,7 @@
$rs->MoveNext();
}
- $include_file = "install/upgrade.php";
+ $include_file = $pathtoroot.$admin."/install/upgrade.php";
}
if ($state == "upgrade_process") {
@@ -591,7 +593,7 @@
if($state=="db_reconfig")
{
- $include_file = "install/db_reconfig.php";
+ $include_file = $pathtoroot.$admin."/install/db_reconfig.php";
}
if($state=="restore_file")
@@ -641,16 +643,16 @@
}
else {
$state = "warning";
- $include_file = "install/warning.php";
+ $include_file = $pathtoroot.$admin."/install/warning.php";
}
}
else {
if ($_POST['backupdate'] != '') {
- $include_file = "install/restore_select.php";
+ $include_file = $pathtoroot.$admin."/install/restore_select.php";
$restore_error = "$backupfile not found or could not be read";
}
else {
- $include_file = "install/restore_select.php";
+ $include_file = $pathtoroot.$admin."/install/restore_select.php";
$restore_error = "No backup selected!!!";
}
}
@@ -661,7 +663,7 @@
if($state=="restore_select")
{
if( isset($_POST['backupdir']) ) $filepath = stripslashes($_POST['backupdir']);
- $include_file = "install/restore_select.php";
+ $include_file = $pathtoroot.$admin."/install/restore_select.php";
}
if($state=="restore_run")
@@ -671,7 +673,7 @@
if(!strlen($backupfile))
$backupfile = SuperStrip($_GET['File'], true);
- $include_file = "install/restore_run.php";
+ $include_file = $pathtoroot.$admin."/install/restore_run.php";
}
if($state=="db_config_save")
@@ -704,19 +706,19 @@
if ($install_type == '') {
$install_type = 1;
}
- $include_file = "install/dbinfo.php";
+ $include_file = $pathtoroot.$admin."/install/dbinfo.php";
}
if ($state == "download_license") {
$ValidLicense = FALSE;
if ($_POST['login'] != '' && $_POST['password'] != '') {
// Here we determine weather login is ok & check available licenses
- $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['login'])."&password=".md5($_POST['password'])."&domain=".$_SERVER['SERVER_NAME'], "r");
+ $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['login'])."&password=".md5($_POST['password'])."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r");
if (!$rfile) {
$get_license_error = "Unable to connect to the Intechnic server! Please try again later!";
$state = "get_license";
- $include_file = "install/get_license.php";
+ $include_file = $pathtoroot.$admin."/install/get_license.php";
}
else {
$rcontents = '';
@@ -729,22 +731,25 @@
if (substr($rcontents, 0, 5) == 'Error') {
$get_license_error = substr($rcontents, 6);
$state = "get_license";
- $include_file = "install/get_license.php";
+ $include_file = $pathtoroot.$admin."/install/get_license.php";
}
else {
if (substr($rcontents, 0, 3) == "SEL") {
$state = "download_license";
$license_select = substr($rcontents, 4);
- $include_file = "install/download_license.php";
+ $include_file = $pathtoroot.$admin."/install/download_license.php";
}
else {
// Here we get one license
- $data = base64_decode(str_replace("In-Portal License File - do not edit!\n", "", $rcontents));
+ $tmp_data = explode('Code==:', $rcontents);
+
+ $data = base64_decode(str_replace("In-Portal License File - do not edit!\n", "", $tmp_data[0]));
inst_ParseLicense($data);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
if($ValidLicense)
{
set_ini_value("Intechnic","License",base64_encode($data));
+ set_ini_value("Intechnic","LicenseCode",$tmp_data[1]);
save_values();
$state="domain_select";
$got_license = 1;
@@ -764,15 +769,15 @@
else if ($_POST['licenses'] == '') {
$state = "get_license";
$get_license_error = "Username and / or password not specified!!!";
- $include_file = "install/get_license.php";
+ $include_file = $pathtoroot.$admin."/install/get_license.php";
}
else {
// Here we download license
- $rfile = @fopen(GET_LICENSE_URL."?license_id=".md5($_POST['licenses'])."&dlog=".md5($_POST['dlog'])."&dpass=".md5($_POST['dpass'])."&domain=".$_POST['domain'], "r");
+ $rfile = @fopen(GET_LICENSE_URL."?license_id=".md5($_POST['licenses'])."&dlog=".md5($_POST['dlog'])."&dpass=".md5($_POST['dpass'])."&domain=".base64_encode($_POST['domain']), "r");
if (!$rfile) {
$get_license_error = "Unable to connect to the Intechnic server! Please try again later!";
$state = "get_license";
- $include_file = "install/get_license.php";
+ $include_file = $pathtoroot.$admin."/install/get_license.php";
}
else {
$rcontents = '';
@@ -785,15 +790,18 @@
if (substr($rcontents, 0, 5) == 'Error') {
$download_license_error = substr($rcontents, 6);
$state = "download_license";
- $include_file = "install/download_license.php";
+ $include_file = $pathtoroot.$admin."/install/download_license.php";
}
else {
- $data = base64_decode(str_replace("In-Portal License File - do not edit!\n", "", $rcontents));
+ $tmp_data = explode('Code==:', $rcontents);
+
+ $data = base64_decode(str_replace("In-Portal License File - do not edit!\n", "", $tmp_data[0]));
inst_ParseLicense($data);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
if($ValidLicense)
{
set_ini_value("Intechnic","License",base64_encode($data));
+ set_ini_value("Intechnic","LicenseCode",$tmp_data[1]);
save_values();
$state="domain_select";
}
@@ -815,7 +823,7 @@
switch($_POST["lic_opt"])
{
case 1: /* download from intechnic */
- $include_file = "install/get_license.php";
+ $include_file = $pathtoroot.$admin."/install/get_license.php";
$state = "get_license";
//if(!$ValidLicense)
//{
@@ -833,13 +841,17 @@
$lic = fread($fp,filesize($pathtoroot."themes/tmp.lic"));
fclose($fp);
}
- $data = inst_LoadLicense(FALSE,$pathtoroot."themes/tmp.lic");
+
+ $tmp_data = inst_LoadLicense(FALSE,$pathtoroot."themes/tmp.lic");
+ $data = $tmp_data[0];
+
@unlink($pathtoroot."themes/tmp.lic");
inst_ParseLicense($data);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
if($ValidLicense)
{
set_ini_value("Intechnic","License",base64_encode($data));
+ set_ini_value("Intechnic","LicenseCode",$tmp_data[1]);
save_values();
$state="domain_select";
}
@@ -887,7 +899,7 @@
if($state=="license")
{
- $include_file = "install/sel_license.php";
+ $include_file = $pathtoroot.$admin."/install/sel_license.php";
}
@@ -943,7 +955,7 @@
$install_type = 2;
}
- $include_file = "install/reinstall.php";
+ $include_file = $pathtoroot.$admin."/install/reinstall.php";
}
if($state=="login")
@@ -975,7 +987,7 @@
if($state=="getuser")
{
- $include_file = "install/login.php";
+ $include_file = $pathtoroot.$admin."/install/login.php";
}
if($state=="set_domain")
@@ -989,20 +1001,34 @@
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
}
}
+
if($_POST["domain"]==1)
{
$domain = $_SERVER['HTTP_HOST'];
- set_ini_value("Intechnic","Domain",$domain);
- save_values();
- $state="runsql";
+
+ if (strstr($domain, $i_Keys[0]['domain'])) {
+ set_ini_value("Intechnic","Domain",$domain);
+ save_values();
+ $state="runsql";
+ }
+ else {
+ $DomainError = 'Domain name selected does not match domain name in the license!';
+ $state = "domain_select";
+ }
}
else
{
$domain = str_replace(" ", "", $_POST["other"]);
if ($domain != '') {
- set_ini_value("Intechnic","Domain",$domain);
- save_values();
- $state="runsql";
+ if (strstr($domain, $i_Keys[0]['domain'])) {
+ set_ini_value("Intechnic","Domain",$domain);
+ save_values();
+ $state="runsql";
+ }
+ else {
+ $DomainError = 'Domain name entered does not match domain name in the license!';
+ $state = "domain_select";
+ }
}
else {
$DomainError = 'Please enter valid domain!';
@@ -1023,7 +1049,7 @@
}
}
- $include_file = "install/domain.php";
+ $include_file = $pathtoroot.$admin."/install/domain.php";
}
@@ -1097,13 +1123,13 @@
$state="RootPass";
}
else {
- $include_file = "install/install_finish.php";
+ $include_file = $pathtoroot.$admin."/install/install_finish.php";
$state="finish";
}
}
if ($state == "finish") {
- $include_file = "install/install_finish.php";
+ $include_file = $pathtoroot.$admin."/install/install_finish.php";
}
if($state=="RootSetPass")
@@ -1131,7 +1157,7 @@
if($state=="RootPass")
{
- $include_file = "install/rootpass.php";
+ $include_file = $pathtoroot.$admin."/install/rootpass.php";
}
if($state=="lang_install_init")
@@ -1300,7 +1326,7 @@
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';
- $include_file = "install/lang_run.php";
+ $include_file = $pathtoroot.$admin."/install/lang_run.php";
}
else
{
@@ -1321,7 +1347,7 @@
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';
- $include_file = "install/lang_run.php";
+ $include_file = $pathtoroot.$admin."/install/lang_run.php";
}
else
{
@@ -1333,7 +1359,7 @@
{
$_POST['next_step'] = 4;
$state = 'finish';
- $include_file = "install/install_finish.php";
+ $include_file = $pathtoroot.$admin."/install/install_finish.php";
}
}
}
@@ -1367,7 +1393,7 @@
{
$Packs[$l->Get("LanguageId")] = $l->Get("PackName");
}
- $include_file = "install/lang_default.php";
+ $include_file = $pathtoroot.$admin."/install/lang_default.php";
}
@@ -1454,7 +1480,7 @@
if($state=="lang_select")
{
$Packs = GetLanguageList();
- $include_file = "install/lang_select.php";
+ $include_file = $pathtoroot.$admin."/install/lang_select.php";
}
if($state=="modselect")
@@ -1482,7 +1508,7 @@
$sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '".$_SERVER['DOCUMENT_ROOT'].$sitepath."admin/backupdata' WHERE VariableName='Backup_Path'";
$ado->Execute($sql);
$Modules = inst_GetModuleList();
- $include_file = "install/modselect.php";
+ $include_file = $pathtoroot.$admin."/install/modselect.php";
}
if(substr($state,0,10)=="postconfig")
@@ -1501,11 +1527,11 @@
}
$modules_str = substr($modules_str, 0, strlen($modules_str) - 1);
- $rfile = @fopen(GET_LICENSE_URL."?url=".base64_encode($_SERVER['SERVER_NAME'].$_POST['Site_Path'])."&modules=".base64_encode($modules_str)."&domain=".md5($_SERVER['SERVER_NAME']), "r");
+ $rfile = @fopen(GET_LICENSE_URL."?url=".base64_encode($_SERVER['SERVER_NAME'].$_POST['Site_Path'])."&modules=".base64_encode($modules_str)."&license_code=".base64_encode($g_LicenseCode)."&domain=".md5($_SERVER['SERVER_NAME']), "r");
if (!$rfile) {
//$get_license_error = "Unable to connect to the Intechnic server! Please try again later!";
//$state = "postconfig_1";
- //$include_file = "install/postconfig.php";
+ //$include_file = $pathtoroot.$admin."/install/postconfig.php";
}
else {
$rcontents = '';
@@ -1539,7 +1565,7 @@
if($step <= count($configs)+1)
{
- $include_file = "install/postconfig.php";
+ $include_file = $pathtoroot.$admin."/install/postconfig.php";
}
else
$state = "theme_sel";
@@ -1548,7 +1574,7 @@
if($state=="theme_sel")
{
$objThemes->CreateMissingThemes();
- $include_file = "install/theme_select.php";
+ $include_file = $pathtoroot.$admin."/install/theme_select.php";
}
if($state=="theme_set")
@@ -1570,7 +1596,7 @@
$t->Set("PrimaryTheme",1);
$t->Update();
$t->VerifyTemplates();
- $include_file = "install/install_finish.php";
+ $include_file = $pathtoroot.$admin."/install/install_finish.php";
$state="finish";
}