diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-07-03 15:42:55 -0700 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-07-03 15:42:55 -0700 |
commit | 2881b553fec5167c8252f7c55247345e1af11be5 (patch) | |
tree | 60e215fb1e5eaa4e566f7b197f6ae10ffc3e4345 /actions | |
parent | c02acd7341cc3104b75a56e0b8dfd4811e77e278 (diff) | |
parent | 088fa6befcf93607020fa2c77fcfdc952239efb8 (diff) |
Merge branch '0.8.x' of git@gitorious.org:laconica/dev into 0.8.x
* '0.8.x' of git@gitorious.org:laconica/dev:
null for both args in conversation
no limit on conversation stream
fixed limit for conversations
only show subscribe button in profile list for local users
move peoplesearchresults class to action/peoplesearch
only show subscription controls to owner
Diffstat (limited to 'actions')
-rw-r--r-- | actions/conversation.php | 5 | ||||
-rw-r--r-- | actions/peoplesearch.php | 44 | ||||
-rw-r--r-- | actions/subscriptions.php | 5 |
3 files changed, 52 insertions, 2 deletions
diff --git a/actions/conversation.php b/actions/conversation.php index 468409189..0eb0d86d6 100644 --- a/actions/conversation.php +++ b/actions/conversation.php @@ -31,6 +31,9 @@ if (!defined('LACONICA')) { exit(1); } +// XXX: not sure how to do paging yet, +// so set a 60-notice limit + require_once INSTALLDIR.'/lib/noticelist.php'; /** @@ -107,7 +110,7 @@ class ConversationAction extends Action function showContent() { - $notices = Notice::conversationStream($this->id, null); + $notices = Notice::conversationStream($this->id, null, null); $ct = new ConversationTree($notices, $this); diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php index c61e0e273..60ddb6a82 100644 --- a/actions/peoplesearch.php +++ b/actions/peoplesearch.php @@ -87,3 +87,47 @@ class PeoplesearchAction extends SearchAction } } +/** + * People search results class + * + * Derivative of ProfileList with specialization for highlighting search terms. + * + * @category Widget + * @package Laconica + * @author Evan Prodromou <evan@controlyourself.ca> + * @author Robin Millette <millette@controlyourself.ca> + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://laconi.ca/ + * + * @see PeoplesearchAction + */ + +class PeopleSearchResults extends ProfileList +{ + var $terms = null; + var $pattern = null; + + function __construct($profile, $terms, $action) + { + parent::__construct($profile, $action); + + $this->terms = array_map('preg_quote', + array_map('htmlspecialchars', $terms)); + + $this->pattern = '/('.implode('|',$terms).')/i'; + } + + function newProfileItem($profile) + { + return new PeopleSearchResultItem($profile, $this->action); + } +} + +class PeopleSearchResultItem extends ProfileListItem +{ + function highlight($text) + { + return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text)); + } +} + diff --git a/actions/subscriptions.php b/actions/subscriptions.php index 4124abea4..42bdae10f 100644 --- a/actions/subscriptions.php +++ b/actions/subscriptions.php @@ -159,7 +159,10 @@ class SubscriptionsListItem extends SubscriptionListItem $this->showBio(); $this->showTags(); // Relevant portion! - $this->showOwnerControls(); + $cur = common_current_user(); + if (!empty($cur) && $cur->id == $this->owner->id) { + $this->showOwnerControls(); + } $this->endProfile(); } |