diff --git a/app/dialplan/resources/classes/dialplan.php b/app/dialplan/resources/classes/dialplan.php
index c828cc25b1..92631e73d3 100644
--- a/app/dialplan/resources/classes/dialplan.php
+++ b/app/dialplan/resources/classes/dialplan.php
@@ -381,7 +381,11 @@ include "root.php";
if (!is_array($_SESSION[$_SESSION['domain_uuid']]['outbound_routes'])) {
//get the outbound routes from the database
$sql = "select * from v_dialplans as d, v_dialplan_details as s ";
- $sql .= "where d.domain_uuid = '".$this->domain_uuid."' ";
+ $sql .= "where ";
+ $sql .= "( ";
+ $sql .= "d.domain_uuid = '".$this->domain_uuid."' ";
+ $sql .= "or d.domain_uuid is null ";
+ $sql .= ") ";
$sql .= "and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' ";
$sql .= "and d.dialplan_enabled = 'true' ";
$sql .= "and d.dialplan_uuid = s.dialplan_uuid ";
diff --git a/app/fax/app_languages.php b/app/fax/app_languages.php
index 5d47714551..5ab3463d98 100644
--- a/app/fax/app_languages.php
+++ b/app/fax/app_languages.php
@@ -1112,8 +1112,26 @@ $text['label-accountcode']['ro'] = "Cod cont";
$text['label-accountcode']['he'] = "קוד חשבון";
$text['label-fax_send_greeting']['en-us'] = "Greeting";
+$text['label-fax_send_greeting']['es-cl'] = "";
+$text['label-fax_send_greeting']['pt-pt'] = "";
+$text['label-fax_send_greeting']['fr-fr'] = "";
+$text['label-fax_send_greeting']['pt-br'] = "";
+$text['label-fax_send_greeting']['pl'] = "";
+$text['label-fax_send_greeting']['sv-se'] = "";
+$text['label-fax_send_greeting']['de-at'] = "";
+$text['label-fax_send_greeting']['ro'] = "";
+$text['label-fax_send_greeting']['he'] = "";
$text['label-fax_send_channels']['en-us'] = "Number of channels";
+$text['label-fax_send_channels']['es-cl'] = "";
+$text['label-fax_send_channels']['pt-pt'] = "";
+$text['label-fax_send_channels']['fr-fr'] = "";
+$text['label-fax_send_channels']['pt-br'] = "";
+$text['label-fax_send_channels']['pl'] = "";
+$text['label-fax_send_channels']['sv-se'] = "";
+$text['label-fax_send_channels']['de-at'] = "";
+$text['label-fax_send_channels']['ro'] = "";
+$text['label-fax_send_channels']['he'] = "";
$text['header-sent']['en-us'] = "Sent Faxes";
$text['header-sent']['es-cl'] = "Los Faxes Enviados";
diff --git a/app/provision/index.php b/app/provision/index.php
index 366ed87183..ae17fefba2 100644
--- a/app/provision/index.php
+++ b/app/provision/index.php
@@ -42,6 +42,15 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
// $device_template = check_str($_REQUEST['template']);
//}
+//get the mac address for Cisco 79xx in the URL as &name=SEP000000000000
+ if (empty($mac)){
+ $name = check_str($_REQUEST['name']);
+ if (substr($name, 0, 3) == "SEP") {
+ $mac = strtolower(substr($name, 3, 12));
+ unset($name);
+ }
+ }
+
//check alternate MAC source
if (empty($mac)){
//set the http user agent
@@ -283,7 +292,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
//deliver the customized config over HTTP/HTTPS
//need to make sure content-type is correct
- if ($_REQUEST['content_type'] = 'application/octet-stream') {
+ if ($_REQUEST['content_type'] == 'application/octet-stream') {
$file_name = str_replace("{\$mac}",$mac,$file);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php
index 6905a786ed..62a8118182 100644
--- a/app/provision/resources/classes/provision.php
+++ b/app/provision/resources/classes/provision.php
@@ -402,7 +402,7 @@ include "root.php";
//get the contacts array and add to the template engine
if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory']['boolean'] == "true") {
//get contacts from the database
- $sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, p.phone_number, p.phone_extension ";
+ $sql = "select c.contact_category, c.contact_organization, c.contact_name_given, c.contact_name_family, p.phone_number, p.phone_extension ";
$sql .= "from v_contacts as c, v_contact_phones as p ";
$sql .= "where c.domain_uuid = '".$domain_uuid."' ";
$sql .= "and c.contact_uuid = p.contact_uuid ";
@@ -801,6 +801,13 @@ include "root.php";
$tmp_array = '';
$i = 0;
+ //build the provision array
+ foreach($_SESSION['provision'] as $key=>$val) {
+ if (strlen($val['var']) > 0) { $value = $val['var']; }
+ if (strlen($val['text']) > 0) { $value = $val['text']; }
+ $provision[$key] = $value;
+ }
+
//get the devices
$sql = "select * from v_devices ";
//$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
diff --git a/core/databases/app_defaults.php b/core/databases/app_defaults.php
index ea4d04d6c9..71adfaced2 100644
--- a/core/databases/app_defaults.php
+++ b/core/databases/app_defaults.php
@@ -126,6 +126,9 @@ if ($domains_processed == 1) {
$config = $_SESSION['switch']['scripts']['dir']."/resources/config.lua";
}
$fout = fopen($config,"w");
+ if(!$fout){
+ throw new Exception("Failed to open '$config' for writing");
+ }
$tmp = "\n";
$tmp .= "--set the variables\n";
if (strlen($_SESSION['switch']['sounds']['dir']) > 0) {
diff --git a/core/install/app_languages.php b/core/install/app_languages.php
index 22ead46f1e..668e6dff7a 100644
--- a/core/install/app_languages.php
+++ b/core/install/app_languages.php
@@ -1,8 +1,8 @@
\n";
echo "\n";
- echo "
\n";
-
echo "
";
echo "WiP
";
diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php
index b4366275fa..ad08a3faeb 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 = '';
@@ -63,7 +63,7 @@ if (is_link('/etc/localtime')) {
// Ubuntu / Debian.
$data = file_get_contents('/etc/timezone');
if ($data) {
- $timezone = $data;
+ $timezone = rtrim($data);
}
} elseif (file_exists('/etc/sysconfig/clock')) {
// RHEL / CentOS
@@ -80,7 +80,6 @@ $first_time_install = true;
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
$first_time_install = false;
} elseif (file_exists("/etc/fusionpbx/config.php")) {
- //linux
$first_time_install = false;
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
$first_time_install = false;
@@ -98,7 +97,7 @@ if(!$first_time_install) {
$install_step = '';
$return_install_step = '';
-if (count($_POST)>0) {
+if (count($_POST) > 0) {
$install_language = check_str($_POST["install_language"]);
$install_step = check_str($_POST["install_step"]);
$return_install_step = check_str($_POST["return_install_step"]);
@@ -130,7 +129,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 +146,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 +167,7 @@ if(!$install_step) { $install_step = 'select_language'; }
"You can use the following to find what ports are allowedsemanage port -l | grep '^http_port_t'
";
}
}
-
+
//action code
if($return_install_step == 'config_detail'){
//check for all required data
@@ -185,11 +184,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";
@@ -224,6 +220,9 @@ if(!$install_step) { $install_step = 'select_language'; }
echo " \n";
echo "\n";
}elseif($install_step == 'detect_config'){
+ if(!($event_host == '' || $event_host == 'localhost' || $event_host == '::1' || $event_host == '127.0.0.1' )){
+ echo "Warning you have choosen a value other than localhost for event_host, this is unsoported at present
\n";
+ }
include "resources/page_parts/install_event_socket.php";
if($detect_ok){
echo "\n";
+ }else{
+ echo "\n";
}
}
elseif($install_step == 'config_detail'){
@@ -262,7 +267,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){
@@ -285,32 +290,34 @@ if(!$install_step) { $install_step = 'select_language'; }
#set_error_handler("error_handler");
try {
require_once "resources/classes/install_fusionpbx.php";
- $fusionPBX = new install_fusionpbx($domain_name, null, $switch_detect);
- $domain_uuid = $fusionPBX->domain_uuid();
- //$fusionPBX->debug = true;
- $fusionPBX->admin_username = $admin_username;
- $fusionPBX->admin_password = $admin_password;
- $fusionPBX->default_country = $install_default_country;
- $fusionPBX->install_language = $install_language;
- $fusionPBX->template_name = $install_template_name;
+ $system = new install_fusionpbx($domain_name, null, $switch_detect);
+ $domain_uuid = $system->domain_uuid();
+ $system->admin_username = $admin_username;
+ $system->admin_password = $admin_password;
+ $system->default_country = $install_default_country;
+ $system->install_language = $install_language;
+ $system->template_name = $install_template_name;
foreach($_POST as $key=>$value){
if(substr($key,0,3) == "db_"){
- $fusionPBX->$key = $value;
+ $system->$key = $value;
}
}
- $fusionPBX->install();
-
+
require_once "resources/classes/install_switch.php";
$switch = new install_switch($domain_name, $domain_uuid, $switch_detect);
//$switch->debug = true;
+ //$system->debug = true;
+ $system->install();
$switch->install();
+ $system->app_defaults();
+ $switch_detect->restart_switch();
}catch(Exception $e){
echo "\n";
echo "Failed to install
" . $e->getMessage() . "
\n";
try {
require_once "resources/classes/install_fusionpbx.php";
- $fusionPBX = new install_fusionpbx($domain_name, $domain_uuid, $switch_detect);
- $fusionPBX->remove_config();
+ $system = new install_fusionpbx($domain_name, $domain_uuid, $switch_detect);
+ $system->remove_config();
}catch(Exception $e){
echo "Failed to remove config: " . $e->getMessage() . "
\n";
}
@@ -345,6 +352,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_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php
index b7482fe592..b38860fb10 100644
--- a/core/install/resources/classes/install_fusionpbx.php
+++ b/core/install/resources/classes/install_fusionpbx.php
@@ -35,11 +35,11 @@ include "root.php";
protected $config_php;
protected $menu_uuid = 'b4750c3f-2a86-b00d-b7d0-345c14eca286';
protected $dbh;
-
+
public function domain_uuid() { return $this->_domain_uuid; }
public $debug = false;
-
+
public $install_msg;
public $install_language = 'en-us';
public $admin_username;
@@ -54,7 +54,7 @@ include "root.php";
public $db_name;
public $db_username;
public $db_password;
-
+
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)');
@@ -94,9 +94,8 @@ include "root.php";
$this->create_superuser();
require "resources/require.php";
$this->create_menus();
- $this->app_defaults();
}
-
+
protected function create_config_php() {
$tmp_config = "";
-
- if((file_exists($this->config_php) and !is_writable($this->config_php))
- or !is_writable(dirname($this->config_php))
- ){
+
+ if((file_exists($this->config_php)
+ and !is_writable($this->config_php))
+ or !is_writable(dirname($this->config_php))
+ ) {
throw new Exception("cannot write to '" . $this->config_php . "'" );
}
$this->write_progress("Creating " . $this->config_php);
@@ -196,7 +196,7 @@ include "root.php";
unset($tmp_config);
fclose($fout);
}
-
+
protected function create_database() {
require $this->config_php;
$this->write_progress("Creating database as " . $this->db_type);
@@ -205,6 +205,7 @@ include "root.php";
global $db;
$db = $this->dbh;
}
+
protected function create_database_sqlite() {
//sqlite database will be created when the config.php is loaded and only if the database file does not exist
try {
@@ -268,7 +269,7 @@ include "root.php";
}
protected function create_database_pgsql() {
-
+
//if $this->db_create_username provided, attempt to create new PG role and database
if (strlen($this->db_create_username) > 0) {
try {
@@ -281,16 +282,16 @@ include "root.php";
} catch (PDOException $error) {
throw new Exception("error connecting to database: " . $error->getMessage());
}
-
+
//create the database, user, grant perms
$this->dbh->exec("CREATE DATABASE {$this->db_name}");
$this->dbh->exec("CREATE USER {$this->db_username} WITH PASSWORD '{$this->db_password}'");
$this->dbh->exec("GRANT ALL ON {$this->db_name} TO {$this->db_username}");
-
+
//close database connection_aborted
$this->dbh = null;
}
-
+
//open database connection with $this->db_name
try {
if (strlen($this->db_port) == 0) { $this->db_port = "5432"; }
@@ -303,7 +304,7 @@ include "root.php";
catch (PDOException $error) {
throw new Exception("error connecting to database: " . $error->getMessage());
}
-
+
//add the database structure
require_once "resources/classes/schema.php";
$schema = new schema;
@@ -311,7 +312,7 @@ include "root.php";
$schema->db_type = $this->db_type;
$schema->sql();
$schema->exec();
-
+
//get the contents of the sql file
if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql')){
$filename = "/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql";
@@ -320,10 +321,10 @@ include "root.php";
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql';
}
$file_contents = file_get_contents($filename);
-
+
//replace \r\n with \n then explode on \n
$file_contents = str_replace("\r\n", "\n", $file_contents);
-
+
//loop line by line through all the lines of sql code
$string_array = explode("\n", $file_contents);
$x = 0;
@@ -340,7 +341,7 @@ include "root.php";
}
unset ($file_contents, $sql);
}
-
+
protected function create_database_mysql() {
//database connection
try {
@@ -377,7 +378,7 @@ include "root.php";
catch (PDOException $error) {
throw new Exception("error creating database: " . $error->getMessage() . "\n" . $sql );
}
-
+
//create the table, user and set the permissions only if the db_create_username was provided
if (strlen($this->db_create_username) > 0) {
//select the mysql database
@@ -389,7 +390,7 @@ include "root.php";
throw new Exception("error conencting to database: " . $error->getMessage());
}
}
-
+
//create user and set the permissions
try {
$tmp_sql = "CREATE USER '".$this->db_username."'@'%' IDENTIFIED BY '".$this->db_password."'; ";
@@ -400,7 +401,7 @@ include "root.php";
print "error: " . $error->getMessage() . "
";
}
}
-
+
//set account to unlimited use
try {
if ($this->db_host == "localhost" || $this->db_host == "127.0.0.1") {
@@ -408,7 +409,7 @@ include "root.php";
$tmp_sql .= "IDENTIFIED BY '".$this->db_password."' ";
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
$this->dbh->query($tmp_sql);
-
+
$tmp_sql = "GRANT USAGE ON * . * TO '".$this->db_username."'@'127.0.0.1' ";
$tmp_sql .= "IDENTIFIED BY '".$this->db_password."' ";
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
@@ -426,7 +427,7 @@ include "root.php";
print "error: " . $error->getMessage() . "
";
}
}
-
+
//create the database and set the create user with permissions
try {
$tmp_sql = "CREATE DATABASE IF NOT EXISTS ".$this->db_name."; ";
@@ -437,7 +438,7 @@ include "root.php";
print "error: " . $error->getMessage() . "
";
}
}
-
+
//set user permissions
try {
$this->dbh->query("GRANT ALL PRIVILEGES ON ".$this->db_name.".* TO '".$this->db_username."'@'%'; ");
@@ -447,7 +448,7 @@ include "root.php";
print "error: " . $error->getMessage() . "
";
}
}
-
+
//make the changes active
try {
$tmp_sql = "FLUSH PRIVILEGES; ";
@@ -458,9 +459,9 @@ include "root.php";
print "error: " . $error->getMessage() . "
";
}
}
-
+
} //if (strlen($this->db_create_username) > 0)
-
+
//select the database
try {
$this->dbh->query("USE ".$this->db_name.";");
@@ -470,7 +471,7 @@ include "root.php";
print "error: " . $error->getMessage() . "
";
}
}
-
+
//add the database structure
require_once "resources/classes/schema.php";
$schema = new schema;
@@ -478,7 +479,7 @@ include "root.php";
$schema->db_type = $this->db_type;
$schema->sql();
$schema->exec();
-
+
//add the defaults data into the database
//get the contents of the sql file
if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/mysql.sql')){
@@ -488,10 +489,10 @@ include "root.php";
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/mysql.sql';
}
$file_contents = file_get_contents($filename);
-
+
//replace \r\n with \n then explode on \n
$file_contents = str_replace("\r\n", "\n", $file_contents);
-
+
//loop line by line through all the lines of sql code
$string_array = explode("\n", $file_contents);
$x = 0;
@@ -513,7 +514,6 @@ include "root.php";
unset ($file_contents, $sql);
}
-
protected function create_domain() {
$this->write_progress("Checking if domain exists '" . $this->domain_name . "'");
$sql = "select * from v_domains ";
@@ -530,7 +530,7 @@ include "root.php";
if($result['domain_enabled'] != 'true'){
throw new Exception("Domain already exists but is disabled, this is unexpected");
}
- }else{
+ } else {
$this->write_progress("... creating domain");
$sql = "insert into v_domains ";
$sql .= "(";
@@ -544,11 +544,11 @@ include "root.php";
$sql .= "'".$this->domain_name."', ";
$sql .= "'' ";
$sql .= ");";
-
+
$this->write_debug($sql);
$this->dbh->exec(check_sql($sql));
unset($sql);
-
+
//domain settings
$x = 0;
$tmp[$x]['name'] = 'uuid';
@@ -580,7 +580,7 @@ include "root.php";
$tmp[$x]['subcategory'] = 'template';
$tmp[$x]['enabled'] = 'true';
$x++;
-
+
//switch settings
$tmp[$x]['name'] = 'dir';
$tmp[$x]['value'] = $switch_bin_dir;
@@ -684,7 +684,7 @@ include "root.php";
$tmp[$x]['subcategory'] = 'dialplan';
$tmp[$x]['enabled'] = 'false';
$x++;
-
+
//server settings
$tmp[$x]['name'] = 'dir';
$tmp[$x]['value'] = $this->detect_switch->temp_dir();
@@ -705,7 +705,7 @@ include "root.php";
$tmp[$x]['subcategory'] = 'backup';
$tmp[$x]['enabled'] = 'true';
$x++;
-
+
$this->dbh->beginTransaction();
foreach($tmp as $row) {
$sql = "insert into v_default_settings ";
@@ -732,7 +732,7 @@ include "root.php";
}
$this->dbh->commit();
unset($tmp);
-
+
//get the list of installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$x=0;
@@ -740,7 +740,7 @@ include "root.php";
include($config_path);
$x++;
}
-
+
//add the groups
$x = 0;
$tmp[$x]['group_name'] = 'superadmin';
@@ -814,7 +814,7 @@ include "root.php";
$this->dbh->commit();
}
}
-
+
protected function create_superuser() {
$this->write_progress("Checking if superuser exists '" . $this->domain_name . "'");
$sql = "select * from v_users ";
@@ -933,14 +933,14 @@ include "root.php";
unset($sql);
}
}
-
+
protected function create_menus() {
$this->write_progress("Creating menus");
//set the defaults
$menu_name = 'default';
$menu_language = 'en-us';
$menu_description = 'Default Menu Set';
-
+
$this->write_progress("Checking if menu exists");
$sql = "select count(*) from v_menus ";
$sql .= "where menu_uuid = '".$this->menu_uuid."' ";
@@ -971,7 +971,7 @@ include "root.php";
}
$this->dbh->exec(check_sql($sql));
unset($sql);
-
+
//add the menu items
require_once "resources/classes/menu.php";
$menu = new menu;
@@ -981,16 +981,19 @@ include "root.php";
unset($menu);
}
}
-
- protected function app_defaults() {
+
+ public function app_defaults() {
$this->write_progress("Running app_defaults");
-
+
//set needed session settings
$_SESSION["username"] = $this->admin_username;
$_SESSION["domain_uuid"] = $this->_domain_uuid;
require $this->config_php;
require "resources/require.php";
-
+ $_SESSION['event_socket_ip_address'] = $this->detect_switch->event_host;
+ $_SESSION['event_socket_port'] = $this->detect_switch->event_port;
+ $_SESSION['event_socket_password'] = $this->detect_switch->event_password;
+
//get the groups assigned to the user and then set the groups in $_SESSION["groups"]
$sql = "SELECT * FROM v_group_users ";
$sql .= "where domain_uuid=:domain_uuid ";
@@ -1002,7 +1005,7 @@ include "root.php";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$_SESSION["groups"] = $result;
unset($sql, $row_count, $prep_statement);
-
+
//get the permissions assigned to the groups that the user is a member of set the permissions in $_SESSION['permissions']
$x = 0;
$sql = "select distinct(permission_name) from v_group_permissions ";
@@ -1017,37 +1020,41 @@ include "root.php";
$x++;
}
}
- $prep_statementsub = $this->dbh->prepare($sql);
- $prep_statementsub->execute();
- $_SESSION['permissions'] = $prep_statementsub->fetchAll(PDO::FETCH_NAMED);
- unset($sql, $prep_statementsub);
+ $prep_statement_sub = $this->dbh->prepare($sql);
+ $prep_statement_sub->execute();
+ $_SESSION['permissions'] = $prep_statement_sub->fetchAll(PDO::FETCH_NAMED);
+ unset($sql, $prep_statement_sub);
+ //include the config.php
+ $db_type = $this->db_type;
+ $db_path = $this->db_path;
+ $db_host = $this->db_host;
+ $db_port = $this->db_port;
+ $db_name = $this->db_name;
+ $db_username = $this->db_username;
+ $db_password = $this->db_password;
-
-
-
+ //add the database structure
require_once "resources/classes/schema.php";
- global $db, $db_type, $db_name, $db_username, $db_password, $db_host, $db_path, $db_port;
-
$schema = new schema;
echo $schema->schema();
-
+
//run all app_defaults.php files
$default_language = $this->install_language;
$domain = new domains;
$domain->upgrade();
-
+
//synchronize the config with the saved settings
save_switch_xml();
-
+
//do not show the apply settings reminder on the login page
$_SESSION["reload_xml"] = false;
-
+
//clear the menu
$_SESSION["menu"] = "";
-
+
}
-
+
public function remove_config() {
if (file_exists('/bin/rm')) {
$this->write_debug('rm -f ' . $this->config_php);
@@ -1064,4 +1071,5 @@ include "root.php";
clearstatcache();
}
}
+
?>
\ No newline at end of file
diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php
index b13c36b23d..715c2cef5b 100644
--- a/core/install/resources/classes/install_switch.php
+++ b/core/install/resources/classes/install_switch.php
@@ -35,7 +35,14 @@ include "root.php";
public $debug = false;
function __construct($domain_name, $domain_uuid, $detect_switch) {
- if(!is_a($detect_switch, 'detect_switch')){
+ if($detect_switch == null){
+ if(strlen($_SESSION['event_socket_ip_address']) == 0 or strlen($_SESSION['event_socket_port']) == 0 or strlen($_SESSION['event_socket_password']) == 0 ){
+ throw new Exception('The parameter $detect_switch was empty and i could not find the event socket details from the session');
+ }
+ $detect_switch = new detect_switch($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
+ $domain_name = $_SESSION['domain_name'];
+ $domain_uuid = $_SESSION['domain_uuid'];
+ }elseif(!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;
@@ -166,13 +173,9 @@ include "root.php";
}
}
-
function install() {
$this->copy_conf();
$this->copy_scripts();
- //tell freeswitch to restart
- $this->write_progress("Restarting switch");
- $this->detect_switch->restart_switch();
}
function upgrade() {
@@ -182,10 +185,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)) {
@@ -236,15 +239,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);
}
diff --git a/core/install/resources/page_parts/install_config_database.php b/core/install/resources/page_parts/install_config_database.php
index ad8e632734..371a726b98 100644
--- a/core/install/resources/page_parts/install_config_database.php
+++ b/core/install/resources/page_parts/install_config_database.php
@@ -31,7 +31,7 @@
echo "\n";
echo "\n";
- echo "\n";
+ echo "\n";
echo "\n";
echo "\n";
echo "\n";
diff --git a/core/install/resources/page_parts/install_config_detail.php b/core/install/resources/page_parts/install_config_detail.php
index 8ee7597ba9..6fd2c8ce05 100644
--- a/core/install/resources/page_parts/install_config_detail.php
+++ b/core/install/resources/page_parts/install_config_detail.php
@@ -31,7 +31,7 @@
echo "\n";
echo "\n";
- echo "\n";
+ echo "\n";
echo "\n";
echo "\n";
diff --git a/core/install/resources/page_parts/install_event_socket.php b/core/install/resources/page_parts/install_event_socket.php
index 928c6e5424..5d25ff6c43 100644
--- a/core/install/resources/page_parts/install_event_socket.php
+++ b/core/install/resources/page_parts/install_event_socket.php
@@ -31,10 +31,10 @@
try {
$switch_detect->detect();
} catch(Exception $e){
- $messages[] = "Failed to detect confgiuration detect_switch reported: " . $e->getMessage();
+ echo "Failed to detect configuration detect_switch reported: " . $e->getMessage() ."
\n";
$detect_ok = false;
}
- echo "