aboutsummaryrefslogtreecommitdiffstats
path: root/mod/impel.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2015-05-29 13:08:01 +0200
committerMario Vavti <mario@mariovavti.com>2015-05-29 13:08:01 +0200
commitb8d328076384ff48be47f59366aea8b1e1cc04a1 (patch)
tree81f0c9ac22a7ca48bf6aa6ccde8c738d5620caa3 /mod/impel.php
parent5f1ae2930b5ae69e142aed84f70afe5cde8cc38f (diff)
downloadvolse-hubzilla-b8d328076384ff48be47f59366aea8b1e1cc04a1.tar.gz
volse-hubzilla-b8d328076384ff48be47f59366aea8b1e1cc04a1.tar.bz2
volse-hubzilla-b8d328076384ff48be47f59366aea8b1e1cc04a1.zip
some fixes to make menu sharing work and expose it in the ui.
Diffstat (limited to 'mod/impel.php')
-rw-r--r--mod/impel.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/mod/impel.php b/mod/impel.php
index 5bc850562..813990a7d 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,10 +57,11 @@ function impel_init(&$a) {
logger('mod_impel: unrecognised element type' . print_r($j,true));
break;
}
+
if($is_menu) {
$m = array();
$m['menu_channel_id'] = local_channel();
- $m['menu_name'] = $j['name'];
+ $m['menu_name'] = $j['pagetitle'];
$m['menu_desc'] = $j['desc'];
if($j['created'])
$m['menu_created'] = datetime_convert($j['created']);
@@ -75,13 +76,16 @@ function impel_init(&$a) {
$m['menu_flags'] |= MENU_SYSTEM;
}
- $menu_id = $menu_create($m);
+
+ $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'] = escapetags($it['link']);
+ $mitem['mitem_desc'] = escape_tags($it['desc']);
$mitem['mitem_order'] = intval($it['order']);
if(is_array($it['flags'])) {
$mitem['mitem_flags'] = 0;
@@ -98,7 +102,7 @@ function impel_init(&$a) {
$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(channel_id())
+ intval(local_channel())
);
}
}