diff --git a/app/gateways/app_languages.php b/app/gateways/app_languages.php index 837d557206..cdfe7c5b97 100644 --- a/app/gateways/app_languages.php +++ b/app/gateways/app_languages.php @@ -81,6 +81,86 @@ $text['message-maximum_gateways']['ru-ru'] = "Максимум Шлюзов:"; $text['message-maximum_gateways']['sv-se'] = "Max antal Gateways:"; $text['message-maximum_gateways']['uk-ua'] = "Максимальна кількість шлюзів"; +$text['message-gateway_started']['en-us'] = "Gateway(s) Started"; +$text['message-gateway_started']['ar-eg'] = "Gateway(s) Started"; +$text['message-gateway_started']['de-at'] = "Gateway(s) Started"; +$text['message-gateway_started']['de-ch'] = "Gateway(s) Started"; +$text['message-gateway_started']['de-de'] = "Gateway(s) Started"; +$text['message-gateway_started']['es-cl'] = "Gateway(s) Started"; +$text['message-gateway_started']['es-mx'] = "Gateway(s) Started"; +$text['message-gateway_started']['fr-ca'] = "Gateway(s) Started"; +$text['message-gateway_started']['fr-fr'] = "Gateway(s) Started"; +$text['message-gateway_started']['he-il'] = "Gateway(s) Started"; +$text['message-gateway_started']['it-it'] = "Gateway(s) Started"; +$text['message-gateway_started']['nl-nl'] = "Gateway(s) Started"; +$text['message-gateway_started']['pl-pl'] = "Gateway(s) Started"; +$text['message-gateway_started']['pt-br'] = "Gateway(s) Started"; +$text['message-gateway_started']['pt-pt'] = "Gateway(s) Started"; +$text['message-gateway_started']['ro-ro'] = "Gateway(s) Started"; +$text['message-gateway_started']['ru-ru'] = "Gateway(s) Started"; +$text['message-gateway_started']['sv-se'] = "Gateway(s) Started"; +$text['message-gateway_started']['uk-ua'] = "Gateway(s) Started"; + +$text['message-gateway_stopped']['en-us'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['ar-eg'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['de-at'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['de-ch'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['de-de'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['es-cl'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['es-mx'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['fr-ca'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['fr-fr'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['he-il'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['it-it'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['nl-nl'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['pl-pl'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['pt-br'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['pt-pt'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['ro-ro'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['ru-ru'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['sv-se'] = "Gateway(s) Stopped"; +$text['message-gateway_stopped']['uk-ua'] = "Gateway(s) Stopped"; + +$text['confirm-start_gateways']['en-us'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['ar-eg'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['de-at'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['de-ch'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['de-de'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['es-cl'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['es-mx'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['fr-ca'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['fr-fr'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['he-il'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['it-it'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['nl-nl'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['pl-pl'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['pt-br'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['pt-pt'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['ro-ro'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['ru-ru'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['sv-se'] = "Are you sure you wish to START these gateways?"; +$text['confirm-start_gateways']['uk-ua'] = "Are you sure you wish to START these gateways?"; + +$text['confirm-stop_gateways']['en-us'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['ar-eg'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['de-at'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['de-ch'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['de-de'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['es-cl'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['es-mx'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['fr-ca'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['fr-fr'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['he-il'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['it-it'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['nl-nl'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['pl-pl'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['pt-br'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['pt-pt'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['ro-ro'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['ru-ru'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['sv-se'] = "Are you sure you wish to STOP these gateways?"; +$text['confirm-stop_gateways']['uk-ua'] = "Are you sure you wish to STOP these gateways?"; + $text['label-username']['en-us'] = "Username"; $text['label-username']['ar-eg'] = "اسم المستخدم"; $text['label-username']['de-at'] = "Benutzername"; //copied from de-de @@ -1361,24 +1441,4 @@ $text['description-auth_username']['ru-ru'] = "Введите имя польз $text['description-auth_username']['sv-se'] = "Ange 'uth-username' här."; $text['description-auth_username']['uk-ua'] = "Enter the auth-username here."; -$text['confirm-copy']['en-us'] = "Do you really want to copy this?"; -$text['confirm-copy']['ar-eg'] = ""; -$text['confirm-copy']['de-at'] = "Wollen Sie das wirklich kopieren?"; //copied from de-de -$text['confirm-copy']['de-ch'] = "Wollen Sie das wirklich kopieren?"; //copied from de-de -$text['confirm-copy']['de-de'] = "Wollen Sie das wirklich kopieren?"; -$text['confirm-copy']['es-cl'] = "¿Realmente desea copiar esto?"; -$text['confirm-copy']['es-mx'] = "¿Realmente desea copiar esto?"; //copied from es-cl -$text['confirm-copy']['fr-ca'] = "Voulez-vous vraiment copier cela?"; //copied from fr-fr -$text['confirm-copy']['fr-fr'] = "Voulez-vous vraiment copier cela?"; -$text['confirm-copy']['he-il'] = "? בטוח שאתה רוצה להעתיק"; -$text['confirm-copy']['it-it'] = "Vuoi veramente copiarlo?"; -$text['confirm-copy']['nl-nl'] = ""; -$text['confirm-copy']['pl-pl'] = "Czy na pewno chcesz to skopiować?"; -$text['confirm-copy']['pt-br'] = "Deseja realmente copiar isto?"; //copied from pt-pt -$text['confirm-copy']['pt-pt'] = "Deseja realmente copiar isto?"; -$text['confirm-copy']['ro-ro'] = "Chiar doriți să copiați acest lucru?"; -$text['confirm-copy']['ru-ru'] = "Вы действительно хотите это скопировать?"; -$text['confirm-copy']['sv-se'] = "Vill du verkligen kopiera detta?"; -$text['confirm-copy']['uk-ua'] = "Ви дійсно бажаєте це копіювати?"; - -?> +?> \ No newline at end of file diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index ce20d193cf..cc2ba23c96 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.php @@ -28,6 +28,7 @@ require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; + require_once "resources/paging.php"; //check permissions if (permission_exists('gateway_view')) { @@ -42,38 +43,77 @@ $language = new text; $text = $language->get(); -//additional includes - require_once "resources/header.php"; - require_once "resources/paging.php"; +//get posted data + if (is_array($_POST['gateways'])) { + $action = $_POST['action']; + $search = $_POST['search']; + $gateways = $_POST['gateways']; + } -//get variables used to control the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; +//copy the gateways + if (permission_exists('gateway_add')) { + if ($action == 'copy' && is_array($gateways) && @sizeof($gateways) != 0) { + //copy + $obj = new gateways; + $obj->copy($gateways); + //redirect + header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; + } + } + +//toggle the gateways + if (permission_exists('gateway_edit')) { + if ($action == 'toggle' && is_array($gateways) && @sizeof($gateways) != 0) { + //toggle + $obj = new gateways; + $obj->toggle($gateways); + //redirect + header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; + } + } + +//delete the gateways + if (permission_exists('gateway_delete')) { + if ($action == 'delete' && is_array($gateways) && @sizeof($gateways) != 0) { + //delete + $obj = new gateways; + $obj->delete($gateways); + //redirect + header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; + } + } //connect to event socket $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - if (strlen($_GET["a"]) > 0 && is_uuid($_GET["gateway"])) { - $profile = $_GET["profile"]; - if (strlen($profile) == 0) { - $profile = 'external'; - } - if ($_GET["a"] == "stop") { - $gateway_uuid = $_GET["gateway"]; - $cmd = 'api sofia profile '.$profile.' killgw '.$gateway_uuid; - $response = trim(event_socket_request($fp, $cmd)); - $msg = 'Stop Gateway:
'.$response.''; - } - if ($_GET["a"] == "start") { - $gateway_uuid = $_GET["gateway"]; - $cmd = 'api sofia profile '.$profile.' rescan'; - $response = trim(event_socket_request($fp, $cmd)); - $msg = 'Start Gateway:
'.$response.''; - } - } - if (!function_exists('switch_gateway_status')) { - function switch_gateway_status($gateway_uuid, $result_type = 'xml') { +//control the gateways + if ($fp && is_array($gateways) && @sizeof($gateways) != 0) { + if ($action == 'start') { + //start + $obj = new gateways; + $obj->start($gateways); + //redirect + header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; + } + if ($action == 'stop') { + //stop + $obj = new gateways; + $obj->stop($gateways); + //redirect + header('Location: gateways.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; + } + } + +//gateway status function + if (!function_exists('switch_gateway_status')) { + function switch_gateway_status($gateway_uuid, $result_type = 'xml') { + global $fp; + if ($fp) { $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cmd = 'api sofia xmlstatus gateway '.$gateway_uuid; $response = trim(event_socket_request($fp, $cmd)); @@ -86,47 +126,52 @@ } } -//show the content - echo "
| ".$text['title-gateways']." | \n"; - echo ""; - if (permission_exists('gateway_all')) { - if ($_GET['show'] == 'all') { - echo " "; - } - else { - echo " \n"; - } +//get order and order by + $order_by = $_GET["order_by"]; + $order = $_GET["order"]; + +//add the search term + $search = strtolower($_GET["search"]); + if (strlen($search) > 0) { + $sql_search = "and ("; + $sql_search .= "lower(gateway) like :search "; + $sql_search .= "or lower(username) like :search "; + $sql_search .= "or lower(auth_username) like :search "; + $sql_search .= "or lower(from_user) like :search "; + $sql_search .= "or lower(from_domain) like :search "; + $sql_search .= "or lower(from_domain) like :search "; + $sql_search .= "or lower(proxy) like :search "; + $sql_search .= "or lower(register_proxy) like :search "; + $sql_search .= "or lower(outbound_proxy) like :search "; + $sql_search .= "or lower(description) like :search "; + $sql_search .= ") "; + $parameters['search'] = '%'.$search.'%'; } - echo " \n"; - echo " | \n"; - echo "
| \n"; - echo " \n"; - echo " ".$text['description-gateway']."\n"; - echo " \n"; - echo " | \n"; - echo "|