From 9fcc776bc1458150d4e4239b918820e3194af514 Mon Sep 17 00:00:00 2001 From: Joe Anderson Date: Thu, 19 Apr 2012 13:32:48 -0400 Subject: [PATCH] +Added a firstrun variable to the installation process so that you have to use the standard installation procedure before using the system --- application/config/database.php | 3 +++ application/core/MY_Controller.php | 5 ++++- install/config/database.php | 3 +++ install/includes/core_class.php | 1 + install/index.php | 6 +++--- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/application/config/database.php b/application/config/database.php index 896e0a7..9e0f8a6 100755 --- a/application/config/database.php +++ b/application/config/database.php @@ -39,6 +39,9 @@ $db['default']['password'] = "kayakodev"; $db['default']['database'] = "db_kayako"; +// A flag to denote wheter the user has run the install script +$config['firstrun'] = FALSE; + // The following values can probably stay the same. $db['default']['hostname'] = "localhost"; $db['default']['dbdriver'] = "mysql"; diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php index 69c9988..7d4c8ea 100644 --- a/application/core/MY_Controller.php +++ b/application/core/MY_Controller.php @@ -14,7 +14,10 @@ class MY_Controller extends CI_Controller{ function __construct(){ parent::__construct(); - // $this->output->enable_profiler(TRUE); + $this->load->config('database'); + if ( $this->config->item('firstrun') == FALSE ){ + redirect('/install'); + } if ( ! $this->input->is_ajax_request() ){ // $this->output->cache(15); diff --git a/install/config/database.php b/install/config/database.php index fc2291f..195132a 100755 --- a/install/config/database.php +++ b/install/config/database.php @@ -39,6 +39,9 @@ $db['default']['password'] = "%PASSWORD%"; $db['default']['database'] = "%DATABASE%"; +// A flag to denote wheter the user has run the install script +$config['firstrun'] = FALSE; + // The following values can probably stay the same. $db['default']['hostname'] = "%HOSTNAME%"; $db['default']['dbdriver'] = "mysql"; diff --git a/install/includes/core_class.php b/install/includes/core_class.php index 7f4df6f..31eba8f 100755 --- a/install/includes/core_class.php +++ b/install/includes/core_class.php @@ -73,6 +73,7 @@ function write_config($data) { $new = str_replace("%USERNAME%",$data['username'],$new); $new = str_replace("%PASSWORD%",$data['password'],$new); $new = str_replace("%DATABASE%",$data['database'],$new); + $new = str_replace('$config[\'firstrun\'] = FALSE;', '$config[\'firstrun\'] = TRUE;', $new); // Write the new database.php file $handle = fopen($output_path,'w+'); diff --git a/install/index.php b/install/index.php index 25d3061..2ec214b 100755 --- a/install/index.php +++ b/install/index.php @@ -109,9 +109,9 @@ function previousPanel(){