aboutsummaryrefslogtreecommitdiffstats
path: root/mod/impel.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-05-31 19:26:00 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-05-31 19:26:00 -0700
commitf3b95f591a7ec49b6fc148913861bae2bb6aa6c7 (patch)
tree22f9f085950ac16766ed3af1f1d052d233c0660e /mod/impel.php
parent8fe3daab21f9aba00f7def3553247b0cbcf5f94a (diff)
parent5cc5e0fafdbc1795781b52124a63695ce3e2d49f (diff)
downloadvolse-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 'mod/impel.php')
-rw-r--r--mod/impel.php57
1 files changed, 50 insertions, 7 deletions
diff --git a/mod/impel.php b/mod/impel.php
index 711547624..ff154125b 100644
--- a/mod/impel.php
+++ b/mod/impel.php
@@ -2,6 +2,7 @@
// import page design element
+require_once('include/menu.php');
function impel_init(&$a) {
@@ -21,7 +22,6 @@ function impel_init(&$a) {
if(! $j)
json_return_and_die($ret);
-
$channel = $a->get_channel();
$arr = array();
@@ -57,15 +57,58 @@ function impel_init(&$a) {
logger('mod_impel: unrecognised element type' . print_r($j,true));
break;
}
- if($is_menu) {
-
-
-
-
-
+ if($is_menu) {
+ $m = array();
+ $m['menu_channel_id'] = local_channel();
+ $m['menu_name'] = $j['pagetitle'];
+ $m['menu_desc'] = $j['desc'];
+ if($j['created'])
+ $m['menu_created'] = datetime_convert($j['created']);
+ if($j['edited'])
+ $m['menu_edited'] = datetime_convert($j['edited']);
+
+ $m['menu_flags'] = 0;
+ if($j['flags']) {
+ if(in_array('bookmark',$j['flags']))
+ $m['menu_flags'] |= MENU_BOOKMARK;
+ if(in_array('system',$j['flags']))
+ $m['menu_flags'] |= MENU_SYSTEM;
+ }
+ $menu_id = menu_create($m);
+
+ if($menu_id) {
+ if(is_array($j['items'])) {
+ foreach($j['items'] as $it) {
+ $mitem = array();
+
+ $mitem['mitem_link'] = str_replace('[baseurl]',z_root(),$it['link']);
+ $mitem['mitem_desc'] = escape_tags($it['desc']);
+ $mitem['mitem_order'] = intval($it['order']);
+ if(is_array($it['flags'])) {
+ $mitem['mitem_flags'] = 0;
+ if(in_array('zid',$it['flags']))
+ $mitem['mitem_flags'] |= MENU_ITEM_ZID;
+ if(in_array('new-window',$it['flags']))
+ $mitem['mitem_flags'] |= MENU_ITEM_NEWWIN;
+ if(in_array('chatroom',$it['flags']))
+ $mitem['mitem_flags'] |= MENU_ITEM_CHATROOM;
+ }
+ menu_add_item($menu_id,local_channel(),$mitem);
+ }
+ if($j['edited']) {
+ $x = q("update menu set menu_edited = '%s' where menu_id = %d and menu_channel_id = %d",
+ dbesc(datetime_convert('UTC','UTC',$j['edited'])),
+ intval($menu_id),
+ intval(local_channel())
+ );
+ }
+ }
+ $ret['success'] = true;
+ }
+ $x = $ret;
}
else {
$arr['uid'] = local_channel();