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(+) (limited to 'mod') 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 --- mod/directory.php | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'mod') 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')) -- 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" --- mod/directory.php | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) (limited to 'mod') 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')) -- 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 + 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'mod') 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) { -- 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 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'mod') 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; } -- 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. --- mod/photos.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') 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') -- cgit v1.2.3 From 50244f943d0a14e3d7a7fcbe7f51d02dbe039879 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 19 Nov 2014 16:29:35 -0800 Subject: minor photo flag issue - and some more whitespace edits --- mod/photos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/photos.php b/mod/photos.php index ce24762b1..7a9229cc4 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1176,7 +1176,7 @@ function photos_content(&$a) { $r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.album, p.scale, p.created FROM photo p INNER JOIN (SELECT resource_id, max(scale) scale FROM photo WHERE uid=%d AND album != '%s' AND album != '%s' - AND (photo_flags = %d or photo_flags = %d ) $sql_extra group by resource_id) ph + AND (photo_flags = %d or ( photo_flags & %d ) > 0 ) $sql_extra group by resource_id) ph ON (p.resource_id = ph.resource_id and p.scale = ph.scale) ORDER by p.created DESC LIMIT %d OFFSET %d", intval($a->data['channel']['channel_id']), dbesc('Contact Photos'), -- cgit v1.2.3