mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-10 10:38:22 +00:00
Add a new table v_device_keys which is used to assign the buttons to lines, blf, park and more. Also add sip port, sip transport and register expires to device lines.
This commit is contained in:
@@ -99,6 +99,22 @@
|
||||
$apps[$x]['permissions'][$y]['name'] = "device_setting_delete";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_key_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_key_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_key_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'device_key_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
|
||||
$y++;
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
@@ -191,47 +207,6 @@
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = "v_device_extensions";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "device_extension_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)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_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)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "device_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)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_devices";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "device_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$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";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_extensions";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "extension_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "device_line";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
|
||||
$y = 2; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = "v_device_lines";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
@@ -283,8 +258,20 @@
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the password.";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_port";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_transport";
|
||||
$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'] = "register_expires";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
|
||||
$y = 3; //table array index
|
||||
$y = 2; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = "v_device_settings";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "device_setting_uuid";
|
||||
@@ -336,4 +323,47 @@
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
|
||||
$y = 3; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_device_keys';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_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)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_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)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_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)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_devices';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'device_uuid';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the key ID.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_type';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_value';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the value.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_label';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the label.';
|
||||
$z++;
|
||||
|
||||
?>
|
||||
|
||||
@@ -121,6 +121,30 @@
|
||||
$text['description-outbound_proxy']['pt-pt'] = "Introduza o outbound proxy.";
|
||||
$text['description-outbound_proxy']['fr-fr'] = "";
|
||||
|
||||
$text['label-sip_port']['en-us'] = "Port";
|
||||
$text['label-sip_port']['pt-pt'] = "";
|
||||
$text['label-sip_port']['fr-fr'] = "";
|
||||
|
||||
$text['description-sip_port']['en-us'] = "Enter the SIP port.";
|
||||
$text['description-sip_port']['pt-pt'] = "";
|
||||
$text['description-sip_port']['fr-fr'] = "";
|
||||
|
||||
$text['label-sip_transport']['en-us'] = "Transport";
|
||||
$text['label-sip_transport']['pt-pt'] = "";
|
||||
$text['label-sip_transport']['fr-fr'] = "";
|
||||
|
||||
$text['description-sip_transport']['en-us'] = "Enter the SIP transport protocol.";
|
||||
$text['description-sip_transport']['pt-pt'] = "Introduza o .";
|
||||
$text['description-sip_transport']['fr-fr'] = "";
|
||||
|
||||
$text['label-register_expires']['en-us'] = "Register Expires";
|
||||
$text['label-register_expires']['pt-pt'] = "";
|
||||
$text['label-register_expires']['fr-fr'] = "";
|
||||
|
||||
$text['description-register_expires']['en-us'] = "Enter the expire time for the SIP registration.";
|
||||
$text['description-register_expires']['pt-pt'] = ".";
|
||||
$text['description-register_expires']['fr-fr'] = "";
|
||||
|
||||
$text['label-display_name']['en-us'] = "Display Name";
|
||||
$text['label-display_name']['pt-pt'] = "Nome no visor";
|
||||
$text['label-display_name']['fr-fr'] = "Nom affiché";
|
||||
@@ -185,6 +209,53 @@
|
||||
$text['description-device_description']['pt-pt'] = "Introduza a descrição.";
|
||||
$text['description-device_description']['fr-fr'] = "";
|
||||
|
||||
//keys
|
||||
$text['label-keys']['en-us'] = "Keys";
|
||||
$text['label-keys']['pt-pt'] = "";
|
||||
$text['label-keys']['fr-fr'] = "";
|
||||
|
||||
$text['title-device_keys']['en-us'] = 'Device Keys';
|
||||
$text['title-device_keys']['pt-pt'] = '';
|
||||
|
||||
$text['title-device_key']['en-us'] = 'Device Key';
|
||||
$text['title-device_key']['pt-pt'] = '';
|
||||
|
||||
$text['description-device_key']['en-us'] = '';
|
||||
$text['description-device_key']['pt-pt'] = '';
|
||||
|
||||
$text['label-device_key_id']['en-us'] = 'Key';
|
||||
$text['label-device_key_id']['pt-pt'] = '';
|
||||
|
||||
$text['description-device_key']['en-us'] = 'Select the key.';
|
||||
$text['description-device_key']['pt-pt'] = '';
|
||||
|
||||
$text['label-device_key_type']['en-us'] = 'Type';
|
||||
$text['label-device_key_type']['pt-pt'] = '';
|
||||
|
||||
$text['description-device_key_type']['en-us'] = 'Select the type of key.';
|
||||
$text['description-device_key_type']['pt-pt'] = '';
|
||||
|
||||
$text['label-device_key_value']['en-us'] = 'Value';
|
||||
$text['label-device_key_value']['pt-pt'] = '';
|
||||
|
||||
$text['description-device_key_value']['en-us'] = 'Enter the value.';
|
||||
$text['description-device_key_value']['pt-pt'] = '';
|
||||
|
||||
$text['label-device_key_label']['en-us'] = 'Label';
|
||||
$text['label-device_key_label']['pt-pt'] = '';
|
||||
|
||||
$text['description-device_key_label']['en-us'] = 'Enter the label.';
|
||||
$text['description-device_key_label']['pt-pt'] = '';
|
||||
|
||||
$text['label-line']['en-us'] = 'line';
|
||||
$text['label-line']['pt-pt'] = '';
|
||||
|
||||
$text['label-blf']['en-us'] = 'blf';
|
||||
$text['label-blf']['pt-pt'] = '';
|
||||
|
||||
$text['label-park']['en-us'] = 'park';
|
||||
$text['label-park']['pt-pt'] = '';
|
||||
|
||||
//general translations
|
||||
$text['label-true']['en-us'] = "true";
|
||||
$text['label-true']['pt-pt'] = "sim";
|
||||
|
||||
@@ -74,6 +74,11 @@ require_once "resources/require.php";
|
||||
$user_id = check_str($_POST["user_id"]);
|
||||
$auth_id = check_str($_POST["auth_id"]);
|
||||
$password = check_str($_POST["password"]);
|
||||
//keys
|
||||
$device_key_id = check_str($_POST["device_key_id"]);
|
||||
$device_key_type = check_str($_POST["device_key_type"]);
|
||||
$device_key_value = check_str($_POST["device_key_value"]);
|
||||
$device_key_label = check_str($_POST["device_key_label"]);
|
||||
//settings
|
||||
//$device_setting_category = check_str($_POST["device_setting_category"]);
|
||||
$device_setting_subcategory = check_str($_POST["device_setting_subcategory"]);
|
||||
@@ -245,7 +250,33 @@ require_once "resources/require.php";
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//add the device settings
|
||||
//add a device key
|
||||
if (strlen($device_key_id) > 0 && permission_exists('device_key_add')) {
|
||||
$sql = "insert into v_device_keys ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "device_uuid, ";
|
||||
$sql .= "device_key_uuid, ";
|
||||
$sql .= "device_key_id, ";
|
||||
$sql .= "device_key_type, ";
|
||||
$sql .= "device_key_value, ";
|
||||
$sql .= "device_key_label ";
|
||||
$sql .= ")";
|
||||
$sql .= " values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$device_uuid', ";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$device_key_id', ";
|
||||
$sql .= "'$device_key_type', ";
|
||||
$sql .= "'$device_key_value', ";
|
||||
$sql .= "'$device_key_label' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//add a device setting
|
||||
if (strlen($device_setting_subcategory) > 0 && permission_exists('device_setting_add')) {
|
||||
$device_setting_category = "provision";
|
||||
$device_setting_name = "text";
|
||||
@@ -451,7 +482,7 @@ require_once "resources/require.php";
|
||||
echo " ".$row['auth_id']." \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable'>\n";
|
||||
echo " ".$row['password']." \n";
|
||||
echo " ******** \n"; //$row['password']
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
if (permission_exists('device_edit')) {
|
||||
@@ -517,6 +548,91 @@ require_once "resources/require.php";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-keys'].":</td>";
|
||||
echo " <td class='vtable' align='left'>";
|
||||
echo " <table width='75%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable'>".$text['label-device_key_id']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-device_key_type']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-device_key_value']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-device_key_label']."</td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
$sql = "SELECT * FROM v_device_keys ";
|
||||
$sql .= "WHERE domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "AND device_uuid = '".$device_uuid."' ";
|
||||
$sql .= "ORDER by device_key_id asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable'>\n";
|
||||
echo " ".$row['device_key_id']." \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable'>\n";
|
||||
echo " ".$row['device_key_type']." \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable'>\n";
|
||||
echo " ".$row['device_key_value']." \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable'>\n";
|
||||
echo " ".$row['device_key_label']." \n";
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
if (permission_exists('device_key_edit')) {
|
||||
echo " <a href='device_key_edit.php?device_uuid=".$row['device_uuid']."&id=".$row['device_key_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('device_key_delete')) {
|
||||
echo " <a href='device_key_delete.php?device_uuid=".$row['device_uuid']."&id=".$row['device_key_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td class='vtable' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " <select class='formfld' style='width: 45px;' name='device_key_id'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='1'>1</option>\n";
|
||||
echo " <option value='2'>2</option>\n";
|
||||
echo " <option value='3'>3</option>\n";
|
||||
echo " <option value='4'>4</option>\n";
|
||||
echo " <option value='5'>5</option>\n";
|
||||
echo " <option value='6'>6</option>\n";
|
||||
echo " <option value='7'>7</option>\n";
|
||||
echo " <option value='8'>8</option>\n";
|
||||
echo " <option value='9'>9</option>\n";
|
||||
echo " <option value='10'>10</option>\n";
|
||||
echo " <option value='11'>11</option>\n";
|
||||
echo " <option value='12'>12</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_key_type' style='width: 120px;' maxlength='255' value=\"$device_key_type\">\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_key_value' style='width: 120px;' maxlength='255' value=\"$device_key_value\">\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_key_label' style='width: 150px;' maxlength='255' value=\"$device_key_label\">\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo " <td class='vtable' align='left'>\n";
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
if (strlen($text['description-settings']) > 0) {
|
||||
echo " <br>".$text['description-settings']."\n";
|
||||
}
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-settings'].":</td>";
|
||||
echo " <td class='vtable' align='left'>";
|
||||
|
||||
44
app/devices/device_key_delete.php
Normal file
44
app/devices/device_key_delete.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('device_key_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//get the id
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
$device_uuid = check_str($_GET["device_uuid"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
//delete device_key
|
||||
$sql = "delete from v_device_keys ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and device_key_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=device_edit.php?id=$device_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo $text['message-delete']."\n";
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
352
app/devices/device_key_edit.php
Normal file
352
app/devices/device_key_edit.php
Normal file
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('device_key_add') || permission_exists('device_key_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$device_key_uuid = check_str($_REQUEST["id"]);
|
||||
$device_uuid = check_str($_REQUEST["device_uuid"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//set the parent uuid
|
||||
if (strlen($_GET["device_key_uuid"]) > 0) {
|
||||
$device_key_uuid = check_str($_GET["device_key_uuid"]);
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$device_key_id = check_str($_POST["device_key_id"]);
|
||||
$device_key_type = check_str($_POST["device_key_type"]);
|
||||
$device_key_value = check_str($_POST["device_key_value"]);
|
||||
$device_key_label = check_str($_POST["device_key_label"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$device_key_uuid = check_str($_POST["device_key_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($device_key_id) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_id']."<br>\n"; }
|
||||
//if (strlen($device_key_type) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_type']."<br>\n"; }
|
||||
//if (strlen($device_key_value) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_value']."<br>\n"; }
|
||||
//if (strlen($device_key_label) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_label']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('device_key_add')) {
|
||||
$sql = "insert into v_device_keys ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "device_key_uuid, ";
|
||||
$sql .= "device_uuid, ";
|
||||
$sql .= "device_key_id, ";
|
||||
$sql .= "device_key_type, ";
|
||||
$sql .= "device_key_value, ";
|
||||
$sql .= "device_key_label ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$device_uuid', ";
|
||||
$sql .= "'$device_key_id', ";
|
||||
$sql .= "'$device_key_type', ";
|
||||
$sql .= "'$device_key_value', ";
|
||||
$sql .= "'$device_key_label' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=device_edit.php?id=$device_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo " ".$text['message-add']."\n";
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('device_key_edit')) {
|
||||
$sql = "update v_device_keys set ";
|
||||
$sql .= "device_key_id = '$device_key_id', ";
|
||||
$sql .= "device_key_type = '$device_key_type', ";
|
||||
$sql .= "device_key_value = '$device_key_value', ";
|
||||
$sql .= "device_key_label = '$device_key_label' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and device_key_uuid = '$device_key_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=device_edit.php?id=$device_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo " ".$text['message-update']."\n";
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
||||
$device_key_uuid = check_str($_GET["id"]);
|
||||
$sql = "select * from v_device_keys ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and device_key_uuid = '$device_key_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$device_key_id = $row["device_key_id"];
|
||||
$device_key_type = $row["device_key_type"];
|
||||
$device_key_value = $row["device_key_value"];
|
||||
$device_key_label = $row["device_key_label"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['title-device_key']."</b></td>\n";
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='device_key_edit.php?id=$device_key_uuid'\" value='".$text['button-back']."'></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-device_key_id'].": $device_key_id\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='device_key_id'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($device_key_id == "1") {
|
||||
echo " <option value='1' selected='selected'>1</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='1'>1</option>\n";
|
||||
}
|
||||
if ($device_key_id == "2") {
|
||||
echo " <option value='2' selected='selected'>2</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='2'>2</option>\n";
|
||||
}
|
||||
if ($device_key_id == "3") {
|
||||
echo " <option value='3' selected='selected'>3</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='3'>3</option>\n";
|
||||
}
|
||||
if ($device_key_id == "4") {
|
||||
echo " <option value='4' selected='selected'>4</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='4'>4</option>\n";
|
||||
}
|
||||
if ($device_key_id == "5") {
|
||||
echo " <option value='5' selected='selected'>5</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='5'>5</option>\n";
|
||||
}
|
||||
if ($device_key_id == "6") {
|
||||
echo " <option value='6' selected='selected'>6</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='6'>6</option>\n";
|
||||
}
|
||||
if ($device_key_id == "7") {
|
||||
echo " <option value='7' selected='selected'>7</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='7'>7</option>\n";
|
||||
}
|
||||
if ($device_key_id == "8") {
|
||||
echo " <option value='8' selected='selected'>8</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='8'>8</option>\n";
|
||||
}
|
||||
if ($device_key_id == "9") {
|
||||
echo " <option value='9' selected='selected'>9</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='9'>9</option>\n";
|
||||
}
|
||||
if ($device_key_id == "10") {
|
||||
echo " <option value='10' selected='selected'>10</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='10'>10</option>\n";
|
||||
}
|
||||
if ($device_key_id == "11") {
|
||||
echo " <option value='11' selected='selected'>11</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='11'>11</option>\n";
|
||||
}
|
||||
if ($device_key_id == "12") {
|
||||
echo " <option value='12' selected='selected'>12</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='12'>12</option>\n";
|
||||
}
|
||||
if ($device_key_id == "13") {
|
||||
echo " <option value='13' selected='selected'>13</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='13'>13</option>\n";
|
||||
}
|
||||
if ($device_key_id == "14") {
|
||||
echo " <option value='14' selected='selected'>14</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='14'>14</option>\n";
|
||||
}
|
||||
if ($device_key_id == "15") {
|
||||
echo " <option value='15' selected='selected'>15</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='15'>15</option>\n";
|
||||
}
|
||||
if ($device_key_id == "16") {
|
||||
echo " <option value='16' selected='selected'>16</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='16'>16</option>\n";
|
||||
}
|
||||
if ($device_key_id == "17") {
|
||||
echo " <option value='17' selected='selected'>17</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='17'>17</option>\n";
|
||||
}
|
||||
if ($device_key_id == "18") {
|
||||
echo " <option value='18' selected='selected'>18</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='18'>18</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_key_id']."\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_key_type'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='device_key_type'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($device_key_type == "line") {
|
||||
echo " <option value='line' selected='selected'>".$text['label-line']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='line'>".$text['label-line']."</option>\n";
|
||||
}
|
||||
if ($device_key_type == "blf") {
|
||||
echo " <option value='blf' selected='selected'>".$text['label-blf']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='blf'>".$text['label-blf']."</option>\n";
|
||||
}
|
||||
if ($device_key_type == "park") {
|
||||
echo " <option value='park' selected='selected'>".$text['label-park']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='park'>".$text['label-park']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_key_type']."\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_key_value'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_key_value' maxlength='255' value=\"$device_key_value\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_key_value']."\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_key_label'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_key_label' maxlength='255' value=\"$device_key_label\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-device_key_label']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type='hidden' name='device_uuid' value='$device_uuid'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='device_key_uuid' value='$device_key_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
@@ -58,6 +58,9 @@ else {
|
||||
$line_number = check_str($_POST["line_number"]);
|
||||
$server_address = check_str($_POST["server_address"]);
|
||||
$outbound_proxy = check_str($_POST["outbound_proxy"]);
|
||||
$sip_port = check_str($_POST["sip_port"]);
|
||||
$sip_transport = check_str($_POST["sip_transport"]);
|
||||
$register_expires = check_str($_POST["register_expires"]);
|
||||
$display_name = check_str($_POST["display_name"]);
|
||||
$user_id = check_str($_POST["user_id"]);
|
||||
$auth_id = check_str($_POST["auth_id"]);
|
||||
@@ -104,6 +107,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$sql .= "line_number, ";
|
||||
$sql .= "server_address, ";
|
||||
$sql .= "outbound_proxy, ";
|
||||
$sql .= "sip_port, ";
|
||||
$sql .= "sip_transport, ";
|
||||
$sql .= "register_expires, ";
|
||||
$sql .= "display_name, ";
|
||||
$sql .= "user_id, ";
|
||||
$sql .= "auth_id, ";
|
||||
@@ -117,6 +123,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$sql .= "'$line_number', ";
|
||||
$sql .= "'$server_address', ";
|
||||
$sql .= "'$outbound_proxy', ";
|
||||
$sql .= "'$sip_port', ";
|
||||
$sql .= "'$sip_transport', ";
|
||||
$sql .= "'$register_expires', ";
|
||||
$sql .= "'$display_name', ";
|
||||
$sql .= "'$user_id', ";
|
||||
$sql .= "'$auth_id', ";
|
||||
@@ -133,6 +142,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$sql .= "line_number = '$line_number', ";
|
||||
$sql .= "server_address = '$server_address', ";
|
||||
$sql .= "outbound_proxy = '$outbound_proxy', ";
|
||||
$sql .= "sip_port = '$sip_port', ";
|
||||
$sql .= "sip_transport = '$sip_transport', ";
|
||||
$sql .= "register_expires = '$register_expires', ";
|
||||
$sql .= "display_name = '$display_name', ";
|
||||
$sql .= "user_id = '$user_id', ";
|
||||
$sql .= "auth_id = '$auth_id', ";
|
||||
@@ -172,6 +184,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
$line_number = $row["line_number"];
|
||||
$server_address = $row["server_address"];
|
||||
$outbound_proxy = $row["outbound_proxy"];
|
||||
$sip_port = $row["sip_port"];
|
||||
$sip_transport = $row["sip_transport"];
|
||||
$register_expires = $row["register_expires"];
|
||||
$display_name = $row["display_name"];
|
||||
$user_id = $row["user_id"];
|
||||
$auth_id = $row["auth_id"];
|
||||
@@ -289,6 +304,40 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo $text['description-password']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-sip_port'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='sip_port' maxlength='255' value=\"$sip_port\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-sip_port']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-sip_transport'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='sip_transport' maxlength='255' value=\"$sip_transport\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-sip_transport']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-register_expires'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='register_expires' maxlength='255' value=\"$register_expires\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-register_expires']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type='hidden' name='device_uuid' value='$device_uuid'>\n";
|
||||
|
||||
Reference in New Issue
Block a user