diff --git a/admin/install/cmd_install.php b/admin/install/cmd_install.php index 23b731a4433..2932d685dff 100644 --- a/admin/install/cmd_install.php +++ b/admin/install/cmd_install.php @@ -12,7 +12,6 @@ * * $Id: index.php 4729 2008-05-31 21:32:02Z nijaba $ */ -$cmd_install=true; if (isset($argv[1]) && ($argv[1]=='install'|| $argv[1]=='upgrade') && isset($argv[2]) && isset($argv[3])) { require_once($argv[2]); @@ -21,6 +20,7 @@ else { require_once(dirname(__FILE__).'/../../config-defaults.php'); + $cmd_install=true; require_once(dirname(__FILE__).'/../../common.php'); } // SET THE LANGUAGE???? -> DEFAULT SET TO EN FOR NOW @@ -108,14 +108,14 @@ $command = str_replace('$databasetabletype', $databasetabletype, $command); - - + + if(!$connect->Execute($command,false)) { print ("\n".$clang->gT("Executing").".....".$command."...".$clang->gT('Failed! Reason:')."\n".$connect->ErrorMsg()."\n\n"); $success=1; } - + $command = ''; @@ -157,7 +157,7 @@ $upgradedbtype=$databasetype; if ($upgradedbtype=='mssql_n' || $upgradedbtype=='odbc_mssql' || $upgradedbtype=='odbtp') $upgradedbtype='mssql'; - if ($upgradedbtype=='mssqnlative') $upgradedbtype='mssqlnative'; + if ($upgradedbtype=='mssqnlative') $upgradedbtype='mssqlnative'; include ('upgrade-all.php'); include ('upgrade-'.$upgradedbtype.'.php'); diff --git a/common.php b/common.php index 601bd5f99f6..1c25c71b505 100644 --- a/common.php +++ b/common.php @@ -232,12 +232,12 @@ //check if database exist and access is not via install script -if (!$database_exists && (strcasecmp($slashlesspath,str_replace(array("\\", "/"), "", $homedir."install")) != 0)) { +if (!$database_exists && !$cmd_install && (strcasecmp($slashlesspath,str_replace(array("\\", "/"), "", $homedir."install")) != 0)) { die ("
The LimeSurvey database does not exist. Please run the install script to create the necessary database."); } - // Check if the DB is up to date -if ($dbexistsbutempty && (strcasecmp($slashlesspath,str_replace(array("\\", "/"), "", $homedir."install")) != 0)) { + // Check if the DB is up to date and access is not via install script +if ($dbexistsbutempty && !$cmd_install && (strcasecmp($slashlesspath,str_replace(array("\\", "/"), "", $homedir."install")) != 0)) { die ("
The LimeSurvey database does exist but it seems to be empty. Please run the install script to create the necessary tables."); } diff --git a/config-defaults.php b/config-defaults.php index 6a982324229..663d85807ec 100644 --- a/config-defaults.php +++ b/config-defaults.php @@ -44,7 +44,14 @@ // FILE LOCATIONS -$rooturl = "http://{$_SERVER['HTTP_HOST']}/limesurvey"; //The root web url for your limesurvey installation. +// File Locations +if (isset($cmd_install) && $cmd_install) { + $rooturl = "http://localhost/limesurvey"; // A safe Root URL if we're doing a cmd_install +} else { + $rooturl = "http://{$_SERVER['HTTP_HOST']}/limesurvey"; // The root web url for your limesurvey installation (without a trailing slash). + // The double quotes (") are important. + $cmd_install = false; +} $rootdir = dirname(__FILE__); // This is the physical disk location for your limesurvey installation. Normally you don't have to touch this setting. // If you use IIS then you MUST enter the complete rootdir e.g. : $rootDir="C:\Inetpub\wwwroot\limesurvey"! @@ -100,9 +107,9 @@ // $sessionlifetime sets how long until a survey session expires in seconds $sessionlifetime = 3600; -// $sessionhandler can be either 'file' or 'db'. (default: 'file'). -// Generally you don't want to change that unless you are using LimeSurvey on load-balanced servers -$sessionhandler = 'file'; +// $sessionhandler can be either 'file' or 'db'. (default: 'file'). +// Generally you don't want to change that unless you are using LimeSurvey on load-balanced servers +$sessionhandler = 'file'; @@ -366,13 +373,13 @@ /** * When this settings is true/1 (default = false/0) then the printable survey option will show a reference - * to the "lime_survey_12345" table which stores the survey answers. + * to the "lime_survey_12345" table which stores the survey answers. * It will show a code like "12345X22X333name": * 12345 = surveyID * 22 = groupID * 333 = questionID * name = answer code (only shown for certain question types - * + * * This code will be shown in front of each question and in front of each answer option at the printable survey. * It can be used as a data analysis code book for querying data from the main response table. */ @@ -497,7 +504,7 @@ * to the http part of your normal LimeSurvey URL. * e.g. https://your.domain.org/limesurvey/admin/admin.php * If LimeSurvey comes up as normal, then everything is fine. If you - * get a page not found error or permission denied error then + * get a page not found error or permission denied error then */ $force_ssl = ''; // DO not turn on unless you are sure your server supports SSL/HTTPS @@ -508,7 +515,7 @@ * server doesn't have HTTPS enabled, the only way to turn it off is * by changing a value in the database directly. This allows you to * force HTTPS off while you change the global settings for Force Secure. - * + * * false = do nothing; * true = override $force_ssl=on; * @@ -533,7 +540,7 @@ if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='' && $_SERVER['HTTPS']!='off') { $rooturl=str_replace('http://', 'https://', $rooturl); -} +} //----------------------------------------------------- // === Advanced Setup @@ -563,7 +570,7 @@ $imagedir = "$rootdir".DIRECTORY_SEPARATOR."images"; // The directory path of the image directory $uploaddir = "$rootdir".DIRECTORY_SEPARATOR."upload"; $standardtemplaterootdir = "$rootdir".DIRECTORY_SEPARATOR."templates"; // The directory path of the standard templates -$usertemplaterootdir = "$uploaddir".DIRECTORY_SEPARATOR."templates"; // The directory path of the user templates +$usertemplaterootdir = "$uploaddir".DIRECTORY_SEPARATOR."templates"; // The directory path of the user templates $sCKEditorURL = "$homeurl/scripts/ckeditor.36"; $ckeditexpandtoolbar = true; // defines if the CKeditor toolbar should be opened by default