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'];
|
$label = $text['label-11d'];
|
||||||
$abbrv = "11d";
|
$abbrv = "11d";
|
||||||
break;
|
break;
|
||||||
case "^(?:\+1|1)?([2-9]\d\d[2-9]\d{6})$":
|
case "^(?:\+?1)?(\d{10})$":
|
||||||
$label = $text['label-north-america'];
|
$label = $text['label-north-america'];
|
||||||
$abbrv = "10-11d";
|
$abbrv = "10-11d";
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -29,19 +29,18 @@ require_once "resources/require.php";
|
||||||
require_once "resources/check_auth.php";
|
require_once "resources/check_auth.php";
|
||||||
|
|
||||||
//detect install state
|
//detect install state
|
||||||
|
$install_enabled = true;
|
||||||
$first_time_install = true;
|
|
||||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
|
if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
|
||||||
$first_time_install = false;
|
$install_enabled = false;
|
||||||
} elseif (file_exists("/etc/fusionpbx/config.php")) {
|
} elseif (file_exists("/etc/fusionpbx/config.php")) {
|
||||||
//linux
|
//linux
|
||||||
$first_time_install = false;
|
$install_enabled = false;
|
||||||
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
|
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
|
||||||
$first_time_install = false;
|
$install_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($first_time_install) {
|
if($install_enabled) {
|
||||||
header("Location: ".PROJECT_PATH."/core/install/install_first_time.php");
|
header("Location: ".PROJECT_PATH."/core/install/install.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
require_once "resources/check_auth.php";
|
require_once "resources/check_auth.php";
|
||||||
|
|
|
||||||
|
|
@ -77,16 +77,16 @@ if (is_link('/etc/localtime')) {
|
||||||
date_default_timezone_set($timezone);
|
date_default_timezone_set($timezone);
|
||||||
|
|
||||||
//detect install state
|
//detect install state
|
||||||
$first_time_install = true;
|
$install_enabled = true;
|
||||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
|
if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
|
||||||
$first_time_install = false;
|
$install_enabled = false;
|
||||||
} elseif (file_exists("/etc/fusionpbx/config.php")) {
|
} elseif (file_exists("/etc/fusionpbx/config.php")) {
|
||||||
$first_time_install = false;
|
$install_enabled = false;
|
||||||
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
|
} 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/require.php";
|
||||||
require_once "resources/check_auth.php";
|
require_once "resources/check_auth.php";
|
||||||
if (!if_group("superadmin")) {
|
if (!if_group("superadmin")) {
|
||||||
|
|
@ -132,7 +132,7 @@ if(!$install_step) { $install_step = 'select_language'; }
|
||||||
}
|
}
|
||||||
|
|
||||||
//set a default enviroment if first_time
|
//set a default enviroment if first_time
|
||||||
if($first_time_install){
|
if($install_enabled){
|
||||||
//initialize some varibles to cut down on warnings
|
//initialize some varibles to cut down on warnings
|
||||||
$_SESSION['message'] = '';
|
$_SESSION['message'] = '';
|
||||||
$v_link_label_play = '';
|
$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 ( count($messages) > $existing_errors) { $install_step = 'config_detail'; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if($install_step =='execute')
|
if($install_step =='execute') {
|
||||||
{
|
|
||||||
//start the rocket launch!
|
|
||||||
|
|
||||||
//set the max execution time to 1 hour
|
//set the max execution time to 1 hour
|
||||||
ini_set('max_execution_time',3600);
|
ini_set('max_execution_time',3600);
|
||||||
}
|
}
|
||||||
|
|
@ -345,14 +342,14 @@ if(!$install_step) { $install_step = 'select_language'; }
|
||||||
echo "<p>Unkown install_step '$install_step'</p>\n";
|
echo "<p>Unkown install_step '$install_step'</p>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($first_time_install){
|
if($install_enabled){
|
||||||
//grab the default theme
|
//grab the default theme
|
||||||
$set_session_theme = 1;
|
$set_session_theme = 1;
|
||||||
$domains_processed = 1;
|
$domains_processed = 1;
|
||||||
include "themes/enhanced/app_defaults.php";
|
include "themes/enhanced/app_defaults.php";
|
||||||
unset($set_session_theme, $domains_processed);
|
unset($set_session_theme, $domains_processed);
|
||||||
//initialize some defaults so we can be 'logged in'
|
//initialize some defaults so we can be 'logged in'
|
||||||
$_SESSION['username'] = 'first_time_install';
|
$_SESSION['username'] = 'install_enabled';
|
||||||
$_SESSION['permissions'][]['permission_name'] = 'superadmin';
|
$_SESSION['permissions'][]['permission_name'] = 'superadmin';
|
||||||
$_SESSION['menu'] = '';
|
$_SESSION['menu'] = '';
|
||||||
}
|
}
|
||||||
|
|
@ -329,8 +329,9 @@ include "root.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function create_database_pgsql() {
|
protected function create_database_pgsql() {
|
||||||
|
//create the database
|
||||||
if ($this->global_settings->db_create()) {
|
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");
|
$this->write_progress("\tCreating database");
|
||||||
try {
|
try {
|
||||||
if (strlen($this->global_settings->db_host()) > 0) {
|
if (strlen($this->global_settings->db_host()) > 0) {
|
||||||
|
|
@ -358,8 +359,8 @@ include "root.php";
|
||||||
//close database connection_aborted
|
//close database connection_aborted
|
||||||
$this->dbh = null;
|
$this->dbh = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->write_progress("\tInstalling data to database");
|
$this->write_progress("\tInstalling data to database");
|
||||||
|
|
||||||
//open database connection with $this->global_settings->db_name()
|
//open database connection with $this->global_settings->db_name()
|
||||||
try {
|
try {
|
||||||
if (strlen($this->global_settings->db_host()) > 0) {
|
if (strlen($this->global_settings->db_host()) > 0) {
|
||||||
|
|
@ -372,7 +373,6 @@ include "root.php";
|
||||||
throw new Exception("error connecting to database: " . $error->getMessage());
|
throw new Exception("error connecting to database: " . $error->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//add the database structure
|
//add the database structure
|
||||||
require_once "resources/classes/schema.php";
|
require_once "resources/classes/schema.php";
|
||||||
$schema = new schema;
|
$schema = new schema;
|
||||||
|
|
@ -506,6 +506,7 @@ include "root.php";
|
||||||
} //if (strlen($this->global_settings->db_create_username()) > 0)
|
} //if (strlen($this->global_settings->db_create_username()) > 0)
|
||||||
|
|
||||||
$this->write_progress("\tInstalling data to database");
|
$this->write_progress("\tInstalling data to database");
|
||||||
|
|
||||||
//select the database
|
//select the database
|
||||||
try {
|
try {
|
||||||
$this->dbh = new PDO($connect_string, $this->global_settings->db_username(), db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
|
$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
|
//utility Functions
|
||||||
|
|
||||||
function write_debug($message) {
|
function write_debug($message) {
|
||||||
if($this->debug){
|
if($this->debug){
|
||||||
echo "$message\n";
|
echo "$message\n";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$iso_countries = array
|
$iso_countries = array
|
||||||
(
|
(
|
||||||
'AF' => 'Afghanistan',
|
'AF' => 'Afghanistan',
|
||||||
|
|
@ -247,4 +248,5 @@ $iso_countries = array
|
||||||
'ZM' => 'Zambia',
|
'ZM' => 'Zambia',
|
||||||
'ZW' => 'Zimbabwe',
|
'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