From 1e37ce5d3a150d406cc0820f18b205645e924a49 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 19 Nov 2015 11:33:07 +0000 Subject: [PATCH 01/14] Optimized control of background images It is now possible to have the default setting to enable background images (via theme > enable_background_images) but have a domain turn it off again as they want to use gradients or specific images. Upgrading any installation that already has any background_image enabled will cause enable_background_images to turn on to let it continue to work. Including support code that the new install system will utilize, should not affect existing systems. --- themes/enhanced/app_defaults.php | 201 +++++++++++++++++++------------ themes/enhanced/template.php | 2 +- 2 files changed, 122 insertions(+), 81 deletions(-) diff --git a/themes/enhanced/app_defaults.php b/themes/enhanced/app_defaults.php index f08e217176..5d13f453a9 100644 --- a/themes/enhanced/app_defaults.php +++ b/themes/enhanced/app_defaults.php @@ -26,7 +26,64 @@ if ($domains_processed == 1) { + //get the background images + $relative_path = PROJECT_PATH.'/themes/enhanced/images/backgrounds'; + $backgrounds = opendir($_SERVER["DOCUMENT_ROOT"].'/'.$relative_path); + unset($array); + $x = 0; + while (false !== ($file = readdir($backgrounds))) { + if ($file != "." AND $file != ".."){ + $new_path = $dir.'/'.$file; + $level = explode('/',$new_path); + $ext = pathinfo($file, PATHINFO_EXTENSION); + if ($ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "gif") { + $x++; + $array[$x]['default_setting_category'] = 'theme'; + $array[$x]['default_setting_subcategory'] = 'background_image'; + $array[$x]['default_setting_name'] = 'array'; + $array[$x]['default_setting_value'] = $relative_path.'/'.$file; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.'; + } + if ($x > 300) { break; }; + } + } + + if(!$set_session_theme){ + //get default settings + $sql = "select * from v_default_settings "; + $sql .= "where default_setting_category = 'theme' "; + $sql .= "and default_setting_subcategory = 'background_image' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset($prep_statement); + + $enable_background_images = false; + //add theme default settings + foreach ($array as $row) { + $found = false; + foreach ($default_settings as $field) { + if ($field["default_setting_value"] == $row["default_setting_value"]) { + $found = true; + } + //enable_background_image is a new setting, if a user has any background images enabled we should turn it on + if ($field["default_setting_enabled"] == 'enabled') { + $enable_background_images = true; + } + } + if (!$found) { + $orm = new orm; + $orm->name('default_settings'); + $orm->save($row); + $message = $orm->message; + //print_r($message); + } + } + } + //define array of settings + unset($array); $x = 0; $array[$x]['default_setting_category'] = 'theme'; $array[$x]['default_setting_subcategory'] = 'login_opacity'; @@ -181,25 +238,46 @@ if ($domains_processed == 1) { $array[$x]['default_setting_value'] = '0.96'; $array[$x]['default_setting_enabled'] = 'false'; $array[$x]['default_setting_description'] = 'Set the opacity of the main menu (decimal, Minimized theme only).'; + $x++; + $array[$x]['default_setting_category'] = 'theme'; + $array[$x]['default_setting_subcategory'] = 'enable_background_images'; + $array[$x]['default_setting_name'] = 'boolean'; + $array[$x]['default_setting_value'] = 'true'; + $array[$x]['default_setting_enabled'] = 'false'; + if($enable_background_images) { $array[$x]['default_setting_enabled'] = 'true'; } + $array[$x]['default_setting_description'] = 'Enable use of background images.'; - //iterate and add each, if necessary - foreach ($array as $index => $default_settings) { - //add theme default settings - $sql = "select count(*) as num_rows from v_default_settings "; - $sql .= "where default_setting_category = 'theme' "; - $sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' "; - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - unset($prep_statement); - if ($row['num_rows'] == 0) { - $orm = new orm; - $orm->name('default_settings'); - $orm->save($array[$index]); - $message = $orm->message; + if($set_session_theme){ + foreach ($array as $index => $default_settings) { + $sub_category = $array[$index]['default_setting_subcategory']; + $name = $array[$index]['default_setting_name']; + if($array[$index]['default_setting_enabled'] == 'true'){ + $_SESSION['theme'][$sub_category][$name] = $array[$index]['default_setting_value']; + }else{ + $_SESSION['theme'][$sub_category][$name] = ''; + } + } + } + else{ + //iterate and add each, if necessary + foreach ($array as $index => $default_settings) { + //add theme default settings + $sql = "select count(*) as num_rows from v_default_settings "; + $sql .= "where default_setting_category = 'theme' "; + $sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] == 0) { + $orm = new orm; + $orm->name('default_settings'); + $orm->save($array[$index]); + $message = $orm->message; + } + unset($row); } - unset($row); } } @@ -222,73 +300,36 @@ if ($domains_processed == 1) { $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_description'] = 'Set a secondary background (HTML compatible) color, for a gradient effect.'; - //add secondary background color separately, if missing - $sql = "select count(*) as num_rows from v_default_settings "; - $sql .= "where default_setting_category = 'theme' "; - $sql .= "and default_setting_subcategory = 'background_color' "; - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - unset($prep_statement); - if ($row['num_rows'] == 0) { - $orm = new orm; - $orm->name('default_settings'); - foreach ($array as $index => $null) { - $orm->save($array[$index]); + if($set_session_theme){ + foreach ($array as $index => $default_settings) { + $sub_category = $array[$index]['default_setting_subcategory']; + $idx = $array[$index]['default_setting_order']; + if($array[$index]['default_setting_enabled'] == 'true'){ + $_SESSION['theme'][$sub_category][$idx] = $array[$index]['default_setting_value']; } - $message = $orm->message; - //print_r($message); } - unset($row); + return; } - - //get the background images - $relative_path = PROJECT_PATH.'/themes/enhanced/images/backgrounds'; - $backgrounds = opendir($_SERVER["DOCUMENT_ROOT"].'/'.$relative_path); - unset($array); - $x = 0; - while (false !== ($file = readdir($backgrounds))) { - if ($file != "." AND $file != ".."){ - $new_path = $dir.'/'.$file; - $level = explode('/',$new_path); - $ext = pathinfo($file, PATHINFO_EXTENSION); - if ($ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "gif") { - $x++; - $array[$x]['default_setting_category'] = 'theme'; - $array[$x]['default_setting_subcategory'] = 'background_image'; - $array[$x]['default_setting_name'] = 'array'; - $array[$x]['default_setting_value'] = $relative_path.'/'.$file; - $array[$x]['default_setting_enabled'] = 'false'; - $array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.'; + else{ + //add secondary background color separately, if missing + $sql = "select count(*) as num_rows from v_default_settings "; + $sql .= "where default_setting_category = 'theme' "; + $sql .= "and default_setting_subcategory = 'background_color' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] == 0) { + $orm = new orm; + $orm->name('default_settings'); + foreach ($array as $index => $null) { + $orm->save($array[$index]); + } + $message = $orm->message; + //print_r($message); } - if ($x > 300) { break; }; - } - } - - //get default settings - $sql = "select * from v_default_settings "; - $sql .= "where default_setting_category = 'theme' "; - $sql .= "and default_setting_subcategory = 'background_image' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); - unset($prep_statement); - - //add theme default settings - foreach ($array as $row) { - $found = false; - foreach ($default_settings as $field) { - if ($field["default_setting_value"] == $row["default_setting_value"]) { - $found = true; - } - } - if (!$found) { - $orm = new orm; - $orm->name('default_settings'); - $orm->save($row); - $message = $orm->message; - //print_r($message); + unset($row); } } diff --git a/themes/enhanced/template.php b/themes/enhanced/template.php index e5cf267146..e33e6e390f 100644 --- a/themes/enhanced/template.php +++ b/themes/enhanced/template.php @@ -1424,7 +1424,7 @@ if (strlen($_SESSION['message']) > 0) { Date: Thu, 19 Nov 2015 13:17:01 +0000 Subject: [PATCH 02/14] BugFix + Optional Enable extensions appear in directory BugFix to respect http_domain_filter when auto creating setting provision> directory_extensions populates $extensions as a contacts array in provisioning --- app/provision/app_defaults.php | 7 ++++ app/provision/resources/classes/provision.php | 41 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/app/provision/app_defaults.php b/app/provision/app_defaults.php index 7e80fd2e59..da82965d6e 100644 --- a/app/provision/app_defaults.php +++ b/app/provision/app_defaults.php @@ -179,6 +179,13 @@ $array[$x]['default_setting_enabled'] = 'false'; $array[$x]['default_setting_description'] = ''; $x++; + $array[$x]['default_setting_category'] = 'provision'; + $array[$x]['default_setting_subcategory'] = 'directory_extensions'; + $array[$x]['default_setting_name'] = 'boolean'; + $array[$x]['default_setting_value'] = 'true'; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = 'allow extensions to be provisioned as contacts as $extensions in provision templates'; + $x++; $array[$x]['default_setting_category'] = 'ntp_server_primary'; $array[$x]['default_setting_subcategory'] = 'directory'; $array[$x]['default_setting_name'] = 'text'; diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 66fa4645cb..6905a786ed 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -180,11 +180,17 @@ include "root.php"; if (strlen($device_template) == 0) { $sql = "SELECT * FROM v_devices "; $sql .= "WHERE device_mac_address=:mac "; + if($provision['http_domain_filter'] == "true") { + $sql .= "AND domain_uuid=:domain_uuid "; + } //$sql .= "WHERE device_mac_address= '$mac' "; $prep_statement_2 = $this->db->prepare(check_sql($sql)); if ($prep_statement_2) { //use the prepared statement $prep_statement_2->bindParam(':mac', $mac); + if($provision['http_domain_filter'] == "true") { + $prep_statement_2->bindParam(':domain_uuid', $domain_uuid); + } $prep_statement_2->execute(); $row = $prep_statement_2->fetch(); //set the variables from values in the database @@ -300,8 +306,14 @@ include "root.php"; if (strlen($device_uuid) > 0) { $sql = "SELECT * FROM v_devices "; $sql .= "WHERE device_uuid = '".$device_uuid."' "; + if($provision['http_domain_filter'] == "true") { + $sql .= "AND domain_uuid=:domain_uuid "; + } $prep_statement_3 = $this->db->prepare(check_sql($sql)); if ($prep_statement_3) { + if($provision['http_domain_filter'] == "true") { + $prep_statement_3->bindParam(':domain_uuid', $domain_uuid); + } $prep_statement_3->execute(); $row = $prep_statement_3->fetch(); $device_uuid_alternate = $row["device_uuid_alternate"]; @@ -311,8 +323,14 @@ include "root.php"; //get the new devices information $sql = "SELECT * FROM v_devices "; $sql .= "WHERE device_uuid = '".$device_uuid."' "; + if($provision['http_domain_filter'] == "true") { + $sql .= "AND domain_uuid=:domain_uuid "; + } $prep_statement_4 = $this->db->prepare(check_sql($sql)); if ($prep_statement_4) { + if($provision['http_domain_filter'] == "true") { + $prep_statement_4->bindParam(':domain_uuid', $domain_uuid); + } $prep_statement_4->execute(); $row = $prep_statement_4->fetch(); $device_label = $row["device_label"]; @@ -455,6 +473,29 @@ include "root.php"; unset ($prep_statement); } + //get the extensions array and add to the template engine + if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_extensions']['boolean'] == "true") { + //get contacts from the database + $sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, e.extension "; + $sql .= "from v_contacts as c, v_extension_users as cte, v_extensions as e, v_users as u "; + $sql .= "where c.domain_uuid = '".$domain_uuid."' "; + $sql .= "and c.contact_uuid = u.contact_uuid "; + $sql .= "and u.user_uuid = cte.user_uuid "; + $sql .= "and cte.extension_uuid = e.extension_uuid "; + $sql .= "and e.directory_visible = 'true' "; + foreach ($lines as $line){ + $sql .= "and e.extension != '" . $line['user_id']. "' "; + } + $sql .= "order by c.contact_organization desc, c.contact_name_given asc, c.contact_name_family asc "; + $prep_statement = $this->db->prepare(check_sql($sql)); + $prep_statement->execute(); + $extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + + //assign the contacts array + $view->assign("extensions", $extensions); + } + //get the provisioning information from device keys if (strlen($device_uuid) > 0) { //get the device keys array From 6bc2186808d3d0c0e3f39041b68a612237bed80c Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 19 Nov 2015 13:57:23 +0000 Subject: [PATCH 03/14] Added External IPv6 support created the external IPv6 profile --- app/sip_profiles/app_defaults.php | 7 +- .../xml/sip_profiles/external-ipv6.xml | 23 +++++ .../sip_profiles/external-ipv6.xml.noload | 94 +++++++++++++++++++ 3 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 app/sip_profiles/resources/xml/sip_profiles/external-ipv6.xml create mode 100644 resources/templates/conf/sip_profiles/external-ipv6.xml.noload diff --git a/app/sip_profiles/app_defaults.php b/app/sip_profiles/app_defaults.php index 24d9cf2d80..3de33883bb 100644 --- a/app/sip_profiles/app_defaults.php +++ b/app/sip_profiles/app_defaults.php @@ -92,15 +92,18 @@ $sip_profile_description = "The Internal IPV6 profile binds to the IP version 6 address and is similar to the Internal profile.\n"; break; case "external": - $sip_profile_description .= "The External profile external provides anonymous calling in the public context. "; + $sip_profile_description = "The External profile external provides anonymous calling in the public context. "; $sip_profile_description .= "By default the External profile binds to port 5080. "; $sip_profile_description .= "Calls can be sent using a SIP URL \"voip.domain.com:5080\" "; break; + case "external-ipv6": + $sip_profile_description = "The External IPV6 profile binds to the IP version 6 address and is similar to the External profile.\n"; + break; case "lan": $sip_profile_description = "The LAN profile is the same as the Internal profile except that it is bound to the LAN IP.\n"; break; default: - $sip_profile_description .= ''; + $sip_profile_description = ''; } //add the sip profile if it is not false diff --git a/app/sip_profiles/resources/xml/sip_profiles/external-ipv6.xml b/app/sip_profiles/resources/xml/sip_profiles/external-ipv6.xml new file mode 100644 index 0000000000..f48bc7ed0e --- /dev/null +++ b/app/sip_profiles/resources/xml/sip_profiles/external-ipv6.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + +{v_sip_profile_settings} + + diff --git a/resources/templates/conf/sip_profiles/external-ipv6.xml.noload b/resources/templates/conf/sip_profiles/external-ipv6.xml.noload new file mode 100644 index 0000000000..4a4b4028ee --- /dev/null +++ b/resources/templates/conf/sip_profiles/external-ipv6.xml.noload @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d00f7a31e15fdaf7a81ce4fa794653c2ebce936c Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 19 Nov 2015 14:54:04 +0000 Subject: [PATCH 04/14] Added more ringer types corrected reference to ssl dir to use $conf_dir moved countries list out to its own file so it can be maintained easier (and used by other apps) --- app/vars/app_defaults.php | 502 ++++++--------------- resources/countries.php | 916 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 1057 insertions(+), 361 deletions(-) create mode 100644 resources/countries.php diff --git a/app/vars/app_defaults.php b/app/vars/app_defaults.php index 96309fd365..bac1fac58f 100644 --- a/app/vars/app_defaults.php +++ b/app/vars/app_defaults.php @@ -43,12 +43,34 @@ $vars = <<=2;+=.1;%(1400,0,350,440)","var_cat":"Defaults","var_enabled":"true","var_description":""}, {"var_name":"sit","var_value":"%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)","var_cat":"Defaults","var_enabled":"true","var_description":""}, {"var_name":"sip_tls_version","var_value":"tlsv1","var_cat":"SIP","var_enabled":"true","var_description":"U0lQIGFuZCBUTFMgc2V0dGluZ3Mu"}, @@ -56,12 +78,12 @@ $vars = <<prepare(check_sql($sql)); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + + if ($row['num_rows'] == 0) { + $sql = "insert into v_vars "; + $sql .= "("; + $sql .= "var_uuid, "; + $sql .= "var_name, "; + $sql .= "var_value, "; + $sql .= "var_cat, "; + $sql .= "var_enabled, "; + $sql .= "var_order, "; + $sql .= "var_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'default_country', "; + $sql .= "'".$country["isocode"]."', "; + $sql .= "'Defaults', "; + $sql .= "'true', "; + $sql .= "'".$x."', "; + $sql .= "'' "; + $sql .= ");"; + $db->exec(check_sql($sql)); + unset($sql, $row); + $x++; + } } - } - - if ( !$found ) { - return; - } - - // Set default Country ISO code - $sql = "select count(*) as num_rows from v_vars "; - $sql .= "where var_name = 'default_country' "; - $sql .= "and var_cat = 'Defaults' "; - $prep_statement = $db->prepare(check_sql($sql)); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - - if ($row['num_rows'] == 0) { - $sql = "insert into v_vars "; - $sql .= "("; - $sql .= "var_uuid, "; - $sql .= "var_name, "; - $sql .= "var_value, "; - $sql .= "var_cat, "; - $sql .= "var_enabled, "; - $sql .= "var_order, "; - $sql .= "var_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'default_country', "; - $sql .= "'".$country["isocode"]."', "; - $sql .= "'Defaults', "; - $sql .= "'true', "; - $sql .= "'".$x."', "; - $sql .= "'' "; - $sql .= ");"; - $db->exec(check_sql($sql)); - unset($sql, $row); - $x++; + unset($prep_statement, $sql); + + // Set default Country code + $sql = "select count(*) as num_rows from v_vars "; + $sql .= "where var_name = 'default_countrycode' "; + $sql .= "and var_cat = 'Defaults' "; + $prep_statement = $db->prepare(check_sql($sql)); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] == 0) { + $sql = "insert into v_vars "; + $sql .= "("; + $sql .= "var_uuid, "; + $sql .= "var_name, "; + $sql .= "var_value, "; + $sql .= "var_cat, "; + $sql .= "var_enabled, "; + $sql .= "var_order, "; + $sql .= "var_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'default_countrycode', "; + $sql .= "'".$country["countrycode"]."', "; + $sql .= "'Defaults', "; + $sql .= "'true', "; + $sql .= "'".$x."', "; + $sql .= "'' "; + $sql .= ");"; + $db->exec(check_sql($sql)); + unset($sql, $row); + $x++; + } } - } - unset($prep_statement, $sql); - - // Set default Country code - $sql = "select count(*) as num_rows from v_vars "; - $sql .= "where var_name = 'default_countrycode' "; - $sql .= "and var_cat = 'Defaults' "; - $prep_statement = $db->prepare(check_sql($sql)); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - if ($row['num_rows'] == 0) { - $sql = "insert into v_vars "; - $sql .= "("; - $sql .= "var_uuid, "; - $sql .= "var_name, "; - $sql .= "var_value, "; - $sql .= "var_cat, "; - $sql .= "var_enabled, "; - $sql .= "var_order, "; - $sql .= "var_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'default_countrycode', "; - $sql .= "'".$country["countrycode"]."', "; - $sql .= "'Defaults', "; - $sql .= "'true', "; - $sql .= "'".$x."', "; - $sql .= "'' "; - $sql .= ");"; - $db->exec(check_sql($sql)); - unset($sql, $row); - $x++; + unset($prep_statement, $sql); + + // Set default International Direct Dialing code + $sql = "select count(*) as num_rows from v_vars "; + $sql .= "where var_name = 'default_exitcode' "; + $sql .= "and var_cat = 'Defaults' "; + $prep_statement = $db->prepare(check_sql($sql)); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] == 0) { + $sql = "insert into v_vars "; + $sql .= "("; + $sql .= "var_uuid, "; + $sql .= "var_name, "; + $sql .= "var_value, "; + $sql .= "var_cat, "; + $sql .= "var_enabled, "; + $sql .= "var_order, "; + $sql .= "var_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'default_exitcode', "; + $sql .= "'".$country["exitcode"]."', "; + $sql .= "'Defaults', "; + $sql .= "'true', "; + $sql .= "'".$x."', "; + $sql .= "'' "; + $sql .= ");"; + $db->exec(check_sql($sql)); + unset($sql, $row); + $x++; + } } + unset($prep_statement, $sql); + + unset($countries); } - unset($prep_statement, $sql); - - // Set default International Direct Dialing code - $sql = "select count(*) as num_rows from v_vars "; - $sql .= "where var_name = 'default_exitcode' "; - $sql .= "and var_cat = 'Defaults' "; - $prep_statement = $db->prepare(check_sql($sql)); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - if ($row['num_rows'] == 0) { - $sql = "insert into v_vars "; - $sql .= "("; - $sql .= "var_uuid, "; - $sql .= "var_name, "; - $sql .= "var_value, "; - $sql .= "var_cat, "; - $sql .= "var_enabled, "; - $sql .= "var_order, "; - $sql .= "var_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'default_exitcode', "; - $sql .= "'".$country["exitcode"]."', "; - $sql .= "'Defaults', "; - $sql .= "'true', "; - $sql .= "'".$x."', "; - $sql .= "'' "; - $sql .= ");"; - $db->exec(check_sql($sql)); - unset($sql, $row); - $x++; - } - } - unset($prep_statement, $sql); - - unset($countries); } } diff --git a/resources/countries.php b/resources/countries.php new file mode 100644 index 0000000000..88f144c60a --- /dev/null +++ b/resources/countries.php @@ -0,0 +1,916 @@ + \ No newline at end of file From b4c6b7247d1d4538758173f274fdee37c09955be Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 19 Nov 2015 14:57:47 +0000 Subject: [PATCH 05/14] Bugfix --- app/vars/app_defaults.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vars/app_defaults.php b/app/vars/app_defaults.php index bac1fac58f..1a0c840845 100644 --- a/app/vars/app_defaults.php +++ b/app/vars/app_defaults.php @@ -99,7 +99,7 @@ EOD; // Set country depend variables as country code and international direct dialing code (exit code) if (!function_exists('set_country_vars')) { function set_country_vars($db, $x) { - require "resources/classes/countries.php"; + require "resources/countries.php"; // $country_iso=$_SESSION['domain']['country']['iso_code']; From 1d51571364b1e4cbd8b49c58e5d86746049a5372 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 19 Nov 2015 10:34:28 -0700 Subject: [PATCH 06/14] Change setting enable_background_images to background_image_enabled. This keeps the code consistent as 'enabled' is used throughout the code as a suffix. It also displays this setting next to the background_image setting. --- themes/enhanced/app_defaults.php | 8 ++++---- themes/enhanced/template.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/enhanced/app_defaults.php b/themes/enhanced/app_defaults.php index 5d13f453a9..333fb6efca 100644 --- a/themes/enhanced/app_defaults.php +++ b/themes/enhanced/app_defaults.php @@ -59,7 +59,7 @@ if ($domains_processed == 1) { $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset($prep_statement); - $enable_background_images = false; + $background_image_enabled = false; //add theme default settings foreach ($array as $row) { $found = false; @@ -69,7 +69,7 @@ if ($domains_processed == 1) { } //enable_background_image is a new setting, if a user has any background images enabled we should turn it on if ($field["default_setting_enabled"] == 'enabled') { - $enable_background_images = true; + $background_image_enabled = true; } } if (!$found) { @@ -240,11 +240,11 @@ if ($domains_processed == 1) { $array[$x]['default_setting_description'] = 'Set the opacity of the main menu (decimal, Minimized theme only).'; $x++; $array[$x]['default_setting_category'] = 'theme'; - $array[$x]['default_setting_subcategory'] = 'enable_background_images'; + $array[$x]['default_setting_subcategory'] = 'background_image_enabled'; $array[$x]['default_setting_name'] = 'boolean'; $array[$x]['default_setting_value'] = 'true'; $array[$x]['default_setting_enabled'] = 'false'; - if($enable_background_images) { $array[$x]['default_setting_enabled'] = 'true'; } + if($background_image_enabled) { $array[$x]['default_setting_enabled'] = 'true'; } $array[$x]['default_setting_description'] = 'Enable use of background images.'; if($set_session_theme){ diff --git a/themes/enhanced/template.php b/themes/enhanced/template.php index e33e6e390f..beefeb7c01 100644 --- a/themes/enhanced/template.php +++ b/themes/enhanced/template.php @@ -1424,7 +1424,7 @@ if (strlen($_SESSION['message']) > 0) { Date: Thu, 19 Nov 2015 13:45:06 -0800 Subject: [PATCH 07/14] Update y000000000028.cfg --- .../provision/yealink/t46g/y000000000028.cfg | 86 +++++++++++++------ 1 file changed, 60 insertions(+), 26 deletions(-) diff --git a/resources/templates/provision/yealink/t46g/y000000000028.cfg b/resources/templates/provision/yealink/t46g/y000000000028.cfg index 7e540ed1fe..3ff3e5e195 100644 --- a/resources/templates/provision/yealink/t46g/y000000000028.cfg +++ b/resources/templates/provision/yealink/t46g/y000000000028.cfg @@ -26,8 +26,45 @@ network.pc_port.speed_duplex = network.pc_port.dhcp_server = 1 network.static_dns_enable = 0 +{if isset($vlan_port_id) } ####################################################################################### -## VLAN ## +## VLAN ENABLED ## +####################################################################################### +network.vlan.internet_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.internet_port_vid = {$vlan_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.internet_port_priority = + +#Enable or disable the VLAN of PC port; 0-Disabled (default), 1-Enabled; +#Require reboot; +network.vlan.pc_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.pc_port_vid = {$vlan_pc_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.pc_port_priority = + +#Enable or disable the DHCP to obtain the information of the VLAN; 0-Disabled; 1-Enabled (default); +#Require reboot; +network.vlan.dhcp_enable = + +#Configure the DHCP option to obtain the information of the VLAN. It ranges from 0 to 255. +#Multiple options separated by a comma. It supports up to 5 options in all. +#Require reboot; +network.vlan.dhcp_option = + +{else} + +####################################################################################### +## VLAN ENABLED ## ####################################################################################### network.vlan.internet_port_enable = 0 @@ -60,6 +97,8 @@ network.vlan.dhcp_enable = #Require reboot; network.vlan.dhcp_option = +{/if} + ####################################################################################### ## WEB Port ## ####################################################################################### @@ -521,30 +560,25 @@ bw.directory_enable = 0 ####################################################################################### ## LDAP ## ####################################################################################### -#Configure the search criteria for name and number lookups. -ldap.enable = -ldap.name_filter = -ldap.number_filter = -ldap.host = 0.0.0.0 -ldap.port = 389 -ldap.base = -ldap.user = -ldap.password = - -#Specify the maximum of the displayed search results. It ranges from 1 to 32000, the default value is 50. -ldap.max_hits = -ldap.name_attr = -ldap.numb_attr = -ldap.display_name = - -#Configure the LDAP version. The valid value is 2 or 3 (default). -ldap.version = - -#Enable or disable the phone to query the contact name from the LDAP server when receiving an incoming call; 0-Disabled (default), 1-Enabled; -ldap.call_in_lookup = - -#Enable or disable the phone to sort the search results in alphabetical order; 0-Disabled (default), 1-Enabled; -ldap.ldap_sort = +#Configure the backlight time (in seconds). The valid values are: 1-Always on, 60 (default), 120, 300, 600, 1800. +security.trust_certificates = 0 +phone_setting.backlight_time = 0 +ldap.name_filter = {$ldap_namefilter} +ldap.number_filter = {$ldap_numberfilter} +ldap.host = {$ldap_host} +ldap.base = {$ldap_base} +ldap.user = {$ldap_user} +ldap.password = {$ldap_password} +ldap.display_name = {$ldap_display_name} +ldap.version = {$ldap_version} +ldap.call_in_lookup = {$ldap_call_in_lookup} +ldap.dial_lookup = {$ldap_dial_lookup} +ldap.enable = {$ldap_enable} +ldap.ldap_sort = {$ldap_sort} +ldap.port = {$ldap_port} +ldap.max_hits = {$ldap_max_hits} +ldap.name_attr = {$ldap_name_attr} +ldap.numb_attr = {$ldap_numb_attr} ####################################################################################### ## Features ## @@ -1525,7 +1559,7 @@ super_search.url = ## Directory Setting ## ####################################################################################### #Configure the access URL of the directory setting file. -directory_setting.url = +directory_setting.url ={$yealink_directory_settingurl} ####################################################################################### ## Configure the access URL of firmware ## From 5d0bb6c6defdbb35cf7fcccca2833d2e54dd2a43 Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Thu, 19 Nov 2015 13:46:37 -0800 Subject: [PATCH 08/14] Update y000000000029.cfg --- .../provision/yealink/t42g/y000000000029.cfg | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/resources/templates/provision/yealink/t42g/y000000000029.cfg b/resources/templates/provision/yealink/t42g/y000000000029.cfg index 8eb5fb45bf..f255bf51cd 100644 --- a/resources/templates/provision/yealink/t42g/y000000000029.cfg +++ b/resources/templates/provision/yealink/t42g/y000000000029.cfg @@ -26,8 +26,45 @@ network.pc_port.speed_duplex = network.pc_port.dhcp_server = 1 network.static_dns_enable = 1 +{if isset($vlan_port_id) } ####################################################################################### -## VLAN ## +## VLAN ENABLED ## +####################################################################################### +network.vlan.internet_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.internet_port_vid = {$vlan_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.internet_port_priority = + +#Enable or disable the VLAN of PC port; 0-Disabled (default), 1-Enabled; +#Require reboot; +network.vlan.pc_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.pc_port_vid = {$vlan_pc_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.pc_port_priority = + +#Enable or disable the DHCP to obtain the information of the VLAN; 0-Disabled; 1-Enabled (default); +#Require reboot; +network.vlan.dhcp_enable = + +#Configure the DHCP option to obtain the information of the VLAN. It ranges from 0 to 255. +#Multiple options separated by a comma. It supports up to 5 options in all. +#Require reboot; +network.vlan.dhcp_option = + +{else} + +####################################################################################### +## VLAN DISABLED ## ####################################################################################### network.vlan.internet_port_enable = 0 @@ -60,6 +97,9 @@ network.vlan.dhcp_enable = #Require reboot; network.vlan.dhcp_option = +{/if} + + ####################################################################################### ## WEB Port ## ####################################################################################### From f8cdb08250a4a2e57c286092bcd9877553613148 Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Thu, 19 Nov 2015 13:47:05 -0800 Subject: [PATCH 09/14] Update y000000000035.cfg --- .../provision/yealink/t48g/y000000000035.cfg | 50 +++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/resources/templates/provision/yealink/t48g/y000000000035.cfg b/resources/templates/provision/yealink/t48g/y000000000035.cfg index 5854bfce1d..268aacde40 100644 --- a/resources/templates/provision/yealink/t48g/y000000000035.cfg +++ b/resources/templates/provision/yealink/t48g/y000000000035.cfg @@ -26,8 +26,45 @@ network.pc_port.speed_duplex = network.pc_port.dhcp_server = 1 network.static_dns_enable = 1 +{if isset($vlan_port_id) } ####################################################################################### -## VLAN ## +## VLAN ENABLED ## +####################################################################################### +network.vlan.internet_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.internet_port_vid = {$vlan_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.internet_port_priority = + +#Enable or disable the VLAN of PC port; 0-Disabled (default), 1-Enabled; +#Require reboot; +network.vlan.pc_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.pc_port_vid = {$vlan_pc_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.pc_port_priority = + +#Enable or disable the DHCP to obtain the information of the VLAN; 0-Disabled; 1-Enabled (default); +#Require reboot; +network.vlan.dhcp_enable = + +#Configure the DHCP option to obtain the information of the VLAN. It ranges from 0 to 255. +#Multiple options separated by a comma. It supports up to 5 options in all. +#Require reboot; +network.vlan.dhcp_option = + +{else} + +####################################################################################### +## VLAN DISABLED ## ####################################################################################### network.vlan.internet_port_enable = 0 @@ -60,6 +97,9 @@ network.vlan.dhcp_enable = #Require reboot; network.vlan.dhcp_option = +{/if} + + ####################################################################################### ## WEB Port ## ####################################################################################### @@ -715,11 +755,11 @@ features.remote_phonebook.flash_time = ####################################################################################### ## Features Action ## ####################################################################################### -#Specifie the address(es) or enters ¡°any¡± from which Action URI will be accepted. +#Specifie the address(es) or enters ¡°any¡± from which Action URI will be accepted. #For discontinuous IP addresses, each IP address is separated by comma, for example: 192.168.1.20,10.2.1.30 -#For continuous IP addresses, the format likes *.*.*.* and the ¡°*¡± stands for the values 0~255. For example: 10.10.*.* stands for the IP addresses that range from 10.10.0.0~10.10.255.255. +#For continuous IP addresses, the format likes *.*.*.* and the ¡°*¡± stands for the values 0~255. For example: 10.10.*.* stands for the IP addresses that range from 10.10.0.0~10.10.255.255. #If left blank, the IP phone cannot receive or handle any HTTP GET request. -#If set to ¡°any¡±, the IP phone accepts and handles HTTP GET requests from any IP address. +#If set to ¡°any¡±, the IP phone accepts and handles HTTP GET requests from any IP address. features.action_uri_limit_ip = features.action_uri_reboot_now = 0 @@ -815,7 +855,7 @@ phone_setting.inactive_backlight_level = 1 phone_setting.blf_list_enable = 1 phone_setting.auto_blf_list_enable = 1 -#Specify the prior of the line keys and EXP keys when automatically configure the blf list£»0-Configure the line keys first, 1-Configure the EXP keys first; +#Specify the prior of the line keys and EXP keys when automatically configure the blf list£»0-Configure the line keys first, 1-Configure the EXP keys first; phone_setting.blf_list_sequence_type = ####################################################################################### From 27eb41972a47dddfb82ee853edb114d6a2dfde85 Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Thu, 19 Nov 2015 13:47:17 -0800 Subject: [PATCH 10/14] Update y000000000037.cfg --- .../provision/yealink/cp860/y000000000037.cfg | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/resources/templates/provision/yealink/cp860/y000000000037.cfg b/resources/templates/provision/yealink/cp860/y000000000037.cfg index af57fae6f5..3b633a861a 100644 --- a/resources/templates/provision/yealink/cp860/y000000000037.cfg +++ b/resources/templates/provision/yealink/cp860/y000000000037.cfg @@ -26,8 +26,45 @@ network.pc_port.speed_duplex = network.pc_port.dhcp_server = 1 network.static_dns_enable = 1 +{if isset($vlan_port_id) } ####################################################################################### -## VLAN ## +## VLAN ENABLED ## +####################################################################################### +network.vlan.internet_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.internet_port_vid = {$vlan_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.internet_port_priority = + +#Enable or disable the VLAN of PC port; 0-Disabled (default), 1-Enabled; +#Require reboot; +network.vlan.pc_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.pc_port_vid = {$vlan_pc_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.pc_port_priority = + +#Enable or disable the DHCP to obtain the information of the VLAN; 0-Disabled; 1-Enabled (default); +#Require reboot; +network.vlan.dhcp_enable = + +#Configure the DHCP option to obtain the information of the VLAN. It ranges from 0 to 255. +#Multiple options separated by a comma. It supports up to 5 options in all. +#Require reboot; +network.vlan.dhcp_option = + +{else} + +####################################################################################### +## VLAN DISABLED ## ####################################################################################### network.vlan.internet_port_enable = 0 @@ -60,6 +97,9 @@ network.vlan.dhcp_enable = #Require reboot; network.vlan.dhcp_option = +{/if} + + ####################################################################################### ## WEB Port ## ####################################################################################### From 958be5229e74159b08db7e1d50e388ccb445bdfe Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Thu, 19 Nov 2015 13:47:38 -0800 Subject: [PATCH 11/14] Update y000000000036.cfg --- .../provision/yealink/t41p/y000000000036.cfg | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/resources/templates/provision/yealink/t41p/y000000000036.cfg b/resources/templates/provision/yealink/t41p/y000000000036.cfg index 7e540ed1fe..474d2af541 100644 --- a/resources/templates/provision/yealink/t41p/y000000000036.cfg +++ b/resources/templates/provision/yealink/t41p/y000000000036.cfg @@ -26,8 +26,45 @@ network.pc_port.speed_duplex = network.pc_port.dhcp_server = 1 network.static_dns_enable = 0 +{if isset($vlan_port_id) } ####################################################################################### -## VLAN ## +## VLAN ENABLED ## +####################################################################################### +network.vlan.internet_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.internet_port_vid = {$vlan_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.internet_port_priority = + +#Enable or disable the VLAN of PC port; 0-Disabled (default), 1-Enabled; +#Require reboot; +network.vlan.pc_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.pc_port_vid = {$vlan_pc_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.pc_port_priority = + +#Enable or disable the DHCP to obtain the information of the VLAN; 0-Disabled; 1-Enabled (default); +#Require reboot; +network.vlan.dhcp_enable = + +#Configure the DHCP option to obtain the information of the VLAN. It ranges from 0 to 255. +#Multiple options separated by a comma. It supports up to 5 options in all. +#Require reboot; +network.vlan.dhcp_option = + +{else} + +####################################################################################### +## VLAN DISABLED ## ####################################################################################### network.vlan.internet_port_enable = 0 @@ -60,6 +97,9 @@ network.vlan.dhcp_enable = #Require reboot; network.vlan.dhcp_option = +{/if} + + ####################################################################################### ## WEB Port ## ####################################################################################### From 8e048019d1f07ac283cbfe941df4a72ea3db385e Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 19 Nov 2015 15:20:14 -0700 Subject: [PATCH 12/14] Add underscore between the words in the variables. {$ldap_name_filter} {$ldap_number_filter} {$yealink_directory_setting_url} --- .../templates/provision/yealink/t46g/y000000000028.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/templates/provision/yealink/t46g/y000000000028.cfg b/resources/templates/provision/yealink/t46g/y000000000028.cfg index 3ff3e5e195..4fdd27011c 100644 --- a/resources/templates/provision/yealink/t46g/y000000000028.cfg +++ b/resources/templates/provision/yealink/t46g/y000000000028.cfg @@ -563,8 +563,8 @@ bw.directory_enable = 0 #Configure the backlight time (in seconds). The valid values are: 1-Always on, 60 (default), 120, 300, 600, 1800. security.trust_certificates = 0 phone_setting.backlight_time = 0 -ldap.name_filter = {$ldap_namefilter} -ldap.number_filter = {$ldap_numberfilter} +ldap.name_filter = {$ldap_name_filter} +ldap.number_filter = {$ldap_number_filter} ldap.host = {$ldap_host} ldap.base = {$ldap_base} ldap.user = {$ldap_user} @@ -1559,7 +1559,7 @@ super_search.url = ## Directory Setting ## ####################################################################################### #Configure the access URL of the directory setting file. -directory_setting.url ={$yealink_directory_settingurl} +directory_setting.url ={$yealink_directory_setting_url} ####################################################################################### ## Configure the access URL of firmware ## From 8db03413923486ae44618188de35b94d1f73c9cd Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 19 Nov 2015 22:32:34 -0700 Subject: [PATCH 13/14] Time condition fix alignment of the arrow button by adding style nowrap and 3 pixel padding. --- app/time_conditions/time_condition_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index f3e70b9f77..1a3178ddcb 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -860,7 +860,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { echo " ".$text['label-group']."\n"; echo " "; echo " "; - echo " "; + echo " "; //$destination = new destinations; echo $destination->select('dialplan', 'dialplan_action['.$group_id.']', $dialplan_action); echo " "; From ae4a9d499f54cf285708ceae22686a40351be3b3 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 19 Nov 2015 22:42:33 -0700 Subject: [PATCH 14/14] Add style white-space: nowrap; to destination edit. --- app/destinations/destination_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index d6051689c1..3d48fb6059 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -679,7 +679,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if ($row["dialplan_detail_tag"] != "condition") { if ($row["dialplan_detail_tag"] == "action" && $row["dialplan_detail_type"] == "set" && strpos($row["dialplan_detail_data"], "accountcode") == 0) { continue; } //exclude set:accountcode actions echo " \n"; - echo " \n"; + echo " \n"; if (strlen($row['dialplan_detail_uuid']) > 0) { echo " \n"; }