Menu: PHP 8.1 updates

This commit is contained in:
markjcrane
2023-05-27 12:00:02 -06:00
parent 283ed042f2
commit c679165016
5 changed files with 299 additions and 270 deletions

View File

@@ -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>";

View File

@@ -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."&nbsp;</td>\n";
echo "<td class='no-wrap overflow hide-xs'>".$group_list."&nbsp;</td>";
echo "<td class='center'>".$menu_item_category."&nbsp;</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'>&nbsp;</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."&nbsp;</td>\n";
echo "<td class='no-wrap overflow hide-xs'>".$group_list."&nbsp;</td>";
echo "<td class='center'>".$menu_item_category."&nbsp;</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'>&nbsp;</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'>&nbsp;</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";

View File

@@ -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;
?>

View File

@@ -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));

View File

@@ -86,7 +86,7 @@ if (!class_exists('menu')) {
//build the delete array
$x = 0;
foreach ($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
//remove menu languages
$array['menu_languages'][$x][$this->name.'_uuid'] = $record['uuid'];
@@ -156,7 +156,7 @@ if (!class_exists('menu')) {
//build the delete array
$x = 0;
foreach ($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
//build array
$uuids[] = "'".$record['uuid']."'";
//remove menu languages
@@ -171,12 +171,12 @@ if (!class_exists('menu')) {
}
//include child menu items
if (is_array($uuids) && @sizeof($uuids) != 0) {
if (!empty($uuids) && @sizeof($uuids) != 0) {
$sql = "select menu_item_uuid as uuid from v_".$this->table." ";
$sql .= "where menu_item_parent_uuid in (".implode(', ', $uuids).") ";
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$rows = $database->select($sql, null, 'all');
if (!empty($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
//remove menu languages
$array['menu_languages'][$x][$this->name.'_uuid'] = $row['uuid'];
@@ -240,12 +240,12 @@ if (!class_exists('menu')) {
header('Location: '.$this->location);
exit;
}
https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805e327
//toggle the checked records
if (is_array($records) && @sizeof($records) != 0) {
//get current toggle state
foreach ($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'";
}
}
@@ -253,6 +253,7 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
$database = new database;
$parameters = null;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
@@ -912,7 +913,7 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
public function menu_horizontal($menu_array) {
//determine menu behavior
$menu_style = $_SESSION['theme']['menu_style']['text'] != '' ? $_SESSION['theme']['menu_style']['text'] : 'fixed';
$menu_style = !empty($_SESSION['theme']['menu_style']['text']) ? $_SESSION['theme']['menu_style']['text'] : 'fixed';
switch ($menu_style) {
case 'inline':
$menu_type = 'default';
@@ -949,10 +950,10 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
$html .= " <a class='navbar-brand-text' href='".PROJECT_PATH."/'>".$menu_brand_text."</a>\n";
break;
case 'image_text':
$menu_brand_image = ($_SESSION['theme']['menu_brand_image']['text'] != '') ? escape($_SESSION['theme']['menu_brand_image']['text']) : PROJECT_PATH."/themes/default/images/logo.png";
$menu_brand_image = (!empty($_SESSION['theme']['menu_brand_image']['text'])) ? escape($_SESSION['theme']['menu_brand_image']['text']) : PROJECT_PATH."/themes/default/images/logo.png";
$html .= " <a href='".PROJECT_PATH."/'>";
$html .= " <img id='menu_brand_image' class='navbar-logo' src='".$menu_brand_image."' title=\"".escape($menu_brand_text)."\">";
if ($_SESSION['theme']['menu_brand_image_hover']['text'] != '') {
if (!empty($_SESSION['theme']['menu_brand_image_hover']['text'])) {
$html .= "<img id='menu_brand_image_hover' class='navbar-logo' style='display: none;' src='".$_SESSION['theme']['menu_brand_image_hover']['text']."' title=\"".escape($menu_brand_text)."\">";
}
$html .= "</a>\n";
@@ -965,7 +966,7 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
$menu_brand_image = !empty($_SESSION['theme']['menu_brand_image']['text']) ? escape($_SESSION['theme']['menu_brand_image']['text']) : PROJECT_PATH."/themes/default/images/logo.png";
$html .= " <a href='".PROJECT_PATH."/'>";
$html .= " <img id='menu_brand_image' class='navbar-logo' src='".$menu_brand_image."' title=\"".escape($menu_brand_text)."\">";
if (isset($_SESSION['theme']['menu_brand_image_hover']['text']) && $_SESSION['theme']['menu_brand_image_hover']['text'] != '') {
if (isset($_SESSION['theme']['menu_brand_image_hover']['text']) && !empty($_SESSION['theme']['menu_brand_image_hover']['text'])) {
$html .= "<img id='menu_brand_image_hover' class='navbar-logo' style='display: none;' src='".$_SESSION['theme']['menu_brand_image_hover']['text']."' title=\"".escape($menu_brand_text)."\">";
}
$html .= "</a>\n";
@@ -982,20 +983,20 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
$html .= " <div class='collapse navbar-collapse' id='main_navbar'>\n";
$html .= " <ul class='navbar-nav'>\n";
if (is_array($menu_array) && sizeof($menu_array) != 0) {
if (!empty($menu_array) && sizeof($menu_array) != 0) {
foreach ($menu_array as $index_main => $menu_parent) {
$mod_li = "nav-item";
$mod_a_1 = "";
$submenu = false;
if (is_array($menu_parent['menu_items']) && sizeof($menu_parent['menu_items']) > 0) {
if (!empty($menu_parent['menu_items']) && sizeof($menu_parent['menu_items']) > 0) {
$mod_li = "nav-item dropdown ";
$mod_a_1 = "data-toggle='dropdown' ";
$submenu = true;
}
$mod_a_2 = ($menu_parent['menu_item_link'] != '' && !$submenu) ? $menu_parent['menu_item_link'] : '#';
$mod_a_2 = (!empty($menu_parent['menu_item_link']) && !$submenu) ? $menu_parent['menu_item_link'] : '#';
$mod_a_3 = ($menu_parent['menu_item_category'] == 'external') ? "target='_blank' " : null;
if (isset($_SESSION['theme']['menu_main_icons']['boolean']) && $_SESSION['theme']['menu_main_icons']['boolean'] == 'true') {
if ($menu_parent['menu_item_icon'] != '' && substr_count($menu_parent['menu_item_icon'], 'fa-') > 0) {
if (!empty($menu_parent['menu_item_icon']) && substr_count($menu_parent['menu_item_icon'], 'fa-') > 0) {
$menu_main_icon = "<span class='fas ".$menu_parent['menu_item_icon']."' title=\"".escape($menu_parent['menu_language_title'])."\"></span>\n";
}
else {
@@ -1020,7 +1021,7 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
$mod_a_3 = ($menu_sub['menu_item_category'] == 'external') ? "target='_blank' " : null;
$menu_sub_icon = null;
if ($_SESSION['theme']['menu_sub_icons']['boolean'] != 'false') {
if ($menu_sub['menu_item_icon'] != '' && substr_count($menu_sub['menu_item_icon'], 'fa-') > 0) {
if (!empty($menu_sub['menu_item_icon']) && substr_count($menu_sub['menu_item_icon'], 'fa-') > 0) {
$menu_sub_icon = "<span class='fas ".escape($menu_sub['menu_item_icon'])."'></span>";
}
else {
@@ -1040,17 +1041,17 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
//current user
if (isset($_SESSION['theme']['user_visible']['text']) && $_SESSION['theme']['user_visible']['text'] == 'true') {
$html .= " <li class='nav-item'>\n";
$html .= " <a class='header_user' href='".PROJECT_PATH."/core/users/user_edit.php?id=user' title=\"".$this->text['theme-label-user']."\"><i class='fas fa-".($_SESSION['theme']['body_header_icon_user']['text'] != '' ? $_SESSION['theme']['body_header_icon_user']['text'] : 'user-circle')." fa-lg fa-fw' style='margin-top: 6px; margin-right: 5px;'></i>".$_SESSION['username']."</a>";
$html .= " <a class='header_user' href='".PROJECT_PATH."/core/users/user_edit.php?id=user' title=\"".$this->text['theme-label-user']."\"><i class='fas fa-".(!empty($_SESSION['theme']['body_header_icon_user']['text']) ? $_SESSION['theme']['body_header_icon_user']['text'] : 'user-circle')." fa-lg fa-fw' style='margin-top: 6px; margin-right: 5px;'></i>".$_SESSION['username']."</a>";
$html .= " </li>\n";
}
//domain name/selector
if (isset($_SESSION['username']) && $_SESSION['username'] != '' && permission_exists('domain_select') && count($_SESSION['domains']) > 1 && $_SESSION['theme']['domain_visible']['text'] == 'true') {
if (!empty($_SESSION['username']) && permission_exists('domain_select') && count($_SESSION['domains']) > 1 && $_SESSION['theme']['domain_visible']['text'] == 'true') {
$html .= " <li class='nav-item'>\n";
$html .= " <a class='header_domain' href='#' id='header_domain_selector_domain' title='".$this->text['theme-label-open_selector']."'><i class='fas fa-".($_SESSION['theme']['body_header_icon_domain']['text'] != '' ? $_SESSION['theme']['body_header_icon_domain']['text'] : 'globe-americas')." fa-lg fa-fw' style='margin-top: 6px; margin-right: 5px;'></i>".escape($_SESSION['domain_name'])."</a>";
$html .= " <a class='header_domain' href='#' id='header_domain_selector_domain' title='".$this->text['theme-label-open_selector']."'><i class='fas fa-".(!empty($_SESSION['theme']['body_header_icon_domain']['text']) ? $_SESSION['theme']['body_header_icon_domain']['text'] : 'globe-americas')." fa-lg fa-fw' style='margin-top: 6px; margin-right: 5px;'></i>".escape($_SESSION['domain_name'])."</a>";
$html .= " </li>\n";
}
//logout icon
if (isset($_SESSION['username']) && $_SESSION['username'] != '' && isset($_SESSION['theme']['logout_icon_visible']) && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
if (!empty($_SESSION['username']) && isset($_SESSION['theme']['logout_icon_visible']) && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
$username_full = $_SESSION['username'].((count($_SESSION['domains']) > 1) ? "@".$_SESSION["user_context"] : null);
$html .= " <li class='nav-item'>\n";
$html .= " <a class='logout_icon' href='#' title=\"".$this->text['theme-label-logout']."\" onclick=\"modal_open('modal-logout','btn_logout');\"><span class='fas fa-sign-out-alt'></span></a>";
@@ -1064,7 +1065,7 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
$html .= "</nav>\n";
//modal for logout icon (above)
if (isset($_SESSION['username']) && $_SESSION['username'] != '' && isset($_SESSION['theme']['logout_icon_visible']) && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
if (!empty($_SESSION['username']) && isset($_SESSION['theme']['logout_icon_visible']) && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
$html .= modal::create(['id'=>'modal-logout','type'=>'general','message'=>$this->text['theme-confirm-logout'],'actions'=>button::create(['type'=>'button','label'=>$this->text['theme-label-logout'],'icon'=>'sign-out-alt','id'=>'btn_logout','style'=>'float: right; margin-left: 15px;','collapse'=>'never','link'=>PROJECT_PATH.'/logout.php','onclick'=>"modal_close();"])]);
}
@@ -1092,13 +1093,13 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
if ($_SESSION['theme']['menu_brand_type']['text'] == 'none') {
$html .= " <a class='menu_side_item_main menu_side_contract' onclick='menu_side_contract();' style='".($_SESSION['theme']['menu_side_pin']['boolean'] == 'true' ? "max-width: calc(100% - 50px);" : null)." ".($_SESSION['theme']['menu_side_state']['text'] != 'expanded' ? "display: none;" : null)."' title=\"".$this->text['theme-label-contract_menu']."\"><i class='fas fa-bars fa-fw' style='z-index: 99800; padding-left: 1px;'></i></a>";
}
$menu_brand_text = $_SESSION['theme']['menu_brand_text']['text'] != '' ? escape($_SESSION['theme']['menu_brand_text']['text']) : "FusionPBX";
$menu_brand_text = !empty($_SESSION['theme']['menu_brand_text']['text']) ? escape($_SESSION['theme']['menu_brand_text']['text']) : "FusionPBX";
if ($_SESSION['theme']['menu_brand_type']['text'] == 'text') {
$html .= " <a class='menu_brand_text' ".($_SESSION['theme']['menu_side_state']['text'] != 'expanded' ? "style='display: none;'" : null)." href='".PROJECT_PATH."/'>".$menu_brand_text."</a>\n";
}
if ($_SESSION['theme']['menu_brand_type']['text'] == 'image' || $_SESSION['theme']['menu_brand_type']['text'] == 'image_text' || $_SESSION['theme']['menu_brand_type']['text'] == '') {
$menu_brand_image_contracted = $_SESSION['theme']['menu_side_brand_image_contracted']['text'] != '' ? $_SESSION['theme']['menu_side_brand_image_contracted']['text'] : PROJECT_PATH."/themes/default/images/logo_side_contracted.png";
$menu_brand_image_expanded = $_SESSION['theme']['menu_side_brand_image_expanded']['text'] != '' ? $_SESSION['theme']['menu_side_brand_image_expanded']['text'] : PROJECT_PATH."/themes/default/images/logo_side_expanded.png";
$menu_brand_image_contracted = !empty($_SESSION['theme']['menu_side_brand_image_contracted']['text']) ? $_SESSION['theme']['menu_side_brand_image_contracted']['text'] : PROJECT_PATH."/themes/default/images/logo_side_contracted.png";
$menu_brand_image_expanded = !empty($_SESSION['theme']['menu_side_brand_image_expanded']['text']) ? $_SESSION['theme']['menu_side_brand_image_expanded']['text'] : PROJECT_PATH."/themes/default/images/logo_side_expanded.png";
$html .= " <a class='menu_brand_image' href='".PROJECT_PATH."/'>";
$html .= "<img id='menu_brand_image_contracted' style='".($_SESSION['theme']['menu_side_state']['text'] == 'expanded' ? "display: none;" : null)."' src='".escape($menu_brand_image_contracted)."' title=\"".escape($menu_brand_text)."\">";
$html .= "<img id='menu_brand_image_expanded' ".($_SESSION['theme']['menu_side_state']['text'] != 'expanded' ? "style='display: none;'" : null)." src='".escape($menu_brand_image_expanded)."' title=\"".escape($menu_brand_text)."\">";
@@ -1109,14 +1110,14 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
// }
$html .= " </div>\n";
//main menu items
if (is_array($menu_array) && sizeof($menu_array) != 0) {
if (!empty($menu_array)) {
foreach ($menu_array as $menu_index_main => $menu_item_main) {
$menu_target = ($menu_item_main['menu_item_category'] == 'external') ? '_blank' : '';
$html .= " <a class='menu_side_item_main' ".($menu_item_main['menu_item_link'] != '' ? "href='".$menu_item_main['menu_item_link']."' target='".$menu_target."'" : "onclick=\"menu_side_expand(); menu_side_item_toggle('".$menu_item_main['menu_item_uuid']."');\"")." title=\"".$menu_item_main['menu_language_title']."\">";
$html .= " <a class='menu_side_item_main' ".(!empty($menu_item_main['menu_item_link']) ? "href='".$menu_item_main['menu_item_link']."' target='".$menu_target."'" : "onclick=\"menu_side_expand(); menu_side_item_toggle('".$menu_item_main['menu_item_uuid']."');\"")." title=\"".$menu_item_main['menu_language_title']."\">";
if (is_array($menu_item_main['menu_items']) && sizeof($menu_item_main['menu_items']) != 0 && $_SESSION['theme']['menu_side_item_main_sub_icons']['boolean'] == 'true') {
$html .= " <div class='menu_side_item_main_sub_icons' style='float: right; margin-right: -1px; ".($_SESSION['theme']['menu_side_state']['text'] != 'expanded' ? "display: none;" : null)."'><i id='sub_arrow_".$menu_item_main['menu_item_uuid']."' class='sub_arrows fas fa-".($_SESSION['theme']['menu_side_item_main_sub_icon_expand']['text'] != '' ? $_SESSION['theme']['menu_side_item_main_sub_icon_expand']['text'] : 'chevron-down')." fa-xs'></i></div>\n";
$html .= " <div class='menu_side_item_main_sub_icons' style='float: right; margin-right: -1px; ".($_SESSION['theme']['menu_side_state']['text'] != 'expanded' ? "display: none;" : null)."'><i id='sub_arrow_".$menu_item_main['menu_item_uuid']."' class='sub_arrows fas fa-".(!empty($_SESSION['theme']['menu_side_item_main_sub_icon_expand']['text']) ? $_SESSION['theme']['menu_side_item_main_sub_icon_expand']['text'] : 'chevron-down')." fa-xs'></i></div>\n";
}
if ($menu_item_main['menu_item_icon'] != '') {
if (!empty($menu_item_main['menu_item_icon'])) {
$html .= "<i class='menu_side_item_icon fas ".$menu_item_main['menu_item_icon']." fa-fw' style='z-index: 99800; margin-right: 8px;'></i>";
}
$html .= "<span class='menu_side_item_title' ".($_SESSION['theme']['menu_side_state']['text'] != 'expanded' ? "style='display: none;'" : null).">".$menu_item_main['menu_language_title']."</span>";
@@ -1143,9 +1144,9 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
//header: left
$html .= "<div class='float-left'>\n";
$html .= button::create(['type'=>'button','id'=>'menu_side_state_hidden_button','title'=>$this->text['theme-label-expand_menu'],'icon'=>'bars','class'=>'default '.($_SESSION['theme']['menu_side_state']['text'] != 'hidden' ? 'hide-sm-up ' : null).'float-left','onclick'=>'menu_side_expand();']);
$body_header_brand_text = $_SESSION['theme']['body_header_brand_text']['text'] != '' ? escape($_SESSION['theme']['body_header_brand_text']['text']) : "FusionPBX";
$body_header_brand_text = !empty($_SESSION['theme']['body_header_brand_text']['text']) ? escape($_SESSION['theme']['body_header_brand_text']['text']) : "FusionPBX";
if ($_SESSION['theme']['body_header_brand_type']['text'] == 'image' || $_SESSION['theme']['body_header_brand_type']['text'] == 'image_text') {
$body_header_brand_image = $_SESSION['theme']['body_header_brand_image']['text'] != '' ? $_SESSION['theme']['body_header_brand_image']['text'] : PROJECT_PATH."/themes/default/images/logo_side_expanded.png";
$body_header_brand_image = !empty($_SESSION['theme']['body_header_brand_image']['text']) ? $_SESSION['theme']['body_header_brand_image']['text'] : PROJECT_PATH."/themes/default/images/logo_side_expanded.png";
$html .= "<div id='body_header_brand_image'>";
$html .= "<a href='".PROJECT_PATH."/'><img id='body_header_brand_image' src='".escape($body_header_brand_image)."' title=\"".escape($body_header_brand_text)."\"></a>";
$html .= "</div>";
@@ -1161,20 +1162,20 @@ https://www.fusionpbx.com/app/pages/page.php?id=f48cceb2-5e31-47c2-a84a-8f45d805
$html .= " <a href='".PROJECT_PATH."/core/users/user_edit.php?id=user' title=\"".$this->text['theme-label-user']."\"><i class='fas fa-".($_SESSION['theme']['body_header_icon_user']['text'] != '' ? $_SESSION['theme']['body_header_icon_user']['text'] : 'user-circle')." fa-lg fa-fw' style='margin-top: 6px; margin-right: 5px;'></i>".$_SESSION['username']."</a>";
$html .= "</span>\n";
//domain name/selector (sm+)
if (isset($_SESSION['username']) && $_SESSION['username'] != '' && permission_exists('domain_select') && count($_SESSION['domains']) > 1 && $_SESSION['theme']['domain_visible']['text'] == 'true') {
if (!empty($_SESSION['username']) && permission_exists('domain_select') && count($_SESSION['domains']) > 1 && $_SESSION['theme']['domain_visible']['text'] == 'true') {
$html .= "<span style='display: inline-block; padding-right: 10px; font-size: 90%;'>\n";
$html .= " <a href='#' id='header_domain_selector_domain' title='".$this->text['theme-label-open_selector']."'><i class='fas fa-".($_SESSION['theme']['body_header_icon_domain']['text'] != '' ? $_SESSION['theme']['body_header_icon_domain']['text'] : 'globe-americas')." fa-lg fa-fw' style='margin-top: 6px; margin-right: 5px;'></i>".escape($_SESSION['domain_name'])."</a>";
$html .= "</span>\n";
}
//logout icon
if (isset($_SESSION['username']) && $_SESSION['username'] != '' && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
if (!empty($_SESSION['username']) && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
$html .= "<a id='header_logout_icon' href='#' title=\"".$this->text['theme-label-logout']."\" onclick=\"modal_open('modal-logout','btn_logout');\"><span class='fas fa-sign-out-alt'></span></a>";
}
$html .= "</div>";
$html .= " </div>\n";
//modal for logout icon (above)
if (isset($_SESSION['username']) && $_SESSION['username'] != '' && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
if (!empty($_SESSION['username']) && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
$html .= modal::create(['id'=>'modal-logout','type'=>'general','message'=>$this->text['theme-confirm-logout'],'actions'=>button::create(['type'=>'button','label'=>$this->text['theme-label-logout'],'icon'=>'sign-out-alt','id'=>'btn_logout','style'=>'float: right; margin-left: 15px;','collapse'=>'never','link'=>PROJECT_PATH.'/logout.php','onclick'=>"modal_close();"])]);
}