From 759a375f5ea37350b9c1cca8a95d3816de4c9d28 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 25 Nov 2015 18:06:27 -0700 Subject: [PATCH 1/5] Remove trailing tabs. Fix some spelling mistakes. And update core/upgrade/app_defaults.php to fix advanced -> upgrade. --- core/install/index.php | 2 -- core/install/install_first_time.php | 18 ++++++++---------- .../resources/classes/install_switch.php | 17 ++++++++--------- core/upgrade/app_defaults.php | 6 ++---- .../provision/cisco/7940/SIPDefault.cnf | 4 ++-- .../provision/mitel/5324/MN_${mac}.cfg | 2 +- .../provision/mitel/5340/MN_${mac}.cfg | 2 +- 7 files changed, 22 insertions(+), 29 deletions(-) diff --git a/core/install/index.php b/core/install/index.php index 9011dd9574..492550f282 100644 --- a/core/install/index.php +++ b/core/install/index.php @@ -95,8 +95,6 @@ if (!if_group("superadmin")) { echo "

"; - echo "

WiP

"; - //include the footer require_once "resources/footer.php"; ?> \ No newline at end of file diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php index b4366275fa..a091eb6825 100644 --- a/core/install/install_first_time.php +++ b/core/install/install_first_time.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -28,7 +28,7 @@ require_once "root.php"; require_once "resources/functions.php"; require_once "resources/classes/text.php"; -//initialize varibles we are going to use +//initialize variables we are going to use $event_host = ''; $event_port = ''; $event_password = ''; @@ -130,7 +130,7 @@ if(!$install_step) { $install_step = 'select_language'; } if (isset($_SESSION['domain']['template']['name']) and strlen($_SESSION['domain']['template']['name']) != 0) { $default_template = $_SESSION['domain']['template']['name']; } - + //set a default enviroment if first_time if($first_time_install){ //initialize some varibles to cut down on warnings @@ -147,7 +147,7 @@ if(!$install_step) { $install_step = 'select_language'; } //buffer the content ob_end_clean(); //clean the buffer ob_start(); - + $messages = array(); if (!extension_loaded('PDO')) { $messages[] = "PHP PDO was not detected. Please install it before proceeding"; @@ -168,7 +168,7 @@ if(!$install_step) { $install_step = 'select_language'; } "You can use the following to find what ports are allowed
semanage port -l | grep '^http_port_t'
"; } } - + //action code if($return_install_step == 'config_detail'){ //check for all required data @@ -185,11 +185,8 @@ if(!$install_step) { $install_step = 'select_language'; } //set the max execution time to 1 hour ini_set('max_execution_time',3600); - } - - //display messages if (count($messages)>0) { echo "
\n"; @@ -262,7 +259,7 @@ if(!$install_step) { $install_step = 'select_language'; } try { $switch_detect->detect(); } catch(Exception $e){ - echo "

Failed to detect confgiuration detect_switch reported: " . $e->getMessage() . "

\n"; + echo "

Failed to detect configuration detect_switch reported: " . $e->getMessage() . "

\n"; $detect_ok = false; } if($detect_ok){ @@ -299,7 +296,7 @@ if(!$install_step) { $install_step = 'select_language'; } } } $fusionPBX->install(); - + require_once "resources/classes/install_switch.php"; $switch = new install_switch($domain_name, $domain_uuid, $switch_detect); //$switch->debug = true; @@ -345,6 +342,7 @@ if($first_time_install){ $_SESSION['permissions'][]['permission_name'] = 'superadmin'; $_SESSION['menu'] = ''; } + // add the content to the template and then send output $body = ob_get_contents(); //get the output from the buffer ob_end_clean(); //clean the buffer diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index b13c36b23d..71f500f9cc 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -35,9 +35,9 @@ include "root.php"; public $debug = false; function __construct($domain_name, $domain_uuid, $detect_switch) { - if(!is_a($detect_switch, 'detect_switch')){ - throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)'); - } + //if(!is_a($detect_switch, 'detect_switch')){ + // throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)'); + //} $this->domain_uuid = $domain_uuid; $this->domain = $domain_name; $this->detect_switch = $detect_switch; @@ -166,11 +166,10 @@ include "root.php"; } } - function install() { $this->copy_conf(); $this->copy_scripts(); - //tell freeswitch to restart + //tell freeswitch to restart $this->write_progress("Restarting switch"); $this->detect_switch->restart_switch(); } @@ -182,10 +181,10 @@ include "root.php"; function copy_conf() { $this->write_progress("Copying Config"); //make a backup of the config - if (file_exists($this->detect_switch->conf_dir())) { - $this->backup_dir($this->detect_switch->conf_dir(), 'fusionpbx_switch_config'); - $this->recursive_delete($this->detect_switch->conf_dir()); - } + if (file_exists($this->detect_switch->conf_dir())) { + $this->backup_dir($this->detect_switch->conf_dir(), 'fusionpbx_switch_config'); + $this->recursive_delete($this->detect_switch->conf_dir()); + } //make sure the conf directory exists if (!is_dir($this->detect_switch->conf_dir())) { if (!mkdir($this->detect_switch->conf_dir(), 0774, true)) { diff --git a/core/upgrade/app_defaults.php b/core/upgrade/app_defaults.php index b5625f3e7a..a904361bb8 100644 --- a/core/upgrade/app_defaults.php +++ b/core/upgrade/app_defaults.php @@ -34,10 +34,8 @@ if ($domains_processed == 1) { } //copy the files and directories from resources/install - $install = new install; - $install->domain_uuid = $domain_uuid; - $install->switch_scripts_dir = $_SESSION['switch']['scripts']['dir']; - $install->copy_scripts(); + $obj = new install_switch; + $obj->upgrade(); } //update the software table diff --git a/resources/templates/provision/cisco/7940/SIPDefault.cnf b/resources/templates/provision/cisco/7940/SIPDefault.cnf index 489f5c97ea..08ce3b7a15 100644 --- a/resources/templates/provision/cisco/7940/SIPDefault.cnf +++ b/resources/templates/provision/cisco/7940/SIPDefault.cnf @@ -126,6 +126,6 @@ directory_url: "http://{$domain_name}/app/provision/?file=directory.php" # URL for branding logo #logo_url: "http://{$domain_name}/app/provision/logo.bmp" -# Remote Party ID -remote_party_id: 1 ; 0-Disabled (default), 1-Enabled +# Remote Party ID 0-Disabled (default), 1-Enabled +remote_party_id: 1 diff --git a/resources/templates/provision/mitel/5324/MN_${mac}.cfg b/resources/templates/provision/mitel/5324/MN_${mac}.cfg index b081d013c3..ff200630c1 100644 --- a/resources/templates/provision/mitel/5324/MN_${mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_${mac}.cfg @@ -31,7 +31,7 @@ 1 0 1 - http://rss.news.yahoo.com/rss/topstories + 135.199.77.12 135.199.77.12 128.138.141.172 diff --git a/resources/templates/provision/mitel/5340/MN_${mac}.cfg b/resources/templates/provision/mitel/5340/MN_${mac}.cfg index ea1c742f2d..4b18dcce14 100644 --- a/resources/templates/provision/mitel/5340/MN_${mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_${mac}.cfg @@ -31,7 +31,7 @@ 1 0 1 - http://rss.news.yahoo.com/rss/topstories + 135.199.77.12 135.199.77.12 128.138.141.172 From 266cc76a03f912a3b218ea29626f9ae3e05ee3cb Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 25 Nov 2015 18:16:38 -0700 Subject: [PATCH 2/5] If the script dir is set in the session we know the location and don't need to ask freeswitch for it again. --- core/install/resources/classes/install_switch.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 71f500f9cc..65592e8903 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -235,15 +235,21 @@ include "root.php"; function copy_scripts() { $this->write_progress("Copying Scripts"); - if (file_exists($this->detect_switch->script_dir())) { + if (strlen($_SESSION['switch']['scripts']['dir']) > 0) { + $script_dir = $_SESSION['switch']['scripts']['dir']; + } + else { + $script_dir = $this->detect_switch->script_dir() + } + if (file_exists($script_dir())) { if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){ $src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts'; } else { $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'; } - $dst_dir = $this->detect_switch->script_dir(); - if (is_readable($this->detect_switch->script_dir())) { + $dst_dir = $script_dir; + if (is_readable($script_dir)) { $this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']); unset($src_dir, $dst_dir); } From cfdccded76461c7d4f7d05a70d3f4844f6120741 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 25 Nov 2015 18:17:48 -0700 Subject: [PATCH 3/5] Fix the syntax by adding a missing semi-colon. --- core/install/resources/classes/install_switch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 65592e8903..4eb4b04247 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -239,7 +239,7 @@ include "root.php"; $script_dir = $_SESSION['switch']['scripts']['dir']; } else { - $script_dir = $this->detect_switch->script_dir() + $script_dir = $this->detect_switch->script_dir(); } if (file_exists($script_dir())) { if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){ From 04f3fa6a7a2398a0a37ed1ab8313ec1a9ffb6431 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 25 Nov 2015 18:18:48 -0700 Subject: [PATCH 4/5] Another minor adjustment. --- core/install/resources/classes/install_switch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 4eb4b04247..ac959b8d16 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -241,7 +241,7 @@ include "root.php"; else { $script_dir = $this->detect_switch->script_dir(); } - if (file_exists($script_dir())) { + if (file_exists($script_dir)) { if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){ $src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts'; } From 35752445c34a4b3b02bccb933bf0784496732f4a Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 25 Nov 2015 21:55:17 -0700 Subject: [PATCH 5/5] Remove the old reference to install class and replaced with install_switch. --- core/upgrade/index.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/upgrade/index.php b/core/upgrade/index.php index ef686b4b33..6a83f51e10 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -72,10 +72,8 @@ if (sizeof($_POST) > 0) { //update scripts folder, if allowed (default) if ($_SESSION['switch']['scripts']['dir'] != '') { //copy the files and directories from resources/install - $install = new install; - $install->domain_uuid = $domain_uuid; - $install->switch_scripts_dir = $_SESSION['switch']['scripts']['dir']; - $install->copy_scripts(); + $obj = new install_switch; + $obj->upgrade(); //set the message $response_message = $text['message-upgrade_source_scripts']; }