menu_item_protected deprecated

This protected feature has not been working correctly. At the moment commented out depending on feedback it maybe removed entirely.
This commit is contained in:
FusionPBX
2025-05-28 19:37:58 -06:00
committed by GitHub
parent ec613ab18d
commit b96b5f8c0f
5 changed files with 94 additions and 90 deletions

View File

@@ -193,10 +193,10 @@
$apps[$x]['db'][$y]['fields'][$z]['search'] = "true";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "menu_item_protected";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
//$apps[$x]['db'][$y]['fields'][$z]['name'] = "menu_item_protected";
//$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
//$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
//$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "menu_item_order";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";

View File

@@ -53,7 +53,7 @@
$menu_item_icon = '';
$menu_item_icon_color = '';
$menu_item_description = '';
$menu_item_protected = '';
//$menu_item_protected = '';
$menu_item_parent_uuid = null;
$menu_item_order = null;
@@ -105,7 +105,7 @@
$menu_item_icon = $_POST["menu_item_icon"] ?? '';
$menu_item_icon_color = $_POST["menu_item_icon_color"] ?? '';
$menu_item_description = $_POST["menu_item_description"] ?? '';
$menu_item_protected = $_POST["menu_item_protected"] ?? '';
//$menu_item_protected = $_POST["menu_item_protected"] ?? '';
$menu_item_parent_uuid = $_POST["menu_item_parent_uuid"] ?? null;
$menu_item_order = $_POST["menu_item_order"] ?? '';
}
@@ -177,7 +177,7 @@
$array['menu_items'][0]['menu_item_icon'] = $menu_item_icon;
$array['menu_items'][0]['menu_item_icon_color'] = $menu_item_icon_color;
$array['menu_items'][0]['menu_item_description'] = $menu_item_description;
$array['menu_items'][0]['menu_item_protected'] = $menu_item_protected;
//$array['menu_items'][0]['menu_item_protected'] = $menu_item_protected;
$array['menu_items'][0]['menu_item_uuid'] = $menu_item_uuid;
if (!is_uuid($menu_item_parent_uuid)) {
$array['menu_items'][0]['menu_item_parent_uuid'] = null;
@@ -203,7 +203,7 @@
$array['menu_items'][0]['menu_item_icon'] = $menu_item_icon;
$array['menu_items'][0]['menu_item_icon_color'] = $menu_item_icon_color;
$array['menu_items'][0]['menu_item_description'] = $menu_item_description;
$array['menu_items'][0]['menu_item_protected'] = $menu_item_protected;
//$array['menu_items'][0]['menu_item_protected'] = $menu_item_protected;
$array['menu_items'][0]['menu_item_uuid'] = $menu_item_uuid;
if (!is_uuid($menu_item_parent_uuid)) {
$array['menu_items'][0]['menu_item_parent_uuid'] = null;
@@ -221,13 +221,13 @@
}
//update child menu items to protected true or false
$sql = "update v_menu_items ";
$sql .= "set menu_item_protected = :menu_item_protected ";
$sql .= "where menu_item_parent_uuid = :menu_item_parent_uuid ";
$parameters['menu_item_parent_uuid'] = $menu_item_uuid;
$parameters['menu_item_protected'] = $menu_item_protected;
$database->execute($sql, $parameters);
unset($parameters);
//$sql = "update v_menu_items ";
//$sql .= "set menu_item_protected = :menu_item_protected ";
//$sql .= "where menu_item_parent_uuid = :menu_item_parent_uuid ";
//$parameters['menu_item_parent_uuid'] = $menu_item_uuid;
//$parameters['menu_item_protected'] = $menu_item_protected;
//$database->execute($sql, $parameters);
//unset($parameters);
//add a group to the menu
if (!empty($group_uuid_name) && permission_exists('menu_add')) {
@@ -319,7 +319,7 @@
$menu_item_icon = $row["menu_item_icon"];
$menu_item_icon_color = $row["menu_item_icon_color"];
$menu_item_description = $row["menu_item_description"];
$menu_item_protected = $row["menu_item_protected"];
//$menu_item_protected = $row["menu_item_protected"];
$menu_item_parent_uuid = $row["menu_item_parent_uuid"];
$menu_item_order = $row["menu_item_order"];
$menu_item_add_user = $row["menu_item_add_user"];
@@ -535,29 +535,29 @@
echo " </td>";
echo " </tr>";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-protected']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='menu_item_protected'>\n";
if ($menu_item_protected == "false") {
echo " <option value='false' selected='selected' >".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
if ($menu_item_protected == "true") {
echo " <option value='true' selected='selected' >".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
echo " </select><br />\n";
echo $text['description-protected']."<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td class='vncell' valign='top' align='left' nowrap>\n";
//echo " ".$text['label-protected']."\n";
//echo "</td>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <select class='formfld' name='menu_item_protected'>\n";
//if ($menu_item_protected == "false") {
// echo " <option value='false' selected='selected' >".$text['label-false']."</option>\n";
//}
//else {
// echo " <option value='false'>".$text['label-false']."</option>\n";
//}
//if ($menu_item_protected == "true") {
// echo " <option value='true' selected='selected' >".$text['label-true']."</option>\n";
//}
//else {
// echo " <option value='true'>".$text['label-true']."</option>\n";
//}
//echo " </select><br />\n";
//echo $text['description-protected']."<br />\n";
//echo "\n";
//echo "</td>\n";
//echo "</tr>\n";
if (!empty($action) && $action == "update") {
if (empty($menu_item_parent_uuid)) {

View File

@@ -111,7 +111,7 @@
//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_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'];
@@ -187,15 +187,15 @@
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";
//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'>";
@@ -313,7 +313,7 @@
echo " <th class='no-wrap pct-35 hide-sm-dn'>".$text['label-link']."</th>";
echo " <th class='no-wrap pct-35 hide-xs'>".$text['label-groups']."</th>";
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-protected']."</th>";
echo " <th class='no-wrap center shrink'>".$text['label-menu_order']."</th>";
if (permission_exists('menu_item_edit') && $list_row_edit_button) {
echo " <td class='action-button'>&nbsp;</td>\n";
@@ -330,7 +330,7 @@
$menu_item_link = $row['menu_item_link'];
$menu_item_icon = $row['menu_item_icon'];
$menu_item_icon_color = $row['menu_item_icon_color'];
$menu_item_protected = $row['menu_item_protected'];
//$menu_item_protected = $row['menu_item_protected'];
//get the groups that have been assigned to the menu
$sql = "select ";
@@ -399,15 +399,15 @@
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>\n";
echo "<td class='center'>".$menu_item_category."&nbsp;</td>\n";
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";
//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'>".$row['menu_item_order']."&nbsp;</td>\n";
//echo "<td align='center' nowrap>";

View File

@@ -54,7 +54,7 @@
$menu = new menu;
$menu->menu_uuid = $menu_uuid;
$menu->menu_language = $menu_language;
$menu->delete_unprotected();
$menu->delete();
$menu->restore();
unset($menu);