From 6274c3977d25a1ca9313cc851230b9b520bd4197 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 8 Apr 2010 13:12:14 -0700 Subject: [PATCH 01/14] In single-user mode, link #hashtags to the user's tagged stream rather than the global tag action, which isn't registered. Previously they would end up pointing to the home URL. --- lib/util.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index 7959978683..e37df63484 100644 --- a/lib/util.php +++ b/lib/util.php @@ -862,7 +862,14 @@ function common_xml_safe_str($str) function common_tag_link($tag) { $canonical = common_canonical_tag($tag); - $url = common_local_url('tag', array('tag' => $canonical)); + if (common_config('singleuser', 'enabled')) { + // regular TagAction isn't set up in 1user mode + $url = common_local_url('showstream', + array('nickname' => common_config('singleuser', 'nickname'), + 'tag' => $canonical)); + } else { + $url = common_local_url('tag', array('tag' => $canonical)); + } $xs = new XMLStringer(); $xs->elementStart('span', 'tag'); $xs->element('a', array('href' => $url, From 05e373d29b91cf929d0ac2ad74a90dce264df022 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 8 Apr 2010 17:05:02 -0700 Subject: [PATCH 02/14] scripts/strip_geo.php to remove geodata from notices by a given user/profile. May be slow or run out of memory if run on particularly prolific posters -- not yet optimized for that case. Note that geodata that has already been sent out to other services (via ostatus, omb, twitter, etc) will not be removed from them. (fixed version -- previous had accidentally undone another commit) --- scripts/strip_geo.php | 116 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100755 scripts/strip_geo.php diff --git a/scripts/strip_geo.php b/scripts/strip_geo.php new file mode 100755 index 0000000000..010fb31f54 --- /dev/null +++ b/scripts/strip_geo.php @@ -0,0 +1,116 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'i::n::y'; +$longoptions = array('id=', 'nickname=', 'yes', 'dry-run'); + +$helptext = <<getProfile(); +} else { + print "You must provide either an ID or a nickname.\n\n"; + show_help(); + exit(1); +} + +if (!have_option('y', 'yes') && !have_option('--dry-run')) { + print "About to PERMANENTLY remove geolocation data from user '{$profile->nickname}' ({$profile->id})'s notices. Are you sure? [y/N] "; + $response = fgets(STDIN); + if (strtolower(trim($response)) != 'y') { + print "Aborting.\n"; + exit(0); + } +} + +// @fixme for a very prolific poster this could be too many. +print "Finding notices with geolocation data..."; +$notice = new Notice(); +$notice->profile_id = $profile->id; +$notice->whereAdd("lat != ''"); +$notice->find(); + +if ($notice->N) { + print " $notice->N found.\n"; + while ($notice->fetch()) { + print "notice id $notice->id "; + if (have_option('v') || have_option('--verbose')) { + print "({$notice->lat},{$notice->lon}) "; + if ($notice->location_ns) { + print "ns {$notice->location_ns} id {$notice->location_id} "; + } + } + if (have_option('--dry-run')) { + // sucka + echo "(skipped)"; + } else { + // note: setting fields to null and calling update() doesn't save the nulled fields + $orig = clone($notice); + $update = clone($notice); + + // In theory we could hit a chunk of notices at once in the UPDATE, + // but we're going to have to decache them individually anyway and + // it doesn't hurt to make sure we don't hold up replication with + // what might be a very slow single UPDATE. + $query = sprintf('UPDATE notice ' . + 'SET lat=NULL,lon=NULL,location_ns=NULL,location_id=NULL ' . + 'WHERE id=%d', $notice->id); + $ok = $update->query($query); + if ($ok) { + // And now we decache him manually, as query() doesn't know what we're doing... + $orig->blow(); + echo "(removed)"; + } else { + echo "(failed?)"; + } + } + print "\n"; + } +} else { + print " none found.\n"; +} + +print "DONE.\n"; From a93d0dc16af0438af59d14f8413dabb80c13b707 Mon Sep 17 00:00:00 2001 From: Christopher Vollick Date: Fri, 9 Apr 2010 06:03:53 -0400 Subject: [PATCH 03/14] Undefined Variable in foafgroup.php Probably just left over from the past. --- actions/foafgroup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/foafgroup.php b/actions/foafgroup.php index d685554ac4..07cca31811 100644 --- a/actions/foafgroup.php +++ b/actions/foafgroup.php @@ -56,7 +56,7 @@ class FoafGroupAction extends Action return false; } - $local = Local_group::staticGet('nickname', $nickname); + $local = Local_group::staticGet('nickname', $this->nickname); if (!$local) { $this->clientError(_('No such group.'), 404); From 7baf671570b1190c54c9b7e763fdaf0ab454b6a7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 9 Apr 2010 08:36:13 -0700 Subject: [PATCH 04/14] Avoid E_NOTICE spew when listing group members who aren't admins --- actions/foafgroup.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actions/foafgroup.php b/actions/foafgroup.php index 07cca31811..4db40c28be 100644 --- a/actions/foafgroup.php +++ b/actions/foafgroup.php @@ -126,7 +126,8 @@ class FoafGroupAction extends Action while ($members->fetch()) { $member_uri = common_local_url('userbyid', array('id'=>$members->id)); $member_details[$member_uri] = array( - 'nickname' => $members->nickname + 'nickname' => $members->nickname, + 'is_admin' => false, ); $this->element('member', array('rdf:resource' => $member_uri)); } From 41062d387f2e163fd023bbafadfcb10072c068ec Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 9 Apr 2010 08:56:43 -0700 Subject: [PATCH 05/14] Fix localization for license notice in page footer (for ticket #2274: i18n cleanup) --- lib/action.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/action.php b/lib/action.php index 09113a598e..0fc3a0dc43 100644 --- a/lib/action.php +++ b/lib/action.php @@ -845,14 +845,16 @@ class Action extends HTMLOutputter // lawsuit 'width' => '80', 'height' => '15')); $this->text(' '); - //TODO: This is dirty: i18n - $this->text(_('All '.common_config('site', 'name').' content and data are available under the ')); - $this->element('a', array('class' => 'license', - 'rel' => 'external license', - 'href' => common_config('license', 'url')), - common_config('license', 'title')); - $this->text(' '); - $this->text(_('license.')); + // TRANS: license message in footer. %1$s is the site name, %2$s is a link to the license URL, with a licence name set in configuration. + $notice = _('All %1$s content and data are available under the %2$s license.'); + $link = "" . + htmlspecialchars(common_config('license', 'title')) . + ""; + $this->raw(sprintf(htmlspecialchars($notice), + htmlspecialchars(common_config('site', 'name')), + $link)); $this->elementEnd('p'); break; } From 9cb0dab27036b237f9f325dc14c417e23fd475f7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 9 Apr 2010 10:46:18 -0700 Subject: [PATCH 06/14] Run block checks on remote OStatus replies --- classes/Notice.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/classes/Notice.php b/classes/Notice.php index be3e9ca2a6..b416e2ff28 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -964,11 +964,19 @@ class Notice extends Memcached_DataObject */ function saveKnownReplies($uris) { + if (empty($uris)) { + return; + } + $sender = Profile::staticGet($this->profile_id); + foreach ($uris as $uri) { $user = User::staticGet('uri', $uri); if (!empty($user)) { + if ($user->hasBlocked($sender)) { + continue; + } $reply = new Reply(); From 4e3fad4f0d20e843cf42c07026ecbdb5a566562a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 9 Apr 2010 14:11:18 -0400 Subject: [PATCH 07/14] fix attributes on homepage output --- actions/groupmembers.php | 4 ++++ actions/peopletag.php | 4 ++++ actions/subscribers.php | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/actions/groupmembers.php b/actions/groupmembers.php index fb4e46dbc0..e72ef371ac 100644 --- a/actions/groupmembers.php +++ b/actions/groupmembers.php @@ -240,9 +240,13 @@ class GroupMemberListItem extends ProfileListItem function homepageAttributes() { + $aAttrs = parent::linkAttributes(); + if (common_config('nofollow', 'members')) { $aAttrs['rel'] = 'nofollow'; } + + return $aAttrs; } } diff --git a/actions/peopletag.php b/actions/peopletag.php index 456cc21c4c..32652f7551 100644 --- a/actions/peopletag.php +++ b/actions/peopletag.php @@ -168,9 +168,13 @@ class PeopleTagListItem extends ProfileListItem function homepageAttributes() { + $aAttrs = parent::linkAttributes(); + if (common_config('nofollow', 'peopletag')) { $aAttrs['rel'] = 'nofollow'; } + + return $aAttrs; } } diff --git a/actions/subscribers.php b/actions/subscribers.php index 6dda7312d6..6f1520b3f4 100644 --- a/actions/subscribers.php +++ b/actions/subscribers.php @@ -177,8 +177,12 @@ class SubscribersListItem extends SubscriptionListItem function homepageAttributes() { + $aAttrs = parent::linkAttributes(); + if (common_config('nofollow', 'subscribers')) { $aAttrs['rel'] = 'nofollow'; } + + return $aAttrs; } } From b47fc9c0bcd9f37438d2aaeb7b5bc98183b554ea Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 9 Apr 2010 11:36:02 -0700 Subject: [PATCH 08/14] Fix for strip_geo's decaching; also added --all option to run over all notices by given profile to help in fixing up cache inconsistencies --- scripts/strip_geo.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/strip_geo.php b/scripts/strip_geo.php index 010fb31f54..b3f27be616 100755 --- a/scripts/strip_geo.php +++ b/scripts/strip_geo.php @@ -21,7 +21,7 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $shortoptions = 'i::n::y'; -$longoptions = array('id=', 'nickname=', 'yes', 'dry-run'); +$longoptions = array('id=', 'nickname=', 'yes', 'dry-run', 'all'); $helptext = <<profile_id = $profile->id; -$notice->whereAdd("lat != ''"); +if (have_option('--all')) { + print "Finding all notices by $profile->nickname..."; +} else { + print "Finding notices by $profile->nickname with geolocation data..."; + $notice->whereAdd("lat != ''"); +} $notice->find(); if ($notice->N) { @@ -101,10 +107,10 @@ if ($notice->N) { $ok = $update->query($query); if ($ok) { // And now we decache him manually, as query() doesn't know what we're doing... - $orig->blow(); + $orig->decache(); echo "(removed)"; } else { - echo "(failed?)"; + echo "(unchanged?)"; } } print "\n"; From 6fb60fb57f9ab604e1d77dc846eb48b978c31994 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 9 Apr 2010 11:36:51 -0700 Subject: [PATCH 09/14] Fix for conversation check in @-reply notification email; i18n cleanup on mail messages: fixed some bad gettext usage, added trans doc comments. --- classes/Notice.php | 21 +++++++++++++++++++++ lib/mail.php | 45 +++++++++++++++++++++++++++++++-------------- lib/noticelist.php | 13 +------------ 3 files changed, 53 insertions(+), 26 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index b416e2ff28..998e9c92ba 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -699,6 +699,27 @@ class Notice extends Memcached_DataObject return $ids; } + /** + * Is this notice part of an active conversation? + * + * @return boolean true if other messages exist in the same + * conversation, false if this is the only one + */ + function hasConversation() + { + if (!empty($this->conversation)) { + $conversation = Notice::conversationStream( + $this->conversation, + 1, + 1 + ); + if ($conversation->N > 0) { + return true; + } + } + return false; + } + /** * @param $groups array of Group *objects* * @param $recipients array of profile *ids* diff --git a/lib/mail.php b/lib/mail.php index 807b6a3633..c38d9f2f50 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -170,8 +170,10 @@ function mail_to_user(&$user, $subject, $body, $headers=array(), $address=null) function mail_confirm_address($user, $code, $nickname, $address) { + // TRANS: Subject for address confirmation email $subject = _('Email address confirmation'); + // TRANS: Body for address confirmation email. $body = sprintf(_("Hey, %s.\n\n". "Someone just entered this email address on %s.\n\n" . "If it was you, and you want to confirm your entry, ". @@ -237,11 +239,13 @@ function mail_subscribe_notify_profile($listenee, $other) $headers = _mail_prepare_headers('subscribe', $listenee->nickname, $other->nickname); $headers['From'] = mail_notify_from(); $headers['To'] = $name . ' <' . $listenee->email . '>'; + // TRANS: Subject of new-subscriber notification e-mail $headers['Subject'] = sprintf(_('%1$s is now listening to '. 'your notices on %2$s.'), $other->getBestName(), common_config('site', 'name')); + // TRANS: Main body of new-subscriber notification e-mail $body = sprintf(_('%1$s is now listening to your notices on %2$s.'."\n\n". "\t".'%3$s'."\n\n". '%4$s'. @@ -255,10 +259,13 @@ function mail_subscribe_notify_profile($listenee, $other) common_config('site', 'name'), $other->profileurl, ($other->location) ? + // TRANS: Profile info line in new-subscriber notification e-mail sprintf(_("Location: %s"), $other->location) . "\n" : '', ($other->homepage) ? + // TRANS: Profile info line in new-subscriber notification e-mail sprintf(_("Homepage: %s"), $other->homepage) . "\n" : '', ($other->bio) ? + // TRANS: Profile info line in new-subscriber notification e-mail sprintf(_("Bio: %s"), $other->bio) . "\n\n" : '', common_config('site', 'name'), common_local_url('emailsettings')); @@ -287,9 +294,11 @@ function mail_new_incoming_notify($user) $headers['From'] = $user->incomingemail; $headers['To'] = $name . ' <' . $user->email . '>'; + // TRANS: Subject of notification mail for new posting email address $headers['Subject'] = sprintf(_('New email address for posting to %s'), common_config('site', 'name')); + // TRANS: Body of notification mail for new posting email address $body = sprintf(_("You have a new posting address on %1\$s.\n\n". "Send email to %2\$s to post new messages.\n\n". "More email instructions at %3\$s.\n\n". @@ -414,6 +423,7 @@ function mail_send_sms_notice_address($notice, $smsemail, $incomingemail) $headers['From'] = ($incomingemail) ? $incomingemail : mail_notify_from(); $headers['To'] = $to; + // TRANS: Subject line for SMS-by-email notification messages $headers['Subject'] = sprintf(_('%s status'), $other->getBestName()); @@ -440,11 +450,11 @@ function mail_confirm_sms($code, $nickname, $address) $headers['From'] = mail_notify_from(); $headers['To'] = $nickname . ' <' . $address . '>'; + // TRANS: Subject line for SMS-by-email address confirmation message $headers['Subject'] = _('SMS confirmation'); - // FIXME: I18N - - $body = "$nickname: confirm you own this phone number with this code:"; + // TRANS: Main body heading for SMS-by-email address confirmation message + $body = sprintf(_("%s: confirm you own this phone number with this code:"), $nickname); $body .= "\n\n"; $body .= $code; $body .= "\n\n"; @@ -464,10 +474,12 @@ function mail_confirm_sms($code, $nickname, $address) function mail_notify_nudge($from, $to) { common_init_locale($to->language); + // TRANS: Subject for 'nudge' notification email $subject = sprintf(_('You\'ve been nudged by %s'), $from->nickname); $from_profile = $from->getProfile(); + // TRANS: Body for 'nudge' notification email $body = sprintf(_("%1\$s (%2\$s) is wondering what you are up to ". "these days and is inviting you to post some news.\n\n". "So let's hear from you :)\n\n". @@ -514,10 +526,12 @@ function mail_notify_message($message, $from=null, $to=null) } common_init_locale($to->language); + // TRANS: Subject for direct-message notification email $subject = sprintf(_('New private message from %s'), $from->nickname); $from_profile = $from->getProfile(); + // TRANS: Body for direct-message notification email $body = sprintf(_("%1\$s (%2\$s) sent you a private message:\n\n". "------------------------------------------------------\n". "%3\$s\n". @@ -565,8 +579,10 @@ function mail_notify_fave($other, $user, $notice) common_init_locale($other->language); + // TRANS: Subject for favorite notification email $subject = sprintf(_('%s (@%s) added your notice as a favorite'), $bestname, $user->nickname); + // TRANS: Body for favorite notification email $body = sprintf(_("%1\$s (@%7\$s) just added your notice from %2\$s". " as one of their favorites.\n\n" . "The URL of your notice is:\n\n" . @@ -622,24 +638,25 @@ function mail_notify_attn($user, $notice) common_init_locale($user->language); - if ($notice->conversation != $notice->id) { - $conversationEmailText = "The full conversation can be read here:\n\n". - "\t%5\$s\n\n "; - $conversationUrl = common_local_url('conversation', - array('id' => $notice->conversation)).'#notice-'.$notice->id; - } else { - $conversationEmailText = "%5\$s"; - $conversationUrl = null; - } + if ($notice->hasConversation()) { + $conversationUrl = common_local_url('conversation', + array('id' => $notice->conversation)).'#notice-'.$notice->id; + // TRANS: Line in @-reply notification e-mail. %s is conversation URL. + $conversationEmailText = sprintf(_("The full conversation can be read here:\n\n". + "\t%s"), $conversationUrl) . "\n\n"; + } else { + $conversationEmailText = ''; + } $subject = sprintf(_('%s (@%s) sent a notice to your attention'), $bestname, $sender->nickname); + // TRANS: Body of @-reply notification e-mail. $body = sprintf(_("%1\$s (@%9\$s) just sent a notice to your attention (an '@-reply') on %2\$s.\n\n". "The notice is here:\n\n". "\t%3\$s\n\n" . "It reads:\n\n". "\t%4\$s\n\n" . - $conversationEmailText . + "%5\$s" . "You can reply back here:\n\n". "\t%6\$s\n\n" . "The list of all @-replies for you here:\n\n" . @@ -652,7 +669,7 @@ function mail_notify_attn($user, $notice) common_local_url('shownotice', array('notice' => $notice->id)),//%3 $notice->content,//%4 - $conversationUrl,//%5 + $conversationEmailText,//%5 common_local_url('newnotice', array('replyto' => $sender->nickname, 'inreplyto' => $notice->id)),//%6 common_local_url('replies', diff --git a/lib/noticelist.php b/lib/noticelist.php index 83c8de9f6e..4f997a3286 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -543,18 +543,7 @@ class NoticeListItem extends Widget function showContext() { - $hasConversation = false; - if (!empty($this->notice->conversation)) { - $conversation = Notice::conversationStream( - $this->notice->conversation, - 1, - 1 - ); - if ($conversation->N > 0) { - $hasConversation = true; - } - } - if ($hasConversation) { + if ($this->notice->hasConversation()) { $conv = Conversation::staticGet( 'id', $this->notice->conversation From 58d5d7baeec6fae77ac5d3e82e6072725fe9bf1b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 9 Apr 2010 09:56:19 -0700 Subject: [PATCH 10/14] Clean up badly formatted strings in OembedAction --- actions/oembed.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/actions/oembed.php b/actions/oembed.php index e287b6ae2a..4a11a85e09 100644 --- a/actions/oembed.php +++ b/actions/oembed.php @@ -154,10 +154,12 @@ class OembedAction extends Action $this->end_document('json'); break; default: - $this->serverError(_('content type ' . $apidata['content-type'] . ' not supported'), 501); + // TRANS: Error message displaying attachments. %s is a raw MIME type (eg 'image/png') + $this->serverError(sprintf(_('content type %s not supported'), $apidata['content-type']), 501); } }else{ - $this->serverError(_('Only ' . common_root_url() . ' urls over plain http please'), 404); + // TRANS: Error message displaying attachments. %s is the site's base URL. + $this->serverError(sprintf(_('Only %s urls over plain http please'), common_root_url()), 404); } } From 5c6c9b6f5f40b50570505a366a858e83db9bb2ec Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 10 Apr 2010 00:07:20 +0200 Subject: [PATCH 11/14] Update message formatting for serverError to use a starting capital and a leading period. --- actions/all.php | 2 +- actions/apitimelineretweetedbyme.php | 2 +- actions/avatarsettings.php | 4 ++-- actions/confirmaddress.php | 2 +- actions/finishremotesubscribe.php | 2 +- actions/oembed.php | 14 +++++++------- actions/public.php | 2 +- actions/remotesubscribe.php | 2 +- actions/replies.php | 2 +- actions/showfavorites.php | 2 +- actions/tag.php | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/actions/all.php b/actions/all.php index 8c22e6f5f0..a977fce954 100644 --- a/actions/all.php +++ b/actions/all.php @@ -61,7 +61,7 @@ class AllAction extends ProfileAction if ($this->page > 1 && $this->notice->N == 0) { // TRANS: Server error when page not found (404) - $this->serverError(_('No such page'), $code = 404); + $this->serverError(_('No such page.'), $code = 404); } return true; diff --git a/actions/apitimelineretweetedbyme.php b/actions/apitimelineretweetedbyme.php index 564e98619a..af05623cdf 100644 --- a/actions/apitimelineretweetedbyme.php +++ b/actions/apitimelineretweetedbyme.php @@ -69,7 +69,7 @@ class ApiTimelineRetweetedByMeAction extends ApiAuthAction { parent::prepare($args); - $this->serverError('Unimplemented', 503); + $this->serverError('Unimplemented.', 503); return false; } diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index d4ea11cb7e..52dc2e4249 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -103,7 +103,7 @@ class AvatarsettingsAction extends AccountSettingsAction if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); - $this->serverError(_('User without matching profile')); + $this->serverError(_('User without matching profile.')); return; } @@ -182,7 +182,7 @@ class AvatarsettingsAction extends AccountSettingsAction if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); - $this->serverError(_('User without matching profile')); + $this->serverError(_('User without matching profile.')); return; } diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php index cc8351d8dc..dc17499f55 100644 --- a/actions/confirmaddress.php +++ b/actions/confirmaddress.php @@ -87,7 +87,7 @@ class ConfirmaddressAction extends Action } $type = $confirm->address_type; if (!in_array($type, array('email', 'jabber', 'sms'))) { - $this->serverError(sprintf(_('Unrecognized address type %s'), $type)); + $this->serverError(sprintf(_('Unrecognized address type %s.'), $type)); return; } if ($cur->$type == $confirm->address) { diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php index deee70f360..ac51ddec3f 100644 --- a/actions/finishremotesubscribe.php +++ b/actions/finishremotesubscribe.php @@ -135,7 +135,7 @@ class FinishremotesubscribeAction extends Action $service->getServiceURI(OMB_ENDPOINT_UPDATEPROFILE); if (!$remote->update($orig_remote)) { - $this->serverError(_('Error updating remote profile')); + $this->serverError(_('Error updating remote profile.')); return; } diff --git a/actions/oembed.php b/actions/oembed.php index 4a11a85e09..1503aa9c2b 100644 --- a/actions/oembed.php +++ b/actions/oembed.php @@ -60,7 +60,7 @@ class OembedAction extends Action $proxy_args = $r->map($path); if (!$proxy_args) { - $this->serverError(_("$path not found"), 404); + $this->serverError(_("$path not found."), 404); } $oembed=array(); $oembed['version']='1.0'; @@ -72,11 +72,11 @@ class OembedAction extends Action $id = $proxy_args['notice']; $notice = Notice::staticGet($id); if(empty($notice)){ - $this->serverError(_("notice $id not found"), 404); + $this->serverError(_("Notice $id not found."), 404); } $profile = $notice->getProfile(); if (empty($profile)) { - $this->serverError(_('Notice has no profile'), 500); + $this->serverError(_('Notice has no profile.'), 500); } if (!empty($profile->fullname)) { $authorname = $profile->fullname . ' (' . $profile->nickname . ')'; @@ -95,7 +95,7 @@ class OembedAction extends Action $id = $proxy_args['attachment']; $attachment = File::staticGet($id); if(empty($attachment)){ - $this->serverError(_("attachment $id not found"), 404); + $this->serverError(_("Attachment $id not found."), 404); } if(empty($attachment->filename) && $file_oembed = File_oembed::staticGet('file_id', $attachment->id)){ // Proxy the existing oembed information @@ -123,7 +123,7 @@ class OembedAction extends Action if($attachment->title) $oembed['title']=$attachment->title; break; default: - $this->serverError(_("$path not supported for oembed requests"), 501); + $this->serverError(_("$path not supported for oembed requests."), 501); } switch($args['format']){ case 'xml': @@ -155,11 +155,11 @@ class OembedAction extends Action break; default: // TRANS: Error message displaying attachments. %s is a raw MIME type (eg 'image/png') - $this->serverError(sprintf(_('content type %s not supported'), $apidata['content-type']), 501); + $this->serverError(sprintf(_('Content type %s not supported.'), $apidata['content-type']), 501); } }else{ // TRANS: Error message displaying attachments. %s is the site's base URL. - $this->serverError(sprintf(_('Only %s urls over plain http please'), common_root_url()), 404); + $this->serverError(sprintf(_('Only %s URLs over plain HTTP please.'), common_root_url()), 404); } } diff --git a/actions/public.php b/actions/public.php index 0b3b5fde84..8e9db10caf 100644 --- a/actions/public.php +++ b/actions/public.php @@ -95,7 +95,7 @@ class PublicAction extends Action if($this->page > 1 && $this->notice->N == 0){ // TRANS: Server error when page not found (404) - $this->serverError(_('No such page'),$code=404); + $this->serverError(_('No such page.'),$code=404); } return true; diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php index c723d53a1c..9fc235e743 100644 --- a/actions/remotesubscribe.php +++ b/actions/remotesubscribe.php @@ -188,7 +188,7 @@ class RemotesubscribeAction extends Action $profile = $user->getProfile(); if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); - $this->serverError(_('User without matching profile')); + $this->serverError(_('User without matching profile.')); return; } diff --git a/actions/replies.php b/actions/replies.php index 4ff1b7a8d2..608f71d6e0 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -90,7 +90,7 @@ class RepliesAction extends OwnerDesignAction if($this->page > 1 && $this->notice->N == 0){ // TRANS: Server error when page not found (404) - $this->serverError(_('No such page'),$code=404); + $this->serverError(_('No such page.'),$code=404); } return true; diff --git a/actions/showfavorites.php b/actions/showfavorites.php index 5b85de6835..4d776ef04c 100644 --- a/actions/showfavorites.php +++ b/actions/showfavorites.php @@ -135,7 +135,7 @@ class ShowfavoritesAction extends OwnerDesignAction if($this->page > 1 && $this->notice->N == 0){ // TRANS: Server error when page not found (404) - $this->serverError(_('No such page'),$code=404); + $this->serverError(_('No such page.'),$code=404); } return true; diff --git a/actions/tag.php b/actions/tag.php index ee9617b662..9532404041 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -49,7 +49,7 @@ class TagAction extends Action if($this->page > 1 && $this->notice->N == 0){ // TRANS: Server error when page not found (404) - $this->serverError(_('No such page'),$code=404); + $this->serverError(_('No such page.'),$code=404); } return true; From 166c1edba97d065d0fd424621305fd016e644c43 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 10 Apr 2010 00:58:57 +0200 Subject: [PATCH 12/14] Fix inconsistencies in clientError() messages * use correct punctuation * single quotes when replace was possible * wording updated when needed --- actions/apiaccountupdatedeliverydevice.php | 2 +- actions/apigroupcreate.php | 2 +- actions/apigroupismember.php | 2 +- actions/apigroupjoin.php | 2 +- actions/apigroupleave.php | 2 +- actions/apigroupmembership.php | 2 +- actions/apigroupshow.php | 2 +- actions/apistatusesupdate.php | 2 +- actions/apitimelinegroup.php | 2 +- actions/block.php | 2 +- actions/deleteuser.php | 4 ++-- actions/designadminpanel.php | 4 ++-- actions/disfavor.php | 2 +- actions/favor.php | 2 +- actions/grantrole.php | 8 ++++---- actions/invite.php | 2 +- actions/microsummary.php | 2 +- actions/oauthconnectionssettings.php | 4 ++-- actions/pathsadminpanel.php | 10 +++++----- actions/peopletag.php | 2 +- actions/postnotice.php | 2 +- actions/public.php | 2 +- actions/repeat.php | 10 +++++----- actions/revokerole.php | 6 +++--- actions/sandbox.php | 4 ++-- actions/shownotice.php | 2 +- actions/silence.php | 4 ++-- actions/siteadminpanel.php | 4 ++-- actions/sitenoticeadminpanel.php | 2 +- actions/snapshotadminpanel.php | 6 +++--- actions/unsandbox.php | 4 ++-- actions/unsilence.php | 4 ++-- actions/unsubscribe.php | 2 +- actions/userauthorization.php | 2 +- actions/userrss.php | 2 +- 35 files changed, 58 insertions(+), 58 deletions(-) diff --git a/actions/apiaccountupdatedeliverydevice.php b/actions/apiaccountupdatedeliverydevice.php index 684906fe90..05d19c22de 100644 --- a/actions/apiaccountupdatedeliverydevice.php +++ b/actions/apiaccountupdatedeliverydevice.php @@ -103,7 +103,7 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction $this->clientError( _( 'You must specify a parameter named ' . - '\'device\' with a value of one of: sms, im, none' + '\'device\' with a value of one of: sms, im, none.' ) ); return; diff --git a/actions/apigroupcreate.php b/actions/apigroupcreate.php index 145806356c..3eb3ae5fcc 100644 --- a/actions/apigroupcreate.php +++ b/actions/apigroupcreate.php @@ -263,7 +263,7 @@ class ApiGroupCreateAction extends ApiAuthAction if (!$valid) { $this->clientError( - sprintf(_('Invalid alias: "%s"'), $alias), + sprintf(_('Invalid alias: "%s".'), $alias), 403, $this->format ); diff --git a/actions/apigroupismember.php b/actions/apigroupismember.php index 97f8435614..f51c747dfb 100644 --- a/actions/apigroupismember.php +++ b/actions/apigroupismember.php @@ -92,7 +92,7 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction } if (empty($this->group)) { - $this->clientError(_('Group not found!'), 404, $this->format); + $this->clientError(_('Group not found.'), 404, $this->format); return false; } diff --git a/actions/apigroupjoin.php b/actions/apigroupjoin.php index 374cf83df0..28df72fa9a 100644 --- a/actions/apigroupjoin.php +++ b/actions/apigroupjoin.php @@ -101,7 +101,7 @@ class ApiGroupJoinAction extends ApiAuthAction } if (empty($this->group)) { - $this->clientError(_('Group not found!'), 404, $this->format); + $this->clientError(_('Group not found.'), 404, $this->format); return false; } diff --git a/actions/apigroupleave.php b/actions/apigroupleave.php index 9848ece053..f6e52b26e8 100644 --- a/actions/apigroupleave.php +++ b/actions/apigroupleave.php @@ -101,7 +101,7 @@ class ApiGroupLeaveAction extends ApiAuthAction } if (empty($this->group)) { - $this->clientError(_('Group not found!'), 404, $this->format); + $this->clientError(_('Group not found.'), 404, $this->format); return false; } diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index 9f72b527cf..c97b27fac4 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -88,7 +88,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction parent::handle($args); if (empty($this->group)) { - $this->clientError(_('Group not found!'), 404, $this->format); + $this->clientError(_('Group not found.'), 404, $this->format); return false; } diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index 5745a81f41..8e471689a8 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -79,7 +79,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction common_redirect(common_local_url('ApiGroupShow', $args), 301); } else { $this->clientError( - _('Group not found!'), + _('Group not found.'), 404, $this->format ); diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index 1956c85863..d4ef6b550d 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -199,7 +199,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction $reply_to = $this->in_reply_to_status_id; } else { $this->clientError( - _('Not found'), + _('Not found.'), $code = 404, $this->format ); diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index da816c40a9..56d1de094c 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -88,7 +88,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction parent::handle($args); if (empty($this->group)) { - $this->clientError(_('Group not found!'), 404, $this->format); + $this->clientError(_('Group not found.'), 404, $this->format); return false; } diff --git a/actions/block.php b/actions/block.php index fe4ec00881..7f609c253b 100644 --- a/actions/block.php +++ b/actions/block.php @@ -66,7 +66,7 @@ class BlockAction extends ProfileFormAction assert(!empty($cur)); // checked by parent if ($cur->hasBlocked($this->profile)) { - $this->clientError(_("You already blocked that user.")); + $this->clientError(_('You already blocked that user.')); return false; } diff --git a/actions/deleteuser.php b/actions/deleteuser.php index 4e6b273953..42ef4b9f51 100644 --- a/actions/deleteuser.php +++ b/actions/deleteuser.php @@ -64,14 +64,14 @@ class DeleteuserAction extends ProfileFormAction assert(!empty($cur)); // checked by parent if (!$cur->hasRight(Right::DELETEUSER)) { - $this->clientError(_("You cannot delete users.")); + $this->clientError(_('You cannot delete users.')); return false; } $this->user = User::staticGet('id', $this->profile->id); if (empty($this->user)) { - $this->clientError(_("You can only delete local users.")); + $this->clientError(_('You can only delete local users.')); return false; } diff --git a/actions/designadminpanel.php b/actions/designadminpanel.php index 30e8bde1a4..41d917e3ca 100644 --- a/actions/designadminpanel.php +++ b/actions/designadminpanel.php @@ -272,11 +272,11 @@ class DesignadminpanelAction extends AdminPanelAction { if (!empty($values['logo']) && !Validate::uri($values['logo'], array('allowed_schemes' => array('http', 'https')))) { - $this->clientError(_("Invalid logo URL.")); + $this->clientError(_('Invalid logo URL.')); } if (!in_array($values['theme'], Theme::listAvailable())) { - $this->clientError(sprintf(_("Theme not available: %s"), $values['theme'])); + $this->clientError(sprintf(_("Theme not available: %s."), $values['theme'])); } } diff --git a/actions/disfavor.php b/actions/disfavor.php index 6269f1bd25..3ccdd69af2 100644 --- a/actions/disfavor.php +++ b/actions/disfavor.php @@ -71,7 +71,7 @@ class DisfavorAction extends Action $notice = Notice::staticGet($id); $token = $this->trimmed('token-'.$notice->id); if (!$token || $token != common_session_token()) { - $this->clientError(_("There was a problem with your session token. Try again, please.")); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return; } $fave = new Fave(); diff --git a/actions/favor.php b/actions/favor.php index afca9768ae..475912fd0b 100644 --- a/actions/favor.php +++ b/actions/favor.php @@ -72,7 +72,7 @@ class FavorAction extends Action $notice = Notice::staticGet($id); $token = $this->trimmed('token-'.$notice->id); if (!$token || $token != common_session_token()) { - $this->clientError(_("There was a problem with your session token. Try again, please.")); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return; } if ($user->hasFave($notice)) { diff --git a/actions/grantrole.php b/actions/grantrole.php index cd6bd4d79a..b8b23d02e9 100644 --- a/actions/grantrole.php +++ b/actions/grantrole.php @@ -59,11 +59,11 @@ class GrantRoleAction extends ProfileFormAction $this->role = $this->arg('role'); if (!Profile_role::isValid($this->role)) { - $this->clientError(_("Invalid role.")); + $this->clientError(_('Invalid role.')); return false; } if (!Profile_role::isSettable($this->role)) { - $this->clientError(_("This role is reserved and cannot be set.")); + $this->clientError(_('This role is reserved and cannot be set.')); return false; } @@ -72,14 +72,14 @@ class GrantRoleAction extends ProfileFormAction assert(!empty($cur)); // checked by parent if (!$cur->hasRight(Right::GRANTROLE)) { - $this->clientError(_("You cannot grant user roles on this site.")); + $this->clientError(_('You cannot grant user roles on this site.')); return false; } assert(!empty($this->profile)); // checked by parent if ($this->profile->hasRole($this->role)) { - $this->clientError(_("User already has this role.")); + $this->clientError(_('User already has this role.')); return false; } diff --git a/actions/invite.php b/actions/invite.php index 54b2de62ac..5dac048b06 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -38,7 +38,7 @@ class InviteAction extends CurrentUserDesignAction if (!common_config('invite', 'enabled')) { $this->clientError(_('Invites have been disabled.')); } else if (!common_logged_in()) { - $this->clientError(sprintf(_('You must be logged in to invite other users to use %s'), + $this->clientError(sprintf(_('You must be logged in to invite other users to use %s.'), common_config('site', 'name'))); return; } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { diff --git a/actions/microsummary.php b/actions/microsummary.php index 5c761e8bb6..d145dc3bc7 100644 --- a/actions/microsummary.php +++ b/actions/microsummary.php @@ -66,7 +66,7 @@ class MicrosummaryAction extends Action $notice = $user->getCurrentNotice(); if (!$notice) { - $this->clientError(_('No current status'), 404); + $this->clientError(_('No current status.'), 404); } header('Content-Type: text/plain'); diff --git a/actions/oauthconnectionssettings.php b/actions/oauthconnectionssettings.php index f125f4c631..8a206d7101 100644 --- a/actions/oauthconnectionssettings.php +++ b/actions/oauthconnectionssettings.php @@ -183,7 +183,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction if (!$result) { common_log_db_error($orig, 'DELETE', __FILE__); - $this->clientError(_('Unable to revoke access for app: ' . $app->id)); + $this->clientError(sprintf(_('Unable to revoke access for app: %s.'), $app->id)); return false; } @@ -195,7 +195,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction function showEmptyListMessage() { - $message = sprintf(_('You have not authorized any applications to use your account.')); + $message = _('You have not authorized any applications to use your account.'); $this->elementStart('div', 'guide'); $this->raw(common_markup_to_html($message)); diff --git a/actions/pathsadminpanel.php b/actions/pathsadminpanel.php index 9155a7e428..7ff3c2583a 100644 --- a/actions/pathsadminpanel.php +++ b/actions/pathsadminpanel.php @@ -154,19 +154,19 @@ class PathsadminpanelAction extends AdminPanelAction // Validate theme dir if (!empty($values['theme']['dir']) && !is_readable($values['theme']['dir'])) { - $this->clientError(sprintf(_("Theme directory not readable: %s"), $values['theme']['dir'])); + $this->clientError(sprintf(_("Theme directory not readable: %s."), $values['theme']['dir'])); } // Validate avatar dir if (empty($values['avatar']['dir']) || !is_writable($values['avatar']['dir'])) { - $this->clientError(sprintf(_("Avatar directory not writable: %s"), $values['avatar']['dir'])); + $this->clientError(sprintf(_("Avatar directory not writable: %s."), $values['avatar']['dir'])); } // Validate background dir if (empty($values['background']['dir']) || !is_writable($values['background']['dir'])) { - $this->clientError(sprintf(_("Background directory not writable: %s"), $values['background']['dir'])); + $this->clientError(sprintf(_("Background directory not writable: %s."), $values['background']['dir'])); } // Validate locales dir @@ -174,13 +174,13 @@ class PathsadminpanelAction extends AdminPanelAction // XXX: What else do we need to validate for lacales path here? --Z if (!empty($values['site']['locale_path']) && !is_readable($values['site']['locale_path'])) { - $this->clientError(sprintf(_("Locales directory not readable: %s"), $values['site']['locale_path'])); + $this->clientError(sprintf(_("Locales directory not readable: %s."), $values['site']['locale_path'])); } // Validate SSL setup if (mb_strlen($values['site']['sslserver']) > 255) { - $this->clientError(_("Invalid SSL server. The maximum length is 255 characters.")); + $this->clientError(_('Invalid SSL server. The maximum length is 255 characters.')); } } diff --git a/actions/peopletag.php b/actions/peopletag.php index 32652f7551..7287cfbf99 100644 --- a/actions/peopletag.php +++ b/actions/peopletag.php @@ -65,7 +65,7 @@ class PeopletagAction extends Action $this->tag = $this->trimmed('tag'); if (!common_valid_profile_tag($this->tag)) { - $this->clientError(sprintf(_('Not a valid people tag: %s'), + $this->clientError(sprintf(_('Not a valid people tag: %s.'), $this->tag)); return; } diff --git a/actions/postnotice.php b/actions/postnotice.php index b2f6f1bb95..694c7808d9 100644 --- a/actions/postnotice.php +++ b/actions/postnotice.php @@ -92,7 +92,7 @@ class PostnoticeAction extends Action { $content = common_shorten_links($_POST['omb_notice_content']); if (Notice::contentTooLong($content)) { - $this->clientError(_('Invalid notice content'), 400); + $this->clientError(_('Invalid notice content.'), 400); return false; } $license = $_POST['omb_notice_license']; diff --git a/actions/public.php b/actions/public.php index 8e9db10caf..5fc547feaf 100644 --- a/actions/public.php +++ b/actions/public.php @@ -80,7 +80,7 @@ class PublicAction extends Action $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; if ($this->page > MAX_PUBLIC_PAGE) { - $this->clientError(sprintf(_("Beyond the page limit (%s)"), MAX_PUBLIC_PAGE)); + $this->clientError(sprintf(_("Beyond the page limit (%s)."), MAX_PUBLIC_PAGE)); } common_set_returnto($this->selfUrl()); diff --git a/actions/repeat.php b/actions/repeat.php index e112496bc1..893cae4ffd 100644 --- a/actions/repeat.php +++ b/actions/repeat.php @@ -54,21 +54,21 @@ class RepeatAction extends Action $this->user = common_current_user(); if (empty($this->user)) { - $this->clientError(_("Only logged-in users can repeat notices.")); + $this->clientError(_('Only logged-in users can repeat notices.')); return false; } $id = $this->trimmed('notice'); if (empty($id)) { - $this->clientError(_("No notice specified.")); + $this->clientError(_('No notice specified.')); return false; } $this->notice = Notice::staticGet('id', $id); if (empty($this->notice)) { - $this->clientError(_("No notice specified.")); + $this->clientError(_('No notice specified.')); return false; } @@ -80,14 +80,14 @@ class RepeatAction extends Action $token = $this->trimmed('token-'.$id); if (empty($token) || $token != common_session_token()) { - $this->clientError(_("There was a problem with your session token. Try again, please.")); + $this->clientError(_('There was a problem with your session token. Try again, please.')); return false; } $profile = $this->user->getProfile(); if ($profile->hasRepeated($id)) { - $this->clientError(_("You already repeated that notice.")); + $this->clientError(_('You already repeated that notice.')); return false; } diff --git a/actions/revokerole.php b/actions/revokerole.php index b78c1c25a4..c67b70fdaf 100644 --- a/actions/revokerole.php +++ b/actions/revokerole.php @@ -59,11 +59,11 @@ class RevokeRoleAction extends ProfileFormAction $this->role = $this->arg('role'); if (!Profile_role::isValid($this->role)) { - $this->clientError(_("Invalid role.")); + $this->clientError(_('Invalid role.')); return false; } if (!Profile_role::isSettable($this->role)) { - $this->clientError(_("This role is reserved and cannot be set.")); + $this->clientError(_('This role is reserved and cannot be set.')); return false; } @@ -72,7 +72,7 @@ class RevokeRoleAction extends ProfileFormAction assert(!empty($cur)); // checked by parent if (!$cur->hasRight(Right::REVOKEROLE)) { - $this->clientError(_("You cannot revoke user roles on this site.")); + $this->clientError(_('You cannot revoke user roles on this site.')); return false; } diff --git a/actions/sandbox.php b/actions/sandbox.php index 5b034ff078..d1ef4c86b2 100644 --- a/actions/sandbox.php +++ b/actions/sandbox.php @@ -62,14 +62,14 @@ class SandboxAction extends ProfileFormAction assert(!empty($cur)); // checked by parent if (!$cur->hasRight(Right::SANDBOXUSER)) { - $this->clientError(_("You cannot sandbox users on this site.")); + $this->clientError(_('You cannot sandbox users on this site.')); return false; } assert(!empty($this->profile)); // checked by parent if ($this->profile->isSandboxed()) { - $this->clientError(_("User is already sandboxed.")); + $this->clientError(_('User is already sandboxed.')); return false; } diff --git a/actions/shownotice.php b/actions/shownotice.php index a23027f7c5..7be9618f86 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -97,7 +97,7 @@ class ShownoticeAction extends OwnerDesignAction $this->profile = $this->notice->getProfile(); if (empty($this->profile)) { - $this->serverError(_('Notice has no profile'), 500); + $this->serverError(_('Notice has no profile.'), 500); return false; } diff --git a/actions/silence.php b/actions/silence.php index 206e5ba878..09cc480d9e 100644 --- a/actions/silence.php +++ b/actions/silence.php @@ -62,14 +62,14 @@ class SilenceAction extends ProfileFormAction assert(!empty($cur)); // checked by parent if (!$cur->hasRight(Right::SILENCEUSER)) { - $this->clientError(_("You cannot silence users on this site.")); + $this->clientError(_('You cannot silence users on this site.')); return false; } assert(!empty($this->profile)); // checked by parent if ($this->profile->isSilenced()) { - $this->clientError(_("User is already silenced.")); + $this->clientError(_('User is already silenced.')); return false; } diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index e5482987fb..4238b3e85a 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -130,7 +130,7 @@ class SiteadminpanelAction extends AdminPanelAction // Validate site name if (empty($values['site']['name'])) { - $this->clientError(_("Site name must have non-zero length.")); + $this->clientError(_('Site name must have non-zero length.')); } // Validate email @@ -168,7 +168,7 @@ class SiteadminpanelAction extends AdminPanelAction // Validate dupe limit if (!Validate::number($values['site']['dupelimit'], array('min' => 1))) { - $this->clientError(_("Dupe limit must 1 or more seconds.")); + $this->clientError(_("Dupe limit must be one or more seconds.")); } } diff --git a/actions/sitenoticeadminpanel.php b/actions/sitenoticeadminpanel.php index a68cc699ca..bdcaa23557 100644 --- a/actions/sitenoticeadminpanel.php +++ b/actions/sitenoticeadminpanel.php @@ -110,7 +110,7 @@ class SitenoticeadminpanelAction extends AdminPanelAction if (mb_strlen($siteNotice) > 255) { $this->clientError( - _('Max length for the site-wide notice is 255 chars') + _('Max length for the site-wide notice is 255 chars.') ); } diff --git a/actions/snapshotadminpanel.php b/actions/snapshotadminpanel.php index a0c2315bc1..df6b168dc8 100644 --- a/actions/snapshotadminpanel.php +++ b/actions/snapshotadminpanel.php @@ -124,13 +124,13 @@ class SnapshotadminpanelAction extends AdminPanelAction // Validate snapshot run value if (!in_array($values['snapshot']['run'], array('web', 'cron', 'never'))) { - $this->clientError(_("Invalid snapshot run value.")); + $this->clientError(_('Invalid snapshot run value.')); } // Validate snapshot frequency value if (!Validate::number($values['snapshot']['frequency'])) { - $this->clientError(_("Snapshot frequency must be a number.")); + $this->clientError(_('Snapshot frequency must be a number.')); } // Validate report URL @@ -141,7 +141,7 @@ class SnapshotadminpanelAction extends AdminPanelAction array('allowed_schemes' => array('http', 'https') ) )) { - $this->clientError(_("Invalid snapshot report URL.")); + $this->clientError(_('Invalid snapshot report URL.')); } } } diff --git a/actions/unsandbox.php b/actions/unsandbox.php index 22f4d8e766..d50b5072ee 100644 --- a/actions/unsandbox.php +++ b/actions/unsandbox.php @@ -62,14 +62,14 @@ class UnsandboxAction extends ProfileFormAction assert(!empty($cur)); // checked by parent if (!$cur->hasRight(Right::SANDBOXUSER)) { - $this->clientError(_("You cannot sandbox users on this site.")); + $this->clientError(_('You cannot sandbox users on this site.')); return false; } assert(!empty($this->profile)); // checked by parent if (!$this->profile->isSandboxed()) { - $this->clientError(_("User is not sandboxed.")); + $this->clientError(_('User is not sandboxed.')); return false; } diff --git a/actions/unsilence.php b/actions/unsilence.php index 9ff1b828b0..7d282c3661 100644 --- a/actions/unsilence.php +++ b/actions/unsilence.php @@ -62,14 +62,14 @@ class UnsilenceAction extends ProfileFormAction assert(!empty($cur)); // checked by parent if (!$cur->hasRight(Right::SILENCEUSER)) { - $this->clientError(_("You cannot silence users on this site.")); + $this->clientError(_('You cannot silence users on this site.')); return false; } assert(!empty($this->profile)); // checked by parent if (!$this->profile->isSilenced()) { - $this->clientError(_("User is not silenced.")); + $this->clientError(_('User is not silenced.')); return false; } diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php index 6bb10d448b..57ca15d687 100644 --- a/actions/unsubscribe.php +++ b/actions/unsubscribe.php @@ -74,7 +74,7 @@ class UnsubscribeAction extends Action $other_id = $this->arg('unsubscribeto'); if (!$other_id) { - $this->clientError(_('No profile id in request.')); + $this->clientError(_('No profile ID in request.')); return; } diff --git a/actions/userauthorization.php b/actions/userauthorization.php index 7f71c60dbe..e896ff96ca 100644 --- a/actions/userauthorization.php +++ b/actions/userauthorization.php @@ -69,7 +69,7 @@ class UserauthorizationAction extends Action $profile = $user->getProfile(); if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); - $this->serverError(_('User without matching profile')); + $this->serverError(_('User without matching profile.')); return; } diff --git a/actions/userrss.php b/actions/userrss.php index e03eb93566..cf7d18ca88 100644 --- a/actions/userrss.php +++ b/actions/userrss.php @@ -103,7 +103,7 @@ class UserrssAction extends Rss10Action $profile = $user->getProfile(); if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); - $this->serverError(_('User without matching profile')); + $this->serverError(_('User without matching profile.')); return null; } $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); From 5d96cf2eec15dc08af5c539be53b427c50ef89a9 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 10 Apr 2010 11:36:23 -0400 Subject: [PATCH 13/14] catch UserNoProfileException and continue --- lib/deluserqueuehandler.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/deluserqueuehandler.php b/lib/deluserqueuehandler.php index 4a1233a5ef..7103039382 100644 --- a/lib/deluserqueuehandler.php +++ b/lib/deluserqueuehandler.php @@ -49,9 +49,13 @@ class DelUserQueueHandler extends QueueHandler return true; } - if (!$user->hasRole(Profile_role::DELETED)) { - common_log(LOG_INFO, "User {$user->nickname} is not pending deletion; aborting."); - return true; + try { + if (!$user->hasRole(Profile_role::DELETED)) { + common_log(LOG_INFO, "User {$user->nickname} is not pending deletion; aborting."); + return true; + } + } catch (UserNoProfileException $unp) { + common_log(LOG_INFO, "Deleting user {$user->nickname} with no profile... probably a good idea!"); } $notice = $this->getNextBatch($user); From 71c828de89d4092579470c9f2ba821ae803cb557 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 10 Apr 2010 17:52:40 -0700 Subject: [PATCH 14/14] Allow blocking someone who's not currently subscribed to you (prevents seeing @-replies from them, or them subbing to you in future) --- classes/User.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/User.php b/classes/User.php index 2c256301c2..1928a3c62f 100644 --- a/classes/User.php +++ b/classes/User.php @@ -548,7 +548,10 @@ class User extends Memcached_DataObject return false; } - Subscription::cancel($other, $this->getProfile()); + $self = $this->getProfile(); + if (Subscription::exists($other, $self)) { + Subscription::cancel($other, $self); + } $block->query('COMMIT');