From 07203c1de3b0db9cbd5fa67b5edc22b1a35ba3de Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 28 May 2015 20:54:57 -0700 Subject: another case of committing with unsaved changes in a second window --- include/menu.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index 0e5fa3c99..c2c53115f 100644 --- a/include/menu.php +++ b/include/menu.php @@ -150,14 +150,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; -- cgit v1.2.3 From 9ff988e3d776088c969849a046ad6ff3811084e7 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 28 May 2015 21:27:48 -0700 Subject: parse error --- include/menu.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index c2c53115f..5c078c189 100644 --- a/include/menu.php +++ b/include/menu.php @@ -158,8 +158,8 @@ function menu_create($arr) { dbesc($menu_desc), intval($menu_flags), intval($menu_channel_id), - dbesc(datetime_convert('UTC','UTC',(($arr['menu_created']) ? $arr['menu_created'] : $t)), - dbesc(datetime_convert('UTC','UTC',(($arr['menu_edited']) ? $arr['menu_edited'] : $t)) + 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; -- cgit v1.2.3 From 3a9139f76ee64b49c7902269cb3d98f6a6e20230 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 28 May 2015 22:06:22 -0700 Subject: there was a reason we included that file --- include/items.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 71d4213b7..aa052b307 100755 --- a/include/items.php +++ b/include/items.php @@ -4389,6 +4389,8 @@ function zot_feed($uid,$observer_hash,$arr) { $mindate = null; $message_id = null; + require_once('include/security.php'); + if(array_key_exists('mindate',$arr)) { $mindate = datetime_convert('UTC','UTC',$arr['mindate']); } @@ -4411,10 +4413,8 @@ function zot_feed($uid,$observer_hash,$arr) { return $result; } - if(! is_sys_channel($uid)) { - require_once('include/security.php'); + if(! is_sys_channel($uid)) $sql_extra = item_permissions_sql($uid,$observer_hash); - } $limit = " LIMIT 100 "; -- cgit v1.2.3 From b8d328076384ff48be47f59366aea8b1e1cc04a1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 29 May 2015 13:08:01 +0200 Subject: some fixes to make menu sharing work and expose it in the ui. --- include/bbcode.php | 3 +++ include/menu.php | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 1f5a65399..a766b6aea 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -193,6 +193,9 @@ function translate_design_element($type) { case 'block': $ret = t('block'); break; + case 'menu': + $ret = t('menu'); + break; } return $ret; diff --git a/include/menu.php b/include/menu.php index 5c078c189..ae53945ef 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']) { @@ -124,7 +124,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']); @@ -287,7 +286,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']); -- cgit v1.2.3 From 2514af652490ebe4d379a32c339dd23d9b321897 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 29 May 2015 17:51:50 +0200 Subject: fix menu render for menu item edit - menu preview --- include/menu.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index ae53945ef..2b61ebd34 100644 --- a/include/menu.php +++ b/include/menu.php @@ -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']) -- cgit v1.2.3 From 504050618497d3f3f43bb44b89637ebd767557ce Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 29 May 2015 17:59:31 +0200 Subject: should not redefine $var in the function call --- include/menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index 2b61ebd34..d20df1d6e 100644 --- a/include/menu.php +++ b/include/menu.php @@ -86,7 +86,7 @@ function menu_render($menu, $class='', $edit = false, $var = array()) { 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; } -- cgit v1.2.3 From edd228decb5ef4c3ffa2a8be00983937680a56c2 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 30 May 2015 15:03:44 -0700 Subject: strip images from directory text entries --- include/bbcode.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 1f5a65399..9ec5ce22f 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -954,3 +954,8 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true) { return $Text; } + + +function strip_bbimage($s) { + $Text = preg_replace("/\[[zi]mg(.*?)\](.*?)\[\/[zi]mg\]/ism", '', $Text); +} \ No newline at end of file -- cgit v1.2.3 From 5cc5e0fafdbc1795781b52124a63695ce3e2d49f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 31 May 2015 18:35:35 -0700 Subject: some basic background work for activitystreams-json-ld-2.0 conversions --- include/bbcode.php | 8 ++++++++ include/items.php | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index f4d9bb525..e2403b8eb 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -958,6 +958,14 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true) { return $Text; } +/** + * This function exists as a short-term solution to folks linking to private images from their /cloud in + * their profiles, which brings up a login dialogue in the directory when that entry is viewed. + * The long term solution is to separate the web file browser from DAV so that you'll never see a + * login prompt (though the resource may return a permission denied). + */ + + function strip_bbimage($s) { $Text = preg_replace("/\[[zi]mg(.*?)\](.*?)\[\/[zi]mg\]/ism", '', $Text); diff --git a/include/items.php b/include/items.php index aa052b307..a04cd1c76 100755 --- a/include/items.php +++ b/include/items.php @@ -553,6 +553,7 @@ function get_feed_for($channel, $observer_hash, $params) { 'order' => 'post', 'top' => $params['top'] ), $channel, $observer_hash, CLIENT_MODE_NORMAL, get_app()->module); + $feed_template = get_markup_template('atom_feed.tpl'); @@ -4881,3 +4882,39 @@ function comment_local_origin($item) { return false; } + + +function i2asld($i) { + + if(! $i) + return array(); + + $ret = array(); + + if($i['verb']) { + $ret['@context'] = dirname($i['verb']); + $ret['@type'] = ucfirst(basename($i['verb'])); + } + $ret['@id'] = $i['plink']; + $ret['published'] = datetime_convert('UTC','UTC',$i['created'],ATOM_TIME); + if($i['title']) + $ret['title'] = $i['title']; + $ret['content'] = bbcode($i['body']); + + $ret['actor'] = asencode_person($i['author']); + $ret['owner'] = asencode_person($i['owner']); + + + return $ret; + +} + + +function asencode_person($p) { + $ret = array(); + $ret['@type'] = 'Person'; + $ret['@id'] = 'acct:' . $p['xchan_addr']; + $ret['displayName'] = $p['xchan_name']; + + return $ret; +} \ No newline at end of file -- cgit v1.2.3