Merge branch 'master' into follow_me_lua

This commit is contained in:
Alexey Melnichuk 2015-11-09 16:45:57 +03:00
commit 27d7369328
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) {
//devices
//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_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,24 +541,37 @@ require_once "resources/require.php";
echo " ".$text['label-device_mac_address']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\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 " <div style='display: none;' id='duplicate_mac_response'></div>\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 "</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";
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";
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";
@ -589,7 +617,9 @@ require_once "resources/require.php";
echo $text['description-device_template']."\n";
echo "</td>\n";
echo "</tr>\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'>";
@ -713,8 +743,9 @@ require_once "resources/require.php";
}
echo " </td>";
echo " </tr>";
}
if (permission_exists('device_key_add') || permission_exists('device_key_edit')) {
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,6 +1186,7 @@ require_once "resources/require.php";
echo " </tr>\n";
}
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";
@ -1165,7 +1199,9 @@ require_once "resources/require.php";
echo $text['description-device']."\n";
echo "</td>\n";
echo "</tr>\n";
}
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";
@ -1189,7 +1225,9 @@ require_once "resources/require.php";
echo $text['description-device_uuid_alternate']."\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";
@ -1200,7 +1238,9 @@ require_once "resources/require.php";
echo $text['description-device_vendor']."\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";
@ -1211,7 +1251,9 @@ require_once "resources/require.php";
echo $text['description-device_model']."\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";
@ -1222,6 +1264,7 @@ require_once "resources/require.php";
echo $text['description-device_firmware_version']."\n";
echo "</td>\n";
echo "</tr>\n";
}
if (permission_exists('device_domain')) {
echo "<tr>\n";
@ -1253,6 +1296,7 @@ require_once "resources/require.php";
echo " <input type='hidden' name='domain_uuid' id='domain_uuid' value=\"".$_SESSION['domain_uuid']."\">\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";
@ -1276,15 +1320,22 @@ require_once "resources/require.php";
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";
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 =