diff --git a/app/registrations/registrations.php b/app/registrations/registrations.php new file mode 100644 index 0000000000..0cec261034 --- /dev/null +++ b/app/registrations/registrations.php @@ -0,0 +1,198 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2017 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane + James Rose +*/ + +//includes + include "root.php"; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists("registration_domain") || permission_exists("registration_all") || if_group("superadmin")) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//get the http values and set them as variables + $search = check_str($_GET["search"]); + +//show the header + require_once "resources/header.php"; + $document['title'] = $text['header-registrations']; + +//set the variables + $profile = (isset($_REQUEST['profile']) && $_REQUEST['profile'] != '') ? $_REQUEST['profile'] : "internal"; + $show = trim($_REQUEST["show"]); + +//check permissions + if (permission_exists("registration_domain") || permission_exists("registration_all") || if_group("superadmin")) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//get the HTTP values and set as variables + $search = trim($_REQUEST["search"]); + $show = trim($_REQUEST["show"]); + if ($show != "all") { $show = ''; } + +//define variables + $c = 0; + $row_style["0"] = "row_style0"; + $row_style["1"] = "row_style1"; + +//show the error message or show the content + if (strlen($msg) > 0) { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
".$text['label-message']."
$msg
\n"; + echo "
\n"; + } + else { + + //get the registrations + $obj = new registrations; + $registrations = $obj->get($show); + + //count the registrations + $registration_count = 0; + if (count($registrations) > 0) { + foreach ($registrations as $row) { + //search + $matches = preg_grep ("/$search/i",$row); + if ($matches != FALSE) { + $registration_count++; + } + } + } + + //show the registrations + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "
\n"; + echo " ".$text['header-registrations']." (".$registration_count.")\n"; + echo ""; + echo "
\n"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
\n"; + echo "
"; + if (permission_exists('registration_all')) { + if ($show == "all") { + echo " \n"; + } + else { + 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"; + + //order the array + require_once "resources/classes/array_order.php"; + $order = new array_order(); + $registrations = $order->sort($registrations, 'sip-auth-realm', 'user'); + + //display the array + if (count($registrations) > 0) { + foreach ($registrations as $row) { + //search + $matches = preg_grep ("/$search/i",$row); + if ($matches != FALSE) { + //set the user agent + $agent = $row['agent']; + + //show the registrations + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + if ($c==0) { $c=1; } else { $c=0; } + } + } + } + echo "
".$text['label-user']."".$text['label-agent']."".$text['label-contact']."".$text['label-lan_ip']."".$text['label-ip']."".$text['label-port']."".$text['label-hostname']."".$text['label-status']."".$text['label-ping']."".$text['label-tools']." 
".$row['user']." ".htmlentities($row['agent'])." ".explode('"',$row['contact'])[1]."".$row['lan-ip']."".$row['network-ip']."".$row['network-port']."".$row['host']."".$row['status']."".$row['ping-time']."\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + + //close the connection and unset the variable + fclose($fp); + unset($xml); + } + +//get the footer + require_once "resources/footer.php"; +?> diff --git a/app/registrations/status_registrations_inc.php b/app/registrations/status_registrations_inc.php deleted file mode 100644 index 2823d45429..0000000000 --- a/app/registrations/status_registrations_inc.php +++ /dev/null @@ -1,188 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2016 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane - James Rose -*/ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -require_once "resources/classes/status_registrations.php"; - -//check permissions - if (permission_exists("registration_domain") || permission_exists("registration_all") || if_group("superadmin")) { - //access granted - } - else { - echo "access denied"; - exit; - } - -//Search - //$search_value = "1003"; - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//get the HTTP values and set as variables - $search_value = trim($_REQUEST["search_value"]); - $sip_profile_name = trim($_REQUEST["profile"]); - $show = trim($_REQUEST["show"]); - if ($show != "all") { $show = ''; } - -//define variables - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; - -//create the event socket connection - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if (!$fp) { - $msg = "
".$text['error-event-socket']."
"; - } - -//define js function call var - $onhover_pause_refresh = " onmouseover='refresh_stop();' onmouseout='refresh_start();'"; - -//show the error message or show the content - if (strlen($msg) > 0) { - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
".$text['label-message']."
$msg
\n"; - echo "
\n"; - } - else { - //get sofia status profile information including registrations - $cmd = "api sofia xmlstatus profile ".$sip_profile_name." reg"; - $xml_response = trim(event_socket_request($fp, $cmd)); - if ($xml_response == "Invalid Profile!") { $xml_response = "".$text['label-message'].""; } - $xml_response = str_replace("", "", $xml_response); - $xml_response = str_replace("", "", $xml_response); - try { - $xml = new SimpleXMLElement($xml_response); - } - catch(Exception $e) { - echo $e->getMessage(); - exit; - } - //get the registrations - $registrations = get_registrations($sip_profile_name); - //count the registrations - $registration_count = 0; - if (count($registrations) > 0) { - foreach ($registrations as $row) { - //search - $matches = preg_grep ("/$search_value/i",$row); - if ($matches != FALSE) { - $registration_count++; - } - } - } - //show the registrations - echo "\n"; - echo "\n"; - echo "\n"; - echo ""; - echo "\n"; - echo "\n"; - echo "
\n"; - echo " ".$text['header-registrations']." (".$registration_count.")\n"; - echo ""; - echo " \"".$text['label-refresh_pause']."\""; - echo ""; - if (permission_exists('registration_all')) { - if ($show == "all") { - echo " \n"; - } - else { - 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"; - - //order the array - require_once "resources/classes/array_order.php"; - $order = new array_order(); - $registrations = $order->sort($registrations, 'sip-auth-realm', 'user'); - - //display the array - if (count($registrations) > 0) { - foreach ($registrations as $row) { - //search - $matches = preg_grep ("/$search_value/i",$row); - if ($matches != FALSE) { - //set the user agent - $agent = $row['agent']; - - //show the registrations - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n"; - if ($c==0) { $c=1; } else { $c=0; } - } - } - } - echo "
".$text['label-user']."".$text['label-agent']."".$text['label-contact']."".$text['label-lan_ip']."".$text['label-ip']."".$text['label-port']."".$text['label-hostname']."".$text['label-status']."".$text['label-ping']."".$text['label-tools']." 
".$row['user']." ".htmlentities($row['agent'])." ".explode('"',$row['contact'])[1]."".$row['lan-ip']."".$row['network-ip']."".$row['network-port']."".$row['host']."".$row['status']."".$row['ping-time']."\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - - //close the connection and unset the variable - fclose($fp); - unset($xml); - } - -?>