mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-22 02:46:30 +00:00
Menu: PHP 8.1 updates
This commit is contained in:
@@ -45,29 +45,50 @@
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//define the variables
|
||||
$menu_uuid = null;
|
||||
$menu_item_uuid = null;
|
||||
$menu_item_title = '';
|
||||
$menu_item_link = '';
|
||||
$menu_item_category = '';
|
||||
$menu_item_icon = '';
|
||||
$menu_item_description = '';
|
||||
$menu_item_protected = '';
|
||||
$menu_item_parent_uuid = null;
|
||||
$menu_item_order = null;
|
||||
|
||||
//get the menu_uuid
|
||||
$menu_uuid = $_REQUEST["id"];
|
||||
$menu_item_uuid = $_REQUEST['menu_item_uuid'];
|
||||
$group_uuid_name = $_REQUEST['group_uuid_name'];
|
||||
$menu_item_group_uuid = $_REQUEST['menu_item_group_uuid'];
|
||||
if (!empty($_REQUEST)) {
|
||||
$menu_uuid = $_REQUEST["id"];
|
||||
$menu_item_uuid = $_REQUEST['menu_item_uuid'] ?? null;
|
||||
$group_uuid_name = $_REQUEST['group_uuid_name'] ?? null;
|
||||
$menu_item_group_uuid = $_REQUEST['menu_item_group_uuid'] ?? null;
|
||||
}
|
||||
|
||||
//set the action
|
||||
$action = '';
|
||||
if (!empty($_REQUEST["a"])) {
|
||||
$action = $_REQUEST["a"];
|
||||
}
|
||||
|
||||
//delete the group from the menu item
|
||||
if ($_REQUEST["a"] == "delete" && permission_exists("menu_delete") && is_uuid($menu_item_group_uuid)) {
|
||||
if ($action == "delete" && permission_exists("menu_delete") && is_uuid($menu_item_group_uuid)) {
|
||||
//delete the group from the users
|
||||
$array['menu_item_groups'][0]['menu_item_group_uuid'] = $menu_item_group_uuid;
|
||||
$database = new database;
|
||||
$database->app_name = 'menu';
|
||||
$database->app_uuid = 'f4b3b3d2-6287-489c-2a00-64529e46f2d7';
|
||||
$database->delete($array);
|
||||
unset($array);
|
||||
$array['menu_item_groups'][0]['menu_item_group_uuid'] = $menu_item_group_uuid;
|
||||
$database = new database;
|
||||
$database->app_name = 'menu';
|
||||
$database->app_uuid = 'f4b3b3d2-6287-489c-2a00-64529e46f2d7';
|
||||
$database->delete($array);
|
||||
unset($array);
|
||||
|
||||
//redirect the browser
|
||||
message::add($text['message-delete']);
|
||||
header("Location: menu_item_edit.php?id=".urlencode($menu_uuid)."&menu_item_uuid=".urlencode($menu_item_uuid)."&menu_uuid=".urlencode($menu_uuid));
|
||||
return;
|
||||
message::add($text['message-delete']);
|
||||
header("Location: menu_item_edit.php?id=".urlencode($menu_uuid)."&menu_item_uuid=".urlencode($menu_item_uuid)."&menu_uuid=".urlencode($menu_uuid));
|
||||
return;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["menu_item_uuid"])) {
|
||||
if (!empty($_REQUEST["menu_item_uuid"]) && is_uuid($_REQUEST["menu_item_uuid"])) {
|
||||
$action = "update";
|
||||
$menu_item_uuid = $_REQUEST["menu_item_uuid"];
|
||||
}
|
||||
@@ -76,25 +97,24 @@
|
||||
}
|
||||
|
||||
//get the HTTP POST variables and set them as PHP variables
|
||||
if (count($_POST) > 0) {
|
||||
$menu_uuid = $_POST["menu_uuid"];
|
||||
$menu_item_uuid = $_POST["menu_item_uuid"];
|
||||
$menu_item_title = $_POST["menu_item_title"];
|
||||
$menu_item_link = $_POST["menu_item_link"];
|
||||
$menu_item_category = $_POST["menu_item_category"];
|
||||
$menu_item_icon = $_POST["menu_item_icon"];
|
||||
$menu_item_description = $_POST["menu_item_description"];
|
||||
$menu_item_protected = $_POST["menu_item_protected"];
|
||||
//$menu_item_uuid = $_POST["menu_item_uuid"];
|
||||
$menu_item_parent_uuid = $_POST["menu_item_parent_uuid"];
|
||||
$menu_item_order = $_POST["menu_item_order"];
|
||||
if (!empty($_POST)) {
|
||||
$menu_uuid = $_POST["menu_uuid"] ?? '';
|
||||
$menu_item_uuid = $_POST["menu_item_uuid"] ?? '';
|
||||
$menu_item_title = $_POST["menu_item_title"] ?? '';
|
||||
$menu_item_link = $_POST["menu_item_link"] ?? '';
|
||||
$menu_item_category = $_POST["menu_item_category"] ?? '';
|
||||
$menu_item_icon = $_POST["menu_item_icon"] ?? '';
|
||||
$menu_item_description = $_POST["menu_item_description"] ?? '';
|
||||
$menu_item_protected = $_POST["menu_item_protected"] ?? '';
|
||||
$menu_item_parent_uuid = $_POST["menu_item_parent_uuid"] ?? null;
|
||||
$menu_item_order = $_POST["menu_item_order"] ?? '';
|
||||
}
|
||||
|
||||
//sanitize the menu link
|
||||
$menu_item_link = preg_replace('#[^a-zA-Z0-9_:\-\.\&\=\?\/]#', '', $menu_item_link);
|
||||
|
||||
//when a HTTP POST is available then process it
|
||||
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
if ($action == "update") {
|
||||
$menu_item_uuid = $_POST["menu_item_uuid"];
|
||||
@@ -127,7 +147,7 @@
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
//get the language from the menu
|
||||
$sql = "select menu_language from v_menus ";
|
||||
$sql .= "where menu_uuid = :menu_uuid ";
|
||||
@@ -213,7 +233,7 @@
|
||||
unset($parameters);
|
||||
|
||||
//add a group to the menu
|
||||
if ($_REQUEST["a"] != "delete" && !empty($group_uuid_name) && permission_exists('menu_add')) {
|
||||
if (!empty($group_uuid_name) && permission_exists('menu_add')) {
|
||||
$group_data = explode('|', $group_uuid_name);
|
||||
$group_uuid = $group_data[0];
|
||||
$group_name = $group_data[1];
|
||||
@@ -234,7 +254,7 @@
|
||||
}
|
||||
|
||||
//add the menu item label
|
||||
if ($_REQUEST["a"] != "delete" && !empty($menu_item_title) && permission_exists('menu_add')) {
|
||||
if (!empty($menu_item_title) && permission_exists('menu_add')) {
|
||||
$sql = "select count(*) from v_menu_languages ";
|
||||
$sql .= "where menu_item_uuid = :menu_item_uuid ";
|
||||
$sql .= "and menu_language = :menu_language ";
|
||||
@@ -279,7 +299,7 @@
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
if ($_REQUEST['submit'] == $text['button-add']) {
|
||||
if (!empty($_REQUEST['submit']) && $_REQUEST['submit'] == $text['button-add']) {
|
||||
header("Location: menu_item_edit.php?id=".urlencode($menu_uuid)."&menu_item_uuid=".urlencode($menu_item_uuid)."&menu_uuid=".urlencode($menu_uuid));
|
||||
}
|
||||
else {
|
||||
@@ -290,7 +310,7 @@
|
||||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
||||
if (!empty($_GET["menu_item_uuid"]) && empty($_POST["persistformvar"])) {
|
||||
$menu_item_uuid = $_GET["menu_item_uuid"];
|
||||
|
||||
$sql = "select * from v_menu_items ";
|
||||
@@ -348,8 +368,8 @@
|
||||
unset($sql, $parameters);
|
||||
|
||||
//set the assigned_groups array
|
||||
if (is_array($menu_item_groups) && sizeof($menu_item_groups) != 0) {
|
||||
$assigned_groups = array();
|
||||
$assigned_groups = array();
|
||||
if (!empty($menu_item_groups) && sizeof($menu_item_groups) != 0) {
|
||||
foreach ($menu_item_groups as $field) {
|
||||
if (!empty($field['group_name'])) {
|
||||
if (is_uuid($field['group_uuid'])) {
|
||||
@@ -362,7 +382,7 @@
|
||||
//get the groups
|
||||
$sql = "select * from v_groups ";
|
||||
$sql .= "where (domain_uuid is null or domain_uuid = :domain_uuid) ";
|
||||
if (is_array($assigned_groups) && sizeof($assigned_groups) != 0) {
|
||||
if (!empty($assigned_groups) && is_array($assigned_groups) && sizeof($assigned_groups) != 0) {
|
||||
$sql .= "and group_uuid not in ('".implode("','",$assigned_groups)."') ";
|
||||
}
|
||||
$sql .= "order by domain_uuid desc, group_name asc ";
|
||||
@@ -477,13 +497,13 @@
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-groups']."</td>";
|
||||
echo " <td class='vtable'>";
|
||||
if (is_array($menu_item_groups) && sizeof($menu_item_groups) != 0) {
|
||||
if (!empty($menu_item_groups) && sizeof($menu_item_groups) != 0) {
|
||||
echo "<table cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
foreach($menu_item_groups as $field) {
|
||||
if (!empty($field['group_name'])) {
|
||||
echo "<tr>\n";
|
||||
echo " <td class='vtable' style='white-space: nowrap; padding-right: 30px;' nowrap='nowrap'>";
|
||||
echo $field['group_name'].(($field['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['group_domain_uuid']]['domain_name'] : null);
|
||||
echo $field['group_name'].((!empty($field['group_domain_uuid'])) ? "@".$_SESSION['domains'][$field['group_domain_uuid']]['domain_name'] : null);
|
||||
echo " </td>\n";
|
||||
if (permission_exists('group_member_delete') || if_group("superadmin")) {
|
||||
echo " <td class='list_control_icons' style='width: 25px;'>";
|
||||
@@ -496,13 +516,13 @@
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
}
|
||||
if (is_array($groups)) {
|
||||
if (!empty($groups)) {
|
||||
echo "<select name='group_uuid_name' class='formfld' style='width: auto; margin-right: 3px;'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach($groups as $row) {
|
||||
if ($field['group_level'] <= $_SESSION['user']['group_level']) {
|
||||
if ($row['group_level'] <= $_SESSION['user']['group_level']) {
|
||||
if (!is_array($assigned_groups) || !in_array($row["group_uuid"], $assigned_groups)) {
|
||||
echo " <option value='".$row['group_uuid']."|".$row['group_name']."'>".$row['group_name'].(($row['domain_uuid'] != '') ? "@".$_SESSION['domains'][$row['domain_uuid']]['domain_name'] : null)."</option>\n";
|
||||
echo " <option value='".$row['group_uuid']."|".$row['group_name']."'>".$row['group_name'].((!empty($row['domain_uuid'])) ? "@".$_SESSION['domains'][$row['domain_uuid']]['domain_name'] : null)."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -536,8 +556,8 @@
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($action == "update") {
|
||||
if ($menu_item_parent_uuid == "") {
|
||||
if (!empty($action) && $action == "update") {
|
||||
if (empty($menu_item_parent_uuid)) {
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>".$text['label-menu_order']."</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_order' value='".escape($menu_item_order)."'></td>";
|
||||
|
||||
@@ -42,14 +42,14 @@
|
||||
}
|
||||
|
||||
//get the http post data
|
||||
if (is_array($_POST['menu_items'])) {
|
||||
if (!empty($_POST['menu_items'])) {
|
||||
$action = $_POST['action'];
|
||||
$menu_uuid = $_POST['menu_uuid'];
|
||||
$menu_items = $_POST['menu_items'];
|
||||
}
|
||||
|
||||
//process the http post data by action
|
||||
if ($action != '' && is_array($menu_items) && @sizeof($menu_items) != 0) {
|
||||
if (!empty($action) && !empty($menu_items)) {
|
||||
switch ($action) {
|
||||
case 'toggle':
|
||||
if (permission_exists('menu_item_edit')) {
|
||||
@@ -69,12 +69,21 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
$tmp_menu_item_order = 0;
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"] ?? '';
|
||||
$order = $_GET["order"] ?? '';
|
||||
|
||||
function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid) {
|
||||
global $menu_uuid, $tmp_menu_item_order, $v_link_label_edit, $v_link_label_delete, $page, $text, $x;
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
|
||||
//check for sub menus
|
||||
//set the initial value
|
||||
$tmp_menu_item_order = 0;
|
||||
|
||||
//add the build db child menu list
|
||||
function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid) {
|
||||
global $menu_uuid, $list_row_edit_button, $tmp_menu_item_order, $v_link_label_edit, $v_link_label_delete, $page, $text, $x;
|
||||
|
||||
//check for sub menus
|
||||
$menu_item_level = $menu_item_level+1;
|
||||
$sql = "select * from v_menu_items ";
|
||||
$sql .= "where menu_uuid = :menu_uuid ";
|
||||
@@ -85,135 +94,132 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid) {
|
||||
$database = new database;
|
||||
$result2 = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
if (is_array($result2) && sizeof($result2) != 0) {
|
||||
if (!empty($result2) && sizeof($result2) != 0) {
|
||||
foreach ($result2 as $row2) {
|
||||
//set the db values as php variables
|
||||
$menu_item_uuid = $row2['menu_item_uuid'];
|
||||
$menu_item_category = $row2['menu_item_category'];
|
||||
$menu_item_protected = $row2['menu_item_protected'];
|
||||
$menu_item_parent_uuid = $row2['menu_item_parent_uuid'];
|
||||
$menu_item_order = $row2['menu_item_order'];
|
||||
$menu_item_language = $row2['menu_item_language'];
|
||||
$menu_item_title = $row2['menu_item_title'];
|
||||
$menu_item_link = $row2['menu_item_link'];
|
||||
//get the groups that have been assigned to the menu
|
||||
$sql = "select ";
|
||||
$sql .= " g.group_name, g.domain_uuid as group_domain_uuid ";
|
||||
$sql .= "from ";
|
||||
$sql .= " v_menu_item_groups as mig, ";
|
||||
$sql .= " v_groups as g ";
|
||||
$sql .= "where ";
|
||||
$sql .= " mig.group_uuid = g.group_uuid ";
|
||||
$sql .= " and mig.menu_uuid = :menu_uuid ";
|
||||
$sql .= " and mig.menu_item_uuid = :menu_item_uuid ";
|
||||
$sql .= "order by ";
|
||||
$sql .= " g.domain_uuid desc, ";
|
||||
$sql .= " g.group_name asc ";
|
||||
$parameters['menu_uuid'] = $menu_uuid;
|
||||
$parameters['menu_item_uuid'] = $menu_item_uuid;
|
||||
$database = new database;
|
||||
$sub_result = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters, $group_list);
|
||||
|
||||
if (is_array($sub_result) && sizeof($sub_result) != 0) {
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
$group_list[] = $sub_row["group_name"].(($sub_row['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$sub_row['group_domain_uuid']]['domain_name'] : null);
|
||||
}
|
||||
$group_list = isset($group_list) ? implode(', ', $group_list) : '';
|
||||
//set the db values as php variables
|
||||
$menu_item_uuid = $row2['menu_item_uuid'];
|
||||
$menu_item_category = $row2['menu_item_category'];
|
||||
$menu_item_protected = $row2['menu_item_protected'];
|
||||
$menu_item_parent_uuid = $row2['menu_item_parent_uuid'];
|
||||
$menu_item_order = $row2['menu_item_order'];
|
||||
$menu_item_title = $row2['menu_item_title'];
|
||||
$menu_item_link = $row2['menu_item_link'];
|
||||
|
||||
//get the groups that have been assigned to the menu
|
||||
$sql = "select ";
|
||||
$sql .= " g.group_name, g.domain_uuid as group_domain_uuid ";
|
||||
$sql .= "from ";
|
||||
$sql .= " v_menu_item_groups as mig, ";
|
||||
$sql .= " v_groups as g ";
|
||||
$sql .= "where ";
|
||||
$sql .= " mig.group_uuid = g.group_uuid ";
|
||||
$sql .= " and mig.menu_uuid = :menu_uuid ";
|
||||
$sql .= " and mig.menu_item_uuid = :menu_item_uuid ";
|
||||
$sql .= "order by ";
|
||||
$sql .= " g.domain_uuid desc, ";
|
||||
$sql .= " g.group_name asc ";
|
||||
$parameters['menu_uuid'] = $menu_uuid;
|
||||
$parameters['menu_item_uuid'] = $menu_item_uuid;
|
||||
$database = new database;
|
||||
$sub_result = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters, $group_list);
|
||||
|
||||
$group_list = '';
|
||||
if (!empty($sub_result) && sizeof($sub_result) != 0) {
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
$group_array[] = $sub_row["group_name"].((!empty($sub_row['group_domain_uuid'])) ? "@".$_SESSION['domains'][$sub_row['group_domain_uuid']]['domain_name'] : null);
|
||||
}
|
||||
unset($sql, $sub_result, $sub_row);
|
||||
$group_list = !empty($group_array) ? implode(', ', $group_array) : '';
|
||||
}
|
||||
unset($sql, $sub_result, $sub_row);
|
||||
|
||||
//display the main body of the list
|
||||
switch ($menu_item_category) {
|
||||
case "internal":
|
||||
$menu_item_link = "<a href='".PROJECT_PATH.$menu_item_link."'>$menu_item_link</a>";
|
||||
break;
|
||||
case "external":
|
||||
if (substr($menu_item_link,0,1) == "/") {
|
||||
$menu_item_link = PROJECT_PATH.$menu_item_link;
|
||||
}
|
||||
$menu_item_link = "<a href='".$menu_item_link."' target='_blank'>".$menu_item_link."</a>";
|
||||
break;
|
||||
case "email":
|
||||
$menu_item_link = "<a href='mailto:".$menu_item_link."'>".$menu_item_link."</a>";
|
||||
break;
|
||||
}
|
||||
switch ($menu_item_category) {
|
||||
case "internal":
|
||||
$menu_item_link = "<a href='".PROJECT_PATH.$menu_item_link."'>$menu_item_link</a>";
|
||||
break;
|
||||
case "external":
|
||||
if (substr($menu_item_link,0,1) == "/") {
|
||||
$menu_item_link = PROJECT_PATH.$menu_item_link;
|
||||
}
|
||||
$menu_item_link = "<a href='".$menu_item_link."' target='_blank'>".$menu_item_link."</a>";
|
||||
break;
|
||||
case "email":
|
||||
$menu_item_link = "<a href='mailto:".$menu_item_link."'>".$menu_item_link."</a>";
|
||||
break;
|
||||
}
|
||||
|
||||
//display the content of the list
|
||||
if (permission_exists('menu_item_edit')) {
|
||||
$list_row_url = 'menu_item_edit.php?id='.urlencode($menu_uuid)."&menu_item_uuid=".urlencode($menu_item_uuid)."&menu_item_parent_uuid=".urlencode($row2['menu_item_parent_uuid']);
|
||||
}
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('menu_item_edit') || permission_exists('menu_item_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='menu_items[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='menu_items[$x][uuid]' value='".escape($menu_item_uuid)."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "<td class='no-wrap".($menu_item_category != 'internal' ? "no-link" : null)."' style='padding-left: ".($menu_item_level * 25)."px;'>\n";
|
||||
if (permission_exists('menu_item_edit')) {
|
||||
echo " <a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($menu_item_title)."</a>\n";
|
||||
}
|
||||
else {
|
||||
echo " ".escape($menu_item_title);
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<td class='no-wrap overflow no-link hide-sm-dn'>".$menu_item_link." </td>\n";
|
||||
echo "<td class='no-wrap overflow hide-xs'>".$group_list." </td>";
|
||||
echo "<td class='center'>".$menu_item_category." </td>";
|
||||
if (permission_exists('menu_item_edit')) {
|
||||
echo " <td class='no-link center'>\n";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.($menu_item_protected == 'true' ? 'true' : 'false')],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
||||
}
|
||||
else {
|
||||
echo " <td class='center'>\n";
|
||||
echo $text['label-'.($menu_item_protected == 'true' ? 'true' : 'false')];
|
||||
}
|
||||
if (permission_exists('menu_item_edit')) {
|
||||
$list_row_url = 'menu_item_edit.php?id='.urlencode($menu_uuid)."&menu_item_uuid=".urlencode($menu_item_uuid)."&menu_item_parent_uuid=".urlencode($row2['menu_item_parent_uuid']);
|
||||
}
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('menu_item_edit') || permission_exists('menu_item_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='menu_items[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='menu_items[$x][uuid]' value='".escape($menu_item_uuid)."' />\n";
|
||||
echo " </td>\n";
|
||||
echo "<td class='center no-wrap'> </td>";
|
||||
}
|
||||
echo "<td class='no-wrap".($menu_item_category != 'internal' ? "no-link" : null)."' style='padding-left: ".($menu_item_level * 25)."px;'>\n";
|
||||
if (permission_exists('menu_item_edit')) {
|
||||
echo " <a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($menu_item_title)."</a>\n";
|
||||
}
|
||||
else {
|
||||
echo " ".escape($menu_item_title);
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<td class='no-wrap overflow no-link hide-sm-dn'>".$menu_item_link." </td>\n";
|
||||
echo "<td class='no-wrap overflow hide-xs'>".$group_list." </td>";
|
||||
echo "<td class='center'>".$menu_item_category." </td>";
|
||||
if (permission_exists('menu_item_edit')) {
|
||||
echo " <td class='no-link center'>\n";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.($menu_item_protected == 'true' ? 'true' : 'false')],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
||||
}
|
||||
else {
|
||||
echo " <td class='center'>\n";
|
||||
echo $text['label-'.($menu_item_protected == 'true' ? 'true' : 'false')];
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "<td class='center no-wrap'> </td>";
|
||||
|
||||
//echo "<td align='center'>";
|
||||
//if (permission_exists('menu_edit')) {
|
||||
// echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_up.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."&menu_item_uuid=".$row2[menu_item_uuid]."&menu_item_order=".$row2[menu_item_order]."'\" value='<' title='".$row2[menu_item_order].". ".$text['button-move_up']."'>";
|
||||
// echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_down.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."&menu_item_uuid=".$row2[menu_item_uuid]."&menu_item_order=".$row2[menu_item_order]."'\" value='>' title='".$row2[menu_item_order].". ".$text['button-move_down']."'>";
|
||||
//}
|
||||
//echo "</td>";
|
||||
//echo "<td align='center'>";
|
||||
//if (permission_exists('menu_edit')) {
|
||||
// echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_up.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."&menu_item_uuid=".$row2[menu_item_uuid]."&menu_item_order=".$row2[menu_item_order]."'\" value='<' title='".$row2[menu_item_order].". ".$text['button-move_up']."'>";
|
||||
// echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_down.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."&menu_item_uuid=".$row2[menu_item_uuid]."&menu_item_order=".$row2[menu_item_order]."'\" value='>' title='".$row2[menu_item_order].". ".$text['button-move_down']."'>";
|
||||
//}
|
||||
//echo "</td>";
|
||||
|
||||
if (permission_exists('menu_item_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
$x++;
|
||||
if (permission_exists('menu_item_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
$x++;
|
||||
|
||||
//update the menu order
|
||||
if ($row2['menu_item_order'] != $tmp_menu_item_order) {
|
||||
$array['menu_items'][0]['menu_item_uuid'] = $row2['menu_item_uuid'];
|
||||
$array['menu_items'][0]['menu_uuid'] = $menu_uuid;
|
||||
$array['menu_items'][0]['menu_item_title'] = $row2['menu_item_title'];
|
||||
$array['menu_items'][0]['menu_item_order'] = $tmp_menu_item_order;
|
||||
$database = new database;
|
||||
$database->app_name = 'menu';
|
||||
$database->app_uuid = 'f4b3b3d2-6287-489c-2a00-64529e46f2d7';
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
}
|
||||
$tmp_menu_item_order++;
|
||||
if ($row2['menu_item_order'] != $tmp_menu_item_order) {
|
||||
$array['menu_items'][0]['menu_item_uuid'] = $row2['menu_item_uuid'];
|
||||
$array['menu_items'][0]['menu_uuid'] = $menu_uuid;
|
||||
$array['menu_items'][0]['menu_item_title'] = $row2['menu_item_title'];
|
||||
$array['menu_items'][0]['menu_item_order'] = $tmp_menu_item_order;
|
||||
$database = new database;
|
||||
$database->app_name = 'menu';
|
||||
$database->app_uuid = 'f4b3b3d2-6287-489c-2a00-64529e46f2d7';
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
}
|
||||
$tmp_menu_item_order++;
|
||||
|
||||
//check for additional sub menus
|
||||
if (strlen($menu_item_uuid)> 0) {
|
||||
build_db_child_menu_list($db, $menu_item_level, $menu_item_uuid);
|
||||
}
|
||||
|
||||
if (!empty($menu_item_uuid)) {
|
||||
build_db_child_menu_list($db, $menu_item_level, $menu_item_uuid);
|
||||
}
|
||||
}
|
||||
unset($result2, $row2);
|
||||
}
|
||||
}
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
}
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_menu_items ";
|
||||
@@ -262,7 +268,7 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid) {
|
||||
echo " <tr class='list-header'>";
|
||||
if (permission_exists('menu_item_edit') || permission_exists('menu_item_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($result ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".(!empty($result) ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo " <th class='no-wrap pct-30'>".$text['label-title']."</th>";
|
||||
@@ -271,12 +277,12 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid) {
|
||||
echo " <th class='no-wrap center shrink'>".$text['label-category']."</th>";
|
||||
echo " <th class='no-wrap center shrink'>".$text['label-protected']."</th>";
|
||||
echo " <th class='no-wrap center shrink'>".$text['label-menu_order']."</th>";
|
||||
if (permission_exists('menu_item_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('menu_item_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
if (!empty($result) && @sizeof($result) != 0) {
|
||||
$x = 0;
|
||||
foreach ($result as $row) {
|
||||
//set the db values as php variables
|
||||
@@ -305,9 +311,9 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid) {
|
||||
$sub_result = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $group_list);
|
||||
|
||||
if (is_array($sub_result) && sizeof($sub_result) != 0) {
|
||||
if (!empty($sub_result) && sizeof($sub_result) != 0) {
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
$group_list[] = $sub_row["group_name"].(($sub_row['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$sub_row['group_domain_uuid']]['domain_name'] : null);
|
||||
$group_list[] = $sub_row["group_name"].((!empty($sub_row['group_domain_uuid'])) ? "@".$_SESSION['domains'][$sub_row['group_domain_uuid']]['domain_name'] : null);
|
||||
}
|
||||
$group_list = implode(', ', $group_list);
|
||||
}
|
||||
@@ -369,7 +375,7 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid) {
|
||||
//}
|
||||
//echo "</td>";
|
||||
|
||||
if (permission_exists('menu_item_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('menu_item_edit') && $list_row_edit_button == 'true') {
|
||||
echo "<td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo "</td>\n";
|
||||
@@ -424,7 +430,7 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid) {
|
||||
echo " }\n";
|
||||
|
||||
//update number of menu items
|
||||
echo " document.getElementById('num_rows').innerHTML = '".($x ?: 0)."';\n";
|
||||
echo " document.getElementById('num_rows').innerHTML = '".(!empty($x) ?: 0)."';\n";
|
||||
|
||||
echo "</script>\n";
|
||||
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//set the include path
|
||||
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
|
||||
set_include_path(parse_ini_file($conf[0])['document.root']);
|
||||
|
||||
//includes files
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get the http value and set as a php variable
|
||||
$menu_uuid = $_REQUEST["menu_uuid"];
|
||||
|
||||
//unset the sesssion menu array
|
||||
unset($_SESSION['menu']['array']);
|
||||
|
||||
//get the menu array and save it to the session
|
||||
$menu = new menu;
|
||||
$menu->menu_uuid = $_SESSION['domain']['menu']['uuid'];
|
||||
$_SESSION['menu']['array'] = $menu->menu_array();
|
||||
unset($menu);
|
||||
|
||||
//redirect the user
|
||||
message::add($text['message-reload']);
|
||||
header("Location: ".PROJECT_PATH."/core/menu/menu_edit.php?id=".urlencode($menu_uuid));
|
||||
return;
|
||||
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//set the include path
|
||||
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
|
||||
set_include_path(parse_ini_file($conf[0])['document.root']);
|
||||
|
||||
//includes files
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get the http value and set as a php variable
|
||||
$menu_uuid = $_REQUEST["menu_uuid"];
|
||||
|
||||
//unset the sesssion menu array
|
||||
unset($_SESSION['menu']['array']);
|
||||
|
||||
//get the menu array and save it to the session
|
||||
$menu = new menu;
|
||||
$menu->menu_uuid = $_SESSION['domain']['menu']['uuid'];
|
||||
$_SESSION['menu']['array'] = $menu->menu_array();
|
||||
unset($menu);
|
||||
|
||||
//redirect the user
|
||||
//message::add($text['message-reload']);
|
||||
header("Location: ".PROJECT_PATH."/core/menu/menu_edit.php?id=".urlencode($menu_uuid));
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
//check permissions
|
||||
if (!$included) {
|
||||
if(!defined('STDIN')) {
|
||||
//set the include path
|
||||
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
|
||||
set_include_path(parse_ini_file($conf[0])['document.root']);
|
||||
@@ -47,13 +47,15 @@
|
||||
$text = $language->get();
|
||||
|
||||
//get the http value and set as a php variable
|
||||
if (!$included) {
|
||||
if (!empty($_REQUEST["menu_uuid"])) {
|
||||
$menu_uuid = $_REQUEST["menu_uuid"];
|
||||
}
|
||||
if (!empty($_REQUEST["menu_language"])) {
|
||||
$menu_language = $_REQUEST["menu_language"];
|
||||
}
|
||||
|
||||
//menu restore default
|
||||
require_once "resources/classes/menu.php";
|
||||
//require_once "resources/classes/menu.php";
|
||||
$menu = new menu;
|
||||
$menu->menu_uuid = $menu_uuid;
|
||||
$menu->menu_language = $menu_language;
|
||||
@@ -68,7 +70,7 @@
|
||||
unset($menu);
|
||||
|
||||
//redirect
|
||||
if (!$included) {
|
||||
if(!defined('STDIN')) {
|
||||
//show a message to the user
|
||||
message::add($text['message-restore']);
|
||||
header("Location: ".PROJECT_PATH."/core/menu/menu_edit.php?id=".urlencode($menu_uuid));
|
||||
|
||||
Reference in New Issue
Block a user