aboutsummaryrefslogtreecommitdiffstats
path: root/include/menu.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/menu.php')
-rw-r--r--include/menu.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/menu.php b/include/menu.php
index 951a2b1fe..cee17c1e9 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -38,6 +38,18 @@ function menu_render($menu) {
}
+function menu_fetch_id($menu_id,$channel_id) {
+
+ $r = q("select * from menu where menu_id = %d and menu_channel_id = %d limit 1",
+ intval($menu_id),
+ intval($channel_id)
+ );
+
+ return (($r) ? $r[0] : false);
+}
+
+
+
function menu_create($arr) {
@@ -103,6 +115,17 @@ function menu_edit($arr) {
return false;
+ $r = q("select menu_id from menu where menu_name = '%s' and menu_channel_id = %d limit 1",
+ dbesc($menu_name),
+ intval($menu_channel_id)
+ );
+ if(($r) && ($r[0]['menu_id'] != $menu_id)) {
+ logger('menu_edit: duplicate menu name for channel ' . $menu_channel_id);
+ return false;
+ }
+
+
+
$menu_channel_id = intval($arr['menu_channel_id']);
$r = q("select * from menu where menu_id = %d and menu_channel_id = %d limit 1",