diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-05-31 19:26:00 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-05-31 19:26:00 -0700 |
commit | f3b95f591a7ec49b6fc148913861bae2bb6aa6c7 (patch) | |
tree | 22f9f085950ac16766ed3af1f1d052d233c0660e /include/menu.php | |
parent | 8fe3daab21f9aba00f7def3553247b0cbcf5f94a (diff) | |
parent | 5cc5e0fafdbc1795781b52124a63695ce3e2d49f (diff) | |
download | volse-hubzilla-f3b95f591a7ec49b6fc148913861bae2bb6aa6c7.tar.gz volse-hubzilla-f3b95f591a7ec49b6fc148913861bae2bb6aa6c7.tar.bz2 volse-hubzilla-f3b95f591a7ec49b6fc148913861bae2bb6aa6c7.zip |
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Diffstat (limited to 'include/menu.php')
-rw-r--r-- | include/menu.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/include/menu.php b/include/menu.php index 0e5fa3c99..d20df1d6e 100644 --- a/include/menu.php +++ b/include/menu.php @@ -28,10 +28,10 @@ function menu_element($menu) { $arr = array(); $arr['type'] = 'menu'; - $arr['name'] = $menu['menu_name']; - $arr['desc'] = $menu['menu_desc']; - $arr['created'] = $menu['menu_created']; - $arr['edited'] = $menu['menu_edited']; + $arr['pagetitle'] = $menu['menu']['menu_name']; + $arr['desc'] = $menu['menu']['menu_desc']; + $arr['created'] = $menu['menu']['menu_created']; + $arr['edited'] = $menu['menu']['menu_edited']; $arr['baseurl'] = z_root(); if($menu['menu_flags']) { @@ -66,13 +66,17 @@ function menu_element($menu) { -function menu_render($menu, $class='', $edit = false, $var = '') { +function menu_render($menu, $class='', $edit = false, $var = array()) { if(! $menu) return ''; $channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0); + if ((! $channel_id) && (local_channel())) + $channel_id = local_channel(); + $menu_list = menu_list($channel_id); + $menu_names = array(); foreach($menu_list as $menus) { if($menus['menu_name'] != $menu['menu']['menu_name']) @@ -82,7 +86,7 @@ function menu_render($menu, $class='', $edit = false, $var = '') { for($x = 0; $x < count($menu['items']); $x ++) { if(in_array($menu['items'][$x]['mitem_link'], $menu_names)) { $m = menu_fetch($menu['items'][$x]['mitem_link'], $channel_id, get_observer_hash()); - $submenu = menu_render($m, 'dropdown-menu', $edit = false, $var = array('wrap' => 'none')); + $submenu = menu_render($m, 'dropdown-menu', $edit = false, array('wrap' => 'none')); $menu['items'][$x]['submenu'] = $submenu; } @@ -124,7 +128,6 @@ function menu_fetch_id($menu_id,$channel_id) { function menu_create($arr) { - $menu_name = trim(escape_tags($arr['menu_name'])); $menu_desc = trim(escape_tags($arr['menu_desc'])); $menu_flags = intval($arr['menu_flags']); @@ -150,14 +153,16 @@ function menu_create($arr) { if($r) return false; + $t = datetime_convert(); + $r = q("insert into menu ( menu_name, menu_desc, menu_flags, menu_channel_id, menu_created, menu_edited ) values( '%s', '%s', %d, %d, '%s', '%s' )", dbesc($menu_name), dbesc($menu_desc), intval($menu_flags), intval($menu_channel_id), - dbesc(datetime_convert()), - dbesc(datetime_convert()) + dbesc(datetime_convert('UTC','UTC',(($arr['menu_created']) ? $arr['menu_created'] : $t))), + dbesc(datetime_convert('UTC','UTC',(($arr['menu_edited']) ? $arr['menu_edited'] : $t))) ); if(! $r) return false; @@ -285,7 +290,6 @@ function menu_delete_id($menu_id, $uid) { function menu_add_item($menu_id, $uid, $arr) { - $mitem_link = escape_tags($arr['mitem_link']); $mitem_desc = escape_tags($arr['mitem_desc']); $mitem_order = intval($arr['mitem_order']); |