diff --git a/app/devices/app_config.php b/app/devices/app_config.php index d752e92f10..25005b4bf6 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -258,7 +258,8 @@ $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'] = "user_uuid"; + $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "device_user_uuid"; + $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "user_uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; diff --git a/app/devices/cmd.php b/app/devices/cmd.php new file mode 100644 index 0000000000..4e46ab13a9 --- /dev/null +++ b/app/devices/cmd.php @@ -0,0 +1,111 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2014 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +include "root.php"; +require_once "resources/require.php"; +require_once "resources/check_auth.php"; +if (permission_exists("device_key_add") || permission_exists("device_key_edit") || if_group("superadmin")) { + //access granted +} +else { + echo "access denied"; + exit; +} + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//set the variables + $cmd = check_str($_GET['cmd']); + $rdr = check_str($_GET['rdr']); + $profile = check_str($_GET['profile']); + $domain = check_str($_GET['domain']); + $show = check_str($_GET['show']); + $user = check_str($_GET['user']); + $agent = check_str($_GET['agent']); + +//get the vendor + if (preg_replace('/^.*?(aastra).*$/i', '$1', strtolower($agent)) == "aastra") { + $vendor = "aastra"; + } + if (preg_replace('/^.*?(cisco).*$/i', '$1', strtolower($agent)) == "cisco") { + $vendor = "cisco"; + } + if (preg_replace('/^.*?(cisco\/spa).*$/i', '$1', strtolower($agent)) == "cisco/spa") { + $vendor = "cisco-spa"; + } + if (preg_replace('/^.*?(grandstream).*$/i', '$1', strtolower($agent)) == "grandstream") { + $vendor = "grandstream"; + } + if (preg_replace('/^.*?(linksys).*$/i', '$1', strtolower($agent)) == "linksys") { + $vendor = "linksys"; + } + if (preg_replace('/^.*?(polycom).*$/i', '$1', strtolower($agent)) == "polycom") { + $vendor = "polycom"; + } + if (preg_replace('/^.*?(yealink).*$/i', '$1', strtolower($agent)) == "yealink") { + $vendor = "yealink"; + } + if (preg_replace('/^.*?(vp530p).*$/i', '$1', strtolower($agent)) == "vp530p") { + $vendor = "yealink"; + } + if (preg_replace('/^.*?(snom).*$/i', '$1', strtolower($agent)) == "snom") { + $vendor = "snom"; + } + +//create the event socket connection + $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); + if ($fp) { + //prepare the command + if ($cmd == "unregister") { + $command = "sofia profile ".$profile." flush_inbound_reg ".$user." reboot"; + } + else { + $command = "lua app.lua event_notify ".$profile." ".$cmd." ".$user." ".$vendor; + + //if ($cmd == "check_sync") { + // $command = "sofia profile ".$profile." check_sync ".$user; + //} + } + //send the command + $response = event_socket_request($fp, "api ".$command); + $response = event_socket_request($fp, "api log notice ".$command); + //show the response + $_SESSION['message'] = $text['label-event']." ".ucwords($cmd)."     ".$text['label-response'].$response; + //close the connection + fclose($fp); + } + +//redirect the user + if ($rdr == "false") { + //redirect false + echo $response; + } + else { + header("Location: status_registrations.php?profile=".$profile."&show=".$show); + } + +?> \ No newline at end of file diff --git a/app/devices/device_dashboard.php b/app/devices/device_dashboard.php index 915984ffcd..cc0ea68beb 100644 --- a/app/devices/device_dashboard.php +++ b/app/devices/device_dashboard.php @@ -232,6 +232,10 @@ echo "
"; echo " \n"; + echo "
"; + echo " \n"; + echo "
\n"; + echo "
\n"; echo " "; echo "
\n"; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index e3caeed460..ceabcc3290 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -632,6 +632,8 @@ require_once "resources/require.php"; echo " \n"; //echo " "; } + echo " \n"; + if (permission_exists('device_add') && $action != "add") { echo " \n"; } diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 8d4b512464..8f57c0bb52 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -164,7 +164,7 @@ include "root.php"; } } - private function contact_append(&$contacts, &$line, $domain_uuid, $user_uuid, $is_group){ + private function contact_append(&$contacts, &$line, $domain_uuid, $device_user_uuid, $is_group){ $sql = "select c.contact_uuid, c.contact_organization, c.contact_name_given, c.contact_name_family, "; $sql .= "c.contact_type, c.contact_category, p.phone_label,"; $sql .= "p.phone_number, p.phone_extension, p.phone_primary "; @@ -177,14 +177,14 @@ include "root.php"; $sql .= " select contact_uuid from v_contact_groups "; $sql .= " where group_uuid in ( "; $sql .= " select group_uuid from v_group_users "; - $sql .= " where user_uuid = '$user_uuid' "; + $sql .= " where user_uuid = '$device_user_uuid' "; $sql .= " and domain_uuid = '$domain_uuid' "; $sql .= " )) "; } else { $sql .= "and c.contact_uuid in ( "; $sql .= " select contact_uuid from v_contact_users "; - $sql .= " where user_uuid = '$user_uuid' "; + $sql .= " where user_uuid = '$device_user_uuid' "; $sql .= " and domain_uuid = '$domain_uuid' "; $sql .= ") "; } @@ -245,25 +245,6 @@ include "root.php"; unset($temp_contacts); } - private function user_uuid_for_line(&$line, $domain_uuid){ - $sql = "select user_uuid from v_extension_users "; - $sql .= "where extension_uuid in ( "; - $sql .= " select extension_uuid from v_extensions "; - $sql .= " where (extension = '".$line["user_id"]."' or number_alias = '".$line["user_id"]."') "; - $sql .= " and domain_uuid = '$domain_uuid' "; - $sql .= ") "; - $sql .= "and domain_uuid = '$domain_uuid' "; - - $prep_statement = $this->db->prepare(check_sql($sql)); - $prep_statement->execute(); - $extension_users = $prep_statement->fetchAll(PDO::FETCH_NAMED); - unset($prep_statement, $sql); - foreach ($extension_users as &$row) { - return $row["user_uuid"]; - } - return false; - } - public function render() { //debug @@ -340,6 +321,7 @@ include "root.php"; if (strlen($row["device_vendor"]) > 0) { $device_vendor = strtolower($row["device_vendor"]); } + $device_user_uuid = $row["device_user_uuid"]; $device_model = $row["device_model"]; $device_firmware_version = $row["device_firmware_version"]; $device_enabled = $row["device_enabled"]; @@ -476,6 +458,7 @@ include "root.php"; $row = $prep_statement_4->fetch(); $device_label = $row["device_label"]; $device_firmware_version = $row["device_firmware_version"]; + $device_user_uuid = $row["device_user_uuid"]; $device_enabled = $row["device_enabled"]; //keep the original template $device_profile_uuid = $row["device_profile_uuid"]; @@ -580,22 +563,15 @@ include "root.php"; //get the list of contact directly assigned to the user //get the user_uuid to find the contacts assigned to the user and the groups the user is a member of. if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0) { - if ($_SESSION['provision']['contact_users']['boolean'] == "true" || $_SESSION['provision']['contact_groups']['boolean'] == "true") { - foreach ($device_lines as &$line) { - $user_uuid = $this->user_uuid_for_line($line, $domain_uuid); - if(!$user_uuid) continue; + //get the contacts assigned to the groups and add to the contacts array + if ($_SESSION['provision']['contact_groups']['boolean'] == "true") { + $this->contact_append($contacts, $line, $domain_uuid, $device_user_uuid, true); + } - //get the contacts assigned to the groups and add to the contacts array - if ($_SESSION['provision']['contact_groups']['boolean'] == "true") { - $this->contact_append($contacts, $line, $domain_uuid, $user_uuid, true); - } - - //get the contacts assigned to the user and add to the contacts array - if ($_SESSION['provision']['contact_users']['boolean'] == "true") { - $this->contact_append($contacts, $line, $domain_uuid, $user_uuid, false); - } - } - } + //get the contacts assigned to the user and add to the contacts array + if ($_SESSION['provision']['contact_users']['boolean'] == "true") { + $this->contact_append($contacts, $line, $domain_uuid, $device_user_uuid, false); + } } //get the extensions and add them to the contacts array diff --git a/resources/app_languages.php b/resources/app_languages.php index 14773aa6c0..cb0566eb84 100644 --- a/resources/app_languages.php +++ b/resources/app_languages.php @@ -161,6 +161,20 @@ $text['confirm-copy']['de-at'] = "Wollen Sie das wirklich kopieren?"; //buttons +$text['button-apply']['en-us'] = "Apply"; +$text['button-apply']['es-cl'] = ""; +$text['button-apply']['pt-pt'] = ""; +$text['button-apply']['fr-fr'] = ""; +$text['button-apply']['pt-br'] = ""; +$text['button-apply']['pl'] = ""; +$text['button-apply']['he'] = ""; +$text['button-apply']['uk'] = ""; +$text['button-apply']['sv-se'] = ""; +$text['button-apply']['de-at'] = ""; +$text['button-apply']['ro'] = ""; +$text['button-apply']['fa'] = ""; +$text['button-apply']['ar-eg'] = ""; + $text['button-clear']['en-us'] = "Clear"; $text['button-clear']['es-cl'] = "Limpiar"; $text['button-clear']['pt-pt'] = "Apagar";