We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 78ed0348 authored by Evan Prodromou's avatar Evan Prodromou

Merge remote branch 'gitorious/0.9.x' into 0.9.x

parents dffec9f2 d3428996
......@@ -357,6 +357,7 @@ class ApiDirectMessageAction extends ApiAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
strtotime($this->messages[0]->created),
strtotime($this->messages[$last]->created)
......
......@@ -213,6 +213,7 @@ class ApiGroupListAction extends ApiBareAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
strtotime($this->groups[0]->created),
......
......@@ -204,6 +204,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
strtotime($this->groups[0]->created),
strtotime($this->groups[$last]->created))
......
......@@ -183,6 +183,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->group->id,
strtotime($this->profiles[0]->created),
......
......@@ -149,6 +149,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->group->id,
strtotime($this->group->modified))
......
......@@ -194,6 +194,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->notice->id,
strtotime($this->notice->created))
......
......@@ -181,6 +181,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
isset($this->ids_only) ? 'IDs' : 'Profiles',
......
......@@ -259,6 +259,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
strtotime($this->notices[0]->created),
......
......@@ -346,6 +346,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
strtotime($this->notices[0]->created),
......
......@@ -229,6 +229,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->group->id,
strtotime($this->notices[0]->created),
......
......@@ -254,6 +254,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
strtotime($this->notices[0]->created),
......
......@@ -244,6 +244,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
strtotime($this->notices[0]->created),
......
......@@ -311,6 +311,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
strtotime($this->notices[0]->created),
strtotime($this->notices[$last]->created))
......
......@@ -232,6 +232,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->tag,
strtotime($this->notices[0]->created),
......
......@@ -234,6 +234,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
strtotime($this->notices[0]->created),
......
......@@ -188,7 +188,7 @@ class EditApplicationAction extends OwnerDesignAction
} elseif (Oauth_application::descriptionTooLong($description)) {
$this->showForm(sprintf(
_('Description is too long (max %d chars).'),
Oauth_application::maxDescription()));
Oauth_application::maxDesc()));
return;
} elseif (mb_strlen($source_url) > 255) {
$this->showForm(_('Source URL is too long.'));
......@@ -253,7 +253,10 @@ class EditApplicationAction extends OwnerDesignAction
$result = $this->app->update($orig);
if (!$result) {
// Note: 0 means no rows changed, which can happen if the only
// thing we changed was the icon, since it's not altered until
// the next step.
if ($result === false) {
common_log_db_error($this->app, 'UPDATE', __FILE__);
$this->serverError(_('Could not update application.'));
}
......
......@@ -170,7 +170,7 @@ class NewApplicationAction extends OwnerDesignAction
} elseif (Oauth_application::descriptionTooLong($description)) {
$this->showForm(sprintf(
_('Description is too long (max %d chars).'),
Oauth_application::maxDescription()));
Oauth_application::maxDesc()));
return;
} elseif (empty($source_url)) {
$this->showForm(_('Source URL is required.'));
......
......@@ -80,7 +80,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
function getInstructions()
{
return _('You have allowed the following applications to access you account.');
return _('You have allowed the following applications to access your account.');
}
/**
......
......@@ -151,6 +151,7 @@ class ShownoticeAction extends OwnerDesignAction
strtotime($this->avatar->modified) : 0;
return 'W/"' . implode(':', array($this->arg('action'),
common_user_cache_hash(),
common_language(),
$this->notice->id,
strtotime($this->notice->created),
......
......@@ -753,8 +753,15 @@ class Notice extends Memcached_DataObject
}
/**
* @param $groups array of Group *objects*
* @param $recipients array of profile *ids*
* Pull up a full list of local recipients who will be getting
* this notice in their inbox. Results will be cached, so don't
* change the input data wily-nilly!
*
* @param array $groups optional list of Group objects;
* if left empty, will be loaded from group_inbox records
* @param array $recipient optional list of reply profile ids
* if left empty, will be loaded from reply records
* @return array associating recipient user IDs with an inbox source constant
*/
function whoGets($groups=null, $recipients=null)
{
......@@ -787,27 +794,27 @@ class Notice extends Memcached_DataObject
$ni[$id] = NOTICE_INBOX_SOURCE_SUB;
}
$profile = $this->getProfile();
foreach ($groups as $group) {
$users = $group->getUserMembers();
foreach ($users as $id) {
if (!array_key_exists($id, $ni)) {
$user = User::staticGet('id', $id);
if (!$user->hasBlocked($profile)) {
$ni[$id] = NOTICE_INBOX_SOURCE_GROUP;
}
$ni[$id] = NOTICE_INBOX_SOURCE_GROUP;
}
}
}
foreach ($recipients as $recipient) {
if (!array_key_exists($recipient, $ni)) {
$recipientUser = User::staticGet('id', $recipient);
if (!empty($recipientUser)) {
$ni[$recipient] = NOTICE_INBOX_SOURCE_REPLY;
}
$ni[$recipient] = NOTICE_INBOX_SOURCE_REPLY;
}
}
// Exclude any deleted, non-local, or blocking recipients.
$profile = $this->getProfile();
foreach ($ni as $id => $source) {
$user = User::staticGet('id', $id);
if (empty($user) || $user->hasBlocked($profile)) {
unset($ni[$id]);
}
}
......
......@@ -255,6 +255,19 @@ class User extends Memcached_DataObject
$user->inboxed = 1;
// Set default-on options here, otherwise they'll be disabled
// initially for sites using caching, since the initial encache
// doesn't know about the defaults in the database.
$user->emailnotifysub = 1;
$user->emailnotifyfav = 1;
$user->emailnotifynudge = 1;
$user->emailnotifymsg = 1;
$user->emailnotifyattn = 1;
$user->emailmicroid = 1;
$user->emailpost = 1;
$user->jabbermicroid = 1;
$user->viewdesigns = 1;
$user->created = common_sql_now();
if (Event::handle('StartUserRegister', array(&$user, &$profile))) {
......@@ -552,6 +565,9 @@ class User extends Memcached_DataObject
if (Subscription::exists($other, $self)) {
Subscription::cancel($other, $self);
}
if (Subscription::exists($self, $other)) {
Subscription::cancel($self, $other);
}
$block->query('COMMIT');
......
......@@ -52,6 +52,10 @@ VALUES
('socialoomphBfD4pMqz31', 'SocialOomph', 'http://www.socialoomph.com/', now()),
('spaz','Spaz','http://funkatron.com/spaz', now()),
('StatusNet Desktop', 'StatusNet Desktop', 'http://status.net/desktop', now()),
('StatusNet Mobile', 'StatusNet Mobile', 'http://status.net/mobile', now()),
('StatusNet iPhone', 'iPhone', 'http://status.net/iphone', now()),
('StatusNet Android', 'Android', 'http://status.net/android', now()),
('StatusNet Blackberry', 'Blackberry', 'http://status.net/blackberry', now()),
('tarpipe','tarpipe','http://tarpipe.com/', now()),
('tjunar','Tjunar','http://nederflash.nl/boek/titels/tjunar-air', now()),
('tr.im','tr.im','http://tr.im/', now()),
......
......@@ -1018,17 +1018,22 @@ class Action extends HTMLOutputter // lawsuit
}
}
$checked = false;
if ($etag) {
$if_none_match = (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) ?
$_SERVER['HTTP_IF_NONE_MATCH'] : null;
if ($if_none_match && $this->_hasEtag($etag, $if_none_match)) {
header('HTTP/1.1 304 Not Modified');
// Better way to do this?
exit(0);
if ($if_none_match) {
// If this check fails, ignore the if-modified-since below.
$checked = true;
if ($this->_hasEtag($etag, $if_none_match)) {
header('HTTP/1.1 304 Not Modified');
// Better way to do this?
exit(0);
}
}
}
if ($lm && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
if (!$checked && $lm && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
$if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
$ims = strtotime($if_modified_since);
if ($lm <= $ims) {
......
......@@ -256,8 +256,9 @@ class ApplicationEditForm extends Form
// Default to Browser
if ($this->application->type == Oauth_application::$browser
|| empty($this->application->type)) {
if (empty($this->application)
|| empty($this->application->type)
|| $this->application->type == Oauth_application::$browser) {
$attrs['checked'] = 'checked';
}
......@@ -274,7 +275,7 @@ class ApplicationEditForm extends Form
'class' => 'radio',
'value' => Oauth_application::$desktop);
if ($this->application->type == Oauth_application::$desktop) {
if (!empty($this->application) && $this->application->type == Oauth_application::$desktop) {
$attrs['checked'] = 'checked';
}
......@@ -298,8 +299,9 @@ class ApplicationEditForm extends Form
// default to read-only access
if ($this->application->access_type & Oauth_application::$readAccess
|| empty($this->application->access_type)) {
if (empty($this->application)
|| empty($this->application->access_type)
|| $this->application->access_type & Oauth_application::$readAccess) {
$attrs['checked'] = 'checked';
}
......@@ -316,7 +318,8 @@ class ApplicationEditForm extends Form
'class' => 'radio',
'value' => 'rw');
if ($this->application->access_type & Oauth_application::$readAccess
if (!empty($this->application)
&& $this->application->access_type & Oauth_application::$readAccess
&& $this->application->access_type & Oauth_application::$writeAccess
) {
$attrs['checked'] = 'checked';
......
......@@ -901,7 +901,7 @@ class HelpCommand extends Command
function handle($channel)
{
$channel->output($this->user,
// TRANS: Help text for commands.
// TRANS: Help text for commands. Do not translate the command names themselves; they are fixed strings.
_("Commands:\n".
"on - turn on notifications\n".
"off - turn off notifications\n".
......
......@@ -100,7 +100,7 @@ class DBQueueManager extends QueueManager
}
} else {
$this->_log(LOG_INFO, "[$queue] Got empty/deleted item, discarding");
$this->_fail($qi);
$this->_done($qi);
}
return true;
}
......
......@@ -494,6 +494,29 @@ function common_is_real_login()
return common_logged_in() && $_SESSION['real_login'];
}
/**
* Get a hash portion for HTTP caching Etags and such including
* info on the current user's session. If login/logout state changes,
* or we've changed accounts, or we've renamed the current user,
* we'll get a new hash value.
*
* This should not be considered secure information.
*
* @param User $user (optional; uses common_current_user() if left out)
* @return string
*/
function common_user_cache_hash($user=false)
{
if ($user === false) {
$user = common_current_user();
}
if ($user) {
return crc32($user->id . ':' . $user->nickname);
} else {
return '0';
}
}
// get canonical version of nickname for comparison
function common_canonical_nickname($nickname)
{
......@@ -1105,26 +1128,30 @@ function common_date_string($dt)
// TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a minute ago');
} else if ($diff < 3300) {
$minutes = round($diff/60);
// TRANS: Used in notices to indicate when the notice was made compared to now.
return sprintf( ngettext('about one minute ago', 'about %d minutes ago'), round($diff/60));
return sprintf( ngettext('about one minute ago', 'about %d minutes ago', $minutes), $minutes);
} else if ($diff < 5400) {
// TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about an hour ago');
} else if ($diff < 22 * 3600) {
$hours = round($diff/3600);
// TRANS: Used in notices to indicate when the notice was made compared to now.
return sprintf( ngettext('about one hour ago', 'about %d hours ago'), round($diff/3600));
return sprintf( ngettext('about one hour ago', 'about %d hours ago', $hours), $hours);
} else if ($diff < 37 * 3600) {
// TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a day ago');
} else if ($diff < 24 * 24 * 3600) {
$days = round($diff/(24*3600));
// TRANS: Used in notices to indicate when the notice was made compared to now.
return sprintf( ngettext('about one day ago', 'about %d days ago'), round($diff/(24*3600)));
return sprintf( ngettext('about one day ago', 'about %d days ago', $days), $days);
} else if ($diff < 46 * 24 * 3600) {
// TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a month ago');
} else if ($diff < 330 * 24 * 3600) {
$months = round($diff/(30*24*3600));
// TRANS: Used in notices to indicate when the notice was made compared to now.
return sprintf( ngettext('about one month ago', 'about %d months ago'), round($diff/(30*24*3600)));
return sprintf( ngettext('about one month ago', 'about %d months ago',$months), $months);
} else if ($diff < 480 * 24 * 3600) {
// TRANS: Used in notices to indicate when the notice was made compared to now.
return _('about a year ago');
......@@ -1453,7 +1480,12 @@ function common_log_db_error(&$object, $verb, $filename=null)
{
$objstr = common_log_objstring($object);
$last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
common_log(LOG_ERR, $last_error->message . '(' . $verb . ' on ' . $objstr . ')', $filename);
if (is_object($last_error)) {
$msg = $last_error->message;
} else {
$msg = 'Unknown error (' . var_export($last_error, true) . ')';
}
common_log(LOG_ERR, $msg . '(' . $verb . ' on ' . $objstr . ')', $filename);
}
function common_log_objstring(&$object)
......
# Translation of StatusNet to Afrikaans (Afrikaans)
# Translation of StatusNet - Core to Afrikaans (Afrikaans)
# Expored from translatewiki.net
#
# Author: Naudefj
......@@ -7,19 +7,19 @@
#
msgid ""
msgstr ""
"Project-Id-Version: StatusNet\n"
"Project-Id-Version: StatusNet - Core\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-09-14 19:53+0000\n"
"PO-Revision-Date: 2010-09-14 19:53:37+0000\n"
"POT-Creation-Date: 2010-09-18 22:06+0000\n"
"PO-Revision-Date: 2010-09-18 22:07:13+0000\n"
"Language-Team: Afrikaans <http://translatewiki.net/wiki/Portal:af>\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: MediaWiki 1.17alpha (r73009); Translate extension (2010-08-20)\n"
"X-Generator: MediaWiki 1.17alpha (r73298); Translate extension (2010-09-17)\n"
"X-Translation-Project: translatewiki.net at http://translatewiki.net\n"
"X-Language-Code: af\n"
"X-Message-Group: #out-statusnet\n"
"X-Message-Group: #out-statusnet-core\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-POT-Import-Date: 1284-49-16 34::+0000\n"
"X-POT-Import-Date: 1284-74-75 38::+0000\n"
#. TRANS: Page title
#. TRANS: Menu item for site administration
......@@ -1619,6 +1619,24 @@ msgstr "lede van die groep %s"
msgid "Admin"
msgstr "Administrateur"
#. TRANS: Button text for the form that will block a user from a group.
#: actions/groupmembers.php:399
msgctxt "BUTTON"
msgid "Block"
msgstr ""
#. TRANS: Button text for the form that will make a user administrator.
#: actions/groupmembers.php:533
msgctxt "BUTTON"
msgid "Make Admin"
msgstr ""
#. TRANS: Submit button title.
#: actions/groupmembers.php:537
msgctxt "TOOLTIP"
msgid "Make this user an admin"
msgstr ""
#. TRANS: Message is used as link title. %s is a user nickname.
#. TRANS: Title in atom group notice feed. %s is a group name.
#. TRANS: Title in atom user notice feed. %s is a user name.
......@@ -4092,14 +4110,20 @@ msgstr ""
msgid "No user for that token."
msgstr ""
#. TRANS: Client error thrown when authentication fails becaus a user clicked "Cancel".
#. TRANS: Client error thrown when authentication fails.
#: lib/apiauth.php:258 lib/apiauth.php:290
msgid "Could not authenticate you."
msgstr ""
#. TRANS: Exception thrown when an attempt is made to revoke an unknown token.
#: lib/apioauthstore.php:178
msgid "Tried to revoke unknown token"
msgid "Tried to revoke unknown token."
msgstr ""
#. TRANS: Exception thrown when an attempt is made to remove a revoked token.
#: lib/apioauthstore.php:182
msgid "Failed to delete revoked token"
msgid "Failed to delete revoked token."
msgstr ""
#. TRANS: Form input field instructions.
......@@ -4435,7 +4459,7 @@ msgid_plural "You are a member of these groups:"
msgstr[0] "U is 'n lid van hierdie groep:"
msgstr[1] "U is 'n lid van hierdie groepe:"
#. TRANS: Help text for commands.
#. TRANS: Help text for commands. Do not translate the command names themselves; they are fixed strings.
#: lib/command.php:905
msgid ""
"Commands:\n"
......@@ -4587,6 +4611,62 @@ msgstr ""
msgid "Extra nicknames for the group, comma- or space- separated, max %d"
msgstr ""
#. TRANS: Menu item in the group navigation page.
#: lib/groupnav.php:86
msgctxt "MENU"
msgid "Group"
msgstr ""
#. TRANS: Tooltip for menu item in the group navigation page.
#. TRANS: %s is the nickname of the group.
#: lib/groupnav.php:89
#, php-format
msgctxt "TOOLTIP"
msgid "%s group"
msgstr ""
#. TRANS: Menu item in the group navigation page.
#: lib/groupnav.php:95
msgctxt "MENU"
msgid "Members"
msgstr ""
#. TRANS: Tooltip for menu item in the group navigation page.
#. TRANS: %s is the nickname of the group.
#: lib/groupnav.php:98
#, php-format
msgctxt "TOOLTIP"
msgid "%s group members"
msgstr ""
#. TRANS: Menu item in the group navigation page. Only shown for group administrators.
#: lib/groupnav.php:108
msgctxt "MENU"
msgid "Blocked"
msgstr ""
#. TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators.
#. TRANS: %s is the nickname of the group.
#: lib/groupnav.php:111
#, php-format
msgctxt "TOOLTIP"
msgid "%s blocked users"
msgstr ""
#. TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators.
#. TRANS: %s is the nickname of the group.
#: lib/groupnav.php:120