Add a missing file sip_profile_copy.php to the dev branch.
This commit is contained in:
@@ -0,0 +1,232 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = "Menu Manager";
|
||||
$apps[$x]['uuid'] = 'f4b3b3d2-6287-489c-2a00-64529e46f2d7';
|
||||
$apps[$x]['category'] = 'Core';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'The menu can be customized using this tool.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Menu Manager';
|
||||
$apps[$x]['menu'][0]['uuid'] = 'da3a9ab4-c28e-ea8d-50cc-e8405ac8e76e';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '02194288-6d56-6d3e-0b1a-d53a2bc10788';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
//$apps[$x]['menu'][0]['path'] = '/core/menu/menu_list.php';
|
||||
$apps[$x]['menu'][0]['path'] = '/core/menu/menu.php';
|
||||
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][1]['title']['en'] = 'System';
|
||||
$apps[$x]['menu'][1]['uuid'] = '02194288-6d56-6d3e-0b1a-d53a2bc10788';
|
||||
$apps[$x]['menu'][1]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][1]['category'] = 'internal';
|
||||
$apps[$x]['menu'][1]['path'] = '/index2.php';
|
||||
$apps[$x]['menu'][1]['order'] = '5';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'user';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][2]['title']['en'] = 'Accounts';
|
||||
$apps[$x]['menu'][2]['uuid'] = 'bc96d773-ee57-0cdd-c3ac-2d91aba61b55';
|
||||
$apps[$x]['menu'][2]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][2]['category'] = 'internal';
|
||||
$apps[$x]['menu'][2]['path'] = '/app/extensions/v_extensions.php';
|
||||
$apps[$x]['menu'][2]['order'] = '10';
|
||||
$apps[$x]['menu'][2]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][2]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][3]['title']['en'] = 'Dialplan2';
|
||||
$apps[$x]['menu'][3]['uuid'] = 'b94e8bd9-9eb5-e427-9c26-ff7a6c21552a';
|
||||
$apps[$x]['menu'][3]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][3]['category'] = 'internal';
|
||||
$apps[$x]['menu'][3]['path'] = '/app/dialplan/dialplans.php';
|
||||
$apps[$x]['menu'][3]['order'] = '15';
|
||||
$apps[$x]['menu'][3]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][3]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][4]['title']['en'] = 'Status';
|
||||
$apps[$x]['menu'][4]['uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
|
||||
$apps[$x]['menu'][4]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][4]['category'] = 'internal';
|
||||
$apps[$x]['menu'][4]['path'] = '/app/calls_active/v_calls_active_extensions.php';
|
||||
$apps[$x]['menu'][4]['order'] = '25';
|
||||
$apps[$x]['menu'][4]['groups'][] = 'user';
|
||||
$apps[$x]['menu'][4]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][4]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][5]['title']['en'] = 'Advanced';
|
||||
$apps[$x]['menu'][5]['uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][5]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][5]['category'] = 'internal';
|
||||
$apps[$x]['menu'][5]['path'] = '/app/exec/v_exec.php';
|
||||
$apps[$x]['menu'][5]['order'] = '30';
|
||||
$apps[$x]['menu'][5]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = 'menu_view';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][1]['name'] = 'menu_add';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][2]['name'] = 'menu_edit';
|
||||
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][3]['name'] = 'menu_delete';
|
||||
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][4]['name'] = 'menu_restore';
|
||||
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_menus';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the name of the menu.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_language';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the language.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_desc';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the description.';
|
||||
$z++;
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_menu_items';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_item_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_menus';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'menu_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_item_parent_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_parent_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_title';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_item_link';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_str';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_category';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$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'] = '';
|
||||
$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'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_item_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_desc';
|
||||
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_add_user';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_add_date';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_mod_user';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_mod_date';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
$y = 2; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_menu_item_groups';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_group_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_menus';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'menu_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_item_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_menu_items';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'menu_item_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,118 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//if there are no items in the menu then add the default menu
|
||||
$sql = "SELECT count(*) as count FROM v_menus ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
unset ($prep_statement);
|
||||
if ($sub_result['count'] > 0) {
|
||||
if ($display_type == "text") {
|
||||
echo " Menu: no change\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
//create the uuid
|
||||
$menu_uuid = 'b4750c3f-2a86-b00d-b7d0-345c14eca286';
|
||||
//set the defaults
|
||||
$menu_name = 'default';
|
||||
$menu_language = 'en';
|
||||
$menu_description = '';
|
||||
//add the menu
|
||||
$sql = "insert into v_menus ";
|
||||
$sql .= "(";
|
||||
$sql .= "menu_uuid, ";
|
||||
$sql .= "menu_name, ";
|
||||
$sql .= "menu_language, ";
|
||||
$sql .= "menu_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$menu_uuid."', ";
|
||||
$sql .= "'$menu_name', ";
|
||||
$sql .= "'$menu_language', ";
|
||||
$sql .= "'$menu_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//add the menu items
|
||||
require_once "includes/classes/menu.php";
|
||||
$menu = new menu;
|
||||
$menu->db = $db;
|
||||
$menu->menu_uuid = $menu_uuid;
|
||||
$menu->restore();
|
||||
unset($menu);
|
||||
if ($display_type == "text") {
|
||||
echo " Menu: added\n";
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $sub_result);
|
||||
|
||||
//if there are no groups listed in v_menu_item_groups then add the default groups
|
||||
$sql = "SELECT * FROM v_menus ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
foreach($result as $field) {
|
||||
//get the menu_uuid
|
||||
$menu_uuid = $field['menu_uuid'];
|
||||
//check each menu to see if there are items in the menu assigned to it
|
||||
$sql = "";
|
||||
$sql .= "select count(*) as count from v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
unset ($prep_statement);
|
||||
if ($sub_result['count'] == 0) {
|
||||
//no menu item groups found add the defaults
|
||||
foreach($apps as $app) {
|
||||
foreach ($app['menu'] as $sub_row) {
|
||||
foreach ($sub_row['groups'] as $group) {
|
||||
//add the record
|
||||
$sql = "insert into v_menu_item_groups ";
|
||||
$sql .= "(";
|
||||
$sql .= "menu_uuid, ";
|
||||
$sql .= "menu_item_uuid, ";
|
||||
$sql .= "group_name ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$menu_uuid', ";
|
||||
$sql .= "'".$sub_row['uuid']."', ";
|
||||
$sql .= "'".$group."' ";
|
||||
$sql .= ")";
|
||||
$db->exec($sql);
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,152 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>Menu Manager</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " Used to customize one or more menus.<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = " select count(*) as num_rows from v_menus ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 150;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = " select * from v_menus ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('menu_name', 'Name', $order_by, $order);
|
||||
echo th_order_by('menu_language', 'Language', $order_by, $order);
|
||||
echo th_order_by('menu_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='menu_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['menu_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['menu_language']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['menu_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
echo " <a href='menu_edit.php?id=".$row['menu_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='menu_delete.php?id=".$row['menu_uuid']."&menu_uuid=".$row['menu_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='5' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='menu_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
$menu_uuid = check_str($_GET["menu_uuid"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
//start the database transaction
|
||||
$db->beginTransaction();
|
||||
|
||||
//delete the menu
|
||||
$sql = "";
|
||||
$sql .= "delete from v_menus ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
|
||||
//delete the items in the menu
|
||||
$sql = "";
|
||||
$sql .= "delete from v_menu_items ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
|
||||
//delete the menu permissions
|
||||
$sql = "";
|
||||
$sql .= "delete from v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
|
||||
//save the changes to the database
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,245 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$menu_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$menu_uuid = check_str($_POST["menu_uuid"]);
|
||||
$menu_name = check_str($_POST["menu_name"]);
|
||||
$menu_language = check_str($_POST["menu_language"]);
|
||||
$menu_description = check_str($_POST["menu_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$menu_uuid = check_str($_POST["menu_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($menu_uuid) == 0) { $msg .= "Please provide: Menu UUID<br>\n"; }
|
||||
//if (strlen($menu_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
|
||||
//if (strlen($menu_language) == 0) { $msg .= "Please provide: Language<br>\n"; }
|
||||
//if (strlen($menu_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
//create a new unique id
|
||||
$menu_uuid = uuid();
|
||||
|
||||
//start a new menu
|
||||
$sql = "insert into v_menus ";
|
||||
$sql .= "(";
|
||||
$sql .= "menu_uuid, ";
|
||||
$sql .= "menu_name, ";
|
||||
$sql .= "menu_language, ";
|
||||
$sql .= "menu_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$menu_uuid."', ";
|
||||
$sql .= "'$menu_name', ";
|
||||
$sql .= "'$menu_language', ";
|
||||
$sql .= "'$menu_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add the default items in the menu
|
||||
require_once "includes/classes/menu.php";
|
||||
$menu = new menu;
|
||||
$menu->db = $db;
|
||||
$menu->menu_uuid = $menu_uuid;
|
||||
$menu->restore();
|
||||
|
||||
//redirect the user back to the main menu
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
//update the menu
|
||||
$sql = "update v_menus set ";
|
||||
$sql .= "menu_name = '$menu_name', ";
|
||||
$sql .= "menu_language = '$menu_language', ";
|
||||
$sql .= "menu_description = '$menu_description' ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//redirect the user back to the main menu
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$menu_uuid = $_GET["id"];
|
||||
$sql = "select * from v_menus ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$menu_uuid = $row["menu_uuid"];
|
||||
$menu_name = $row["menu_name"];
|
||||
$menu_language = $row["menu_language"];
|
||||
$menu_description = $row["menu_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Menu Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Menu Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'>\n";
|
||||
if (permission_exists('menu_restore')) {
|
||||
echo " <input type='button' class='btn' value='Restore Default' onclick=\"document.location.href='menu_restore_default.php?menu_uuid=$menu_uuid&menu_uuid=$menu_uuid';\" />";
|
||||
}
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='menu.php'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo "Used to customize one or more menus.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='menu_name' maxlength='255' value=\"$menu_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the name of the menu.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Language:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='menu_language' maxlength='255' value=\"$menu_language\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the language.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='menu_description' maxlength='255' value=\"$menu_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='menu_uuid' value='$menu_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//show the menu items
|
||||
require_once "core/menu/menu_item_list.php";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
//clear the menu session so it will rebuild with the update
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
//get the menu uuid
|
||||
$menu_uuid = check_str($_GET["id"]);
|
||||
$menu_item_id = check_str($_GET["menu_item_id"]);
|
||||
|
||||
//delete the item in the menu
|
||||
$sql = "delete from v_menu_items ";
|
||||
$sql .= "where menu_item_id = '$menu_item_id' ";
|
||||
$sql .= "and menu_uuid = '$menu_uuid' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_edit.php?id=$menu_uuid\">\n";
|
||||
echo "<div align='center'>";
|
||||
echo "Delete Completed";
|
||||
echo "</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,464 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_add') || permission_exists('menu_edit') || permission_exists('menu_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//include the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//get the menu_uuid
|
||||
$menu_uuid = check_str($_REQUEST["id"]);
|
||||
$menu_item_uuid = check_str($_REQUEST['menu_item_uuid']);
|
||||
$group_name = check_str($_REQUEST['group_name']);
|
||||
|
||||
//delete the group from the user
|
||||
if ($_REQUEST["a"] == "delete" && permission_exists("menu_delete")) {
|
||||
//delete the group from the users
|
||||
$sql = "delete from v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid = '".$menu_uuid."' ";
|
||||
$sql .= "and menu_item_uuid = '".$menu_item_uuid."' ";
|
||||
$sql .= "and group_name = '".$group_name."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_item_edit.php?id=$menu_uuid&menu_item_uuid=$menu_item_uuid&menu_uuid=$menu_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add a group to the menu
|
||||
if ($_REQUEST["a"] != "delete" && strlen($group_name) > 0 && permission_exists('menu_add')) {
|
||||
//add the group to the menu
|
||||
if (strlen($menu_item_uuid) > 0) {
|
||||
$sql_insert = "insert into v_menu_item_groups ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "menu_uuid, ";
|
||||
$sql_insert .= "menu_item_uuid, ";
|
||||
$sql_insert .= "group_name ";
|
||||
$sql_insert .= ")";
|
||||
$sql_insert .= "values ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "'".$menu_uuid."', ";
|
||||
$sql_insert .= "'".$menu_item_uuid."', ";
|
||||
$sql_insert .= "'".$group_name."' ";
|
||||
$sql_insert .= ")";
|
||||
$db->exec($sql_insert);
|
||||
}
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["menu_item_uuid"])) {
|
||||
if (strlen($_REQUEST["menu_item_uuid"]) > 0) {
|
||||
$action = "update";
|
||||
$menu_item_uuid = check_str($_REQUEST["menu_item_uuid"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//clear the menu session so it will rebuild with the update
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
//get the HTTP POST variables and set them as PHP variables
|
||||
if (count($_POST)>0) {
|
||||
$menu_uuid = check_str($_POST["menu_uuid"]);
|
||||
$menu_item_uuid = check_str($_POST["menu_item_uuid"]);
|
||||
$menu_item_title = check_str($_POST["menu_item_title"]);
|
||||
$menu_item_link = check_str($_POST["menu_item_link"]);
|
||||
$menu_item_category = check_str($_POST["menu_item_category"]);
|
||||
$menu_item_description = check_str($_POST["menu_item_description"]);
|
||||
$menu_item_protected = check_str($_POST["menu_item_protected"]);
|
||||
//$menu_item_uuid = check_str($_POST["menu_item_uuid"]);
|
||||
$menu_item_parent_uuid = check_str($_POST["menu_item_parent_uuid"]);
|
||||
$menu_item_order = check_str($_POST["menu_item_order"]);
|
||||
}
|
||||
|
||||
//when a HTTP POST is available then process it
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
if ($action == "update") {
|
||||
$menu_item_uuid = check_str($_POST["menu_item_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
if (strlen($menu_item_title) == 0) { $msg .= "Please provide: title<br>\n"; }
|
||||
if (strlen($menu_item_category) == 0) { $msg .= "Please provide: category<br>\n"; }
|
||||
//if (strlen($menu_item_link) == 0) { $msg .= "Please provide: menu_item_link<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('menu_add')) {
|
||||
$sql = "SELECT menu_item_order FROM v_menu_items ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "and menu_item_parent_uuid = '$menu_item_parent_uuid' ";
|
||||
$sql .= "order by menu_item_order desc ";
|
||||
$sql .= "limit 1 ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$highest_menu_item_order = $row[menu_item_order];
|
||||
}
|
||||
unset($prep_statement);
|
||||
|
||||
$sql = "insert into v_menu_items ";
|
||||
$sql .= "(";
|
||||
$sql .= "menu_uuid, ";
|
||||
$sql .= "menu_item_title, ";
|
||||
$sql .= "menu_item_link, ";
|
||||
$sql .= "menu_item_category, ";
|
||||
$sql .= "menu_item_description, ";
|
||||
$sql .= "menu_item_protected, ";
|
||||
$sql .= "menu_item_uuid, ";
|
||||
$sql .= "menu_item_parent_uuid, ";
|
||||
$sql .= "menu_item_order, ";
|
||||
$sql .= "menu_item_add_user, ";
|
||||
$sql .= "menu_item_add_date ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$menu_uuid', ";
|
||||
$sql .= "'$menu_item_title', ";
|
||||
$sql .= "'$menu_item_link', ";
|
||||
$sql .= "'$menu_item_category', ";
|
||||
$sql .= "'$menu_item_description', ";
|
||||
$sql .= "'$menu_item_protected', ";
|
||||
$sql .= "'".uuid()."', ";
|
||||
if (strlen($menu_item_parent_uuid) == 0) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "'$menu_item_parent_uuid', ";
|
||||
}
|
||||
$sql .= "'".($highest_menu_item_order+1)."', ";
|
||||
$sql .= "'".$_SESSION["username"]."', ";
|
||||
$sql .= "now() ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_item_edit.php?id=$menu_uuid&menu_item_uuid=$menu_item_uuid&menu_uuid=$menu_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($action == "update" && permission_exists('menu_edit')) {
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_item_title = '$menu_item_title', ";
|
||||
$sql .= "menu_item_link = '$menu_item_link', ";
|
||||
$sql .= "menu_item_category = '$menu_item_category', ";
|
||||
$sql .= "menu_item_description = '$menu_item_description', ";
|
||||
$sql .= "menu_item_protected = '$menu_item_protected', ";
|
||||
if (strlen($menu_item_parent_uuid) == 0) {
|
||||
$sql .= "menu_item_parent_uuid = null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "menu_item_parent_uuid = '$menu_item_parent_uuid', ";
|
||||
}
|
||||
$sql .= "menu_item_order = '$menu_item_order', ";
|
||||
$sql .= "menu_item_mod_user = '".$_SESSION["username"]."', ";
|
||||
$sql .= "menu_item_mod_date = now() ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "and menu_item_uuid = '$menu_item_uuid' ";
|
||||
$count = $db->exec(check_sql($sql));
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_item_edit.php?id=$menu_uuid&menu_item_uuid=$menu_item_uuid&menu_uuid=$menu_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Edit Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$menu_item_uuid = $_GET["menu_item_uuid"];
|
||||
|
||||
$sql = "select * from v_menu_items ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "and menu_item_uuid = '$menu_item_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$menu_item_uuid = $row["menu_item_uuid"];
|
||||
$menu_item_title = $row["menu_item_title"];
|
||||
$menu_item_link = $row["menu_item_link"];
|
||||
$menu_item_category = $row["menu_item_category"];
|
||||
$menu_item_description = $row["menu_item_description"];
|
||||
$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"];
|
||||
$menu_item_add_date = $row["menu_item_add_date"];
|
||||
//$menu_item_del_user = $row["menu_item_del_user"];
|
||||
//$menu_item_del_date = $row["menu_item_del_date"];
|
||||
$menu_item_mod_user = $row["menu_item_mod_user"];
|
||||
$menu_item_mod_date = $row["menu_item_mod_date"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
}
|
||||
|
||||
//show the content
|
||||
require_once "includes/header.php";
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<table width='100%' cellpadding='6' cellspacing='0'>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' align='left' valign='top' nowrap><b>Menu Item Edit</b></td>\n";
|
||||
echo "<td width='70%' align='right' valign='top'><input type='button' class='btn' name='' alt='back' onclick=\"window.history.back();\" value='Back'><br /><br /></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>Title:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_title' value='$menu_item_title'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>Link:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_link' value='$menu_item_link'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>Category:</td>";
|
||||
echo " <td class='vtable'>";
|
||||
echo " <select name=\"menu_item_category\" class='formfld'>\n";
|
||||
echo " <option value=\"\"></option>\n";
|
||||
if ($menu_item_category == "internal") { echo "<option value=\"internal\" selected>internal</option>\n"; } else { echo "<option value=\"internal\">internal</option>\n"; }
|
||||
if ($menu_item_category == "external") { echo "<option value=\"external\" selected>external</option>\n"; } else { echo "<option value=\"external\">external</option>\n"; }
|
||||
if ($menu_item_category == "email") { echo "<option value=\"email\" selected>email</option>\n"; } else { echo "<option value=\"email\">email</option>\n"; }
|
||||
echo " </select>";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>Parent Menu:</td>";
|
||||
echo " <td class='vtable'>";
|
||||
$sql = "SELECT * FROM v_menu_items ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "order by menu_item_title asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
echo "<select name=\"menu_item_parent_uuid\" class='formfld'>\n";
|
||||
echo "<option value=\"\"></option>\n";
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $field) {
|
||||
if ($menu_item_parent_uuid == $field['menu_item_uuid']) {
|
||||
echo "<option value='".$field['menu_item_uuid']."' selected>".$field['menu_item_title']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo "<option value='".$field['menu_item_uuid']."'>".$field['menu_item_title']."</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
unset($sql, $result);
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>Groups:</td>";
|
||||
echo " <td class='vtable'>";
|
||||
|
||||
echo "<table width='52%'>\n";
|
||||
$sql = "SELECT * FROM v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid=:menu_uuid ";
|
||||
$sql .= "and menu_item_uuid=:menu_item_uuid ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->bindParam(':menu_uuid', $menu_uuid);
|
||||
$prep_statement->bindParam(':menu_item_uuid', $menu_item_uuid);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
foreach($result as $field) {
|
||||
if (strlen($field['group_name']) > 0) {
|
||||
echo "<tr>\n";
|
||||
echo " <td class='vtable'>".$field['group_name']."</td>\n";
|
||||
echo " <td>\n";
|
||||
if (permission_exists('group_member_delete') || if_group("superadmin")) {
|
||||
echo " <a href='menu_item_edit.php?id=".$field['menu_uuid']."&group_name=".$field['group_name']."&menu_item_uuid=".$menu_item_uuid."&menu_item_parent_uuid=".$menu_item_parent_uuid."&a=delete' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
$sql = "SELECT * FROM v_groups ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
echo "<select name=\"group_name\" class='frm'>\n";
|
||||
echo "<option value=\"\"></option>\n";
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $field) {
|
||||
if ($field['group_name'] == "superadmin") {
|
||||
//only show the superadmin group to other users in the superadmin group
|
||||
if (if_group("superadmin")) {
|
||||
echo "<option value='".$field['group_name']."'>".$field['group_name']."</option>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<option value='".$field['group_name']."'>".$field['group_name']."</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
echo "<input type=\"submit\" class='btn' value=\"Add\">\n";
|
||||
unset($sql, $result);
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Protected:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='menu_item_protected'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($menu_item_protected == "true") {
|
||||
echo " <option value='true' selected='selected' >true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>true</option>\n";
|
||||
}
|
||||
if ($menu_item_protected == "false") {
|
||||
echo " <option value='false' selected='selected' >false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>false</option>\n";
|
||||
}
|
||||
echo " </select><br />\n";
|
||||
echo "Protect this item in the menu so that is is not removed by 'Restore Default.'<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($action == "update") {
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>Menu Order:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_order' value='$menu_item_order'></td>";
|
||||
echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>Added By:</td>";
|
||||
//echo " <td class='vtable'>$menu_item_add_user </td>";
|
||||
//echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>Add Date:</td>";
|
||||
//echo " <td class='vtable'>$menu_item_add_date </td>";
|
||||
//echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>menu_item_del_user:</td>";
|
||||
//echo " <td><input type='text' name='menu_item_del_user' value='$menu_item_del_user'></td>";
|
||||
//echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>menu_item_del_date:</td>";
|
||||
//echo " <td><input type='text' name='menu_item_del_date' value='$menu_item_del_date'></td>";
|
||||
//echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>Modified By:</td>";
|
||||
//echo " <td class='vtable'>$menu_item_mod_user </td>";
|
||||
//echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>Modified Date:</td>";
|
||||
//echo " <td class='vtable'>$menu_item_mod_date </td>";
|
||||
//echo " </tr>";
|
||||
}
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>Description:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_description' value='$menu_item_description'></td>";
|
||||
echo " </tr>";
|
||||
|
||||
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <table width='100%'>";
|
||||
echo " <tr>";
|
||||
echo " <td align='left'>";
|
||||
echo " </td>\n";
|
||||
echo " <td align='right'>";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='menu_item_uuid' value='$menu_item_uuid'>";
|
||||
}
|
||||
echo " <input type='hidden' name='menu_uuid' value='$menu_uuid'>";
|
||||
echo " <input type='hidden' name='menu_item_uuid' value='$menu_item_uuid'>";
|
||||
echo " <input type='submit' class='btn' name='submit' value='Save'>\n";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,371 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
$tmp_menu_item_order = 0;
|
||||
|
||||
function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid, $c) {
|
||||
global $menu_uuid, $tmp_menu_item_order, $v_link_label_edit, $v_link_label_delete;
|
||||
|
||||
//check for sub menus
|
||||
$menu_item_level = $menu_item_level+1;
|
||||
$sql = "select * from v_menu_items ";
|
||||
$sql .= "where menu_uuid = '".$menu_uuid."' ";
|
||||
$sql .= "and menu_item_parent_uuid = '".$menu_item_uuid."' ";
|
||||
$sql .= "order by menu_item_order, menu_item_title asc ";
|
||||
$prep_statement_2 = $db->prepare($sql);
|
||||
$prep_statement_2->execute();
|
||||
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
|
||||
|
||||
$row_style["0"] = "row_style1";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
if (count($result2) > 0) {
|
||||
if ($c == 0) { $c2 = 1; } else { $c2 = 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 = "";
|
||||
$sql .= "select group_name from v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "and menu_item_uuid = '".$menu_item_uuid."' ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$group_list = "";
|
||||
$x = 0;
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
if ($x == 0) {
|
||||
$group_list = $sub_row["group_name"];
|
||||
}
|
||||
else {
|
||||
$group_list .= ", ".$sub_row["group_name"];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
unset ($sub_prep_statement);
|
||||
//display the main body of the list
|
||||
switch ($menu_item_category) {
|
||||
case "internal":
|
||||
$menu_item_title = "<a href='".PROJECT_PATH."/$menu_item_link'>$menu_item_title</a>";
|
||||
break;
|
||||
case "external":
|
||||
if (substr($menu_item_link, 0,1) == "/") {
|
||||
$menu_item_link = PROJECT_PATH . $menu_item_link;
|
||||
}
|
||||
$menu_item_title = "<a href='$menu_item_link' target='_blank'>$menu_item_title</a>";
|
||||
break;
|
||||
case "email":
|
||||
$menu_item_title = "<a href='mailto:$menu_item_link'>$menu_item_title</a>";
|
||||
break;
|
||||
}
|
||||
|
||||
//display the content of the list
|
||||
echo "<tr'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>";
|
||||
echo " <table cellpadding='0' cellspacing='0' border='0'>";
|
||||
echo " <tr>";
|
||||
echo " <td nowrap>";
|
||||
$i=0;
|
||||
while($i < $menu_item_level){
|
||||
echo " ";
|
||||
$i++;
|
||||
}
|
||||
echo " ".$menu_item_title." ";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo "</td>";
|
||||
//echo "<td valign='top'> ".$menu_item_link." </td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> ".$group_list." </td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> ".$menu_item_category." </td>";
|
||||
//echo "<td valign='top'>".$row[menu_item_description]."</td>";
|
||||
//echo "<td valign='top'> ".$row[menu_item_order]." </td>";
|
||||
if ($menu_item_protected == "true") {
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> <strong>yes</strong> </td>";
|
||||
}
|
||||
else {
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> no </td>";
|
||||
}
|
||||
echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
|
||||
echo " ";
|
||||
//echo " ".$row2[menu_item_order]." ";
|
||||
echo "</td>";
|
||||
|
||||
//echo "<td valign='top' align='center' class='".$row_style[$c]."'>";
|
||||
//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].". 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].". Move Down'>";
|
||||
//}
|
||||
//echo "</td>";
|
||||
|
||||
echo " <td valign='top' align='right' nowrap>\n";
|
||||
if (permission_exists('menu_edit')) {
|
||||
echo " <a href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row2['menu_item_uuid']."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('menu_delete')) {
|
||||
echo " <a href='menu_item_delete.php?id=".$menu_uuid."&menu_item_uuid=".$row2['menu_item_uuid']."' onclick=\"return confirm('Do you really want to delete this?')\" alt='delete'>$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>";
|
||||
|
||||
//update the menu order
|
||||
if ($row2[menu_item_order] != $tmp_menu_item_order) {
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_item_title = '".$row2[menu_item_title]."', ";
|
||||
$sql .= "menu_item_order = '".$tmp_menu_item_order."' ";
|
||||
$sql .= "where menu_uuid = '".$menu_uuid."' ";
|
||||
$sql .= "and menu_item_uuid = '".$row2[menu_item_uuid]."' ";
|
||||
$count = $db->exec(check_sql($sql));
|
||||
}
|
||||
$tmp_menu_item_order++;
|
||||
|
||||
//check for additional sub menus
|
||||
if (strlen($menu_item_uuid)> 0) {
|
||||
$c = build_db_child_menu_list($db, $menu_item_level, $menu_item_uuid, $c);
|
||||
}
|
||||
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result2, $row2);
|
||||
}
|
||||
return $c;
|
||||
//end check for children
|
||||
}
|
||||
|
||||
require_once "includes/header.php";
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
|
||||
echo "<table width='100%' border='0'><tr>";
|
||||
//echo "<td width='50%'><b>Menu Manager</b></td>";
|
||||
echo "<td width='50%' align='right'>\n";
|
||||
//if (permission_exists('menu_restore')) {
|
||||
// echo " <input type='button' class='btn' value='Restore Default' onclick=\"document.location.href='menu_restore_default.php';\" />";
|
||||
//}
|
||||
echo "</td>\n";
|
||||
echo "<td width='35' nowrap></td>\n";
|
||||
echo "</tr></table>";
|
||||
|
||||
$sql = "select * from v_menu_items ";
|
||||
$sql .= "where menu_uuid = '".$menu_uuid."' ";
|
||||
$sql .= "and menu_item_parent_uuid is null ";
|
||||
if (strlen($order_by)> 0) {
|
||||
$sql .= "order by $order_by $order ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by menu_item_order asc ";
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style0";
|
||||
|
||||
echo "<div align='left'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
if ($result_count == 0) {
|
||||
//no results
|
||||
echo "<tr><td> </td></tr>";
|
||||
}
|
||||
else {
|
||||
echo "<tr>";
|
||||
echo "<th align='left' nowrap> Title </th>";
|
||||
echo "<th align='left' nowrap> Groups </th>";
|
||||
echo "<th align='left'nowrap> Category </th>";
|
||||
echo "<th nowrap> Protected </th>";
|
||||
//echo "<th align='left' width='55' nowrap> Order </th>";
|
||||
echo "<th nowrap width='70'>Order </th>";
|
||||
echo "<td align='right' width='42'>\n";
|
||||
if (permission_exists('menu_add')) {
|
||||
echo " <a href='menu_item_edit.php?id=".$menu_uuid."' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>";
|
||||
|
||||
foreach($result as $row) {
|
||||
//set the db values as php variables
|
||||
$menu_item_uuid = $row['menu_item_uuid'];
|
||||
$menu_item_category = $row['menu_item_category'];
|
||||
$menu_item_title = $row['menu_item_title'];
|
||||
$menu_item_link = $row['menu_item_link'];
|
||||
$menu_item_protected = $row['menu_item_protected'];
|
||||
|
||||
//get the groups that have been assigned to the menu
|
||||
$sql = "";
|
||||
$sql .= "select group_name from v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "and menu_item_uuid = '$menu_item_uuid' ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$group_list = "";
|
||||
$x = 0;
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
if ($x == 0) {
|
||||
$group_list = $sub_row["group_name"];
|
||||
}
|
||||
else {
|
||||
$group_list .= ", ".$sub_row["group_name"];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
unset ($sub_prep_statement);
|
||||
|
||||
//add the type link based on the typd of the menu
|
||||
switch ($menu_item_category) {
|
||||
case "internal":
|
||||
$menu_item_title = "<a href='".PROJECT_PATH."/$menu_item_link'>$menu_item_title</a>";
|
||||
break;
|
||||
case "external":
|
||||
if (substr($menu_item_link, 0,1) == "/") {
|
||||
$menu_item_link = PROJECT_PATH . $menu_item_link;
|
||||
}
|
||||
$menu_item_title = "<a href='$menu_item_link' target='_blank'>$menu_item_title</a>";
|
||||
break;
|
||||
case "email":
|
||||
$menu_item_title = "<a href='mailto:$menu_item_link'>$menu_item_title</a>";
|
||||
break;
|
||||
}
|
||||
|
||||
//display the content of the list
|
||||
echo "<tr style='".$row_style[$c]."'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> ".$menu_item_title." </td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> ".$group_list." </td>";
|
||||
//echo "<td valign='top' class='".$row_style[$c]."'> ".$menu_item_link." </td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> ".$menu_item_category." </td>";
|
||||
//echo "<td valign='top' class='".$row_style[$c]."'>".$row[menu_item_description]."</td>";
|
||||
//echo "<td valign='top' class='".$row_style[$c]."'> ".$row['menu_item_parent_uuid']." </td>";
|
||||
//echo "<td valign='top' class='".$row_style[$c]."'> ".$row['menu_item_order']." </td>";
|
||||
|
||||
if ($menu_item_protected == "true") {
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> <strong>yes</strong> </td>";
|
||||
}
|
||||
else {
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> no </td>";
|
||||
}
|
||||
|
||||
echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
|
||||
echo " ".$row[menu_item_order]." ";
|
||||
echo "</td>";
|
||||
|
||||
//echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
|
||||
//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=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$row['menu_item_uuid']."&menu_item_order=".$row['menu_item_order']."'\" value='<' title='".$row['menu_item_order'].". 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=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$row['menu_item_uuid']."&menu_item_order=".$row['menu_item_order']."'\" value='>' title='".$row['menu_item_order'].". Move Down'>";
|
||||
//}
|
||||
//echo "</td>";
|
||||
|
||||
echo " <td valign='top' align='right' nowrap>\n";
|
||||
if (permission_exists('menu_edit')) {
|
||||
echo " <a href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('menu_delete')) {
|
||||
echo " <a href='menu_item_delete.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."' onclick=\"return confirm('Do you really want to delete this?')\" alt='delete'>$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>";
|
||||
|
||||
//update the menu order
|
||||
if ($row[menu_item_order] != $tmp_menu_item_order) {
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_item_title = '".$row['menu_item_title']."', ";
|
||||
$sql .= "menu_item_order = '".$tmp_menu_item_order."' ";
|
||||
$sql .= "where menu_uuid = '".$menu_uuid."' ";
|
||||
$sql .= "and menu_item_uuid = '".$row[menu_item_uuid]."' ";
|
||||
//$db->exec(check_sql($sql));
|
||||
}
|
||||
$tmp_menu_item_order++;
|
||||
|
||||
//check for sub menus
|
||||
$menu_item_level = 0;
|
||||
if (strlen($row['menu_item_uuid']) > 0) {
|
||||
$c = build_db_child_menu_list($db, $menu_item_level, $row['menu_item_uuid'], $c);
|
||||
}
|
||||
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6' align='left'>\n";
|
||||
echo " <table border='0' width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
if (permission_exists('menu_add')) {
|
||||
echo " <a href='menu_item_edit.php?id=".$menu_uuid."' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br><br>";
|
||||
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>";
|
||||
|
||||
echo "<br><br>";
|
||||
require_once "includes/footer.php";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//move down more than one level at a time
|
||||
//update v_menu_items set menu_item_order = (menu_item_order+1) where menu_item_order > 2 or menu_item_order = 2
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$menu_item_id = check_str($_GET["menu_item_id"]);
|
||||
$menu_item_order = check_str($_GET["menu_item_order"]);
|
||||
$menu_parent_guid = check_str($_GET["menu_parent_guid"]);
|
||||
|
||||
$sql = "SELECT menu_item_order FROM v_menu_items ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "order by menu_item_order desc ";
|
||||
$sql .= "limit 1 ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$highestmenu_item_order = $row[menu_item_order];
|
||||
}
|
||||
unset($prep_statement);
|
||||
|
||||
if ($menu_item_order != $highestmenu_item_order) {
|
||||
//clear the menu session so it will rebuild with the update
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
//move the current item's order number up
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_item_order = (menu_item_order-1) "; //move down
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and menu_item_order = ".($menu_item_order+1)." ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//move the selected item's order number down
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_item_order = (menu_item_order+1) "; //move up
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and menu_item_id = '$menu_item_id' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"1;url=menu_list.php?menu_item_id=$menu_item_id\">\n";
|
||||
echo "<div align='center'>";
|
||||
echo "Item Moved Down";
|
||||
echo "</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,75 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//move down more than one level at a time
|
||||
//update v_menu_items set menu_order = (menu_order+1) where menu_order > 2 or menu_order = 2
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$menu_item_id = check_str($_GET["menu_item_id"]);
|
||||
$menu_order = check_str($_GET["menu_order"]);
|
||||
|
||||
if ($menu_order != 1) {
|
||||
//clear the menu session so it will rebuild with the update
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
//move the current item's order number down
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_order = (menu_order+1) "; //move down
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and menu_order = ".($menu_order-1)." ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//move the selected item's order number up
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_order = (menu_order-1) "; //move up
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and menu_item_id = '$menu_item_id' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"1;url=menu_list.php?menu_item_id=$menu_item_id\">\n";
|
||||
echo "<div align='center'>";
|
||||
echo "Item Moved Up";
|
||||
echo "</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_restore')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the http value and set as a php variable
|
||||
$menu_uuid = check_str($_REQUEST["menu_uuid"]);
|
||||
|
||||
//menu restore default
|
||||
require_once "includes/classes/menu.php";
|
||||
$menu = new menu;
|
||||
$menu->db = $db;
|
||||
$menu->menu_uuid = $menu_uuid;
|
||||
$menu->delete();
|
||||
$menu->restore();
|
||||
|
||||
//unset the menu session variable
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
//unset the default template
|
||||
$_SESSION["template_content"] = '';
|
||||
|
||||
//show a message to the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=/core/menu/menu_edit.php?id=$menu_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Restore Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user