Rename install_first_time variable and file name. Remove the install/upgrade_switch.php which isn't being used anymore. Update the indentation and remove inconsistent white spaces.
This commit is contained in:
parent
f32d99377f
commit
03897edf95
|
|
@ -207,7 +207,7 @@ else {
|
|||
$label = $text['label-11d'];
|
||||
$abbrv = "11d";
|
||||
break;
|
||||
case "^(?:\+1|1)?([2-9]\d\d[2-9]\d{6})$":
|
||||
case "^(?:\+?1)?(\d{10})$":
|
||||
$label = $text['label-north-america'];
|
||||
$abbrv = "10-11d";
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -29,19 +29,18 @@ require_once "resources/require.php";
|
|||
require_once "resources/check_auth.php";
|
||||
|
||||
//detect install state
|
||||
|
||||
$first_time_install = true;
|
||||
$install_enabled = true;
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
|
||||
$first_time_install = false;
|
||||
$install_enabled = false;
|
||||
} elseif (file_exists("/etc/fusionpbx/config.php")) {
|
||||
//linux
|
||||
$first_time_install = false;
|
||||
$install_enabled = false;
|
||||
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
|
||||
$first_time_install = false;
|
||||
$install_enabled = false;
|
||||
}
|
||||
|
||||
if($first_time_install) {
|
||||
header("Location: ".PROJECT_PATH."/core/install/install_first_time.php");
|
||||
if($install_enabled) {
|
||||
header("Location: ".PROJECT_PATH."/core/install/install.php");
|
||||
exit;
|
||||
}
|
||||
require_once "resources/check_auth.php";
|
||||
|
|
|
|||
|
|
@ -77,16 +77,16 @@ if (is_link('/etc/localtime')) {
|
|||
date_default_timezone_set($timezone);
|
||||
|
||||
//detect install state
|
||||
$first_time_install = true;
|
||||
$install_enabled = true;
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
|
||||
$first_time_install = false;
|
||||
$install_enabled = false;
|
||||
} elseif (file_exists("/etc/fusionpbx/config.php")) {
|
||||
$first_time_install = false;
|
||||
$install_enabled = false;
|
||||
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
|
||||
$first_time_install = false;
|
||||
$install_enabled = false;
|
||||
}
|
||||
|
||||
if(!$first_time_install) {
|
||||
if(!$install_enabled) {
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (!if_group("superadmin")) {
|
||||
|
|
@ -132,7 +132,7 @@ if(!$install_step) { $install_step = 'select_language'; }
|
|||
}
|
||||
|
||||
//set a default enviroment if first_time
|
||||
if($first_time_install){
|
||||
if($install_enabled){
|
||||
//initialize some varibles to cut down on warnings
|
||||
$_SESSION['message'] = '';
|
||||
$v_link_label_play = '';
|
||||
|
|
@ -183,10 +183,7 @@ if(!$install_step) { $install_step = 'select_language'; }
|
|||
if ( count($messages) > $existing_errors) { $install_step = 'config_detail'; }
|
||||
}
|
||||
|
||||
if($install_step =='execute')
|
||||
{
|
||||
//start the rocket launch!
|
||||
|
||||
if($install_step =='execute') {
|
||||
//set the max execution time to 1 hour
|
||||
ini_set('max_execution_time',3600);
|
||||
}
|
||||
|
|
@ -224,7 +221,7 @@ if(!$install_step) { $install_step = 'select_language'; }
|
|||
echo " <button type='submit' id='next'>".$text['button-next']."</button>\n";
|
||||
echo " </div>\n";
|
||||
echo "</form>\n";
|
||||
}elseif($install_step == 'detect_config'){
|
||||
} elseif($install_step == 'detect_config'){
|
||||
if(!($event_host == '' || $event_host == 'localhost' || $event_host == '::1' || $event_host == '127.0.0.1' )){
|
||||
echo "<p><b>Warning</b> you have choosen a value other than localhost for event_host, this is unsoported at present</p>\n";
|
||||
}
|
||||
|
|
@ -242,7 +239,7 @@ if(!$install_step) { $install_step = 'select_language'; }
|
|||
echo " <button type='submit' id='next'>".$text['button-next']."</button>\n";
|
||||
echo " </div>\n";
|
||||
echo "</form>\n";
|
||||
}else{
|
||||
} else {
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo " <div style='text-align:right'>\n";
|
||||
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
|
||||
|
|
@ -315,14 +312,14 @@ if(!$install_step) { $install_step = 'select_language'; }
|
|||
$switch->install_phase_1();
|
||||
$system->install_phase_2();
|
||||
$switch->install_phase_2();
|
||||
}catch(Exception $e){
|
||||
} catch(Exception $e){
|
||||
echo "</pre>\n";
|
||||
echo "<p><b>Failed to install</b><br/>" . $e->getMessage() . "</p>\n";
|
||||
try {
|
||||
require_once "resources/classes/install_fusionpbx.php";
|
||||
$system = new install_fusionpbx($global_settings);
|
||||
$system->remove_config();
|
||||
}catch(Exception $e){
|
||||
} catch(Exception $e){
|
||||
echo "<p><b>Failed to remove config:</b> " . $e->getMessage() . "</p>\n";
|
||||
}
|
||||
$install_ok = false;
|
||||
|
|
@ -345,14 +342,14 @@ if(!$install_step) { $install_step = 'select_language'; }
|
|||
echo "<p>Unkown install_step '$install_step'</p>\n";
|
||||
}
|
||||
|
||||
if($first_time_install){
|
||||
if($install_enabled){
|
||||
//grab the default theme
|
||||
$set_session_theme = 1;
|
||||
$domains_processed = 1;
|
||||
include "themes/enhanced/app_defaults.php";
|
||||
unset($set_session_theme, $domains_processed);
|
||||
//initialize some defaults so we can be 'logged in'
|
||||
$_SESSION['username'] = 'first_time_install';
|
||||
$_SESSION['username'] = 'install_enabled';
|
||||
$_SESSION['permissions'][]['permission_name'] = 'superadmin';
|
||||
$_SESSION['menu'] = '';
|
||||
}
|
||||
|
|
@ -329,8 +329,9 @@ include "root.php";
|
|||
}
|
||||
|
||||
protected function create_database_pgsql() {
|
||||
//create the database
|
||||
if ($this->global_settings->db_create()) {
|
||||
//Attempt to create new PG role and database
|
||||
//attempt to create new Postgres role and database
|
||||
$this->write_progress("\tCreating database");
|
||||
try {
|
||||
if (strlen($this->global_settings->db_host()) > 0) {
|
||||
|
|
@ -358,8 +359,8 @@ include "root.php";
|
|||
//close database connection_aborted
|
||||
$this->dbh = null;
|
||||
}
|
||||
|
||||
$this->write_progress("\tInstalling data to database");
|
||||
|
||||
//open database connection with $this->global_settings->db_name()
|
||||
try {
|
||||
if (strlen($this->global_settings->db_host()) > 0) {
|
||||
|
|
@ -372,7 +373,6 @@ include "root.php";
|
|||
throw new Exception("error connecting to database: " . $error->getMessage());
|
||||
}
|
||||
|
||||
|
||||
//add the database structure
|
||||
require_once "resources/classes/schema.php";
|
||||
$schema = new schema;
|
||||
|
|
@ -506,6 +506,7 @@ include "root.php";
|
|||
} //if (strlen($this->global_settings->db_create_username()) > 0)
|
||||
|
||||
$this->write_progress("\tInstalling data to database");
|
||||
|
||||
//select the database
|
||||
try {
|
||||
$this->dbh = new PDO($connect_string, $this->global_settings->db_username(), db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ include "root.php";
|
|||
}
|
||||
|
||||
//utility Functions
|
||||
|
||||
function write_debug($message) {
|
||||
if($this->debug){
|
||||
echo "$message\n";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
$iso_countries = array
|
||||
(
|
||||
'AF' => 'Afghanistan',
|
||||
|
|
@ -247,4 +248,5 @@ $iso_countries = array
|
|||
'ZM' => 'Zambia',
|
||||
'ZW' => 'Zimbabwe',
|
||||
);
|
||||
|
||||
?>
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// set included, if not
|
||||
if (!isset($included)) { $included = false; }
|
||||
|
||||
//check the permission
|
||||
if(defined('STDIN')) {
|
||||
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
|
||||
preg_match("/^(.*)\/core\/.*$/", $document_root, $matches);
|
||||
$document_root = $matches[1];
|
||||
set_include_path($document_root);
|
||||
require_once "resources/require.php";
|
||||
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
||||
$format = 'text'; //html, text
|
||||
}
|
||||
else if (!$included) {
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('upgrade_switch') || if_group("superadmin")) {
|
||||
//echo "access granted";
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
$format = 'html'; //html, text
|
||||
}
|
||||
|
||||
//run switch upgrade
|
||||
require_once "resources/classes/install_switch.php";
|
||||
$switch = new install_switch();
|
||||
$switch->upgrade();
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue