From efb6842d748ad35f2843619983a4e3e9b14617a9 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 26 Jan 2015 20:47:53 -0800 Subject: superblock enhancements --- mod/directory.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'mod') diff --git a/mod/directory.php b/mod/directory.php index 4ceda293d..2a07208a4 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -274,17 +274,21 @@ function directory_content(&$a) { $arr = array('contact' => $rr, 'entry' => $entry); call_hooks('directory_item', $arr); - + + unset($profile); + unset($location); + + if(! $arr['entry']) { + continue; + } + if($sort_order == '' && $suggest) { $entries[$addresses[$rr['address']]] = $arr['entry']; // Use the same indexes as originally to get the best suggestion first } + else { $entries[] = $arr['entry']; } - unset($profile); - unset($location); - - } ksort($entries); // Sort array by key so that foreach-constructs work as expected -- cgit v1.2.3 From 65aa6cf708a34e20ebad3c6b6dfc4088e927cce1 Mon Sep 17 00:00:00 2001 From: marijus Date: Tue, 27 Jan 2015 19:00:16 +0100 Subject: move userReadableSize() and getIconFromType() from /include/RedDAV/RedBrowser.php to include/text.php and add template for mod/sharedwithme --- mod/sharedwithme.php | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'mod') diff --git a/mod/sharedwithme.php b/mod/sharedwithme.php index 8b7d2661c..56cbc35ec 100644 --- a/mod/sharedwithme.php +++ b/mod/sharedwithme.php @@ -73,27 +73,37 @@ function sharedwithme_content(&$a) { dbesc($channel['channel_hash']) ); - $o = profile_tabs($a, $is_owner, $channel['channel_address']); - - $o .= '
'; - - $o .= ' ' . t('Remove all entries') . ''; - - $o .= '

' . t('Files shared with me') . '

'; - - $o .= '
'; - - $o .= '
'; + $items =array(); if($r) { foreach($r as $rr) { $object = json_decode($rr['object'],true); - $url = rawurldecode(get_rel_link($object['link'],'alternate')); - $o .= '' . $url . ' 

'; + + $item = array(); + $item['id'] = $rr['id']; + $item['objfiletype'] = $object['filetype']; + $item['objfiletypeclass'] = getIconFromType($object['filetype']); + $item['objurl'] = rawurldecode(get_rel_link($object['link'],'alternate')) . '?f=&zid=' . $channel['xchan_addr']; + $item['objfilename'] = $object['filename']; + $item['objfilesize'] = userReadableSize($object['filesize']); + $item['objedited'] = $object['edited']; + + $items[] = $item; + } } - $o .= '
'; + $o = profile_tabs($a, $is_owner, $channel['channel_address']); + + $o .= replace_macros(get_markup_template('sharedwithme.tpl'), array( + '$header' => t('Files: shared with me'), + '$name' => t('Name'), + '$size' => t('Size'), + '$lastmod' => t('Last Modified'), + '$dropall' => t('Remove all files'), + '$drop' => t('Remove this file'), + '$items' => $items + )); return $o; -- cgit v1.2.3 From f62383e648b50787a5456e452cf5b590d67d0ff4 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 27 Jan 2015 11:48:10 -0800 Subject: allow doc/help system to use subdirs --- mod/help.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'mod') diff --git a/mod/help.php b/mod/help.php index 5cdeda58f..0081e54e7 100644 --- a/mod/help.php +++ b/mod/help.php @@ -37,20 +37,28 @@ function help_content(&$a) { $text = ''; if(argc() > 1) { - $text = load_doc_file('doc/' . $a->argv[1] . '.md'); - $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags(argv(1)))); + $path = ''; + for($x = 1; $x < argc(); $x ++) { + if(strlen($path)) + $path .= '/'; + $path .= argv($x); + } + $title = basename($path); + + $text = load_doc_file('doc/' . $path . '.md'); + $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title))); if(! $text) { - $text = load_doc_file('doc/' . $a->argv[1] . '.bb'); + $text = load_doc_file('doc/' . $path . '.bb'); if($text) $doctype = 'bbcode'; - $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('_',' ',notags(argv(1)))); + $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('_',' ',notags($title))); } if(! $text) { - $text = load_doc_file('doc/' . $a->argv[1] . '.html'); + $text = load_doc_file('doc/' . $path . '.html'); if($text) $doctype = 'html'; - $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags(argv(1)))); + $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title))); } } -- cgit v1.2.3 From 145b30adfc21b7f29d1431ebd1e2e0f4ebd853bf Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 27 Jan 2015 18:34:18 -0800 Subject: allow RSS connections in the type 'a' autocomplete results as that is used for channel sources. Without it a feed cannot be selected as a channel source. --- mod/acl.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/acl.php b/mod/acl.php index d406942c3..8eff93a9a 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -33,7 +33,7 @@ function acl_init(&$a){ $sql_extra2 = "AND ( xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " OR xchan_addr LIKE " . protect_sprintf( "'%" . dbesc($search) . ((strpos($search,'@') === false) ? "%@%'" : "%'")) . ") "; // This horrible mess is needed because position also returns 0 if nothing is found. W/ould be MUCH easier if it instead returned a very large value - // Otherwise we could just order by LEAST(POSTION($search IN xchan_name),POSITION($search IN xchan_addr)). + // Otherwise we could just order by LEAST(POSITION($search IN xchan_name),POSITION($search IN xchan_addr)). $order_extra2 = "CASE WHEN xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) ." then POSITION('".dbesc($search)."' IN xchan_name) else position('".dbesc($search)."' IN xchan_addr) end, "; $col = ((strpos($search,'@') !== false) ? 'xchan_addr' : 'xchan_name' ); $sql_extra3 = "AND $col like " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " "; @@ -171,6 +171,7 @@ function acl_init(&$a){ ); } elseif(($type == 'a') || ($type == 'p')) { + $r = q("SELECT abook_id as id, xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and not (xchan_flags & %d)>0 @@ -180,6 +181,7 @@ function acl_init(&$a){ intval(XCHAN_FLAGS_DELETED) ); + } elseif($type == 'x') { $r = navbar_complete($a); @@ -209,7 +211,7 @@ function acl_init(&$a){ foreach($r as $g){ // remove RSS feeds from ACLs - they are inaccessible - if(strpos($g['hash'],'/')) + if(strpos($g['hash'],'/') && $type != 'a') continue; if(($g['abook_their_perms'] & PERMS_W_TAGWALL) && $type == 'c' && (! $noforums)) { @@ -233,7 +235,7 @@ function acl_init(&$a){ "id" => $g['id'], "xid" => $g['hash'], "link" => $g['nick'], - "nick" => substr($g['nick'],0,strpos($g['nick'],'@')), + "nick" => (($g['nick']) ? substr($g['nick'],0,strpos($g['nick'],'@')) : t('RSS')), "self" => (($g['abook_flags'] & ABOOK_FLAG_SELF) ? 'abook-self' : ''), "taggable" => '', "label" => '', @@ -248,6 +250,8 @@ function acl_init(&$a){ 'count' => $count, 'items' => $items, ); + + echo json_encode($o); -- cgit v1.2.3