Index: branches/RC/admin/install.php
===================================================================
diff -u -r8929 -r9398
--- branches/RC/admin/install.php (.../install.php) (revision 8929)
+++ branches/RC/admin/install.php (.../install.php) (revision 9398)
@@ -8,13 +8,15 @@
$general_error = '';
// new path detection without K4 init: begin
-define('FULL_PATH', realpath(dirname(__FILE__).'/..') );
-define('BASE_PATH', rtrim(preg_replace('#/admin$#', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'));
-$rootURL = 'http://'.$_SERVER['HTTP_HOST'].rtrim(BASE_PATH, '/').'/admin/';
+define('FULL_PATH', realpath(dirname(__FILE__).'/..'));
+define('ADMIN_DIRECTORY', preg_replace('/^'.preg_quote(FULL_PATH, '/').'/', '', realpath(dirname(__FILE__))));
+
+define('BASE_PATH', rtrim(preg_replace('#'.ADMIN_DIRECTORY.'$#', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'));
+$rootURL = 'http://'.$_SERVER['HTTP_HOST'].rtrim(BASE_PATH, '/').ADMIN_DIRECTORY.'/';
// new path detection without K4 init: end
$pathtoroot = FULL_PATH.'/';
-$admin = 'admin';
+$admin = trim(ADMIN_DIRECTORY, '/');
ini_set('include_path', '.');
@@ -36,17 +38,14 @@
$install_type = GetVar('install_type', true);
$force_finish = isset($_REQUEST['ff']) ? true : false;
-$ini_file = $pathtoroot."config.php";
-if(file_exists($ini_file))
-{
+$ini_file = FULL_PATH.'/config.php';
+if (file_exists($ini_file)) {
$write_access = is_writable($ini_file);
- $ini_vars = inst_parse_portal_ini($ini_file,TRUE);
+ $ini_vars = inst_parse_portal_ini($ini_file, true);
- foreach($ini_vars as $secname => $section)
- {
- foreach($section as $key => $value)
- {
- $key = "g_".str_replace('-', '', $key);
+ foreach ($ini_vars as $secname => $section) {
+ foreach ($section as $key => $value) {
+ $key = 'g_'.str_replace('-', '', $key);
global $$key;
$$key = $value;
}
@@ -58,12 +57,12 @@
$write_access = is_writable($pathtoroot);
if($write_access)
{
- set_ini_value("Database", "DBType", "");
- set_ini_value("Database", "DBHost", "");
- set_ini_value("Database", "DBUser", "");
- set_ini_value("Database", "DBUserPassword", "");
- set_ini_value("Database", "DBName", "");
- set_ini_value("Module Versions", "In-Portal", "");
+ set_ini_value('Database', 'DBType', '');
+ set_ini_value('Database', 'DBHost', '');
+ set_ini_value('Database', 'DBUser', '');
+ set_ini_value('Database', 'DBUserPassword', '');
+ set_ini_value('Database', 'DBName', '');
+ set_ini_value('Module Versions', 'In-Portal', '');
save_values();
}
@@ -250,21 +249,21 @@
//die();
}
- if(!is_writable($pathtoroot."admin/backupdata/"))
+ if(!is_writable($pathtoroot.$admin."/backupdata/"))
{
if ($general_error != '') {
$general_error .= '
';
}
- $general_error .= "In-portal's Backup directory must be writable (".$pathtoroot."admin/backupdata/).";
+ $general_error .= "In-portal's Backup directory must be writable (".$pathtoroot.$admin."/backupdata/).";
//die();
}
- if(!is_writable($pathtoroot."admin/export/"))
+ if(!is_writable($pathtoroot.$admin."/export/"))
{
if ($general_error != '') {
$general_error .= '
';
}
- $general_error .= "In-portal's Export directory must be writable (".$pathtoroot."admin/export/).";
+ $general_error .= "In-portal's Export directory must be writable (".$pathtoroot.$admin."/export/).";
//die();
}
@@ -749,7 +748,7 @@
else
{
$filepath = stripslashes($_POST['backupdir']);
- $backupfile = $filepath.$path_char.str_replace('(.*)', $_POST['backupdate'], BACKUP_NAME);
+ $backupfile = $filepath.'/'.str_replace('(.*)', $_POST['backupdate'], BACKUP_NAME);
if(file_exists($backupfile) && is_readable($backupfile))
{
@@ -780,7 +779,7 @@
}
if (!$show_warning) {
- $filename = $pathtoroot.$admin.$path_char.'install'.$path_char.'inportal_remove.sql';
+ $filename = $pathtoroot.$admin.'/install/inportal_remove.sql';
RunSchemaFile($ado,$filename);
$state="restore_run";
}
@@ -1587,7 +1586,7 @@
$ado->Execute($sql);
$sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '$g_Domain' WHERE VariableName='Server_Name'";
$ado->Execute($sql);
- $sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '".$_SERVER['DOCUMENT_ROOT'].$sitepath."admin/backupdata' WHERE VariableName='Backup_Path'";
+ $sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '".$_SERVER['DOCUMENT_ROOT'].$sitepath.$admin."/backupdata' WHERE VariableName='Backup_Path'";
$ado->Execute($sql);
$Modules = a48d819089308a9aeb447e7248b2587f();
@@ -1701,7 +1700,7 @@
SET LastAccessed = 0
WHERE PortalUserId IN (0,-2)';
$ado->Execute($sql);
-
+
echo "";
}