diff --git a/app/call_block/app_config.php b/app/call_block/app_config.php index 66240bd553..4d5af2cadc 100644 --- a/app/call_block/app_config.php +++ b/app/call_block/app_config.php @@ -99,6 +99,10 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary"; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "call_block_direction"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select the direction of the calls to block."; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "extension_uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; @@ -113,11 +117,15 @@ $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the name."; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "call_block_country_code"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the country code."; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "call_block_number"; $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "blocked_caller_number"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the full phone number."; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the phone number."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "call_block_count"; $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "blocked_call_count"; diff --git a/app/call_block/app_defaults.php b/app/call_block/app_defaults.php index ad9a9495fb..56c8d4c733 100644 --- a/app/call_block/app_defaults.php +++ b/app/call_block/app_defaults.php @@ -30,8 +30,8 @@ if ($domains_processed == 1) { $database = new database; $database->execute("DROP VIEW view_call_block;", null); $sql = "CREATE VIEW view_call_block AS ( \n"; - $sql .= " select c.domain_uuid, call_block_uuid, c.extension_uuid, call_block_name, \n"; - $sql .= " call_block_number, extension, number_alias, call_block_count, call_block_app, call_block_data, date_added, call_block_enabled, call_block_description \n"; + $sql .= " select c.domain_uuid, call_block_uuid, c.call_block_direction, c.extension_uuid, c.call_block_name, c.call_block_country_code, \n"; + $sql .= " c.call_block_number, e.extension, e.number_alias, c.call_block_count, c.call_block_app, c.call_block_data, c.date_added, c.call_block_enabled, c.call_block_description \n"; $sql .= " from v_call_block as c \n"; $sql .= " left join v_extensions as e \n"; $sql .= " on c.extension_uuid = e.extension_uuid \n"; diff --git a/app/call_block/app_languages.php b/app/call_block/app_languages.php index 69c914bac4..eba6287e68 100644 --- a/app/call_block/app_languages.php +++ b/app/call_block/app_languages.php @@ -177,6 +177,27 @@ $text['label-provide-enabled']['ru-ru'] = "Пожалуйста, введите: $text['label-provide-enabled']['sv-se'] = "Ange: Aktiverad"; $text['label-provide-enabled']['uk-ua'] = "Включити/відключити"; +$text['label-country_code']['en-us'] = "Country Code"; +$text['label-country_code']['en-gb'] = "Country Code"; +$text['label-country_code']['ar-eg'] = ""; +$text['label-country_code']['de-at'] = ""; //copied from de-de +$text['label-country_code']['de-ch'] = ""; //copied from de-de +$text['label-country_code']['de-de'] = ""; +$text['label-country_code']['es-cl'] = ""; +$text['label-country_code']['es-mx'] = ""; //copied from es-cl +$text['label-country_code']['fr-ca'] = "Préfixe"; //copied from fr-fr +$text['label-country_code']['fr-fr'] = "Préfixe"; +$text['label-country_code']['he-il'] = ""; +$text['label-country_code']['it-it'] = ""; +$text['label-country_code']['nl-nl'] = "Voorloop"; +$text['label-country_code']['pl-pl'] = ""; +$text['label-country_code']['pt-br'] = "Prefixo"; //copied from pt-pt +$text['label-country_code']['pt-pt'] = ""; +$text['label-country_code']['ro-ro'] = ""; +$text['label-country_code']['ru-ru'] = ""; +$text['label-country_code']['sv-se'] = ""; +$text['label-country_code']['uk-ua'] = ""; + $text['label-number']['en-us'] = "Number"; $text['label-number']['en-gb'] = "Number"; $text['label-number']['ar-eg'] = "رقم"; @@ -265,6 +286,48 @@ $text['label-inbound']['ru-ru'] = "Входящий"; $text['label-inbound']['sv-se'] = "Inkommande"; $text['label-inbound']['uk-ua'] = "Вихідний"; +$text['label-outbound']['en-us'] = "Outbound"; +$text['label-outbound']['en-gb'] = "Outbound"; +$text['label-outbound']['ar-eg'] = ""; +$text['label-outbound']['de-at'] = "Ausgehend"; //copied from de-de +$text['label-outbound']['de-ch'] = "Ausgehend"; //copied from de-de +$text['label-outbound']['de-de'] = "Ausgehend"; +$text['label-outbound']['es-cl'] = "Salida"; +$text['label-outbound']['es-mx'] = "Salida"; //copied from es-cl +$text['label-outbound']['fr-ca'] = "Sortant"; //copied from fr-fr +$text['label-outbound']['fr-fr'] = "Sortant"; +$text['label-outbound']['he-il'] = ""; +$text['label-outbound']['it-it'] = "In Uscita"; +$text['label-outbound']['nl-nl'] = ""; +$text['label-outbound']['pl-pl'] = "Wychodzące"; +$text['label-outbound']['pt-br'] = "Saída"; //copied from pt-pt +$text['label-outbound']['pt-pt'] = "Saída"; +$text['label-outbound']['ro-ro'] = ""; +$text['label-outbound']['ru-ru'] = "Исходящие"; +$text['label-outbound']['sv-se'] = "Utgående"; +$text['label-outbound']['uk-ua'] = ""; + +$text['label-destination']['en-us'] = "Destination"; +$text['label-destination']['en-gb'] = "Destination"; +$text['label-destination']['ar-eg'] = ""; +$text['label-destination']['de-at'] = "Ziel"; //copied from de-de +$text['label-destination']['de-ch'] = "Ziel"; //copied from de-de +$text['label-destination']['de-de'] = "Ziel"; +$text['label-destination']['es-cl'] = "Destino"; +$text['label-destination']['es-mx'] = "Destino"; //copied from es-cl +$text['label-destination']['fr-ca'] = "Destination"; //copied from fr-fr +$text['label-destination']['fr-fr'] = "Destination"; +$text['label-destination']['he-il'] = ""; +$text['label-destination']['it-it'] = "Destinazione"; +$text['label-destination']['nl-nl'] = ""; +$text['label-destination']['pl-pl'] = "Numer docelowy"; +$text['label-destination']['pt-br'] = "Número de destino"; +$text['label-destination']['pt-pt'] = "Destino"; +$text['label-destination']['ro-ro'] = ""; +$text['label-destination']['ru-ru'] = "Назначение"; +$text['label-destination']['sv-se'] = "Destination"; +$text['label-destination']['uk-ua'] = "Номер"; + $text['label-edit-note']['en-us'] = "Block calls from a number. Edit the name and enable/disable below."; $text['label-edit-note']['en-gb'] = "Block calls from a number. Edit the name and enable/disable below."; $text['label-edit-note']['ar-eg'] = ""; @@ -419,27 +482,27 @@ $text['label-count']['ru-ru'] = "Количество"; $text['label-count']['sv-se'] = "Räkna"; $text['label-count']['uk-ua'] = "Кількість"; -$text['label-called-on']['en-us'] = "Called on"; -$text['label-called-on']['en-gb'] = "Called on"; -$text['label-called-on']['ar-eg'] = "تم الأتصال علي"; -$text['label-called-on']['de-at'] = "Anruf am"; //copied from de-de -$text['label-called-on']['de-ch'] = "Anruf am"; //copied from de-de -$text['label-called-on']['de-de'] = "Anruf am"; -$text['label-called-on']['el-gr'] = "Η κλήση πραγματοποιήθηκε"; -$text['label-called-on']['es-cl'] = "Llamó en"; -$text['label-called-on']['es-mx'] = "Llamó en"; //copied from es-cl -$text['label-called-on']['fr-ca'] = "Appelé le"; //copied from fr-fr -$text['label-called-on']['fr-fr'] = "Appelé le"; -$text['label-called-on']['he-il'] = "Opgeroepen op"; -$text['label-called-on']['it-it'] = "Chiamato il"; -$text['label-called-on']['nl-nl'] = "Aangeroepen op"; -$text['label-called-on']['pl-pl'] = "Zadzwoniono na"; -$text['label-called-on']['pt-br'] = "Chamada em "; -$text['label-called-on']['pt-pt'] = "Chamado em"; -$text['label-called-on']['ro-ro'] = "Sunat pe"; -$text['label-called-on']['ru-ru'] = "Направление"; -$text['label-called-on']['sv-se'] = "Ringdes på"; -$text['label-called-on']['uk-ua'] = "Дзвінок здійснено"; +$text['label-called']['en-us'] = "Called"; +$text['label-called']['en-gb'] = "Called"; +$text['label-called']['ar-eg'] = "تم الأتصال علي"; +$text['label-called']['de-at'] = "Anruf"; //copied from de-de +$text['label-called']['de-ch'] = "Anruf"; //copied from de-de +$text['label-called']['de-de'] = "Anruf"; +$text['label-called']['el-gr'] = "Η κλήση πραγματοποιήθηκε"; +$text['label-called']['es-cl'] = "Llamó"; +$text['label-called']['es-mx'] = "Llamó"; //copied from es-cl +$text['label-called']['fr-ca'] = "Appelé"; //copied from fr-fr +$text['label-called']['fr-fr'] = "Appelé"; +$text['label-called']['he-il'] = "Opgeroepen"; +$text['label-called']['it-it'] = "Chiamato"; +$text['label-called']['nl-nl'] = "Aangeroepen"; +$text['label-called']['pl-pl'] = "Zadzwoniono"; +$text['label-called']['pt-br'] = "Chamada"; +$text['label-called']['pt-pt'] = "Chamado"; +$text['label-called']['ro-ro'] = "Sunat"; +$text['label-called']['ru-ru'] = "Направление"; +$text['label-called']['sv-se'] = "Ringdes"; +$text['label-called']['uk-ua'] = "Дзвінок здійснено"; $text['label-busy']['en-us'] = "Busy"; $text['label-busy']['en-gb'] = "Busy"; @@ -573,6 +636,49 @@ $text['label-action']['ru-ru'] = "Действие"; $text['label-action']['sv-se'] = "Åtgärd"; $text['label-action']['uk-ua'] = "Дія"; +$text['label-direction']['en-us'] = "Direction"; +$text['label-direction']['en-gb'] = "Direction"; +$text['label-direction']['ar-eg'] = ""; +$text['label-direction']['de-at'] = "Richtung"; //copied from de-de +$text['label-direction']['de-ch'] = "Richtung"; //copied from de-de +$text['label-direction']['de-de'] = "Richtung"; +$text['label-direction']['es-cl'] = "Dirección"; +$text['label-direction']['es-mx'] = "Dirección"; //copied from es-cl +$text['label-direction']['fr-ca'] = "Direction"; //copied from fr-fr +$text['label-direction']['fr-fr'] = "Direction"; +$text['label-direction']['he-il'] = ""; +$text['label-direction']['it-it'] = "Direzione"; +$text['label-direction']['nl-nl'] = ""; +$text['label-direction']['pl-pl'] = "Kierunek"; +$text['label-direction']['pt-br'] = "Direção"; +$text['label-direction']['pt-pt'] = "Direcção"; +$text['label-direction']['ro-ro'] = ""; +$text['label-direction']['ru-ru'] = "Направление"; +$text['label-direction']['sv-se'] = "Riktning"; +$text['label-direction']['uk-ua'] = "Напрям"; + +$text['description-direction']['en-us'] = "Select the direction of the calls to block."; +$text['description-direction']['en-gb'] = "Select the direction of the calls to block."; +$text['description-direction']['ar-eg'] = "Select the direction of the calls to block."; +$text['description-direction']['de-at'] = "Select the direction of the calls to block."; +$text['description-direction']['de-ch'] = "Select the direction of the calls to block."; +$text['description-direction']['de-de'] = "Select the direction of the calls to block."; +$text['description-direction']['el-gr'] = "Select the direction of the calls to block."; +$text['description-direction']['es-cl'] = "Select the direction of the calls to block."; +$text['description-direction']['es-mx'] = "Select the direction of the calls to block."; +$text['description-direction']['fr-ca'] = "Select the direction of the calls to block."; +$text['description-direction']['fr-fr'] = "Select the direction of the calls to block."; +$text['description-direction']['he-il'] = "Select the direction of the calls to block."; +$text['description-direction']['it-it'] = "Select the direction of the calls to block."; +$text['description-direction']['nl-nl'] = "Select the direction of the calls to block."; +$text['description-direction']['pl-pl'] = "Select the direction of the calls to block."; +$text['description-direction']['pt-br'] = "Select the direction of the calls to block."; +$text['description-direction']['pt-pt'] = "Select the direction of the calls to block."; +$text['description-direction']['ro-ro'] = "Select the direction of the calls to block."; +$text['description-direction']['ru-ru'] = "Select the direction of the calls to block."; +$text['description-direction']['sv-se'] = "Select the direction of the calls to block."; +$text['description-direction']['uk-ua'] = "Select the direction of the calls to block."; + $text['description-call_block_name']['en-us'] = "Enter the Caller ID Name to block."; $text['description-call_block_name']['en-gb'] = "Enter the Caller ID Name to block."; $text['description-call_block_name']['ar-eg'] = ""; @@ -595,8 +701,29 @@ $text['description-call_block_name']['ru-ru'] = ""; $text['description-call_block_name']['sv-se'] = ""; $text['description-call_block_name']['uk-ua'] = ""; -$text['description-call_block_number']['en-us'] = "Enter the Caller ID Number to block."; -$text['description-call_block_number']['en-gb'] = "Enter the Caller ID Number to block."; +$text['description-country_code']['en-us'] = "Enter the Country Code prefix."; +$text['description-country_code']['en-gb'] = "Enter the Country Code prefix."; +$text['description-country_code']['ar-eg'] = ""; +$text['description-country_code']['de-at'] = ""; //copied from de-de +$text['description-country_code']['de-ch'] = ""; //copied from de-de +$text['description-country_code']['de-de'] = ""; +$text['description-country_code']['es-cl'] = ""; +$text['description-country_code']['es-mx'] = ""; //copied from es-cl +$text['description-country_code']['fr-ca'] = "Entrez le préfixe de destination."; //copied from fr-fr +$text['description-country_code']['fr-fr'] = "Entrez le préfixe de destination."; +$text['description-country_code']['he-il'] = ""; +$text['description-country_code']['it-it'] = ""; +$text['description-country_code']['nl-nl'] = "Voer de bestemming prefix in."; +$text['description-country_code']['pl-pl'] = ""; +$text['description-country_code']['pt-br'] = "Insira o prefixo do destino."; +$text['description-country_code']['pt-pt'] = ""; +$text['description-country_code']['ro-ro'] = ""; +$text['description-country_code']['ru-ru'] = ""; +$text['description-country_code']['sv-se'] = ""; +$text['description-country_code']['uk-ua'] = ""; + +$text['description-call_block_number']['en-us'] = "Enter the Country Code and Caller ID Number to block."; +$text['description-call_block_number']['en-gb'] = "Enter the Country Code and Caller ID Number to block."; $text['description-call_block_number']['ar-eg'] = ""; $text['description-call_block_number']['de-at'] = ""; $text['description-call_block_number']['de-ch'] = ""; @@ -617,8 +744,8 @@ $text['description-call_block_number']['ru-ru'] = ""; $text['description-call_block_number']['sv-se'] = ""; $text['description-call_block_number']['uk-ua'] = ""; -$text['description-extension']['en-us'] = "Select the extension to block."; -$text['description-extension']['en-gb'] = "Select the extension to block."; +$text['description-extension']['en-us'] = "Select the extension to be affected."; +$text['description-extension']['en-gb'] = "Select the extension to be affected."; $text['description-extension']['ar-eg'] = ""; $text['description-extension']['de-at'] = ""; $text['description-extension']['de-ch'] = ""; diff --git a/app/call_block/call_block.php b/app/call_block/call_block.php index bba27639d1..a4ab54e559 100644 --- a/app/call_block/call_block.php +++ b/app/call_block/call_block.php @@ -83,6 +83,7 @@ if (strlen($search) > 0) { $sql_search = " ("; $sql_search .= "lower(call_block_name) like :search "; + $sql_search .= "or call_block_country_code like :search "; $sql_search .= "or lower(call_block_number) like :search "; $sql_search .= "or lower(call_block_description) like :search "; $sql_search .= ") "; @@ -136,7 +137,7 @@ if (isset($sql_search)) { $sql .= "and ".$sql_search; } - $sql .= order_by($order_by, $order, 'call_block_number'); + $sql .= order_by($order_by, $order, ['call_block_country_code','call_block_number']); $sql .= limit_offset($rows_per_page, $offset); $database = new database; $result = $database->select($sql, $parameters, 'all'); @@ -202,8 +203,10 @@ echo " \n"; echo " \n"; } - echo th_order_by('extension', $text['label-extension'], $order_by, $order); + echo th_order_by('call_block_direction', $text['label-direction'], $order_by, $order, null, "style='width: 1%;' class='center'"); + echo th_order_by('extension', $text['label-extension'], $order_by, $order, null, "class='center'"); echo th_order_by('call_block_name', $text['label-name'], $order_by, $order); + echo th_order_by('call_block_country_code', $text['label-country_code'], $order_by, $order); echo th_order_by('call_block_number', $text['label-number'], $order_by, $order); echo th_order_by('call_block_count', $text['label-count'], $order_by, $order, '', "class='center hide-sm-dn'"); echo th_order_by('call_block_action', $text['label-action'], $order_by, $order); @@ -228,7 +231,13 @@ echo " \n"; echo " \n"; } - echo " "; + echo " "; + switch ($row['call_block_direction']) { + case "inbound": echo "\n"; break; + case "outbound": echo "\n"; break; + } + echo " \n"; + echo " "; if (strlen($row['extension']) == 0) { echo $text['label-all']; } @@ -238,6 +247,14 @@ echo " \n"; echo " ".escape($row['call_block_name'])."\n"; echo " "; + if (permission_exists('call_block_edit')) { + echo "".escape($row['call_block_country_code']).""; + } + else { + echo escape($row['call_block_country_code']); + } + echo " \n"; + echo " "; if (permission_exists('call_block_edit')) { echo "".escape(format_phone($row['call_block_number'])).""; } @@ -280,4 +297,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/call_block/call_block_edit.php b/app/call_block/call_block_edit.php index 33e6581b43..29f43c779c 100644 --- a/app/call_block/call_block_edit.php +++ b/app/call_block/call_block_edit.php @@ -52,8 +52,10 @@ //get http post variables and set them to php variables if (count($_POST) > 0) { + $call_block_direction = $_POST["call_block_direction"]; $extension_uuid = $_POST["extension_uuid"]; $call_block_name = $_POST["call_block_name"]; + $call_block_country_code = $_POST["call_block_country_code"]; $call_block_number = $_POST["call_block_number"]; $call_block_enabled = $_POST["call_block_enabled"]; $call_block_description = $_POST["call_block_description"]; @@ -83,6 +85,7 @@ $xml_cdrs = $_POST['xml_cdrs']; if (permission_exists('call_block_add') && is_array($xml_cdrs) && @sizeof($xml_cdrs) != 0) { $obj = new call_block; + $obj->call_block_direction = $call_block_direction; $obj->extension_uuid = $extension_uuid; $obj->call_block_app = $call_block_app; $obj->call_block_data = $call_block_data; @@ -160,10 +163,12 @@ if ($action == "add") { $array['call_block'][0]['call_block_uuid'] = uuid(); $array['call_block'][0]['domain_uuid'] = $_SESSION['domain_uuid']; + $array['call_block'][0]['call_block_direction'] = $call_block_direction; if (is_uuid($extension_uuid)) { $array['call_block'][0]['extension_uuid'] = $extension_uuid; } $array['call_block'][0]['call_block_name'] = $call_block_name; + $array['call_block'][0]['call_block_country_code'] = $call_block_country_code; $array['call_block'][0]['call_block_number'] = $call_block_number; $array['call_block'][0]['call_block_count'] = 0; $array['call_block'][0]['call_block_app'] = $call_block_app; @@ -184,7 +189,7 @@ return; } if ($action == "update") { - $sql = "select c.call_block_number, d.domain_name "; + $sql = "select c.call_block_country_code, c.call_block_number, d.domain_name "; $sql .= "from v_call_block as c "; $sql .= "join v_domains as d on c.domain_uuid = d.domain_uuid "; $sql .= "where c.domain_uuid = :domain_uuid "; @@ -199,16 +204,18 @@ //clear the cache $cache = new cache; - $cache->delete("app:call_block:".$domain_name.":".$call_block_number); + $cache->delete("app:call_block:".$domain_name.":".$call_block_country_code.$call_block_number); } unset($sql, $parameters); $array['call_block'][0]['call_block_uuid'] = $call_block_uuid; $array['call_block'][0]['domain_uuid'] = $_SESSION['domain_uuid']; + $array['call_block'][0]['call_block_direction'] = $call_block_direction; if (is_uuid($extension_uuid)) { $array['call_block'][0]['extension_uuid'] = $extension_uuid; } $array['call_block'][0]['call_block_name'] = $call_block_name; + $array['call_block'][0]['call_block_country_code'] = $call_block_country_code; $array['call_block'][0]['call_block_number'] = $call_block_number; $array['call_block'][0]['call_block_app'] = $call_block_app; $array['call_block'][0]['call_block_data'] = $call_block_data; @@ -241,8 +248,10 @@ $database = new database; $row = $database->select($sql, $parameters, 'row'); if (is_array($row) && sizeof($row) != 0) { + $call_block_direction = $row["call_block_direction"]; $extension_uuid = $row["extension_uuid"]; $call_block_name = $row["call_block_name"]; + $call_block_country_code = $row["call_block_country_code"]; $call_block_number = $row["call_block_number"]; $call_block_app = $row["call_block_app"]; $call_block_data = $row["call_block_data"]; @@ -318,6 +327,21 @@ echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + if (permission_exists('call_block_all')) { echo "\n"; echo "\n"; echo "
\n"; + echo " ".$text['label-direction']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-direction']."\n"; + echo "\n"; + echo "
\n"; @@ -356,6 +380,7 @@ echo " ".$text['label-number']."\n"; echo "\n"; + echo " \n"; echo " \n"; echo "
\n"; echo $text['description-call_block_number']."\n"; @@ -460,57 +485,49 @@ //get recent calls from the db (if not editing an existing call block record) if (!is_uuid($_REQUEST["id"])) { - if (permission_exists('call_block_all')) { - $sql = "select caller_id_number, caller_id_name, caller_id_number, start_epoch, direction, hangup_cause, duration, billsec, xml_cdr_uuid "; - $sql .= "from v_xml_cdr where true "; - $sql .= "and domain_uuid = :domain_uuid "; - $sql .= "and direction != 'outbound' "; - $sql .= "order by start_stamp desc "; - $sql .= limit_offset($_SESSION['call_block']['recent_call_limit']['text']); - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $database = new database; - $result = $database->select($sql, $parameters); - unset($sql, $parameters); - } - + //without block all permission, limit to assigned extension(s) if (!permission_exists('call_block_all') && is_array($_SESSION['user']['extension'])) { foreach ($_SESSION['user']['extension'] as $assigned_extension) { $assigned_extensions[$assigned_extension['extension_uuid']] = $assigned_extension['user']; } - - $sql = "select caller_id_number, caller_id_name, caller_id_number, start_epoch, direction, hangup_cause, duration, billsec, xml_cdr_uuid "; - $sql .= "from v_xml_cdr "; - $sql .= "where domain_uuid = :domain_uuid "; - if (is_array($assigned_extensions) && sizeof($assigned_extensions) != 0) { - $x = 0; - foreach ($assigned_extensions as $assigned_extension_uuid => $assigned_extension) { - $sql_where_array[] = "extension_uuid = :extension_uuid_".$x; - //$sql_where_array[] = "caller_id_number = :caller_id_number_".$x; - //$sql_where_array[] = "destination_number = :destination_number_1_".$x; - //$sql_where_array[] = "destination_number = :destination_number_2_".$x; - $parameters['extension_uuid_'.$x] = $assigned_extension_uuid; - //$parameters['caller_id_number_'.$x] = $assigned_extension; - //$parameters['destination_number_1_'.$x] = $assigned_extension; - //$parameters['destination_number_2_'.$x] = '*99'.$assigned_extension; - $x++; - } - if (is_array($sql_where_array) && sizeof($sql_where_array) != 0) { - $sql .= "and (".implode(' or ', $sql_where_array).") "; - } - unset($sql_where_array); + if (is_array($assigned_extensions) && sizeof($assigned_extensions) != 0) { + $x = 0; + foreach ($assigned_extensions as $assigned_extension_uuid => $assigned_extension) { + $sql_where_array[] = "extension_uuid = :extension_uuid_".$x; + $parameters['extension_uuid_'.$x] = $assigned_extension_uuid; + $x++; } - $sql .= "order by start_stamp desc"; - $sql .= limit_offset($_SESSION['call_block']['recent_call_limit']['text']); - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $database = new database; - $result = $database->select($sql, $parameters, 'all'); + if (is_array($sql_where_array) && sizeof($sql_where_array) != 0) { + $sql_where .= "and (".implode(' or ', $sql_where_array).") "; + } + unset($sql_where_array); + } } + //get recent calls + $sql = "select caller_id_name, caller_id_number, caller_destination, start_epoch, direction, hangup_cause, duration, billsec, xml_cdr_uuid "; + $sql .= "from v_xml_cdr where domain_uuid = :domain_uuid "; + $sql .= "and direction <> 'local' "; + $sql .= $sql_where; + $sql .= "order by start_stamp desc "; + $sql .= limit_offset($_SESSION['call_block']['recent_call_limit']['text']); + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $database = new database; + $result = $database->select($sql, $parameters); + unset($sql, $parameters); + echo "
\n"; echo "\n"; echo "
\n"; - echo "
".$text['heading-recent_calls']."
\n"; + echo "
"; + echo " ".$text['heading-recent_calls'].""; + echo " \n"; + echo "
\n"; echo "
\n"; echo button::create(['type'=>'button','id'=>'action_bar_sub_button_back','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'collapse'=>'hide-xs','style'=>'display: none;','link'=>'call_block.php']); if ($result) { @@ -539,83 +556,112 @@ echo modal::create(['id'=>'modal-block','type'=>'general','message'=>$text['confirm-block'],'actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_block','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_form_submit('form_list');"])]); } - echo "\n"; - echo "\n"; - echo " \n"; - echo "\n"; - echo th_order_by('caller_id_name', $text['label-name'], $order_by, $order); - echo th_order_by('caller_id_number', $text['label-number'], $order_by, $order); - echo th_order_by('start_stamp', $text['label-called-on'], $order_by, $order); - echo th_order_by('duration', $text['label-duration'], $order_by, $order, null, "class='right hide-sm-dn'"); - echo ""; + foreach (['inbound','outbound'] as $direction) { + echo "
\n"; - echo " \n"; - echo "  
\n"; + echo "\n"; + echo " \n"; + echo "\n"; + echo th_order_by('caller_id_name', $text['label-name'], $order_by, $order); + echo th_order_by('caller_id_number', $text['label-number'], $order_by, $order); + echo th_order_by('caller_id_number', $text['label-destination'], $order_by, $order); + echo th_order_by('start_stamp', $text['label-called'], $order_by, $order); + echo th_order_by('duration', $text['label-duration'], $order_by, $order, null, "class='right hide-sm-dn'"); + echo ""; - if (is_array($result) && @sizeof($result) != 0) { - $x = 0; - foreach ($result as $row) { - $list_row_onclick_uncheck = "if (!this.checked) { document.getElementById('checkbox_all').checked = false; }"; - $list_row_onclick_toggle = "onclick=\"document.getElementById('checkbox_".$x."').checked = document.getElementById('checkbox_".$x."').checked ? false : true; ".$list_row_onclick_uncheck."\""; - if (strlen($row['caller_id_number']) >= 7) { - if ($_SESSION['domain']['time_format']['text'] == '24h') { - $tmp_start_epoch = date('j M Y', $row['start_epoch'])." ".date('H:i:s', $row['start_epoch']).''; - } - else { - $tmp_start_epoch = date('j M Y', $row['start_epoch'])." ".date('h:i:s a', $row['start_epoch']).''; - } - echo "\n"; - echo " \n"; - if ( - file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_voicemail.png") && - file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_answered.png") && - file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_failed.png") && - file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_answered.png") - ) { - echo " \n"; + echo " \n"; + if ( + file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_voicemail.png") && + file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_answered.png") && + file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_failed.png") && + file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_answered.png") + ) { + echo " \n"; + } + else { + echo " "; + } + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + $seconds = ($row['hangup_cause'] == "ORIGINATOR_CANCEL") ? $row['duration'] : $row['billsec']; //if they cancelled, show the ring time, not the bill time. + echo " \n"; + echo "\n"; } - echo " \n"; } - else { - echo " "; - } - echo " \n"; - echo " \n"; - echo " \n"; - $seconds = ($row['hangup_cause'] == "ORIGINATOR_CANCEL") ? $row['duration'] : $row['billsec']; //if they cancelled, show the ring time, not the bill time. - echo " \n"; - echo "\n"; - $x++; } } - unset($result); - + echo "
\n"; + echo " \n"; + echo "  
\n"; - echo " \n"; - echo " \n"; - echo " "; - switch ($row['direction']) { - case "inbound" : - if ($row['billsec'] == 0) { - echo "".$text[\n"; + if (is_array($result) && @sizeof($result) != 0) { + foreach ($result as $x => $row) { + if ($row['direction'] == $direction) { + $list_row_onclick_uncheck = "if (!this.checked) { document.getElementById('checkbox_all_".$direction."').checked = false; }"; + $list_row_onclick_toggle = "onclick=\"document.getElementById('checkbox_".$x."').checked = document.getElementById('checkbox_".$x."').checked ? false : true; ".$list_row_onclick_uncheck."\""; + if (strlen($row['caller_id_number']) >= 7) { + if ($_SESSION['domain']['time_format']['text'] == '24h') { + $tmp_start_epoch = date('j M Y', $row['start_epoch'])." ".date('H:i:s', $row['start_epoch']).''; + } + else { + $tmp_start_epoch = date('j M Y', $row['start_epoch'])." ".date('h:i:s a', $row['start_epoch']).''; + } + echo "
\n"; + echo " \n"; + echo " \n"; + echo " "; + switch ($row['direction']) { + case "inbound": + if ($row['billsec'] == 0) { + $title_mod = " ".$text['label-missed']; + $file_mod = "_voicemail"; + } + else { + $file_mod = "_answered"; + } + echo "\n"; + break; + case "outbound": + if ($row['billsec'] == 0) { + $title_mod = " ".$text['label-failed']; + $file_mod = "_failed"; + } + else { + $file_mod = "_answered"; + } + echo "\n"; + break; } - else { - echo "".$text[\n"; - } - break; - case "local" : - if ($row['billsec'] == 0) { - echo "".$text[\n"; - } - else { - echo "".$text[\n"; - } - break; + echo "  ".$row['caller_id_name']." ".format_phone($row['caller_id_number'])."".format_phone($row['caller_destination'])."".$tmp_start_epoch."".gmdate("G:i:s", $seconds)."
 ".$row['caller_id_name']." ".format_phone($row['caller_id_number'])."".$tmp_start_epoch."".gmdate("G:i:s", $seconds)."
\n"; } + unset($result); - echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; + //handle hiding and showing of direction recent calls + echo "\n"; + } //make sub action bar sticky @@ -639,4 +685,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/call_block/resources/classes/call_block.php b/app/call_block/resources/classes/call_block.php index fcb61a6555..947f123f65 100644 --- a/app/call_block/resources/classes/call_block.php +++ b/app/call_block/resources/classes/call_block.php @@ -23,6 +23,7 @@ if (!class_exists('call_block')) { /** * declare public variables */ + public $call_block_direction; public $extension_uuid; public $call_block_app; public $call_block_data; @@ -307,7 +308,7 @@ if (!class_exists('call_block')) { //get the caller id info from cdrs if (is_array($uuids) && @sizeof($uuids) != 0) { - $sql = "select caller_id_name, caller_id_number from v_xml_cdr "; + $sql = "select caller_id_name, caller_id_number, caller_destination from v_xml_cdr "; $sql .= "where xml_cdr_uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -322,11 +323,17 @@ if (!class_exists('call_block')) { if (permission_exists('call_block_all')) { $array['call_block'][$x]['call_block_uuid'] = uuid(); $array['call_block'][$x]['domain_uuid'] = $_SESSION['domain_uuid']; + $array['call_block'][$x]['call_block_direction'] = $this->call_block_direction; if (is_uuid($this->extension_uuid)) { $array['call_block'][$x]['extension_uuid'] = $this->extension_uuid; } - $array['call_block'][$x]['call_block_name'] = trim($row["caller_id_name"]); - $array['call_block'][$x]['call_block_number'] = trim($row["caller_id_number"]); + if ($this->call_block_direction == 'inbound') { + $array['call_block'][$x]['call_block_name'] = trim($row["caller_id_name"]); + $array['call_block'][$x]['call_block_number'] = trim($row["caller_id_number"]); + } + if ($this->call_block_direction == 'outbound') { + $array['call_block'][$x]['call_block_number'] = trim($row["caller_destination"]); + } $array['call_block'][$x]['call_block_count'] = 0; $array['call_block'][$x]['call_block_app'] = $this->call_block_app; $array['call_block'][$x]['call_block_data'] = $this->call_block_data; @@ -340,9 +347,15 @@ if (!class_exists('call_block')) { if (is_uuid($field['extension_uuid'])) { $array['call_block'][$x]['call_block_uuid'] = uuid(); $array['call_block'][$x]['domain_uuid'] = $_SESSION['domain_uuid']; + $array['call_block'][$x]['call_block_direction'] = $this->call_block_direction; $array['call_block'][$x]['extension_uuid'] = $field['extension_uuid']; - $array['call_block'][$x]['call_block_name'] = trim($row["caller_id_name"]); - $array['call_block'][$x]['call_block_number'] = trim($row["caller_id_number"]); + if ($this->call_block_direction == 'inbound') { + $array['call_block'][$x]['call_block_name'] = trim($row["caller_id_name"]); + $array['call_block'][$x]['call_block_number'] = trim($row["caller_id_number"]); + } + if ($this->call_block_direction == 'outbound') { + $array['call_block'][$x]['call_block_number'] = trim($row["caller_destination"]); + } $array['call_block'][$x]['call_block_count'] = 0; $array['call_block'][$x]['call_block_app'] = $this->call_block_app; $array['call_block'][$x]['call_block_data'] = $this->call_block_data; diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index 8652d49f82..9d0a64eaf0 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -345,7 +345,7 @@ $array['dialplans'][0]["dialplan_uuid"] = $dialplan_uuid; $array['dialplans'][0]["dialplan_name"] = $queue_name; $array['dialplans'][0]["dialplan_number"] = $queue_extension; - $array['dialplans'][0]["dialplan_context"] = $_SESSION['context']; + $array['dialplans'][0]["dialplan_context"] = $_SESSION['domain_name']; $array['dialplans'][0]["dialplan_continue"] = "false"; $array['dialplans'][0]["dialplan_xml"] = $dialplan_xml; $array['dialplans'][0]["dialplan_order"] = "230"; @@ -377,7 +377,7 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //redirect the user if (isset($action)) { diff --git a/app/call_centers/resources/classes/call_center.php b/app/call_centers/resources/classes/call_center.php index c5e8f59d69..4f62248265 100644 --- a/app/call_centers/resources/classes/call_center.php +++ b/app/call_centers/resources/classes/call_center.php @@ -109,7 +109,7 @@ $dialplan["domain_uuid"] = $this->domain_uuid; $dialplan["dialplan_name"] = ($this->queue_name != '') ? $this->queue_name : format_phone($this->destination_number); $dialplan["dialplan_number"] = $this->destination_number; - $dialplan["dialplan_context"] = $_SESSION['context']; + $dialplan["dialplan_context"] = $_SESSION['domain_name']; $dialplan["dialplan_continue"] = "false"; $dialplan["dialplan_order"] = "210"; $dialplan["dialplan_enabled"] = "true"; @@ -267,7 +267,7 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION['context']); + $cache->delete("dialplan:".$_SESSION['domain_name']); //return the dialplan_uuid return $dialplan_response; @@ -366,7 +366,7 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); remove_config_from_cache('configuration:callcenter.conf'); //synchronize configuration @@ -592,7 +592,7 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //set message message::add($text['message-copy']); diff --git a/app/click_to_call/click_to_call.php b/app/click_to_call/click_to_call.php index 7a953f7b97..4d6cc4d8a3 100644 --- a/app/click_to_call/click_to_call.php +++ b/app/click_to_call/click_to_call.php @@ -66,7 +66,7 @@ $auto_answer = check_str($_GET['auto_answer']); //true,false $rec = check_str($_GET['rec']); //true,false $ringback = check_str($_GET['ringback']); - $context = $_SESSION['context']; + $context = $_SESSION['domain_name']; //clean up variable values $src = str_replace(array('.','(',')','-',' '), '', $src); diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index 0d2ba8c3b1..468910f612 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -147,7 +147,7 @@ $array['dialplans'][0]["dialplan_uuid"] = $dialplan_uuid; $array['dialplans'][0]["dialplan_name"] = $conference_center_name; $array['dialplans'][0]["dialplan_number"] = $conference_center_extension; - $array['dialplans'][0]["dialplan_context"] = $_SESSION['context']; + $array['dialplans'][0]["dialplan_context"] = $_SESSION['domain_name']; $array['dialplans'][0]["dialplan_continue"] = "false"; $array['dialplans'][0]["dialplan_xml"] = $dialplan_xml; $array['dialplans'][0]["dialplan_order"] = "333"; @@ -183,7 +183,7 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //redirect the user if (isset($action)) { diff --git a/app/conference_centers/resources/classes/conference_centers.php b/app/conference_centers/resources/classes/conference_centers.php index d98b76715d..7943fc08ef 100644 --- a/app/conference_centers/resources/classes/conference_centers.php +++ b/app/conference_centers/resources/classes/conference_centers.php @@ -89,7 +89,7 @@ if (!class_exists('conference_centers')) { } $sql = "select count(*) from v_conference_rooms as r, v_meetings as p "; if ($not_admin) { - $sql .= "v_meeting_users as u, "; + $sql .= ",v_meeting_users as u "; } $sql .= "where r.domain_uuid = :domain_uuid "; $sql .= "and r.meeting_uuid = p.meeting_uuid "; @@ -373,7 +373,7 @@ if (!class_exists('conference_centers')) { //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //apply settings reminder $_SESSION["reload_xml"] = true; @@ -604,7 +604,7 @@ if (!class_exists('conference_centers')) { //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //set message message::add($text['message-toggle']); diff --git a/app/conferences/conference_edit.php b/app/conferences/conference_edit.php index 45d60e7d59..c87d4ea371 100644 --- a/app/conferences/conference_edit.php +++ b/app/conferences/conference_edit.php @@ -205,7 +205,7 @@ $array['dialplans'][0]['app_uuid'] = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9'; $array['dialplans'][0]['dialplan_xml'] = $dialplan_xml; $array['dialplans'][0]['dialplan_order'] = '333'; - $array['dialplans'][0]['dialplan_context'] = $_SESSION['context']; + $array['dialplans'][0]['dialplan_context'] = $_SESSION['domain_name']; $array['dialplans'][0]['dialplan_enabled'] = $conference_enabled; $array['dialplans'][0]['dialplan_description'] = $conference_description; @@ -241,7 +241,7 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //redirect the browser header("Location: conferences.php"); diff --git a/app/conferences/resources/classes/conferences.php b/app/conferences/resources/classes/conferences.php index d2e68865bb..570ee92dca 100644 --- a/app/conferences/resources/classes/conferences.php +++ b/app/conferences/resources/classes/conferences.php @@ -141,7 +141,7 @@ if (!class_exists('conferences')) { //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //set message message::add($text['message-delete']); @@ -227,7 +227,7 @@ if (!class_exists('conferences')) { //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //set message message::add($text['message-toggle']); @@ -362,7 +362,7 @@ if (!class_exists('conferences')) { //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //set message message::add($text['message-copy']); diff --git a/app/contacts/app_languages.php b/app/contacts/app_languages.php index b6bb1dc152..a739bae454 100644 --- a/app/contacts/app_languages.php +++ b/app/contacts/app_languages.php @@ -4753,8 +4753,8 @@ $text['description-contacts_import_google']['ru-ru'] = "Выберите нуж $text['description-contacts_import_google']['sv-se'] = "Välj de kontakter som skall importeras."; $text['description-contacts_import_google']['uk-ua'] = ""; -$text['description-contacts_import']['en-us'] = "Export your contacts from outlook to a comma delimitted csv file. Then use this tool to upload and add the contacts from that file."; -$text['description-contacts_import']['en-gb'] = "Export your contacts from outlook to a comma delimitted csv file. Then use this tool to upload and add the contacts from that file."; +$text['description-contacts_import']['en-us'] = "Submit or upload delimited data to add multiple records."; +$text['description-contacts_import']['en-gb'] = "Submit or upload delimited data to add multiple records."; $text['description-contacts_import']['ar-eg'] = ""; $text['description-contacts_import']['de-at'] = "Exportieren Sie Ihre Kontakte aus Outlook in eine CSV Datei und benützen Sie diese Funktion um Ihre Kontakte zu importieren."; //copied from de-de $text['description-contacts_import']['de-ch'] = "Exportieren Sie Ihre Kontakte aus Outlook in eine CSV Datei und benützen Sie diese Funktion um Ihre Kontakte zu importieren."; //copied from de-de diff --git a/app/contacts/contact_import.php b/app/contacts/contact_import.php index 2c415cfe99..dfb92964fc 100644 --- a/app/contacts/contact_import.php +++ b/app/contacts/contact_import.php @@ -143,7 +143,7 @@ $token = new token; if (!$token->validate($_SERVER['PHP_SELF'])) { message::add($text['message-invalid_token'],'negative'); - header('Location: extension_imports.php'); + header('Location: contact_import.php'); exit; } @@ -209,6 +209,7 @@ echo " \n"; foreach($row['fields'] as $field) { if ($field == 'phone_label') { continue; } + if ($field == 'contact_url') { continue; } // can remove this after field is removed from the table $selected = ''; if ($field == $line_field) { $selected = "selected='selected'"; @@ -270,7 +271,7 @@ $token = new token; if (!$token->validate($_SERVER['PHP_SELF'])) { message::add($text['message-invalid_token'],'negative'); - header('Location: extension_imports.php'); + header('Location: contact_import.php'); exit; } diff --git a/app/database_transactions/app_languages.php b/app/database_transactions/app_languages.php index 66adb0fe7d..2fb88996e0 100644 --- a/app/database_transactions/app_languages.php +++ b/app/database_transactions/app_languages.php @@ -64,6 +64,27 @@ $text['description-database_transactions']['ru-ru'] = "Изменения в б $text['description-database_transactions']['sv-se'] = "Databas Transaktioner"; $text['description-database_transactions']['uk-ua'] = ""; +$text['label-user']['en-us'] = "User"; +$text['label-user']['en-gb'] = "User"; +$text['label-user']['ar-eg'] = ""; +$text['label-user']['de-at'] = "Benutzer"; //copied from de-de +$text['label-user']['de-ch'] = "Benutzer"; //copied from de-de +$text['label-user']['de-de'] = "Benutzer"; +$text['label-user']['es-cl'] = ""; +$text['label-user']['es-mx'] = ""; +$text['label-user']['fr-ca'] = "Utilisateur"; +$text['label-user']['fr-fr'] = "Utilisateur"; +$text['label-user']['he-il'] = ""; +$text['label-user']['it-it'] = ""; +$text['label-user']['nl-nl'] = "Gebruiker"; +$text['label-user']['pl-pl'] = ""; +$text['label-user']['pt-br'] = ""; +$text['label-user']['pt-pt'] = ""; +$text['label-user']['ro-ro'] = ""; +$text['label-user']['ru-ru'] = "Пользователь"; +$text['label-user']['sv-se'] = "Användare"; +$text['label-user']['uk-ua'] = ""; + $text['label-user_uuid']['en-us'] = "User"; $text['label-user_uuid']['en-gb'] = "User"; $text['label-user_uuid']['ar-eg'] = ""; diff --git a/app/database_transactions/database_transactions.php b/app/database_transactions/database_transactions.php index 6970dae29b..4cbdb8932a 100644 --- a/app/database_transactions/database_transactions.php +++ b/app/database_transactions/database_transactions.php @@ -47,7 +47,8 @@ $order_by = $_GET["order_by"]; $order = $_GET["order"]; -//add the search term +//add the user filter and search term + $user_uuid = $_GET['user_uuid']; $search = strtolower($_GET["search"]); if ($search != '') { $sql_search = "and ("; @@ -62,10 +63,14 @@ } //prepare to page the results - $sql = "select count(*) from v_database_transactions as t "; + $sql = "select count(t.database_transaction_uuid) from v_database_transactions as t "; $sql .= "left outer join v_domains as d using (domain_uuid) "; $sql .= "left outer join v_users as u using (user_uuid) "; $sql .= "where t.domain_uuid = :domain_uuid "; + if (is_uuid($user_uuid)) { + $sql .= "and t.user_uuid = :user_uuid "; + $parameters['user_uuid'] = $user_uuid; + } $sql .= $sql_search; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; @@ -81,12 +86,26 @@ $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(*)','t.database_transaction_uuid, d.domain_name, u.username, t.user_uuid, t.app_name, t.app_uuid, t.transaction_code, t.transaction_address, t.transaction_type, t.transaction_date', $sql); + $sql = str_replace('count(t.database_transaction_uuid)','t.database_transaction_uuid, d.domain_name, u.username, t.user_uuid, t.app_name, t.app_uuid, t.transaction_code, t.transaction_address, t.transaction_type, t.transaction_date', $sql); $sql .= order_by($order_by, $order, 't.transaction_date', 'desc'); $sql .= limit_offset($rows_per_page, $offset); $database = new database; $result = $database->select($sql, $parameters, 'all'); - unset($sql); + unset($sql, $parameters); + +//get users + $sql = "select user_uuid, username from v_users "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "order by username "; + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $database = new database; + $rows = $database->select($sql, $parameters, 'all'); + if (is_array($rows) && @sizeof($rows) != 0) { + foreach ($rows as $row) { + $users[$row['user_uuid']] = $row['username']; + } + } + unset($sql, $parameters, $rows, $row); //additional includes $document['title'] = $text['title-database_transactions']; @@ -97,9 +116,19 @@ echo "
".$text['title-database_transactions']." (".$num_rows.")
\n"; echo "
\n"; echo "
\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo "\n"; + echo $text['description-device_export']; + echo "

\n"; if (is_array($available_columns) && @sizeof($available_columns) != 0) { $x = 0; - foreach ($available_columns as $column_name) { - $list_row_onclick = "if (!this.checked) { document.getElementById('checkbox_all').checked = false; }"; - echo "\n"; - echo " \n"; - echo " "; - echo ""; - $x++; + foreach ($available_columns as $table_name => $columns) { + $table_name_label = ucwords(str_replace(['-','_',],' ', $table_name)); + echo "
\n"; + echo "".$table_name_label."\n"; + echo "
\n"; + echo "
\n"; - echo " \n"; - echo " ".$text['label-column_name']."
\n"; - echo " \n"; - echo " ".$column_name."
\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo "\n"; + foreach ($columns as $column_name) { + $list_row_onclick = "if (!this.checked) { document.getElementById('checkbox_all').checked = false; }"; + echo "\n"; + echo " \n"; + echo " "; + echo ""; + $x++; + } + echo "
\n"; + echo " \n"; + echo " ".$text['label-column_name']."
\n"; + echo " \n"; + echo " ".$column_name."
\n"; + echo "
\n"; + echo "\n"; } } + + //test the validation + //echo " \n"; + //echo " \n"; + //echo " \n"; - echo "\n"; - echo "
\n"; echo "\n"; echo "\n"; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 3040b537a9..b93f271737 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -283,11 +283,13 @@ $y = 0; foreach ($device_lines as $row) { if (strlen($row['line_number']) > 0) { + $new_line = false; if (is_uuid($row["device_line_uuid"])) { $device_line_uuid = $row["device_line_uuid"]; } else { $device_line_uuid = uuid(); + $new_line = true; } $array['devices'][0]['device_lines'][$y]['domain_uuid'] = $domain_uuid; $array['devices'][0]['device_lines'][$y]['device_uuid'] = $device_uuid; @@ -296,15 +298,23 @@ $array['devices'][0]['device_lines'][$y]['server_address'] = $row["server_address"]; if (permission_exists('device_line_outbound_proxy_primary')) { $array['devices'][0]['device_lines'][$y]['outbound_proxy_primary'] = $row["outbound_proxy_primary"]; + } else if ($new_line && isset($_SESSION['provision']['outbound_proxy_primary'])) { + $array['devices'][0]['device_lines'][$y]['outbound_proxy_primary'] = $_SESSION['provision']['outbound_proxy_primary']['text']; } if (permission_exists('device_line_outbound_proxy_secondary')) { $array['devices'][0]['device_lines'][$y]['outbound_proxy_secondary'] = $row["outbound_proxy_secondary"]; + } else if ($new_line && isset($_SESSION['provision']['outbound_proxy_secondary'])) { + $array['devices'][0]['device_lines'][$y]['outbound_proxy_secondary'] = $_SESSION['provision']['outbound_proxy_secondary']['text']; } if (permission_exists('device_line_server_address_primary')) { $array['devices'][0]['device_lines'][$y]['server_address_primary'] = $row["server_address_primary"]; + } else if ($new_line && isset($_SESSION['provision']['server_address_primary'])) { + $array['devices'][0]['device_lines'][$y]['server_address_primary'] = $_SESSION['provision']['server_address_primary']['text']; } if (permission_exists('device_line_server_address_secondary')) { $array['devices'][0]['device_lines'][$y]['server_address_secondary'] = $row["server_address_secondary"]; + } else if ($new_line && isset($_SESSION['provision']['server_address_secondary'])) { + $array['devices'][0]['device_lines'][$y]['server_address_secondary'] = $_SESSION['provision']['server_address_secondary']['text']; } $array['devices'][0]['device_lines'][$y]['display_name'] = $row["display_name"]; $array['devices'][0]['device_lines'][$y]['user_id'] = $row["user_id"]; @@ -1019,10 +1029,12 @@ $element['hidden'] = true; $element['visibility'] = "visibility:hidden;"; } + //add the primary key uuid if (is_uuid($row['device_line_uuid'])) { echo " \n"; } + //show each row in the array echo " \n"; echo " \n"; @@ -1046,10 +1058,7 @@ if (permission_exists('device_line_server_address_primary')) { echo " \n"; - if (is_uuid($_SESSION['provision']['server_address_primary']['uuid'])) { - echo " \n"; - } - else { + if (isset($_SESSION['provision']['server_address_primary']) && !isset($_SESSION['provision']['server_address_primary']['text'])) { echo " \n"; } + else { + echo " \n"; + } echo " \n"; } if (permission_exists('device_line_server_address_secondary')) { echo " \n"; - if (isset($_SESSION['provision']['server_address_secondary']['text'])) { - echo " \n"; - } - else { + if (isset($_SESSION['provision']['server_address_secondary']) && !isset($_SESSION['provision']['server_address_secondary']['text'])) { echo " \n"; } + else { + echo " \n"; + } echo " \n"; } if (permission_exists('device_line_outbound_proxy_primary')) { echo " \n"; - if (isset($_SESSION['provision']['outbound_proxy_primary']['text'])) { - echo " \n"; - } - else { + if (isset($_SESSION['provision']['outbound_proxy_primary']) && !isset($_SESSION['provision']['outbound_proxy_primary']['text'])) { echo " \n"; } + else { + echo " \n"; + } echo " \n"; } - + if (permission_exists('device_line_outbound_proxy_secondary')) { echo " \n"; - if (isset($_SESSION['provision']['outbound_proxy_secondary']['text'])) { - echo " \n"; - } - else { + if (isset($_SESSION['provision']['outbound_proxy_secondary']) && !isset($_SESSION['provision']['outbound_proxy_secondary']['text'])) { echo " \n"; } + else { + echo " \n"; + } echo " \n"; } diff --git a/app/devices/device_imports.php b/app/devices/device_imports.php index b361629819..460c07bf9c 100644 --- a/app/devices/device_imports.php +++ b/app/devices/device_imports.php @@ -66,25 +66,24 @@ //save the data to the csv file if (isset($_POST['data'])) { $file = $_SESSION['server']['temp']['dir']."/devices-".$_SESSION['domain_name'].".csv"; - file_put_contents($file, $_POST['data']); - $_SESSION['file'] = $file; - } - -//copy the csv file - //$_POST['submit'] == "Upload" && - if ( is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('device_imports')) { - if ($_POST['type'] == 'csv') { - move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name']); - $save_msg = "Uploaded file to ".$_SESSION['server']['temp']['dir']."/". htmlentities($_FILES['ulfile']['name']); - //system('chmod -R 744 '.$_SESSION['server']['temp']['dir'].'*'); - unset($_POST['txtCommand']); - $file = $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name']; + if (file_put_contents($file, $_POST['data'])) { $_SESSION['file'] = $file; } } +//copy the csv file + //$_POST['submit'] == "Upload" && + if ( is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('device_import')) { + if ($_POST['type'] == 'csv') { + $file = $_SESSION['server']['temp']['dir']."/devices-".$_SESSION['domain_name'].".csv"; + if (move_uploaded_file($_FILES['ulfile']['tmp_name'], $file)) { + $_SESSION['file'] = $file; + } + } + } + //get the schema - if (strlen($delimiter) > 0) { + if (strlen($delimiter) > 0 && file_exists($_SESSION['file'])) { //get the first line $line = fgets(fopen($_SESSION['file'], 'r')); $line_fields = explode($delimiter, $line); @@ -441,7 +440,6 @@ echo "\n"; echo "\n"; - /* echo "\n"; echo "\n"; echo " ".$text['label-import_file_upload']."\n"; @@ -451,7 +449,6 @@ echo "
\n"; echo "\n"; echo "\n"; - */ echo "\n"; echo "

"; diff --git a/app/devices/resources/classes/device.php b/app/devices/resources/classes/device.php index 3629450c0b..de813176cc 100644 --- a/app/devices/resources/classes/device.php +++ b/app/devices/resources/classes/device.php @@ -311,6 +311,12 @@ include "root.php"; //build the delete array foreach ($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + $sql = "update v_devices set device_uuid_alternate = null where device_uuid_alternate = :device_uuid_alternate; "; + $parameters['device_uuid_alternate'] = $record['uuid']; + $database = new database; + $database->execute($sql, $parameters); + unset($sql, $parameters); + $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; $array['device_settings'][$x]['device_uuid'] = $record['uuid']; $array['device_lines'][$x]['device_uuid'] = $record['uuid']; diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 58d0864f91..1274d864e8 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -392,7 +392,7 @@ if (strlen($dialplan_order) == 0) { $dialplan_order ='333'; } - $dialplan_context = $_SESSION['context']; + $dialplan_context = $_SESSION['domain_name']; $dialplan_continue = 'false'; $app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'; @@ -684,6 +684,11 @@ } //end foreach } + //add the dialplan permission + $p = new permissions; + $p->add("dialplan_add", "temp"); + $p->add("dialplan_detail_add", "temp"); + //save to the data $database = new database; $database->app_name = 'outbound_routes'; @@ -699,6 +704,10 @@ $dialplans->uuid = $dialplan_uuid; $dialplans->xml(); + //remove the temporary permission + $p->delete("dialplan_add", "temp"); + $p->delete("dialplan_detail_add", "temp"); + //clear the cache $cache = new cache; $cache->delete("dialplan:".$dialplan_context); @@ -720,12 +729,13 @@ $sql = "select * from v_gateways "; $sql .= "where enabled = 'true' "; if (permission_exists('outbound_route_any_gateway')) { - $sql .= "order by domain_uuid, gateway "; + $sql .= "order by domain_uuid = :domain_uuid DESC, gateway "; } else { $sql .= "and domain_uuid = :domain_uuid "; - $parameters['domain_uuid'] = $domain_uuid; + } + $parameters['domain_uuid'] = $domain_uuid; $database = new database; $gateways = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -806,50 +816,49 @@ function type_onchange(dialplan_detail_type) { echo "\n"; echo "\n"; - if (if_group("superadmin")) { - echo "\n"; - echo "\n"; - } + echo "\n"; + echo "\n"; + //set the onchange $onchange = ''; diff --git a/app/dialplans/dialplan_add.php b/app/dialplans/dialplan_add.php index 57e3f957ea..6076daaf49 100644 --- a/app/dialplans/dialplan_add.php +++ b/app/dialplans/dialplan_add.php @@ -80,7 +80,7 @@ } //set the default - if (strlen($dialplan_context) == 0) { $dialplan_context = $_SESSION['context']; } + if (strlen($dialplan_context) == 0) { $dialplan_context = $_SESSION['domain_name']; } //add or update data from http post if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { diff --git a/app/dialplans/dialplan_edit.php b/app/dialplans/dialplan_edit.php index 3fc41d263a..07c204786c 100644 --- a/app/dialplans/dialplan_edit.php +++ b/app/dialplans/dialplan_edit.php @@ -267,6 +267,9 @@ //clear the cache $cache = new cache; + if ($dialplan_context == "\${domain_name}" or $dialplan_context == "global") { + $dialplan_context = "*"; + } $cache->delete("dialplan:".$dialplan_context); //set the message diff --git a/app/dialplans/resources/switch/conf/dialplan/040_call_block.xml b/app/dialplans/resources/switch/conf/dialplan/040_call_block.xml index 6d144d73bb..a73a790960 100644 --- a/app/dialplans/resources/switch/conf/dialplan/040_call_block.xml +++ b/app/dialplans/resources/switch/conf/dialplan/040_call_block.xml @@ -1,6 +1,6 @@ - + diff --git a/app/dialplans/resources/switch/conf/dialplan/050_user_record.xml b/app/dialplans/resources/switch/conf/dialplan/050_user_record.xml index 0c3234a51c..68982435f0 100644 --- a/app/dialplans/resources/switch/conf/dialplan/050_user_record.xml +++ b/app/dialplans/resources/switch/conf/dialplan/050_user_record.xml @@ -41,7 +41,8 @@ - + + diff --git a/app/email_templates/email_template_edit.php b/app/email_templates/email_template_edit.php index 1efcb8be4c..0e395deee7 100644 --- a/app/email_templates/email_template_edit.php +++ b/app/email_templates/email_template_edit.php @@ -165,6 +165,13 @@ unset($sql, $parameters, $row); } +//load editor preferences/defaults + $setting_size = $_SESSION["editor"]["font_size"]["text"] != '' ? $_SESSION["editor"]["font_size"]["text"] : '12px'; + $setting_theme = $_SESSION["editor"]["theme"]["text"] != '' ? $_SESSION["editor"]["theme"]["text"] : 'cobalt'; + $setting_invisibles = $_SESSION["editor"]["invisibles"]["boolean"] != '' ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false'; + $setting_indenting = $_SESSION["editor"]["indent_guides"]["boolean"] != '' ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false'; + $setting_numbering = $_SESSION["editor"]["line_numbers"]["boolean"] != '' ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true'; + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -173,6 +180,69 @@ $document['title'] = $text['title-email_template']; require_once "resources/header.php"; + echo "\n"; + + echo "\n"; + //show the content echo "
\n"; @@ -180,7 +250,7 @@ echo "
".$text['title-email_template']."
\n"; echo "
\n"; echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'email_templates.php']); - echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']); + echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','onclick'=>"set_value(); $('#frm').submit();"]); echo "
\n"; echo "
\n"; echo "\n"; @@ -236,7 +306,77 @@ echo " ".$text['label-template_body']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; echo "
\n"; echo $text['description-template_body']."\n"; echo "\n"; @@ -327,6 +467,39 @@ echo "
"; + echo "\n"; + echo "\n"; + //include the footer require_once "resources/footer.php"; diff --git a/app/email_templates/resources/images/icon_file.png b/app/email_templates/resources/images/icon_file.png new file mode 100644 index 0000000000..c8d71de0c4 Binary files /dev/null and b/app/email_templates/resources/images/icon_file.png differ diff --git a/app/email_templates/resources/images/icon_folder.png b/app/email_templates/resources/images/icon_folder.png new file mode 100644 index 0000000000..7efc21fe2e Binary files /dev/null and b/app/email_templates/resources/images/icon_folder.png differ diff --git a/app/email_templates/resources/images/icon_gear.png b/app/email_templates/resources/images/icon_gear.png new file mode 100644 index 0000000000..0fde59125d Binary files /dev/null and b/app/email_templates/resources/images/icon_gear.png differ diff --git a/app/email_templates/resources/images/icon_goto.png b/app/email_templates/resources/images/icon_goto.png new file mode 100644 index 0000000000..89f5d28531 Binary files /dev/null and b/app/email_templates/resources/images/icon_goto.png differ diff --git a/app/email_templates/resources/images/icon_indenting.png b/app/email_templates/resources/images/icon_indenting.png new file mode 100644 index 0000000000..c6d4c733f1 Binary files /dev/null and b/app/email_templates/resources/images/icon_indenting.png differ diff --git a/app/email_templates/resources/images/icon_invisibles.png b/app/email_templates/resources/images/icon_invisibles.png new file mode 100644 index 0000000000..9e2973bb6e Binary files /dev/null and b/app/email_templates/resources/images/icon_invisibles.png differ diff --git a/app/email_templates/resources/images/icon_numbering.png b/app/email_templates/resources/images/icon_numbering.png new file mode 100644 index 0000000000..305144c8d4 Binary files /dev/null and b/app/email_templates/resources/images/icon_numbering.png differ diff --git a/app/email_templates/resources/images/icon_replace.png b/app/email_templates/resources/images/icon_replace.png new file mode 100644 index 0000000000..4b2ec21788 Binary files /dev/null and b/app/email_templates/resources/images/icon_replace.png differ diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php index ad73a13afb..2c2e0ec61b 100644 --- a/app/extensions/app_config.php +++ b/app/extensions/app_config.php @@ -63,7 +63,7 @@ $apps[$x]['destinations'][$y]['type'] = "sql"; $apps[$x]['destinations'][$y]['label'] = "call_groups"; $apps[$x]['destinations'][$y]['name'] = "extensions"; - $apps[$x]['destinations'][$y]['sql']['pgsql'] = "select extension_uuid, distinct(unnest(string_to_array(call_group, ','))) as destination from v_extensions "; + $apps[$x]['destinations'][$y]['sql']['pgsql'] = "select distinct(unnest(string_to_array(call_group, ','))) as destination from v_extensions "; $apps[$x]['destinations'][$y]['sql']['sqlite'] = "select distinct(call_group) as destination from v_extensions"; $apps[$x]['destinations'][$y]['sql']['mysql'] = "select distinct(call_group) as destination from v_extensions"; $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and call_group <> '' and enabled = 'true' "; diff --git a/app/extensions/app_languages.php b/app/extensions/app_languages.php index 4aad443c58..0e0913cddd 100644 --- a/app/extensions/app_languages.php +++ b/app/extensions/app_languages.php @@ -2746,8 +2746,8 @@ $text['description-dial_string']['ru-ru'] = "Местоположение кон $text['description-dial_string']['sv-se'] = "Plats för enheten."; $text['description-dial_string']['uk-ua'] = ""; -$text['description-cidr']['en-us'] = "Enter the CIDR here."; -$text['description-cidr']['en-gb'] = "Enter the CIDR here."; +$text['description-cidr']['en-us'] = "Enter allowed address/ranges in CIDR notation (comma separated)."; +$text['description-cidr']['en-gb'] = "Enter allowed address/ranges in CIDR notation (comma separated)."; $text['description-cidr']['ar-eg'] = ""; $text['description-cidr']['de-at'] = "Geben Sie hier die Beschränkung der IP Adresse an (z.B. 1.2.3.4/32)"; //copied from de-de $text['description-cidr']['de-ch'] = "Geben Sie hier die Beschränkung der IP Adresse an (z.B. 1.2.3.4/32)"; //copied from de-de diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 9144b45376..4ef2eddade 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -267,15 +267,6 @@ return; } - //set the default user context - if (permission_exists("extension_user_context")) { - //allow a user assigned to super admin to change the user_context - } - else { - //if the user_context was not set then set the default value - $user_context = $_SESSION['domain_name']; - } - //prevent users from bypassing extension limit by using range if ($_SESSION['limit']['extensions']['numeric'] != '') { if ($total_extensions + $range > $_SESSION['limit']['extensions']['numeric']){ @@ -402,7 +393,14 @@ $array["extensions"][$i]["directory_exten_visible"] = $directory_exten_visible; $array["extensions"][$i]["limit_max"] = $limit_max; $array["extensions"][$i]["limit_destination"] = $limit_destination; - $array["extensions"][$i]["user_context"] = $user_context; + if (permission_exists("extension_user_context")) { + $array["extensions"][$i]["user_context"] = $user_context; + } + else { + if ($action == "add") { + $array["extensions"][$i]["user_context"] = $_SESSION['domain_name']; + } + } if (permission_exists('extension_missed_call')) { $array["extensions"][$i]["missed_call_app"] = $missed_call_app; $array["extensions"][$i]["missed_call_data"] = $missed_call_data; diff --git a/app/fax/fax_files.php b/app/fax/fax_files.php index dca315d10d..2b0d312172 100644 --- a/app/fax/fax_files.php +++ b/app/fax/fax_files.php @@ -115,7 +115,6 @@ //download the fax if ($_GET['a'] == "download") { - session_cache_limiter('public'); //test to see if it is in the inbox or sent directory. if ($_GET['type'] == "fax_inbox") { if (file_exists($fax_dir.'/'.$_GET['ext'].'/inbox/'.$_GET['filename'])) { @@ -349,19 +348,12 @@ $page_height = 11.7; $page_size = 'a4'; } - //generate pdf (a work around, as tiff2pdf improperly inverts the colors) - $cmd_tif2pdf = "tiff2pdf -i -u i -p ".$page_size." -w ".$page_width." -l ".$page_height." -f -o ".$dir_fax_temp.'/'.$file_name.".pdf ".$dir_fax.'/'.$file_name.".tif"; - //echo $cmd_tif2pdf."
"; + //generate pdf from tif + $cmd_tif2pdf = "tiff2pdf -u i -p ".$page_size." -w ".$page_width." -l ".$page_height." -f -o ".$dir_fax.'/'.$file_name.".pdf ".$dir_fax.'/'.$file_name.".tif"; exec($cmd_tif2pdf); - chdir($dir_fax_temp); - $cmd_pdf2tif = "gs -q -sDEVICE=tiffg3 -r".$gs_r." -g".$gs_g." -dNOPAUSE -sOutputFile=".$file_name."_temp.tif -- ".$file_name.".pdf -c quit"; - //echo $cmd_pdf2tif."
"; - exec($cmd_pdf2tif); //convert pdf to tif - @unlink($dir_fax_temp.'/'.$file_name.".pdf"); - $cmd_tif2pdf = "tiff2pdf -i -u i -p ".$page_size." -w ".$page_width." -l ".$page_height." -f -o ".$dir_fax.'/'.$file_name.".pdf ".$dir_fax_temp.'/'.$file_name."_temp.tif"; - //echo $cmd_tif2pdf."
"; - exec($cmd_tif2pdf); - @unlink($dir_fax_temp.'/'.$file_name."_temp.tif"); + //clean up temporary files, if any + if (file_exists($dir_fax_temp.'/'.$file_name.'.pdf')) { @unlink($dir_fax_temp.'/'.$file_name.'.pdf'); } + if (file_exists($dir_fax_temp.'/'.$file_name.'.tif')) { @unlink($dir_fax_temp.'/'.$file_name.'.tif'); } } if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) { diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 85e23333ca..3bad2175e8 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -25,6 +25,7 @@ James Rose Luis Daniel Lucio Quiroz Errol Samuels + Corey Moullas */ if (!isset($included)) { $included = false; } @@ -369,7 +370,9 @@ if (!function_exists('fax_split_dtmf')) { $fax_name = str_replace("=", "_", $fax_name); $attachment_file_name = $_files['name'][$index]; - rename($dir_fax_temp.'/'.$attachment_file_name, $dir_fax_temp.'/'.$fax_name.'.'.$fax_file_extension); + if ($attachment_file_name != $fax_name.'.'.$fax_file_extension) { + rename($dir_fax_temp.'/'.$attachment_file_name, $dir_fax_temp.'/'.$fax_name.'.'.$fax_file_extension); + } unset($attachment_file_name); if (!$included) { @@ -394,12 +397,8 @@ if (!function_exists('fax_split_dtmf')) { if (file_exists($dir_fax_temp.'/'.$fax_name.'.pdf')) { chdir($dir_fax_temp); - //$cmd = gs_cmd("-q -sDEVICE=psmono -r".$gs_r." -g".$gs_g." -dNOPAUSE -dBATCH -dSAFER -sOutputFile=".correct_path($fax_name).".pdf -- ".correct_path($fax_name).".pdf -c quit"); - // echo($cmd . "
\n"); - //exec($cmd); - //convert pdf to tif - $cmd = gs_cmd("-q -sDEVICE=tiffg32d -r".$gs_r." -g".$gs_g." -dBATCH -dPDFFitPage -dNOPAUSE -sOutputFile=".correct_path($fax_name).".tif -- ".correct_path($fax_name).".pdf -c quit"); + $cmd = gs_cmd("-q -r".$gs_r." -g".$gs_g." -dBATCH -dPDFFitPage -dSAFER -dNOPAUSE -dBATCH -sOutputFile=".correct_path($fax_name).".tif -sDEVICE=tiffg4 -Ilib stocht.ps -c \"{ .75 gt { 1 } { 0 } ifelse} settransfer\" -- ".correct_path($fax_name).".pdf -c quit"); // echo($cmd . "
\n"); exec($cmd); @unlink($dir_fax_temp.'/'.$fax_name.'.pdf'); @@ -660,41 +659,14 @@ if (!function_exists('fax_split_dtmf')) { @unlink($tif_file); } - //generate pdf (a work around, as tiff2pdf was improperly inverting the colors) + //generate pdf from tif $cmd = 'tiff2pdf -u i -p '.$fax_page_size. ' -w '.$page_width. ' -l '.$page_height. ' -f -o '. correct_path($dir_fax_temp.'/'.$fax_instance_uuid.'.pdf').' '. correct_path($dir_fax_temp.'/'.$fax_instance_uuid.'.tif'); - // echo($cmd . "
\n"); exec($cmd); - - chdir($dir_fax_temp); - - //$cmd = gs_cmd("-q -sDEVICE=psmono -r".$gs_r." -g".$gs_g." -dNOPAUSE -dBATCH -dSAFER -sOutputFile=".correct_path($fax_instance_uuid).".pdf -- ".correct_path($fax_instance_uuid).".pdf -c quit"); - // echo($cmd . "
\n"); - //exec($cmd); - - //convert pdf to tif - $cmd = gs_cmd('-q -sDEVICE=tiffg32d -r'.$gs_r.' -g'.$gs_g.' -dBATCH -dPDFFitPage -dNOPAUSE -sOutputFile='. - correct_path($fax_instance_uuid.'_temp.tif'). - ' -- '.$fax_instance_uuid.'.pdf -c quit'); - // echo($cmd . "
\n"); - exec($cmd); - - @unlink($dir_fax_temp.'/'.$fax_instance_uuid.".pdf"); - - $cmd = 'tiff2pdf -u i -p '.$fax_page_size. - ' -w '.$page_width. - ' -l '.$page_height. - ' -f -o '. - correct_path($dir_fax_temp.'/'.$fax_instance_uuid.'.pdf').' '. - correct_path($dir_fax_temp.'/'.$fax_instance_uuid.'_temp.tif'); - // echo($cmd . "
\n"); - exec($cmd); - - @unlink($dir_fax_temp.'/'.$fax_instance_uuid."_temp.tif"); } else { if (!$included) { diff --git a/app/fax/resources/classes/fax.php b/app/fax/resources/classes/fax.php index c5b12b7c11..77b30c2e78 100644 --- a/app/fax/resources/classes/fax.php +++ b/app/fax/resources/classes/fax.php @@ -162,7 +162,7 @@ if (!class_exists('fax')) { $dialplan["dialplan_uuid"] = $this->dialplan_uuid; $dialplan["dialplan_name"] = ($this->fax_name != '') ? $this->fax_name : format_phone($this->destination_number); $dialplan["dialplan_number"] = $this->fax_extension; - $dialplan["dialplan_context"] = $_SESSION['context']; + $dialplan["dialplan_context"] = $_SESSION['domain_name']; $dialplan["dialplan_continue"] = "false"; $dialplan["dialplan_xml"] = $dialplan_xml; $dialplan["dialplan_order"] = "310"; @@ -195,7 +195,7 @@ if (!class_exists('fax')) { //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION['context']); + $cache->delete("dialplan:".$_SESSION['domain_name']); //return the dialplan_uuid return $dialplan_response; @@ -346,7 +346,7 @@ if (!class_exists('fax')) { //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //set message message::add($text['message-delete']); @@ -646,7 +646,7 @@ if (!class_exists('fax')) { //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //set message message::add($text['message-copy']); diff --git a/app/fifo/fifo_add.php b/app/fifo/fifo_add.php index ffbe66fbf9..0f34fb5987 100644 --- a/app/fifo/fifo_add.php +++ b/app/fifo/fifo_add.php @@ -103,7 +103,7 @@ $queue_name = $extension_name."@\${domain_name}"; $app_uuid = '16589224-c876-aeb3-f59f-523a1c0801f7'; $dialplan_uuid = uuid(); - $dialplan_context = $_SESSION['context']; + $dialplan_context = $_SESSION['domain_name']; $domain_uuid = $_SESSION['domain_uuid']; $dialplan_detail_order = 0; @@ -406,7 +406,7 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //redirect the user message::add($text['message-add']); diff --git a/app/gateways/app_config.php b/app/gateways/app_config.php index 5486038064..8cddfbb9c4 100644 --- a/app/gateways/app_config.php +++ b/app/gateways/app_config.php @@ -197,6 +197,14 @@ $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'] = "ping_min"; + $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'] = "ping_max"; + $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'] = "caller_id_in_from"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; diff --git a/app/gateways/app_languages.php b/app/gateways/app_languages.php index c7fef8b760..75a4823a4f 100644 --- a/app/gateways/app_languages.php +++ b/app/gateways/app_languages.php @@ -484,6 +484,48 @@ $text['label-ping']['ru-ru'] = "Пинг"; $text['label-ping']['sv-se'] = "Ping"; $text['label-ping']['uk-ua'] = "Пінг"; +$text['label-ping_min']['en-us'] = "Ping Min"; +$text['label-ping_min']['en-gb'] = ""; +$text['label-ping_min']['ar-eg'] = ""; +$text['label-ping_min']['de-at'] = ""; +$text['label-ping_min']['de-ch'] = ""; +$text['label-ping_min']['de-de'] = ""; +$text['label-ping_min']['es-cl'] = ""; +$text['label-ping_min']['es-mx'] = ""; +$text['label-ping_min']['fr-ca'] = ""; +$text['label-ping_min']['fr-fr'] = ""; +$text['label-ping_min']['he-il'] = ""; +$text['label-ping_min']['it-it'] = ""; +$text['label-ping_min']['nl-nl'] = ""; +$text['label-ping_min']['pl-pl'] = ""; +$text['label-ping_min']['pt-br'] = ""; +$text['label-ping_min']['pt-pt'] = ""; +$text['label-ping_min']['ro-ro'] = ""; +$text['label-ping_min']['ru-ru'] = ""; +$text['label-ping_min']['sv-se'] = ""; +$text['label-ping_min']['uk-ua'] = ""; + +$text['label-ping_max']['en-us'] = "Ping Max"; +$text['label-ping_max']['en-gb'] = ""; +$text['label-ping_max']['ar-eg'] = ""; +$text['label-ping_max']['de-at'] = ""; +$text['label-ping_max']['de-ch'] = ""; +$text['label-ping_max']['de-de'] = ""; +$text['label-ping_max']['es-cl'] = ""; +$text['label-ping_max']['es-mx'] = ""; +$text['label-ping_max']['fr-ca'] = ""; +$text['label-ping_max']['fr-fr'] = ""; +$text['label-ping_max']['he-il'] = ""; +$text['label-ping_max']['it-it'] = ""; +$text['label-ping_max']['nl-nl'] = ""; +$text['label-ping_max']['pl-pl'] = ""; +$text['label-ping_max']['pt-br'] = ""; +$text['label-ping_max']['pt-pt'] = ""; +$text['label-ping_max']['ro-ro'] = ""; +$text['label-ping_max']['ru-ru'] = ""; +$text['label-ping_max']['sv-se'] = ""; +$text['label-ping_max']['uk-ua'] = ""; + $text['label-password']['en-us'] = "Password"; $text['label-password']['en-gb'] = "Password"; $text['label-password']['ar-eg'] = "كلمة السر"; diff --git a/app/gateways/gateway_copy.php b/app/gateways/gateway_copy.php index 8cbd42a76f..81072b678f 100644 --- a/app/gateways/gateway_copy.php +++ b/app/gateways/gateway_copy.php @@ -75,12 +75,14 @@ $channels = $row["channels"]; $caller_id_in_from = $row["caller_id_in_from"]; $supress_cng = $row["supress_cng"]; + $sip_cid_type = $row["sip_cid_type"]; $extension_in_contact = $row["extension_in_contact"]; $effective_caller_id_name = $row["effective_caller_id_name"]; $effective_caller_id_number = $row["effective_caller_id_number"]; $outbound_caller_id_name = $row["outbound_caller_id_name"]; $outbound_caller_id_number = $row["outbound_caller_id_number"]; $context = $row["context"]; + $profile = $row["profile"]; $enabled = $row["enabled"]; $description = $row["description"]." (".$text['label-copy'].")"; } @@ -118,8 +120,10 @@ //$array['gateways'][0]['channels'] = $channels; $array['gateways'][0]['caller_id_in_from'] = $caller_id_in_from; $array['gateways'][0]['supress_cng'] = $supress_cng; + $array['gateways'][0]['sip_cid_type'] = $sip_cid_type; $array['gateways'][0]['extension_in_contact'] = $extension_in_contact; $array['gateways'][0]['context'] = $context; + $array['gateways'][0]['profile'] = $profile; $array['gateways'][0]['enabled'] = $enabled; $array['gateways'][0]['description'] = $description; diff --git a/app/gateways/gateway_edit.php b/app/gateways/gateway_edit.php index 17dda4f7f2..ec1eff8424 100644 --- a/app/gateways/gateway_edit.php +++ b/app/gateways/gateway_edit.php @@ -94,6 +94,8 @@ $retry_seconds = $_POST["retry_seconds"]; $extension = $_POST["extension"]; $ping = $_POST["ping"]; + $ping_min = $_POST["ping_min"]; + $ping_max = $_POST["ping_max"]; $channels = $_POST["channels"]; $caller_id_in_from = $_POST["caller_id_in_from"]; $supress_cng = $_POST["supress_cng"]; @@ -178,6 +180,8 @@ $array['gateways'][$x]["retry_seconds"] = $retry_seconds; $array['gateways'][$x]["extension"] = $extension; $array['gateways'][$x]["ping"] = $ping; + $array['gateways'][$x]["ping_min"] = $ping_min; + $array['gateways'][$x]["ping_max"] = $ping_max; $array['gateways'][$x]["channels"] = $channels; $array['gateways'][$x]["caller_id_in_from"] = $caller_id_in_from; $array['gateways'][$x]["supress_cng"] = $supress_cng; @@ -279,6 +283,8 @@ $retry_seconds = $row["retry_seconds"]; $extension = $row["extension"]; $ping = $row["ping"]; + $ping_min = $row["ping_min"]; + $ping_max = $row["ping_max"]; $channels = $row["channels"]; $caller_id_in_from = $row["caller_id_in_from"]; $supress_cng = $row["supress_cng"]; @@ -706,6 +712,28 @@ echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo " ".$text['label-ping_min']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-ping_min']."\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo " ".$text['label-ping_max']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-ping_max']."\n"; + echo "\n"; + echo "\n"; + if (permission_exists('gateway_channels')) { echo "\n"; echo "\n"; diff --git a/app/grandstream/app_config.php b/app/grandstream/app_config.php index a3606b7d9f..c760b39683 100644 --- a/app/grandstream/app_config.php +++ b/app/grandstream/app_config.php @@ -282,7 +282,7 @@ $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_dial_plan"; $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = '{\+x+|x+|*x+|*++|\p\a\r\k\+*x+|\f\l\o\w\+*x+}'; + $apps[$x]['default_settings'][$y]['default_setting_value'] = '{\+x+|x+|*x+|*++||\p\a\r\k\+*x+|\f\l\o\w\+*x+|**x+}'; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Define the digits that are allowed to be called."; $y++; @@ -614,53 +614,85 @@ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Ring Timeout (in seconds). Default is 60 (30-3600)"; $y++; - $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "06a35172-1bea-4611-87d0-9d66475ae709"; - $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; - $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_wallpaper_source"; - $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; - $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "0 - Default, 1 - Download, 2-USB(for GXP2140/2160/2170 only), 3 - Uploaded, 4 - Color Background"; - $y++; - $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "7ee552de-4634-4d61-8869-e0f5230858fa"; - $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; - $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_display_language"; - $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "Auto"; - $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "Display Language. See provision profile for codes."; - $y++; - $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "19604f85-b643-4b92-8e28-9c09c34cf559"; - $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; - $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_blind_xfer_blf"; - $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; - $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "Enable Blind Transfer to BLF Yes=1, No=0. Default=0"; - $y++; - $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "82b7076b-e596-49e8-b535-af86e21e0453"; - $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; - $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_ip_address_mode"; - $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; - $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "IP Address Mode. 0 - DHCP, 1 - Static IP, 2 - PPPoE. Default is 0"; - $y++; - $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "6ab26457-fcc8-414e-8ac5-ae681f114974"; - $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; - $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_speaker_ring_volume"; - $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "5"; - $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "Number: 0-7. Default is 5."; - $y++; - $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "fd0e54fe-1008-11eb-adc1-0242ac120002"; - $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; - $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_feature_key_sync"; - $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; - $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; - $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; - $apps[$x]['default_settings'][$y]['default_setting_description'] = "Enabled: 1, Disabled: 0 Defaults to 0. Valid for firmware higher than 1.0.9.202 for the GXP series and all firmwares GRP phones."; - $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "06a35172-1bea-4611-87d0-9d66475ae709"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_wallpaper_source"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "0 - Default, 1 - Download, 2-USB(for GXP2140/2160/2170 only), 3 - Uploaded, 4 - Color Background"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "7ee552de-4634-4d61-8869-e0f5230858fa"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_display_language"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "Auto"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Display Language. See provision profile for codes."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "19604f85-b643-4b92-8e28-9c09c34cf559"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_blind_xfer_blf"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Enable Blind Transfer to BLF Yes=1, No=0. Default=0"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "82b7076b-e596-49e8-b535-af86e21e0453"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_ip_address_mode"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "IP Address Mode. 0 - DHCP, 1 - Static IP, 2 - PPPoE. Default is 0"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "6ab26457-fcc8-414e-8ac5-ae681f114974"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_speaker_ring_volume"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "5"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Number: 0-7. Default is 5."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "6f3f3390-2b69-4898-a4d9-e62249d58d58"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_feature_key_sync"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "0"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Enabled: 1, Disabled: 0 Defaults to 0. Valid for firmware higher than 1.0.9.202 for the GXP series and all firmwares GRP phones."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "a6c84c0b-a7f1-4457-8afb-b64af601597d"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_wifi_enable"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = ""; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Configure the WiFi radio on supported phones. If disabled allow the device to manage itself"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "f7fdbe09-0d4a-4d06-b70b-e25cdf1b3376"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_wifi_essid"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = ""; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Configure the WiFi ESSID on supported phones"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "2edaa516-d87e-410f-8ddc-1cc468dabd2e"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_wifi_password"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = ""; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Configure the WiFi password on supported phones"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "7b525ca5-96ae-4104-ad6c-c929f85c30dc"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_wifi_hidden_security"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "None"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Configure the security to use when connecting to a hidden SSID. Valid values: None, WEP, WPA/WPA2_PSK, 802.1X_EAP"; + $y++; -?> +?> \ No newline at end of file diff --git a/app/ivr_menus/app_config.php b/app/ivr_menus/app_config.php index bb7b813c09..6b3841475f 100644 --- a/app/ivr_menus/app_config.php +++ b/app/ivr_menus/app_config.php @@ -271,6 +271,10 @@ $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'] = "ivr_menu_pin_number"; + $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'] = "ivr_menu_confirm_macro"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; diff --git a/app/ivr_menus/app_languages.php b/app/ivr_menus/app_languages.php index 62e135c59f..6b1cc89727 100644 --- a/app/ivr_menus/app_languages.php +++ b/app/ivr_menus/app_languages.php @@ -631,6 +631,27 @@ $text['label-destination']['ru-ru'] = "Место назначения"; $text['label-destination']['sv-se'] = "Destination"; $text['label-destination']['uk-ua'] = ""; +$text['label-pin_number']['en-us'] = "Pin Number"; +$text['label-pin_number']['en-gb'] = "Pin Number"; +$text['label-pin_number']['ar-eg'] = ""; +$text['label-pin_number']['de-at'] = "PIN Nummer"; //copied from de-de +$text['label-pin_number']['de-ch'] = "PIN Nummer"; //copied from de-de +$text['label-pin_number']['de-de'] = "PIN Nummer"; +$text['label-pin_number']['es-cl'] = "Número Pin"; +$text['label-pin_number']['es-mx'] = "Número Pin"; //copied from es-cl +$text['label-pin_number']['fr-ca'] = "Code Pin"; //copied from fr-fr +$text['label-pin_number']['fr-fr'] = "Code Pin"; +$text['label-pin_number']['he-il'] = ""; +$text['label-pin_number']['it-it'] = "PIN"; +$text['label-pin_number']['nl-nl'] = "PIN"; +$text['label-pin_number']['pl-pl'] = ""; +$text['label-pin_number']['pt-br'] = "Código Pin"; //copied from pt-pt +$text['label-pin_number']['pt-pt'] = "Código Pin"; +$text['label-pin_number']['ro-ro'] = ""; +$text['label-pin_number']['ru-ru'] = "PIN Номер"; +$text['label-pin_number']['sv-se'] = "Pin Nummer"; +$text['label-pin_number']['uk-ua'] = ""; + $text['label-comfirm_macro']['en-us'] = "Confirm Macro"; $text['label-comfirm_macro']['en-gb'] = "Confirm Macro"; $text['label-comfirm_macro']['ar-eg'] = ""; @@ -1366,6 +1387,27 @@ $text['description-destination']['ru-ru'] = "Выберите пункт наз $text['description-destination']['sv-se'] = "Välj destination."; $text['description-destination']['uk-ua'] = ""; +$text['description-pin_number']['en-us'] = "Optional pin number to secure access to the menu."; +$text['description-pin_number']['en-gb'] = "Optional pin number to secure access to the menu."; +$text['description-pin_number']['ar-eg'] = ""; +$text['description-pin_number']['de-at'] = ""; +$text['description-pin_number']['de-ch'] = ""; +$text['description-pin_number']['de-de'] = ""; +$text['description-pin_number']['es-cl'] = ""; +$text['description-pin_number']['es-mx'] = ""; +$text['description-pin_number']['fr-ca'] = ""; +$text['description-pin_number']['fr-fr'] = ""; +$text['description-pin_number']['he-il'] = ""; +$text['description-pin_number']['it-it'] = ""; +$text['description-pin_number']['nl-nl'] = ""; +$text['description-pin_number']['pl-pl'] = ""; +$text['description-pin_number']['pt-br'] = ""; +$text['description-pin_number']['pt-pt'] = ""; +$text['description-pin_number']['ro-ro'] = ""; +$text['description-pin_number']['ru-ru'] = ""; +$text['description-pin_number']['sv-se'] = ""; +$text['description-pin_number']['uk-ua'] = ""; + $text['description-comfirm_macro']['en-us'] = "Enter the confirm macro."; $text['description-comfirm_macro']['en-gb'] = "Enter the confirm macro."; $text['description-comfirm_macro']['ar-eg'] = ""; diff --git a/app/ivr_menus/ivr_menu_copy.php b/app/ivr_menus/ivr_menu_copy.php index 21cd68476f..c3488f97b6 100644 --- a/app/ivr_menus/ivr_menu_copy.php +++ b/app/ivr_menus/ivr_menu_copy.php @@ -57,7 +57,7 @@ $database = new database; $ivr_menus = $database->select($sql, $parameters, 'all'); if (!is_array($ivr_menus)) { - echo "access denied 63"; + echo "access denied"; exit; } unset($sql, $parameters); @@ -84,6 +84,7 @@ $ivr_menu_name = $ivr_menus[$x]['ivr_menu_name']; $ivr_menu_extension = $ivr_menus[$x]['ivr_menu_extension']; $ivr_menu_ringback = $ivr_menus[$x]['ivr_menu_ringback']; + $ivr_menu_context = $ivr_menus[$x]['ivr_menu_context']; $ivr_menu_description = $ivr_menus[$x]['ivr_menu_description'].' ('.$text['label-copy'].')'; //prepare the ivr menu array @@ -123,7 +124,7 @@ $dialplan[$x]["dialplan_uuid"] = $dialplan_uuid; $dialplan[$x]["dialplan_name"] = $ivr_menu_name; $dialplan[$x]["dialplan_number"] = $ivr_menu_extension; - $dialplan[$x]["dialplan_context"] = $_SESSION["context"]; + $dialplan[$x]["dialplan_context"] = $ivr_menu_context; $dialplan[$x]["dialplan_continue"] = "false"; $dialplan[$x]["dialplan_xml"] = $dialplan_xml; $dialplan[$x]["dialplan_order"] = "101"; @@ -156,7 +157,7 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$ivr_menu_context); //set message message::add($text['message-copy']); diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index 093d49138a..78d2b86999 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -112,6 +112,7 @@ $ivr_menu_options = $_POST["ivr_menu_options"]; $ivr_menu_invalid_sound = $_POST["ivr_menu_invalid_sound"]; $ivr_menu_exit_sound = $_POST["ivr_menu_exit_sound"]; + $ivr_menu_pin_number = $_POST["ivr_menu_pin_number"]; $ivr_menu_confirm_macro = $_POST["ivr_menu_confirm_macro"]; $ivr_menu_confirm_key = $_POST["ivr_menu_confirm_key"]; $ivr_menu_tts_engine = $_POST["ivr_menu_tts_engine"]; @@ -260,6 +261,7 @@ $array['ivr_menus'][0]["ivr_menu_greet_short"] = $ivr_menu_greet_short; $array['ivr_menus'][0]["ivr_menu_invalid_sound"] = $ivr_menu_invalid_sound; $array['ivr_menus'][0]["ivr_menu_exit_sound"] = $ivr_menu_exit_sound; + $array['ivr_menus'][0]["ivr_menu_pin_number"] = $ivr_menu_pin_number; $array['ivr_menus'][0]["ivr_menu_confirm_macro"] = $ivr_menu_confirm_macro; $array['ivr_menus'][0]["ivr_menu_confirm_key"] = $ivr_menu_confirm_key; $array['ivr_menus'][0]["ivr_menu_tts_engine"] = $ivr_menu_tts_engine; @@ -456,6 +458,7 @@ $ivr_menu_greet_short = $row["ivr_menu_greet_short"]; $ivr_menu_invalid_sound = $row["ivr_menu_invalid_sound"]; $ivr_menu_exit_sound = $row["ivr_menu_exit_sound"]; + $ivr_menu_pin_number = $row["ivr_menu_pin_number"]; $ivr_menu_confirm_macro = $row["ivr_menu_confirm_macro"]; $ivr_menu_confirm_key = $row["ivr_menu_confirm_key"]; $ivr_menu_tts_engine = $row["ivr_menu_tts_engine"]; @@ -1406,6 +1409,17 @@ echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo " ".$text['label-pin_number']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-pin_number']."\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo " ".$text['label-comfirm_macro']."\n"; diff --git a/app/ivr_menus/resources/classes/ivr_menu.php b/app/ivr_menus/resources/classes/ivr_menu.php index 40a46246fb..3d7aa56904 100644 --- a/app/ivr_menus/resources/classes/ivr_menu.php +++ b/app/ivr_menus/resources/classes/ivr_menu.php @@ -52,9 +52,9 @@ if (!class_exists('ivr_menu')) { public function __construct() { //assign private variables - $this->app_name = 'ivr_menus'; - $this->app_uuid = 'a5788e9b-58bc-bd1b-df59-fff5d51253ab'; - $this->list_page = 'ivr_menus.php'; + $this->app_name = 'ivr_menus'; + $this->app_uuid = 'a5788e9b-58bc-bd1b-df59-fff5d51253ab'; + $this->list_page = 'ivr_menus.php'; } @@ -324,7 +324,7 @@ if (!class_exists('ivr_menu')) { //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION['domain_name']); foreach ($ivr_menus as $ivr_menu_uuid => $ivr_menu) { $cache->delete("configuration:ivr.conf:".$ivr_menu_uuid); } @@ -467,7 +467,7 @@ if (!class_exists('ivr_menu')) { //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION['domain_name']); //set message message::add($text['message-copy']); diff --git a/app/ivr_menus/resources/functions/ivr_menu_xml.php b/app/ivr_menus/resources/functions/ivr_menu_xml.php index 6178d5c5a9..ee5de986e7 100644 --- a/app/ivr_menus/resources/functions/ivr_menu_xml.php +++ b/app/ivr_menus/resources/functions/ivr_menu_xml.php @@ -82,6 +82,7 @@ $ivr_menu_max_timeouts = $row["ivr_menu_max_timeouts"]; $ivr_menu_digit_len = $row["ivr_menu_digit_len"]; $ivr_menu_direct_dial = $row["ivr_menu_direct_dial"]; + $ivr_menu_context = $row["ivr_menu_context"]; $ivr_menu_enabled = $row["ivr_menu_enabled"]; $ivr_menu_description = $row["ivr_menu_description"]; @@ -159,7 +160,7 @@ unset($sub_sql, $sub_result, $sub_row); if ($ivr_menu_direct_dial == "true") { - $tmp .= " \n"; + $tmp .= " \n"; } $tmp .= " \n"; $tmp .= "\n"; diff --git a/app/provision/index.php b/app/provision/index.php index 037df0b9ff..aba0070ba6 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -155,88 +155,6 @@ //get the domain name $domain_name = $_SESSION['domains'][$domain_uuid]['domain_name']; - //get the default settings - $sql = "select * from v_default_settings "; - $sql .= "where default_setting_enabled = 'true' "; - $sql .= "order by default_setting_order asc "; - $database = new database; - $result = $database->select($sql, null, 'all'); - //unset the previous settings - if (is_array($result) && @sizeof($result) != 0) { - foreach ($result as $row) { - unset($_SESSION[$row['default_setting_category']]); - } - //set the settings as a session - foreach ($result as $row) { - $name = $row['default_setting_name']; - $category = $row['default_setting_category']; - $subcategory = $row['default_setting_subcategory']; - if (strlen($subcategory) == 0) { - if ($name == "array") { - $_SESSION[$category][] = $row['default_setting_value']; - } - else { - $_SESSION[$category][$name] = $row['default_setting_value']; - } - } - else { - if ($name == "array") { - $_SESSION[$category][$subcategory][] = $row['default_setting_value']; - } - else { - $_SESSION[$category][$subcategory]['uuid'] = $row['default_setting_uuid']; - $_SESSION[$category][$subcategory][$name] = $row['default_setting_value']; - } - } - } - } - unset($sql, $result, $row); - - //get the domains settings - if (is_uuid($domain_uuid)) { - $sql = "select * from v_domain_settings "; - $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and domain_setting_enabled = 'true' "; - $sql .= "order by domain_setting_order asc "; - $parameters['domain_uuid'] = $domain_uuid; - $database = new database; - $result = $database->select($sql, $parameters, 'all'); - //unset the arrays that domains are overriding - if (is_array($result) && @sizeof($result) != 0) { - foreach ($result as $row) { - $name = $row['domain_setting_name']; - $category = $row['domain_setting_category']; - $subcategory = $row['domain_setting_subcategory']; - if ($name == "array") { - unset($_SESSION[$category][$subcategory]); - } - } - //set the settings as a session - foreach ($result as $row) { - $name = $row['domain_setting_name']; - $category = $row['domain_setting_category']; - $subcategory = $row['domain_setting_subcategory']; - if (strlen($subcategory) == 0) { - //$$category[$name] = $row['domain_setting_value']; - if ($name == "array") { - $_SESSION[$category][] = $row['domain_setting_value']; - } - else { - $_SESSION[$category][$name] = $row['domain_setting_value']; - } - } - else { - //$$category[$subcategory][$name] = $row['domain_setting_value']; - if ($name == "array") { - $_SESSION[$category][$subcategory][] = $row['domain_setting_value']; - } - else { - $_SESSION[$category][$subcategory][$name] = $row['domain_setting_value']; - } - } - } - } - } } else { //get the domain_name @@ -252,6 +170,89 @@ unset($sql, $parameters); } +//get the default settings + $sql = "select * from v_default_settings "; + $sql .= "where default_setting_enabled = 'true' "; + $sql .= "order by default_setting_order asc "; + $database = new database; + $result = $database->select($sql, null, 'all'); + //unset the previous settings + if (is_array($result) && @sizeof($result) != 0) { + foreach ($result as $row) { + unset($_SESSION[$row['default_setting_category']]); + } + //set the settings as a session + foreach ($result as $row) { + $name = $row['default_setting_name']; + $category = $row['default_setting_category']; + $subcategory = $row['default_setting_subcategory']; + if (strlen($subcategory) == 0) { + if ($name == "array") { + $_SESSION[$category][] = $row['default_setting_value']; + } + else { + $_SESSION[$category][$name] = $row['default_setting_value']; + } + } + else { + if ($name == "array") { + $_SESSION[$category][$subcategory][] = $row['default_setting_value']; + } + else { + $_SESSION[$category][$subcategory]['uuid'] = $row['default_setting_uuid']; + $_SESSION[$category][$subcategory][$name] = $row['default_setting_value']; + } + } + } + } + unset($sql, $result, $row); + +//get the domains settings + if (is_uuid($domain_uuid)) { + $sql = "select * from v_domain_settings "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "and domain_setting_enabled = 'true' "; + $sql .= "order by domain_setting_order asc "; + $parameters['domain_uuid'] = $domain_uuid; + $database = new database; + $result = $database->select($sql, $parameters, 'all'); + //unset the arrays that domains are overriding + if (is_array($result) && @sizeof($result) != 0) { + foreach ($result as $row) { + $name = $row['domain_setting_name']; + $category = $row['domain_setting_category']; + $subcategory = $row['domain_setting_subcategory']; + if ($name == "array") { + unset($_SESSION[$category][$subcategory]); + } + } + //set the settings as a session + foreach ($result as $row) { + $name = $row['domain_setting_name']; + $category = $row['domain_setting_category']; + $subcategory = $row['domain_setting_subcategory']; + if (strlen($subcategory) == 0) { + //$$category[$name] = $row['domain_setting_value']; + if ($name == "array") { + $_SESSION[$category][] = $row['domain_setting_value']; + } + else { + $_SESSION[$category][$name] = $row['domain_setting_value']; + } + } + else { + //$$category[$subcategory][$name] = $row['domain_setting_value']; + if ($name == "array") { + $_SESSION[$category][$subcategory][] = $row['domain_setting_value']; + } + else { + $_SESSION[$category][$subcategory][$name] = $row['domain_setting_value']; + } + } + } + } + } + //build the provision array foreach($_SESSION['provision'] as $key=>$val) { if (strlen($val['var']) > 0) { $value = $val['var']; } diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 0d87cf90ce..a5e702093f 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -460,6 +460,9 @@ include "root.php"; $templates['HW GXP1620'] = 'grandstream/gxp16xx'; $templates['HW GXP1625'] = 'grandstream/gxp16xx'; $templates['HW GXP1630'] = 'grandstream/gxp16xx'; + $templates['HW GXP1760W'] = 'grandstream/gxp17xx'; + $templates['HW GXP1780'] = 'grandstream/gxp17xx'; + $templates['HW GXP1782'] = 'grandstream/gxp17xx'; $templates['HW GXP2124'] = 'grandstream/gxp2124'; $templates['HW GXP2130'] = 'grandstream/gxp2130'; $templates['HW GXP2135'] = 'grandstream/gxp2135'; diff --git a/app/scripts/resources/scripts/app/call_block/index.lua b/app/scripts/resources/scripts/app/call_block/index.lua index 9e10fc4ddd..48aa13a589 100644 --- a/app/scripts/resources/scripts/app/call_block/index.lua +++ b/app/scripts/resources/scripts/app/call_block/index.lua @@ -44,8 +44,10 @@ if (session:ready()) then --session:setAutoHangup(false); domain_uuid = session:getVariable("domain_uuid"); + call_direction = session:getVariable("call_direction"); caller_id_name = session:getVariable("caller_id_name"); caller_id_number = session:getVariable("caller_id_number"); + destination_number = session:getVariable("destination_number"); context = session:getVariable("context"); call_block = session:getVariable("call_block"); extension_uuid = session:getVariable("extension_uuid"); @@ -90,23 +92,48 @@ assert(dbh:connected()); --check to see if the call should be blocked - sql = "select * from v_call_block "; - sql = sql .. "where domain_uuid = :domain_uuid "; - sql = sql .. "and call_block_enabled = 'true' "; - sql = sql .. "and ( "; - sql = sql .. " (call_block_name = :call_block_name and call_block_number = :call_block_number) "; - sql = sql .. " or (call_block_name is null and call_block_number = :call_block_number) "; - sql = sql .. " or (call_block_name = :call_block_name and call_block_number is null) "; - sql = sql .. ") "; + sql = "select * from v_call_block\n"; + sql = sql .. "where domain_uuid = :domain_uuid \n"; + sql = sql .. "and call_block_enabled = 'true' \n"; + sql = sql .. "and call_block_direction = :call_block_direction \n"; + sql = sql .. "and ( \n"; + sql = sql .. " (\n"; + sql = sql .. " call_block_name = :call_block_name \n"; + sql = sql .. " and ( \n"; + sql = sql .. " '+' || call_block_country_code || call_block_number = :call_block_number \n"; + sql = sql .. " or call_block_country_code || call_block_number = :call_block_number \n"; + sql = sql .. " or call_block_number = :call_block_number \n"; + sql = sql .. " ) \n"; + sql = sql .. " ) \n"; + sql = sql .. " or (\n"; + sql = sql .. " call_block_name is null \n"; + sql = sql .. " and ( \n"; + sql = sql .. " '+' || call_block_country_code || call_block_number = :call_block_number \n"; + sql = sql .. " or call_block_country_code || call_block_number = :call_block_number \n"; + sql = sql .. " or call_block_number = :call_block_number \n"; + sql = sql .. " ) \n"; + sql = sql .. " ) \n"; + sql = sql .. " or (call_block_name = :call_block_name and call_block_number is null) \n"; + sql = sql .. ") \n"; if (extension_uuid == nil) then sql = sql .. "and extension_uuid is null "; else sql = sql .. "and (extension_uuid is null or extension_uuid = :extension_uuid) "; end if (extension_uuid ~= nil) then - params = {domain_uuid = domain_uuid, call_block_name = caller_id_name, call_block_number = caller_id_number, extension_uuid = extension_uuid}; + if (call_direction == 'inbound') then + params = {domain_uuid = domain_uuid, call_block_direction = call_direction, call_block_name = caller_id_name, call_block_number = caller_id_number, extension_uuid = extension_uuid}; + end + if (call_direction == 'outbound') then + params = {domain_uuid = domain_uuid, call_block_direction = call_direction, call_block_name = caller_id_name, call_block_number = destination_number, extension_uuid = extension_uuid}; + end else - params = {domain_uuid = domain_uuid, call_block_name = caller_id_name, call_block_number = caller_id_number}; + if (call_direction == 'inbound') then + params = {domain_uuid = domain_uuid, call_block_direction = call_direction, call_block_name = caller_id_name, call_block_number = caller_id_number}; + end + if (call_direction == 'outbound') then + params = {domain_uuid = domain_uuid, call_block_direction = call_direction, call_block_name = caller_id_name, call_block_number = destination_number}; + end end if (debug["sql"]) then freeswitch.consoleLog("notice", "[dialplan] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); @@ -217,4 +244,4 @@ freeswitch.consoleLog("notice", "[call_block] " .. call_block_cache_key .. " source: cache\n"); end end - end + end \ No newline at end of file diff --git a/app/scripts/resources/scripts/app/voicemail/resources/functions/mwi_notify.lua b/app/scripts/resources/scripts/app/voicemail/resources/functions/mwi_notify.lua index f274ddffc5..39936cbdc3 100644 --- a/app/scripts/resources/scripts/app/voicemail/resources/functions/mwi_notify.lua +++ b/app/scripts/resources/scripts/app/voicemail/resources/functions/mwi_notify.lua @@ -12,6 +12,11 @@ array = explode("/", sofia_contact); sip_profile = array[2]; + --debug info + --freeswitch.consoleLog("NOTICE", "sofia_contact */"..account.."\n"); + --freeswitch.consoleLog("NOTICE", "sip_profile="..sip_profile.."\n"); + --freeswitch.consoleLog("NOTICE", "sofia_contact="..sofia_contact.."\n"); + --set the variables new_messages = tonumber(new_messages) or 0 saved_messages = tonumber(saved_messages) or 0 diff --git a/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua b/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua index 7943ff2355..92efeb7a27 100644 --- a/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua +++ b/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua @@ -277,73 +277,71 @@ end end end - - if (transcribe_provider == "google") then - local api_key = settings:get('voicemail', 'google_key', 'text') or ''; - local transcription_server = settings:get('voicemail', 'google_url', 'text') or ''; - if (api_key ~= '') then - transcribe_cmd = [[sox ]]..file_path..[[ ]]..file_path..[[.flac && echo "{ 'config': { 'languageCode': 'en-US', 'enableWordTimeOffsets': false }, 'audio': { 'content': '`base64 -w 0 ]]..file_path..[[.flac`' } }" | curl -X POST -H "Content-Type: application/json" -d @- "]]..transcription_server..[[:recognize?key=]]..api_key..[[" && rm -f ]]..file_path..[[.flac]] -end + if (transcribe_provider == "google") then + local api_key = settings:get('voicemail', 'google_key', 'text') or ''; + local transcription_server = settings:get('voicemail', 'google_url', 'text') or ''; + if (api_key ~= '') then + transcribe_cmd = [[sox ]]..file_path..[[ ]]..file_path..[[.flac trim 0 00:59 && echo "{ 'config': { 'languageCode': 'en-US', 'enableWordTimeOffsets': false , 'enableAutomaticPunctuation': true , 'alternativeLanguageCodes': 'es' }, 'audio': { 'content': '`base64 -w 0 ]]..file_path..[[.flac`' } }" | curl -X POST -H "Content-Type: application/json" -d @- "]]..transcription_server..[[:recognize?key=]]..api_key..[[" && rm -f ]]..file_path..[[.flac]] + end - local handle = io.popen(transcribe_cmd); - local transcribe_result = handle:read("*a"); - transcribe_result = transcribe_result:gsub('%%HESITATION ', ''); - handle:close(); - if (debug["info"]) then - freeswitch.consoleLog("notice", "[voicemail] CMD: " .. transcribe_cmd .. "\n"); - freeswitch.consoleLog("notice", "[voicemail] RESULT: " .. transcribe_result .. "\n"); - end + local handle = io.popen(transcribe_cmd); + local transcribe_result = handle:read("*a"); + transcribe_result = transcribe_result:gsub('%%HESITATION ', ''); + handle:close(); + if (debug["info"]) then + freeswitch.consoleLog("notice", "[voicemail] CMD: " .. transcribe_cmd .. "\n"); + freeswitch.consoleLog("notice", "[voicemail] RESULT: " .. transcribe_result .. "\n"); + end - --Trancribe request can fail - if (transcribe_result == '') then - freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: (null) \n"); - return '' - else - status, transcribe_json = pcall(JSON.decode, transcribe_result); - if not status then - if (debug["info"]) then - freeswitch.consoleLog("notice", "[voicemail] error decoding google json\n"); - end - return ''; - end - end - - if (transcribe_json["results"] ~= nil) then - --Transcription - if (transcribe_json["results"][1]["alternatives"][1]["transcript"] ~= nil) then - transcription = ''; - for key, row in pairs(transcribe_json["results"]) do - transcription = transcription .. row["alternatives"][1]["transcript"]; - end - if (debug["info"]) then - freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: " .. transcription .. "\n"); - end - else - if (debug["info"]) then - freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: (null) \n"); - end - return ''; + --Trancribe request can fail + if (transcribe_result == '') then + freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: (null) \n"); + return '' + else + status, transcribe_json = pcall(JSON.decode, transcribe_result); + if not status then + if (debug["info"]) then + freeswitch.consoleLog("notice", "[voicemail] error decoding google json\n"); end - --Confidence - if (transcribe_json["results"][1]["alternatives"][1]["confidence"]) then - if (debug["info"]) then - freeswitch.consoleLog("notice", "[voicemail] CONFIDENCE: " .. transcribe_json["results"][1]["alternatives"][1]["confidence"] .. "\n"); - end - confidence = transcribe_json["results"][1]["alternatives"][1]["confidence"]; - else - if (debug["info"]) then - freeswitch.consoleLog("notice", "[voicemail] CONFIDENCE: (null) \n"); - end + return ''; + end + end + if (transcribe_json["results"] ~= nil) then + --Transcription + if (transcribe_json["results"][1]["alternatives"][1]["transcript"] ~= nil) then + transcription = ''; + for key, row in pairs(transcribe_json["results"]) do + transcription = transcription .. row["alternatives"][1]["transcript"]; + end + if (debug["info"]) then + freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: " .. transcription .. "\n"); end - return transcription; else if (debug["info"]) then - freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: json error \n"); + freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: (null) \n"); end return ''; end + --Confidence + if (transcribe_json["results"][1]["alternatives"][1]["confidence"]) then + if (debug["info"]) then + freeswitch.consoleLog("notice", "[voicemail] CONFIDENCE: " .. transcribe_json["results"][1]["alternatives"][1]["confidence"] .. "\n"); + end + confidence = transcribe_json["results"][1]["alternatives"][1]["confidence"]; + else + if (debug["info"]) then + freeswitch.consoleLog("notice", "[voicemail] CONFIDENCE: (null) \n"); + end + end + return transcription; + else + if (debug["info"]) then + freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: json error \n"); + end + return ''; end + end if (transcribe_provider == "custom") then local transcription_server = settings:get('voicemail', 'transcription_server', 'text') or ''; @@ -396,9 +394,9 @@ end local message_max_length = settings:get('voicemail', 'message_max_length', 'numeric') or 300; local message_silence_threshold = settings:get('voicemail', 'message_silence_threshold', 'numeric') or 200; local message_silence_seconds = settings:get('voicemail', 'message_silence_seconds', 'numeric') or 3; - transcribe_enabled = settings:get('voicemail', 'transcribe_enabled', 'boolean') or "false"; + local email_queue_enabled = settings:get('email_queue', 'enabled', 'boolean') or "false"; local transcribe_provider = settings:get('voicemail', 'transcribe_provider', 'text') or ''; - local email_method = settings:get('email', 'method', 'text') or "smtp"; + transcribe_enabled = settings:get('voicemail', 'transcribe_enabled', 'boolean') or "false"; --debug information if (debug["info"]) then @@ -528,7 +526,7 @@ end start_epoch = os.time(); --if using the email queue disable inline transcription - if (email_method == 'queue') then + if (email_queue_enabled == 'true') then transcribe_enabled = 'false'; end diff --git a/app/scripts/resources/scripts/app/voicemail/resources/functions/send_email.lua b/app/scripts/resources/scripts/app/voicemail/resources/functions/send_email.lua index b7941aa6ee..ea144fdb93 100644 --- a/app/scripts/resources/scripts/app/voicemail/resources/functions/send_email.lua +++ b/app/scripts/resources/scripts/app/voicemail/resources/functions/send_email.lua @@ -32,8 +32,8 @@ function send_email(id, uuid) local db = dbh or Database.new('system') local settings = Settings.new(db, domain_name, domain_uuid) - local email_method = settings:get('email', 'method', 'text'); local transcribe_enabled = settings:get('voicemail', 'transcribe_enabled', 'boolean'); + local email_queue_enabled = settings:get('email_queue', 'enabled', 'boolean') or "false"; --get voicemail message details local sql = [[SELECT * FROM v_voicemails @@ -48,6 +48,7 @@ --voicemail_password = row["voicemail_password"]; --greeting_id = row["greeting_id"]; voicemail_mail_to = row["voicemail_mail_to"]; + voicemail_transcription_enabled = row["voicemail_transcription_enabled"]; voicemail_file = row["voicemail_file"]; voicemail_local_after_email = row["voicemail_local_after_email"]; voicemail_description = row["voicemail_description"]; @@ -135,7 +136,7 @@ sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) "; sql = sql .. "AND template_language = :template_language "; sql = sql .. "AND template_category = 'voicemail' " - if (transcribe_enabled == 'true') then + if (transcribe_enabled == 'true' and voicemail_transcription_enabled == 'true') then sql = sql .. "AND template_subcategory = 'transcription' " else sql = sql .. "AND template_subcategory = 'default' " @@ -184,6 +185,7 @@ subject = subject:gsub("${voicemail_description}", voicemail_description); subject = subject:gsub("${voicemail_name_formatted}", voicemail_name_formatted); subject = subject:gsub("${domain_name}", domain_name); + subject = subject:gsub("${new_messages}", new_messages); subject = trim(subject); subject = '=?utf-8?B?'..base64.encode(subject)..'?='; @@ -202,7 +204,9 @@ body = body:gsub("${voicemail_name_formatted}", voicemail_name_formatted); body = body:gsub("${domain_name}", domain_name); body = body:gsub("${sip_to_user}", id); - body = body:gsub("${origination_callee_id_name}", origination_callee_id_name); + if (origination_callee_id_name ~= nil) then + body = body:gsub("${origination_callee_id_name}", origination_callee_id_name); + end body = body:gsub("${dialed_user}", id); if (voicemail_file == "attach") then body = body:gsub("${message}", text['label-attached']); @@ -228,7 +232,7 @@ end --whether to keep the voicemail message and details local after email - if (string.len(voicemail_mail_to) > 2 and email_method ~= 'queue') then + if (string.len(voicemail_mail_to) > 2 and email_queue_enabled == 'false') then if (voicemail_local_after_email == "false") then --delete the voicemail message details local sql = [[DELETE FROM v_voicemail_messages diff --git a/app/scripts/resources/scripts/app/voicemail/resources/scripts/mwi_notify.lua b/app/scripts/resources/scripts/app/voicemail/resources/scripts/mwi_notify.lua new file mode 100644 index 0000000000..fdc83fcdc3 --- /dev/null +++ b/app/scripts/resources/scripts/app/voicemail/resources/scripts/mwi_notify.lua @@ -0,0 +1,22 @@ + +--get the argv values + voicemail_id = argv[1]; + domain_name = argv[2]; + new_messages = argv[3] or '0'; + saved_messages = argv[4] or '0'; + +--include the lua script + require "resources.functions.config"; + +--send MWI NOTIFY message + require "app.voicemail.resources.functions.mwi_notify"; + +--debug info + --freeswitch.consoleLog("NOTICE", "voicemail_id="..voicemail_id.."\n"); + --freeswitch.consoleLog("NOTICE", "domain_name="..domain_name.."\n"); + --freeswitch.consoleLog("NOTICE", "new_messages="..new_messages.."\n"); + --freeswitch.consoleLog("NOTICE", "saved_messages="..saved_messages.."\n"); + +--send the message waiting event + mwi_notify(voicemail_id..'@'..domain_name, domain_name, new_messages, saved_messages); + diff --git a/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua b/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua index 5492491ad5..62bc459e5f 100644 --- a/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua +++ b/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/ivr.conf.lua @@ -98,6 +98,7 @@ ivr_menu_greet_short = row["ivr_menu_greet_short"]; ivr_menu_invalid_sound = row["ivr_menu_invalid_sound"]; ivr_menu_exit_sound = row["ivr_menu_exit_sound"]; + ivr_menu_pin_number = row["ivr_menu_pin_number"]; ivr_menu_confirm_macro = row["ivr_menu_confirm_macro"]; ivr_menu_confirm_key = row["ivr_menu_confirm_key"]; ivr_menu_tts_engine = row["ivr_menu_tts_engine"]; @@ -248,6 +249,7 @@ table.insert(xml, [[ greet-short="]]..ivr_menu_greet_short..[[" ]]); table.insert(xml, [[ invalid-sound="]]..ivr_menu_invalid_sound..[[" ]]); table.insert(xml, [[ exit-sound="]]..ivr_menu_exit_sound..[[" ]]); + table.insert(xml, [[ pin="]]..ivr_menu_pin_number..[[" ]]); table.insert(xml, [[ confirm-macro="]]..ivr_menu_confirm_macro..[[" ]]); table.insert(xml, [[ confirm-key="]]..ivr_menu_confirm_key..[[" ]]); table.insert(xml, [[ tts-engine="]]..ivr_menu_tts_engine..[[" ]]); diff --git a/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua b/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua index 71beae1443..6274ab2e4c 100644 --- a/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua +++ b/app/scripts/resources/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua @@ -181,6 +181,12 @@ if (string.len(field.ping) > 0) then table.insert(xml, [[ ]]); end + if (string.len(field.ping_min) > 0) then + table.insert(xml, [[ ]]); + end + if (string.len(field.ping_max) > 0) then + table.insert(xml, [[ ]]); + end if (string.len(field.context) > 0) then table.insert(xml, [[ ]]); end diff --git a/app/scripts/resources/scripts/resources/functions/send_mail.lua b/app/scripts/resources/scripts/resources/functions/send_mail.lua index 72af13bf59..aa5837a4cc 100644 --- a/app/scripts/resources/scripts/resources/functions/send_mail.lua +++ b/app/scripts/resources/scripts/resources/functions/send_mail.lua @@ -3,28 +3,11 @@ local Database = require "resources.functions.database"; local cache = require"resources.functions.cache"; local log = require "resources.functions.log".send_mail - local db = dbh or Database.new('system'); ---local settings = Settings.new(db, nil, nil); ---local email_method = settings:get('email', 'method', 'text'); +local settings = Settings.new(db, domain_name, domain_uuid) +local email_queue_enabled = settings:get('email_queue', 'enabled', 'boolean') or "false"; ---get the dialplan mode from the cache -email_method_key = "settings:email:email_mode"; -email_method, err = cache.get(email_method_key); - ---if not found in the cache then get it from the database -if (err == 'NOT FOUND') then - --get the mode from default settings - sql = "select default_setting_value from v_default_settings " - sql = sql .. "where default_setting_category = 'email' "; - sql = sql .. "and default_setting_subcategory = 'method' "; - email_method = db:first_value(sql, nil); - if (email_method) then - local ok, err = cache.set(email_method_key, email_method, expire["dialplan"]); - end -end - -if (email_method == 'queue') then +if (email_queue_enabled == 'true') then function send_mail(headers, email_address, email_message, email_file) --include json library @@ -36,7 +19,14 @@ if (email_method == 'queue') then local domain_uuid = headers["X-FusionPBX-Domain-UUID"]; local domain_name = headers["X-FusionPBX-Domain-Name"]; local email_type = headers["X-FusionPBX-Email-Type"] or 'info'; - local call_uuid = headers["X-FusionPBX-Email-Call-UUID"]; + local call_uuid = headers["X-FusionPBX-Call-UUID"]; + local local_after_email = headers["X-FusionPBX-local_after_email"] or ''; + + if (local_after_email == 'false') then + email_action_after = 'delete'; + else + email_action_after = ''; + end local settings = Settings.new(db, domain_name, domain_uuid); @@ -65,7 +55,10 @@ if (email_method == 'queue') then sql = sql .. " email_to, "; sql = sql .. " email_subject, "; sql = sql .. " email_body, "; - sql = sql .. " email_status "; + sql = sql .. " email_status, "; + sql = sql .. " email_uuid, "; + sql = sql .. " email_action_after "; + sql = sql .. ") "; sql = sql .. "values ( "; sql = sql .. " :email_queue_uuid, "; @@ -76,7 +69,9 @@ if (email_method == 'queue') then sql = sql .. " :email_to, "; sql = sql .. " :email_subject, "; sql = sql .. " :email_body, "; - sql = sql .. " :email_status "; + sql = sql .. " :email_status, "; + sql = sql .. " :email_uuid, "; + sql = sql .. " :email_action_after "; sql = sql .. ") "; local params = { email_queue_uuid = email_queue_uuid; @@ -87,6 +82,8 @@ if (email_method == 'queue') then email_subject = email_subject; email_body = email_body; email_status = email_status; + email_uuid = call_uuid; + email_action_after = email_action_after; } db:query(sql, params); @@ -100,7 +97,8 @@ if (email_method == 'queue') then local email_table = split(email_file, '/', true) email_attachment_name = email_table[#email_table] - email_attachment_path = email_file.sub(email_file, 0, (string.len(email_file) - string.len(email_attachment_name)) - 1); + email_attachment_path = email_file.sub(email_file, 0, (string.len(email_file) - string.len(email_attachment_name)) - 1); + --freeswitch.consoleLog("notice", "[send_email] voicemail path: " .. email_attachment_path .. "/" .. email_attachment_name .. "\n"); --base64 encode the file --local file = require "resources.functions.file" @@ -136,7 +134,7 @@ if (email_method == 'queue') then email_attachment_base64 = email_attachment_base64; } if (debug["sql"]) then - freeswitch.consoleLog("notice", "[dialplan] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); + freeswitch.consoleLog("notice", "[send_email] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); end db:query(sql, params); end @@ -162,7 +160,7 @@ else local domain_uuid = headers["X-FusionPBX-Domain-UUID"] local domain_name = headers["X-FusionPBX-Domain-Name"] local email_type = headers["X-FusionPBX-Email-Type"] or 'info' - local call_uuid = headers["X-FusionPBX-Email-Call-UUID"] + local call_uuid = headers["X-FusionPBX-Call-UUID"] local db = dbh or Database.new('system') local settings = Settings.new(db, domain_name, domain_uuid) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 7b2aa374f4..81803862a0 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -501,7 +501,7 @@ //clear the cache $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["domain_name"]); //set the message if ($action == "add") { diff --git a/app/voicemails/app_config.php b/app/voicemails/app_config.php index 60a2d41e43..c357ce090a 100644 --- a/app/voicemails/app_config.php +++ b/app/voicemails/app_config.php @@ -317,7 +317,7 @@ $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary"; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_id"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the voicemail id."; $z++; diff --git a/core/authentication/resources/classes/plugins/database.php b/core/authentication/resources/classes/plugins/database.php index ceb6405596..df85e1e936 100644 --- a/core/authentication/resources/classes/plugins/database.php +++ b/core/authentication/resources/classes/plugins/database.php @@ -30,13 +30,15 @@ class plugin_database { $user_authorized = false; //check the username and password if they don't match then redirect to the login - $sql = "select * from v_users "; + $sql = "select u.user_uuid, u.contact_uuid, u.username, u.password, u.salt, u.api_key, u.domain_uuid, d.domain_name "; + $sql .= "from v_users as u, v_domains as d "; + $sql .= "where u.domain_uuid = d.domain_uuid "; if (strlen($this->key) > 30) { - $sql .= "where api_key = :api_key "; + $sql .= "and u.api_key = :api_key "; $parameters['api_key'] = $this->key; } else { - $sql .= "where lower(username) = lower(:username) "; + $sql .= "and lower(u.username) = lower(:username) "; $parameters['username'] = $this->username; } if ($_SESSION["users"]["unique"]["text"] === "global") { @@ -44,7 +46,7 @@ class plugin_database { } else { //unique username - per domain - $sql .= "and domain_uuid = :domain_uuid "; + $sql .= "and u.domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $this->domain_uuid; } $sql .= "and (user_enabled = 'true' or user_enabled is null) "; @@ -56,7 +58,7 @@ class plugin_database { if ($_SESSION["users"]["unique"]["text"] === "global" && $row["domain_uuid"] !== $this->domain_uuid) { //set the domain_uuid $this->domain_uuid = $row["domain_uuid"]; - $this->domain_name = $_SESSION['domains'][$this->domain_uuid]['domain_name']; + $this->domain_name = $row["domain_name"]; //set the domain session variables $_SESSION["domain_uuid"] = $this->domain_uuid; diff --git a/core/default_settings/app_defaults.php b/core/default_settings/app_defaults.php index ebdf9f35b5..23d08e041d 100644 --- a/core/default_settings/app_defaults.php +++ b/core/default_settings/app_defaults.php @@ -487,6 +487,21 @@ unset($sql, $parameters); } + //set domain > time_zone to UTC if not set + $sql = "update v_default_settings set "; + $sql .= "default_setting_value = 'UTC', "; + $sql .= "default_setting_enabled = 'true' "; + $sql .= "where ( "; + $sql .= " default_setting_value is null or "; + $sql .= " default_setting_value = '' "; + $sql .= ") "; + $sql .= "and default_setting_category = 'domain' "; + $sql .= "and default_setting_subcategory = 'time_zone' "; + $sql .= "and default_setting_name = 'name' "; + $database = new database; + $database->execute($sql); + unset($sql); + } ?> diff --git a/core/default_settings/default_setting_edit.php b/core/default_settings/default_setting_edit.php index 98976a9dc8..d273b10eb0 100644 --- a/core/default_settings/default_setting_edit.php +++ b/core/default_settings/default_setting_edit.php @@ -211,7 +211,7 @@ //pre-populate the form if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { $default_setting_uuid = $_GET["id"]; - $sql = "select default_setting_uuid, default_setting_category, default_setting_subcategory, default_setting_name, default_setting_value, cast(default_setting_enabled as text), default_setting_description "; + $sql = "select default_setting_uuid, default_setting_category, default_setting_subcategory, default_setting_name, default_setting_value, default_setting_order, cast(default_setting_enabled as text), default_setting_description "; $sql .= "from v_default_settings "; $sql .= "where default_setting_uuid = :default_setting_uuid "; $parameters['default_setting_uuid'] = $default_setting_uuid; diff --git a/core/default_settings/resources/classes/default_settings.php b/core/default_settings/resources/classes/default_settings.php index 727f4b8107..a3401d9b5f 100644 --- a/core/default_settings/resources/classes/default_settings.php +++ b/core/default_settings/resources/classes/default_settings.php @@ -269,7 +269,7 @@ if (!class_exists('default_settings')) { $array['domain_settings'][$x]['domain_setting_name'] = $default_setting_name; $array['domain_settings'][$x]['domain_setting_value'] = $default_setting_value; $array['domain_settings'][$x]['domain_setting_order'] = $default_setting_order; - $array['domain_settings'][$x]['domain_setting_enabled'] = $default_setting_enabled; + $array['domain_settings'][$x]['domain_setting_enabled'] = $default_setting_enabled ?: 0; $array['domain_settings'][$x]['domain_setting_description'] = $default_setting_description; //insert diff --git a/core/domain_settings/domain_setting_edit.php b/core/domain_settings/domain_setting_edit.php index a464b5ab05..2cc544adee 100644 --- a/core/domain_settings/domain_setting_edit.php +++ b/core/domain_settings/domain_setting_edit.php @@ -325,7 +325,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true" && is_uuid($_GET["id"])) { $domain_setting_uuid = $_GET["id"]; - $sql = "select domain_setting_uuid, domain_setting_category, domain_setting_subcategory, domain_setting_name, domain_setting_value, cast(domain_setting_enabled as text), domain_setting_description "; + $sql = "select domain_setting_uuid, domain_setting_category, domain_setting_subcategory, domain_setting_name, domain_setting_value, domain_setting_order, cast(domain_setting_enabled as text), domain_setting_description "; $sql .= "from v_domain_settings "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and domain_setting_uuid = :domain_setting_uuid "; diff --git a/core/domain_settings/resources/classes/domain_settings.php b/core/domain_settings/resources/classes/domain_settings.php index f4d810cd71..35a510349d 100644 --- a/core/domain_settings/resources/classes/domain_settings.php +++ b/core/domain_settings/resources/classes/domain_settings.php @@ -276,7 +276,7 @@ if (!class_exists('domain_settings')) { $array['domain_settings'][0]['domain_setting_name'] = $domain_setting_name; $array['domain_settings'][0]['domain_setting_value'] = $domain_setting_value; $array['domain_settings'][0]['domain_setting_order'] = $domain_setting_order; - $array['domain_settings'][0]['domain_setting_enabled'] = $domain_setting_enabled; + $array['domain_settings'][0]['domain_setting_enabled'] = $domain_setting_enabled ?: 0; $array['domain_settings'][0]['domain_setting_description'] = $domain_setting_description; //insert diff --git a/core/domains/domain_edit.php b/core/domains/domain_edit.php index 5f4e7e3757..c01851ba87 100644 --- a/core/domains/domain_edit.php +++ b/core/domains/domain_edit.php @@ -500,8 +500,6 @@ //clear the domains session array to update it unset($_SESSION["domains"]); - unset($_SESSION["domain_uuid"]); - unset($_SESSION["domain_name"]); unset($_SESSION['domain']); unset($_SESSION['switch']); diff --git a/core/groups/app_languages.php b/core/groups/app_languages.php index a703294a8c..f984c6967c 100644 --- a/core/groups/app_languages.php +++ b/core/groups/app_languages.php @@ -1681,6 +1681,48 @@ $text['label-12-hour']['ru-ru'] = "12-часовой"; $text['label-12-hour']['sv-se'] = "12-timmars"; $text['label-12-hour']['uk-ua'] = "12-годинний"; +$text['label-assigned']['en-us'] = "Assigned"; +$text['label-assigned']['en-gb'] = "Assigned"; +$text['label-assigned']['ar-eg'] = "Assigned"; +$text['label-assigned']['de-at'] = "Assigned"; +$text['label-assigned']['de-ch'] = "Assigned"; +$text['label-assigned']['de-de'] = "Assigned"; +$text['label-assigned']['es-cl'] = "Assigned"; +$text['label-assigned']['es-mx'] = "Assigned"; +$text['label-assigned']['fr-ca'] = "Assigned"; +$text['label-assigned']['fr-fr'] = "Assigned"; +$text['label-assigned']['he-il'] = "Assigned"; +$text['label-assigned']['it-it'] = "Assigned"; +$text['label-assigned']['nl-nl'] = "Assigned"; +$text['label-assigned']['pl-pl'] = "Assigned"; +$text['label-assigned']['pt-br'] = "Assigned"; +$text['label-assigned']['pt-pt'] = "Assigned"; +$text['label-assigned']['ro-ro'] = "Assigned"; +$text['label-assigned']['ru-ru'] = "Assigned"; +$text['label-assigned']['sv-se'] = "Assigned"; +$text['label-assigned']['uk-ua'] = "Assigned"; + +$text['label-unassigned']['en-us'] = "Unassigned"; +$text['label-unassigned']['en-gb'] = "Unassigned"; +$text['label-unassigned']['ar-eg'] = "Unassigned"; +$text['label-unassigned']['de-at'] = "Unassigned"; +$text['label-unassigned']['de-ch'] = "Unassigned"; +$text['label-unassigned']['de-de'] = "Unassigned"; +$text['label-unassigned']['es-cl'] = "Unassigned"; +$text['label-unassigned']['es-mx'] = "Unassigned"; +$text['label-unassigned']['fr-ca'] = "Unassigned"; +$text['label-unassigned']['fr-fr'] = "Unassigned"; +$text['label-unassigned']['he-il'] = "Unassigned"; +$text['label-unassigned']['it-it'] = "Unassigned"; +$text['label-unassigned']['nl-nl'] = "Unassigned"; +$text['label-unassigned']['pl-pl'] = "Unassigned"; +$text['label-unassigned']['pt-br'] = "Unassigned"; +$text['label-unassigned']['pt-pt'] = "Unassigned"; +$text['label-unassigned']['ro-ro'] = "Unassigned"; +$text['label-unassigned']['ru-ru'] = "Unassigned"; +$text['label-unassigned']['sv-se'] = "Unassigned"; +$text['label-unassigned']['uk-ua'] = "Unassigned"; + $text['header-user_setting-edit']['en-us'] = "User Setting"; $text['header-user_setting-edit']['en-gb'] = "User Setting"; $text['header-user_setting-edit']['ar-eg'] = ""; diff --git a/core/groups/group_permissions.php b/core/groups/group_permissions.php index b8c92f8729..35a503f975 100644 --- a/core/groups/group_permissions.php +++ b/core/groups/group_permissions.php @@ -94,6 +94,9 @@ } } +//get the view preference + $view = $_REQUEST['view']; + //get the http post data if (is_array($_POST['group_permissions'])) { $action = $_POST['action']; @@ -233,7 +236,7 @@ $token = new token; if (!$token->validate($_SERVER['PHP_SELF'])) { message::add($text['message-invalid_token'],'negative'); - header('Location: group_permissions.php?group_uuid='.urlencode($group_uuid).'&search='.urlencode($search)); + header('Location: group_permissions.php?group_uuid='.urlencode($group_uuid).($view ? '&view='.urlencode($view) : null).($search ? '&search='.urlencode($search) : null)); exit; } @@ -264,10 +267,6 @@ exit; } -//get order and order by - //$order_by = $_GET["order_by"]; - //$order = $_GET["order"]; - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -287,7 +286,12 @@ } echo "