Improve security on the lua scripts, add lua json library, add *77 dnd toggle feature code, speed dial *0[ext], and improve blf support for extension number alias.

This commit is contained in:
markjcrane
2016-12-08 18:36:15 -07:00
parent 30acee4dff
commit 9b1b38fab6
84 changed files with 3881 additions and 1346 deletions
+4
View File
@@ -445,6 +445,10 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the extension.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_speed_dial";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the speed dial.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_description";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the description.";
+22
View File
@@ -879,6 +879,17 @@ $text['label-phone_tools']['sv-se'] = "Verktyg";
$text['label-phone_tools']['de-at'] = "Funktionen";
$text['label-phone_tools']['he'] = "כלים";
$text['label-phone_speed_dial']['en-us'] = "Speed Dial";
$text['label-phone_speed_dial']['es-cl'] = "";
$text['label-phone_speed_dial']['pt-pt'] = "";
$text['label-phone_speed_dial']['fr-fr'] = "";
$text['label-phone_speed_dial']['pt-br'] = "";
$text['label-phone_speed_dial']['pl'] = "";
$text['label-phone_speed_dial']['uk'] = "";
$text['label-phone_speed_dial']['sv-se'] = "";
$text['label-phone_speed_dial']['de-at'] = "";
$text['label-phone_speed_dial']['he'] = "";
$text['label-phone_numbers']['en-us'] = "Numbers";
$text['label-phone_numbers']['es-cl'] = "Números";
$text['label-phone_numbers']['pt-pt'] = "Números";
@@ -2019,6 +2030,17 @@ $text['description-phone_primary']['sv-se'] = "Sätt som primärt Nummer för de
$text['description-phone_primary']['de-at'] = "Als primäre Nummer für diesen Kontakt setzen.";
$text['description-phone_primary']['he'] = "";
$text['description-phone_speed_dial']['en-us'] = "Enter the speed dial number.";
$text['description-phone_speed_dial']['es-cl'] = "";
$text['description-phone_speed_dial']['pt-pt'] = "";
$text['description-phone_speed_dial']['fr-fr'] = "";
$text['description-phone_speed_dial']['pt-br'] = "";
$text['description-phone_speed_dial']['pl'] = "";
$text['description-phone_speed_dial']['uk'] = "";
$text['description-phone_speed_dial']['sv-se'] = "";
$text['description-phone_speed_dial']['de-at'] = "";
$text['description-phone_speed_dial']['he'] = "";
$text['description-phone_number']['en-us'] = "Enter the phone number.";
$text['description-phone_number']['es-cl'] = "Ingrese el número de teléfono.";
$text['description-phone_number']['pt-pt'] = "Introduza o número de telefone";
+36 -14
View File
@@ -17,23 +17,27 @@
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
Portions created by the Initial Developer are Copyright (C) 2008-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_phone_edit') || permission_exists('contact_phone_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('contact_phone_edit') || permission_exists('contact_phone_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
@@ -48,9 +52,10 @@ else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get the uuid
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
@@ -60,6 +65,7 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$phone_type_text = check_str($_POST["phone_type_text"]);
$phone_label = check_str($_POST["phone_label"]);
$phone_label_custom = check_str($_POST["phone_label_custom"]);
$phone_speed_dial = check_str($_POST["phone_speed_dial"]);
$phone_number = check_str($_POST["phone_number"]);
$phone_extension = check_str($_POST["phone_extension"]);
$phone_primary = check_str($_POST["phone_primary"]);
@@ -128,6 +134,7 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$sql .= "phone_type_video, ";
$sql .= "phone_type_text, ";
$sql .= "phone_label, ";
$sql .= "phone_speed_dial, ";
$sql .= "phone_number, ";
$sql .= "phone_extension, ";
$sql .= "phone_primary, ";
@@ -143,6 +150,7 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$sql .= (($phone_type_video) ? 1 : 'null').", ";
$sql .= (($phone_type_text) ? 1 : 'null').", ";
$sql .= "'".$phone_label."', ";
$sql .= "'".$phone_speed_dial."', ";
$sql .= "'".$phone_number."', ";
$sql .= "'".$phone_extension."', ";
$sql .= (($phone_primary) ? 1 : 0).", ";
@@ -164,6 +172,7 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$sql .= "phone_type_video = ".(($phone_type_video) ? 1 : 'null').", ";
$sql .= "phone_type_text = ".(($phone_type_text) ? 1 : 'null').", ";
$sql .= "phone_label = '".$phone_label."', ";
$sql .= "phone_speed_dial = '".$phone_speed_dial."', ";
$sql .= "phone_number = '".$phone_number."', ";
$sql .= "phone_extension = '".$phone_extension."', ";
$sql .= "phone_primary = ".(($phone_primary) ? 1 : 0).", ";
@@ -195,6 +204,7 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$phone_type_video = $row["phone_type_video"];
$phone_type_text = $row["phone_type_text"];
$phone_label = $row["phone_label"];
$phone_speed_dial = $row["phone_speed_dial"];
$phone_number = $row["phone_number"];
$phone_extension = $row["phone_extension"];
$phone_primary = $row["phone_primary"];
@@ -297,6 +307,17 @@ if (strlen($_GET["contact_uuid"]) > 0) {
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-phone_speed_dial']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='phone_speed_dial' maxlength='255' min='0' step='1' value=\"$phone_speed_dial\">\n";
echo "<br />\n";
echo $text['description-phone_speed_dial']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-phone_number']."\n";
@@ -360,4 +381,5 @@ if (strlen($_GET["contact_uuid"]) > 0) {
//include the footer
require_once "resources/footer.php";
?>
@@ -0,0 +1,7 @@
<context name="{v_context}">
<extension name="speed_dial" number="*0[ext]" continue="false" app_uuid="1a4a2611-01e3-4582-982b-4ada4d314ea3" enabled="true">
<condition field="destination_number" expression="^\*0(.*)$">
<action application="lua" data="app.lua speed_dial $1"/>
</condition>
</extension>
</context>
@@ -1,5 +1,9 @@
<context name="{v_context}">
<extension name="do-not-disturb" number="*78,*79" continue="false" app_uuid="df32d982-e39e-4ae5-a46d-aed1893873f2" enabled="true">
<extension name="do-not-disturb" number="*77,*78,*79" continue="false" app_uuid="df32d982-e39e-4ae5-a46d-aed1893873f2" enabled="true">
<condition field="destination_number" expression="^\*77$" break="on-true">
<action application="set" data="enabled=toggle"/>
<action application="lua" data="do_not_disturb.lua"/>
</condition>
<condition field="destination_number" expression="^\*78$|\*363$" break="on-true">
<action application="set" data="enabled=true"/>
<action application="lua" data="do_not_disturb.lua"/>
+1 -1
View File
@@ -72,7 +72,7 @@
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "number_alias";
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "extension_toll";