Merge branch 'master' into follow_me_lua

This commit is contained in:
Alexey Melnichuk
2015-11-09 16:45:57 +03:00
16 changed files with 368 additions and 277 deletions

View File

@@ -39,6 +39,18 @@
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_mac_address';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_label';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_template';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = "device_extension_view";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
@@ -105,6 +117,15 @@
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_domain';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_username_password';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_alternate';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = "device_profile_view";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
@@ -127,6 +148,25 @@
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_all';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_vendor';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_model';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_firmware';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_enable';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_description';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
//schema details
$y = 0; //table array index

View File

@@ -128,10 +128,25 @@ require_once "resources/require.php";
//get http post variables and set them to php variables
if (count($_POST) > 0) {
//device mac address
if (permission_exists('device_mac_address')) {
$device_mac_address = check_str($_POST["device_mac_address"]);
$device_mac_address = strtolower(preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address));
$_POST["device_mac_address"] = $device_mac_address;
}
else {
$orm = new orm;
$orm->name('devices');
$orm->uuid($device_uuid);
$result = $orm->find()->get();
//$message = $orm->message;
foreach ($result as &$row) {
$device_mac_address = $row["device_mac_address"];
$_POST["device_mac_address"] = $device_mac_address;
}
unset ($prep_statement);
}
//devices
$device_mac_address = check_str($_POST["device_mac_address"]);
$device_mac_address = strtolower(preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address));
$_POST["device_mac_address"] = $device_mac_address;
$device_label = check_str($_POST["device_label"]);
$device_vendor = check_str($_POST["device_vendor"]);
$device_uuid_alternate = check_str($_POST["device_uuid_alternate"]);
@@ -514,7 +529,7 @@ require_once "resources/require.php";
echo "</td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='devices.php'\" value='".$text['button-back']."'>\n";
if ($action != "add") {
if (permission_exists('device_add') && $action != "add") {
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"var new_mac = prompt('".$text['message_device']."'); if (new_mac != null) { window.location='device_copy.php?id=".$device_uuid."&mac=' + new_mac; }\" value='".$text['button-copy']."'>\n";
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
@@ -526,195 +541,211 @@ require_once "resources/require.php";
echo " ".$text['label-device_mac_address']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_mac_address' id='device_mac_address' maxlength='255' value=\"$device_mac_address\">\n";
if (permission_exists('device_mac_address')) {
echo " <input class='formfld' type='text' name='device_mac_address' id='device_mac_address' maxlength='255' value=\"$device_mac_address\">\n";
echo "<br />\n";
echo $text['description-device_mac_address']."\n";
}
else {
echo $device_mac_address;
}
echo " <div style='display: none;' id='duplicate_mac_response'></div>\n";
echo "<br />\n";
echo $text['description-device_mac_address']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_label']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_label' maxlength='255' value=\"$device_label\">\n";
echo "<br />\n";
echo $text['description-device_label']."\n";
if (permission_exists('device_label')) {
echo " <input class='formfld' type='text' name='device_label' maxlength='255' value=\"$device_label\">\n";
echo "<br />\n";
echo $text['description-device_label']."\n";
}
else {
echo $device_label;
}
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_template']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$device = new device;
$template_dir = $device->get_template_dir();
if (permission_exists('device_template')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_template']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$device = new device;
$template_dir = $device->get_template_dir();
echo "<select id='device_template' name='device_template' class='formfld'>\n";
echo "<option value=''></option>\n";
echo "<select id='device_template' name='device_template' class='formfld'>\n";
echo "<option value=''></option>\n";
if (is_dir($template_dir)) {
$templates = scandir($template_dir);
foreach($templates as $dir) {
if($file != "." && $dir != ".." && $dir[0] != '.') {
if(is_dir($template_dir . "/" . $dir)) {
echo "<optgroup label='$dir'>";
$dh_sub=$template_dir . "/" . $dir;
if(is_dir($dh_sub)) {
$templates_sub = scandir($dh_sub);
foreach($templates_sub as $dir_sub) {
if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') {
if(is_dir($template_dir . '/' . $dir .'/'. $dir_sub)) {
if ($device_template == $dir."/".$dir_sub) {
echo "<option value='".$dir."/".$dir_sub."' selected='selected'>".$dir."/".$dir_sub."</option>\n";
}
else {
echo "<option value='".$dir."/".$dir_sub."'>".$dir."/".$dir_sub."</option>\n";
if (is_dir($template_dir)) {
$templates = scandir($template_dir);
foreach($templates as $dir) {
if($file != "." && $dir != ".." && $dir[0] != '.') {
if(is_dir($template_dir . "/" . $dir)) {
echo "<optgroup label='$dir'>";
$dh_sub=$template_dir . "/" . $dir;
if(is_dir($dh_sub)) {
$templates_sub = scandir($dh_sub);
foreach($templates_sub as $dir_sub) {
if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') {
if(is_dir($template_dir . '/' . $dir .'/'. $dir_sub)) {
if ($device_template == $dir."/".$dir_sub) {
echo "<option value='".$dir."/".$dir_sub."' selected='selected'>".$dir."/".$dir_sub."</option>\n";
}
else {
echo "<option value='".$dir."/".$dir_sub."'>".$dir."/".$dir_sub."</option>\n";
}
}
}
}
closedir($dh_sub);
}
closedir($dh_sub);
echo "</optgroup>";
}
echo "</optgroup>";
}
}
closedir($dh);
}
closedir($dh);
}
echo "</select>\n";
echo "<br />\n";
echo $text['description-device_template']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-lines']."</td>";
echo " <td class='vtable' align='left'>";
echo " <table width='100%' border='0' cellpadding='0' cellspacing='3'>\n";
echo " <tr>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-line']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-server_address']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-outbound_proxy']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-display_name']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-user_id']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-auth_id']."</td>\n";
if (permission_exists('device_line_password')) {
echo " <td class='vtable' nowrap='nowrap'>".$text['label-password']."</td>\n";
echo "</select>\n";
echo "<br />\n";
echo $text['description-device_template']."\n";
echo "</td>\n";
echo "</tr>\n";
}
echo " <td class='vtable' nowrap='nowrap'>".$text['label-sip_port']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-sip_transport']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-register_expires']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-enabled']."</td>\n";
echo " <td>&nbsp;</td>\n";
echo " </tr>\n";
$x = 0;
foreach($device_lines as $row) {
//determine whether to hide the element
if (strlen($device_line_uuid) == 0) {
$element['hidden'] = false;
$element['visibility'] = "visibility:visible;";
}
else {
$element['hidden'] = true;
$element['visibility'] = "visibility:hidden;";
}
//add the primary key uuid
if (strlen($row['device_line_uuid']) > 0) {
echo " <input name='device_lines[".$x."][device_line_uuid]' type='hidden' value=\"".$row['device_line_uuid']."\">\n";
}
//show each row in the array
echo " <tr>\n";
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
$selected = "selected=\"selected\" ";
echo " <select class='formfld' style='width: 45px;' name='device_lines[".$x."][line_number]'>\n";
echo " <option value=''></option>\n";
echo " <option value='1' ".($row['line_number'] == "1" ? $selected:"").">1</option>\n";
echo " <option value='2' ".($row['line_number'] == "2" ? $selected:"").">2</option>\n";
echo " <option value='3' ".($row['line_number'] == "3" ? $selected:"").">3</option>\n";
echo " <option value='4' ".($row['line_number'] == "4" ? $selected:"").">4</option>\n";
echo " <option value='5' ".($row['line_number'] == "5" ? $selected:"").">5</option>\n";
echo " <option value='6' ".($row['line_number'] == "6" ? $selected:"").">6</option>\n";
echo " <option value='7' ".($row['line_number'] == "7" ? $selected:"").">7</option>\n";
echo " <option value='8' ".($row['line_number'] == "8" ? $selected:"").">8</option>\n";
echo " <option value='9' ".($row['line_number'] == "9" ? $selected:"").">9</option>\n";
echo " <option value='10' ".($row['line_number'] == "10" ? $selected:"").">10</option>\n";
echo " <option value='11' ".($row['line_number'] == "11" ? $selected:"").">11</option>\n";
echo " <option value='12' ".($row['line_number'] == "12" ? $selected:"").">12</option>\n";
echo " </select>\n";
echo " </td>\n";
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
echo " <input class='formfld' style='width: 125px;' type='text' name='device_lines[".$x."][server_address]' maxlength='255' value=\"".$row['server_address']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 125px;' type='text' name='device_lines[".$x."][outbound_proxy]' maxlength='255' value=\"".$row['outbound_proxy']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 95px;' type='text' name='device_lines[".$x."][display_name]' maxlength='255' value=\"".$row['display_name']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][user_id]' maxlength='255' value=\"".$row['user_id']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][auth_id]' maxlength='255' value=\"".$row['auth_id']."\">\n";
echo " </td>\n";
if (permission_exists('device_line_password')) {
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 90px;' type='password' name='device_lines[".$x."][password]' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" autocomplete=\"off\" maxlength='255' value=\"".$row['password']."\">\n";
echo " </td>\n";
}
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][sip_port]' maxlength='255' value=\"".$row['sip_port']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <select class='formfld' style='width: 60px;' name='device_lines[".$x."][sip_transport]'>\n";
echo " <option value='tcp' ".(($row['sip_transport'] == 'tcp') ? "selected" : null).">TCP</option>\n";
echo " <option value='udp' ".(($row['sip_transport'] == 'udp') ? "selected" : null).">UDP</option>\n";
echo " <option value='tls' ".(($row['sip_transport'] == 'tls') ? "selected" : null).">TLS</option>\n";
echo " <option value='dns srv' ".(($row['sip_transport'] == 'dns srv') ? "selected" : null).">DNS SRV</option>\n";
echo " </select>\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][register_expires]' maxlength='255' value=\"".$row['register_expires']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <select class='formfld' name='device_lines[".$x."][enabled]'>\n";
echo " <option value='true' ".(($row['enabled'] == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " <option value='false' ".(($row['enabled'] == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
echo " </td>\n";
echo " <td>\n";
if (strlen($row['device_line_uuid']) > 0) {
if (permission_exists('device_delete')) {
echo " <a href='device_line_delete.php?device_uuid=".$row['device_uuid']."&id=".$row['device_line_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
if (permission_exists('device_line_view')) {
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-lines']."</td>";
echo " <td class='vtable' align='left'>";
echo " <table width='100%' border='0' cellpadding='0' cellspacing='3'>\n";
echo " <tr>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-line']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-server_address']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-outbound_proxy']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-display_name']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-user_id']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-auth_id']."</td>\n";
if (permission_exists('device_line_password')) {
echo " <td class='vtable' nowrap='nowrap'>".$text['label-password']."</td>\n";
}
echo " </td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-sip_port']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-sip_transport']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-register_expires']."</td>\n";
echo " <td class='vtable' nowrap='nowrap'>".$text['label-enabled']."</td>\n";
echo " <td>&nbsp;</td>\n";
echo " </tr>\n";
$x++;
}
echo " </table>\n";
if (strlen($text['description-lines']) > 0) {
echo " <br>".$text['description-lines']."\n";
}
echo " </td>";
echo " </tr>";
if (permission_exists('device_key_add') || permission_exists('device_key_edit')) {
$x = 0;
foreach($device_lines as $row) {
//determine whether to hide the element
if (strlen($device_line_uuid) == 0) {
$element['hidden'] = false;
$element['visibility'] = "visibility:visible;";
}
else {
$element['hidden'] = true;
$element['visibility'] = "visibility:hidden;";
}
//add the primary key uuid
if (strlen($row['device_line_uuid']) > 0) {
echo " <input name='device_lines[".$x."][device_line_uuid]' type='hidden' value=\"".$row['device_line_uuid']."\">\n";
}
//show each row in the array
echo " <tr>\n";
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
$selected = "selected=\"selected\" ";
echo " <select class='formfld' style='width: 45px;' name='device_lines[".$x."][line_number]'>\n";
echo " <option value=''></option>\n";
echo " <option value='1' ".($row['line_number'] == "1" ? $selected:"").">1</option>\n";
echo " <option value='2' ".($row['line_number'] == "2" ? $selected:"").">2</option>\n";
echo " <option value='3' ".($row['line_number'] == "3" ? $selected:"").">3</option>\n";
echo " <option value='4' ".($row['line_number'] == "4" ? $selected:"").">4</option>\n";
echo " <option value='5' ".($row['line_number'] == "5" ? $selected:"").">5</option>\n";
echo " <option value='6' ".($row['line_number'] == "6" ? $selected:"").">6</option>\n";
echo " <option value='7' ".($row['line_number'] == "7" ? $selected:"").">7</option>\n";
echo " <option value='8' ".($row['line_number'] == "8" ? $selected:"").">8</option>\n";
echo " <option value='9' ".($row['line_number'] == "9" ? $selected:"").">9</option>\n";
echo " <option value='10' ".($row['line_number'] == "10" ? $selected:"").">10</option>\n";
echo " <option value='11' ".($row['line_number'] == "11" ? $selected:"").">11</option>\n";
echo " <option value='12' ".($row['line_number'] == "12" ? $selected:"").">12</option>\n";
echo " </select>\n";
echo " </td>\n";
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
echo " <input class='formfld' style='width: 125px;' type='text' name='device_lines[".$x."][server_address]' maxlength='255' value=\"".$row['server_address']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 125px;' type='text' name='device_lines[".$x."][outbound_proxy]' maxlength='255' value=\"".$row['outbound_proxy']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 95px;' type='text' name='device_lines[".$x."][display_name]' maxlength='255' value=\"".$row['display_name']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][user_id]' maxlength='255' value=\"".$row['user_id']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][auth_id]' maxlength='255' value=\"".$row['auth_id']."\">\n";
echo " </td>\n";
if (permission_exists('device_line_password')) {
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 90px;' type='password' name='device_lines[".$x."][password]' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" autocomplete=\"off\" maxlength='255' value=\"".$row['password']."\">\n";
echo " </td>\n";
}
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][sip_port]' maxlength='255' value=\"".$row['sip_port']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <select class='formfld' style='width: 60px;' name='device_lines[".$x."][sip_transport]'>\n";
echo " <option value='tcp' ".(($row['sip_transport'] == 'tcp') ? "selected" : null).">TCP</option>\n";
echo " <option value='udp' ".(($row['sip_transport'] == 'udp') ? "selected" : null).">UDP</option>\n";
echo " <option value='tls' ".(($row['sip_transport'] == 'tls') ? "selected" : null).">TLS</option>\n";
echo " <option value='dns srv' ".(($row['sip_transport'] == 'dns srv') ? "selected" : null).">DNS SRV</option>\n";
echo " </select>\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <input class='formfld' style='width: 75px;' type='text' name='device_lines[".$x."][register_expires]' maxlength='255' value=\"".$row['register_expires']."\">\n";
echo " </td>\n";
echo " <td align='left'>\n";
echo " <select class='formfld' name='device_lines[".$x."][enabled]'>\n";
echo " <option value='true' ".(($row['enabled'] == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " <option value='false' ".(($row['enabled'] == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
echo " </td>\n";
echo " <td>\n";
if (strlen($row['device_line_uuid']) > 0) {
if (permission_exists('device_delete')) {
echo " <a href='device_line_delete.php?device_uuid=".$row['device_uuid']."&id=".$row['device_line_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
}
echo " </td>\n";
echo " </tr>\n";
$x++;
}
echo " </table>\n";
if (strlen($text['description-lines']) > 0) {
echo " <br>".$text['description-lines']."\n";
}
echo " </td>";
echo " </tr>";
}
if (permission_exists('device_profile_edit')) {
//device profile
$sql = "select * from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
@@ -738,7 +769,9 @@ require_once "resources/require.php";
echo " </td>";
echo " </tr>";
}
}
if (permission_exists('device_key_edit')) {
$vendor_count = 0;
foreach($device_keys as $row) {
if ($previous_vendor != $row['device_key_vendor']) {
@@ -1065,7 +1098,7 @@ require_once "resources/require.php";
}
//device settings
if (permission_exists('device_setting_add')) {
if (permission_exists('device_setting_edit')) {
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-settings']."</td>";
echo " <td class='vtable' align='left'>";
@@ -1153,75 +1186,85 @@ require_once "resources/require.php";
echo " </tr>\n";
}
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_username' id='device_username' autocomplete=\"off\" maxlength='255' placeholder=\"".$text['label-device_username']."\" value=\"$device_username\">\n";
echo " <input class='formfld' type='text' name='device_password' id='device_password' autocomplete=\"off\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='255' placeholder=\"".$text['label-device_password']."\" value=\"$device_password\">\n";
echo " <div style='display: none;' id='duplicate_username_response'></div>\n";
echo "<br />\n";
echo $text['description-device']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_uuid_alternate']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left' nowrap='nowrap'>\n";
if (strlen($device_uuid_alternate) == 0) {
echo " <input class='formfld' type='text' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\">";
if (permission_exists('device_username_password')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_username' id='device_username' autocomplete=\"off\" maxlength='255' placeholder=\"".$text['label-device_username']."\" value=\"$device_username\">\n";
echo " <input class='formfld' type='text' name='device_password' id='device_password' autocomplete=\"off\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='255' placeholder=\"".$text['label-device_password']."\" value=\"$device_password\">\n";
echo " <div style='display: none;' id='duplicate_username_response'></div>\n";
echo "<br />\n";
echo $text['description-device']."\n";
echo "</td>\n";
echo "</tr>\n";
}
else {
$label = $device_alternate[0]['device_label'];
if (strlen($label) == 0) { $label = $device_alternate[0]['device_description']; }
if (strlen($label) == 0) { $label = $device_alternate[0]['device_mac_address']; }
echo " <table>\n";
echo " <tr>\n";
echo " <td><a href='?id=$device_uuid_alternate' id='device_uuid_alternate_link'>$label</a><input class='formfld' type='hidden' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\">&nbsp;</td>";
echo " <td><a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('device_uuid_alternate').value = ''; document.getElementById('device_uuid_alternate_link').hidden = 'true'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a></td>\n";
echo " </tr>\n";
echo " </table>\n";
unset($label);
if (permission_exists('device_alternate')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_uuid_alternate']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left' nowrap='nowrap'>\n";
if (strlen($device_uuid_alternate) == 0) {
echo " <input class='formfld' type='text' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\">";
}
else {
$label = $device_alternate[0]['device_label'];
if (strlen($label) == 0) { $label = $device_alternate[0]['device_description']; }
if (strlen($label) == 0) { $label = $device_alternate[0]['device_mac_address']; }
echo " <table>\n";
echo " <tr>\n";
echo " <td><a href='?id=$device_uuid_alternate' id='device_uuid_alternate_link'>$label</a><input class='formfld' type='hidden' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\">&nbsp;</td>";
echo " <td><a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('device_uuid_alternate').value = ''; document.getElementById('device_uuid_alternate_link').hidden = 'true'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a></td>\n";
echo " </tr>\n";
echo " </table>\n";
unset($label);
}
echo $text['description-device_uuid_alternate']."\n";
echo "</td>\n";
echo "</tr>\n";
}
echo $text['description-device_uuid_alternate']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_vendor']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_vendor' maxlength='255' value=\"$device_vendor\">\n";
echo "<br />\n";
echo $text['description-device_vendor']."\n";
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('device_vendor')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_vendor']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_vendor' maxlength='255' value=\"$device_vendor\">\n";
echo "<br />\n";
echo $text['description-device_vendor']."\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_model']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_model' maxlength='255' value=\"$device_model\">\n";
echo "<br />\n";
echo $text['description-device_model']."\n";
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('device_model')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_model']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_model' maxlength='255' value=\"$device_model\">\n";
echo "<br />\n";
echo $text['description-device_model']."\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_firmware_version']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_firmware_version' maxlength='255' value=\"$device_firmware_version\">\n";
echo "<br />\n";
echo $text['description-device_firmware_version']."\n";
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('device_firmware')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_firmware_version']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_firmware_version' maxlength='255' value=\"$device_firmware_version\">\n";
echo "<br />\n";
echo $text['description-device_firmware_version']."\n";
echo "</td>\n";
echo "</tr>\n";
}
if (permission_exists('device_domain')) {
echo "<tr>\n";
@@ -1253,38 +1296,46 @@ require_once "resources/require.php";
echo " <input type='hidden' name='domain_uuid' id='domain_uuid' value=\"".$_SESSION['domain_uuid']."\">\n";
}
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_provision_enable']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='device_provision_enable'>\n";
if ($device_provision_enable == "true" || strlen($device_provision_enable) == 0) {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
if (permission_exists('device_enable')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_provision_enable']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='device_provision_enable'>\n";
if ($device_provision_enable == "true" || strlen($device_provision_enable) == 0) {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($device_provision_enable == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-device_provision_enable']."\n";
echo "</td>\n";
echo "</tr>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($device_provision_enable == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-device_provision_enable']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_description' maxlength='255' value=\"$device_description\">\n";
echo "<br />\n";
echo $text['description-device_description']."\n";
if (permission_exists('device_description')) {
echo " <input class='formfld' type='text' name='device_description' maxlength='255' value=\"$device_description\">\n";
echo "<br />\n";
echo $text['description-device_description']."\n";
}
else {
echo $device_description."\n";
}
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";

View File

@@ -13,7 +13,7 @@
These entries will be pre-pended to the LUA_PATH environment variable
-->
<!-- <param name="script-directory" value="/usr/local/lua/?.lua"/> -->
<param name="script-directory" value="$${base_dir}/scripts/?.lua"/>
<param name="script-directory" value="$${script_dir}/?.lua"/>
<param name="xml-handler-script" value="app.lua xml_handler"/>
<param name="xml-handler-bindings" value="configuration,dialplan,directory"/>

View File

@@ -223,8 +223,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
account.1.nat.udp_update_enable =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =

View File

@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 1
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30

View File

@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 1
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30

View File

@@ -223,8 +223,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
account.1.nat.udp_update_enable =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =

View File

@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 1
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30

View File

@@ -223,8 +223,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
account.1.nat.udp_update_enable =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =

View File

@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 1
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30

View File

@@ -223,8 +223,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
account.1.nat.udp_update_enable =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =

View File

@@ -223,8 +223,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
account.1.nat.udp_update_enable =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =

View File

@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 1
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30

View File

@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 1
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30

View File

@@ -253,8 +253,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
account.1.nat.udp_update_enable =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =

View File

@@ -147,8 +147,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
account.1.nat.udp_update_enable =
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =