Rename directory number_translation to number_translations to be more consistant

This commit is contained in:
markjcrane
2017-12-24 06:14:59 +00:00
parent 21842a9a87
commit a19fd6c2c7
16 changed files with 0 additions and 0 deletions
+114
View File
@@ -0,0 +1,114 @@
<?php
//application details
$apps[$x]['name'] = "Number Translation";
$apps[$x]['uuid'] = "6ad54de6-4909-11e7-a919-92ebcb67fe33";
$apps[$x]['category'] = "System";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "0.1";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Manage mod_translation";
$apps[$x]['description']['ar-eg'] = "إدارة mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['de-at'] = "Verwalte mod_translate";
$apps[$x]['description']['de-ch'] = "Verwalte mod_translate";
$apps[$x]['description']['de-de'] = "Verwalte mod_translate";
$apps[$x]['description']['es-cl'] = "Administrar mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['es-mx'] = "Administrar mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['fr-ca'] = "Gérer mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['fr-fr'] = "Gérer mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['he-il'] = "נהל את mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['it-it'] = "Gestisci mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['nl-nl'] = "Beheer mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['pl-pl'] = "Zarządzaj mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['pt-br'] = "Gerenciar mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['pt-pt'] = "Gerenciar mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['ro-ro'] = "Gestionați mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['ru-ru'] = "Управление mod_translate";
$apps[$x]['description']['sv-se'] = "Hantera mod_translate"; //translation provided by Google Translate
$apps[$x]['description']['uk-ua'] = "управління mod_translate"; //translation provided by Google Translate
$apps[$x]['minimum_version'] = "4.3.2";
//permission details
$y = 0;
$apps[$x]['permissions'][$y]['name'] = "number_translation_view";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "6ad55156-4909-11e7-a919-92ebcb67fe33";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "number_translation_edit";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "6ad556c4-4909-11e7-a919-92ebcb67fe33";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "number_translation_add";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "6ad5585e-4909-11e7-a919-92ebcb67fe33";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "number_translation_delete";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "6ad555d4-4909-11e7-a919-92ebcb67fe33";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//schema details
$y=0;
$apps[$x]['db'][$y]['table']['name'] = "v_number_translations";
$apps[$x]['db'][$y]['table']['parent'] = "";
$z=0;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "number_translation_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "hostname";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "number_translation_name";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "number_translation_hostname";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "number_translation_enabled";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "number_translation_description";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$y++;
$apps[$x]['db'][$y]['table']['name'] = "v_number_translation_details";
$apps[$x]['db'][$y]['table']['parent'] = "v_number_translations";
$z=0;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "number_translation_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_number_translations";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "number_translation_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "number_translation_detail_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "number_translation_detail_regex";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "number_translation_detail_replace";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "number_translation_detail_order";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
?>
+79
View File
@@ -0,0 +1,79 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
if ($domains_processed == 1) {
//get the array of xml files
$xml_list = glob($_SERVER["PROJECT_ROOT"] . "/*/*/resources/switch/conf/number_translation/*.xml");
//number_translation class
$number_translation = new number_translation;
//process the xml files
foreach ($xml_list as &$xml_file) {
//get and parse the xml
$number_translation->display_type = $display_type;
$number_translation->xml = file_get_contents($xml_file);
$number_translation->import();
}
//check for existing configuration
if (file_exists($_SESSION['switch']['conf']['dir']."/autoload_configs/translate.conf.xml")) {
//import existing data
$xml = file_get_contents($_SESSION['switch']['conf']['dir']."/autoload_configs/translate.conf.xml");
//convert the xml string to an xml object
$xml = simplexml_load_string($xml);
//convert to json
$json = json_encode($xml);
//convert to an array
$number_translations = json_decode($json, true);
if (array_key_exists('include', $number_translations)) {
$number_translations = $number_translations['include'];
}
if ($number_translations['configuration']['@attributes']['autogenerated'] != 'true') {
foreach ($number_translations['configuration']['profiles']['profile'] as $profile) {
$json = json_encode($profile);
$number_translation->display_type = $display_type;
$number_translation->json = $json;
$number_translation->import();
}
}
}
//regenerate and reload
$number_translation->xml();
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
event_socket_request($fp, 'api reloadxml');
event_socket_request($fp, 'api reload mod_translate');
}
elseif ($display_type == 'text') {
echo "Failed to connect to event socket";
}
unset($fp);
}
?>
+164
View File
@@ -0,0 +1,164 @@
<?php
#This file was last reorganized on 19th of September 2017 08:54:24 AM UTC
$text['button-reload']['en-us'] = "Reload";
$text['button-reload']['ar-eg'] = "إعادة تحميل";
$text['button-reload']['de-at'] = "Neu laden"; //copied from de-de
$text['button-reload']['de-ch'] = "Neu laden"; //copied from de-de
$text['button-reload']['de-de'] = "Neu laden";
$text['button-reload']['es-cl'] = "Recargar";
$text['button-reload']['es-mx'] = "Recargar"; //copied from es-cl
$text['button-reload']['fr-ca'] = "Recharger"; //copied from fr-fr
$text['button-reload']['fr-fr'] = "Recharger";
$text['button-reload']['he-il'] = "לִטעוֹן מִחָדָשׁ";
$text['button-reload']['it-it'] = "Ricaricare";
$text['button-reload']['nl-nl'] = "vernieuwen";
$text['button-reload']['pl-pl'] = "Przeładować";
$text['button-reload']['pt-br'] = "Recarregar"; //copied from pt-pt
$text['button-reload']['pt-pt'] = "Recarregar";
$text['button-reload']['ro-ro'] = "Reîncarcă";
$text['button-reload']['ru-ru'] = "Перезагрузить";
$text['button-reload']['sv-se'] = "Ladda om";
$text['button-reload']['uk-ua'] = "перезавантажувати";
$text['button-reload_xml']['en-us'] = "Reload XML";
$text['button-reload_xml']['ar-eg'] = "إعادة تحميل شمل";
$text['button-reload_xml']['de-at'] = "XML neu laden"; //copied from de-de
$text['button-reload_xml']['de-ch'] = "XML neu laden"; //copied from de-de
$text['button-reload_xml']['de-de'] = "XML neu laden";
$text['button-reload_xml']['es-cl'] = "Actualizar XML";
$text['button-reload_xml']['es-mx'] = "Actualizar XML"; //copied from es-cl
$text['button-reload_xml']['fr-ca'] = "Recharger XML"; //copied from fr-fr
$text['button-reload_xml']['fr-fr'] = "Recharger XML";
$text['button-reload_xml']['he-il'] = "טען מחדש XML";
$text['button-reload_xml']['it-it'] = "Ricarica XML";
$text['button-reload_xml']['nl-nl'] = "XML opnieuw laden";
$text['button-reload_xml']['pl-pl'] = "Przeładuj XML";
$text['button-reload_xml']['pt-br'] = "Carregar novamente XML";
$text['button-reload_xml']['pt-pt'] = "Recarregar XML";
$text['button-reload_xml']['ro-ro'] = "Reîncărcați XML";
$text['button-reload_xml']['ru-ru'] = "Перезагрузить XML";
$text['button-reload_xml']['sv-se'] = "Ladda Om XML";
$text['button-reload_xml']['uk-ua'] = "Перезагрузити XML";
$text['description-number_translation']['en-us'] = "Manage mod_translate profiles";
$text['description-number_translation']['ar-eg'] = "إدارة ملفات تعريف mod_translate";
$text['description-number_translation']['de-at'] = "Verwaltung der Mod_translate-Profile"; //copied from de-de
$text['description-number_translation']['de-ch'] = "Verwaltung der Mod_translate-Profile"; //copied from de-de
$text['description-number_translation']['de-de'] = "Verwaltung der Mod_translate-Profile";
$text['description-number_translation']['es-cl'] = "Administrar perfiles de mod_translate";
$text['description-number_translation']['es-mx'] = "Administrar perfiles de mod_translate"; //copied from es-cl
$text['description-number_translation']['fr-ca'] = "Gérer les profils mod_translate"; //copied from fr-fr
$text['description-number_translation']['fr-fr'] = "Gérer les profils mod_translate";
$text['description-number_translation']['he-il'] = "ניהול פרופילים mod_translate";
$text['description-number_translation']['it-it'] = "Gestire i profili mod_translate";
$text['description-number_translation']['nl-nl'] = "Beheer mod_translate profielen";
$text['description-number_translation']['pl-pl'] = "Zarządzaj profilami mod_translate";
$text['description-number_translation']['pt-br'] = "Gerenciar perfis mod_translate"; //copied from pt-pt
$text['description-number_translation']['pt-pt'] = "Gerenciar perfis mod_translate";
$text['description-number_translation']['ro-ro'] = "Gestionați profilele mod_translate";
$text['description-number_translation']['ru-ru'] = "Управление профилями mod_translate";
$text['description-number_translation']['sv-se'] = "Hantera mod_translate profiler";
$text['description-number_translation']['uk-ua'] = "Управління mod_translate профілів";
$text['header-number_translation']['en-us'] = "Profiles";
$text['header-number_translation']['ar-eg'] = "مظهر";
$text['header-number_translation']['de-at'] = "Profile"; //copied from de-de
$text['header-number_translation']['de-ch'] = "Profile"; //copied from de-de
$text['header-number_translation']['de-de'] = "Profile";
$text['header-number_translation']['es-cl'] = "Perfiles";
$text['header-number_translation']['es-mx'] = "Perfiles"; //copied from es-cl
$text['header-number_translation']['fr-ca'] = "Profils"; //copied from fr-fr
$text['header-number_translation']['fr-fr'] = "Profils";
$text['header-number_translation']['he-il'] = "פרופילים";
$text['header-number_translation']['it-it'] = "profili";
$text['header-number_translation']['nl-nl'] = "profielen";
$text['header-number_translation']['pl-pl'] = "Profile";
$text['header-number_translation']['pt-br'] = "Perfis"; //copied from pt-pt
$text['header-number_translation']['pt-pt'] = "Perfis";
$text['header-number_translation']['ro-ro'] = "Profil";
$text['header-number_translation']['ru-ru'] = "Профили";
$text['header-number_translation']['sv-se'] = "profiler";
$text['header-number_translation']['uk-ua'] = "профілі";
$text['label-hostname']['en-us'] = "Hostname";
$text['label-hostname']['ar-eg'] = "اسم المضيف";
$text['label-hostname']['de-at'] = "Hostname"; //copied from de-de
$text['label-hostname']['de-ch'] = "Hostname"; //copied from de-de
$text['label-hostname']['de-de'] = "Hostname";
$text['label-hostname']['es-cl'] = "Nombre de host";
$text['label-hostname']['es-mx'] = "Nombre de host"; //copied from es-cl
$text['label-hostname']['fr-ca'] = "Nom d'hôte"; //copied from fr-fr
$text['label-hostname']['fr-fr'] = "Nom d'hôte";
$text['label-hostname']['he-il'] = "שם מארח";
$text['label-hostname']['it-it'] = "Hostname";
$text['label-hostname']['nl-nl'] = "Hostname";
$text['label-hostname']['pl-pl'] = "Nazwa hosta";
$text['label-hostname']['pt-br'] = "Mome de anfitrião"; //copied from pt-pt
$text['label-hostname']['pt-pt'] = "Mome de anfitrião";
$text['label-hostname']['ro-ro'] = "Numele gazdei";
$text['label-hostname']['ru-ru'] = "Имя Хоста";
$text['label-hostname']['sv-se'] = "Värdnamn";
$text['label-hostname']['uk-ua'] = "Назва хоста";
$text['label-regex']['en-us'] = "Regular Expression";
$text['label-regex']['ar-eg'] = "تعبير عادي";
$text['label-regex']['de-at'] = "Regulärer Ausdruck"; //copied from de-de
$text['label-regex']['de-ch'] = "Regulärer Ausdruck"; //copied from de-de
$text['label-regex']['de-de'] = "Regulärer Ausdruck";
$text['label-regex']['es-cl'] = "Expresión regular";
$text['label-regex']['es-mx'] = "Expresión regular"; //copied from es-cl
$text['label-regex']['fr-ca'] = "Expression régulière"; //copied from fr-fr
$text['label-regex']['fr-fr'] = "Expression régulière";
$text['label-regex']['he-il'] = "הבעה רגילה";
$text['label-regex']['it-it'] = "Espressione regolare";
$text['label-regex']['nl-nl'] = "Regular Expression";
$text['label-regex']['pl-pl'] = "Wyrażenie regularne";
$text['label-regex']['pt-br'] = "Expressão regular"; //copied from pt-pt
$text['label-regex']['pt-pt'] = "Expressão regular";
$text['label-regex']['ro-ro'] = "Expresie uzuala";
$text['label-regex']['ru-ru'] = "Регулярное выражение";
$text['label-regex']['sv-se'] = "Vanligt uttryck";
$text['label-regex']['uk-ua'] = "Регулярний вираз";
$text['label-replace']['en-us'] = "Replace";
$text['label-replace']['ar-eg'] = "يحل محل";
$text['label-replace']['de-at'] = "Ersetzen"; //copied from de-de
$text['label-replace']['de-ch'] = "Ersetzen"; //copied from de-de
$text['label-replace']['de-de'] = "Ersetzen";
$text['label-replace']['es-cl'] = "Reemplazar";
$text['label-replace']['es-mx'] = "Reemplazar"; //copied from es-cl
$text['label-replace']['fr-ca'] = "Remplacer"; //copied from fr-fr
$text['label-replace']['fr-fr'] = "Remplacer";
$text['label-replace']['he-il'] = "החלף";
$text['label-replace']['it-it'] = "Sostituire";
$text['label-replace']['nl-nl'] = "Vervangen";
$text['label-replace']['pl-pl'] = "Zastąpić";
$text['label-replace']['pt-br'] = "Substituir"; //copied from pt-pt
$text['label-replace']['pt-pt'] = "Substituir";
$text['label-replace']['ro-ro'] = "A inlocui";
$text['label-replace']['ru-ru'] = "Замена";
$text['label-replace']['sv-se'] = "Byta ut";
$text['label-replace']['uk-ua'] = "заміщати";
$text['title-number_translation']['en-us'] = "Manage mod_translate";
$text['title-number_translation']['ar-eg'] = "إدارة mod_translate";
$text['title-number_translation']['de-at'] = "Verwalte mod_translate"; //copied from de-de
$text['title-number_translation']['de-ch'] = "Verwalte mod_translate"; //copied from de-de
$text['title-number_translation']['de-de'] = "Verwalte mod_translate";
$text['title-number_translation']['es-cl'] = "Administrar mod_translate";
$text['title-number_translation']['es-mx'] = "Administrar mod_translate"; //copied from es-cl
$text['title-number_translation']['fr-ca'] = "Gérer mod_translate"; //copied from fr-fr
$text['title-number_translation']['fr-fr'] = "Gérer mod_translate";
$text['title-number_translation']['he-il'] = "נהל את mod_translate";
$text['title-number_translation']['it-it'] = "Gestisci mod_translate";
$text['title-number_translation']['nl-nl'] = "Beheer mod_translate";
$text['title-number_translation']['pl-pl'] = "Zarządzaj mod_translate";
$text['title-number_translation']['pt-br'] = "Gerenciar mod_translate"; //copied from pt-pt
$text['title-number_translation']['pt-pt'] = "Gerenciar mod_translate";
$text['title-number_translation']['ro-ro'] = "Gestionați mod_translate";
$text['title-number_translation']['ru-ru'] = "Управление mod_translate";
$text['title-number_translation']['sv-se'] = "Hantera mod_translate";
$text['title-number_translation']['uk-ua'] = "управління mod_translate";
?>
+29
View File
@@ -0,0 +1,29 @@
<?php
$y=0;
$apps[$x]['menu'][$y]['title']['en-us'] = "Number Translation";
$apps[$x]['menu'][$y]['title']['ar-eg'] = "عدد الترجمة"; //Google translate
$apps[$x]['menu'][$y]['title']['de-at'] = "Nummer Übersetzung";
$apps[$x]['menu'][$y]['title']['de-ch'] = "Nummer Übersetzung";
$apps[$x]['menu'][$y]['title']['de-de'] = "Nummer Übersetzung";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Traducción de números"; //Google translate
$apps[$x]['menu'][$y]['title']['es-mx'] = "Traducción de números"; //Google translate
$apps[$x]['menu'][$y]['title']['fr-ca'] = "Traduction de numéros"; //Google translate
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Traduction de numéros"; //Google translate
$apps[$x]['menu'][$y]['title']['he-il'] = "תרגום מספר"; //Google translate
$apps[$x]['menu'][$y]['title']['it-it'] = "Traduzione numero"; //Google translate
$apps[$x]['menu'][$y]['title']['nl-nl'] = "Nummer Vertaling"; //Google translate
$apps[$x]['menu'][$y]['title']['pl-pl'] = "Tłumaczenie liczbowe"; //Google translate
$apps[$x]['menu'][$y]['title']['pt-br'] = "Tradução numérica"; //Google translate
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Tradução numérica"; //Google translate
$apps[$x]['menu'][$y]['title']['ro-ro'] = "Traducerea numerelor"; //Google translate
$apps[$x]['menu'][$y]['title']['ru-ru'] = "Преобразование номера";
$apps[$x]['menu'][$y]['title']['sv-se'] = "Antal översättning"; //Google translate
$apps[$x]['menu'][$y]['title']['uk-ua'] = "кількість перекладів"; //Google translate
$apps[$x]['menu'][$y]['uuid'] = "6ad5505c-4909-11e7-a919-92ebcb67fe33";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "internal";
$apps[$x]['menu'][$y]['path'] = "/app/number_translation/number_translations.php";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
?>
+68
View File
@@ -0,0 +1,68 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (!if_group("superadmin")) {
echo "access denied";
exit;
}
//set the variables
$cmd = check_str($_GET['cmd']);
$rdr = check_str($_GET['rdr']);
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
//reloadxml
if ($cmd == "api reloadxml") {
messages::add(rtrim(event_socket_request($fp, $cmd)), 'alert');
unset($cmd);
}
//reload mod_translate
if ($cmd == "api reload mod_translate") {
messages::add(rtrim(event_socket_request($fp, $cmd)), 'alert');
unset($cmd);
}
//close the connection
fclose($fp);
}
//redirect the user
if ($rdr == "false") {
//redirect false
echo $response;
}
else {
header("Location: number_translations.php");
}
?>
@@ -0,0 +1,99 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (!permission_exists('number_translation_delete')) {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the number_translation uuid
$number_translation_uuids = $_REQUEST["id"];
$app_uuid = check_str($_REQUEST['app_uuid']);
//delete the number_translations
if (sizeof($number_translation_uuids) > 0) {
//get number_translation contexts
foreach ($number_translation_uuids as $number_translation_uuid) {
//check each
$number_translation_uuid = check_str($number_translation_uuid);
//get the number_translation data
$sql = "select * from v_number_translations ";
$sql .= "where number_translation_uuid = '".$number_translation_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$database_number_translation_uuid = $row["number_translation_uuid"];
$number_translation_contexts[] = $row["number_translation_context"];
}
unset($prep_statement);
}
//start the atomic transaction
$db->beginTransaction();
//delete number_translation and details
$number_translations_deleted = 0;
foreach ($number_translation_uuids as $number_translation_uuid) {
//delete child data
$sql = "delete from v_number_translation_details ";
$sql .= "where number_translation_uuid = '".$number_translation_uuid."'; ";
$db->query($sql);
unset($sql);
//delete parent data
$sql = "delete from v_number_translations ";
$sql .= "where number_translation_uuid = '".$number_translation_uuid."'; ";
$db->query($sql);
unset($sql);
$number_translations_deleted++;
}
//commit the atomic transaction
$db->commit();
//update the number_translation xml
$number_translations = new number_translation;
$number_translations->xml();
}
//redirect the browser
messages::add($text['message-delete'].(($number_translations_deleted > 1) ? ": ".$number_translations_deleted : null));
header("Location: ".PROJECT_PATH."/app/number_translation/number_translations.php".(($app_uuid != '') ? "?app_uuid=".$app_uuid : null));
?>
@@ -0,0 +1,68 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
//includes
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (!permission_exists('number_translation_delete')) {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the variables
if (count($_GET) > 0) {
$number_translation_detail_uuid = check_str($_GET["id"]);
$number_translation_uuid = check_str($_REQUEST["number_translation_uuid"]);
}
//delete the number_translation detail
if (strlen($number_translation_detail_uuid) > 0) {
//delete child data
$sql = "delete from v_number_translation_details ";
$sql .= "where number_translation_detail_uuid = '$number_translation_detail_uuid' ";
$db->query($sql);
unset($sql);
//update the number_translation xml
$number_translations = new number_translation;
$number_translations->xml();
}
//save the message to a session variable
messages::add($text['message-delete']);
//redirect the browser
header("Location: number_translation_edit.php?id=$number_translation_uuid");
exit;
?>
@@ -0,0 +1,394 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
//includes
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php";
//check permissions
if (permission_exists('number_translation_add') || permission_exists('number_translation_edit') ) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the action as an add or an update
if (is_uuid($_REQUEST["id"])) {
$action = "update";
$number_translation_uuid = $_REQUEST["id"];
}
else {
$action = "add";
}
if (strlen($_REQUEST["app_uuid"]) > 0) {
$app_uuid = $_REQUEST["app_uuid"];
}
//get the http post values and set them as php variables
if (count($_POST) > 0) {
$hostname = check_str($_POST["hostname"]);
$number_translation_name = check_str($_POST["number_translation_name"]);
$number_translation_enabled = check_str($_POST["number_translation_enabled"]);
$number_translation_description = check_str($_POST["number_translation_description"]);
}
//process and save the data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the number_translation uuid
if ($action == "update") {
$number_translation_uuid = check_str($_POST["number_translation_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($number_translation_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
if (strlen($number_translation_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
//if (strlen($number_translation_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
//remove the invalid characters from the number_translation name
$number_translation_name = $_POST["number_translation_name"];
$number_translation_name = str_replace(" ", "_", $number_translation_name);
$number_translation_name = str_replace("/", "", $number_translation_name);
//build the array
$x = 0;
if (isset($_POST["number_translation_uuid"])) {
$array['number_translations'][$x]['number_translation_uuid'] = $_POST["number_translation_uuid"];
}
$array['number_translations'][$x]['number_translation_name'] = $number_translation_name;
$array['number_translations'][$x]['number_translation_enabled'] = $_POST["number_translation_enabled"];
$array['number_translations'][$x]['number_translation_description'] = $_POST["number_translation_description"];
$y = 0;
if (is_array($_POST["number_translation_details"])) {
foreach ($_POST["number_translation_details"] as $row) {
if (strlen($row["number_translation_detail_regex"]) > 0) {
if (strlen($row["number_translation_detail_uuid"]) > 0) {
$array['number_translations'][$x]['number_translation_details'][$y]['number_translation_detail_uuid'] = $row["number_translation_detail_uuid"];
}else{
$array['number_translations'][$x]['number_translation_details'][$y]['number_translation_uuid'] = $_POST["number_translation_uuid"];
}
$array['number_translations'][$x]['number_translation_details'][$y]['number_translation_detail_regex'] = $row["number_translation_detail_regex"];
$array['number_translations'][$x]['number_translation_details'][$y]['number_translation_detail_replace'] = $row["number_translation_detail_replace"];
$array['number_translations'][$x]['number_translation_details'][$y]['number_translation_detail_order'] = $row["number_translation_detail_order"];
}
$y++;
}
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
$permissions = new permissions;
$permissions->add('number_translation_detail_add', 'temp');
$permissions->add('number_translation_detail_edit', 'temp');
$database = new database;
$database->app_name = 'number_translations';
$database->save($array);
$permissions->delete('number_translation_detail_add', 'temp');
$permissions->delete('number_translation_detail_edit', 'temp');
if ($database->message['code'] != '200'){
messages::add('Failed to update record(s), database reported:'.$database->message['message'], 'negative');
header("Location: ?id=$number_translation_uuid");
exit;
}
}
//update the number_translation xml
$number_translations = new number_translation;
$number_translations->xml();
//set the message
if ($action == "add") {
messages::add($text['message-add']);
}
else if ($action == "update") {
messages::add($text['message-update']);
}
header("Location: ?id=$number_translation_uuid");
exit;
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$sql = "select * from v_number_translations ";
$sql .= "where number_translation_uuid = '$number_translation_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (is_array($result)) foreach ($result as &$row) {
$domain_uuid = $row["domain_uuid"];
//$app_uuid = $row["app_uuid"];
$hostname = $row["hostname"];
$number_translation_name = $row["number_translation_name"];
$number_translation_enabled = $row["number_translation_enabled"];
$number_translation_description = $row["number_translation_description"];
}
unset ($prep_statement);
}
//get the number_translation details in an array
$sql = "select * from v_number_translation_details ";
$sql .= "where number_translation_uuid = '$number_translation_uuid' ";
$sql .= "order by number_translation_detail_order asc";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$results = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$results_count = count($result);
unset ($prep_statement, $sql);
//show the header
require_once "resources/header.php";
$document['title'] = $text['title-number_translation_edit'];
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<input type='hidden' name='id' value='$number_translation_uuid'>\n";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">\n";
echo " <tr>\n";
echo " <td align='left' width='30%'>\n";
echo" <span class=\"title\">".$text['title-number_translation_edit']."</span><br />\n";
echo " </td>\n";
echo " <td width='70%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='number_translations.php".((strlen($app_uuid) > 0) ? "?app_uuid=".$app_uuid : null)."';\" value='".$text['button-back']."'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"if (confirm('".$text['confirm-copy']."')){window.location='number_translation_copy.php?id=".$number_translation_uuid."';}\" value='".$text['button-copy']."'>\n";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['description-number_translation-edit']."\n";
echo " \n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='50%' style='vertical-align: top;'>\n";
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='30%'>\n";
echo " ".$text['label-name']."\n";
echo " </td>\n";
echo " <td class='vtable' width='70%' align='left'>\n";
echo " <input class='formfld' type='text' name='number_translation_name' maxlength='255' placeholder='' value=\"".htmlspecialchars($number_translation_name)."\" required='required'>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-hostname']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='hostname' maxlength='255' value=\"$hostname\">\n";
echo " <br />\n";
echo " ".$text['description-hostname']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>";
echo "<td width='50%' style='vertical-align: top;'>\n";
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <select class='formfld' name='number_translation_enabled'>\n";
if ($number_translation_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['option-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['option-true']."</option>\n";
}
if ($number_translation_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['option-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['option-false']."</option>\n";
}
echo " </select>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap' width='30%'>\n";
echo " ".$text['label-description']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left' width='70%'>\n";
echo " <textarea class='formfld' style='width: 250px; height: 68px;' name='number_translation_description'>".htmlspecialchars($number_translation_description)."</textarea>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br><br>";
//number_translation details
if ($action == "update") {
?>
<!--javascript to change select to input and back again-->
<script language="javascript">
function label_to_form(label_id, form_id) {
if (document.getElementById(label_id) != null) {
label = document.getElementById(label_id);
label.parentNode.removeChild(label);
}
document.getElementById(form_id).style.display='';
}
</script>
<?php
//display the results
if ($results_count > 0) {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0' style='margin: -2px; border-spacing: 2px;'>\n";
echo "<tr>\n";
echo "<td class='vncellcolreq' stlye='width:40%'>".$text['label-regex']."</td>\n";
echo "<td class='vncellcolreq' stlye='width:40%'>".$text['label-replace']."</td>\n";
echo "<td class='vncellcolreq' style='text-align: center;'>".$text['label-order']."</td>\n";
echo "<td>&nbsp;</td>\n";
echo "</tr>\n";
$x=0;
$results[]['number_translation_uuid'] = $number_translation_uuid;
foreach($results as $index => $row) {
//get the values from the database and set as variables
$number_translation_detail_uuid = $row['number_translation_detail_uuid'];
$number_translation_detail_regex = $row['number_translation_detail_regex'];
$number_translation_detail_replace = $row['number_translation_detail_replace'];
$number_translation_detail_order = (strlen($row['number_translation_detail_order']) > 0 ? $row['number_translation_detail_order'] : $number_translation_detail_order + 5 );
//no border on last row
$no_border = (strlen($number_translation_detail_uuid) == 0) ? "border: none;" : null;
//begin the row
echo "<tr>\n";
//determine whether to hide the element
if (strlen($number_translation_detail_regex) == 0) {
$element['hidden'] = false;
$element['visibility'] = "";
}
else {
$element['hidden'] = true;
$element['visibility'] = "display: none;";
}
//add the primary key uuid
if (strlen($number_translation_detail_uuid) > 0) {
echo " <input name='number_translation_details[".$x."][number_translation_detail_uuid]' type='hidden' value=\"".$number_translation_detail_uuid."\">\n";
}
//regex
echo "<td class='vtablerow' onclick=\"label_to_form('label_number_translation_detail_regex_".$x."','number_translation_detail_regex_".$x."');\" style='".$no_border." width: 40%; max-width: 150px; overflow: hidden; _text-overflow: ellipsis; white-space: nowrap;' nowrap='nowrap'>\n";
if ($element['hidden']) {
echo " <label id=\"label_number_translation_detail_regex_".$x."\">".htmlspecialchars($number_translation_detail_regex)."</label>\n";
}
echo " <input id='number_translation_detail_regex_".$x."' name='number_translation_details[".$x."][number_translation_detail_regex]' class='formfld' type='text' style='width: calc(100% - 2px); min-width: calc(100% - 2px); max-width: calc(100% - 2px); ".$element['visibility']."' placeholder='' value=\"".htmlspecialchars($number_translation_detail_regex)."\">\n";
echo "</td>\n";
//replace
echo "<td class='vtablerow' onclick=\"label_to_form('label_number_translation_detail_replace_".$x."','number_translation_detail_replace_".$x."');\" style='".$no_border." width: 40%; max-width: 150px; overflow: hidden; _text-overflow: ellipsis; white-space: nowrap;' nowrap='nowrap'>\n";
if ($element['hidden']) {
echo " <label id=\"label_number_translation_detail_replace_".$x."\">".htmlspecialchars($number_translation_detail_replace)."</label>\n";
}
echo " <input id='number_translation_detail_replace_".$x."' name='number_translation_details[".$x."][number_translation_detail_replace]' class='formfld' type='text' style='width: calc(100% - 2px); min-width: calc(100% - 2px); max-width: calc(100% - 2px); ".$element['visibility']."' placeholder='' value=\"".htmlspecialchars($number_translation_detail_replace)."\">\n";
echo "</td>\n";
//order
echo "<td class='vtablerow' style='".$no_border." text-align: center;' onclick=\"label_to_form('label_number_translation_detail_order_".$x."','number_translation_detail_order_".$x."');\" nowrap='nowrap'>\n";
if ($element['hidden']) {
echo " <label id=\"label_number_translation_detail_order_".$x."\">".$number_translation_detail_order."</label>\n";
}
echo " <input id='number_translation_detail_order_".$x."' name='number_translation_details[".$x."][number_translation_detail_order]' class='formfld' type='number' min='0' step='1' style='width: 32px; text-align: center; ".$element['visibility']."' placeholder='' value=\"".htmlspecialchars($number_translation_detail_order)."\" onclick='this.select();'>\n";
echo "</td>\n";
//tools
echo " <td class='list_control_icon'>\n";
if ($element['hidden']) {
//echo " <a href='number_translation_detail_edit.php?id=".$number_translation_detail_uuid."&number_translation_uuid=".$number_translation_uuid."&app_uuid=".$app_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
echo " <a href='number_translation_detail_delete.php?id=".$number_translation_detail_uuid."&number_translation_uuid=".$number_translation_uuid.(($app_uuid != '') ? "&app_uuid=".$app_uuid : null)."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
//end the row
echo "</tr>\n";
//increment the value
$x++;
}
unset($sql, $result, $row_count);
echo "</table>";
} //end if results
} //end if update
echo "<br>\n";
echo "<div align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='number_translation_uuid' value='$number_translation_uuid'>\n";
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</div>\n";
echo "<br><br>\n";
echo "</form>";
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
echo "<p>".$text['billing-warning']."</p>";
}
//show the footer
require_once "resources/footer.php";
?>
@@ -0,0 +1,241 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (!permission_exists('number_translation_view')) {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//handle enable toggle
$number_translation_uuid = check_str($_REQUEST['id']);
$number_translation_enabled = check_str($_REQUEST['enabled']);
if ($number_translation_uuid != '' && $number_translation_enabled != '') {
$array['number_translations'][0]['number_translation_uuid'] = $number_translation_uuid;
$array['number_translations'][0]['number_translation_enabled'] = $number_translation_enabled;
$database = new database;
$database->app_name = 'number_translations';
$database->save($array);
$number_translation = new number_translation;
$number_translation->xml();
messages::add($text['message-update']);
unset($array, $number_translation);
}
//set the http values as php variables
if (isset($_REQUEST["search"])) { $search = check_str($_REQUEST["search"]); } else { $search = null; }
if (isset($_REQUEST["order_by"])) { $order_by = check_str($_REQUEST["order_by"]); } else { $order_by = null; }
if (isset($_REQUEST["order"])) { $order = check_str($_REQUEST["order"]); } else { $order = null; }
//includes
require_once "resources/header.php";
require_once "resources/paging.php";
//get the number of rows in the number_translation
$sql = "select count(*) as num_rows from v_number_translations ";
$sql .= "where true ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " number_translation_name like '%".$search."%' ";
$sql .= " or number_translation_description like '%".$search."%' ";
$sql .= ") ";
}
$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) {
$num_rows = $row['num_rows'];
}
else {
$num_rows = '0';
}
}
unset($prep_statement, $result);
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "";
if (strlen($app_uuid) > 0) { $param = "&app_uuid=".$app_uuid; }
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list of number_translations
$sql = "select * from v_number_translations ";
$sql .= "where true ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " number_translation_name like '%".$search."%' ";
$sql .= " or number_translation_description like '%".$search."%' ";
$sql .= ") ";
}
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } else { $sql .= "order by number_translation_name asc "; }
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$number_translations = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($number_translations);
unset ($prep_statement, $sql);
//set the alternating row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//set the title
$document['title'] = $text['title-number_translation'];
//show the content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td align='left' valign='top'>\n";
echo " <span class='title'>\n";
echo " ".$text['header-number_translation']."\n";
echo " </span>\n";
echo " <br><br>\n";
echo " </td>\n";
echo " <td align='right' valign='top' nowrap='nowrap' style='padding-left: 50px;'>\n";
echo " <form name='frm_search' method='get' action=''>\n";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
if (strlen($order_by) > 0) {
echo " <input type='hidden' class='txt' name='order_by' value='".$order_by."'>";
echo " <input type='hidden' class='txt' name='order' value='".$order."'>";
}
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " <input type='button' class='btn' value='".$text['button-reload_xml']."' onclick=\"document.location.href='cmd.php?cmd=api+reloadxml';\" />\n";
echo " <input type='button' class='btn' value='".$text['button-reload']." mod_translate' onclick=\"document.location.href='cmd.php?cmd=api+reload+mod_translate';\" />\n";
echo " </form>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td colspan='2'>\n";
echo " <span class='vexpl'>\n";
echo " " . $text['description-number_translation'] . "\n";
echo " </span>\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br />";
echo "<form name='frm_delete' method='post' action='number_translation_delete.php'>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
if (permission_exists('number_translation_delete') && $result_count > 0) {
echo "<th style='text-align: center; padding: 3px 0px 0px 0px;' width='1'><input type='checkbox' style='margin: 0px 0px 0px 2px;' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
}
echo th_order_by('number_translation_name', $text['label-name'], $order_by, $order, $app_uuid, null, (($search != '') ? "search=".$search : null));
echo th_order_by('number_translation_enabled', $text['label-enabled'], $order_by, $order, $app_uuid, "style='text-align: center;'", (($search != '') ? "search=".$search : null));
echo th_order_by('number_translation_description', $text['label-description'], $order_by, $order, $app_uuid, null, (($search != '') ? "search=".$search : null));
echo "<td class='list_control_icons'>";
if (permission_exists('number_translation_delete') && $result_count > 0) {
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm_delete.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
}
echo "</td>\n";
echo "</tr>\n";
if ($result_count > 0) {
foreach($number_translations as $row) {
$tr_link = "href='number_translation_edit.php?id=".$row['number_translation_uuid']."'";
echo "<tr ".$tr_link.">\n";
if (permission_exists("number_translation_delete")) {
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; padding: 3px 0px 0px 0px;'><input type='checkbox' name='id[]' id='checkbox_".$row['number_translation_uuid']."' value='".$row['number_translation_uuid']."'></td>\n";
$number_translation_ids[] = 'checkbox_'.$row['number_translation_uuid'];
}
echo " <td valign='top' class='".$row_style[$c]."'>";
echo $row['number_translation_name'];
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center;'>";
echo " <a href='?id=".$row['number_translation_uuid']."&enabled=".(($row['number_translation_enabled'] == 'true') ? 'false' : 'true').(($app_uuid != '') ? "&app_uuid=".$app_uuid : null).(($search != '') ? "&search=".$search : null).(($order_by != '') ? "&order_by=".$order_by."&order=".$order : null)."'>".$text['label-'.$row['number_translation_enabled']]."</a>\n";
echo " </td>\n";
echo " <td valign='top' class='row_stylebg' width='30%'>".((strlen($row['number_translation_description']) > 0) ? $row['number_translation_description'] : "&nbsp;")."</td>\n";
echo " <td class='list_control_icons'>\n";
if (permission_exists('number_translation_edit')) {
echo " <a href='number_translation_edit.php?id=".$row['number_translation_uuid'].(($app_uuid != '') ? "&app_uuid=".$app_uuid : null)."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('number_translation_delete')) {
echo " <a href=\"number_translation_delete.php?id[]=".$row['number_translation_uuid'].(($app_uuid != '') ? "&app_uuid=".$app_uuid : null)."\" alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='8'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('number_translation_edit')) {
echo " <a href='number_translation_add.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
if (permission_exists('number_translation_delete') && $result_count > 0) {
echo " <a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm_delete.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br><br>";
echo "</form>";
if (sizeof($number_translation_ids) > 0) {
echo "<script>\n";
echo " function check(what) {\n";
foreach ($number_translation_ids as $checkbox_id) {
echo "document.getElementById('".$checkbox_id."').checked = (what == 'all') ? true : false;\n";
}
echo " }\n";
echo "</script>\n";
}
//include the footer
require_once "resources/footer.php";
//unset the variables
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
?>
@@ -0,0 +1,179 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
include "root.php";
//define the number_translation class
if (!class_exists('number_translation')) {
class number_translation {
//variables
public $db;
public $xml;
public $json;
public $display_type;
//class constructor
public function __construct() {
//connect to the database if not connected
if (!$this->db) {
require_once "resources/classes/database.php";
$database = new database;
$database->connect();
$this->db = $database->db;
}
}
public function number_translation_exists($name) {
$sql = "select number_translation_uuid from v_number_translations ";
$sql .= "where number_translation_name = '$name' ";
$prep_statement = $this->db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
if (count($result)) {
return true;
}
else {
return false;
}
}
unset($sql, $prep_statement, $result);
}
public function import() {
if (strlen($this->xml) > 0) {
//convert the xml string to an xml object
$xml = simplexml_load_string($this->xml);
//convert to json
$json = json_encode($xml);
//convert to an array
$number_translation = json_decode($json, true);
}
elseif (strlen($this->json) > 0) {
//convert to an array
$number_translation = json_decode($this->json, true);
}
else {
throw new Exception("require either json or xml to import");
}
//check if the number_translation exists
if (!$this->number_translation_exists($number_translation['@attributes']['name'])) {
$permissions = new permissions;
$permissions->add('number_translation_add', 'temp');
$permissions->add('number_translation_detail_add', 'temp');
$x=0;
$array['number_translations'][$x]['number_translation_name'] = $number_translation['@attributes']['name'];
$array['number_translations'][$x]['number_translation_enabled'] = "true";
if (strlen($number_translation['@attributes']['enabled']) > 0) {
$array['number_translations'][$x]['number_translation_enabled'] = $number_translation['@attributes']['enabled'];
}
$array['number_translations'][$x]['number_translation_description'] = $number_translation['@attributes']['description'];
//loop through the condition array
$order = 5;
if (isset($number_translation['rule'])) {
foreach ($number_translation['rule'] as &$row) {
if(array_key_exists('@attributes', $row))
$row = $row['@attributes'];
$array['number_translations'][$x]['number_translation_details'][$order]['number_translation_detail_regex'] = $row['regex'];
$array['number_translations'][$x]['number_translation_details'][$order]['number_translation_detail_replace'] = $row['replace'];
$array['number_translations'][$x]['number_translation_details'][$order]['number_translation_detail_order'] = $order;
$order = $order + 5;
}
}
$database = new database;
$database->app_name = 'number_translations';
$database->app_uuid = '6ad54de6-4909-11e7-a919-92ebcb67fe33';
$database->save($array);
if ($this->display_type == "text") {
if ($database->message['code'] != '200') {
echo "number_translation:".$number_translation['@attributes']['name'].": failed: ".$database->message['message']."\n";
}
else {
echo "number_translation:".$number_translation['@attributes']['name'].": added with ".(($order/5)-1)." entries\n";
}
}
$permissions->delete('number_translation_add', 'temp');
$permissions->delete('number_translation_detail_add', 'temp');
}
unset ($this->xml, $this->json);
}
//reads number_translation details from the database to build the xml
public function xml () {
$xml = "<include>\n";
$xml .= ' <configuration name="translate.conf" description="Number Translation Rules" autogenerated="true">'."\n";
$xml .= " <profiles>\n";
$sql = "select * \n";
$sql .= "from v_number_translations \n";
$sql .= "order by \n";
$sql .= "number_translation_name asc \n";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$results = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($results as $row) {
$number_translation_uuid = $row["number_translation_uuid"];
$number_translation_name = $row["number_translation_name"];
$number_translation_description = $row["number_translation_description"];
$xml .= " <profile name=\"$number_translation_name\" description=\"$number_translation_description\">\n";
$sql = "select ";
$sql .= "number_translation_detail_uuid, number_translation_detail_regex, number_translation_detail_replace, number_translation_detail_order \n";
$sql .= "from v_number_translation_details \n";
$sql .= "where number_translation_uuid = '$number_translation_uuid' \n";
$sql .= "order by \n";
$sql .= "number_translation_detail_order asc \n";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$results = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($results as $row) {
$number_translation_detail_regex = $row["number_translation_detail_regex"];
$number_translation_detail_replace = $row["number_translation_detail_replace"];
$xml .= " <rule regex=\"$number_translation_detail_regex\" replace=\"$number_translation_detail_replace\"/>\n";
}
$xml .= " </profile>\n";
}
$xml .= " </profiles>\n";
$xml .= " </configuration>\n";
$xml .= "</include>";
$fout = fopen($_SESSION['switch']['conf']['dir']."/autoload_configs/translate.conf.xml","w");
fwrite($fout, $xml);
unset($xml);
fclose($fout);
$_SESSION["reload_xml"] = true;
}
} // end class
} // class_exists
?>
@@ -0,0 +1,6 @@
<profile name="GB_national_to_e164" description="Convert from GB national dialling to E.164 format">
<rule regex="^\+(\d+)$" replace="$1"/>
<rule regex="^00(\d+)$" replace="$1"/>
<rule regex="^0([1-9]\d+)$" replace="44$1"/>
<rule regex="^(\d+)$" replace="$1"/>
</profile>
@@ -0,0 +1,6 @@
<profile name="e164_to_GB_national" description="Convert from E.164 format to GB national dialling">
<rule regex="^44(\d{3,6})$" replace="$1"/>
<rule regex="^44(\d+)$" replace="0$1"/>
<rule regex="^(\d+)$" replace="00$1"/>
<rule regex="^\+(\d+)$" replace="00$1"/>
</profile>
@@ -0,0 +1,3 @@
<profile name="remove_leading_plus" description="Remove a leading +">
<rule regex="^\+(\d+)$" replace="$1"/>
</profile>
@@ -0,0 +1,4 @@
<profile name="strip_non_digits" description="Remove anything that is not [0-9a-fA-F#*]">
<rule regex="^[^0-9a-fA-F#*]*([0-9a-fA-F#*]+)[^0-9a-fA-F#*]*([0-9a-fA-F#*]*)[^0-9a-fA-F#*]*([0-9a-fA-F#*]*)[^0-9a-fA-F#*]*([0-9a-fA-F#*]*)[^0-9a-fA-F#*]*([0-9a-fA-F#*]*)[^0-9a-fA-F#*]*([0-9a-fA-F#*]*)[^0-9a-fA-F#*]*([0-9a-fA-F#*]*)[^0-9a-fA-F#*]*([0-9a-fA-F#*]*)[^0-9a-fA-F#*]*([0-9a-fA-F#*]*)[^0-9a-fA-F#*]*$" replace="$1$2$3$4$5$6$7$8$9"/>
<rule regex="^(.*)$" replace="$1"/>
</profile>
@@ -0,0 +1,4 @@
<profile name="strip_symbols" description="Remove anything that is [^ (){}_-]">
<rule regex="^[ (){}_-]*([^ (){}_-]+)[ (){}_-]*([^ (){}_-]*)[ (){}_-]*([^ (){}_-]*)[ (){}_-]*([^ (){}_-]*)[ (){}_-]*([^ (){}_-]*)[ (){}_-]*([^ (){}_-]*)[ (){}_-]*([^ (){}_-]*)[ (){}_-]*([^ (){}_-]*)[ (){}_-]*([^ (){}_-]*)[ (){}_-]*$" replace="$1$2$3$4$5$6$7$8$9"/>
<rule regex="^(.*)$" replace="$1"/>
</profile>
+90
View File
@@ -0,0 +1,90 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
} else {
define("PATH_SEPARATOR", ":");
}
}
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
if(PHP_SAPI == 'cli'){
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) {
$path = '/';
} else {
$i = 1;
$path = '';
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
}
$_SERVER["DOCUMENT_ROOT"] = $path;
}else{
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
}
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
// try to detect if a project path is being used
if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', '');
} else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
$i = 1;
$path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
}
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
}
?>