From c8c061d0cfdd1191b7a6d1acd7eeeaf484f75128 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 18 Nov 2014 13:48:22 +0100 Subject: Fix dirsearch with quoted single-word term --- mod/dirsearch.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 52d953707..56e2378a8 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -305,6 +305,12 @@ function dir_parse_query($s) { $curr['value'] = substr($curr['value'],1); continue; } + elseif($curr['value'][0] == '"' && $curr['value'][strlen($curr['value'])-1] == '"') { + $curr['value'] = substr($curr['value'],1,strlen($curr['value'])-2); + $ret[] = $curr; + $curr = array(); + continue; + } else { $ret[] = $curr; $curr = array(); -- cgit v1.2.3 From e0ab1e24e43e60cec955f82b1d4618050efebeac Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 18 Nov 2014 19:42:13 +0100 Subject: Directory shows channel suggestions by default --- include/contact_widgets.php | 1 - mod/directory.php | 42 ++++++++++++++++++++++++++++++++++++++++-- view/tpl/direntry.tpl | 3 +++ view/tpl/peoplefind.tpl | 1 - 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/include/contact_widgets.php b/include/contact_widgets.php index ee9394e95..4e8adab62 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -24,7 +24,6 @@ function findpeople_widget() { '$label' => t('Connect/Follow'), '$hint' => t('Examples: Robert Morgenstein, Fishing'), '$findthem' => t('Find'), - '$suggest' => t('Channel Suggestions'), '$similar' => '', // FIXME and uncomment when mod/match working // t('Similar Interests'), '$random' => t('Random Profile'), '$inv' => t('Invite Friends'), diff --git a/mod/directory.php b/mod/directory.php index d4a4c383a..ee064e3ed 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -1,5 +1,6 @@ set_pager_itemspage(60); + if(x($_GET,'ignore')) { + q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ", + intval(local_user()), + dbesc($_GET['ignore']) + ); + } } function directory_content(&$a) { @@ -42,11 +49,33 @@ function directory_content(&$a) { else $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : ''); + if(strpos($search,'=') && local_user() && get_pconfig(local_user(),'feature','expert')) $advanced = $search; + $keywords = (($_GET['keywords']) ? $_GET['keywords'] : ''); + // Suggest channels if no search terms or keywords are given + $suggest = ($search == '' && $keywords == '' && local_user()); + + if($suggest) { + $r = suggestion_query(local_user(),get_observer_hash()); + + // Remember in which order the suggestions were + $addresses = array(); + foreach($r as $rr) { + $addresses[$rr['xchan_addr']] = $index++; + } + + // Build query to get info about suggested people + $advanced = ''; + foreach(array_keys($addresses) as $address) { + $advanced .= "address=\"$address\" "; + } + + } + $tpl = get_markup_template('directory_header.tpl'); @@ -227,19 +256,28 @@ function directory_content(&$a) { 'online' => $online, 'kw' => (($out) ? t('Keywords: ') : ''), 'keywords' => $out, + 'ignlink' => $suggest ? $a->get_baseurl() . '/directory?ignore=' . $rr['hash'] : '', + 'ignore_label' => "Don't suggest", ); $arr = array('contact' => $rr, 'entry' => $entry); call_hooks('directory_item', $arr); - $entries[] = $arr['entry']; + 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 + if($j['keywords']) { $a->data['directory_keywords'] = $j['keywords']; } @@ -268,7 +306,7 @@ function directory_content(&$a) { '$finddsc' => t('Finding:'), '$safetxt' => htmlspecialchars($search,ENT_QUOTES,'UTF-8'), '$entries' => $entries, - '$dirlbl' => t('Directory'), + '$dirlbl' => $suggest ? t('Channel Suggestions') : t('Directory'), '$submit' => t('Find'), '$next' => alt_pager($a,$j['records'], t('next page'), t('previous page')) diff --git a/view/tpl/direntry.tpl b/view/tpl/direntry.tpl index 2da920ab1..cdc6f1f97 100755 --- a/view/tpl/direntry.tpl +++ b/view/tpl/direntry.tpl @@ -6,6 +6,9 @@ {{if $entry.connect}} {{/if}} +{{if $entry.ignlink}} + +{{/if}} diff --git a/view/tpl/peoplefind.tpl b/view/tpl/peoplefind.tpl index 2f23948c8..16af5d8ed 100755 --- a/view/tpl/peoplefind.tpl +++ b/view/tpl/peoplefind.tpl @@ -12,7 +12,6 @@ -- cgit v1.2.3 From bfde28f28eae1f4b00aac03b2714254d14ab7464 Mon Sep 17 00:00:00 2001 From: RedMatrix Date: Wed, 19 Nov 2014 09:15:24 +1100 Subject: Revert "Directory shows channel suggestions by default" --- include/contact_widgets.php | 1 + mod/directory.php | 42 ++---------------------------------------- view/tpl/direntry.tpl | 3 --- view/tpl/peoplefind.tpl | 1 + 4 files changed, 4 insertions(+), 43 deletions(-) diff --git a/include/contact_widgets.php b/include/contact_widgets.php index 4e8adab62..ee9394e95 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -24,6 +24,7 @@ function findpeople_widget() { '$label' => t('Connect/Follow'), '$hint' => t('Examples: Robert Morgenstein, Fishing'), '$findthem' => t('Find'), + '$suggest' => t('Channel Suggestions'), '$similar' => '', // FIXME and uncomment when mod/match working // t('Similar Interests'), '$random' => t('Random Profile'), '$inv' => t('Invite Friends'), diff --git a/mod/directory.php b/mod/directory.php index ee064e3ed..d4a4c383a 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -1,6 +1,5 @@ set_pager_itemspage(60); - if(x($_GET,'ignore')) { - q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ", - intval(local_user()), - dbesc($_GET['ignore']) - ); - } } function directory_content(&$a) { @@ -49,33 +42,11 @@ function directory_content(&$a) { else $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : ''); - if(strpos($search,'=') && local_user() && get_pconfig(local_user(),'feature','expert')) $advanced = $search; - $keywords = (($_GET['keywords']) ? $_GET['keywords'] : ''); - // Suggest channels if no search terms or keywords are given - $suggest = ($search == '' && $keywords == '' && local_user()); - - if($suggest) { - $r = suggestion_query(local_user(),get_observer_hash()); - - // Remember in which order the suggestions were - $addresses = array(); - foreach($r as $rr) { - $addresses[$rr['xchan_addr']] = $index++; - } - - // Build query to get info about suggested people - $advanced = ''; - foreach(array_keys($addresses) as $address) { - $advanced .= "address=\"$address\" "; - } - - } - $tpl = get_markup_template('directory_header.tpl'); @@ -256,28 +227,19 @@ function directory_content(&$a) { 'online' => $online, 'kw' => (($out) ? t('Keywords: ') : ''), 'keywords' => $out, - 'ignlink' => $suggest ? $a->get_baseurl() . '/directory?ignore=' . $rr['hash'] : '', - 'ignore_label' => "Don't suggest", ); $arr = array('contact' => $rr, 'entry' => $entry); call_hooks('directory_item', $arr); - 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']; - } + $entries[] = $arr['entry']; unset($profile); unset($location); } - ksort($entries); // Sort array by key so that foreach-constructs work as expected - if($j['keywords']) { $a->data['directory_keywords'] = $j['keywords']; } @@ -306,7 +268,7 @@ function directory_content(&$a) { '$finddsc' => t('Finding:'), '$safetxt' => htmlspecialchars($search,ENT_QUOTES,'UTF-8'), '$entries' => $entries, - '$dirlbl' => $suggest ? t('Channel Suggestions') : t('Directory'), + '$dirlbl' => t('Directory'), '$submit' => t('Find'), '$next' => alt_pager($a,$j['records'], t('next page'), t('previous page')) diff --git a/view/tpl/direntry.tpl b/view/tpl/direntry.tpl index cdc6f1f97..2da920ab1 100755 --- a/view/tpl/direntry.tpl +++ b/view/tpl/direntry.tpl @@ -6,9 +6,6 @@ {{if $entry.connect}} {{/if}} -{{if $entry.ignlink}} - -{{/if}} diff --git a/view/tpl/peoplefind.tpl b/view/tpl/peoplefind.tpl index 16af5d8ed..2f23948c8 100755 --- a/view/tpl/peoplefind.tpl +++ b/view/tpl/peoplefind.tpl @@ -12,6 +12,7 @@ -- cgit v1.2.3 From 38d50cabd4b3db859c5ac33f02760b1b00a993e5 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 18 Nov 2014 15:13:37 -0800 Subject: private mail buttons --- mod/mail.php | 8 ++++++-- mod/wall_upload.php | 1 + view/tpl/msg-header.tpl | 28 ++++++++++++++-------------- view/tpl/prv_message.tpl | 14 +++++++------- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/mod/mail.php b/mod/mail.php index dacb181c5..6c778b956 100644 --- a/mod/mail.php +++ b/mod/mail.php @@ -113,6 +113,7 @@ function mail_content(&$a) { } $channel = $a->get_channel(); + head_set_icon($channel['xchan_photo_s']); $cipher = get_pconfig(local_user(),'system','default_cipher'); @@ -163,13 +164,16 @@ function mail_content(&$a) { $tpl = get_markup_template('msg-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, array( + $header = replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(true), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$nickname' => $channel['channel_address'], '$linkurl' => t('Please enter a link URL:'), '$expireswhen' => t('Expires YYYY-MM-DD HH:MM') )); + + $a->page['htmlhead'] .= $header; + $preselect = (isset($a->argv[2])?array($a->argv[2]):false); $prename = $preurl = $preid = ''; @@ -276,7 +280,7 @@ function mail_content(&$a) { $tpl = get_markup_template('msg-header.tpl'); $a->page['htmlhead'] .= replace_macros($tpl, array( - '$nickname' => $channel['channel_addr'], + '$nickname' => $channel['channel_address'], '$baseurl' => $a->get_baseurl(true), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$linkurl' => t('Please enter a link URL:'), diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 97840a180..7ed1859a8 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -8,6 +8,7 @@ require_once('include/photos.php'); function wall_upload_post(&$a) { + $using_api = ((x($_FILES,'media')) ? true : false); if($using_api) { diff --git a/view/tpl/msg-header.tpl b/view/tpl/msg-header.tpl index 503e4c8cc..85fa51b0a 100755 --- a/view/tpl/msg-header.tpl +++ b/view/tpl/msg-header.tpl @@ -52,10 +52,10 @@ else 'prvmail-upload-wrapper', { action: 'wall_upload/{{$nickname}}', name: 'userfile', - onSubmit: function(file,ext) { $('#profile-rotator').spin('tiny'); }, + onSubmit: function(file,ext) { $('#prvmail-rotator').spin('tiny'); }, onComplete: function(file,response) { - addeditortext(response); - $('#profile-rotator').spin(false); + addmailtext(response); + $('#prvmail-rotator').spin(false); } } ); @@ -64,23 +64,23 @@ else 'prvmail-attach-wrapper', { action: 'wall_attach/{{$nickname}}', name: 'userfile', - onSubmit: function(file,ext) { $('#profile-rotator').spin('tiny'); }, + onSubmit: function(file,ext) { $('#prvmail-rotator').spin('tiny'); }, onComplete: function(file,response) { - addeditortext(response); - $('#profile-rotator').spin(false); + addmailtext(response); + $('#prvmail-rotator').spin(false); } } ); }); - function jotGetLink() { + function prvmailJotGetLink() { reply = prompt("{{$linkurl}}"); if(reply && reply.length) { - $('#profile-rotator').spin('tiny'); + $('#prvmail-rotator').spin('tiny'); $.get('parse_url?url=' + reply, function(data) { - addeditortext(response); - $('#profile-rotator').spin(false); + addmailtext(data); + $('#prvmail-rotator').spin(false); }); } } @@ -103,15 +103,15 @@ else event.target.textContent = reply; event.preventDefault(); if(reply && reply.length) { - $('#profile-rotator').spin('tiny'); + $('#prvmail-rotator').spin('tiny'); $.get('parse_url?url=' + reply, function(data) { - addeditortext(response); - $('#profile-rotator').spin(false); + addmailtext(data); + $('#prvmail-rotator').spin(false); }); } } - function addeditortext(data) { + function addmailtext(data) { if(plaintext == 'none') { var currentText = $("#prvmail-text").val(); $("#prvmail-text").val(currentText + data); diff --git a/view/tpl/prv_message.tpl b/view/tpl/prv_message.tpl index 709943541..c6f393aa4 100755 --- a/view/tpl/prv_message.tpl +++ b/view/tpl/prv_message.tpl @@ -34,21 +34,21 @@ - {{if $feature_expire}} - {{/if}} {{if $feature_encrypt}} - {{/if}}
- +
-- cgit v1.2.3 From 11f0b45a9015a717e6e0da1bfd5a1c61381d64ed Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 18 Nov 2014 16:58:36 -0800 Subject: blog mode - turn the comment link into a button and group with the likes/dislikes --- mod/like.php | 18 +++++------------- view/tpl/conv_list.tpl | 9 ++++++--- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/mod/like.php b/mod/like.php index b56611197..04a2b43cd 100755 --- a/mod/like.php +++ b/mod/like.php @@ -263,26 +263,18 @@ function like_content(&$a) { else killme(); - - $r = q("SELECT * FROM item WHERE verb = '%s' AND item_restrict = 0 + $r = q("SELECT id FROM item WHERE verb = '%s' AND item_restrict = 0 AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') LIMIT 1", dbesc($activity), dbesc($observer['xchan_hash']), intval($item_id), dbesc($item['mid']) ); - if($r) { - $like_item = $r[0]; - - // Already liked/disliked it, delete it - $r = q("UPDATE item SET item_restrict = ( item_restrict & ~%d ), changed = '%s' WHERE id = %d", - intval(ITEM_DELETED), - dbesc(datetime_convert()), - intval($like_item['id']) - ); - - proc_run('php',"include/notifier.php","like",$like_item['id']); + if($r) { + // already liked it. Drop that item. + require_once('include/items.php'); + drop_item($r[0]['id'],false,DROPITEM_PHASE1); return; } diff --git a/view/tpl/conv_list.tpl b/view/tpl/conv_list.tpl index b9a966e93..444734f48 100755 --- a/view/tpl/conv_list.tpl +++ b/view/tpl/conv_list.tpl @@ -104,7 +104,12 @@ -
+
+ + +
{{if $item.unseen_comments}}
{{/if}} + {{if $item.like_count}}
@@ -164,8 +169,6 @@ {{/if}}
-
-- cgit v1.2.3 From 3224848bad07fefec7ab830e70634740329ccae6 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 18 Nov 2014 19:02:28 -0800 Subject: turn the "adult photo flagging" (which prevents a particularly flagged photo from showing up in your top level albums) into a feature so it doesn't clutter the normal photo edit form. This feature was a quick hack and needs more work; but it could be important to somebody. --- include/features.php | 1 + mod/photos.php | 1 + view/tpl/photo_view.tpl | 3 +++ 3 files changed, 5 insertions(+) diff --git a/include/features.php b/include/features.php index 7530158ec..92d8598a5 100644 --- a/include/features.php +++ b/include/features.php @@ -48,6 +48,7 @@ function get_features() { array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')), array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds')), array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key')), + array('adult_photo_flagging', t('Flag Adult Photos'), t('Provide photo edit option to hide adult photos from default album view')), ), // Network Tools diff --git a/mod/photos.php b/mod/photos.php index ab848c709..ce24762b1 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -952,6 +952,7 @@ function photos_content(&$a) { 'lockstate' => $lockstate[0], 'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com'), 'item_id' => ((count($linked_items)) ? $link_item['id'] : 0), + 'adult_enabled' => feature_enabled($owner_uid,'adult_photo_flagging'), 'adult' => array('adult',t('Flag as adult in album view'), (($ph[0]['photo_flags'] & PHOTO_ADULT) ? 1 : 0),''), 'submit' => t('Submit'), 'delete' => t('Delete Photo') diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl index a741a5ce7..45a7cd7e5 100755 --- a/view/tpl/photo_view.tpl +++ b/view/tpl/photo_view.tpl @@ -59,9 +59,12 @@
+ {{if $edit.adult_enabled}}
{{include file="field_checkbox.tpl" field=$edit.adult}}
+ {{/if}} + {{$edit.aclselect}}
-- cgit v1.2.3 From efcbcd6f8809a7540bae6eb0a8c38c60def86537 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 18 Nov 2014 20:34:47 -0800 Subject: add sys channel to public recips if scope public --- include/zot.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/zot.php b/include/zot.php index 3ffc9b43f..837154ee8 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1256,8 +1256,14 @@ function zot_import($arr, $sender_url) { function public_recips($msg) { + + require_once('include/identity.php'); + $check_mentions = false; + $include_sys = false; + if($msg['message']['type'] === 'activity') { + $include_sys = true; $col = 'channel_w_stream'; $field = PERMS_W_STREAM; if(array_key_exists('flags',$msg['message']) && in_array('thread_parent', $msg['message']['flags'])) { @@ -1307,6 +1313,12 @@ function public_recips($msg) { $r = array_merge($r,$x); + if($include_sys && array_key_exists('public_scope',$msg['message']) && $msg['message']['public_scope'] === 'public') { + $sys = get_sys_channel(); + if($sys) + $r[] = array('hash' => $sys['channel_hash']); + } + // look for any public mentions on this site // They will get filtered by tgroup_check() so we don't need to check permissions now -- cgit v1.2.3 From 4893e64c1e871e22385e2c3db2d0815d872858fa Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 19 Nov 2014 00:56:05 -0800 Subject: there's still a permission issue delivering a public post directly to the sys channel (on the local system), but this puts the local sys channel in the public delivery chain and fixes an issue with unseen counts showing on the discover page (where you can't do anything about it). --- include/ItemObject.php | 2 +- include/zot.php | 2 ++ version.inc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/ItemObject.php b/include/ItemObject.php index 6f1c76fa1..f6f7c0fba 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -79,7 +79,7 @@ class Item extends BaseObject { $indent = ''; $osparkle = ''; $total_children = $this->count_descendants(); - $unseen_comments = (($item->real_uid) ? 0 : $this->count_unseen_descendants()); + $unseen_comments = (($item['real_uid']) ? 0 : $this->count_unseen_descendants()); $conv = $this->get_conversation(); $observer = $conv->get_observer(); diff --git a/include/zot.php b/include/zot.php index 837154ee8..d5789438c 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1313,6 +1313,8 @@ function public_recips($msg) { $r = array_merge($r,$x); +logger('message: ' . print_r($msg['message'],true)); + if($include_sys && array_key_exists('public_scope',$msg['message']) && $msg['message']['public_scope'] === 'public') { $sys = get_sys_channel(); if($sys) diff --git a/version.inc b/version.inc index 2679ebdf3..97d0c5a13 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2014-11-18.863 +2014-11-19.864 -- cgit v1.2.3 From 7fec939c23f2a23c8ac123d8a416cb2bde9ffbd9 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 19 Nov 2014 14:41:24 -0800 Subject: couple of fixes: - significantly increase the content availability on the discover channel - fix the button group on the blog/list mode which made the border on a single comment button a bit wonky --- include/zot.php | 5 +++++ view/tpl/conv_list.tpl | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/zot.php b/include/zot.php index d5789438c..1f121802a 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1428,8 +1428,13 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque continue; } + $channel = $r[0]; + // allow public postings to the sys channel regardless of permissions + if(($channel['channel_pageflags'] & PAGE_SYSTEM) && (! $arr['item_private'])) + $public = true; + $tag_delivery = tgroup_check($channel['channel_id'],$arr); $perm = (($arr['mid'] == $arr['parent_mid']) ? 'send_stream' : 'post_comments'); diff --git a/view/tpl/conv_list.tpl b/view/tpl/conv_list.tpl index 444734f48..aec1a78ab 100755 --- a/view/tpl/conv_list.tpl +++ b/view/tpl/conv_list.tpl @@ -104,7 +104,7 @@
-
+