mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-03-14 20:48:48 +00:00
Merge remote-tracking branch 'fusionpbx/master'
This commit is contained in:
@@ -6,7 +6,7 @@ It provides the functionality your business needs and brings corporate-level pho
|
||||
|
||||
In addition to providing all of the usual PBX functionality, FusionPBX allows you to configure:
|
||||
|
||||
- Multi-Tenancy
|
||||
- Multi-Tenant
|
||||
- Unlimited Extensions
|
||||
- Voicemail-to-Email
|
||||
- Music on Hold
|
||||
@@ -25,7 +25,7 @@ We provide several avenues for you to get your system up and running on your own
|
||||
1. [Current Documentation](http://wiki.fusionpbx.com/index.php?title=Main_Page)
|
||||
2. [New Documentation](http://fusionpbx-docs.readthedocs.org/en/latest/) COMING SOON
|
||||
3. [How to Contribute](http://fusionpbx.com) COMING SOON
|
||||
4. [IRC](http://webchat.freenode.net/) in the fusionpbx channel
|
||||
4. [IRC](http://webchat.freenode.net/) in the #fusionpbx channel
|
||||
|
||||
Commercial Support
|
||||
--------------------------------------
|
||||
|
||||
@@ -33,6 +33,6 @@ else {
|
||||
|
||||
//redirect the user
|
||||
$_SESSION['message'] = $text['message-delete'];
|
||||
header('Location: access_control_node_edit.php?id='.$access_control_uuid);
|
||||
header('Location: access_control_edit.php?id='.$access_control_uuid);
|
||||
|
||||
?>
|
||||
@@ -25,22 +25,18 @@
|
||||
$apps[$x]['permissions'][$y]['menu']['uuid'] = "29295c90-b1b9-440b-9c7E-c8363c6e8975";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "user";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "call_block_add";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "user";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "call_block_edit";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "user";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "call_block_delete";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "user";
|
||||
$y++;
|
||||
|
||||
//schema details
|
||||
|
||||
@@ -350,6 +350,31 @@ $text['label-busy']['de-at'] = "Besetzt";
|
||||
$text['label-busy']['ar-eg'] = "مشغول";
|
||||
$text['label-busy']['he'] = "תפוס";
|
||||
|
||||
$text['label-hold']['en-us'] = "Hold";
|
||||
$text['label-hold']['es-cl'] = "";
|
||||
$text['label-hold']['pt-pt'] = "";
|
||||
$text['label-hold']['fr-fr'] = "";
|
||||
$text['label-hold']['nl-nl'] = "";
|
||||
$text['label-hold']['pt-br'] = "";
|
||||
$text['label-hold']['pl'] = "";
|
||||
$text['label-hold']['sv-se'] = "";
|
||||
$text['label-hold']['uk'] = "";
|
||||
$text['label-hold']['ro'] = "";
|
||||
$text['label-hold']['de-at'] = "";
|
||||
$text['label-hold']['ar-eg'] = "";
|
||||
$text['label-hold']['he'] = "";
|
||||
|
||||
$text['label-voicemail']['en-us'] = "Voicemail";
|
||||
$text['label-voicemail']['es-cl'] = "Correo de Voz";
|
||||
$text['label-voicemail']['pt-pt'] = "Correio de Voz";
|
||||
$text['label-voicemail']['fr-fr'] = "Messagerie Vocale";
|
||||
$text['label-voicemail']['pt-br'] = "Correio de voz";
|
||||
$text['label-voicemail']['pl'] = "Poczta głosowa";
|
||||
$text['label-voicemail']['sv-se'] = "Röstbrevlåda";
|
||||
$text['label-voicemail']['uk'] = "Голосова пошта";
|
||||
$text['label-voicemail']['de-at'] = "Mailbox";
|
||||
$text['label-voicemail']['he'] = "תא קולי";
|
||||
|
||||
$text['label-add-note']['en-us'] = "Block calls from a number. Either select a number from the list above or enter the number, name and enable below.";
|
||||
$text['label-add-note']['es-cl'] = "Bloquea llamadas desde un número. Puede elegir un número de la lista de arriba o ingresar el nú, nombre y activarlo abajo.";
|
||||
$text['label-add-note']['pt-pt'] = "Bloquear chamadas a partir de um número. Seleccione um número a partir da lista indicada ou introduza um número, nome e active.";
|
||||
|
||||
@@ -16,8 +16,7 @@ $apps[$x]['menu'][0]['uuid'] = "29295c90-b1b9-440b-9c7E-c8363c6e8975";
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
|
||||
$apps[$x]['menu'][0]['category'] = "internal";
|
||||
$apps[$x]['menu'][0]['path'] = "/app/call_block/call_block.php";
|
||||
$apps[$x]['menu'][0]['groups'][] = "user";
|
||||
$apps[$x]['menu'][0]['groups'][] = "admin";
|
||||
$apps[$x]['menu'][0]['groups'][] = "superadmin";
|
||||
$apps[$x]['menu'][0]['groups'][] = "admin";
|
||||
|
||||
?>
|
||||
@@ -44,7 +44,7 @@ else {
|
||||
|
||||
//define the call_block_get_extensions function
|
||||
function call_block_get_extensions($select_extension) {
|
||||
global $db;
|
||||
global $db, $text;
|
||||
|
||||
//list voicemail
|
||||
$sql = "select extension, user_context, description from v_extensions ";
|
||||
@@ -55,12 +55,12 @@ else {
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
echo "<optgroup label='Voicemail'>\n";
|
||||
echo "<optgroup label='".$text['label-voicemail']."'>\n";
|
||||
foreach ($result as &$row) {
|
||||
$extension = $row["extension"];
|
||||
$context = $row["user_context"];
|
||||
$description = $row["description"];
|
||||
if ($extension == $select_extension) $selected = "SELECTED";
|
||||
if ($extension == $select_extension) $selected = "selected='selected'";
|
||||
echo " <option value='Voicemail $context $extension' $selected>".$extension." ".$description."</option>\n";
|
||||
$selected = "";
|
||||
}
|
||||
@@ -77,7 +77,7 @@ else {
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
if (count($_POST) > 0) {
|
||||
$call_block_name = check_str($_POST["call_block_name"]);
|
||||
$call_block_number = check_str($_POST["call_block_number"]);
|
||||
$call_block_action = check_str($_POST["call_block_action"]);
|
||||
@@ -167,7 +167,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$result = $prep_statement->fetchAll();
|
||||
$result_count = count($result);
|
||||
if ($result_count > 0) {
|
||||
$call_block_number = $result[0]["call_block_number"];
|
||||
//set the domain_name
|
||||
$domain_name = $result[0]["domain_name"];
|
||||
|
||||
//clear the cache
|
||||
@@ -298,6 +298,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
else {
|
||||
echo " <option value='Busy'>".$text['label-busy']."</option>\n";
|
||||
}
|
||||
if ($action == "Hold") {
|
||||
echo " <option value='Hold' selected='selected'>".$text['label-hold']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='Hold'>".$text['label-hold']."</option>\n";
|
||||
}
|
||||
call_block_get_extensions($extension);
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
@@ -86,6 +86,7 @@ if (count($_GET)>0) {
|
||||
|
||||
//synchronize configuration
|
||||
save_call_center_xml();
|
||||
remove_config_from_cache('configuration:callcenter.conf');
|
||||
|
||||
//redirect the browser
|
||||
$_SESSION["message"] = $text['message-delete'];
|
||||
|
||||
@@ -264,6 +264,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//syncrhonize configuration
|
||||
save_call_center_xml();
|
||||
remove_config_from_cache('configuration:callcenter.conf');
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: call_center_agents.php");
|
||||
@@ -291,7 +292,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
unset($sql);
|
||||
|
||||
//syncrhonize configuration
|
||||
save_call_center_xml();
|
||||
save_call_center_xml();
|
||||
remove_config_from_cache('configuration:callcenter.conf');
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: call_center_agents.php");
|
||||
|
||||
@@ -87,9 +87,11 @@ if (strlen($id) > 0) {
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["context"]);
|
||||
remove_config_from_cache('configuration:callcenter.conf');
|
||||
|
||||
//synchronize configuration
|
||||
save_dialplan_xml();
|
||||
save_call_center_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
@@ -257,6 +257,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//syncrhonize the configuration
|
||||
save_call_center_xml();
|
||||
remove_config_from_cache('configuration:callcenter.conf');
|
||||
|
||||
//delete the dialplan context from memcache
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
@@ -326,6 +327,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//synchronize the configuration
|
||||
save_call_center_xml();
|
||||
remove_config_from_cache('configuration:callcenter.conf');
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
@@ -393,6 +395,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//syncrhonize configuration
|
||||
save_call_center_xml();
|
||||
remove_config_from_cache('configuration:callcenter.conf');
|
||||
}
|
||||
|
||||
//redirect
|
||||
|
||||
@@ -111,7 +111,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
unset($sql);
|
||||
|
||||
//syncrhonize configuration
|
||||
save_call_center_xml();
|
||||
save_call_center_xml();
|
||||
remove_config_from_cache('configuration:callcenter.conf');
|
||||
|
||||
//look up queue uuid by queue name (ugh)
|
||||
$sql = "select call_center_queue_uuid from v_call_center_queues where queue_name = '".$queue_name."'";
|
||||
|
||||
@@ -101,17 +101,6 @@ $text['label-on-busy']['sv-se'] = "Vid Upptaget ";
|
||||
$text['label-on-busy']['uk'] = "Якщо зайнято";
|
||||
$text['label-on-busy']['de-at'] = "Bei Besetzt";
|
||||
|
||||
$text['label-ignore-busy']['en-us'] = "Ignore Busy";
|
||||
$text['label-ignore-busy']['es-cl'] = "";
|
||||
$text['label-ignore-busy']['pt-pt'] = "";
|
||||
$text['label-ignore-busy']['fr-fr'] = "";
|
||||
$text['label-ignore-busy']['it-it'] = "";
|
||||
$text['label-ignore-busy']['pt-br'] = "";
|
||||
$text['label-ignore-busy']['pl'] = "";
|
||||
$text['label-ignore-busy']['sv-se'] = "";
|
||||
$text['label-ignore-busy']['uk'] = "";
|
||||
$text['label-ignore-busy']['de-at'] = "";
|
||||
|
||||
$text['label-number']['en-us'] = "Number";
|
||||
$text['label-number']['es-cl'] = "Número";
|
||||
$text['label-number']['pt-pt'] = "Número";
|
||||
@@ -133,6 +122,17 @@ $text['label-no_answer']['sv-se'] = "Inget Svar ";
|
||||
$text['label-no_answer']['uk'] = "Без відповіді";
|
||||
$text['label-no_answer']['de-at'] = "Keine Antwort";
|
||||
|
||||
$text['label-ignore-busy']['en-us'] = "Ignore Busy";
|
||||
$text['label-ignore-busy']['es-cl'] = "";
|
||||
$text['label-ignore-busy']['pt-pt'] = "";
|
||||
$text['label-ignore-busy']['fr-fr'] = "";
|
||||
$text['label-ignore-busy']['it-it'] = "";
|
||||
$text['label-ignore-busy']['pt-br'] = "";
|
||||
$text['label-ignore-busy']['pl'] = "";
|
||||
$text['label-ignore-busy']['sv-se'] = "";
|
||||
$text['label-ignore-busy']['uk'] = "";
|
||||
$text['label-ignore-busy']['de-at'] = "Ignorieren bei Besetzt";
|
||||
|
||||
$text['label-follow-me']['en-us'] = "Follow Me";
|
||||
$text['label-follow-me']['es-cl'] = "Sígueme";
|
||||
$text['label-follow-me']['pt-pt'] = "Segue-me";
|
||||
@@ -141,7 +141,7 @@ $text['label-follow-me']['pt-br'] = "Siga-me";
|
||||
$text['label-follow-me']['pl'] = "Podążaj za mną";
|
||||
$text['label-follow-me']['sv-se'] = "Följ Mig ";
|
||||
$text['label-follow-me']['uk'] = "";
|
||||
$text['label-follow-me']['de-at'] = "Follow Me";
|
||||
$text['label-follow-me']['de-at'] = "Anrufweiterschaltung";
|
||||
|
||||
$text['label-enabled']['en-us'] = "Enabled";
|
||||
$text['label-enabled']['es-cl'] = "Activo";
|
||||
@@ -311,7 +311,7 @@ $text['label-call-forward']['pt-br'] = "Encaminhamento de chamadas";
|
||||
$text['label-call-forward']['pl'] = "Przekierowanie";
|
||||
$text['label-call-forward']['sv-se'] = "Vidarekoppling ";
|
||||
$text['label-call-forward']['uk'] = "Переадресація";
|
||||
$text['label-call-forward']['de-at'] = "Ruf Weiterleitung";
|
||||
$text['label-call-forward']['de-at'] = "Rufumleitung";
|
||||
|
||||
$text['description-on-busy']['en-us'] = "If enabled, it overrides the value of voicemail enabling in extension.";
|
||||
$text['description-on-busy']['es-cl'] = "Si está habilitada, anula el valor del correo de voz que permite en la extensión.";
|
||||
@@ -383,7 +383,7 @@ $text['description-2']['pt-br'] = "A informação contem a origem, destino, dura
|
||||
$text['description-2']['pl'] = "Za pomocą poniższych linków można skonfigurować przekierowania, usługę „Podążaj z mną” lub „Nie przeszkadzać” (DnD).";
|
||||
$text['description-2']['sv-se'] = "Använd länkarna för att konfigurera Vidarekoppling, Följ Mig och Stör Ej. ";
|
||||
$text['description-2']['uk'] = "";
|
||||
$text['description-2']['de-at'] = "Benutzen Sie die Funktionen um Weiterleitung, Follow Me oder Bitte nicht stören zu konfigurieren.";
|
||||
$text['description-2']['de-at'] = "Benutzen Sie die Funktionen um Rufumleitung, Anrufweiterschaltung oder Nicht stören zu konfigurieren.";
|
||||
|
||||
$text['description']['en-us'] = "Directs incoming calls for extension:";
|
||||
$text['description']['es-cl'] = "Dirige las llamadas entrantes hacia una extensión:";
|
||||
|
||||
@@ -63,7 +63,7 @@ else {
|
||||
$sql = "select * from v_extensions ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and extension_uuid = '$extension_uuid' ";
|
||||
if (!(if_group("admin") || if_group("superadmin"))) {
|
||||
if (!(permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb'))) {
|
||||
if (count($_SESSION['user']['extension']) > 0) {
|
||||
$sql .= "and (";
|
||||
$x = 0;
|
||||
@@ -536,7 +536,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
if (permission_exists('follow_me_cid_set')) {
|
||||
echo " ";
|
||||
$sql_forward = "select destination_uuid, destination_number, destination_description from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
|
||||
$sql_forward = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
|
||||
$prep_statement_forward = $db->prepare(check_sql($sql_forward));
|
||||
$prep_statement_forward->execute();
|
||||
$result_forward = $prep_statement_forward->fetchAll(PDO::FETCH_ASSOC);
|
||||
@@ -546,7 +546,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo " <option value='' disabled='disabled'></option>\n";
|
||||
foreach ($result_forward as &$row_forward) {
|
||||
$selected = $row_forward["destination_uuid"] == $forward_caller_id_uuid ? "selected='selected' " : '';
|
||||
echo "<option value='".$row_forward["destination_uuid"]."' ".$selected.">".format_phone($row_forward["destination_number"])." : ".$row_forward["destination_description"]."</option>\n";
|
||||
$caller_id_number = $row_forward['destination_caller_id_number'];
|
||||
if(strlen($caller_id_number) == 0){
|
||||
$caller_id_number = $row_forward['destination_number'];
|
||||
}
|
||||
$caller_id_name = $row_forward['destination_caller_id_name'];
|
||||
if(strlen($caller_id_name) == 0){
|
||||
$caller_id_name = $row_forward['destination_description'];
|
||||
}
|
||||
echo "<option value='".$row_forward["destination_uuid"]."' ".$selected.">".format_phone($caller_id_number)." : ".$caller_id_name."</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
}
|
||||
@@ -603,7 +611,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
if (permission_exists('follow_me_cid_set')) {
|
||||
echo " ";
|
||||
$sql_follow_me = "select destination_uuid, destination_number, destination_description from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
|
||||
$sql_follow_me = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
|
||||
$prep_statement_follow_me = $db->prepare(check_sql($sql_follow_me));
|
||||
$prep_statement_follow_me->execute();
|
||||
$result_follow_me = $prep_statement_follow_me->fetchAll(PDO::FETCH_ASSOC);
|
||||
@@ -613,7 +621,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo " <option value='' disabled='disabled'></option>\n";
|
||||
foreach ($result_follow_me as &$row_follow_me) {
|
||||
$selected = $row_follow_me["destination_uuid"] == $follow_me_caller_id_uuid ? "selected='selected'" : '';
|
||||
echo "<option value='".$row_follow_me["destination_uuid"]."' ".$selected.">".format_phone($row_follow_me["destination_number"])." : ".$row_follow_me["destination_description"]."</option>\n";
|
||||
|
||||
$caller_id_number = $row_follow_me['destination_caller_id_number'];
|
||||
if(strlen($caller_id_number) == 0){
|
||||
$caller_id_number = $row_follow_me['destination_number'];
|
||||
}
|
||||
$caller_id_name = $row_follow_me['destination_caller_id_name'];
|
||||
if(strlen($caller_id_name) == 0){
|
||||
$caller_id_name = $row_follow_me['destination_description'];
|
||||
}
|
||||
|
||||
echo "<option value='".$row_follow_me["destination_uuid"]."' ".$selected.">".format_phone($caller_id_number)." : ".$caller_id_name."</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
}
|
||||
@@ -749,11 +767,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo $text['label-ignore-busy'];
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='follow_me_ignore_busy'>\n";
|
||||
echo " <option value='true' " . ($follow_me_ignore_busy == 'true' ? "selected='selected'" : '') . ">True</option>\n";
|
||||
echo " <option value='false'" . ($follow_me_ignore_busy == 'true' ? '' : "selected='selected'") . ">False</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " <br> Interrupt call if one of destination are busy\n";
|
||||
echo " <label for='follow_me_ignore_busy'><input type='radio' name='follow_me_ignore_busy' id='follow_me_ignore_busy' value='false' onclick=\"\" ".(($follow_me_ignore_busy == "false" || $follow_me_ignore_busy == "") ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
|
||||
echo " <label for='follow_me_ignore_busy'><input type='radio' name='follow_me_ignore_busy' id='follow_me_ignore_busy' value='true' onclick=\"$on_click\" ".(($follow_me_ignore_busy == "true") ? "checked='checked'" : null)." /> ".$text['label-enabled']."</label> \n";
|
||||
echo " <br />\n";
|
||||
echo $text['description-ignore-busy']." \n";
|
||||
//echo " <br> Interrupt call if one of destination are busy\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
|
||||
@@ -84,17 +84,27 @@ include "root.php";
|
||||
}
|
||||
|
||||
if (strlen($this->forward_caller_id_uuid) > 0){
|
||||
$sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->forward_caller_id_uuid'";
|
||||
$sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->forward_caller_id_uuid'";
|
||||
$prep_statement_caller = $db->prepare($sql_caller);
|
||||
if ($prep_statement_caller) {
|
||||
$prep_statement_caller->execute();
|
||||
$row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC);
|
||||
if (strlen($row_caller['destination_description']) > 0) {
|
||||
$dial_string_caller_id_name = $row_caller['destination_description'];
|
||||
|
||||
$caller_id_number = $row_caller['destination_caller_id_number'];
|
||||
if(strlen($caller_id_number) == 0){
|
||||
$caller_id_number = $row_caller['destination_number'];
|
||||
}
|
||||
$caller_id_name = $row_caller['destination_caller_id_name'];
|
||||
if(strlen($caller_id_name) == 0){
|
||||
$caller_id_name = $row_caller['destination_description'];
|
||||
}
|
||||
|
||||
if (strlen($caller_id_name) > 0) {
|
||||
$dial_string_caller_id_name = $caller_id_name;
|
||||
$dial_string .= ",origination_caller_id_name=$dial_string_caller_id_name";
|
||||
}
|
||||
if (strlen($row_caller['destination_number']) > 0) {
|
||||
$dial_string_caller_id_number = $row_caller['destination_number'];
|
||||
if (strlen($caller_id_number) > 0) {
|
||||
$dial_string_caller_id_number = $caller_id_number;
|
||||
$dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number";
|
||||
$dial_string .= ",outbound_caller_id_number=$dial_string_caller_id_number";
|
||||
}
|
||||
@@ -136,15 +146,17 @@ include "root.php";
|
||||
|
||||
//update the extension
|
||||
$sql = "update v_extensions set ";
|
||||
if (strlen($this->forward_all_destination) == 0) {
|
||||
$sql .= "forward_all_destination = null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "forward_all_destination = '$this->forward_all_destination', ";
|
||||
}
|
||||
if (strlen($this->forward_all_destination) == 0 || $this->forward_all_enabled == "false") {
|
||||
if (strlen($this->forward_all_destination) == 0) {
|
||||
$sql .= "forward_all_destination = null, ";
|
||||
}
|
||||
$sql .= "dial_string = null, ";
|
||||
$sql .= "forward_all_enabled = 'false' ";
|
||||
}
|
||||
else {
|
||||
$sql .= "forward_all_destination = '$this->forward_all_destination', ";
|
||||
$sql .= "dial_string = '".check_str($this->dial_string)."', ";
|
||||
$sql .= "forward_all_enabled = 'true' ";
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ include "root.php";
|
||||
|
||||
//set the dial string
|
||||
if ($this->enabled == "true") {
|
||||
$this->dial_string = "loopback/*99".$this->extension;
|
||||
$this->dial_string = "error/user_busy";
|
||||
}
|
||||
else {
|
||||
$this->dial_string = '';
|
||||
|
||||
@@ -299,16 +299,26 @@ include "root.php";
|
||||
$dial_string_caller_id_number = "\${caller_id_number}";
|
||||
|
||||
if (strlen($this->follow_me_caller_id_uuid) > 0){
|
||||
$sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'";
|
||||
$sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'";
|
||||
$prep_statement_caller = $db->prepare($sql_caller);
|
||||
if ($prep_statement_caller) {
|
||||
$prep_statement_caller->execute();
|
||||
$row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC);
|
||||
if (strlen($row_caller['destination_description']) > 0) {
|
||||
$dial_string_caller_id_name = $row_caller['destination_description'];
|
||||
|
||||
$caller_id_number = $row_caller['destination_caller_id_number'];
|
||||
if(strlen($caller_id_number) == 0){
|
||||
$caller_id_number = $row_caller['destination_number'];
|
||||
}
|
||||
if (strlen($row_caller['destination_number']) > 0) {
|
||||
$dial_string_caller_id_number = $row_caller['destination_number'];
|
||||
$caller_id_name = $row_caller['destination_caller_id_name'];
|
||||
if(strlen($caller_id_name) == 0){
|
||||
$caller_id_name = $row_caller['destination_description'];
|
||||
}
|
||||
|
||||
if (strlen($caller_id_name) > 0) {
|
||||
$dial_string_caller_id_name = $caller_id_name;
|
||||
}
|
||||
if (strlen($caller_id_number) > 0) {
|
||||
$dial_string_caller_id_number = $caller_id_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,43 +418,4 @@
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "end_epoch";
|
||||
$z++;
|
||||
|
||||
/*
|
||||
$y = 4; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = "v_conference_center_users";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "conference_user_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'] = "domain_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_domains";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "conference_center_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_conference_centers";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "conference_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "user_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_users";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "user_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
*/
|
||||
|
||||
?>
|
||||
@@ -62,218 +62,169 @@ else {
|
||||
$conference_center_name = str_replace(" ", "-", $conference_center_name);
|
||||
}
|
||||
|
||||
/*
|
||||
//delete the user from the v_conference_center_users
|
||||
if ($_GET["a"] == "delete" && permission_exists("conference_center_delete")) {
|
||||
//set the variables
|
||||
$user_uuid = check_str($_REQUEST["user_uuid"]);
|
||||
$conference_center_uuid = check_str($_REQUEST["id"]);
|
||||
//delete the group from the users
|
||||
$sql = "delete from v_conference_center_users ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and conference_center_uuid = '".$conference_center_uuid."' ";
|
||||
$sql .= "and user_uuid = '".$user_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
//redirect the browser
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=conference_center_edit.php?id=$conference_center_uuid\">\n";
|
||||
echo "<div align='center'>Delete Complete</div>";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
//process user data
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//add the user to the v_conference_center_users
|
||||
if (strlen($_REQUEST["user_uuid"]) > 0 && strlen($_REQUEST["id"]) > 0 && $_GET["a"] != "delete") {
|
||||
//set the variables
|
||||
$user_uuid = check_str($_REQUEST["user_uuid"]);
|
||||
$conference_center_uuid = check_str($_REQUEST["id"]);
|
||||
//assign the user to the extension
|
||||
$sql_insert = "insert into v_conference_center_users ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "conference_user_uuid, ";
|
||||
$sql_insert .= "domain_uuid, ";
|
||||
$sql_insert .= "conference_center_uuid, ";
|
||||
$sql_insert .= "user_uuid ";
|
||||
$sql_insert .= ")";
|
||||
$sql_insert .= "values ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "'".uuid()."', ";
|
||||
$sql_insert .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql_insert .= "'".$conference_center_uuid."', ";
|
||||
$sql_insert .= "'".$user_uuid."' ";
|
||||
$sql_insert .= ")";
|
||||
$db->exec($sql_insert);
|
||||
//redirect the browser
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=conference_center_edit.php?id=$conference_center_uuid\">\n";
|
||||
echo "<div align='center'>Add Complete</div>";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$conference_center_uuid = check_str($_POST["conference_center_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($dialplan_uuid) == 0) { $msg .= "Please provide: Dialplan UUID<br>\n"; }
|
||||
if (strlen($conference_center_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
|
||||
if (strlen($conference_center_extension) == 0) { $msg .= "Please provide: Extension<br>\n"; }
|
||||
if (strlen($conference_center_pin_length) == 0) { $msg .= "Please provide: PIN Length<br>\n"; }
|
||||
//if (strlen($conference_center_order) == 0) { $msg .= "Please provide: Order<br>\n"; }
|
||||
//if (strlen($conference_center_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($conference_center_enabled) == 0) { $msg .= "Please provide: Enabled<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;
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$conference_center_uuid = check_str($_POST["conference_center_uuid"]);
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
//prepare the uuids
|
||||
$conference_center_uuid = uuid();
|
||||
$dialplan_uuid = uuid();
|
||||
//add the conference
|
||||
$sql = "insert into v_conference_centers ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "conference_center_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "conference_center_name, ";
|
||||
$sql .= "conference_center_extension, ";
|
||||
$sql .= "conference_center_pin_length, ";
|
||||
$sql .= "conference_center_greeting, ";
|
||||
$sql .= "conference_center_description, ";
|
||||
$sql .= "conference_center_enabled ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$conference_center_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$conference_center_name', ";
|
||||
$sql .= "'$conference_center_extension', ";
|
||||
$sql .= "'$conference_center_pin_length', ";
|
||||
$sql .= "'$conference_center_greeting', ";
|
||||
$sql .= "'$conference_center_description', ";
|
||||
$sql .= "'$conference_center_enabled' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//create the dialplan entry
|
||||
$dialplan_name = $conference_center_name;
|
||||
$dialplan_order ='333';
|
||||
$dialplan_context = $_SESSION['context'];
|
||||
$dialplan_enabled = 'true';
|
||||
$dialplan_description = $conference_center_description;
|
||||
$app_uuid = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9';
|
||||
dialplan_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid);
|
||||
|
||||
//<condition destination_number="500" />
|
||||
$dialplan_detail_tag = 'condition'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'destination_number';
|
||||
$dialplan_detail_data = '^'.$conference_center_extension.'$';
|
||||
$dialplan_detail_order = '010';
|
||||
$dialplan_detail_group = '2';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//<action application="lua" />
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'lua';
|
||||
$dialplan_detail_data = 'app.lua conference_center';
|
||||
$dialplan_detail_order = '020';
|
||||
$dialplan_detail_group = '2';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//save the xml
|
||||
save_dialplan_xml();
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: conference_centers.php");
|
||||
//check for all required data
|
||||
//if (strlen($dialplan_uuid) == 0) { $msg .= "Please provide: Dialplan UUID<br>\n"; }
|
||||
if (strlen($conference_center_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
|
||||
if (strlen($conference_center_extension) == 0) { $msg .= "Please provide: Extension<br>\n"; }
|
||||
if (strlen($conference_center_pin_length) == 0) { $msg .= "Please provide: PIN Length<br>\n"; }
|
||||
//if (strlen($conference_center_order) == 0) { $msg .= "Please provide: Order<br>\n"; }
|
||||
//if (strlen($conference_center_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($conference_center_enabled) == 0) { $msg .= "Please provide: Enabled<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;
|
||||
} //if ($action == "add")
|
||||
}
|
||||
|
||||
if ($action == "update") {
|
||||
//update the conference center extension
|
||||
$sql = "update v_conference_centers set ";
|
||||
$sql .= "conference_center_name = '$conference_center_name', ";
|
||||
$sql .= "conference_center_extension = '$conference_center_extension', ";
|
||||
$sql .= "conference_center_pin_length = '$conference_center_pin_length', ";
|
||||
$sql .= "conference_center_greeting = '$conference_center_greeting', ";
|
||||
$sql .= "conference_center_description = '$conference_center_description', ";
|
||||
$sql .= "conference_center_enabled = '$conference_center_enabled' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and conference_center_uuid = '$conference_center_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
//prepare the uuids
|
||||
$conference_center_uuid = uuid();
|
||||
$dialplan_uuid = uuid();
|
||||
//add the conference
|
||||
$sql = "insert into v_conference_centers ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "conference_center_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "conference_center_name, ";
|
||||
$sql .= "conference_center_extension, ";
|
||||
$sql .= "conference_center_pin_length, ";
|
||||
$sql .= "conference_center_greeting, ";
|
||||
$sql .= "conference_center_description, ";
|
||||
$sql .= "conference_center_enabled ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$conference_center_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$conference_center_name', ";
|
||||
$sql .= "'$conference_center_extension', ";
|
||||
$sql .= "'$conference_center_pin_length', ";
|
||||
$sql .= "'$conference_center_greeting', ";
|
||||
$sql .= "'$conference_center_description', ";
|
||||
$sql .= "'$conference_center_enabled' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//udpate the conference center dialplan
|
||||
$sql = "update v_dialplans set ";
|
||||
$sql .= "dialplan_name = '$conference_center_name', ";
|
||||
if (strlen($dialplan_order) > 0) {
|
||||
$sql .= "dialplan_order = '333', ";
|
||||
}
|
||||
$sql .= "dialplan_context = '".$_SESSION['context']."', ";
|
||||
$sql .= "dialplan_enabled = 'true', ";
|
||||
$sql .= "dialplan_description = '$conference_center_description' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
//create the dialplan entry
|
||||
$dialplan_name = $conference_center_name;
|
||||
$dialplan_order ='333';
|
||||
$dialplan_context = $_SESSION['context'];
|
||||
$dialplan_enabled = 'true';
|
||||
$dialplan_description = $conference_center_description;
|
||||
$app_uuid = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9';
|
||||
dialplan_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid);
|
||||
|
||||
//update dialplan detail condition
|
||||
$sql = "update v_dialplan_details set ";
|
||||
$sql .= "dialplan_detail_data = '^".$conference_center_extension."$' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_detail_tag = 'condition' ";
|
||||
$sql .= "and dialplan_detail_type = 'destination_number' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
//<condition destination_number="500" />
|
||||
$dialplan_detail_tag = 'condition'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'destination_number';
|
||||
$dialplan_detail_data = '^'.$conference_center_extension.'$';
|
||||
$dialplan_detail_order = '010';
|
||||
$dialplan_detail_group = '2';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//update dialplan detail action
|
||||
$dialplan_detail_type = 'lua';
|
||||
$dialplan_detail_data = 'app.lua conference_center';
|
||||
$sql = "update v_dialplan_details set ";
|
||||
$sql .= "dialplan_detail_type = '".$dialplan_detail_type."', ";
|
||||
$sql .= "dialplan_detail_data = '".$dialplan_detail_data."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_detail_tag = 'action' ";
|
||||
$sql .= "and dialplan_detail_type = 'lua' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
//<action application="lua" />
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'lua';
|
||||
$dialplan_detail_data = 'app.lua conference_center';
|
||||
$dialplan_detail_order = '020';
|
||||
$dialplan_detail_group = '2';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//syncrhonize configuration
|
||||
save_dialplan_xml();
|
||||
//save the xml
|
||||
save_dialplan_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["context"]);
|
||||
|
||||
//redirect the browser
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: conference_centers.php");
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
//update the conference center extension
|
||||
$sql = "update v_conference_centers set ";
|
||||
$sql .= "conference_center_name = '$conference_center_name', ";
|
||||
$sql .= "conference_center_extension = '$conference_center_extension', ";
|
||||
$sql .= "conference_center_pin_length = '$conference_center_pin_length', ";
|
||||
$sql .= "conference_center_greeting = '$conference_center_greeting', ";
|
||||
$sql .= "conference_center_description = '$conference_center_description', ";
|
||||
$sql .= "conference_center_enabled = '$conference_center_enabled' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and conference_center_uuid = '$conference_center_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//udpate the conference center dialplan
|
||||
$sql = "update v_dialplans set ";
|
||||
$sql .= "dialplan_name = '$conference_center_name', ";
|
||||
if (strlen($dialplan_order) > 0) {
|
||||
$sql .= "dialplan_order = '333', ";
|
||||
}
|
||||
$sql .= "dialplan_context = '".$_SESSION['context']."', ";
|
||||
$sql .= "dialplan_enabled = 'true', ";
|
||||
$sql .= "dialplan_description = '$conference_center_description' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//update dialplan detail condition
|
||||
$sql = "update v_dialplan_details set ";
|
||||
$sql .= "dialplan_detail_data = '^".$conference_center_extension."$' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_detail_tag = 'condition' ";
|
||||
$sql .= "and dialplan_detail_type = 'destination_number' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//update dialplan detail action
|
||||
$dialplan_detail_type = 'lua';
|
||||
$dialplan_detail_data = 'app.lua conference_center';
|
||||
$sql = "update v_dialplan_details set ";
|
||||
$sql .= "dialplan_detail_type = '".$dialplan_detail_type."', ";
|
||||
$sql .= "dialplan_detail_data = '".$dialplan_detail_data."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_detail_tag = 'action' ";
|
||||
$sql .= "and dialplan_detail_type = 'lua' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
|
||||
//syncrhonize configuration
|
||||
save_dialplan_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["context"]);
|
||||
|
||||
//redirect the browser
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: conference_centers.php");
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//function to show the list of sound files
|
||||
// moved to functions.php
|
||||
|
||||
@@ -48,9 +48,10 @@ else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$contact_uuid = check_str($_GET["contact_uuid"]);
|
||||
}
|
||||
//get the contact 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) {
|
||||
@@ -73,114 +74,125 @@ if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$address_label = ($address_label_custom != '') ? $address_label_custom : $address_label;
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$contact_address_uuid = check_str($_POST["contact_address_uuid"]);
|
||||
}
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
$contact_address_uuid = check_str($_POST["contact_address_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
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;
|
||||
}
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
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;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
//if primary, unmark other primary numbers
|
||||
if ($address_primary) {
|
||||
$sql = "update v_contact_addresses set address_primary = 0 ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
//update last modified
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "add") {
|
||||
$contact_address_uuid = uuid();
|
||||
$sql = "insert into v_contact_addresses ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_address_uuid, ";
|
||||
$sql .= "address_type, ";
|
||||
$sql .= "address_label, ";
|
||||
$sql .= "address_street, ";
|
||||
$sql .= "address_extended, ";
|
||||
$sql .= "address_community, ";
|
||||
$sql .= "address_locality, ";
|
||||
$sql .= "address_region, ";
|
||||
$sql .= "address_postal_code, ";
|
||||
$sql .= "address_country, ";
|
||||
$sql .= "address_latitude, ";
|
||||
$sql .= "address_longitude, ";
|
||||
$sql .= "address_primary, ";
|
||||
$sql .= "address_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$contact_address_uuid."', ";
|
||||
$sql .= "'".$address_type."', ";
|
||||
$sql .= "'".$address_label."', ";
|
||||
$sql .= "'".$address_street."', ";
|
||||
$sql .= "'".$address_extended."', ";
|
||||
$sql .= "'".$address_community."', ";
|
||||
$sql .= "'".$address_locality."', ";
|
||||
$sql .= "'".$address_region."', ";
|
||||
$sql .= "'".$address_postal_code."', ";
|
||||
$sql .= "'".$address_country."', ";
|
||||
$sql .= "'".$address_latitude."', ";
|
||||
$sql .= "'".$address_longitude."', ";
|
||||
$sql .= (($address_primary) ? 1 : 0).", ";
|
||||
$sql .= "'".$address_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//if primary, unmark other primary numbers
|
||||
if ($address_primary) {
|
||||
$sql = "update v_contact_addresses set address_primary = 0 ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
if ($action == "add") {
|
||||
$contact_address_uuid = uuid();
|
||||
$sql = "insert into v_contact_addresses ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_address_uuid, ";
|
||||
$sql .= "address_type, ";
|
||||
$sql .= "address_label, ";
|
||||
$sql .= "address_street, ";
|
||||
$sql .= "address_extended, ";
|
||||
$sql .= "address_community, ";
|
||||
$sql .= "address_locality, ";
|
||||
$sql .= "address_region, ";
|
||||
$sql .= "address_postal_code, ";
|
||||
$sql .= "address_country, ";
|
||||
$sql .= "address_latitude, ";
|
||||
$sql .= "address_longitude, ";
|
||||
$sql .= "address_primary, ";
|
||||
$sql .= "address_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$contact_address_uuid."', ";
|
||||
$sql .= "'".$address_type."', ";
|
||||
$sql .= "'".$address_label."', ";
|
||||
$sql .= "'".$address_street."', ";
|
||||
$sql .= "'".$address_extended."', ";
|
||||
$sql .= "'".$address_community."', ";
|
||||
$sql .= "'".$address_locality."', ";
|
||||
$sql .= "'".$address_region."', ";
|
||||
$sql .= "'".$address_postal_code."', ";
|
||||
$sql .= "'".$address_country."', ";
|
||||
$sql .= "'".$address_latitude."', ";
|
||||
$sql .= "'".$address_longitude."', ";
|
||||
$sql .= (($address_primary) ? 1 : 0).", ";
|
||||
$sql .= "'".$address_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_addresses set ";
|
||||
$sql .= "contact_uuid = '".$contact_uuid."', ";
|
||||
$sql .= "address_type = '".$address_type."', ";
|
||||
$sql .= "address_label = '".$address_label."', ";
|
||||
$sql .= "address_street = '".$address_street."', ";
|
||||
$sql .= "address_extended = '".$address_extended."', ";
|
||||
$sql .= "address_community = '".$address_community."', ";
|
||||
$sql .= "address_locality = '".$address_locality."', ";
|
||||
$sql .= "address_region = '".$address_region."', ";
|
||||
$sql .= "address_postal_code = '".$address_postal_code."', ";
|
||||
$sql .= "address_country = '".$address_country."', ";
|
||||
$sql .= "address_latitude = '".$address_latitude."', ";
|
||||
$sql .= "address_longitude = '".$address_longitude."', ";
|
||||
$sql .= "address_primary = ".(($address_primary) ? 1 : 0).", ";
|
||||
$sql .= "address_description = '".$address_description."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_address_uuid = '".$contact_address_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_addresses set ";
|
||||
$sql .= "contact_uuid = '".$contact_uuid."', ";
|
||||
$sql .= "address_type = '".$address_type."', ";
|
||||
$sql .= "address_label = '".$address_label."', ";
|
||||
$sql .= "address_street = '".$address_street."', ";
|
||||
$sql .= "address_extended = '".$address_extended."', ";
|
||||
$sql .= "address_community = '".$address_community."', ";
|
||||
$sql .= "address_locality = '".$address_locality."', ";
|
||||
$sql .= "address_region = '".$address_region."', ";
|
||||
$sql .= "address_postal_code = '".$address_postal_code."', ";
|
||||
$sql .= "address_country = '".$address_country."', ";
|
||||
$sql .= "address_latitude = '".$address_latitude."', ";
|
||||
$sql .= "address_longitude = '".$address_longitude."', ";
|
||||
$sql .= "address_primary = ".(($address_primary) ? 1 : 0).", ";
|
||||
$sql .= "address_description = '".$address_description."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_address_uuid = '".$contact_address_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
|
||||
@@ -79,171 +79,182 @@ else {
|
||||
$contact_note = check_str($_POST["contact_note"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$contact_uuid = check_str($_POST["contact_uuid"]);
|
||||
}
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
$contact_uuid = check_str($_POST["contact_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($contact_type) == 0) { $msg .= $text['message-required'].$text['label-contact_type']."<br>\n"; }
|
||||
//if (strlen($contact_organization) == 0) { $msg .= $text['message-required'].$text['label-contact_organization']."<br>\n"; }
|
||||
//if (strlen($contact_name_prefix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_prefix']."<br>\n"; }
|
||||
//if (strlen($contact_name_given) == 0) { $msg .= $text['message-required'].$text['label-contact_name_given']."<br>\n"; }
|
||||
//if (strlen($contact_name_middle) == 0) { $msg .= $text['message-required'].$text['label-contact_name_middle']."<br>\n"; }
|
||||
//if (strlen($contact_name_family) == 0) { $msg .= $text['message-required'].$text['label-contact_name_family']."<br>\n"; }
|
||||
//if (strlen($contact_name_suffix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_suffix']."<br>\n"; }
|
||||
//if (strlen($contact_nickname) == 0) { $msg .= $text['message-required'].$text['label-contact_nickname']."<br>\n"; }
|
||||
//if (strlen($contact_title) == 0) { $msg .= $text['message-required'].$text['label-contact_title']."<br>\n"; }
|
||||
//if (strlen($contact_role) == 0) { $msg .= $text['message-required'].$text['label-contact_role']."<br>\n"; }
|
||||
//if (strlen($contact_time_zone) == 0) { $msg .= $text['message-required'].$text['label-contact_time_zone']."<br>\n"; }
|
||||
//if (strlen($contact_note) == 0) { $msg .= $text['message-required'].$text['label-contact_note']."<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;
|
||||
}
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
//if (strlen($contact_type) == 0) { $msg .= $text['message-required'].$text['label-contact_type']."<br>\n"; }
|
||||
//if (strlen($contact_organization) == 0) { $msg .= $text['message-required'].$text['label-contact_organization']."<br>\n"; }
|
||||
//if (strlen($contact_name_prefix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_prefix']."<br>\n"; }
|
||||
//if (strlen($contact_name_given) == 0) { $msg .= $text['message-required'].$text['label-contact_name_given']."<br>\n"; }
|
||||
//if (strlen($contact_name_middle) == 0) { $msg .= $text['message-required'].$text['label-contact_name_middle']."<br>\n"; }
|
||||
//if (strlen($contact_name_family) == 0) { $msg .= $text['message-required'].$text['label-contact_name_family']."<br>\n"; }
|
||||
//if (strlen($contact_name_suffix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_suffix']."<br>\n"; }
|
||||
//if (strlen($contact_nickname) == 0) { $msg .= $text['message-required'].$text['label-contact_nickname']."<br>\n"; }
|
||||
//if (strlen($contact_title) == 0) { $msg .= $text['message-required'].$text['label-contact_title']."<br>\n"; }
|
||||
//if (strlen($contact_role) == 0) { $msg .= $text['message-required'].$text['label-contact_role']."<br>\n"; }
|
||||
//if (strlen($contact_time_zone) == 0) { $msg .= $text['message-required'].$text['label-contact_time_zone']."<br>\n"; }
|
||||
//if (strlen($contact_note) == 0) { $msg .= $text['message-required'].$text['label-contact_note']."<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;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
if ($action == "add") {
|
||||
$contact_uuid = uuid();
|
||||
$sql = "insert into v_contacts ";
|
||||
$sql .= "( ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_type, ";
|
||||
$sql .= "contact_organization, ";
|
||||
$sql .= "contact_name_prefix, ";
|
||||
$sql .= "contact_name_given, ";
|
||||
$sql .= "contact_name_middle, ";
|
||||
$sql .= "contact_name_family, ";
|
||||
$sql .= "contact_name_suffix, ";
|
||||
$sql .= "contact_nickname, ";
|
||||
$sql .= "contact_title, ";
|
||||
$sql .= "contact_category, ";
|
||||
$sql .= "contact_role, ";
|
||||
$sql .= "contact_time_zone, ";
|
||||
$sql .= "contact_note, ";
|
||||
$sql .= "last_mod_date, ";
|
||||
$sql .= "last_mod_user ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$contact_type."', ";
|
||||
$sql .= "'".$contact_organization."', ";
|
||||
$sql .= "'".$contact_name_prefix."', ";
|
||||
$sql .= "'".$contact_name_given."', ";
|
||||
$sql .= "'".$contact_name_middle."', ";
|
||||
$sql .= "'".$contact_name_family."', ";
|
||||
$sql .= "'".$contact_name_suffix."', ";
|
||||
$sql .= "'".$contact_nickname."', ";
|
||||
$sql .= "'".$contact_title."', ";
|
||||
$sql .= "'".$contact_category."', ";
|
||||
$sql .= "'".$contact_role."', ";
|
||||
$sql .= "'".$contact_time_zone."', ";
|
||||
$sql .= "'".$contact_note."', ";
|
||||
$sql .= "now(), ";
|
||||
$sql .= "'".$_SESSION['username']."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//update last modified
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
$location = "contact_edit.php?id=".$contact_uuid;
|
||||
} //if ($action == "add")
|
||||
if ($action == "add") {
|
||||
$contact_uuid = uuid();
|
||||
$sql = "insert into v_contacts ";
|
||||
$sql .= "( ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_type, ";
|
||||
$sql .= "contact_organization, ";
|
||||
$sql .= "contact_name_prefix, ";
|
||||
$sql .= "contact_name_given, ";
|
||||
$sql .= "contact_name_middle, ";
|
||||
$sql .= "contact_name_family, ";
|
||||
$sql .= "contact_name_suffix, ";
|
||||
$sql .= "contact_nickname, ";
|
||||
$sql .= "contact_title, ";
|
||||
$sql .= "contact_category, ";
|
||||
$sql .= "contact_role, ";
|
||||
$sql .= "contact_time_zone, ";
|
||||
$sql .= "contact_note, ";
|
||||
$sql .= "last_mod_date, ";
|
||||
$sql .= "last_mod_user ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$contact_type."', ";
|
||||
$sql .= "'".$contact_organization."', ";
|
||||
$sql .= "'".$contact_name_prefix."', ";
|
||||
$sql .= "'".$contact_name_given."', ";
|
||||
$sql .= "'".$contact_name_middle."', ";
|
||||
$sql .= "'".$contact_name_family."', ";
|
||||
$sql .= "'".$contact_name_suffix."', ";
|
||||
$sql .= "'".$contact_nickname."', ";
|
||||
$sql .= "'".$contact_title."', ";
|
||||
$sql .= "'".$contact_category."', ";
|
||||
$sql .= "'".$contact_role."', ";
|
||||
$sql .= "'".$contact_time_zone."', ";
|
||||
$sql .= "'".$contact_note."', ";
|
||||
$sql .= "now(), ";
|
||||
$sql .= "'".$_SESSION['username']."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//if contact is shared, remove contact group record containing user's uuid
|
||||
if ($_POST['contact_shared'] == 'true') {
|
||||
$sql = "delete from v_contact_groups ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$sql .= "and group_uuid = '".$_SESSION["user_uuid"]."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($prep_statement, $sql);
|
||||
$group_uuid = $_POST['group_uuid'];
|
||||
}
|
||||
//if private contact, delete any groups currently assigned, set group uuid to user's uuid
|
||||
else {
|
||||
$sql = "delete from v_contact_groups ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($prep_statement, $sql);
|
||||
$group_uuid = $_SESSION["user_uuid"];
|
||||
}
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
$location = "contact_edit.php?id=".$contact_uuid;
|
||||
} //if ($action == "add")
|
||||
|
||||
//handle insertion of contact group (or private contact, if not shared)
|
||||
if ($group_uuid != '') {
|
||||
$sql = "insert into v_contact_groups ";
|
||||
$sql .= "( ";
|
||||
$sql .= "contact_group_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "group_uuid ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$group_uuid."' ";
|
||||
$sql .= ") ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
//if contact is shared, remove contact group record containing user's uuid
|
||||
if ($_POST['contact_shared'] == 'true') {
|
||||
$sql = "delete from v_contact_groups ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$sql .= "and group_uuid = '".$_SESSION["user_uuid"]."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($prep_statement, $sql);
|
||||
$group_uuid = $_POST['group_uuid'];
|
||||
}
|
||||
//if private contact, delete any groups currently assigned, set group uuid to user's uuid
|
||||
else {
|
||||
$sql = "delete from v_contact_groups ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($prep_statement, $sql);
|
||||
$group_uuid = $_SESSION["user_uuid"];
|
||||
}
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "contact_type = '".$contact_type."', ";
|
||||
$sql .= "contact_organization = '".$contact_organization."', ";
|
||||
$sql .= "contact_name_prefix = '".$contact_name_prefix."', ";
|
||||
$sql .= "contact_name_given = '".$contact_name_given."', ";
|
||||
$sql .= "contact_name_middle = '".$contact_name_middle."', ";
|
||||
$sql .= "contact_name_family = '".$contact_name_family."', ";
|
||||
$sql .= "contact_name_suffix = '".$contact_name_suffix."', ";
|
||||
$sql .= "contact_nickname = '".$contact_nickname."', ";
|
||||
$sql .= "contact_title = '".$contact_title."', ";
|
||||
$sql .= "contact_category = '".$contact_category."', ";
|
||||
$sql .= "contact_role = '".$contact_role."', ";
|
||||
$sql .= "contact_time_zone = '".$contact_time_zone."', ";
|
||||
$sql .= "contact_note = '".$contact_note."', ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//handle insertion of contact group (or private contact, if not shared)
|
||||
if ($group_uuid != '') {
|
||||
$sql = "insert into v_contact_groups ";
|
||||
$sql .= "( ";
|
||||
$sql .= "contact_group_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "group_uuid ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$group_uuid."' ";
|
||||
$sql .= ") ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
$location = "contact_edit.php?id=".$contact_uuid;
|
||||
} //if ($action == "update")
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "contact_type = '".$contact_type."', ";
|
||||
$sql .= "contact_organization = '".$contact_organization."', ";
|
||||
$sql .= "contact_name_prefix = '".$contact_name_prefix."', ";
|
||||
$sql .= "contact_name_given = '".$contact_name_given."', ";
|
||||
$sql .= "contact_name_middle = '".$contact_name_middle."', ";
|
||||
$sql .= "contact_name_family = '".$contact_name_family."', ";
|
||||
$sql .= "contact_name_suffix = '".$contact_name_suffix."', ";
|
||||
$sql .= "contact_nickname = '".$contact_nickname."', ";
|
||||
$sql .= "contact_title = '".$contact_title."', ";
|
||||
$sql .= "contact_category = '".$contact_category."', ";
|
||||
$sql .= "contact_role = '".$contact_role."', ";
|
||||
$sql .= "contact_time_zone = '".$contact_time_zone."', ";
|
||||
$sql .= "contact_note = '".$contact_note."', ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//handle redirect
|
||||
if ($_POST['submit'] == $text['button-add']) {
|
||||
$group_uuid = $_POST['group_uuid'];
|
||||
//insert
|
||||
$location = "contact_edit.php?id=".$contact_uuid;
|
||||
}
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
$location = "contact_edit.php?id=".$contact_uuid;
|
||||
} //if ($action == "update")
|
||||
|
||||
header("Location: ".$location);
|
||||
return;
|
||||
//handle redirect
|
||||
if ($_POST['submit'] == $text['button-add']) {
|
||||
$group_uuid = $_POST['group_uuid'];
|
||||
//insert
|
||||
$location = "contact_edit.php?id=".$contact_uuid;
|
||||
}
|
||||
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
header("Location: ".$location);
|
||||
return;
|
||||
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
||||
|
||||
@@ -64,87 +64,98 @@ if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$email_label = ($email_label_custom != '') ? $email_label_custom : $email_label;
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$contact_email_uuid = check_str($_POST["contact_email_uuid"]);
|
||||
}
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
$contact_email_uuid = check_str($_POST["contact_email_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
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;
|
||||
}
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
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;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
//if primary, unmark other primary numbers
|
||||
if ($email_primary) {
|
||||
$sql = "update v_contact_emails set email_primary = 0 ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
//update last modified
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "add") {
|
||||
$contact_email_uuid = uuid();
|
||||
$sql = "insert into v_contact_emails ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_email_uuid, ";
|
||||
$sql .= "email_label, ";
|
||||
$sql .= "email_address, ";
|
||||
$sql .= "email_primary, ";
|
||||
$sql .= "email_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$contact_email_uuid."', ";
|
||||
$sql .= "'".$email_label."', ";
|
||||
$sql .= "'".$email_address."', ";
|
||||
$sql .= (($email_primary) ? 1 : 0).", ";
|
||||
$sql .= "'".$email_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//if primary, unmark other primary numbers
|
||||
if ($email_primary) {
|
||||
$sql = "update v_contact_emails set email_primary = 0 ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
if ($action == "add") {
|
||||
$contact_email_uuid = uuid();
|
||||
$sql = "insert into v_contact_emails ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_email_uuid, ";
|
||||
$sql .= "email_label, ";
|
||||
$sql .= "email_address, ";
|
||||
$sql .= "email_primary, ";
|
||||
$sql .= "email_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$contact_email_uuid."', ";
|
||||
$sql .= "'".$email_label."', ";
|
||||
$sql .= "'".$email_address."', ";
|
||||
$sql .= (($email_primary) ? 1 : 0).", ";
|
||||
$sql .= "'".$email_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_emails set ";
|
||||
$sql .= "contact_uuid = '".$contact_uuid."', ";
|
||||
$sql .= "email_label = '".$email_label."', ";
|
||||
$sql .= "email_address = '".$email_address."', ";
|
||||
$sql .= "email_primary = ".(($email_primary) ? 1 : 0).", ";
|
||||
$sql .= "email_description = '".$email_description."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_email_uuid = '".$contact_email_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_emails set ";
|
||||
$sql .= "contact_uuid = '".$contact_uuid."', ";
|
||||
$sql .= "email_label = '".$email_label."', ";
|
||||
$sql .= "email_address = '".$email_address."', ";
|
||||
$sql .= "email_primary = ".(($email_primary) ? 1 : 0).", ";
|
||||
$sql .= "email_description = '".$email_description."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_email_uuid = '".$contact_email_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
|
||||
@@ -82,7 +82,7 @@ else {
|
||||
echo "<th>".$text['label-description']."</th>\n";
|
||||
echo "<td class='list_control_icons'>";
|
||||
if (permission_exists('extension_add')) {
|
||||
echo "<a href='/app/extensions/extension_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
|
||||
echo "<a href='".PROJECT_PATH."/app/extensions/extension_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
@@ -92,7 +92,7 @@ else {
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
if (permission_exists('extension_edit')) {
|
||||
echo "<a href='/app/extensions/extension_edit.php?id=".$row['extension_uuid']."'>".$row['extension']."</a>";
|
||||
echo "<a href='".PROJECT_PATH."/app/extensions/extension_edit.php?id=".$row['extension_uuid']."'>".$row['extension']."</a>";
|
||||
}
|
||||
else {
|
||||
echo $row['extension'];
|
||||
@@ -102,10 +102,10 @@ else {
|
||||
echo " <td valign='top' class='row_stylebg'>".$row['description']." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('extension_edit')) {
|
||||
echo "<a href='/app/extensions/extension_edit.php?id=".$row['extension_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
echo "<a href='".PROJECT_PATH."/app/extensions/extension_edit.php?id=".$row['extension_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
}
|
||||
if (permission_exists('extension_delete')) {
|
||||
echo "<a href='/app/extensions/extension_delete.php?id=".$row['extension_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
echo "<a href='".PROJECT_PATH."/app/extensions/extension_delete.php?id=".$row['extension_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
@@ -116,4 +116,4 @@ else {
|
||||
|
||||
echo "</table>";
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -299,7 +299,7 @@ else {
|
||||
$sql .= (($row['phone_type_text']) ? 1 : 0).", ";
|
||||
$sql .= "'".$row['phone_label']."', ";
|
||||
$sql .= "'".$row['phone_number']."', ";
|
||||
$sql .= "'".$row['phone_description']."', ";
|
||||
$sql .= "'".$row['phone_description']."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
@@ -59,75 +59,87 @@ else {
|
||||
$last_mod_user = check_str($_POST["last_mod_user"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//get the primary id for the contact note
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$contact_note_uuid = check_str($_POST["contact_note_uuid"]);
|
||||
}
|
||||
//get the primary id for the contact note
|
||||
if ($action == "update") {
|
||||
$contact_note_uuid = check_str($_POST["contact_note_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
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;
|
||||
}
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
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;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
$contact_note_uuid = uuid();
|
||||
$sql = "insert into v_contact_notes ";
|
||||
$sql .= "(";
|
||||
$sql .= "contact_note_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_note, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "last_mod_date, ";
|
||||
$sql .= "last_mod_user ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$contact_note_uuid', ";
|
||||
$sql .= "'$contact_uuid', ";
|
||||
$sql .= "'$contact_note', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "now(), ";
|
||||
$sql .= "'".$_SESSION['username']."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
//update last modified
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
//add the note
|
||||
if ($action == "add") {
|
||||
$contact_note_uuid = uuid();
|
||||
$sql = "insert into v_contact_notes ";
|
||||
$sql .= "(";
|
||||
$sql .= "contact_note_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_note, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "last_mod_date, ";
|
||||
$sql .= "last_mod_user ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$contact_note_uuid', ";
|
||||
$sql .= "'$contact_uuid', ";
|
||||
$sql .= "'$contact_note', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "now(), ";
|
||||
$sql .= "'".$_SESSION['username']."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_notes set ";
|
||||
$sql .= "contact_uuid = '$contact_uuid', ";
|
||||
$sql .= "contact_note = '$contact_note', ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and contact_note_uuid = '$contact_note_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
//update the note
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_notes set ";
|
||||
$sql .= "contact_uuid = '$contact_uuid', ";
|
||||
$sql .= "contact_note = '$contact_note', ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and contact_note_uuid = '$contact_note_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
|
||||
@@ -72,102 +72,113 @@ if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$phone_label = ($phone_label_custom != '') ? $phone_label_custom : $phone_label;
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$contact_phone_uuid = check_str($_POST["contact_phone_uuid"]);
|
||||
}
|
||||
//set thge uuid
|
||||
if ($action == "update") {
|
||||
$contact_phone_uuid = check_str($_POST["contact_phone_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
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;
|
||||
}
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
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;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
//if primary, unmark other primary numbers
|
||||
if ($phone_primary) {
|
||||
$sql = "update v_contact_phones set phone_primary = 0 ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
//update last modified
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "add") {
|
||||
$contact_phone_uuid = uuid();
|
||||
$sql = "insert into v_contact_phones ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_phone_uuid, ";
|
||||
$sql .= "phone_type_voice, ";
|
||||
$sql .= "phone_type_fax, ";
|
||||
$sql .= "phone_type_video, ";
|
||||
$sql .= "phone_type_text, ";
|
||||
$sql .= "phone_label, ";
|
||||
$sql .= "phone_number, ";
|
||||
$sql .= "phone_extension, ";
|
||||
$sql .= "phone_primary, ";
|
||||
$sql .= "phone_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$contact_phone_uuid."', ";
|
||||
$sql .= (($phone_type_voice) ? 1 : 'null').", ";
|
||||
$sql .= (($phone_type_fax) ? 1 : 'null').", ";
|
||||
$sql .= (($phone_type_video) ? 1 : 'null').", ";
|
||||
$sql .= (($phone_type_text) ? 1 : 'null').", ";
|
||||
$sql .= "'".$phone_label."', ";
|
||||
$sql .= "'".$phone_number."', ";
|
||||
$sql .= "'".$phone_extension."', ";
|
||||
$sql .= (($phone_primary) ? 1 : 0).", ";
|
||||
$sql .= "'".$phone_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//if primary, unmark other primary numbers
|
||||
if ($phone_primary) {
|
||||
$sql = "update v_contact_phones set phone_primary = 0 ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
if ($action == "add") {
|
||||
$contact_phone_uuid = uuid();
|
||||
$sql = "insert into v_contact_phones ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_phone_uuid, ";
|
||||
$sql .= "phone_type_voice, ";
|
||||
$sql .= "phone_type_fax, ";
|
||||
$sql .= "phone_type_video, ";
|
||||
$sql .= "phone_type_text, ";
|
||||
$sql .= "phone_label, ";
|
||||
$sql .= "phone_number, ";
|
||||
$sql .= "phone_extension, ";
|
||||
$sql .= "phone_primary, ";
|
||||
$sql .= "phone_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$contact_phone_uuid."', ";
|
||||
$sql .= (($phone_type_voice) ? 1 : 'null').", ";
|
||||
$sql .= (($phone_type_fax) ? 1 : 'null').", ";
|
||||
$sql .= (($phone_type_video) ? 1 : 'null').", ";
|
||||
$sql .= (($phone_type_text) ? 1 : 'null').", ";
|
||||
$sql .= "'".$phone_label."', ";
|
||||
$sql .= "'".$phone_number."', ";
|
||||
$sql .= "'".$phone_extension."', ";
|
||||
$sql .= (($phone_primary) ? 1 : 0).", ";
|
||||
$sql .= "'".$phone_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_phones set ";
|
||||
$sql .= "contact_uuid = '$contact_uuid', ";
|
||||
$sql .= "phone_type_voice = ".(($phone_type_voice) ? 1 : 'null').", ";
|
||||
$sql .= "phone_type_fax = ".(($phone_type_fax) ? 1 : 'null').", ";
|
||||
$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_number = '".$phone_number."', ";
|
||||
$sql .= "phone_extension = '".$phone_extension."', ";
|
||||
$sql .= "phone_primary = ".(($phone_primary) ? 1 : 0).", ";
|
||||
$sql .= "phone_description = '".$phone_description."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_phone_uuid = '".$contact_phone_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_phones set ";
|
||||
$sql .= "contact_uuid = '$contact_uuid', ";
|
||||
$sql .= "phone_type_voice = ".(($phone_type_voice) ? 1 : 'null').", ";
|
||||
$sql .= "phone_type_fax = ".(($phone_type_fax) ? 1 : 'null').", ";
|
||||
$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_number = '".$phone_number."', ";
|
||||
$sql .= "phone_extension = '".$phone_extension."', ";
|
||||
$sql .= "phone_primary = ".(($phone_primary) ? 1 : 0).", ";
|
||||
$sql .= "phone_description = '".$phone_description."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_phone_uuid = '".$contact_phone_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
|
||||
@@ -48,9 +48,10 @@ else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$contact_uuid = check_str($_GET["contact_uuid"]);
|
||||
}
|
||||
//get the contact 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) {
|
||||
@@ -66,93 +67,104 @@ if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$relation_reciprocal_label = ($relation_reciprocal_label_custom != '') ? $relation_reciprocal_label_custom : $relation_reciprocal_label;
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$contact_relation_uuid = check_str($_POST["contact_relation_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
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;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
if ($action == "add") {
|
||||
$contact_relation_uuid = uuid();
|
||||
$sql = "insert into v_contact_relations ";
|
||||
$sql .= "(";
|
||||
$sql .= "contact_relation_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "relation_label, ";
|
||||
$sql .= "relation_contact_uuid ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$contact_relation_uuid."', ";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$relation_label."', ";
|
||||
$sql .= "'".$relation_contact_uuid."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($relation_reciprocal) {
|
||||
$contact_relation_uuid = uuid();
|
||||
$sql = "insert into v_contact_relations ";
|
||||
$sql .= "(";
|
||||
$sql .= "contact_relation_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "relation_label, ";
|
||||
$sql .= "relation_contact_uuid ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$contact_relation_uuid."', ";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$relation_contact_uuid."', ";
|
||||
$sql .= "'".$relation_reciprocal_label."', ";
|
||||
$sql .= "'".$contact_uuid."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
$contact_relation_uuid = check_str($_POST["contact_relation_uuid"]);
|
||||
}
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
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;
|
||||
}
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_relations set ";
|
||||
$sql .= "relation_label = '".$relation_label."', ";
|
||||
$sql .= "relation_contact_uuid = '".$relation_contact_uuid."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_relation_uuid = '".$contact_relation_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
//update last modified
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "add") {
|
||||
$contact_relation_uuid = uuid();
|
||||
$sql = "insert into v_contact_relations ";
|
||||
$sql .= "(";
|
||||
$sql .= "contact_relation_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "relation_label, ";
|
||||
$sql .= "relation_contact_uuid ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$contact_relation_uuid."', ";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$relation_label."', ";
|
||||
$sql .= "'".$relation_contact_uuid."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($relation_reciprocal) {
|
||||
$contact_relation_uuid = uuid();
|
||||
$sql = "insert into v_contact_relations ";
|
||||
$sql .= "(";
|
||||
$sql .= "contact_relation_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "relation_label, ";
|
||||
$sql .= "relation_contact_uuid ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$contact_relation_uuid."', ";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$relation_contact_uuid."', ";
|
||||
$sql .= "'".$relation_reciprocal_label."', ";
|
||||
$sql .= "'".$contact_uuid."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_relations set ";
|
||||
$sql .= "relation_label = '".$relation_label."', ";
|
||||
$sql .= "relation_contact_uuid = '".$relation_contact_uuid."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_relation_uuid = '".$contact_relation_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
||||
|
||||
@@ -48,10 +48,13 @@ else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$contact_uuid = check_str($_GET["contact_uuid"]);
|
||||
}
|
||||
$domain_uuid = $_SESSION['domain_uuid'];
|
||||
//get the contact uuid
|
||||
if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$contact_uuid = check_str($_GET["contact_uuid"]);
|
||||
}
|
||||
|
||||
//set the session domain uuid as a variable
|
||||
$domain_uuid = $_SESSION['domain_uuid'];
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
@@ -64,97 +67,110 @@ $domain_uuid = $_SESSION['domain_uuid'];
|
||||
$contact_setting_description = check_str($_POST["contact_setting_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$contact_setting_uuid = check_str($_POST["contact_setting_uuid"]);
|
||||
}
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
$contact_setting_uuid = check_str($_POST["contact_setting_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
|
||||
//if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
|
||||
//if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
|
||||
//if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
|
||||
//if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
|
||||
//if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
|
||||
//if (strlen($domain_setting_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;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
$contact_setting_order = ($contact_setting_order != '') ? $contact_setting_order : 'null';
|
||||
|
||||
//add the domain
|
||||
if ($action == "add" && permission_exists('domain_setting_add')) {
|
||||
$sql = "insert into v_contact_settings ";
|
||||
$sql .= "(";
|
||||
$sql .= "contact_setting_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_setting_category, ";
|
||||
$sql .= "contact_setting_subcategory, ";
|
||||
$sql .= "contact_setting_name, ";
|
||||
$sql .= "contact_setting_value, ";
|
||||
$sql .= "contact_setting_order, ";
|
||||
$sql .= "contact_setting_enabled, ";
|
||||
$sql .= "contact_setting_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$contact_uuid', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$contact_setting_category', ";
|
||||
$sql .= "'$contact_setting_subcategory', ";
|
||||
$sql .= "'$contact_setting_name', ";
|
||||
$sql .= "'$contact_setting_value', ";
|
||||
$sql .= "$contact_setting_order, ";
|
||||
$sql .= "'$contact_setting_enabled', ";
|
||||
$sql .= "'$contact_setting_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
} //if ($action == "add")
|
||||
|
||||
//update the domain
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_settings set ";
|
||||
$sql .= "contact_setting_category = '$contact_setting_category', ";
|
||||
$sql .= "contact_setting_subcategory = '$contact_setting_subcategory', ";
|
||||
$sql .= "contact_setting_name = '$contact_setting_name', ";
|
||||
$sql .= "contact_setting_value = '$contact_setting_value', ";
|
||||
$sql .= "contact_setting_order = $contact_setting_order, ";
|
||||
$sql .= "contact_setting_enabled = '$contact_setting_enabled', ";
|
||||
$sql .= "contact_setting_description = '$contact_setting_description' ";
|
||||
$sql .= "where contact_uuid = '$contact_uuid' ";
|
||||
$sql .= "and contact_setting_uuid = '$contact_setting_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
} //if ($action == "update")
|
||||
|
||||
//redirect the browser
|
||||
if ($action == "update") {
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
}
|
||||
if ($action == "add") {
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
}
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
//if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
|
||||
//if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
|
||||
//if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
|
||||
//if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
|
||||
//if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
|
||||
//if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
|
||||
//if (strlen($domain_setting_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;
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
//set the order
|
||||
$contact_setting_order = ($contact_setting_order != '') ? $contact_setting_order : 'null';
|
||||
|
||||
//update last modified
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add the domain
|
||||
if ($action == "add" && permission_exists('domain_setting_add')) {
|
||||
$sql = "insert into v_contact_settings ";
|
||||
$sql .= "(";
|
||||
$sql .= "contact_setting_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_setting_category, ";
|
||||
$sql .= "contact_setting_subcategory, ";
|
||||
$sql .= "contact_setting_name, ";
|
||||
$sql .= "contact_setting_value, ";
|
||||
$sql .= "contact_setting_order, ";
|
||||
$sql .= "contact_setting_enabled, ";
|
||||
$sql .= "contact_setting_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$contact_uuid', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$contact_setting_category', ";
|
||||
$sql .= "'$contact_setting_subcategory', ";
|
||||
$sql .= "'$contact_setting_name', ";
|
||||
$sql .= "'$contact_setting_value', ";
|
||||
$sql .= "$contact_setting_order, ";
|
||||
$sql .= "'$contact_setting_enabled', ";
|
||||
$sql .= "'$contact_setting_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
} //if ($action == "add")
|
||||
|
||||
//update the domain
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_settings set ";
|
||||
$sql .= "contact_setting_category = '$contact_setting_category', ";
|
||||
$sql .= "contact_setting_subcategory = '$contact_setting_subcategory', ";
|
||||
$sql .= "contact_setting_name = '$contact_setting_name', ";
|
||||
$sql .= "contact_setting_value = '$contact_setting_value', ";
|
||||
$sql .= "contact_setting_order = $contact_setting_order, ";
|
||||
$sql .= "contact_setting_enabled = '$contact_setting_enabled', ";
|
||||
$sql .= "contact_setting_description = '$contact_setting_description' ";
|
||||
$sql .= "where contact_uuid = '$contact_uuid' ";
|
||||
$sql .= "and contact_setting_uuid = '$contact_setting_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
} //if ($action == "update")
|
||||
|
||||
//redirect the browser
|
||||
if ($action == "update") {
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
}
|
||||
if ($action == "add") {
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
}
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
|
||||
@@ -47,9 +47,10 @@ else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$contact_uuid = check_str($_GET["contact_uuid"]);
|
||||
}
|
||||
//get the contact 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) {
|
||||
@@ -58,81 +59,91 @@ if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$time_description = check_str($_POST["time_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$contact_time_uuid = check_str($_POST["contact_time_uuid"]);
|
||||
}
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
$contact_time_uuid = check_str($_POST["contact_time_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
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;
|
||||
}
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
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;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
//update last modified
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "add") {
|
||||
$contact_time_uuid = uuid();
|
||||
$sql = "insert into v_contact_times ";
|
||||
$sql .= "( ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_time_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "user_uuid, ";
|
||||
$sql .= "time_start, ";
|
||||
$sql .= "time_stop, ";
|
||||
$sql .= "time_description ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$contact_time_uuid."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$_SESSION["user"]["user_uuid"]."', ";
|
||||
$sql .= "'".$time_start."', ";
|
||||
$sql .= "'".$time_stop."', ";
|
||||
$sql .= "'".$time_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
if ($action == "add") {
|
||||
$contact_time_uuid = uuid();
|
||||
$sql = "insert into v_contact_times ";
|
||||
$sql .= "( ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_time_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "user_uuid, ";
|
||||
$sql .= "time_start, ";
|
||||
$sql .= "time_stop, ";
|
||||
$sql .= "time_description ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$contact_time_uuid."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$_SESSION["user"]["user_uuid"]."', ";
|
||||
$sql .= "'".$time_start."', ";
|
||||
$sql .= "'".$time_stop."', ";
|
||||
$sql .= "'".$time_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_times ";
|
||||
$sql .= "set ";
|
||||
$sql .= "time_start = '".$time_start."', ";
|
||||
$sql .= "time_stop = '".$time_stop."', ";
|
||||
$sql .= "time_description = '".$time_description."' ";
|
||||
$sql .= "where ";
|
||||
$sql .= "contact_time_uuid = '".$contact_time_uuid."' ";
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$sql .= "and user_uuid = '".$_SESSION["user"]["user_uuid"]."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_times ";
|
||||
$sql .= "set ";
|
||||
$sql .= "time_start = '".$time_start."', ";
|
||||
$sql .= "time_stop = '".$time_stop."', ";
|
||||
$sql .= "time_description = '".$time_description."' ";
|
||||
$sql .= "where ";
|
||||
$sql .= "contact_time_uuid = '".$contact_time_uuid."' ";
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$sql .= "and user_uuid = '".$_SESSION["user"]["user_uuid"]."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
|
||||
@@ -48,12 +48,13 @@ else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$contact_uuid = check_str($_GET["contact_uuid"]);
|
||||
}
|
||||
//get the contact 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) {
|
||||
if (count($_POST) > 0) {
|
||||
$url_label = check_str($_POST["url_label"]);
|
||||
$url_label_custom = check_str($_POST["url_label_custom"]);
|
||||
$url_address = check_str($_POST["url_address"]);
|
||||
@@ -64,87 +65,98 @@ if (strlen($_GET["contact_uuid"]) > 0) {
|
||||
$url_label = ($url_label_custom != '') ? $url_label_custom : $url_label;
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the form data
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$contact_url_uuid = check_str($_POST["contact_url_uuid"]);
|
||||
}
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
$contact_url_uuid = check_str($_POST["contact_url_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
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;
|
||||
}
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
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;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
//if primary, unmark other primary numbers
|
||||
if ($url_primary) {
|
||||
$sql = "update v_contact_urls set url_primary = 0 ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
//update last modified
|
||||
$sql = "update v_contacts set ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "add") {
|
||||
$contact_url_uuid = uuid();
|
||||
$sql = "insert into v_contact_urls ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_url_uuid, ";
|
||||
$sql .= "url_label, ";
|
||||
$sql .= "url_address, ";
|
||||
$sql .= "url_primary, ";
|
||||
$sql .= "url_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$contact_url_uuid."', ";
|
||||
$sql .= "'".$url_label."', ";
|
||||
$sql .= "'".$url_address."', ";
|
||||
$sql .= (($url_primary) ? 1 : 0).", ";
|
||||
$sql .= "'".$url_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//if primary, unmark other primary numbers
|
||||
if ($url_primary) {
|
||||
$sql = "update v_contact_urls set url_primary = 0 ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and contact_uuid = '".$contact_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
if ($action == "add") {
|
||||
$contact_url_uuid = uuid();
|
||||
$sql = "insert into v_contact_urls ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_url_uuid, ";
|
||||
$sql .= "url_label, ";
|
||||
$sql .= "url_address, ";
|
||||
$sql .= "url_primary, ";
|
||||
$sql .= "url_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".$contact_uuid."', ";
|
||||
$sql .= "'".$contact_url_uuid."', ";
|
||||
$sql .= "'".$url_label."', ";
|
||||
$sql .= "'".$url_address."', ";
|
||||
$sql .= (($url_primary) ? 1 : 0).", ";
|
||||
$sql .= "'".$url_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_urls set ";
|
||||
$sql .= "contact_uuid = '".$contact_uuid."', ";
|
||||
$sql .= "url_label = '".$url_label."', ";
|
||||
$sql .= "url_address = '".$url_address."', ";
|
||||
$sql .= "url_primary = ".(($url_primary) ? 1 : 0).", ";
|
||||
$sql .= "url_description = '".$url_description."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_url_uuid = '".$contact_url_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_urls set ";
|
||||
$sql .= "contact_uuid = '".$contact_uuid."', ";
|
||||
$sql .= "url_label = '".$url_label."', ";
|
||||
$sql .= "url_address = '".$url_address."', ";
|
||||
$sql .= "url_primary = ".(($url_primary) ? 1 : 0).", ";
|
||||
$sql .= "url_description = '".$url_description."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and contact_url_uuid = '".$contact_url_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2013
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -55,7 +55,8 @@ else {
|
||||
foreach ($_SESSION['groups'] as $group_data) {
|
||||
$user_group_uuids[] = $group_data['group_uuid'];
|
||||
}
|
||||
//add user's uuid to group uuid list to include private (non-shared) contacts
|
||||
|
||||
//add user's uuid to group uuid list to include private (non-shared) contacts
|
||||
$user_group_uuids[] = $_SESSION["user_uuid"];
|
||||
|
||||
//get contact sync sources
|
||||
@@ -177,7 +178,10 @@ else {
|
||||
$sql .= "order by ".$order_by." ".$order." ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by contact_organization desc, contact_name_given asc, contact_name_family asc ";
|
||||
$sql .= "order by last_mod_date desc ";
|
||||
if ($db_type == "pgsql") {
|
||||
$sql .= "nulls last ";
|
||||
}
|
||||
}
|
||||
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
|
||||
@@ -214,15 +214,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$dialplan["dialplan_description"] = ($dialplan_description != '') ? $dialplan_description : $destination_description;
|
||||
$dialplan_detail_order = 10;
|
||||
|
||||
//add the public condition
|
||||
$y = 0;
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "context";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "public";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
||||
$y++;
|
||||
|
||||
//increment the dialplan detail order
|
||||
$dialplan_detail_order = $dialplan_detail_order + 10;
|
||||
|
||||
@@ -369,7 +360,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
if (!permission_exists('destination_domain')) {
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
echo $sql."<br><br>";
|
||||
//echo $sql."<br><br>";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
@@ -552,7 +543,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo " if (document.getElementById('tr_caller_id_name')) { document.getElementById('tr_caller_id_name').style.display = 'none'; }\n";
|
||||
echo " if (document.getElementById('tr_caller_id_number')) { document.getElementById('tr_caller_id_number').style.display = 'none'; }\n";
|
||||
echo " document.getElementById('tr_actions').style.display = 'none';\n";
|
||||
echo " document.getElementById('tr_fax_detection').style.display = 'none';\n";
|
||||
echo " if (document.getElementById('tr_fax_detection')) { document.getElementById('tr_fax_detection').style.display = 'none'; }\n";
|
||||
echo " document.getElementById('tr_cid_name_prefix').style.display = 'none';\n";
|
||||
echo " if (document.getElementById('tr_sell')) { document.getElementById('tr_sell').style.display = 'none'; }\n";
|
||||
echo " if (document.getElementById('tr_buy')) { document.getElementById('tr_buy').style.display = 'none'; }\n";
|
||||
@@ -564,7 +555,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo " if (document.getElementById('tr_caller_id_name')) { document.getElementById('tr_caller_id_name').style.display = ''; }\n";
|
||||
echo " if (document.getElementById('tr_caller_id_number')) { document.getElementById('tr_caller_id_number').style.display = ''; }\n";
|
||||
echo " document.getElementById('tr_actions').style.display = '';\n";
|
||||
echo " document.getElementById('tr_fax_detection').style.display = '';\n";
|
||||
echo " if (document.getElementById('tr_fax_detection')) { document.getElementById('tr_fax_detection').style.display = ''; }\n";
|
||||
echo " document.getElementById('tr_cid_name_prefix').style.display = '';\n";
|
||||
echo " if (document.getElementById('tr_sell')) { document.getElementById('tr_sell').style.display = ''; }\n";
|
||||
echo " if (document.getElementById('tr_buy')) { document.getElementById('tr_buy').style.display = ''; }\n";
|
||||
|
||||
@@ -50,10 +50,80 @@ else {
|
||||
$document['title'] = $text['title-destinations'];
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//get total destination count from the database
|
||||
$sql = "select count(*) as num_rows from v_destinations ";
|
||||
if ($_GET['showall'] && permission_exists('destination_all')) {
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "where ";
|
||||
}
|
||||
} else {
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "and ";
|
||||
}
|
||||
}
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "(";
|
||||
$sql .= " destination_type like '%".$search."%' ";
|
||||
$sql .= " or destination_number like '%".$search."%' ";
|
||||
$sql .= " or destination_context like '%".$search."%' ";
|
||||
$sql .= " or destination_enabled like '%".$search."%' ";
|
||||
$sql .= " or destination_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = 0;
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 150;
|
||||
$param = "&search=".$search;
|
||||
if ($_GET['showall'] && permission_exists('destination_all')) {
|
||||
$param .= "&showall=true";
|
||||
}
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_destinations ";
|
||||
if ($_GET['showall'] && permission_exists('destination_all')) {
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= " where ";
|
||||
}
|
||||
} else {
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= " and ";
|
||||
}
|
||||
}
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= " (";
|
||||
$sql .= " destination_type like '%".$search."%' ";
|
||||
$sql .= " or destination_number like '%".$search."%' ";
|
||||
$sql .= " or destination_context like '%".$search."%' ";
|
||||
$sql .= " or destination_enabled like '%".$search."%' ";
|
||||
$sql .= " or destination_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (strlen($order_by) > 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$destinations = $prep_statement->fetchAll();
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap' valign='top'><b>".$text['header-destinations']."</b></td>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap' valign='top'><b>".$text['header-destinations']." (".$num_rows.")</b></td>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <td width='50%' align='right'>\n";
|
||||
if (permission_exists('destination_all')) {
|
||||
@@ -76,77 +146,6 @@ else {
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//get total destination count from the database
|
||||
$sql = "select count(*) as num_rows from v_destinations ";
|
||||
if ($_GET['showall'] && permission_exists('destination_all')) {
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "where ";
|
||||
}
|
||||
} else {
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "and ";
|
||||
}
|
||||
}
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "(";
|
||||
$sql .= " destination_type like '%".$search."%' ";
|
||||
$sql .= " or destination_number like '%".$search."%' ";
|
||||
$sql .= " or destination_context like '%".$search."%' ";
|
||||
$sql .= " or destination_enabled like '%".$search."%' ";
|
||||
$sql .= " or destination_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
$total_destinations = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = 0;
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 150;
|
||||
$param = "&search=".$search;
|
||||
if ($_GET['showall'] && permission_exists('destination_all')) {
|
||||
$param .= "&showall=true";
|
||||
}
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($total_destinations, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_destinations ";
|
||||
if ($_GET['showall'] && permission_exists('destination_all')) {
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= " where ";
|
||||
}
|
||||
} else {
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= " and ";
|
||||
}
|
||||
}
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= " (";
|
||||
$sql .= " destination_type like '%".$search."%' ";
|
||||
$sql .= " or destination_number like '%".$search."%' ";
|
||||
$sql .= " or destination_context like '%".$search."%' ";
|
||||
$sql .= " or destination_enabled like '%".$search."%' ";
|
||||
$sql .= " or destination_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (strlen($order_by) > 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$destination = $prep_statement->fetchAll();
|
||||
$destination_count = count($destination);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
@@ -163,15 +162,15 @@ else {
|
||||
echo th_order_by('destination_description', $text['label-destination_description'], $order_by, $order, '', '', $param);
|
||||
echo "<td class='list_control_icons'>";
|
||||
if (permission_exists('destination_add')) {
|
||||
if ($_SESSION['limit']['destinations']['numeric'] == '' || ($_SESSION['limit']['destinations']['numeric'] != '' && $total_destinations < $_SESSION['limit']['destinations']['numeric'])) {
|
||||
if ($_SESSION['limit']['destinations']['numeric'] == '' || ($_SESSION['limit']['destinations']['numeric'] != '' && $num_rows < $_SESSION['limit']['destinations']['numeric'])) {
|
||||
echo "<a href='destination_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
||||
}
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($destination_count > 0) {
|
||||
foreach($destination as $row) {
|
||||
if ($num_rows > 0) {
|
||||
foreach($destinations as $row) {
|
||||
$tr_link = "href='destination_edit.php?id=".$row['destination_uuid']."'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
if ($_GET['showall'] && permission_exists('destination_all')) {
|
||||
@@ -193,7 +192,7 @@ else {
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $destination, $row_count);
|
||||
unset($sql, $destinations, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
@@ -204,7 +203,7 @@ else {
|
||||
echo "<td colspan='6' align='right'>\n";
|
||||
}
|
||||
if (permission_exists('destination_add')) {
|
||||
if ($_SESSION['limit']['destinations']['numeric'] == '' || ($_SESSION['limit']['destinations']['numeric'] != '' && $total_destinations < $_SESSION['limit']['destinations']['numeric'])) {
|
||||
if ($_SESSION['limit']['destinations']['numeric'] == '' || ($_SESSION['limit']['destinations']['numeric'] != '' && $num_rows < $_SESSION['limit']['destinations']['numeric'])) {
|
||||
echo "<a href='destination_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,18 @@
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_mac_address';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_label';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_template';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "device_extension_view";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
@@ -105,6 +117,15 @@
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_domain';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_username_password';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_alternate';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "device_profile_view";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
@@ -127,6 +148,25 @@
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_all';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_vendor';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_model';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_firmware';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_enable';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_description';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
|
||||
@@ -1690,7 +1690,7 @@ $text['label-blf']['ar-eg'] = "";
|
||||
$text['label-blf']['he'] = "";
|
||||
|
||||
$text['label-callers']['en-us'] = "Callers";
|
||||
$text['label-callers']['es-cl'] = "Llaamadas";
|
||||
$text['label-callers']['es-cl'] = "Llamadas";
|
||||
$text['label-callers']['pt-pt'] = "";
|
||||
$text['label-callers']['fr-fr'] = "";
|
||||
$text['label-callers']['pt-br'] = "";
|
||||
|
||||
@@ -128,10 +128,25 @@ require_once "resources/require.php";
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
//device mac address
|
||||
if (permission_exists('device_mac_address')) {
|
||||
$device_mac_address = check_str($_POST["device_mac_address"]);
|
||||
$device_mac_address = strtolower(preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address));
|
||||
$_POST["device_mac_address"] = $device_mac_address;
|
||||
}
|
||||
else {
|
||||
$orm = new orm;
|
||||
$orm->name('devices');
|
||||
$orm->uuid($device_uuid);
|
||||
$result = $orm->find()->get();
|
||||
//$message = $orm->message;
|
||||
foreach ($result as &$row) {
|
||||
$device_mac_address = $row["device_mac_address"];
|
||||
$_POST["device_mac_address"] = $device_mac_address;
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
//devices
|
||||
$device_mac_address = check_str($_POST["device_mac_address"]);
|
||||
$device_mac_address = strtolower(preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address));
|
||||
$_POST["device_mac_address"] = $device_mac_address;
|
||||
$device_label = check_str($_POST["device_label"]);
|
||||
$device_vendor = check_str($_POST["device_vendor"]);
|
||||
$device_uuid_alternate = check_str($_POST["device_uuid_alternate"]);
|
||||
@@ -217,6 +232,7 @@ require_once "resources/require.php";
|
||||
|
||||
//array cleanup
|
||||
$x = 0;
|
||||
//unset($_POST["autocomplete"]);
|
||||
foreach ($_POST["device_lines"] as $row) {
|
||||
//unset the empty row
|
||||
if (strlen($row["line_number"]) == 0) {
|
||||
@@ -287,7 +303,7 @@ require_once "resources/require.php";
|
||||
}
|
||||
|
||||
//write the provision files
|
||||
if (strlen($_SESSION['switch']['provision']['dir']) > 0) {
|
||||
if (strlen($_SESSION['provision']['path']['text']) > 0) {
|
||||
require_once "app/provision/provision_write.php";
|
||||
}
|
||||
|
||||
@@ -502,6 +518,7 @@ require_once "resources/require.php";
|
||||
<?php
|
||||
//show the content
|
||||
echo "<form method='post' name='frm' id='frm' action='' onsubmit='check_duplicates(); return false;'>\n";
|
||||
//echo "<input style='display:none;' type='password' name='autocomplete'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'>";
|
||||
@@ -512,7 +529,7 @@ require_once "resources/require.php";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' align='right' valign='top'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='devices.php'\" value='".$text['button-back']."'>\n";
|
||||
if ($action != "add") {
|
||||
if (permission_exists('device_add') && $action != "add") {
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"var new_mac = prompt('".$text['message_device']."'); if (new_mac != null) { window.location='device_copy.php?id=".$device_uuid."&mac=' + new_mac; }\" value='".$text['button-copy']."'>\n";
|
||||
}
|
||||
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
@@ -524,192 +541,211 @@ require_once "resources/require.php";
|
||||
echo " ".$text['label-device_mac_address']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_mac_address' id='device_mac_address' maxlength='255' value=\"$device_mac_address\">\n";
|
||||
if (permission_exists('device_mac_address')) {
|
||||
echo " <input class='formfld' type='text' name='device_mac_address' id='device_mac_address' maxlength='255' value=\"$device_mac_address\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_mac_address']."\n";
|
||||
}
|
||||
else {
|
||||
echo $device_mac_address;
|
||||
}
|
||||
echo " <div style='display: none;' id='duplicate_mac_response'></div>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_mac_address']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_label']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_label' maxlength='255' value=\"$device_label\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_label']."\n";
|
||||
if (permission_exists('device_label')) {
|
||||
echo " <input class='formfld' type='text' name='device_label' maxlength='255' value=\"$device_label\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_label']."\n";
|
||||
}
|
||||
else {
|
||||
echo $device_label;
|
||||
}
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_template']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
$device = new device;
|
||||
$template_dir = $device->get_template_dir();
|
||||
if (permission_exists('device_template')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_template']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
$device = new device;
|
||||
$template_dir = $device->get_template_dir();
|
||||
|
||||
echo "<select id='device_template' name='device_template' class='formfld'>\n";
|
||||
echo "<option value=''></option>\n";
|
||||
echo "<select id='device_template' name='device_template' class='formfld'>\n";
|
||||
echo "<option value=''></option>\n";
|
||||
|
||||
if ($dh = opendir($template_dir)) {
|
||||
while($dir = readdir($dh)) {
|
||||
if($file != "." && $dir != ".." && $dir[0] != '.') {
|
||||
if(is_dir($template_dir . "/" . $dir)) {
|
||||
echo "<optgroup label='$dir'>";
|
||||
if($dh_sub = opendir($template_dir.'/'.$dir)) {
|
||||
while($dir_sub = readdir($dh_sub)) {
|
||||
if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') {
|
||||
if(is_dir($template_dir . '/' . $dir .'/'. $dir_sub)) {
|
||||
if ($device_template == $dir."/".$dir_sub) {
|
||||
echo "<option value='".$dir."/".$dir_sub."' selected='selected'>".$dir."/".$dir_sub."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo "<option value='".$dir."/".$dir_sub."'>".$dir."/".$dir_sub."</option>\n";
|
||||
if (is_dir($template_dir)) {
|
||||
$templates = scandir($template_dir);
|
||||
foreach($templates as $dir) {
|
||||
if($file != "." && $dir != ".." && $dir[0] != '.') {
|
||||
if(is_dir($template_dir . "/" . $dir)) {
|
||||
echo "<optgroup label='$dir'>";
|
||||
$dh_sub=$template_dir . "/" . $dir;
|
||||
if(is_dir($dh_sub)) {
|
||||
$templates_sub = scandir($dh_sub);
|
||||
foreach($templates_sub as $dir_sub) {
|
||||
if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') {
|
||||
if(is_dir($template_dir . '/' . $dir .'/'. $dir_sub)) {
|
||||
if ($device_template == $dir."/".$dir_sub) {
|
||||
echo "<option value='".$dir."/".$dir_sub."' selected='selected'>".$dir."/".$dir_sub."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo "<option value='".$dir."/".$dir_sub."'>".$dir."/".$dir_sub."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh_sub);
|
||||
}
|
||||
echo "</optgroup>";
|
||||
}
|
||||
closedir($dh_sub);
|
||||
}
|
||||
echo "</optgroup>";
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_template']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
if (permission_exists('device_line_view')) {
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-lines']."</td>";
|
||||
echo " <td class='vtable' align='left'>";
|
||||
echo " <table width='100%' border='0' cellpadding='0' cellspacing='3'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-line']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-server_address']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-outbound_proxy']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-display_name']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-user_id']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-auth_id']."</td>\n";
|
||||
if (permission_exists('device_line_password')) {
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-password']."</td>\n";
|
||||
}
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-sip_port']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-sip_transport']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-register_expires']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-enabled']."</td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
$x = 0;
|
||||
foreach($device_lines as $row) {
|
||||
//determine whether to hide the element
|
||||
if (strlen($device_line_uuid) == 0) {
|
||||
$element['hidden'] = false;
|
||||
$element['visibility'] = "visibility:visible;";
|
||||
}
|
||||
else {
|
||||
$element['hidden'] = true;
|
||||
$element['visibility'] = "visibility:hidden;";
|
||||
}
|
||||
//add the primary key uuid
|
||||
if (strlen($row['device_line_uuid']) > 0) {
|
||||
echo " <input name='device_lines[".$x."][device_line_uuid]' type='hidden' value=\"".$row['device_line_uuid']."\">\n";
|
||||
}
|
||||
//show each row in the array
|
||||
echo " <tr>\n";
|
||||
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
|
||||
$selected = "selected=\"selected\" ";
|
||||
echo " <select class='formfld' style='width: 45px;' name='device_lines[".$x."][line_number]'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='1' ".($row['line_number'] == "1" ? $selected:"").">1</option>\n";
|
||||
echo " <option value='2' ".($row['line_number'] == "2" ? $selected:"").">2</option>\n";
|
||||
echo " <option value='3' ".($row['line_number'] == "3" ? $selected:"").">3</option>\n";
|
||||
echo " <option value='4' ".($row['line_number'] == "4" ? $selected:"").">4</option>\n";
|
||||
echo " <option value='5' ".($row['line_number'] == "5" ? $selected:"").">5</option>\n";
|
||||
echo " <option value='6' ".($row['line_number'] == "6" ? $selected:"").">6</option>\n";
|
||||
echo " <option value='7' ".($row['line_number'] == "7" ? $selected:"").">7</option>\n";
|
||||
echo " <option value='8' ".($row['line_number'] == "8" ? $selected:"").">8</option>\n";
|
||||
echo " <option value='9' ".($row['line_number'] == "9" ? $selected:"").">9</option>\n";
|
||||
echo " <option value='10' ".($row['line_number'] == "10" ? $selected:"").">10</option>\n";
|
||||
echo " <option value='11' ".($row['line_number'] == "11" ? $selected:"").">11</option>\n";
|
||||
echo " <option value='12' ".($row['line_number'] == "12" ? $selected:"").">12</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " <input class='formfld' style='width: 125px;' type='text' name='device_lines[".$x."][server_address]' maxlength='255' value=\"".$row['server_address']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 125px;' type='text' name='device_lines[".$x."][outbound_proxy]' maxlength='255' value=\"".$row['outbound_proxy']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 95px;' type='text' name='device_lines[".$x."][display_name]' maxlength='255' value=\"".$row['display_name']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][user_id]' maxlength='255' value=\"".$row['user_id']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][auth_id]' maxlength='255' value=\"".$row['auth_id']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
if (permission_exists('device_line_password')) {
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 90px;' type='password' name='device_lines[".$x."][password]' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" autocomplete=\"off\" maxlength='255' value=\"".$row['password']."\">\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][sip_port]' maxlength='255' value=\"".$row['sip_port']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <select class='formfld' style='width: 60px;' name='device_lines[".$x."][sip_transport]'>\n";
|
||||
echo " <option value='tcp' ".(($row['sip_transport'] == 'tcp') ? "selected" : null).">TCP</option>\n";
|
||||
echo " <option value='udp' ".(($row['sip_transport'] == 'udp') ? "selected" : null).">UDP</option>\n";
|
||||
echo " <option value='tls' ".(($row['sip_transport'] == 'tls') ? "selected" : null).">TLS</option>\n";
|
||||
echo " <option value='dns srv' ".(($row['sip_transport'] == 'dns srv') ? "selected" : null).">DNS SRV</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][register_expires]' maxlength='255' value=\"".$row['register_expires']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <select class='formfld' name='device_lines[".$x."][enabled]'>\n";
|
||||
echo " <option value='true' ".(($row['enabled'] == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
||||
echo " <option value='false' ".(($row['enabled'] == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td>\n";
|
||||
if (strlen($row['device_line_uuid']) > 0) {
|
||||
if (permission_exists('device_delete')) {
|
||||
echo " <a href='device_line_delete.php?device_uuid=".$row['device_uuid']."&id=".$row['device_line_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
$x++;
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_template']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-lines']."</td>";
|
||||
echo " <td class='vtable' align='left'>";
|
||||
echo " <table width='100%' border='0' cellpadding='0' cellspacing='3'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-line']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-server_address']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-outbound_proxy']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-display_name']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-user_id']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-auth_id']."</td>\n";
|
||||
if (permission_exists('device_line_password')) {
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-password']."</td>\n";
|
||||
}
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-sip_port']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-sip_transport']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-register_expires']."</td>\n";
|
||||
echo " <td class='vtable' nowrap='nowrap'>".$text['label-enabled']."</td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
$x = 0;
|
||||
foreach($device_lines as $row) {
|
||||
//determine whether to hide the element
|
||||
if (strlen($device_line_uuid) == 0) {
|
||||
$element['hidden'] = false;
|
||||
$element['visibility'] = "visibility:visible;";
|
||||
}
|
||||
else {
|
||||
$element['hidden'] = true;
|
||||
$element['visibility'] = "visibility:hidden;";
|
||||
}
|
||||
//add the primary key uuid
|
||||
if (strlen($row['device_line_uuid']) > 0) {
|
||||
echo " <input name='device_lines[".$x."][device_line_uuid]' type='hidden' value=\"".$row['device_line_uuid']."\">\n";
|
||||
}
|
||||
//show each row in the array
|
||||
echo " <tr>\n";
|
||||
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
|
||||
$selected = "selected=\"selected\" ";
|
||||
echo " <select class='formfld' style='width: 45px;' name='device_lines[".$x."][line_number]'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='1' ".($row['line_number'] == "1" ? $selected:"").">1</option>\n";
|
||||
echo " <option value='2' ".($row['line_number'] == "2" ? $selected:"").">2</option>\n";
|
||||
echo " <option value='3' ".($row['line_number'] == "3" ? $selected:"").">3</option>\n";
|
||||
echo " <option value='4' ".($row['line_number'] == "4" ? $selected:"").">4</option>\n";
|
||||
echo " <option value='5' ".($row['line_number'] == "5" ? $selected:"").">5</option>\n";
|
||||
echo " <option value='6' ".($row['line_number'] == "6" ? $selected:"").">6</option>\n";
|
||||
echo " <option value='7' ".($row['line_number'] == "7" ? $selected:"").">7</option>\n";
|
||||
echo " <option value='8' ".($row['line_number'] == "8" ? $selected:"").">8</option>\n";
|
||||
echo " <option value='9' ".($row['line_number'] == "9" ? $selected:"").">9</option>\n";
|
||||
echo " <option value='10' ".($row['line_number'] == "10" ? $selected:"").">10</option>\n";
|
||||
echo " <option value='11' ".($row['line_number'] == "11" ? $selected:"").">11</option>\n";
|
||||
echo " <option value='12' ".($row['line_number'] == "12" ? $selected:"").">12</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " <input class='formfld' style='width: 125px;' type='text' name='device_lines[".$x."][server_address]' maxlength='255' value=\"".$row['server_address']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 125px;' type='text' name='device_lines[".$x."][outbound_proxy]' maxlength='255' value=\"".$row['outbound_proxy']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 95px;' type='text' name='device_lines[".$x."][display_name]' maxlength='255' value=\"".$row['display_name']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][user_id]' maxlength='255' value=\"".$row['user_id']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][auth_id]' maxlength='255' value=\"".$row['auth_id']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
if (permission_exists('device_line_password')) {
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 90px;' type='password' name='device_lines[".$x."][password]' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" autocomplete=\"off\" maxlength='255' value=\"".$row['password']."\">\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][sip_port]' maxlength='255' value=\"".$row['sip_port']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <select class='formfld' style='width: 60px;' name='device_lines[".$x."][sip_transport]'>\n";
|
||||
echo " <option value='tcp' ".(($row['sip_transport'] == 'tcp') ? "selected" : null).">TCP</option>\n";
|
||||
echo " <option value='udp' ".(($row['sip_transport'] == 'udp') ? "selected" : null).">UDP</option>\n";
|
||||
echo " <option value='tls' ".(($row['sip_transport'] == 'tls') ? "selected" : null).">TLS</option>\n";
|
||||
echo " <option value='dns srv' ".(($row['sip_transport'] == 'dns srv') ? "selected" : null).">DNS SRV</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][register_expires]' maxlength='255' value=\"".$row['register_expires']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td align='left'>\n";
|
||||
echo " <select class='formfld' name='device_lines[".$x."][enabled]'>\n";
|
||||
echo " <option value='true' ".(($row['enabled'] == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
||||
echo " <option value='false' ".(($row['enabled'] == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td>\n";
|
||||
if (strlen($row['device_line_uuid']) > 0) {
|
||||
if (permission_exists('device_delete')) {
|
||||
echo " <a href='device_line_delete.php?device_uuid=".$row['device_uuid']."&id=".$row['device_line_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </table>\n";
|
||||
if (strlen($text['description-lines']) > 0) {
|
||||
echo " <br>".$text['description-lines']."\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
$x++;
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
}
|
||||
echo " </table>\n";
|
||||
if (strlen($text['description-lines']) > 0) {
|
||||
echo " <br>".$text['description-lines']."\n";
|
||||
}
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
if (permission_exists('device_key_add') || permission_exists('device_key_edit')) {
|
||||
if (permission_exists('device_profile_edit')) {
|
||||
//device profile
|
||||
$sql = "select * from v_device_profiles ";
|
||||
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
|
||||
@@ -733,7 +769,9 @@ require_once "resources/require.php";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
}
|
||||
}
|
||||
|
||||
if (permission_exists('device_key_edit')) {
|
||||
$vendor_count = 0;
|
||||
foreach($device_keys as $row) {
|
||||
if ($previous_vendor != $row['device_key_vendor']) {
|
||||
@@ -1060,7 +1098,7 @@ require_once "resources/require.php";
|
||||
}
|
||||
|
||||
//device settings
|
||||
if (permission_exists('device_setting_add')) {
|
||||
if (permission_exists('device_setting_edit')) {
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-settings']."</td>";
|
||||
echo " <td class='vtable' align='left'>";
|
||||
@@ -1148,75 +1186,85 @@ require_once "resources/require.php";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_username' id='device_username' autocomplete=\"off\" maxlength='255' placeholder=\"".$text['label-device_username']."\" value=\"$device_username\">\n";
|
||||
echo " <input class='formfld' type='text' name='device_password' id='device_password' autocomplete=\"off\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='255' placeholder=\"".$text['label-device_password']."\" value=\"$device_password\">\n";
|
||||
echo " <div style='display: none;' id='duplicate_username_response'></div>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_uuid_alternate']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left' nowrap='nowrap'>\n";
|
||||
if (strlen($device_uuid_alternate) == 0) {
|
||||
echo " <input class='formfld' type='text' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\">";
|
||||
if (permission_exists('device_username_password')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_username' id='device_username' autocomplete=\"off\" maxlength='255' placeholder=\"".$text['label-device_username']."\" value=\"$device_username\">\n";
|
||||
echo " <input class='formfld' type='text' name='device_password' id='device_password' autocomplete=\"off\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='255' placeholder=\"".$text['label-device_password']."\" value=\"$device_password\">\n";
|
||||
echo " <div style='display: none;' id='duplicate_username_response'></div>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
else {
|
||||
$label = $device_alternate[0]['device_label'];
|
||||
if (strlen($label) == 0) { $label = $device_alternate[0]['device_description']; }
|
||||
if (strlen($label) == 0) { $label = $device_alternate[0]['device_mac_address']; }
|
||||
echo " <table>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><a href='?id=$device_uuid_alternate' id='device_uuid_alternate_link'>$label</a><input class='formfld' type='hidden' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\"> </td>";
|
||||
echo " <td><a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('device_uuid_alternate').value = ''; document.getElementById('device_uuid_alternate_link').hidden = 'true'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
unset($label);
|
||||
|
||||
if (permission_exists('device_alternate')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_uuid_alternate']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left' nowrap='nowrap'>\n";
|
||||
if (strlen($device_uuid_alternate) == 0) {
|
||||
echo " <input class='formfld' type='text' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\">";
|
||||
}
|
||||
else {
|
||||
$label = $device_alternate[0]['device_label'];
|
||||
if (strlen($label) == 0) { $label = $device_alternate[0]['device_description']; }
|
||||
if (strlen($label) == 0) { $label = $device_alternate[0]['device_mac_address']; }
|
||||
echo " <table>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><a href='?id=$device_uuid_alternate' id='device_uuid_alternate_link'>$label</a><input class='formfld' type='hidden' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\"> </td>";
|
||||
echo " <td><a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('device_uuid_alternate').value = ''; document.getElementById('device_uuid_alternate_link').hidden = 'true'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
unset($label);
|
||||
}
|
||||
echo $text['description-device_uuid_alternate']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
echo $text['description-device_uuid_alternate']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_vendor']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_vendor' maxlength='255' value=\"$device_vendor\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_vendor']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
if (permission_exists('device_vendor')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_vendor']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_vendor' maxlength='255' value=\"$device_vendor\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_vendor']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_model']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_model' maxlength='255' value=\"$device_model\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_model']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
if (permission_exists('device_model')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_model']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_model' maxlength='255' value=\"$device_model\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_model']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_firmware_version']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_firmware_version' maxlength='255' value=\"$device_firmware_version\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_firmware_version']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
if (permission_exists('device_firmware')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_firmware_version']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_firmware_version' maxlength='255' value=\"$device_firmware_version\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_firmware_version']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
if (permission_exists('device_domain')) {
|
||||
echo "<tr>\n";
|
||||
@@ -1248,38 +1296,46 @@ require_once "resources/require.php";
|
||||
echo " <input type='hidden' name='domain_uuid' id='domain_uuid' value=\"".$_SESSION['domain_uuid']."\">\n";
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_provision_enable']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='device_provision_enable'>\n";
|
||||
if ($device_provision_enable == "true" || strlen($device_provision_enable) == 0) {
|
||||
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
||||
if (permission_exists('device_enable')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_provision_enable']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='device_provision_enable'>\n";
|
||||
if ($device_provision_enable == "true" || strlen($device_provision_enable) == 0) {
|
||||
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
if ($device_provision_enable == "false") {
|
||||
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>".$text['label-false']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_provision_enable']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
if ($device_provision_enable == "false") {
|
||||
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>".$text['label-false']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_provision_enable']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_description' maxlength='255' value=\"$device_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_description']."\n";
|
||||
if (permission_exists('device_description')) {
|
||||
echo " <input class='formfld' type='text' name='device_description' maxlength='255' value=\"$device_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_description']."\n";
|
||||
}
|
||||
else {
|
||||
echo $device_description."\n";
|
||||
}
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
|
||||
@@ -138,7 +138,7 @@ require_once "resources/require.php";
|
||||
}
|
||||
|
||||
//write the provision files
|
||||
if (strlen($_SESSION['switch']['provision']['dir']) > 0) {
|
||||
if (strlen($_SESSION['provision']['path']['text']) > 0) {
|
||||
require_once "app/provision/provision_write.php";
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,10 @@ else {
|
||||
exit;
|
||||
}
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
@@ -44,15 +48,116 @@ else {
|
||||
$order = check_str($_GET["order"]);
|
||||
}
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
//get total devices count from the database
|
||||
$sql = "select count(*) as num_rows from v_devices where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
$total_devices = $row['num_rows'];
|
||||
}
|
||||
unset($sql, $prep_statement, $row);
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_devices as d ";
|
||||
if ($_GET['showall'] && permission_exists('device_all')) {
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "where ";
|
||||
}
|
||||
} else {
|
||||
$sql .= "where (";
|
||||
$sql .= " d.domain_uuid = '$domain_uuid' ";
|
||||
if (permission_exists('device_all')) {
|
||||
$sql .= " or d.domain_uuid is null ";
|
||||
}
|
||||
$sql .= ") ";
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "and ";
|
||||
}
|
||||
}
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "(";
|
||||
$sql .= " d.device_mac_address like '%".$search."%' ";
|
||||
$sql .= " or d.device_label like '%".$search."%' ";
|
||||
$sql .= " or d.device_vendor like '%".$search."%' ";
|
||||
$sql .= " or d.device_provision_enable like '%".$search."%' ";
|
||||
$sql .= " or d.device_template like '%".$search."%' ";
|
||||
$sql .= " or d.device_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
$prep_statement = $db->prepare($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';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 150;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select d.*, d2.device_label as alternate_label ";
|
||||
$sql .= "from v_devices as d, v_devices as d2 ";
|
||||
$sql .= "where ( ";
|
||||
$sql .= " d.device_uuid_alternate = d2.device_uuid ";
|
||||
$sql .= " or d.device_uuid_alternate is null and d.device_uuid = d2.device_uuid ";
|
||||
$sql .= ") ";
|
||||
if ($_GET['showall'] && permission_exists('device_all')) {
|
||||
//echo __line__."<br \>\n";
|
||||
} else {
|
||||
$sql .= "and (";
|
||||
$sql .= " d.domain_uuid = '$domain_uuid' ";
|
||||
if (permission_exists('device_all')) {
|
||||
$sql .= " or d.domain_uuid is null ";
|
||||
}
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "and (";
|
||||
$sql .= " d.device_mac_address like '%".$search."%' ";
|
||||
$sql .= " or d.device_label like '%".$search."%' ";
|
||||
$sql .= " or d.device_vendor like '%".$search."%' ";
|
||||
$sql .= " or d.device_provision_enable like '%".$search."%' ";
|
||||
$sql .= " or d.device_template like '%".$search."%' ";
|
||||
$sql .= " or d.device_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (strlen($order_by) == 0) {
|
||||
$sql .= "order by d.device_label, d.device_description asc ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by $order_by $order ";
|
||||
}
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$devices = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//alternate_found
|
||||
$device_alternate = false;
|
||||
foreach($devices as $row) {
|
||||
if (strlen($row['device_uuid_alternate']) > 0) {
|
||||
$device_alternate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='100%' align='left' valign='top'>";
|
||||
echo " <b>".$text['header-devices']."</b>";
|
||||
echo " <b>".$text['header-devices']." (".$num_rows.")</b>";
|
||||
echo " <br /><br />";
|
||||
echo " ".$text['description-devices'];
|
||||
echo " </td>\n";
|
||||
@@ -77,114 +182,10 @@ else {
|
||||
echo "</table>\n";
|
||||
echo "<br />";
|
||||
|
||||
//get total devices count from the database
|
||||
$sql = "select count(*) as num_rows from v_devices where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
$total_devices = $row['num_rows'];
|
||||
}
|
||||
unset($sql, $prep_statement, $row);
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_devices as d ";
|
||||
if ($_GET['showall'] && permission_exists('device_all')) {
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "where ";
|
||||
}
|
||||
} else {
|
||||
$sql .= "where (";
|
||||
$sql .= " d.domain_uuid = '$domain_uuid' ";
|
||||
if (permission_exists('device_all')) {
|
||||
$sql .= " or d.domain_uuid is null ";
|
||||
}
|
||||
$sql .= ") ";
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "and ";
|
||||
}
|
||||
}
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "(";
|
||||
$sql .= " d.device_mac_address like '%".$search."%' ";
|
||||
$sql .= " or d.device_label like '%".$search."%' ";
|
||||
$sql .= " or d.device_vendor like '%".$search."%' ";
|
||||
$sql .= " or d.device_provision_enable like '%".$search."%' ";
|
||||
$sql .= " or d.device_template like '%".$search."%' ";
|
||||
$sql .= " or d.device_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
$prep_statement = $db->prepare($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';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 150;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select d.*, d2.device_label as alternate_label ";
|
||||
$sql .= "from v_devices as d, v_devices as d2 ";
|
||||
$sql .= "where ( ";
|
||||
$sql .= " d.device_uuid_alternate = d2.device_uuid ";
|
||||
$sql .= " or d.device_uuid_alternate is null and d.device_uuid = d2.device_uuid ";
|
||||
$sql .= ") ";
|
||||
if ($_GET['showall'] && permission_exists('device_all')) {
|
||||
//echo __line__."<br \>\n";
|
||||
} else {
|
||||
$sql .= "and (";
|
||||
$sql .= " d.domain_uuid = '$domain_uuid' ";
|
||||
if (permission_exists('device_all')) {
|
||||
$sql .= " or d.domain_uuid is null ";
|
||||
}
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "and (";
|
||||
$sql .= " d.device_mac_address like '%".$search."%' ";
|
||||
$sql .= " or d.device_label like '%".$search."%' ";
|
||||
$sql .= " or d.device_vendor like '%".$search."%' ";
|
||||
$sql .= " or d.device_provision_enable like '%".$search."%' ";
|
||||
$sql .= " or d.device_template like '%".$search."%' ";
|
||||
$sql .= " or d.device_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (strlen($order_by) == 0) {
|
||||
$sql .= "order by d.device_label, d.device_description asc ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by $order_by $order ";
|
||||
}
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$devices = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
//alternate_found
|
||||
$device_alternate = false;
|
||||
foreach($devices as $row) {
|
||||
if (strlen($row['device_uuid_alternate']) > 0) {
|
||||
$device_alternate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($_GET['showall'] && permission_exists('device_all')) {
|
||||
|
||||
@@ -58,9 +58,7 @@ else {
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get the app uuid
|
||||
if (is_uuid($_REQUEST["app_uuid"])) {
|
||||
if (strlen($_REQUEST["app_uuid"]) > 0) {
|
||||
$app_uuid = $_REQUEST["app_uuid"];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="call_block" number="" continue="true" app_uuid="b1b31930-d0ee-4395-a891-04df94599f1f" enabled="false">
|
||||
<condition>
|
||||
<action application="lua" data="app.lua call_block"/>
|
||||
<condition field="${call_blocked}" expression="^true$" >
|
||||
<anti-action application="lua" data="app.lua call_block"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -4,8 +4,9 @@
|
||||
<action application="set" data="caller_id_name=Page" />
|
||||
<action application="set" data="caller_id_number=" />
|
||||
<action application="set" data="pin_number={v_pin_number}" />
|
||||
<action application="set" data="extension_list=101-103,105" />
|
||||
<action application="set" data="destinations=101-103,105" />
|
||||
<action application="set" data="moderator=false" />
|
||||
<action application="set" data="mute=true" />
|
||||
<action application="set" data="set api_hangup_hook=conference page-${destination_number} kick all" />
|
||||
<action application="lua" data="page.lua" />
|
||||
</condition>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="page-extension" number="*8[ext]" continue="false" app_uuid="1b224444-de8b-448d-b2d1-19feaac3effa">
|
||||
<condition field="destination_number" expression="^\*8(\d{2,7})$">
|
||||
<action application="set" data="extension_list=$1"/>
|
||||
<action application="set" data="destinations=$1"/>
|
||||
<action application="set" data="pin_number={v_pin_number}"/>
|
||||
<action application="set" data="mute=true"/>
|
||||
<action application="set" data="moderator=false" />
|
||||
|
||||
@@ -184,33 +184,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add condition public context
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_detail_uuid, ";
|
||||
$sql .= "dialplan_detail_tag, ";
|
||||
$sql .= "dialplan_detail_type, ";
|
||||
$sql .= "dialplan_detail_data, ";
|
||||
$sql .= "dialplan_detail_group, ";
|
||||
$sql .= "dialplan_detail_order ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$dialplan_detail_uuid', ";
|
||||
$sql .= "'condition', ";
|
||||
$sql .= "'context', ";
|
||||
$sql .= "'public', ";
|
||||
$sql .= "'0', ";
|
||||
$sql .= "'10' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add condition 1
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
|
||||
@@ -41,4 +41,6 @@
|
||||
$apps[$x]['permissions'][5]['groups'][] = "superadmin";
|
||||
$apps[$x]['permissions'][5]['description'] = "Add outbound routes for any gateways on any domain.";
|
||||
|
||||
$apps[$x]['permissions'][6]['name'] = "outbound_route_toll_allow_lua";
|
||||
|
||||
?>
|
||||
@@ -937,19 +937,21 @@ function type_onchange(dialplan_detail_type) {
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-toll_allow']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='toll_allow_enabled'>\n";
|
||||
echo " <option value='true' >".$text['label-true']."</option>\n";
|
||||
echo " <option value='false' selected='true'>".$text['label-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-enable-toll_allow']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
if (permission_exists('outbound_route_toll_allow_lua')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-toll_allow']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='toll_allow_enabled'>\n";
|
||||
echo " <option value='true'>".$text['label-true']."</option>\n";
|
||||
echo " <option value='false' selected='true'>".$text['label-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-enable-toll_allow']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
|
||||
@@ -118,6 +118,9 @@
|
||||
$apps[$x]['permissions'][$y]['name'] = "extension_user_context";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "extension_absolute_codec_string";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
@@ -384,6 +387,14 @@
|
||||
$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]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "absolute_codec_string";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text";
|
||||
$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]['description']['en-us'] = "";
|
||||
|
||||
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
|
||||
@@ -468,6 +468,19 @@ $text['label-sip_bypass_media']['ro'] = "SIP Bypass Media";
|
||||
$text['label-sip_bypass_media']['ar-eg'] = "";
|
||||
$text['label-sip_bypass_media']['he'] = "";
|
||||
|
||||
$text['label-absolute_codec_string']['en-us'] = "Absolute Codec String";
|
||||
$text['label-absolute_codec_string']['es-cl'] = "";
|
||||
$text['label-absolute_codec_string']['pt-pt'] = "";
|
||||
$text['label-absolute_codec_string']['fr-fr'] = "";
|
||||
$text['label-absolute_codec_string']['pt-br'] = "";
|
||||
$text['label-absolute_codec_string']['pl'] = "";
|
||||
$text['label-absolute_codec_string']['uk'] = "";
|
||||
$text['label-absolute_codec_string']['sv-se'] = "";
|
||||
$text['label-absolute_codec_string']['de-at'] = "";
|
||||
$text['label-absolute_codec_string']['ro'] = "";
|
||||
$text['label-absolute_codec_string']['ar-eg'] = "";
|
||||
$text['label-absolute_codec_string']['he'] = "";
|
||||
|
||||
$text['label-rewrite_tls_contact_port']['en-us'] = "Rewrite TLS Contact Port";
|
||||
$text['label-rewrite_tls_contact_port']['es-cl'] = "Reescribir Contacto Puerto TLS";
|
||||
$text['label-rewrite_tls_contact_port']['pt-pt'] = "Reescreva Contacto Porto TLS";
|
||||
@@ -1339,6 +1352,19 @@ $text['description-mwi_account']['ro'] = "Contul MWI cu utilizator@domeniu al me
|
||||
$text['description-mwi_account']['ar-eg'] = "";
|
||||
$text['description-mwi_account']['he'] = "";
|
||||
|
||||
$text['description-absolute_codec_string']['en-us'] = "Absolute Codec String for the extension";
|
||||
$text['description-absolute_codec_string']['es-cl'] = "";
|
||||
$text['description-absolute_codec_string']['pt-pt'] = "";
|
||||
$text['description-absolute_codec_string']['fr-fr'] = "";
|
||||
$text['description-absolute_codec_string']['pt-br'] = "";
|
||||
$text['description-absolute_codec_string']['pl'] = "";
|
||||
$text['description-absolute_codec_string']['uk'] = "";
|
||||
$text['description-absolute_codec_string']['sv-se'] = "";
|
||||
$text['description-absolute_codec_string']['de-at'] = "";
|
||||
$text['description-absolute_codec_string']['ro'] = "";
|
||||
$text['description-absolute_codec_string']['ar-eg'] = "";
|
||||
$text['description-absolute_codec_string']['he'] = "";
|
||||
|
||||
$text['description-missed_call']['en-us'] = "Select the notification type, and enter the appropriate destination.";
|
||||
$text['description-missed_call']['es-cl'] = "Seleccione el tipo de notificación, y entrar en el destino apropiado.";
|
||||
$text['description-missed_call']['pt-pt'] = "Selecione o tipo de notificação e digite o destino apropriado.";
|
||||
@@ -1793,4 +1819,4 @@ $text['button-add']['ro'] = "Adaugă";
|
||||
$text['button-add']['ar-eg'] = "اضافة";
|
||||
$text['button-add']['he'] = "הוספה";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -135,6 +135,7 @@ else {
|
||||
$nibble_account = check_str($_POST["nibble_account"]);
|
||||
$mwi_account = check_str($_POST["mwi_account"]);
|
||||
$sip_bypass_media = check_str($_POST["sip_bypass_media"]);
|
||||
$absolute_codec_string = check_str($_POST["absolute_codec_string"]);
|
||||
$dial_string = check_str($_POST["dial_string"]);
|
||||
$enabled = check_str($_POST["enabled"]);
|
||||
$description = check_str($_POST["description"]);
|
||||
@@ -462,6 +463,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$sql .= "mwi_account, ";
|
||||
}
|
||||
$sql .= "sip_bypass_media, ";
|
||||
if (permission_exists('extension_absolute_codec_string')) {
|
||||
$sql .= "absolute_codec_string, ";
|
||||
}
|
||||
if (permission_exists('extension_dial_string')) {
|
||||
$sql .= "dial_string, ";
|
||||
}
|
||||
@@ -527,6 +531,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$sql .= "'$mwi_account', ";
|
||||
}
|
||||
$sql .= "'$sip_bypass_media', ";
|
||||
if (permission_exists('extension_absolute_codec_string')) {
|
||||
$sql .= "'$absolute_codec_string', ";
|
||||
}
|
||||
if (permission_exists('extension_dial_string')) {
|
||||
$sql .= "'$dial_string', ";
|
||||
}
|
||||
@@ -680,6 +687,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
}
|
||||
$sql .= "mwi_account = '$mwi_account', ";
|
||||
$sql .= "sip_bypass_media = '$sip_bypass_media', ";
|
||||
if (permission_exists('extension_absolute_codec_string')) {
|
||||
$sql .= "absolute_codec_string = '$absolute_codec_string', ";
|
||||
}
|
||||
if (permission_exists('extension_dial_string')) {
|
||||
$sql .= "dial_string = '$dial_string', ";
|
||||
}
|
||||
@@ -841,6 +851,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$nibble_account = $row["nibble_account"];
|
||||
$mwi_account = $row["mwi_account"];
|
||||
$sip_bypass_media = $row["sip_bypass_media"];
|
||||
$absolute_codec_string = $row["absolute_codec_string"];
|
||||
$dial_string = $row["dial_string"];
|
||||
$enabled = $row["enabled"];
|
||||
$description = $row["description"];
|
||||
@@ -982,7 +993,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo "}\n";
|
||||
echo "</script>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<form method='post' name='frm' action='' autocomplete='off'>\n";
|
||||
echo "<input style='display:none;' type='password' name='autocomplete'>";
|
||||
echo "<table width='100%' border='0' cellpdding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
@@ -1042,7 +1054,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo " ".$text['label-password']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='password' name='password' id='password' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" autocomplete='off' maxlength='50' value=\"$password\">\n";
|
||||
echo " <input class='formfld' type='password' name='password' id='password' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='50' value=\"$password\">\n";
|
||||
echo " <br />\n";
|
||||
echo " ".$text['description-password']."\n";
|
||||
echo "</td>\n";
|
||||
@@ -1257,13 +1269,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$template_dir = $device->get_template_dir();
|
||||
echo "<select id='device_template' name='device_template' class='formfld'>\n";
|
||||
echo "<option value=''></option>\n";
|
||||
if($dh = opendir($template_dir)) {
|
||||
while($dir = readdir($dh)) {
|
||||
if (is_dir($template_dir)) {
|
||||
$templates = scandir($template_dir);
|
||||
foreach($templates as $dir) {
|
||||
if($file != "." && $dir != ".." && $dir[0] != '.') {
|
||||
if(is_dir($template_dir . "/" . $dir)) {
|
||||
echo "<optgroup label='$dir'>";
|
||||
if($dh_sub = opendir($template_dir.'/'.$dir)) {
|
||||
while($dir_sub = readdir($dh_sub)) {
|
||||
$dh_sub=$template_dir . "/" . $dir;
|
||||
if(is_dir($dh_sub)) {
|
||||
$templates_sub = scandir($dh_sub);
|
||||
foreach($templates_sub as $dir_sub) {
|
||||
if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') {
|
||||
if(is_dir($template_dir . '/' . $dir .'/'. $dir_sub)) {
|
||||
if ($device_template == $dir."/".$dir_sub) {
|
||||
@@ -1364,11 +1379,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo " <select name='outbound_caller_id_name' id='outbound_caller_id_name' class='formfld'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach ($destinations as &$row) {
|
||||
if ($outbound_caller_id_name == $row["destination_caller_id_name"]) {
|
||||
echo " <option value='".$row["destination_caller_id_name"]."' selected='selected'>".$row["destination_caller_id_name"]."</option>\n";
|
||||
$tmp = $row["destination_caller_id_name"];
|
||||
if(strlen($tmp) == 0){
|
||||
$tmp = $row["destination_description"];
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$row["destination_caller_id_name"]."'>".$row["destination_caller_id_name"]."</option>\n";
|
||||
if(strlen($tmp) > 0){
|
||||
if ($outbound_caller_id_name == $tmp) {
|
||||
echo " <option value='".$tmp."' selected='selected'>".$tmp."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$tmp."'>".$tmp."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </select>\n";
|
||||
@@ -1397,11 +1418,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo " <select name='outbound_caller_id_number' id='outbound_caller_id_number' class='formfld'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach ($destinations as &$row) {
|
||||
if ($outbound_caller_id_number == $row["destination_caller_id_number"]) {
|
||||
echo " <option value='".$row["destination_caller_id_number"]."' selected='selected'>".$row["destination_caller_id_number"]."</option>\n";
|
||||
$tmp = $row["destination_caller_id_number"];
|
||||
if(strlen($tmp) == 0){
|
||||
$tmp = $row["destination_number"];
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$row["destination_caller_id_number"]."'>".$row["destination_caller_id_number"]."</option>\n";
|
||||
if(strlen($tmp) > 0){
|
||||
if ($outbound_caller_id_number == $tmp) {
|
||||
echo " <option value='".$tmp."' selected='selected'>".$tmp."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$tmp."'>".$tmp."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </select>\n";
|
||||
@@ -1863,6 +1890,19 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if (permission_exists('extension_absolute_codec_string')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-absolute_codec_string']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='absolute_codec_string' maxlength='255' value=\"$absolute_codec_string\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-absolute_codec_string']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
if (permission_exists('extension_domain')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
@@ -1964,4 +2004,4 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
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-2014
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -50,22 +50,6 @@ $document['title'] = $text['title-extensions'];
|
||||
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//show the content
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'><b>".$text['header-extensions']."</b><br>\n";
|
||||
echo " ".$text['description-extensions']."\n";
|
||||
echo " </td>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <td width='30%' align='right'>\n";
|
||||
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
||||
echo " </td>\n";
|
||||
echo " </form>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />";
|
||||
|
||||
//get total extension count from the database
|
||||
$sql = "select count(*) as num_rows from v_extensions where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
@@ -128,10 +112,25 @@ require_once "resources/paging.php";
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
$extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//show the content
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'><b>".$text['header-extensions']." (".$num_rows.")</b><br>\n";
|
||||
echo " ".$text['description-extensions']."\n";
|
||||
echo " </td>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <td width='30%' align='right'>\n";
|
||||
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
||||
echo " </td>\n";
|
||||
echo " </form>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />";
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
@@ -153,8 +152,8 @@ require_once "resources/paging.php";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
if ($num_rows > 0) {
|
||||
foreach($extensions as $row) {
|
||||
$tr_link = (permission_exists('extension_edit')) ? " href='extension_edit.php?id=".$row['extension_uuid']."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
@@ -181,7 +180,7 @@ require_once "resources/paging.php";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
unset($sql, $extensions, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
@@ -205,7 +204,6 @@ require_once "resources/paging.php";
|
||||
echo "</table>";
|
||||
echo "<br><br>";
|
||||
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
@@ -65,6 +65,7 @@
|
||||
public $nibble_account;
|
||||
public $mwi_account;
|
||||
public $sip_bypass_media;
|
||||
public $absolute_codec_string;
|
||||
public $dial_string;
|
||||
public $enabled;
|
||||
public $description;
|
||||
@@ -360,6 +361,9 @@
|
||||
$xml .= " <variable name=\"proxy_media\" value=\"true\"/>\n";
|
||||
break;
|
||||
}
|
||||
if (strlen($row['absolute_codec_string']) > 0) {
|
||||
$xml .= " <variable name=\"absolute_codec_string\" value=\"" . $row['absolute_codec_string'] . "\"/>\n";
|
||||
}
|
||||
if (strlen($row['forward_all_enabled']) > 0) {
|
||||
$xml .= " <variable name=\"forward_all_enabled\" value=\"" . $row['forward_all_enabled'] . "\"/>\n";
|
||||
}
|
||||
@@ -494,4 +498,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$text['title-fax']['en-us'] = "Fax Server";
|
||||
$text['title-fax']['en-us'] = "Fax Servers";
|
||||
$text['title-fax']['es-cl'] = "Servidor de Fax";
|
||||
$text['title-fax']['pt-pt'] = "Servidor de Fax";
|
||||
$text['title-fax']['fr-fr'] = "Serveur de Fax";
|
||||
|
||||
@@ -33,8 +33,10 @@ else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
@@ -44,18 +46,7 @@ require_once "resources/paging.php";
|
||||
$order_by = check_str($_GET["order_by"]);
|
||||
$order = check_str($_GET["order"]);
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
echo " <span class=\"title\">".$text['title-fax']."</span>";
|
||||
echo " <br /><br />\n";
|
||||
echo " ".$text['description']."\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
//get the fax extensions
|
||||
if (if_group("superadmin") || if_group("admin")) {
|
||||
//show all fax extensions
|
||||
$sql = "select count(*) as num_rows from v_fax ";
|
||||
@@ -109,9 +100,20 @@ require_once "resources/paging.php";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
echo " <span class=\"title\">".$text['title-fax']." (".$num_rows.")</span>";
|
||||
echo " <br /><br />\n";
|
||||
echo " ".$text['description']."\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
@@ -130,7 +132,7 @@ require_once "resources/paging.php";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
if ($num_rows > 0) {
|
||||
foreach($result as $row) {
|
||||
//remove the backslash
|
||||
$row['fax_email'] = str_replace("\\", "", $row['fax_email']);
|
||||
@@ -182,7 +184,7 @@ require_once "resources/paging.php";
|
||||
//alternate the CSS class
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
unset($sql, $result);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
|
||||
@@ -172,24 +172,6 @@ else {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//show the header
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' valign='top'>\n";
|
||||
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
|
||||
echo " <b>".$text['header-inbox'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
|
||||
}
|
||||
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
|
||||
echo " <b>".$text['header-sent'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td width='70%' align='right' valign='top'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='fax.php'\" value='".$text['button-back']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_fax_files ";
|
||||
$sql .= "where fax_uuid = '$fax_uuid' ";
|
||||
@@ -234,10 +216,27 @@ else {
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
$fax_files = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//show the header
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' valign='top'>\n";
|
||||
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
|
||||
echo " <b>".$text['header-inbox'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
|
||||
}
|
||||
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
|
||||
echo " <b>".$text['header-sent'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td width='70%' align='right' valign='top'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='fax.php'\" value='".$text['button-back']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br>\n";
|
||||
|
||||
//show the table and content
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
@@ -255,8 +254,8 @@ else {
|
||||
echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
|
||||
echo "<td style='width: 25px;' class='list_control_icons'> </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
if ($num_rows > 0) {
|
||||
foreach($fax_files as $row) {
|
||||
$file = basename($row['fax_file_path']);
|
||||
if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") {
|
||||
$file_name = substr($file, 0, (strlen($file) -4));
|
||||
@@ -382,7 +381,7 @@ else {
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
unset($sql, $fax_files);
|
||||
} //end if results
|
||||
|
||||
//show the paging controls
|
||||
|
||||
@@ -608,7 +608,7 @@ function gs_cmd($args) {
|
||||
$fax_uri = $route_array[0];
|
||||
$t38 = "fax_enable_t38=true,fax_enable_t38_request=true,";
|
||||
}
|
||||
$cmd = "api originate {for_fax=1,absolute_codec_string='PCMU,PCMA',accountcode='".$fax_accountcode."',sip_h_X-accountcode='".$fax_accountcode."',domain_uuid=".$_SESSION["domain_uuid"].",domain_name=".$_SESSION["domain_name"].",mailto_address='".$mailto_address."',mailfrom_address='".$mailfrom_address."',origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')";
|
||||
$cmd = "api originate {for_fax=1,accountcode='".$fax_accountcode."',sip_h_X-accountcode='".$fax_accountcode."',domain_uuid=".$_SESSION["domain_uuid"].",domain_name=".$_SESSION["domain_name"].",mailto_address='".$mailto_address."',mailfrom_address='".$mailfrom_address."',origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')";
|
||||
//send the command to event socket
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$response = str_replace("\n", "", $response);
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
$apps[$x]['menu'][0]['title']['en-us'] = "Queues";
|
||||
$apps[$x]['menu'][0]['title']['es-cl'] = "Colas";
|
||||
$apps[$x]['menu'][0]['title']['es-mx'] = "Colas";
|
||||
$apps[$x]['menu'][0]['title']['de-de'] = "";
|
||||
$apps[$x]['menu'][0]['title']['de-ch'] = "";
|
||||
$apps[$x]['menu'][0]['title']['de-at'] = "";
|
||||
$apps[$x]['menu'][0]['title']['de-de'] = "Warteschlangen";
|
||||
$apps[$x]['menu'][0]['title']['de-ch'] = "Warteschlangen";
|
||||
$apps[$x]['menu'][0]['title']['de-at'] = "Warteschlangen";
|
||||
$apps[$x]['menu'][0]['title']['fr-fr'] = "Queues";
|
||||
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
|
||||
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
|
||||
@@ -19,4 +19,4 @@ $apps[$x]['menu'][0]['path'] = "/app/dialplan/dialplans.php?app_uuid=16589224-c8
|
||||
$apps[$x]['menu'][0]['groups'][] = "admin";
|
||||
$apps[$x]['menu'][0]['groups'][] = "superadmin";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -144,6 +144,8 @@
|
||||
$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_follow_me";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "follow_me_uuid";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "follow_me_destination_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
@@ -172,4 +174,4 @@
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = "";
|
||||
$z++;
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
$apps[$x]['menu'][0]['title']['en-us'] = "Follow Me";
|
||||
$apps[$x]['menu'][0]['title']['es-mx'] = "Sígueme";
|
||||
$apps[$x]['menu'][0]['title']['de-de'] = "";
|
||||
$apps[$x]['menu'][0]['title']['de-ch'] = "";
|
||||
$apps[$x]['menu'][0]['title']['de-at'] = "";
|
||||
$apps[$x]['menu'][0]['title']['de-de'] = "Follow Me";
|
||||
$apps[$x]['menu'][0]['title']['de-ch'] = "Follow Me";
|
||||
$apps[$x]['menu'][0]['title']['de-at'] = "Follow Me";
|
||||
$apps[$x]['menu'][0]['title']['fr-fr'] = "Follow Me";
|
||||
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
|
||||
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
|
||||
@@ -18,4 +18,4 @@
|
||||
$apps[$x]['menu'][0]['groups'][] = "admin";
|
||||
$apps[$x]['menu'][0]['groups'][] = "superadmin";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -189,6 +189,11 @@
|
||||
$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'] = "hostname";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(255)";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "enabled";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
|
||||
@@ -442,6 +442,15 @@ $text['label-expire_seconds']['de-at'] = "Expire Seconds";
|
||||
$text['label-expire_seconds']['ar-eg'] = "";
|
||||
$text['label-expire_seconds']['he'] = "";
|
||||
|
||||
$text['label-hostname']['en-us'] = "Hostname";
|
||||
$text['label-hostname']['pt-pt'] = "Hostname";
|
||||
$text['label-hostname']['fr-fr'] = "Nom d'hôte";
|
||||
$text['label-hostname']['pt-br'] = "Hostname";
|
||||
$text['label-hostname']['pl'] = "Nazwa hosta";
|
||||
$text['label-hostname']['sv-se'] = "Hostname";
|
||||
$text['label-hostname']['uk'] = "Назва хоста";
|
||||
$text['label-hostname']['de-at'] = "Hostname";
|
||||
|
||||
$text['label-enabled']['en-us'] = "Enabled";
|
||||
$text['label-enabled']['es-cl'] = "Activado";
|
||||
$text['label-enabled']['pt-pt'] = "Habilitado";
|
||||
@@ -870,6 +879,15 @@ $text['description-expire_seconds']['de-at'] = "Geben Sie an, nach wie vielen Se
|
||||
$text['description-expire_seconds']['ar-eg'] = "";
|
||||
$text['description-expire_seconds']['he'] = "";
|
||||
|
||||
$text['description-hostname']['en-us'] = "Enter the hostname / switchname.";
|
||||
$text['description-hostname']['pt-pt'] = "Introduza o hostname";
|
||||
$text['description-hostname']['fr-fr'] = "Entrer le nom de l'hôte / du switch.";
|
||||
$text['description-hostname']['pt-br'] = "Insira o hostname";
|
||||
$text['description-hostname']['pl'] = "Wprowadź nazwę hosta / PBXu.";
|
||||
$text['description-hostname']['sv-se'] = "Fyll i hostname / switchname.";
|
||||
$text['description-hostname']['uk'] = "Введіть назву хоста / switchname.";
|
||||
$text['description-hostname']['de-at'] = "Geben Sie den Hostnamen / Switchnamen an.";
|
||||
|
||||
$text['description-enabled']['en-us'] = "Enable or Disable the Gateway";
|
||||
$text['description-enabled']['es-cl'] = "Activar o Desactivar la Pasarela";
|
||||
$text['description-enabled']['pt-pt'] = "Habilitar ou Desabilitar o Gateway";
|
||||
|
||||
@@ -95,6 +95,7 @@ else {
|
||||
$extension_in_contact = check_str($_POST["extension_in_contact"]);
|
||||
$context = check_str($_POST["context"]);
|
||||
$profile = check_str($_POST["profile"]);
|
||||
$hostname = check_str($_POST["hostname"]);
|
||||
$enabled = check_str($_POST["enabled"]);
|
||||
$description = check_str($_POST["description"]);
|
||||
}
|
||||
@@ -198,6 +199,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$sql .= "extension_in_contact, ";
|
||||
$sql .= "context, ";
|
||||
$sql .= "profile, ";
|
||||
$sql .= "hostname, ";
|
||||
$sql .= "enabled, ";
|
||||
$sql .= "description ";
|
||||
$sql .= ")";
|
||||
@@ -232,6 +234,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$sql .= "'$extension_in_contact', ";
|
||||
$sql .= "'$context', ";
|
||||
$sql .= "'$profile', ";
|
||||
if (strlen($hostname) == 0) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "'$hostname', ";
|
||||
}
|
||||
$sql .= "'$enabled', ";
|
||||
$sql .= "'$description' ";
|
||||
$sql .= ")";
|
||||
@@ -278,6 +286,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
else {
|
||||
$sql .= "domain_uuid = '$domain_uuid', ";
|
||||
}
|
||||
if (strlen($hostname) == 0) {
|
||||
$sql .= "hostname = null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "hostname = '$hostname', ";
|
||||
}
|
||||
$sql .= "enabled = '$enabled', ";
|
||||
$sql .= "description = '$description' ";
|
||||
$sql .= "where gateway_uuid = '$gateway_uuid'";
|
||||
@@ -374,6 +388,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$extension_in_contact = $row["extension_in_contact"];
|
||||
$context = $row["context"];
|
||||
$profile = $row["profile"];
|
||||
$hostname = $row["hostname"];
|
||||
$enabled = $row["enabled"];
|
||||
$description = $row["description"];
|
||||
}
|
||||
@@ -871,6 +886,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
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 "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-enabled']."\n";
|
||||
|
||||
@@ -136,7 +136,7 @@ else {
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$gateways = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$rows_per_page = 150;
|
||||
@@ -159,6 +159,7 @@ else {
|
||||
echo "<th>".$text['label-action']."</th>\n";
|
||||
echo "<th>".$text['label-state']."</th>\n";
|
||||
}
|
||||
echo th_order_by('hostname', $text['label-hostname'], $order_by, $order);
|
||||
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
|
||||
echo th_order_by('description', $text['label-description'], $order_by, $order);
|
||||
echo "<td class='list_control_icons'>";
|
||||
@@ -171,7 +172,7 @@ else {
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($num_rows > 0) {
|
||||
foreach($result as $row) {
|
||||
foreach($gateways as $row) {
|
||||
$tr_link = (permission_exists('gateway_edit')) ? "href='gateway_edit.php?id=".$row['gateway_uuid']."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
@@ -211,6 +212,7 @@ else {
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> </td>\n";
|
||||
}
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row["hostname"]."</td>\n";
|
||||
if ($row["enabled"] == "true") {
|
||||
echo " <td valign='top' class='".$row_style[$c]."' style='align: center;'>".$text['label-true']."</td>\n";
|
||||
}
|
||||
@@ -230,11 +232,11 @@ else {
|
||||
}
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
unset($sql, $gateways, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='8' align='left'>\n";
|
||||
echo "<td colspan='9' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
|
||||
@@ -103,6 +103,13 @@
|
||||
$array[$x]['default_setting_description'] = '';
|
||||
$x++;
|
||||
$array[$x]['default_setting_category'] = 'provision';
|
||||
$array[$x]['default_setting_subcategory'] = 'path';
|
||||
$array[$x]['default_setting_name'] = 'text';
|
||||
$array[$x]['default_setting_value'] = '';
|
||||
$array[$x]['default_setting_enabled'] = 'false';
|
||||
$array[$x]['default_setting_description'] = '';
|
||||
$x++;
|
||||
$array[$x]['default_setting_category'] = 'provision';
|
||||
$array[$x]['default_setting_subcategory'] = 'voicemail_number';
|
||||
$array[$x]['default_setting_name'] = 'text';
|
||||
$array[$x]['default_setting_value'] = '*97';
|
||||
|
||||
@@ -77,6 +77,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
$domain_uuid = $row["domain_uuid"];
|
||||
}
|
||||
unset($result, $prep_statement);
|
||||
$_SESSION['domain_uuid'] = $domain_uuid;
|
||||
|
||||
//get the domain name
|
||||
$domain_name = $_SESSION['domains'][$domain_uuid]['domain_name'];
|
||||
@@ -240,7 +241,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
header('WWW-Authenticate: Basic realm="'.$_SESSION['domain_name']." ".date('r').'"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
header("Content-Type: text/plain");
|
||||
echo 'Authorization Required';
|
||||
header("Content-Length: 0");
|
||||
exit;
|
||||
} else {
|
||||
if ($_SERVER['PHP_AUTH_USER'] == $provision["http_auth_username"] && $_SERVER['PHP_AUTH_PW'] == $provision["http_auth_password"]) {
|
||||
@@ -251,7 +252,9 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
header('WWW-Authenticate: Basic realm="'.$_SESSION['domain_name']." ".date('r').'"');
|
||||
unset($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']);
|
||||
usleep(rand(1000000,3000000));//1-3 seconds.
|
||||
echo 'Authorization Required';
|
||||
$content = 'Authorization Required';
|
||||
header("Content-Length: ".strval(strlen($content)));
|
||||
echo $content;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -311,4 +314,4 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
return $needed_parts ? false : $data;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -465,7 +465,7 @@ include "root.php";
|
||||
$sql .= "or device_profile_uuid = '".$device_profile_uuid."' ";
|
||||
}
|
||||
$sql .= ") ";
|
||||
$sql .= "AND (device_key_vendor = '".$device_vendor."' or device_key_vendor is null) ";
|
||||
$sql .= "AND (lower(device_key_vendor) = '".$device_vendor."' or device_key_vendor is null) ";
|
||||
$sql .= "ORDER BY device_key_category asc, device_key_id asc, device_uuid desc";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
@@ -822,8 +822,8 @@ include "root.php";
|
||||
//$file_size = round(filesize($new_path)/1024, 2);
|
||||
//echo $this->template_dir."/".$device_template."/".$file_name." $file_size\n";
|
||||
//write the configuration to the directory
|
||||
if (strlen($_SESSION['switch']['provision']['dir']) > 0) {
|
||||
$dir_array = explode(";", $_SESSION['switch']['provision']['dir']);
|
||||
if (strlen($provision["path"]) > 0) {
|
||||
$dir_array = explode(";", $provision["path"]);
|
||||
foreach($dir_array as $directory) {
|
||||
|
||||
if (file_exists($this->template_dir."/".$device_template."/".$file_name)) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -127,7 +127,7 @@ require_once "resources/check_auth.php";
|
||||
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td width='100%'>\n";
|
||||
echo " <b>".$text['header-registrations'].": ".count($registrations)."</b>\n";
|
||||
echo " <b>".$text['header-registrations']." (".count($registrations).")</b>\n";
|
||||
echo "</td>\n";
|
||||
echo "<td valign='middle' nowrap='nowrap' style='padding-right: 15px' id='refresh_state'>";
|
||||
echo " <img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' onclick='refresh_stop();' alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\">";
|
||||
|
||||
@@ -88,6 +88,17 @@ $text['option-rollover']['uk'] = "";
|
||||
$text['option-rollover']['de-at'] = "Überrollen";
|
||||
$text['option-rollover']['he'] = "";
|
||||
|
||||
$text['option-random']['en-us'] = "Random";
|
||||
$text['option-random']['es-cl'] = "Aleatorio";
|
||||
$text['option-random']['pt-pt'] = "";
|
||||
$text['option-random']['fr-fr'] = "";
|
||||
$text['option-random']['pt-br'] = "";
|
||||
$text['option-random']['pl'] = "";
|
||||
$text['option-random']['sv-se'] = "";
|
||||
$text['option-random']['uk'] = "";
|
||||
$text['option-random']['de-at'] = "";
|
||||
$text['option-random']['he'] = "";
|
||||
|
||||
$text['option-ptring']['en-us'] = "pt-ring";
|
||||
$text['option-ptring']['es-cl'] = "pt-ring";
|
||||
$text['option-ptring']['fr-fr'] = "Portugal";
|
||||
|
||||
@@ -499,6 +499,7 @@ else {
|
||||
echo " <option value='sequence' ".(($ring_group_strategy == "sequence") ? "selected='selected'" : null).">".$text['option-sequence']."</option>\n";
|
||||
echo " <option value='enterprise' ".(($ring_group_strategy == "enterprise") ? "selected='selected'" : null).">".$text['option-enterprise']."</option>\n";
|
||||
echo " <option value='rollover' ".(($ring_group_strategy == "rollover") ? "selected='selected'" : null).">".$text['option-rollover']."</option>\n";
|
||||
echo " <option value='random' ".(($ring_group_strategy == "random") ? "selected='selected'" : null).">".$text['option-random']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-strategy']."\n";
|
||||
|
||||
@@ -3,54 +3,68 @@
|
||||
if ($domains_processed == 1) {
|
||||
|
||||
//define holiday presets
|
||||
$preset[] = json_encode(array("new_years_day" => array("mday" => "1", "mon" => "1")));
|
||||
$preset[] = json_encode(array("martin_luther_king_jr_day" => array("wday" => "2", "mon" => "1", "mweek" => "3")));
|
||||
$preset[] = json_encode(array("presidents_day" => array("wday" => "2", "mon" => "2", "mweek" => "3")));
|
||||
$preset[] = json_encode(array("memorial_day" => array("mday" => "25-31", "wday" => "2", "mon" => "5")));
|
||||
$preset[] = json_encode(array("independence_day" => array("mday" => "4", "mon" => "7")));
|
||||
$preset[] = json_encode(array("labor_day" => array("wday" => "2", "mon" => "9", "mweek" => "1")));
|
||||
$preset[] = json_encode(array("columbus_day" => array("wday" => "2", "mon" => "10", "mweek" => "2")));
|
||||
$preset[] = json_encode(array("veterans_day" => array("mday" => "11", "mon" => "11")));
|
||||
$preset[] = json_encode(array("thanksgiving_day" => array("wday" => "5-6", "mon" => "11", "mweek" => "4")));
|
||||
$preset[] = json_encode(array("christmas_day" => array("mday" => "25", "mon" => "12")));
|
||||
$preset['usa'][] = json_encode(array("new_years_day" => array("mday" => "1", "mon" => "1")));
|
||||
$preset['usa'][] = json_encode(array("martin_luther_king_jr_day" => array("wday" => "2", "mon" => "1", "mweek" => "3")));
|
||||
$preset['usa'][] = json_encode(array("presidents_day" => array("wday" => "2", "mon" => "2", "mweek" => "3")));
|
||||
$preset['usa'][] = json_encode(array("memorial_day" => array("mday" => "25-31", "wday" => "2", "mon" => "5")));
|
||||
$preset['usa'][] = json_encode(array("independence_day" => array("mday" => "4", "mon" => "7")));
|
||||
$preset['usa'][] = json_encode(array("labor_day" => array("wday" => "2", "mon" => "9", "mweek" => "1")));
|
||||
$preset['usa'][] = json_encode(array("columbus_day" => array("wday" => "2", "mon" => "10", "mweek" => "2")));
|
||||
$preset['usa'][] = json_encode(array("veterans_day" => array("mday" => "11", "mon" => "11")));
|
||||
$preset['usa'][] = json_encode(array("thanksgiving_day" => array("wday" => "5-6", "mon" => "11", "mweek" => "4")));
|
||||
$preset['usa'][] = json_encode(array("christmas_day" => array("mday" => "25", "mon" => "12")));
|
||||
|
||||
//define array of settings
|
||||
$x = 0;
|
||||
foreach ($preset as $json) {
|
||||
$array[$x]['default_setting_category'] = 'time_conditions';
|
||||
$array[$x]['default_setting_subcategory'] = 'preset';
|
||||
$array[$x]['default_setting_name'] = 'array';
|
||||
$array[$x]['default_setting_value'] = $json;
|
||||
$array[$x]['default_setting_enabled'] = 'true';
|
||||
$array[$x]['default_setting_description'] = 'Holiday';
|
||||
$x++;
|
||||
}
|
||||
$preset['england'][] = json_encode(array("new_years_day" => array("mday" => "1", "mon" => "1")));
|
||||
$preset['england'][] = json_encode(array("christmas_day" => array("mday" => "25", "mon" => "12")));
|
||||
$preset['england'][] = json_encode(array("boxing_day" => array("mday" => "26", "mon" => "12")));
|
||||
$preset['england'][] = json_encode(array("may_day" => array("mon" => "5", "mweek" => "1", "wday" => "2")));
|
||||
$preset['england'][] = json_encode(array("spring_bank_holiday" => array("mon" => "5", "mday" => "25-31", "wday" => "2")));
|
||||
$preset['england'][] = json_encode(array("august_bank_holiday" => array("mon" => "8", "mday" => "25-31", "wday" => "2")));
|
||||
|
||||
//get an array of the default settings
|
||||
$sql = "select * from v_default_settings ";
|
||||
//iterate and migrate old presets first
|
||||
$sql = "update v_default_settings ";
|
||||
$sql .= "set default_setting_subcategory = 'preset_usa' ";
|
||||
$sql .= ", default_setting_description = 'usa Holiday' ";
|
||||
$sql .= "where default_setting_category = 'time_conditions' ";
|
||||
$sql .= "and default_setting_subcategory = 'preset' ";
|
||||
$sql .= "and default_setting_name = 'array' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//find the missing default settings
|
||||
$x = 0;
|
||||
foreach ($array as $setting) {
|
||||
$found = false;
|
||||
$missing[$x] = $setting;
|
||||
foreach ($default_settings as $row) {
|
||||
if (trim($row['default_setting_value']) == trim($setting['default_setting_value'])) {
|
||||
$found = true;
|
||||
//remove items from the array that were found
|
||||
unset($missing[$x]);
|
||||
}
|
||||
}
|
||||
$x++;
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
unset ($prep_statement, $sql);
|
||||
}
|
||||
|
||||
//iterate and add each, if necessary
|
||||
$x = 0;
|
||||
foreach ($preset as $region => $data) {
|
||||
$sql = "select * from v_default_settings ";
|
||||
$sql .= "where default_setting_category = 'time_conditions' ";
|
||||
$sql .= "and default_setting_subcategory = 'preset_$region' ";
|
||||
$sql .= "and default_setting_name = 'array' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
foreach ($data as $json) {
|
||||
$found = false;
|
||||
$missing[$x]['default_setting_category'] = 'time_conditions';
|
||||
$missing[$x]['default_setting_subcategory'] = "preset_$region";
|
||||
$missing[$x]['default_setting_name'] = 'array';
|
||||
$missing[$x]['default_setting_value'] = $json;
|
||||
$missing[$x]['default_setting_enabled'] = 'true';
|
||||
$missing[$x]['default_setting_description'] = "$region Holiday";
|
||||
foreach ($default_settings as $row) {
|
||||
if (trim($row['default_setting_value']) == trim($json)) {
|
||||
$found = true;
|
||||
//remove items from the array that were found
|
||||
unset($missing[$x]);
|
||||
}
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//add the missing default settings
|
||||
foreach ($missing as $row) {
|
||||
//add the default settings
|
||||
@@ -63,6 +77,39 @@ if ($domains_processed == 1) {
|
||||
}
|
||||
unset($missing);
|
||||
|
||||
$array[$x]['default_setting_category'] = 'time_conditions';
|
||||
$array[$x]['default_setting_subcategory'] = 'region';
|
||||
$array[$x]['default_setting_name'] = 'text';
|
||||
$array[$x]['default_setting_value'] = 'usa';
|
||||
$array[$x]['default_setting_enabled'] = 'true';
|
||||
$array[$x]['default_setting_description'] = 'What region to use by default when choosing Time Conditions';
|
||||
$x++;
|
||||
|
||||
//iterate and add each, if necessary
|
||||
foreach ($array as $index => $default_settings) {
|
||||
|
||||
//add the default setting
|
||||
$sql = "select count(*) as num_rows from v_default_settings ";
|
||||
$sql .= "where default_setting_category = '".$default_settings['default_setting_category']."' ";
|
||||
$sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' ";
|
||||
$sql .= "and default_setting_name = '".$default_settings['default_setting_name']."' ";
|
||||
$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;
|
||||
//print_r($message);
|
||||
}
|
||||
unset($row);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//unset the array variable
|
||||
unset($array);
|
||||
}
|
||||
|
||||
@@ -583,6 +583,28 @@ $text['label-alternate-destination']['uk'] = "";
|
||||
$text['label-alternate-destination']['de-at'] = "Alternatives Ziel";
|
||||
$text['label-alternate-destination']['he'] = "";
|
||||
|
||||
$text['label-group']['en-us'] = "Group";
|
||||
$text['label-group']['es-cl'] = "Grupo";
|
||||
$text['label-group']['pt-pt'] = "";
|
||||
$text['label-group']['fr-fr'] = "";
|
||||
$text['label-group']['pt-br'] = "";
|
||||
$text['label-group']['pl'] = "";
|
||||
$text['label-group']['sv-se'] = "";
|
||||
$text['label-group']['uk'] = "";
|
||||
$text['label-group']['de-at'] = "";
|
||||
$text['label-group']['he'] = "";
|
||||
|
||||
$text['label-destination']['en-us'] = "Destination";
|
||||
$text['label-destination']['es-cl'] = "Destino";
|
||||
$text['label-destination']['pt-pt'] = "Destino";
|
||||
$text['label-destination']['fr-fr'] = "Destination";
|
||||
$text['label-destination']['pt-br'] = "";
|
||||
$text['label-destination']['pl'] = "Destynacja";
|
||||
$text['label-destination']['sv-se'] = "Destination";
|
||||
$text['label-destination']['uk'] = "";
|
||||
$text['label-destination']['de-at'] = "Ziel";
|
||||
$text['label-destination']['he'] = "";
|
||||
|
||||
$text['header-time_conditions']['en-us'] = "Time Conditions";
|
||||
$text['header-time_conditions']['es-cl'] = "Condiciones de Tiempo";
|
||||
$text['header-time_conditions']['pt-pt'] = "Condições Temporais";
|
||||
|
||||
@@ -44,10 +44,12 @@ require_once "resources/header.php";
|
||||
$destination = new destinations;
|
||||
|
||||
//load available presets
|
||||
foreach ($_SESSION['time_conditions']['preset'] as $json) {
|
||||
$preset_region = "preset_".$_SESSION['time_conditions']['region']['text'];
|
||||
foreach ($_SESSION['time_conditions'][$preset_region] as $json) {
|
||||
$available_presets[] = json_decode($json, true);
|
||||
}
|
||||
|
||||
unset($preset_region);
|
||||
|
||||
//set the action as an add or an update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
@@ -248,7 +250,14 @@ require_once "resources/header.php";
|
||||
$is_preset = (in_array($group_id, $_REQUEST['preset'])) ? true : false;
|
||||
|
||||
//set group and order number
|
||||
$dialplan_detail_group = $group_id;
|
||||
|
||||
$dialplan_detail_group_user = check_str($_POST["group_$group_id"]);
|
||||
if($dialplan_detail_group_user!='') {
|
||||
$dialplan_detail_group = $dialplan_detail_group_user;
|
||||
} else {
|
||||
$dialplan_detail_group = $group_id;
|
||||
}
|
||||
|
||||
$dialplan_detail_order = 0;
|
||||
|
||||
foreach ($conditions as $cond_num => $cond_var) {
|
||||
@@ -836,7 +845,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') {
|
||||
echo " ".$text['label-settings'];
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <table border='0' cellpadding='2' cellspacing='0' style='margin: -2px;'>\n";
|
||||
echo " <table border='0' cellpadding='0' cellspacing='0' style='margin: -2px;'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable' style='width: 108px;'>".$text['label-condition']."</td>\n";
|
||||
echo " <td class='vtable' style='width: 125px;'>".$text['label-condition_value']."</td>\n";
|
||||
@@ -846,11 +855,16 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') {
|
||||
echo " <tr>";
|
||||
echo " <td colspan='4' style='white-space: nowrap;' id='group_".$group_id."'></td>";
|
||||
echo " </tr>";
|
||||
echo " </tr>";
|
||||
echo " <td colspan='2' class='vtable' style='width: 108px;'>".$text['label-destination']."</td>\n";
|
||||
echo " <td colspan='2' class='vtable'>".$text['label-group']."</td>\n";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td colspan='4' style='padding-top: 10px;'>";
|
||||
echo " <td colspan='2' style='padding-top: 3px;'>";
|
||||
//$destination = new destinations;
|
||||
echo $destination->select('dialplan', 'dialplan_action['.$group_id.']', $dialplan_action);
|
||||
echo " </td>";
|
||||
echo " <td colspan='2' style='padding-top: 3px;'><input class='formfld' type='text' name='group_".$group_id."' id='group_".$group_id."' maxlength='255' value=\"".$group_id."\"></td>\n";
|
||||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo " <br />";
|
||||
@@ -1092,4 +1106,4 @@ echo "<br />";
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -46,7 +46,7 @@ require_once "resources/check_auth.php";
|
||||
}
|
||||
|
||||
//deny access if the user extension is not assigned
|
||||
if (!(if_group("superadmin") || if_group("admin"))) {
|
||||
if (!permission_exists('voicemail_greeting_view')) {
|
||||
if (!is_extension_assigned($voicemail_id)) {
|
||||
echo "access denied";
|
||||
return;
|
||||
|
||||
@@ -48,6 +48,13 @@ if ($domains_processed == 1) {
|
||||
$array[$x]['default_setting_enabled'] = 'true';
|
||||
$array[$x]['default_setting_description'] = 'Define whether to keep voicemail files on the local system after sending attached via email.';
|
||||
$x++;
|
||||
$array[$x]['default_setting_category'] = 'voicemail';
|
||||
$array[$x]['default_setting_subcategory'] = 'storage_type';
|
||||
$array[$x]['default_setting_name'] = 'text';
|
||||
$array[$x]['default_setting_value'] = 'base64';
|
||||
$array[$x]['default_setting_enabled'] = 'false';
|
||||
$array[$x]['default_setting_description'] = 'Define which storage type (base_64 stores in the database).';
|
||||
$x++;
|
||||
|
||||
//iterate and add each, if necessary
|
||||
foreach ($array as $index => $default_settings) {
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
if ($result_count > 0) {
|
||||
foreach($result as &$row) {
|
||||
//set the greeting directory
|
||||
$path = $_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domain_name'].'/'.$row['voicemail_id'];
|
||||
$path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$_SESSION['domain_name'].'/'.$row['voicemail_id'];
|
||||
if (file_exists($path.'/msg_'.$row['voicemail_message_uuid'].'.wav')) {
|
||||
$row['file_path'] = $path.'/msg_'.$row['voicemail_message_uuid'].'.wav';
|
||||
}
|
||||
@@ -239,7 +239,7 @@
|
||||
}
|
||||
|
||||
//delete the recording
|
||||
$file_path = $_SESSION['switch']['storage']['dir']."/voicemail/default/".$_SESSION['domain_name']."/".$this->voicemail_id;
|
||||
$file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id;
|
||||
foreach (glob($file_path."/msg_".$this->voicemail_message_uuid.".*") as $file_name) {
|
||||
unlink($file_name);
|
||||
}
|
||||
@@ -278,7 +278,7 @@
|
||||
session_cache_limiter('public');
|
||||
|
||||
//set source folder path
|
||||
$path = $_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domain_name'].'/'.$this->voicemail_id;
|
||||
$path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$_SESSION['domain_name'].'/'.$this->voicemail_id;
|
||||
|
||||
//prepare base64 content from db, if enabled
|
||||
if ($_SESSION['voicemail']['storage_type']['text'] == 'base64') {
|
||||
|
||||
@@ -185,17 +185,13 @@ if (!(check_str($_REQUEST["action"]) == "download" && check_str($_REQUEST["src"]
|
||||
|
||||
$previous_voicemail_id = $field['voicemail_id'];
|
||||
unset($sql, $result, $result_count);
|
||||
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
echo "<br /><br />";
|
||||
|
||||
}
|
||||
else {
|
||||
echo "<br />".$text['message-messages_not_found']."<br /><br />";
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
|
||||
//autoplay message
|
||||
|
||||
@@ -57,11 +57,73 @@ else {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_voicemails ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "and (";
|
||||
$sql .= " voicemail_id like '%".$search."%' ";
|
||||
$sql .= " or voicemail_mail_to like '%".$search."%' ";
|
||||
$sql .= " or voicemail_local_after_email like '%".$search."%' ";
|
||||
$sql .= " or voicemail_enabled like '%".$search."%' ";
|
||||
$sql .= " or voicemail_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (!permission_exists('voicemail_delete')) {
|
||||
$x = 0;
|
||||
if (count($voicemail_uuids) > 0) {
|
||||
$sql .= "and (";
|
||||
foreach($voicemail_uuids as $row) {
|
||||
if ($x == 0) {
|
||||
$sql .= "voicemail_uuid = '".$row['voicemail_uuid']."' ";
|
||||
}
|
||||
else {
|
||||
$sql .= " or voicemail_uuid = '".$row['voicemail_uuid']."'";
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
else {
|
||||
$sql .= "and voicemail_uuid is null ";
|
||||
}
|
||||
}
|
||||
$prep_statement = $db->prepare($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';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 150;
|
||||
$param = "";
|
||||
if ($search != '') { $param .= "&search=".$search; }
|
||||
if ($order_by != '') { $param .= "&order_by=".$order_by."&order=".$order; }
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = str_replace('count(*) as num_rows', '*', $sql);
|
||||
$sql .= ($order_by != '') ? "order by ".$order_by." ".$order." " : "order by voicemail_id asc ";
|
||||
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$voicemails = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap' valign='top'>";
|
||||
echo " <b>".$text['title-voicemails']."</b>";
|
||||
echo " <b>".$text['title-voicemails']." (".$num_rows.")</b>";
|
||||
echo " <br /><br />";
|
||||
echo " ".$text['description-voicemail'];
|
||||
echo " <br /><br />";
|
||||
@@ -75,74 +137,11 @@ else {
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_voicemails ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "and (";
|
||||
$sql .= " voicemail_id like '%".$search."%' ";
|
||||
$sql .= " or voicemail_mail_to like '%".$search."%' ";
|
||||
$sql .= " or voicemail_local_after_email like '%".$search."%' ";
|
||||
$sql .= " or voicemail_enabled like '%".$search."%' ";
|
||||
$sql .= " or voicemail_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (!permission_exists('voicemail_delete')) {
|
||||
$x = 0;
|
||||
if (count($voicemail_uuids) > 0) {
|
||||
$sql .= "and (";
|
||||
foreach($voicemail_uuids as $row) {
|
||||
if ($x == 0) {
|
||||
$sql .= "voicemail_uuid = '".$row['voicemail_uuid']."' ";
|
||||
}
|
||||
else {
|
||||
$sql .= " or voicemail_uuid = '".$row['voicemail_uuid']."'";
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
else {
|
||||
$sql .= "and voicemail_uuid is null ";
|
||||
}
|
||||
}
|
||||
$prep_statement = $db->prepare($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';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 150;
|
||||
$param = "";
|
||||
if ($search != '') { $param .= "&search=".$search; }
|
||||
if ($order_by != '') { $param .= "&order_by=".$order_by."&order=".$order; }
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = str_replace('count(*) as num_rows', '*', $sql);
|
||||
$sql .= ($order_by != '') ? "order by ".$order_by." ".$order." " : "order by voicemail_id asc ";
|
||||
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
if ($result_count > 0) {
|
||||
if ($num_rows > 0) {
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
@@ -165,7 +164,7 @@ else {
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
foreach($result as $row) {
|
||||
foreach($voicemails as $row) {
|
||||
$tr_link = (permission_exists('voicemail_edit')) ? "href='voicemail_edit.php?id=".$row['voicemail_uuid']."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
@@ -202,7 +201,7 @@ else {
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
unset($sql, $voicemails, $row_count);
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='11' align='left'>\n";
|
||||
|
||||
@@ -471,21 +471,21 @@ else {
|
||||
switch ($row['direction']) {
|
||||
case "inbound" :
|
||||
if ($row['billsec'] == 0)
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_missed.png' style='border: none;' title='".$text['label-inbound']." ".$text['label-missed']."'>\n";
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_missed.png' width='16' style='border: none;' title='".$text['label-inbound']." ".$text['label-missed']."'>\n";
|
||||
else
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_connected.png' style='border: none;' title='".$text['label-inbound']."'>\n";
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_connected.png' width='16' style='border: none;' title='".$text['label-inbound']."'>\n";
|
||||
break;
|
||||
case "outbound" :
|
||||
if ($row['billsec'] == 0)
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_failed.png' style='border: none;' title='".$text['label-outbound']." ".$text['label-failed']."'>\n";
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_failed.png' width='16' style='border: none;' title='".$text['label-outbound']." ".$text['label-failed']."'>\n";
|
||||
else
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_connected.png' style='border: none;' title='".$text['label-outbound']."'>\n";
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_connected.png' width='16' style='border: none;' title='".$text['label-outbound']."'>\n";
|
||||
break;
|
||||
case "local" :
|
||||
if ($row['billsec'] == 0)
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_failed.png' style='border: none;' title='".$text['label-local']." ".$text['label-failed']."'>\n";
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_failed.png' width='16' style='border: none;' title='".$text['label-local']." ".$text['label-failed']."'>\n";
|
||||
else
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_connected.png' style='border: none;' title='".$text['label-local']."'>\n";
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_connected.png' width='16' style='border: none;' title='".$text['label-local']."'>\n";
|
||||
break;
|
||||
default:
|
||||
echo " ";
|
||||
|
||||
@@ -47,7 +47,7 @@ else {
|
||||
//get the cdr string from the database
|
||||
$sql = "select * from v_xml_cdr ";
|
||||
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
|
||||
if ($sql_where) { $sql .= "where uuid = '$uuid' "; }
|
||||
$sql .= "where uuid = '$uuid' ";
|
||||
} else {
|
||||
$sql .= "where uuid = '$uuid' and domain_uuid = '$domain_uuid' ";
|
||||
}
|
||||
|
||||
@@ -131,6 +131,9 @@ if ($domains_processed == 1) {
|
||||
if (strlen($_SESSION['switch']['sounds']['dir']) > 0) {
|
||||
$tmp .= correct_path(" sounds_dir = [[".$_SESSION['switch']['sounds']['dir']."]];\n");
|
||||
}
|
||||
if (strlen($_SESSION['switch']['phrases']['dir']) > 0) {
|
||||
$tmp .= correct_path(" phrases_dir = [[".$_SESSION['switch']['phrases']['dir']."]];\n");
|
||||
}
|
||||
if (strlen($_SESSION['switch']['db']['dir']) > 0) {
|
||||
$tmp .= correct_path(" database_dir = [[".$_SESSION['switch']['db']['dir']."]];\n");
|
||||
}
|
||||
@@ -182,7 +185,25 @@ if ($domains_processed == 1) {
|
||||
}
|
||||
$tmp .= "\n";
|
||||
}
|
||||
|
||||
$tmp .= "--set defaults\n";
|
||||
$tmp .= " expire = {}\n";
|
||||
$tmp .= " expire[\"directory\"] = \"3600\";\n";
|
||||
$tmp .= " expire[\"dialplan\"] = \"3600\";\n";
|
||||
$tmp .= " expire[\"languages\"] = \"3600\";\n";
|
||||
$tmp .= " expire[\"sofia.conf\"] = \"3600\";\n";
|
||||
$tmp .= " expire[\"acl.conf\"] = \"3600\";\n";
|
||||
$tmp .= "\n";
|
||||
$tmp .= "--set xml_handler\n";
|
||||
$tmp .= " xml_handler = {}\n";
|
||||
$tmp .= " xml_handler[\"fs_path\"] = false;\n";
|
||||
$tmp .= "\n";
|
||||
$tmp .= "--set the debug options\n";
|
||||
$tmp .= " debug[\"params\"] = false;\n";
|
||||
$tmp .= " debug[\"sql\"] = false;\n";
|
||||
$tmp .= " debug[\"xml_request\"] = false;\n";
|
||||
$tmp .= " debug[\"xml_string\"] = false;\n";
|
||||
$tmp .= " debug[\"cache\"] = false;\n";
|
||||
$tmp .= "\n";
|
||||
$tmp .= "--additional info\n";
|
||||
$tmp .= " domain_count = ".count($_SESSION["domains"]).";\n";
|
||||
$tmp .= correct_path(" temp_dir = [[".$_SESSION['server']['temp']['dir']."]];\n");
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2010
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -30,12 +30,26 @@ if ($domains_processed == 1) {
|
||||
//define array of settings
|
||||
$x = 0;
|
||||
$array[$x]['default_setting_category'] = 'domain';
|
||||
$array[$x]['default_setting_subcategory'] = 'time_zone';
|
||||
$array[$x]['default_setting_name'] = 'name';
|
||||
$array[$x]['default_setting_value'] = '';
|
||||
$array[$x]['default_setting_enabled'] = 'true';
|
||||
$array[$x]['default_setting_description'] = '';
|
||||
$x++;
|
||||
$array[$x]['default_setting_category'] = 'domain';
|
||||
$array[$x]['default_setting_subcategory'] = 'language';
|
||||
$array[$x]['default_setting_name'] = 'code';
|
||||
$array[$x]['default_setting_value'] = 'en-us';
|
||||
$array[$x]['default_setting_enabled'] = 'true';
|
||||
$array[$x]['default_setting_description'] = '';
|
||||
$x++;
|
||||
$array[$x]['default_setting_category'] = 'domain';
|
||||
$array[$x]['default_setting_subcategory'] = 'bridge';
|
||||
$array[$x]['default_setting_name'] = 'text';
|
||||
$array[$x]['default_setting_value'] = 'outbound';
|
||||
$array[$x]['default_setting_enabled'] = 'true';
|
||||
$array[$x]['default_setting_description'] = 'outbound,loopback,lcr';
|
||||
$x++;
|
||||
$array[$x]['default_setting_category'] = 'security';
|
||||
$array[$x]['default_setting_subcategory'] = 'password_length';
|
||||
$array[$x]['default_setting_name'] = 'var';
|
||||
|
||||
@@ -92,6 +92,38 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
// fix null
|
||||
$default_setting_order = ($default_setting_order != '') ? $default_setting_order : 'null';
|
||||
|
||||
//update switch timezone variables
|
||||
if ($default_setting_category == "domain" && $default_setting_subcategory == "time_zone" && $default_setting_name == "name" ) {
|
||||
//get the action
|
||||
$sql = "select * from v_vars ";
|
||||
$sql .= "where var_name = 'timezone' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$var_action = "add";
|
||||
foreach ($result as $row) {
|
||||
$var_action = "update";
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//update the timezone
|
||||
if ($var_action == "update") {
|
||||
$sql = "update v_vars ";
|
||||
$sql .= "set var_value = '".$default_setting_value."' ";
|
||||
$sql .= "where var_name = 'timezone' ";
|
||||
}
|
||||
else {
|
||||
$sql = "insert into v_vars ";
|
||||
$sql .= "(var_uuid, var_name, var_value, var_cat, var_enabled) ";
|
||||
$sql .= "values ('".uuid()."', 'timezone', '$default_setting_value', 'Defaults', 'true'); ";
|
||||
}
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//synchronize the configuration
|
||||
save_var_xml();
|
||||
}
|
||||
|
||||
if ($action == "add" && permission_exists('default_setting_add')) {
|
||||
$sql = "insert into v_default_settings ";
|
||||
$sql .= "(";
|
||||
@@ -566,4 +598,4 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
?>
|
||||
@@ -47,9 +47,10 @@ else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
if (strlen($_GET["domain_uuid"]) > 0) {
|
||||
$domain_uuid = check_str($_GET["domain_uuid"]);
|
||||
}
|
||||
//set the domain_uuid
|
||||
if (strlen($_GET["domain_uuid"]) > 0) {
|
||||
$domain_uuid = check_str($_GET["domain_uuid"]);
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
@@ -92,7 +93,75 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
$domain_setting_order = ($domain_setting_order != '') ? $domain_setting_order : 'null';
|
||||
// fix null
|
||||
$domain_setting_order = ($domain_setting_order != '') ? $domain_setting_order : 'null';
|
||||
|
||||
//update switch timezone variables
|
||||
if ($domain_setting_category == "domain" && $domain_setting_subcategory == "time_zone" && $domain_setting_name == "name" ) {
|
||||
//get the dialplan_uuid
|
||||
$sql = "select * from v_dialplans ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and app_uuid = '9f356fe7-8cf8-4c14-8fe2-6daf89304458' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as $row) {
|
||||
$dialplan_uuid = $row["dialplan_uuid"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//get the action
|
||||
$sql = "select * from v_dialplan_details ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
|
||||
$sql .= "and dialplan_detail_tag = 'action' ";
|
||||
$sql .= "and dialplan_detail_type = 'set' ";
|
||||
$sql .= "and dialplan_detail_data like 'timezone=%' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$detail_action = "add";
|
||||
foreach ($result as $row) {
|
||||
$dialplan_detail_uuid = $row["dialplan_detail_uuid"];
|
||||
$detail_action = "update";
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//update the timezone
|
||||
if ($detail_action == "update") {
|
||||
$sql = "update v_dialplan_details ";
|
||||
$sql .= "set dialplan_detail_data = 'timezone=".$domain_setting_value."' ";
|
||||
$sql .= "where dialplan_detail_uuid = '".$dialplan_detail_uuid."' ";
|
||||
}
|
||||
else {
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$dialplan_detail_group = 0;
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_detail_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_detail_tag, ";
|
||||
$sql .= "dialplan_detail_type, ";
|
||||
$sql .= "dialplan_detail_data, ";
|
||||
$sql .= "dialplan_detail_inline, ";
|
||||
$sql .= "dialplan_detail_group ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$dialplan_detail_uuid."', ";
|
||||
$sql .= "'".$dialplan_uuid."', ";
|
||||
$sql .= "'action', ";
|
||||
$sql .= "'set', ";
|
||||
$sql .= "'timezone=".$domain_setting_value."', ";
|
||||
$sql .= "'true', ";
|
||||
$sql .= "'".$dialplan_detail_group."' ";
|
||||
$sql .= "); ";
|
||||
}
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//add the domain
|
||||
if ($action == "add" && permission_exists('domain_setting_add')) {
|
||||
|
||||
@@ -75,7 +75,7 @@ else {
|
||||
$domain->db = $db;
|
||||
$domain->set();
|
||||
|
||||
// on domain change, redirect user
|
||||
//redirect the user
|
||||
if ($_SESSION["login"]["destination"] != '') {
|
||||
// to default, or domain specific, login destination
|
||||
header("Location: ".PROJECT_PATH.$_SESSION["login"]["destination"]["url"]);
|
||||
@@ -87,10 +87,14 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/app/domains/domains.php")) {
|
||||
$href = '/app/domains/domains.php';
|
||||
}
|
||||
|
||||
//includes
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-domains'];
|
||||
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//get the http values and set them as variables
|
||||
@@ -100,24 +104,6 @@ else {
|
||||
$order = check_str($_GET["order"]);
|
||||
}
|
||||
|
||||
//show the header and the search
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' valign='top' nowrap='nowrap'><b>".$text['header-domains']."</b></td>\n";
|
||||
echo " <td width='50%' align='right' valign='top'>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
||||
echo " </form>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' valign='top' colspan='2'>\n";
|
||||
echo " ".$text['description-domains']."<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_domains ";
|
||||
if (strlen($search) > 0) {
|
||||
@@ -146,12 +132,12 @@ else {
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
//get the domains
|
||||
$sql = "select * from v_domains ";
|
||||
if (strlen($search) > 0) {
|
||||
$sql .= "where (";
|
||||
$sql .= " domain_name like '%".$search."%' ";
|
||||
$sql .= " or domain_description like '%".$search."%' ";
|
||||
$sql .= " domain_name like '%".$search."%' ";
|
||||
$sql .= " or domain_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (strlen($order_by) == 0) {
|
||||
@@ -177,6 +163,24 @@ else {
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
//show the header and the search
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' valign='top' nowrap='nowrap'><b>".$text['header-domains']."</b></td>\n";
|
||||
echo " <td width='50%' align='right' valign='top'>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
||||
echo " </form>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' valign='top' colspan='2'>\n";
|
||||
echo " ".$text['description-domains']."<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
||||
@@ -190,7 +194,6 @@ else {
|
||||
echo "</tr>\n";
|
||||
|
||||
if (count($domains) > 0) {
|
||||
global $c, $row_style, $text, $v_link_label_edit, $v_link_label_delete;
|
||||
foreach ($domains as $domain_uuid => $domain) {
|
||||
$tr_link = (permission_exists('domain_edit')) ? "href='domain_edit.php?id=".$domain_uuid."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
@@ -245,4 +248,5 @@ else {
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
@@ -9,7 +9,7 @@ $text['title-user_dashboard']['pl'] = "Panel użytkowników";
|
||||
$text['title-user_dashboard']['he'] = "ממשק משתמש";
|
||||
$text['title-user_dashboard']['uk'] = "Панель користувача";
|
||||
$text['title-user_dashboard']['sv-se'] = "Användarpanel";
|
||||
$text['title-user_dashboard']['de-at'] = "Benutzer-Übersichtsseite";
|
||||
$text['title-user_dashboard']['de-at'] = "Benutzerübersicht";
|
||||
$text['title-user_dashboard']['ro'] = "Panou control utilizator";
|
||||
$text['title-user_dashboard']['fa'] = "";
|
||||
$text['title-user_dashboard']['ar-eg'] = "الصفحه الرئيسيه للمستخدم";
|
||||
@@ -359,7 +359,7 @@ $text['label-followme']['pl'] = "Podążaj za mną";
|
||||
$text['label-followme']['he'] = "עקוב אחרי";
|
||||
$text['label-followme']['uk'] = "Follow Me";
|
||||
$text['label-followme']['sv-se'] = "Följ Mig";
|
||||
$text['label-followme']['de-at'] = "Follow Me";
|
||||
$text['label-followme']['de-at'] = "Anrufweiterschaltung";
|
||||
$text['label-followme']['ro'] = "Urmează-mă";
|
||||
$text['label-followme']['fa'] = "";
|
||||
$text['label-followme']['ar-eg'] = "خدمة اتبعني";
|
||||
@@ -457,7 +457,7 @@ $text['label-callforward']['pl'] = "Przekierowanie rozmowy";
|
||||
$text['label-callforward']['he'] = "עקוב אחרי";
|
||||
$text['label-callforward']['uk'] = "Переадресація дзвінків";
|
||||
$text['label-callforward']['sv-se'] = "Vidarekoppling";
|
||||
$text['label-callforward']['de-at'] = "Anrufweiterleitung";
|
||||
$text['label-callforward']['de-at'] = "Rufumleitung";
|
||||
$text['label-callforward']['ro'] = "Redirecționare apel";
|
||||
$text['label-callforward']['fa'] = "";
|
||||
$text['label-callforward']['ar-eg'] = "تحويل المكالمات";
|
||||
@@ -471,7 +471,7 @@ $text['header-user_dashboard']['pl'] = "Panel użytkowników";
|
||||
$text['header-user_dashboard']['he'] = "ממשק משתמש";
|
||||
$text['header-user_dashboard']['uk'] = "Панель користувача";
|
||||
$text['header-user_dashboard']['sv-se'] = "Användarpanel";
|
||||
$text['header-user_dashboard']['de-at'] = "Benutzer-Übersichtsseite";
|
||||
$text['header-user_dashboard']['de-at'] = "Benutzerübersicht";
|
||||
$text['header-user_dashboard']['ro'] = "Panou control utilizator";
|
||||
$text['header-user_dashboard']['fa'] = "";
|
||||
$text['header-user_dashboard']['ar-eg'] = "الصفحه الرئيسيه للمستخدم";
|
||||
|
||||
@@ -29,7 +29,7 @@ $apps[$x]['menu'][1]['title']['pl'] = "Panel użytkowników";
|
||||
$apps[$x]['menu'][1]['title']['he'] = "ממשק משתמש";
|
||||
$apps[$x]['menu'][1]['title']['uk'] = "Панель користувача";
|
||||
$apps[$x]['menu'][1]['title']['sv-se'] = "Användarpanel";
|
||||
$apps[$x]['menu'][1]['title']['de-at'] = "Benutzer-Übersichtsseite";
|
||||
$apps[$x]['menu'][1]['title']['de-at'] = "Benutzerübersicht";
|
||||
$apps[$x]['menu'][1]['title']['ro'] = "Panou control utilizator";
|
||||
$apps[$x]['menu'][1]['title']['ar-eg'] = "الصفحه الرئيسيه للمستخدم";
|
||||
$apps[$x]['menu'][1]['uuid'] = "92c8ffdb-3c82-4f08-aec0-82421ec41bb5";
|
||||
|
||||
@@ -651,7 +651,7 @@ $text['label-additional_info']['ro'] = "";
|
||||
$text['label-additional_info']['de-at'] = "Zusätzliche Information";
|
||||
$text['label-additional_info']['he'] = "מידע נוסף";
|
||||
|
||||
$text['header-user_manager']['en-us'] = "User Manager";
|
||||
$text['header-user_manager']['en-us'] = "Users";
|
||||
$text['header-user_manager']['es-cl'] = "Administración de Usuario";
|
||||
$text['header-user_manager']['pt-pt'] = "Gestão de Utilizadores";
|
||||
$text['header-user_manager']['fr-fr'] = "Gestion des utilisateurs";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
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-2015
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -298,12 +298,12 @@ if (count($_POST) > 0 && check_str($_POST["persistform"]) != "1") {
|
||||
echo "<table border='0' $tablewidth cellpadding='0' cellspacing='0'>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq' width='30%'>".$text['label-username']."</td>";
|
||||
echo " <td class='vtable' width='70%'><input type='text' class='formfld' autocomplete='off' name='username' value='$username'></td>";
|
||||
echo " <td class='vtable' width='70%'><input style='display:none;' type='password' name='autocomplete'><input type='text' class='formfld' autocomplete='off' name='username' value='$username'></td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>".$text['label-password']."</td>";
|
||||
echo " <td class='vtable'><input type='password' class='formfld' autocomplete='off' name='password' id='password' value='$password' onfocus='compare_passwords();' onkeyup='compare_passwords();' onblur='compare_passwords();'></td>";
|
||||
echo " <td class='vtable'><input style='display:none;' type='password' name='autocomplete'><input type='password' class='formfld' autocomplete='off' name='password' id='password' value='$password' onfocus='compare_passwords();' onkeyup='compare_passwords();' onblur='compare_passwords();'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>".$text['label-confirm_password']."</td>";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2013
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -34,6 +34,7 @@ else {
|
||||
exit;
|
||||
}
|
||||
|
||||
//additional includes
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//set the variables
|
||||
@@ -41,35 +42,6 @@ else {
|
||||
$order = check_str($_GET["order"]);
|
||||
$search_value = check_str($_REQUEST["search_value"]);
|
||||
|
||||
//page title and description
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='90%' nowrap='nowrap' valign='top'><b>".$text['header-user_manager']."</b></td>\n";
|
||||
echo "<td align='right' nowrap='nowrap'>";
|
||||
if (permission_exists('user_all')) {
|
||||
if ($_GET['showall'] == 'true') {
|
||||
echo "<input type='button' class='btn' value='".$text['button-back']."' onclick=\"window.location='index.php';\">\n";
|
||||
echo "<input type='hidden' name='showall' value='true'>";
|
||||
}
|
||||
else {
|
||||
echo "<input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='index.php?showall=true';\">\n";
|
||||
}
|
||||
}
|
||||
echo "<input type='text' class='txt' style='width: 150px; margin-right: 3px;' name='search_value' value=\"".$search_value."\">";
|
||||
echo "<input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
||||
echo "</td>";
|
||||
echo "</tr>\n";
|
||||
echo "</form>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='4'>\n";
|
||||
echo $text['description-user_manager']."\n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
//get the list of superadmins
|
||||
$superadmins = superadmin_list($db);
|
||||
|
||||
@@ -157,10 +129,39 @@ else {
|
||||
$sql .= " limit ".$rows_per_page." offset ".$offset." ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
$users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$user_count = count($users);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//page title and description
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='90%' nowrap='nowrap' valign='top'><b>".$text['header-user_manager']." (".$num_rows.")</b></td>\n";
|
||||
echo "<td align='right' nowrap='nowrap'>";
|
||||
if (permission_exists('user_all')) {
|
||||
if ($_GET['showall'] == 'true') {
|
||||
echo "<input type='button' class='btn' value='".$text['button-back']."' onclick=\"window.location='index.php';\">\n";
|
||||
echo "<input type='hidden' name='showall' value='true'>";
|
||||
}
|
||||
else {
|
||||
echo "<input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='index.php?showall=true';\">\n";
|
||||
}
|
||||
}
|
||||
echo "<input type='text' class='txt' style='width: 150px; margin-right: 3px;' name='search_value' value=\"".$search_value."\">";
|
||||
echo "<input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
||||
echo "</td>";
|
||||
echo "</tr>\n";
|
||||
echo "</form>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='4'>\n";
|
||||
echo $text['description-user_manager']."\n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
//alternate the row style
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
@@ -185,8 +186,8 @@ else {
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
if ($user_count > 0) {
|
||||
foreach($users as $row) {
|
||||
if (if_superadmin($superadmins, $row['user_uuid']) && !if_group("superadmin")) {
|
||||
//hide
|
||||
} else {
|
||||
@@ -233,7 +234,7 @@ else {
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
}
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
unset($sql, $users, $user_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
|
||||
@@ -462,7 +462,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
|
||||
echo " <td width='30%' class='vncellreq' valign='top'>".$text['label-username']."</td>";
|
||||
echo " <td width='70%' class='vtable'>";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
echo " <input type='txt' autocomplete='off' class='formfld' name='username' value='".$username."' required='required'>";
|
||||
echo " <input type='txt' class='formfld' name='username' value='".$username."' required='required'>";
|
||||
}
|
||||
else {
|
||||
echo " ".$username;
|
||||
@@ -472,7 +472,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-password']."</td>";
|
||||
echo " <td class='vtable'><input type='password' autocomplete='off' class='formfld' name='password' id='password' value='' onfocus='compare_passwords();' onkeyup='compare_passwords();' onblur='compare_passwords();'></td>";
|
||||
echo " <td class='vtable'><input style='display:none;' type='password' name='autocomplete'><input type='password' autocomplete='off' class='formfld' name='password' id='password' value='' onfocus='compare_passwords();' onkeyup='compare_passwords();' onblur='compare_passwords();'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-confirm_password']."</td>";
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
if (!function_exists('software_version')) {
|
||||
function software_version() {
|
||||
return '4.0.0';
|
||||
return '4.0.1';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -771,15 +771,13 @@ function format_string ($format, $data) {
|
||||
|
||||
//get the format and use it to format the phone number
|
||||
function format_phone($phone_number) {
|
||||
if (is_numeric($phone_number)) {
|
||||
foreach ($_SESSION["format"]["phone"] as &$format) {
|
||||
$format_count = substr_count($format, 'x');
|
||||
$format_count = $format_count + substr_count($format, 'R');
|
||||
$format_count = $format_count + substr_count($format, 'r');
|
||||
if ($format_count == strlen($phone_number)) {
|
||||
//format the number
|
||||
$phone_number = format_string($format, $phone_number);
|
||||
}
|
||||
foreach ($_SESSION["format"]["phone"] as &$format) {
|
||||
$format_count = substr_count($format, 'x');
|
||||
$format_count = $format_count + substr_count($format, 'R');
|
||||
$format_count = $format_count + substr_count($format, 'r');
|
||||
if ($format_count == strlen($phone_number)) {
|
||||
//format the number
|
||||
$phone_number = format_string($format, $phone_number);
|
||||
}
|
||||
}
|
||||
return $phone_number;
|
||||
@@ -1328,4 +1326,4 @@ function number_pad($number,$n) {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -112,6 +112,7 @@ This method causes the script to get its manadatory arguments directly from the
|
||||
--set the cache
|
||||
if (found_cid_num) then -- caller id exists
|
||||
if (found_enabled == "true") then
|
||||
--set the cache
|
||||
cache = "found_cid_num=" .. found_cid_num .. "&found_uuid=" .. found_uuid .. "&found_enabled=" .. found_enabled .. "&found_action=" .. found_action .. "&found_count=" .. found_count;
|
||||
result = trim(api:execute("memcache", "set app:call_block:" .. params["domain_name"] .. ":" .. params["cid_num"] .. " '"..cache.."' "..expire["call_block"]));
|
||||
|
||||
@@ -172,15 +173,16 @@ This method causes the script to get its manadatory arguments directly from the
|
||||
if (source == "database") then
|
||||
dbh:query("UPDATE v_call_block SET call_block_count = " .. found_count + 1 .. " WHERE call_block_uuid = '" .. found_uuid .. "'")
|
||||
end
|
||||
session:setVariable("call_block", "block")
|
||||
session:execute("set", "call_blocked=true");
|
||||
logger("W", "NOTICE", "number " .. params["cid_num"] .. " blocked with " .. found_count .. " previous hits, domain_name: " .. params["domain_name"])
|
||||
if (found_action == "Reject") then
|
||||
session:hangup("CALL_REJECTED")
|
||||
end
|
||||
if (found_action == "Busy") then
|
||||
elseif (found_action == "Busy") then
|
||||
session:hangup("USER_BUSY")
|
||||
end
|
||||
if (details[0] =="Voicemail") then
|
||||
elseif (found_action =="Hold") then
|
||||
session:setAutoHangup(false)
|
||||
session:execute("transfer", "*9664")
|
||||
elseif (details[0] =="Voicemail") then
|
||||
session:setAutoHangup(false)
|
||||
session:execute("transfer", "*99" .. details[2] .. " XML " .. details[1])
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
-- notice, this list of conditions and the following disclaimer in the
|
||||
-- documentation and/or other materials provided with the distribution.
|
||||
--
|
||||
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- THIS SOFTWARE IS PROVIDED AS ''IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
@@ -385,7 +385,7 @@
|
||||
end
|
||||
|
||||
--check if someone has already joined the conference
|
||||
local_hostname = trim(api:execute("hostname", ""));
|
||||
local_hostname = trim(api:execute("switchname", ""));
|
||||
freeswitch.consoleLog("notice", "[conference center] local_hostname is " .. local_hostname .. "\n");
|
||||
sql = "SELECT hostname FROM channels WHERE application = 'conference' AND dest = '" .. destination_number .. "' AND cid_num <> '".. caller_id_number .."' LIMIT 1";
|
||||
if (debug["sql"]) then
|
||||
|
||||
@@ -31,43 +31,69 @@
|
||||
require "resources.functions.config";
|
||||
require "resources.functions.explode";
|
||||
require "resources.functions.trim";
|
||||
require "resources.functions.base64";
|
||||
|
||||
--check the missed calls
|
||||
function missed()
|
||||
if (missed_call_app ~= nil and missed_call_data ~= nil) then
|
||||
if (missed_call_app == "email") then
|
||||
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
||||
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Email-Type":"missed"}';
|
||||
--set the sounds path for the language, dialect and voice
|
||||
default_language = session:getVariable("default_language");
|
||||
default_dialect = session:getVariable("default_dialect");
|
||||
default_voice = session:getVariable("default_voice");
|
||||
if (not default_language) then default_language = 'en'; end
|
||||
if (not default_dialect) then default_dialect = 'us'; end
|
||||
if (not default_voice) then default_voice = 'callie'; end
|
||||
|
||||
subject = "Missed Call from ${caller_id_name} <${caller_id_number}>";
|
||||
subject = subject:gsub("${caller_id_name}", caller_id_name);
|
||||
subject = subject:gsub("${caller_id_number}", caller_id_number);
|
||||
subject = subject:gsub("${sip_to_user}", sip_to_user);
|
||||
subject = subject:gsub("${dialed_user}", dialed_user);
|
||||
--prepare the files
|
||||
file_subject = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_subject.tpl";
|
||||
file_body = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_body.tpl";
|
||||
if (not file_exists(file_subject)) then
|
||||
file_subject = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_subject.tpl";
|
||||
file_body = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_body.tpl";
|
||||
end
|
||||
|
||||
--prepare the headers
|
||||
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
||||
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Email-Type":"missed"}';
|
||||
|
||||
body = "Missed Call from ${caller_id_name} <${caller_id_number}> to ${sip_to_user} ext ${dialed_user}";
|
||||
body = body:gsub("${caller_id_name}", caller_id_name);
|
||||
body = body:gsub("${caller_id_number}", caller_id_number);
|
||||
body = body:gsub("${sip_to_user}", sip_to_user);
|
||||
body = body:gsub("${dialed_user}", dialed_user);
|
||||
--prepare the subject
|
||||
local f = io.open(file_subject, "r");
|
||||
local subject = f:read("*all");
|
||||
f:close();
|
||||
subject = subject:gsub("${caller_id_name}", caller_id_name);
|
||||
subject = subject:gsub("${caller_id_number}", caller_id_number);
|
||||
subject = subject:gsub("${sip_to_user}", sip_to_user);
|
||||
subject = subject:gsub("${dialed_user}", dialed_user);
|
||||
subject = trim(subject);
|
||||
subject = '=?utf-8?B?'..base64.encode(subject)..'?=';
|
||||
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("%s+", "");
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("'", "'");
|
||||
body = body:gsub([["]], """);
|
||||
body = trim(body);
|
||||
|
||||
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'";
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n");
|
||||
end
|
||||
api = freeswitch.API();
|
||||
result = api:executeString(cmd);
|
||||
--prepare the body
|
||||
local f = io.open(file_body, "r");
|
||||
local body = f:read("*all");
|
||||
f:close();
|
||||
body = body:gsub("${caller_id_name}", caller_id_name);
|
||||
body = body:gsub("${caller_id_number}", caller_id_number);
|
||||
body = body:gsub("${sip_to_user}", sip_to_user);
|
||||
body = body:gsub("${dialed_user}", dialed_user);
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("%s+", "");
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("'", "'");
|
||||
body = body:gsub([["]], """);
|
||||
body = trim(body);
|
||||
|
||||
--send the email
|
||||
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'";
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n");
|
||||
end
|
||||
api = freeswitch.API();
|
||||
result = api:executeString(cmd);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
-- Contributor(s):
|
||||
-- Mark J. Crane
|
||||
|
||||
--set the debug options
|
||||
debug["sql"] = false;
|
||||
|
||||
--create the api object
|
||||
api = freeswitch.API();
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
require "resources.functions.config";
|
||||
require "resources.functions.explode";
|
||||
require "resources.functions.trim";
|
||||
-- require "resources.functions.file_exists";
|
||||
require "resources.functions.base64";
|
||||
require "resources.functions.file_exists";
|
||||
|
||||
--create the api object
|
||||
api = freeswitch.API();
|
||||
@@ -37,37 +38,62 @@
|
||||
function missed()
|
||||
if (missed_call_app ~= nil and missed_call_data ~= nil) then
|
||||
if (missed_call_app == "email") then
|
||||
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
||||
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Email-Type":"missed"}';
|
||||
--set the sounds path for the language, dialect and voice
|
||||
default_language = env:getHeader("default_language");
|
||||
default_dialect = env:getHeader("default_dialect");
|
||||
default_voice = env:getHeader("default_voice");
|
||||
if (not default_language) then default_language = 'en'; end
|
||||
if (not default_dialect) then default_dialect = 'us'; end
|
||||
if (not default_voice) then default_voice = 'callie'; end
|
||||
|
||||
subject = "Missed Call from ${caller_id_name} <${caller_id_number}>";
|
||||
subject = subject:gsub("${caller_id_name}", caller_id_name);
|
||||
subject = subject:gsub("${caller_id_number}", caller_id_number);
|
||||
subject = subject:gsub("${sip_to_user}", sip_to_user);
|
||||
subject = subject:gsub("${dialed_user}", dialed_user);
|
||||
--prepare the files
|
||||
file_subject = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_subject.tpl";
|
||||
file_body = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_body.tpl";
|
||||
if (not file_exists(file_subject)) then
|
||||
file_subject = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_subject.tpl";
|
||||
file_body = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_body.tpl";
|
||||
end
|
||||
|
||||
body = "Missed Call from ${caller_id_name} <${caller_id_number}> to ${sip_to_user} ext ${dialed_user}";
|
||||
body = body:gsub("${caller_id_name}", caller_id_name);
|
||||
body = body:gsub("${caller_id_number}", caller_id_number);
|
||||
body = body:gsub("${sip_to_user}", sip_to_user);
|
||||
body = body:gsub("${dialed_user}", dialed_user);
|
||||
--prepare the headers
|
||||
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
||||
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Email-Type":"missed"}';
|
||||
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("%s+", "");
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("'", "'");
|
||||
body = body:gsub([["]], """);
|
||||
body = trim(body);
|
||||
--prepare the subject
|
||||
local f = io.open(file_subject, "r");
|
||||
local subject = f:read("*all");
|
||||
f:close();
|
||||
subject = subject:gsub("${caller_id_name}", caller_id_name);
|
||||
subject = subject:gsub("${caller_id_number}", caller_id_number);
|
||||
subject = subject:gsub("${sip_to_user}", sip_to_user);
|
||||
subject = subject:gsub("${dialed_user}", dialed_user);
|
||||
subject = trim(subject);
|
||||
subject = '=?utf-8?B?'..base64.encode(subject)..'?=';
|
||||
|
||||
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'";
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n");
|
||||
end
|
||||
result = api:executeString(cmd);
|
||||
--prepare the body
|
||||
local f = io.open(file_body, "r");
|
||||
local body = f:read("*all");
|
||||
f:close();
|
||||
body = body:gsub("${caller_id_name}", caller_id_name);
|
||||
body = body:gsub("${caller_id_number}", caller_id_number);
|
||||
body = body:gsub("${sip_to_user}", sip_to_user);
|
||||
body = body:gsub("${dialed_user}", dialed_user);
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("%s+", "");
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("'", "'");
|
||||
body = body:gsub([["]], """);
|
||||
body = trim(body);
|
||||
|
||||
--send the emails
|
||||
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'";
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n");
|
||||
end
|
||||
result = api:executeString(cmd);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Missed Call from ${caller_id_name} <${caller_id_number}> to ${sip_to_user} ext ${dialed_user}
|
||||
@@ -0,0 +1 @@
|
||||
Missed Call from ${caller_id_name} <${caller_id_number}>
|
||||
@@ -121,7 +121,22 @@
|
||||
result = session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-fail_auth.wav");
|
||||
end
|
||||
|
||||
--remove the previous device and send a sync command to it
|
||||
--this device already has an alternate find the correct device_uuid and then override current one
|
||||
if (authorized == 'true' and action == "login" and device_uuid_alternate ~= nil) then
|
||||
sql = [[SELECT * FROM v_devices ]];
|
||||
sql = sql .. [[WHERE device_uuid_alternate = ']]..device_uuid..[[' ]];
|
||||
sql = sql .. [[AND domain_uuid = ']]..domain_uuid..[[' ]];
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n");
|
||||
end
|
||||
dbh:query(sql, function(row)
|
||||
if (row.device_uuid_alternate ~= nil) then
|
||||
device_uuid = row.device_uuid;
|
||||
end
|
||||
end);
|
||||
end
|
||||
|
||||
--remove the alternate device from another device so that it can be added to this device
|
||||
if (authorized == 'true' and action == "login") then
|
||||
sql = [[SELECT * FROM v_device_lines ]];
|
||||
sql = sql .. [[WHERE device_uuid = ']]..device_uuid_alternate..[[' ]];
|
||||
@@ -135,7 +150,7 @@
|
||||
sql = sql .. [[WHERE device_uuid_alternate = ']]..device_uuid_alternate..[[' ]];
|
||||
sql = sql .. [[AND domain_uuid = ']]..domain_uuid..[[' ]];
|
||||
if (debug["sql"]) then
|
||||
--freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n");
|
||||
freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n");
|
||||
end
|
||||
dbh:query(sql);
|
||||
--send a sync command to the previous device
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
-- notice, this list of conditions and the following disclaimer in the
|
||||
-- documentation and/or other materials provided with the distribution.
|
||||
--
|
||||
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
@@ -27,6 +27,8 @@
|
||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- Luis Daniel Lucio Qurioz <dlucio@okay.com.mx>
|
||||
|
||||
local log = require "resources.functions.log".ring_group
|
||||
|
||||
--connect to the database
|
||||
require "resources.functions.database_handle";
|
||||
dbh = database_handle('system');
|
||||
@@ -34,6 +36,9 @@
|
||||
--include functions
|
||||
require "resources.functions.trim";
|
||||
require "resources.functions.explode";
|
||||
require "resources.functions.base64";
|
||||
require "resources.functions.file_exists";
|
||||
require "resources.functions.channel_utils"
|
||||
|
||||
--get the variables
|
||||
domain_name = session:getVariable("domain_name");
|
||||
@@ -97,6 +102,7 @@
|
||||
status = dbh:query(sql, function(row)
|
||||
domain_uuid = row["domain_uuid"];
|
||||
ring_group_name = row["ring_group_name"];
|
||||
ring_group_extension = row["ring_group_extension"];
|
||||
ring_group_forward_enabled = row["ring_group_forward_enabled"];
|
||||
ring_group_forward_destination = row["ring_group_forward_destination"];
|
||||
ring_group_cid_name_prefix = row["ring_group_cid_name_prefix"];
|
||||
@@ -119,36 +125,67 @@
|
||||
function missed()
|
||||
if (missed_call_app ~= nil and missed_call_data ~= nil) then
|
||||
if (missed_call_app == "email") then
|
||||
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
||||
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Email-Type":"missed"}';
|
||||
--set the sounds path for the language, dialect and voice
|
||||
default_language = session:getVariable("default_language");
|
||||
default_dialect = session:getVariable("default_dialect");
|
||||
default_voice = session:getVariable("default_voice");
|
||||
if (not default_language) then default_language = 'en'; end
|
||||
if (not default_dialect) then default_dialect = 'us'; end
|
||||
if (not default_voice) then default_voice = 'callie'; end
|
||||
|
||||
subject = "Missed Call from ${caller_id_name} <${caller_id_number}> ${ring_group_name}";
|
||||
subject = subject:gsub("${caller_id_name}", caller_id_name);
|
||||
subject = subject:gsub("${caller_id_number}", caller_id_number);
|
||||
subject = subject:gsub("${ring_group_name}", ring_group_name);
|
||||
--prepare the files
|
||||
file_subject = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_subject.tpl";
|
||||
file_body = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_body.tpl";
|
||||
if (not file_exists(file_subject)) then
|
||||
file_subject = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_subject.tpl";
|
||||
file_body = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_body.tpl";
|
||||
end
|
||||
|
||||
body = "Missed Call from ${caller_id_name} <${caller_id_number}> to ${ring_group_name}";
|
||||
body = body:gsub("${caller_id_name}", caller_id_name);
|
||||
body = body:gsub("${caller_id_number}", caller_id_number);
|
||||
body = body:gsub("${ring_group_name}", ring_group_name);
|
||||
--prepare the headers
|
||||
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
||||
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Email-Type":"missed"}';
|
||||
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("%s+", "");
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("'", "'");
|
||||
body = body:gsub([["]], """);
|
||||
body = trim(body);
|
||||
--prepare the subject
|
||||
local f = io.open(file_subject, "r");
|
||||
local subject = f:read("*all");
|
||||
f:close();
|
||||
subject = subject:gsub("${caller_id_name}", caller_id_name);
|
||||
subject = subject:gsub("${caller_id_number}", caller_id_number);
|
||||
subject = subject:gsub("${ring_group_name}", ring_group_name);
|
||||
subject = subject:gsub("${ring_group_extension}", ring_group_extension);
|
||||
subject = subject:gsub("${sip_to_user}", ring_group_name);
|
||||
subject = subject:gsub("${dialed_user}", ring_group_extension);
|
||||
subject = trim(subject);
|
||||
subject = '=?utf-8?B?'..base64.encode(subject)..'?=';
|
||||
|
||||
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'";
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n");
|
||||
end
|
||||
api = freeswitch.API();
|
||||
result = api:executeString(cmd);
|
||||
--prepare the body
|
||||
local f = io.open(file_body, "r");
|
||||
local body = f:read("*all");
|
||||
f:close();
|
||||
body = body:gsub("${caller_id_name}", caller_id_name);
|
||||
body = body:gsub("${caller_id_number}", caller_id_number);
|
||||
body = body:gsub("${ring_group_name}", ring_group_name);
|
||||
body = body:gsub("${ring_group_extension}", ring_group_extension);
|
||||
body = body:gsub("${sip_to_user}", ring_group_name);
|
||||
body = body:gsub("${dialed_user}", ring_group_extension);
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("%s+", "");
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("'", "'");
|
||||
body = body:gsub([["]], """);
|
||||
body = trim(body);
|
||||
|
||||
--send the email
|
||||
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'";
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n");
|
||||
end
|
||||
api = freeswitch.API();
|
||||
result = api:executeString(cmd);
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -158,6 +195,31 @@
|
||||
--forward the ring group
|
||||
session:execute("transfer", ring_group_forward_destination.." XML "..context);
|
||||
else
|
||||
--get the strategy of the ring group, if random, we use random() to order the destinations
|
||||
sql = [[
|
||||
SELECT
|
||||
r.ring_group_strategy
|
||||
FROM
|
||||
v_ring_groups as r
|
||||
WHERE
|
||||
ring_group_uuid = ']]..ring_group_uuid..[['
|
||||
AND r.domain_uuid = ']]..domain_uuid..[['
|
||||
AND r.ring_group_enabled = 'true'
|
||||
]];
|
||||
|
||||
|
||||
assert(dbh:query(sql, function(row)
|
||||
if (row.ring_group_strategy == "random") then
|
||||
if (database["type"] == "mysql") then
|
||||
sql_order = 'rand()'
|
||||
else
|
||||
sql_order = 'random()' --both postgresql and sqlite uses random() instead of rand()
|
||||
end
|
||||
else
|
||||
sql_order='d.destination_delay, d.destination_number asc'
|
||||
end
|
||||
end));
|
||||
|
||||
--get the ring group destinations
|
||||
sql = [[
|
||||
SELECT
|
||||
@@ -172,7 +234,7 @@
|
||||
AND r.domain_uuid = ']]..domain_uuid..[['
|
||||
AND r.ring_group_enabled = 'true'
|
||||
ORDER BY
|
||||
d.destination_delay, d.destination_number asc
|
||||
]]..sql_order..[[
|
||||
]];
|
||||
--freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
|
||||
destinations = {};
|
||||
@@ -291,6 +353,9 @@
|
||||
if (ring_group_strategy == "sequence") then
|
||||
delimiter = "|";
|
||||
end
|
||||
if (ring_group_strategy == "random") then
|
||||
delimiter = "|";
|
||||
end
|
||||
if (ring_group_strategy == "simultaneous") then
|
||||
delimiter = ",";
|
||||
end
|
||||
@@ -374,23 +439,10 @@
|
||||
extension_uuid = trim(api:executeString(cmd));
|
||||
--send to user
|
||||
local dial_string_to_user = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid .. row.record_session .. "]user/" .. row.destination_number .. "@" .. domain_name;
|
||||
if (ring_group_skip_active ~= nil) then
|
||||
if (ring_group_skip_active == "true") then
|
||||
cmd = "show channels like "..destination_number;
|
||||
reply = trim(api:executeString(cmd));
|
||||
--freeswitch.consoleLog("notice", "[ring group] reply "..cmd.." " .. reply .. "\n");
|
||||
if (reply == "0 total.") then
|
||||
dial_string = dial_string_to_user
|
||||
else
|
||||
if (string.find(reply, domain_name)) then
|
||||
--active call
|
||||
else
|
||||
dial_string = dial_string_to_user;
|
||||
end
|
||||
end
|
||||
else
|
||||
--look inside the reply to check for the correct domain_name
|
||||
dial_string = dial_string_to_user;
|
||||
if (ring_group_skip_active == "true") then
|
||||
local channels = channels_by_number(destination_number, domain_name)
|
||||
if (not channels) or #channels == 0 then
|
||||
dial_string = dial_string_to_user
|
||||
end
|
||||
else
|
||||
dial_string = dial_string_to_user;
|
||||
@@ -562,23 +614,27 @@
|
||||
app_data = app_data:gsub("%]", "}");
|
||||
end
|
||||
freeswitch.consoleLog("NOTICE", "[ring group] app_data: "..app_data.."\n");
|
||||
-- log.noticef("bridge begin: originate_disposition:%s answered:%s ready:%s bridged:%s", session:getVariable("originate_disposition"), session:answered() and "true" or "false", session:ready() and "true" or "false", session:bridged() and "true" or "false")
|
||||
session:execute("bridge", app_data);
|
||||
-- log.noticef("bridge done: originate_disposition:%s answered:%s ready:%s bridged:%s", session:getVariable("originate_disposition"), session:answered() and "true" or "false", session:ready() and "true" or "false", session:bridged() and "true" or "false")
|
||||
end
|
||||
|
||||
--timeout destination
|
||||
if (app_data ~= nil) then
|
||||
if (session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
|
||||
if session:ready() and (
|
||||
session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
|
||||
or session:getVariable("originate_disposition") == "NO_ANSWER"
|
||||
or session:getVariable("originate_disposition") == "NO_USER_RESPONSE"
|
||||
or session:getVariable("originate_disposition") == "USER_NOT_REGISTERED"
|
||||
or session:getVariable("originate_disposition") == "NORMAL_TEMPORARY_FAILURE"
|
||||
or session:getVariable("originate_disposition") == "NO_ROUTE_DESTINATION"
|
||||
or session:getVariable("originate_disposition") == "USER_BUSY"
|
||||
or session:getVariable("originate_disposition") == "failure") then
|
||||
--send missed call notification
|
||||
missed();
|
||||
--execute the time out action
|
||||
session:execute(ring_group_timeout_app, ring_group_timeout_data);
|
||||
or session:getVariable("originate_disposition") == "failure"
|
||||
) then
|
||||
--send missed call notification
|
||||
missed();
|
||||
--execute the time out action
|
||||
session:execute(ring_group_timeout_app, ring_group_timeout_data);
|
||||
end
|
||||
else
|
||||
if (ring_group_timeout_app ~= nil) then
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
skip_instructions = session:getVariable("skip_instructions");
|
||||
skip_greeting = session:getVariable("skip_greeting");
|
||||
vm_message_ext = session:getVariable("vm_message_ext");
|
||||
vm_say_caller_id_number = session:getVariable("vm_say_caller_id_number");
|
||||
vm_disk_quota = session:getVariable("vm-disk-quota");
|
||||
if (not vm_disk_quota) then
|
||||
vm_disk_quota = session:getVariable("vm_disk_quota");
|
||||
|
||||
@@ -31,20 +31,34 @@
|
||||
max_digits = 1;
|
||||
--flush dtmf digits from the input buffer
|
||||
session:flushDigits();
|
||||
--set the callback function
|
||||
if (session:ready()) then
|
||||
session:setVariable("playback_terminators", "#");
|
||||
session:setInputCallback("on_dtmf", "");
|
||||
end
|
||||
--set the display
|
||||
if (session:ready()) then
|
||||
reply = api:executeString("uuid_display "..session:get_uuid().." "..caller_id_number);
|
||||
end
|
||||
--say the message number
|
||||
if (session:ready()) then
|
||||
if (string.len(dtmf_digits) == 0) then
|
||||
if (string.len(dtmf_digits) == 0) then
|
||||
dtmf_digits = macro(session, "message_number", 1, 100, '');
|
||||
end
|
||||
end
|
||||
--say the number
|
||||
if (session:ready()) then
|
||||
if (string.len(dtmf_digits) == 0) then
|
||||
session:say(message_number, default_language, "NUMBER", "pronounced");
|
||||
session:say(message_number, default_language, "number", "pronounced");
|
||||
end
|
||||
end
|
||||
--say the caller id number
|
||||
if (session:ready() and caller_id_number ~= nil) then
|
||||
if (vm_say_caller_id_number ~= nil) then
|
||||
if (vm_say_caller_id_number == "true") then
|
||||
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-message_from.wav");
|
||||
session:say(caller_id_number, default_language, "name_spelled", "iterated");
|
||||
end
|
||||
end
|
||||
end
|
||||
--say the message date
|
||||
@@ -53,10 +67,9 @@
|
||||
if (current_time_zone ~= nil) then
|
||||
session:execute("set", "timezone="..current_time_zone.."");
|
||||
end
|
||||
session:say(created_epoch, default_language, "CURRENT_DATE_TIME", "pronounced");
|
||||
session:say(created_epoch, default_language, "current_date_time", "pronounced");
|
||||
end
|
||||
end
|
||||
|
||||
--get the recordings from the database
|
||||
if (storage_type == "base64") then
|
||||
sql = [[SELECT * FROM v_voicemail_messages
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
sql = [[SELECT extension, number_alias from v_extensions
|
||||
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
||||
AND (mwi_account = ']]..voicemail_id..[[' or mwi_account = ']]..voicemail_id..[[@]]..domain_name..[[')]];
|
||||
--if (debug["sql"]) then
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
|
||||
--end
|
||||
end
|
||||
status = dbh:query(sql, function(row)
|
||||
if (string.len(row["number_alias"]) > 0) then
|
||||
table.insert(accounts, row["number_alias"]);
|
||||
@@ -74,4 +74,4 @@
|
||||
event:addHeader("MWI-Voice-Message", message_count.."/0 ("..message_count.."/0)");
|
||||
event:fire();
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user