From baa17381c0320d8b75da52bde556dfe17eba937c Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 13:27:14 -0700 Subject: [PATCH 01/32] Change time format to work with older PHP (before 5.3) --- plugins/Event/eventform.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Event/eventform.php b/plugins/Event/eventform.php index f62571ce63..8100e5903b 100644 --- a/plugins/Event/eventform.php +++ b/plugins/Event/eventform.php @@ -124,7 +124,7 @@ class EventForm extends Form $this->li(); $times = EventTimeList::getTimes($today->format('m/d/Y 12:00') . ' am ' . $today->format('T')); - $start = EventTimeList::nearestHalfHour('@' . $today->getTimestamp()); + $start = EventTimeList::nearestHalfHour($today->format('c')); $start->setTimezone(new DateTimeZone(common_timezone())); $this->out->dropdown( @@ -160,7 +160,7 @@ class EventForm extends Form 'event-endtime', // TRANS: Field label on event form. _m('LABEL','End time'), - EventTimeList::getTimes('@' . $start->getTimestamp(), true), + EventTimeList::getTimes($start->format('c'), true), // TRANS: Field title on event form. _m('Time the event ends.'), false, From 2d6b4497a4e20014ec98b90bf878364b398ce0fd Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 14 Sep 2011 16:25:50 -0700 Subject: [PATCH 02/32] Fix undefined variable --- lib/groupprofileblock.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/groupprofileblock.php b/lib/groupprofileblock.php index df383f0696..fc0679247b 100644 --- a/lib/groupprofileblock.php +++ b/lib/groupprofileblock.php @@ -117,7 +117,7 @@ class GroupProfileBlock extends ProfileBlock array('nickname' => $this->group->nickname)), // TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators. // TRANS: %s is the nickname of the group. - 'title' => sprintf(_m('TOOLTIP','Edit %s group properties'), $nickname)), + 'title' => sprintf(_m('TOOLTIP','Edit %s group properties'), $this->group->nickname)), // TRANS: Link text for link on user profile. _m('BUTTON','Edit')); $this->out->elementEnd('li'); @@ -126,7 +126,7 @@ class GroupProfileBlock extends ProfileBlock array('nickname' => $this->group->nickname)), // TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators. // TRANS: %s is the nickname of the group. - 'title' => sprintf(_m('TOOLTIP','Add or edit %s logo'), $nickname)), + 'title' => sprintf(_m('TOOLTIP','Add or edit %s logo'), $this->group->nickname)), // TRANS: Link text for link on user profile. _m('MENU','Logo')); $this->out->elementEnd('li'); From b34812152d0a4f9bc9f86cd96ab7c3c98939619e Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 13:36:05 -0700 Subject: [PATCH 03/32] Don't try to verify URL if the user has left it out when making a new event --- plugins/Event/newevent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Event/newevent.php b/plugins/Event/newevent.php index 34e83cd7e0..4c2157e01e 100644 --- a/plugins/Event/newevent.php +++ b/plugins/Event/newevent.php @@ -206,7 +206,7 @@ class NeweventAction extends Action throw new ClientException(_m('Event must have an end time.')); } - if (isset($this->url) && Validate::uri($this->url) === false) { + if (!empty($this->url) && Validate::uri($this->url) === false) { // TRANS: Client exception thrown when trying to post an event with an invalid URL. throw new ClientException(_m('URL must be valid.')); } From 945bdf649be19962dc9f578036dcc83fe334ee9c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 17 Sep 2011 17:00:30 -0400 Subject: [PATCH 04/32] show correct favorites link --- lib/popularnoticesection.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/popularnoticesection.php b/lib/popularnoticesection.php index f6f27c6878..e66df8f423 100644 --- a/lib/popularnoticesection.php +++ b/lib/popularnoticesection.php @@ -69,6 +69,12 @@ class PopularNoticeSection extends NoticeSection function moreUrl() { - return common_local_url('favorited'); + if (common_config('singleuser', 'enabled')) { + $user = User::singleUser(); + common_local_url('showfavorites', array('nickname' => + $user->nickname)); + } else { + return common_local_url('favorited'); + } } } From f52d33753e1382b598763d617e762b328b6b4aff Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 17 Sep 2011 17:28:01 -0400 Subject: [PATCH 05/32] problem with remote subscription on groups in OStatus --- plugins/OStatus/OStatusPlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 360aaa0c0a..15d0abaa51 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -246,7 +246,7 @@ class OStatusPlugin extends Plugin $cur = common_current_user(); if (empty($cur)) { - $output->elementStart('li', 'entity_subscribe'); + $widget->out->elementStart('li', 'entity_subscribe'); $profile = $peopletag->getTagger(); $url = common_local_url('ostatusinit', array('group' => $group->nickname)); @@ -255,7 +255,7 @@ class OStatusPlugin extends Plugin // TRANS: Link to subscribe to a remote entity. _m('Subscribe')); - $output->elementEnd('li'); + $widget->out->elementEnd('li'); return false; } From 4467615021fad00ab92df0a79a9a792cbcb7280e Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 14:38:47 -0700 Subject: [PATCH 06/32] Fix reference to constant --- plugins/Realtime/RealtimePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index d2172dcf8d..3d6302c4e4 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -188,7 +188,7 @@ class RealtimePlugin extends Plugin // Add to the public timeline if ($notice->is_local == Notice::LOCAL_PUBLIC || - ($notice->is_local == Notice::REMOTE_OMB && !common_config('public', 'localonly'))) { + ($notice->is_local == Notice::REMOTE && !common_config('public', 'localonly'))) { $paths[] = array('public', null, null); } From 6c43967e8c2bad93e00e1ac98aa2cf4f2ef978b5 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 14:47:35 -0700 Subject: [PATCH 07/32] Don't allow Twitter registration if site is invite only --- .../TwitterBridge/twitterauthorization.php | 65 ++++++++++--------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index 22d7a7fbdc..410f10ff90 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -385,41 +385,44 @@ class TwitterauthorizationAction extends Action $this->hidden('tw_fields_screen_name', $this->tw_fields['screen_name']); $this->hidden('tw_fields_name', $this->tw_fields['fullname']); - $this->elementStart('fieldset'); - $this->hidden('token', common_session_token()); - $this->element('legend', null, - // TRANS: Fieldset legend. - _m('Create new account')); - $this->element('p', null, - // TRANS: Sub form introduction text. - _m('Create a new user with this nickname.')); - $this->elementStart('ul', 'form_data'); + // Don't allow new account creation if site is flagged as invite only + if (common_config('site', 'inviteonly') == false) { + $this->elementStart('fieldset'); + $this->hidden('token', common_session_token()); + $this->element('legend', null, + // TRANS: Fieldset legend. + _m('Create new account')); + $this->element('p', null, + // TRANS: Sub form introduction text. + _m('Create a new user with this nickname.')); + $this->elementStart('ul', 'form_data'); - // Hook point for captcha etc - Event::handle('StartRegistrationFormData', array($this)); + // Hook point for captcha etc + Event::handle('StartRegistrationFormData', array($this)); - $this->elementStart('li'); - // TRANS: Field label. - $this->input('newname', _m('New nickname'), - ($this->username) ? $this->username : '', - // TRANS: Field title for nickname field. - _m('1-64 lowercase letters or numbers, no punctuation or spaces.')); - $this->elementEnd('li'); - $this->elementStart('li'); - // TRANS: Field label. - $this->input('email', _m('LABEL','Email'), $this->getEmail(), - // TRANS: Field title for e-mail address field. - _m('Used only for updates, announcements, '. - 'and password recovery')); - $this->elementEnd('li'); + $this->elementStart('li'); + // TRANS: Field label. + $this->input('newname', _m('New nickname'), + ($this->username) ? $this->username : '', + // TRANS: Field title for nickname field. + _m('1-64 lowercase letters or numbers, no punctuation or spaces.')); + $this->elementEnd('li'); + $this->elementStart('li'); + // TRANS: Field label. + $this->input('email', _m('LABEL','Email'), $this->getEmail(), + // TRANS: Field title for e-mail address field. + _m('Used only for updates, announcements, '. + 'and password recovery')); + $this->elementEnd('li'); - // Hook point for captcha etc - Event::handle('EndRegistrationFormData', array($this)); + // Hook point for captcha etc + Event::handle('EndRegistrationFormData', array($this)); - $this->elementEnd('ul'); - // TRANS: Button text for creating a new StatusNet account in the Twitter connect page. - $this->submit('create', _m('BUTTON','Create')); - $this->elementEnd('fieldset'); + $this->elementEnd('ul'); + // TRANS: Button text for creating a new StatusNet account in the Twitter connect page. + $this->submit('create', _m('BUTTON','Create')); + $this->elementEnd('fieldset'); + } $this->elementStart('fieldset'); $this->element('legend', null, From 5c0e8d2a2f3e55b7315511e806f40b6dea69f9ea Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 17 Sep 2011 18:20:08 -0400 Subject: [PATCH 08/32] fix link for mobile profile when in singleuser mode --- plugins/MobileProfile/MobileProfilePlugin.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index bc25b340e9..e6bc444ea4 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -293,8 +293,16 @@ class MobileProfilePlugin extends WAP20Plugin function _showLogo($action) { $action->elementStart('address', 'vcard'); + if (common_config('singleuser', 'enabled')) { + $user = User::singleUser(); + $url = common_local_url('showstream', array('nickname' => $user->nickname)); + } else { + $url = common_local_url('public'); + } + $action->elementStart('a', array('class' => 'url home bookmark', - 'href' => common_local_url('public'))); + 'href' => $url)); + if (common_config('site', 'mobilelogo') || file_exists(Theme::file('logo.png')) || file_exists(Theme::file('mobilelogo.png'))) { From be95dcf008c40d27f8bf34d18b56a8e25bc93d9d Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 15:43:21 -0700 Subject: [PATCH 09/32] Move license checkbox to the end of the form --- .../TwitterBridge/twitterauthorization.php | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index 410f10ff90..7a07e4690b 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -357,28 +357,7 @@ class TwitterauthorizationAction extends Action $this->elementStart('fieldset', array('id' => 'settings_twitter_connect_options')); // TRANS: Fieldset legend. $this->element('legend', null, _m('Connection options')); - $this->elementStart('ul', 'form_data'); - $this->elementStart('li'); - $this->element('input', array('type' => 'checkbox', - 'id' => 'license', - 'class' => 'checkbox', - 'name' => 'license', - 'value' => 'true')); - $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license')); - // TRANS: Text for license agreement checkbox. - // TRANS: %s is the license as configured for the StatusNet site. - $message = _m('My text and files are available under %s ' . - 'except this private data: password, ' . - 'email address, IM address, and phone number.'); - $link = '' . - htmlspecialchars(common_config('license', 'title')) . - ''; - $this->raw(sprintf(htmlspecialchars($message), $link)); - $this->elementEnd('label'); - $this->elementEnd('li'); - $this->elementEnd('ul'); + $this->hidden('access_token_key', $this->access_token->key); $this->hidden('access_token_secret', $this->access_token->secret); $this->hidden('twuid', $this->twuid); @@ -445,6 +424,34 @@ class TwitterauthorizationAction extends Action $this->submit('connect', _m('BUTTON','Connect')); $this->elementEnd('fieldset'); + $this->elementStart('fieldset'); + $this->element('legend', null, + // TRANS: Fieldset legend. + _m('License')); + $this->elementStart('ul', 'form_data'); + $this->elementStart('li'); + $this->element('input', array('type' => 'checkbox', + 'id' => 'license', + 'class' => 'checkbox', + 'name' => 'license', + 'value' => 'true')); + $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license')); + // TRANS: Text for license agreement checkbox. + // TRANS: %s is the license as configured for the StatusNet site. + $message = _m('My text and files are available under %s ' . + 'except this private data: password, ' . + 'email address, IM address, and phone number.'); + $link = '' . + htmlspecialchars(common_config('license', 'title')) . + ''; + $this->raw(sprintf(htmlspecialchars($message), $link)); + $this->elementEnd('label'); + $this->elementEnd('li'); + $this->elementEnd('ul'); + $this->elementEnd('fieldset'); + $this->elementEnd('fieldset'); $this->elementEnd('form'); } From 2df2d4fd1d3dd32d6040e254e041316e986fefe6 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 15:45:55 -0700 Subject: [PATCH 10/32] Move submit (connect) button to the very bottom --- plugins/TwitterBridge/twitterauthorization.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index 7a07e4690b..baaf4a1af7 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -420,8 +420,6 @@ class TwitterauthorizationAction extends Action $this->password('password', _m('Password')); $this->elementEnd('li'); $this->elementEnd('ul'); - // TRANS: Button text for connecting an existing StatusNet account in the Twitter connect page.. - $this->submit('connect', _m('BUTTON','Connect')); $this->elementEnd('fieldset'); $this->elementStart('fieldset'); @@ -451,7 +449,8 @@ class TwitterauthorizationAction extends Action $this->elementEnd('li'); $this->elementEnd('ul'); $this->elementEnd('fieldset'); - + // TRANS: Button text for connecting an existing StatusNet account in the Twitter connect page.. + $this->submit('connect', _m('BUTTON','Connect')); $this->elementEnd('fieldset'); $this->elementEnd('form'); } From d4ed6db1d87a8109529554bca1f39417907ffe0f Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 15:50:13 -0700 Subject: [PATCH 11/32] Make sure the session token gets output no matter what (whoops) --- plugins/TwitterBridge/twitterauthorization.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index baaf4a1af7..1a7234214e 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -363,11 +363,11 @@ class TwitterauthorizationAction extends Action $this->hidden('twuid', $this->twuid); $this->hidden('tw_fields_screen_name', $this->tw_fields['screen_name']); $this->hidden('tw_fields_name', $this->tw_fields['fullname']); + $this->hidden('token', common_session_token()); // Don't allow new account creation if site is flagged as invite only if (common_config('site', 'inviteonly') == false) { $this->elementStart('fieldset'); - $this->hidden('token', common_session_token()); $this->element('legend', null, // TRANS: Fieldset legend. _m('Create new account')); From 13e1fab919bff215808e7d4670dacb5eb0450f19 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 10:59:01 -0400 Subject: [PATCH 12/32] be more careful with returned table def for schema --- lib/schema.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/schema.php b/lib/schema.php index aad705a533..0ac2255f16 100644 --- a/lib/schema.php +++ b/lib/schema.php @@ -107,9 +107,11 @@ class Schema { $td = $this->getTableDef($table); - foreach ($td->columns as $cd) { - if ($cd->name == $column) { - return $cd; + if (!empty($td) && !empty($td->columns)) { + foreach ($td->columns as $cd) { + if ($cd->name == $column) { + return $cd; + } } } From 7c1d73ed3da8b594bd5cede99f41d3c7bb2734a7 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 12:07:59 -0400 Subject: [PATCH 13/32] Sitemap plugin no longer forces an index on user.created --- plugins/Sitemap/SitemapPlugin.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/plugins/Sitemap/SitemapPlugin.php b/plugins/Sitemap/SitemapPlugin.php index 36041cfc9a..e7711fb339 100644 --- a/plugins/Sitemap/SitemapPlugin.php +++ b/plugins/Sitemap/SitemapPlugin.php @@ -196,12 +196,6 @@ class SitemapPlugin extends Plugin null, false), new ColumnDef('modified', 'timestamp'))); - $userCreated = $schema->getColumnDef('user', 'created'); - - if (empty($userCreated) || $userCreated->key != 'MUL') { - $schema->createIndex('user', 'created'); - } - return true; } From 3d4ea0a71f71c9573f4789cdebedbdbae3732413 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 12:14:43 -0400 Subject: [PATCH 14/32] Correct the routes for notice and user sitemaps --- plugins/Sitemap/SitemapPlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Sitemap/SitemapPlugin.php b/plugins/Sitemap/SitemapPlugin.php index e7711fb339..29b822acd5 100644 --- a/plugins/Sitemap/SitemapPlugin.php +++ b/plugins/Sitemap/SitemapPlugin.php @@ -108,14 +108,14 @@ class SitemapPlugin extends Plugin $m->connect('sitemapindex.xml', array('action' => 'sitemapindex')); - $m->connect('/notice-sitemap-:year-:month-:day-:index.xml', + $m->connect('notice-sitemap-:year-:month-:day-:index.xml', array('action' => 'noticesitemap'), array('year' => '[0-9]{4}', 'month' => '[01][0-9]', 'day' => '[0123][0-9]', 'index' => '[1-9][0-9]*')); - $m->connect('/user-sitemap-:year-:month-:day-:index.xml', + $m->connect('user-sitemap-:year-:month-:day-:index.xml', array('action' => 'usersitemap'), array('year' => '[0-9]{4}', 'month' => '[01][0-9]', From 951601633bdfec4da55a559c522a4d2923600b71 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 12:33:35 -0400 Subject: [PATCH 15/32] better handling of tagged notice streams --- actions/showstream.php | 27 +++++++++++++++++++++------ lib/taggedprofilenoticestream.php | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/actions/showstream.php b/actions/showstream.php index ee8bc18e72..ccd976a0e3 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -55,6 +55,25 @@ require_once INSTALLDIR.'/lib/feedlist.php'; */ class ShowstreamAction extends ProfileAction { + var $notice; + + function prepare($args) + { + parent::prepare($args); + + $p = Profile::current(); + + if (empty($this->tag)) { + $stream = new ProfileNoticeStream($this->profile, $p); + } else { + $stream = new TaggedProfileNoticeStream($this->profile, $this->tag, $p); + } + + $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); + + return true; + } + function isReadOnly($args) { return true; @@ -224,13 +243,9 @@ class ShowstreamAction extends ProfileAction function showNotices() { - $notice = empty($this->tag) - ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1) - : $this->user->getTaggedNotices($this->tag, ($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null); - $pnl = null; - if (Event::handle('ShowStreamNoticeList', array($notice, $this, &$pnl))) { - $pnl = new ProfileNoticeList($notice, $this); + if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) { + $pnl = new ProfileNoticeList($this->notice, $this); } $cnt = $pnl->show(); if (0 == $cnt) { diff --git a/lib/taggedprofilenoticestream.php b/lib/taggedprofilenoticestream.php index 9998b7d769..eec20cd8c6 100644 --- a/lib/taggedprofilenoticestream.php +++ b/lib/taggedprofilenoticestream.php @@ -47,7 +47,7 @@ if (!defined('STATUSNET')) { class TaggedProfileNoticeStream extends ScopingNoticeStream { - function __construct($profile, $tag, $userProfile) + function __construct($profile, $tag, $userProfile=-1) { if (is_int($userProfile) && $userProfile == -1) { $userProfile = Profile::current(); From b0667ea6d41a9f73ff53168f35fb3713c4fb4a2b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 12:37:14 -0400 Subject: [PATCH 16/32] correct source for createsim notices --- scripts/createsim.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/createsim.php b/scripts/createsim.php index 64ad907cb0..21ed38fd56 100644 --- a/scripts/createsim.php +++ b/scripts/createsim.php @@ -149,7 +149,7 @@ function newNotice($i, $tagmax) $options['scope'] |= Notice::SITE_SCOPE; } - $notice = Notice::saveNew($user->id, $content, 'system', $options); + $notice = Notice::saveNew($user->id, $content, 'createsim', $options); } function newSub($i) From 01ea6a18f91392dc9a1a9dcc291c5ab9a026a023 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 12:40:17 -0400 Subject: [PATCH 17/32] make activity plugin use its own notice source --- plugins/Activity/ActivityPlugin.php | 2 +- theme/base/css/display.css | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/Activity/ActivityPlugin.php b/plugins/Activity/ActivityPlugin.php index 5801c194a6..0c7700d787 100644 --- a/plugins/Activity/ActivityPlugin.php +++ b/plugins/Activity/ActivityPlugin.php @@ -47,7 +47,7 @@ if (!defined('STATUSNET')) { class ActivityPlugin extends Plugin { const VERSION = '0.1'; - const SOURCE = 'system'; + const SOURCE = 'activity'; // Flags to switch off certain activity notices public $StartFollowUser = true; diff --git a/theme/base/css/display.css b/theme/base/css/display.css index f5638e58ab..75e48c0958 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -1502,16 +1502,16 @@ content:'☠'; font-size:150%; } -#content .notice-source-system div.entry-title, .notice-source-system div.entry-content { +#content .notice-source-activity div.entry-title, .notice-source-activity div.entry-content { margin-left: 0; } -#content .notice-source-system div.entry-title { +#content .notice-source-activity div.entry-title { font-style: italic; min-height: 0; } -#content .notice-source-system .notice div.entry-title { +#content .notice-source-activity .notice div.entry-title { font-style: normal; } From 915dd9c9b55e3401dfd00924dd0ea5d8b3bcf4e4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 12:44:16 -0400 Subject: [PATCH 18/32] Copy-and-paste error in OStatus button output --- plugins/OStatus/OStatusPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 15d0abaa51..78408365df 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -247,7 +247,7 @@ class OStatusPlugin extends Plugin if (empty($cur)) { $widget->out->elementStart('li', 'entity_subscribe'); - $profile = $peopletag->getTagger(); + $url = common_local_url('ostatusinit', array('group' => $group->nickname)); $widget->out->element('a', array('href' => $url, From 06f19d523a381de2f782dadfd86380fa5f9cb6a6 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 12:52:00 -0400 Subject: [PATCH 19/32] inverted if() in RealtimePlugin check for tag --- plugins/Realtime/RealtimePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 3d6302c4e4..a4bcb8d803 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -475,7 +475,7 @@ class RealtimePlugin extends Plugin break; case 'tag': $tag = $action->trimmed('tag'); - if (empty($tag)) { + if (!empty($tag)) { $arg1 = $tag; } else { $this->log(LOG_NOTICE, "Unexpected 'tag' action without tag argument"); From be4e3593f58c8b5d39544b94b9492b452b1cba60 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 12:52:38 -0400 Subject: [PATCH 20/32] declare attributes of TagAction --- actions/tag.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/actions/tag.php b/actions/tag.php index 33339cb8bf..e0cb9783d1 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -23,6 +23,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class TagAction extends Action { var $notice; + var $tag; + var $page; function prepare($args) { From e43ea4c9f5cc18015f7ba1953573930f2d67e960 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 13:03:12 -0400 Subject: [PATCH 21/32] fix RealtimePlugin root hack hack --- plugins/Realtime/RealtimePlugin.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index a4bcb8d803..287e48e484 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -294,9 +294,18 @@ class RealtimePlugin extends Plugin // root url from page output $action->elementStart('address'); + + if (common_config('singleuser', 'enabled')) { + $user = User::singleUser(); + $url = common_local_url('showstream', array('nickname' => $user->nickname)); + } else { + $url = common_local_url('public'); + } + $action->element('a', array('class' => 'url', - 'href' => common_local_url('public')), + 'href' => $url), ''); + $action->elementEnd('address'); $action->showContentBlock(); From 75bdc37b619fa125e04e0d1dbafd32a54024a0a7 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 14:06:27 -0400 Subject: [PATCH 22/32] Correct args for join event --- .../SubscriptionThrottlePlugin.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/SubscriptionThrottle/SubscriptionThrottlePlugin.php b/plugins/SubscriptionThrottle/SubscriptionThrottlePlugin.php index 829219af20..9e6fc9cab7 100644 --- a/plugins/SubscriptionThrottle/SubscriptionThrottlePlugin.php +++ b/plugins/SubscriptionThrottle/SubscriptionThrottlePlugin.php @@ -81,15 +81,15 @@ class SubscriptionThrottlePlugin extends Plugin /** * Filter group joins to see if they're coming too fast. * - * @param Group $group The group being joined - * @param User $user The user joining + * @param Group $group The group being joined + * @param Profile $profile The profile joining * * @return boolean hook value */ - function onStartJoinGroup($group, $user) + function onStartJoinGroup($group, $profile) { foreach ($this->groupLimits as $seconds => $limit) { - $mem = $this->_getNthMem($user, $limit); + $mem = $this->_getNthMem($profile, $limit); if (!empty($mem)) { $jointime = strtotime($mem->created); @@ -130,16 +130,16 @@ class SubscriptionThrottlePlugin extends Plugin /** * Get the Nth most recent group membership for this user * - * @param User $user The user to get memberships for - * @param integer $n How far to count back + * @param Profile $profile The user to get memberships for + * @param integer $n How far to count back * * @return Group_member a membership or null */ - private function _getNthMem($user, $n) + private function _getNthMem($profile, $n) { $mem = new Group_member(); - $mem->profile_id = $user->id; + $mem->profile_id = $profile->id; $mem->orderBy('created DESC'); $mem->limit($n - 1, 1); From 2f1953ca257ed3d65701357b9535daa691ea6494 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 14:06:35 -0400 Subject: [PATCH 23/32] Correct args for join event --- plugins/OStatus/OStatusPlugin.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 78408365df..a7179eb47a 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -752,11 +752,11 @@ class OStatusPlugin extends Plugin * deny the join. * * @param User_group $group - * @param User $user + * @param Profile $profile * * @return mixed hook return value */ - function onStartJoinGroup($group, $user) + function onStartJoinGroup($group, $profile) { $oprofile = Ostatus_profile::staticGet('group_id', $group->id); if ($oprofile) { @@ -768,15 +768,13 @@ class OStatusPlugin extends Plugin // NOTE: we don't use Group_member::asActivity() since that record // has not yet been created. - $member = Profile::staticGet($user->id); - $act = new Activity(); $act->id = TagURI::mint('join:%d:%d:%s', - $member->id, + $profile->id, $group->id, common_date_iso8601(time())); - $act->actor = ActivityObject::fromProfile($member); + $act->actor = ActivityObject::fromProfile($profile); $act->verb = ActivityVerb::JOIN; $act->object = $oprofile->asActivityObject(); @@ -786,10 +784,10 @@ class OStatusPlugin extends Plugin // TRANS: Success message for subscribe to group attempt through OStatus. // TRANS: %1$s is the member name, %2$s is the subscribed group's name. $act->content = sprintf(_m('%1$s has joined group %2$s.'), - $member->getBestName(), + $profile->getBestName(), $oprofile->getBestName()); - if ($oprofile->notifyActivity($act, $member)) { + if ($oprofile->notifyActivity($act, $profile)) { return true; } else { $oprofile->garbageCollect(); @@ -809,7 +807,7 @@ class OStatusPlugin extends Plugin * it'll be left with a stray membership record. * * @param User_group $group - * @param Profile $user + * @param Profile $profile * * @return mixed hook return value */ From dbb7324b251af3b85b8025b19ad1c28bd81ef315 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 14:36:49 -0400 Subject: [PATCH 24/32] test for missing profile in ostatus queue handler --- plugins/OStatus/lib/ostatusqueuehandler.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/OStatus/lib/ostatusqueuehandler.php b/plugins/OStatus/lib/ostatusqueuehandler.php index 568e8fe391..f5284057e3 100644 --- a/plugins/OStatus/lib/ostatusqueuehandler.php +++ b/plugins/OStatus/lib/ostatusqueuehandler.php @@ -53,6 +53,13 @@ class OStatusQueueHandler extends QueueHandler $this->notice = $notice; $this->user = User::staticGet('id', $notice->profile_id); + try { + $profile = $this->notice->getProfile(); + } catch (Exception $e) { + common_log(LOG_ERR, "Can't get profile for notice; skipping: " . $e->getMessage()); + return true; + } + $this->pushUser(); foreach ($notice->getGroups() as $group) { From 116840a80e6d7e55084cb8afe89a1f932b44eb5a Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sun, 18 Sep 2011 13:35:09 -0700 Subject: [PATCH 25/32] Reorder directory router connections / fix regex --- plugins/Directory/DirectoryPlugin.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/Directory/DirectoryPlugin.php b/plugins/Directory/DirectoryPlugin.php index 06cfca02ef..5979bb0e80 100644 --- a/plugins/Directory/DirectoryPlugin.php +++ b/plugins/Directory/DirectoryPlugin.php @@ -115,21 +115,20 @@ class DirectoryPlugin extends Plugin { $m->connect( - 'directory/users', + 'directory/users/:filter', array('action' => 'userdirectory'), - array('filter' => 'all') + array('filter' => '[0-9a-zA-Z]|(0-9)') ); $m->connect( - 'directory/users/:filter', - array('action' => 'userdirectory'), - array('filter' => '([0-9a-zA-Z_]{1,64}|0-9)') + 'directory/users', + array('action' => 'userdirectory') ); $m->connect( 'groups/:filter', array('action' => 'groupdirectory'), - array('filter' => '([0-9a-zA-Z_]{1,64}|0-9)') + array('filter' => '[0-9a-zA-Z]|(0-9)') ); $m->connect( From 3bf3b6686c699292fb86c9d24658eab0ce5beb71 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sun, 18 Sep 2011 14:17:41 -0700 Subject: [PATCH 26/32] Remove fulltext indexes from notice and profile tables. The default for fulltext search is 'like' (MySQLLikeSearch) which doesn't require them. --- classes/Notice.php | 3 --- classes/Profile.php | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index e34dab549f..a38f54f050 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -127,9 +127,6 @@ class Notice extends Managed_DataObject 'notice_created_idx' => array('created'), 'notice_replyto_idx' => array('reply_to'), 'notice_repeatof_idx' => array('repeat_of'), - ), - 'fulltext indexes' => array( - 'content' => array('content'), ) ); } diff --git a/classes/Profile.php b/classes/Profile.php index 5ace57004c..8cea91ece6 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -72,10 +72,7 @@ class Profile extends Managed_DataObject 'primary key' => array('id'), 'indexes' => array( 'profile_nickname_idx' => array('nickname'), - ), - 'fulltext indexes' => array( - 'nickname' => array('nickname', 'fullname', 'location', 'bio', 'homepage') - ), + ) ); } From 52ed4678f307723c556df6375466e70f0f53a417 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 17:32:13 -0400 Subject: [PATCH 27/32] correct link for searchsubs --- plugins/SearchSub/SearchSubPlugin.php | 1 - plugins/SearchSub/searchsubmenu.php | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/SearchSub/SearchSubPlugin.php b/plugins/SearchSub/SearchSubPlugin.php index 600dae6c16..858474240e 100644 --- a/plugins/SearchSub/SearchSubPlugin.php +++ b/plugins/SearchSub/SearchSubPlugin.php @@ -108,7 +108,6 @@ class SearchSubPlugin extends Plugin $m->connect('search/:search/unsubscribe', array('action' => 'searchunsub'), array('search' => Router::REGEX_TAG)); - $m->connect(':nickname/search-subscriptions', array('action' => 'searchsubs'), array('nickname' => Nickname::DISPLAY_FMT)); diff --git a/plugins/SearchSub/searchsubmenu.php b/plugins/SearchSub/searchsubmenu.php index 5973eb8b93..2aabb7a5a6 100644 --- a/plugins/SearchSub/searchsubmenu.php +++ b/plugins/SearchSub/searchsubmenu.php @@ -92,9 +92,12 @@ class SearchSubMenu extends MoreMenu $id = $this->menuItemID($actionName, $args); } - // Add 'q' as a search param, not part of the url path - - $url = common_local_url($actionName, array(), $args); + if ($actionname == 'searchsub') { + // Add 'q' as a search param, not part of the url path + $url = common_local_url($actionName, array(), $args); + } else { + $url = common_local_url($actionName, $args); + } $this->out->menuItem($url, $label, From bba39c4aafbba02f4e1a35af5b6aae063ffe8bec Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 17:32:59 -0400 Subject: [PATCH 28/32] reorder routes for ostatus for better matches --- plugins/OStatus/OStatusPlugin.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index a7179eb47a..dfdec36899 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -54,19 +54,19 @@ class OStatusPlugin extends Plugin // Discovery actions $m->connect('main/ownerxrd', array('action' => 'ownerxrd')); - $m->connect('main/ostatus', - array('action' => 'ostatusinit')); $m->connect('main/ostatustag', array('action' => 'ostatustag')); $m->connect('main/ostatustag?nickname=:nickname', array('action' => 'ostatustag'), array('nickname' => '[A-Za-z0-9_-]+')); - $m->connect('main/ostatus?nickname=:nickname', + $m->connect('main/ostatus/nickname/:nickname', array('action' => 'ostatusinit'), array('nickname' => '[A-Za-z0-9_-]+')); - $m->connect('main/ostatus?group=:group', + $m->connect('main/ostatus/group/:group', array('action' => 'ostatusinit'), array('group' => '[A-Za-z0-9_-]+')); - $m->connect('main/ostatus?peopletag=:peopletag&tagger=:tagger', + $m->connect('main/ostatus/peopletag/:peopletag/tagger/:tagger', array('action' => 'ostatusinit'), array('tagger' => '[A-Za-z0-9_-]+', 'peopletag' => '[A-Za-z0-9_-]+')); + $m->connect('main/ostatus', + array('action' => 'ostatusinit')); // Remote subscription actions $m->connect('main/ostatussub', @@ -251,7 +251,7 @@ class OStatusPlugin extends Plugin $url = common_local_url('ostatusinit', array('group' => $group->nickname)); $widget->out->element('a', array('href' => $url, - 'class' => 'entity_remote_subscribe'), + 'class' => 'entity_remote_subscribe'), // TRANS: Link to subscribe to a remote entity. _m('Subscribe')); From cf2457f03f1a3c49d4c4890fa89fdfc396df8995 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 17:33:25 -0400 Subject: [PATCH 29/32] correct link for apitimelinegroup --- actions/apitimelinegroup.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index 136d41bb99..5a0ea60c7e 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -106,10 +106,8 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction $self = $this->getSelfUri(); - $link = common_local_url( - 'ApiTimelineGroup', - array('nickname' => $this->group->nickname) - ); + $link = common_local_url('showgroup', + array('nickname' => $this->group->nickname)); switch($this->format) { case 'xml': From 3eaa3234f9bd7f6e2361b32c1dd481023398850e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 17:54:48 -0400 Subject: [PATCH 30/32] Drop fulltext indexes that aren't used in new def --- lib/schema.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/schema.php b/lib/schema.php index 0ac2255f16..e188037e68 100644 --- a/lib/schema.php +++ b/lib/schema.php @@ -562,12 +562,18 @@ class Schema $uniques = $this->diffArrays($old, $def, 'unique keys'); $indexes = $this->diffArrays($old, $def, 'indexes'); $foreign = $this->diffArrays($old, $def, 'foreign keys'); + $fulltext = $this->diffArrays($old, $def, 'fulltext indexes'); // Drop any obsolete or modified indexes ahead... foreach ($indexes['del'] + $indexes['mod'] as $indexName) { $this->appendDropIndex($statements, $tableName, $indexName); } + // Drop any obsolete or modified fulltext indexes ahead... + foreach ($fulltext['del'] + $fulltext['mod'] as $indexName) { + $this->appendDropIndex($statements, $tableName, $indexName); + } + // For efficiency, we want this all in one // query, instead of using our methods. From 5b0192a8acf74874e76ddbf4663b99fd9da66307 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 18:28:14 -0400 Subject: [PATCH 31/32] default search engine is actually LIKE --- CONFIGURE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONFIGURE b/CONFIGURE index 0a3579885c..3f0ae668ab 100644 --- a/CONFIGURE +++ b/CONFIGURE @@ -646,7 +646,7 @@ search Some stuff for search. type: type of search. Ignored if PostgreSQL or Sphinx are enabled. Can either - be 'fulltext' (default) or 'like'. The former is faster and more efficient + be 'fulltext' or 'like' (default). The former is faster and more efficient but requires the lame old MyISAM engine for MySQL. The latter will work with InnoDB but could be miserably slow on large systems. We'll probably add another type sometime in the future, From 48625da04b8ab5865c31aef38033b94bf8cfa983 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 18:28:44 -0400 Subject: [PATCH 32/32] Automatically add or drop fulltext indexes --- classes/Notice.php | 8 +++++++- classes/Profile.php | 10 +++++++++- lib/schema.php | 5 +++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index a38f54f050..ce6464c157 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -87,7 +87,7 @@ class Notice extends Managed_DataObject public static function schemaDef() { - return array( + $def = array( 'fields' => array( 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'who made the update'), @@ -129,6 +129,12 @@ class Notice extends Managed_DataObject 'notice_repeatof_idx' => array('repeat_of'), ) ); + + if (common_config('search', 'type') == 'fulltext') { + $def['fulltext indexes'] = array('content' => array('content')); + } + + return $def; } function multiGet($kc, $kvs, $skipNulls=true) diff --git a/classes/Profile.php b/classes/Profile.php index 8cea91ece6..b8178e9b66 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -51,7 +51,7 @@ class Profile extends Managed_DataObject public static function schemaDef() { - return array( + $def = array( 'description' => 'local and remote users have profiles', 'fields' => array( 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), @@ -74,6 +74,14 @@ class Profile extends Managed_DataObject 'profile_nickname_idx' => array('nickname'), ) ); + + // Add a fulltext index + + if (common_config('search', 'type') == 'fulltext') { + $def['fulltext indexes'] = array('nickname' => array('nickname', 'fullname', 'location', 'bio', 'homepage')); + } + + return $def; } function multiGet($keyCol, $keyVals, $skipNulls=true) diff --git a/lib/schema.php b/lib/schema.php index e188037e68..92555499ba 100644 --- a/lib/schema.php +++ b/lib/schema.php @@ -630,6 +630,11 @@ class Schema $this->appendCreateIndex($statements, $tableName, $indexName, $def['indexes'][$indexName]); } + foreach ($fulltext['mod'] + $fulltext['add'] as $indexName) { + $colDef = $def['fulltext indexes'][$indexName]; + $this->appendCreateFulltextIndex($statements, $tableName, $indexName, $colDef); + } + return $statements; }