Commit a51d2ece authored by Evan Prodromou's avatar Evan Prodromou

Merge remote-tracking branch 'origin/1.1.x' into 1.1.x

parents d1fae16c 4e3fb638

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -1425,3 +1425,28 @@ EndUpgrade: when ending a site upgrade; good place to do your own upgrades
HaveIMPlugin: is there an IM plugin loaded?
- &$haveIMPlugin: set me to true if you're loaded!
StartShowNoticeOptionItems: Before showing first controls in a notice list item; inside the div
- $nli: NoticeListItem being shown
EndShowNoticeOptionItems: After showing last controls in a notice list item; inside the div
- $nli: NoticeListItem being shown
StartNoticeInScope: Before checking if a notice should be visible to a user
- $notice: The notice to check
- $profile: The profile to check for scope
- &$bResult: The boolean result; fill this in if you want to skip
EndNoticeInScope: After checking if a notice should be visible to a user
- $notice: The notice to check
- $profile: The profile to check for scope
- &$bResult: The boolean result; overwrite this if you so desire
StartNoticeListPrefill: Before pre-filling a list of notices with extra data
- &$notices: Notices to be pre-filled
- $avatarSize: The avatar size for the list
EndNoticeListPrefill: After pre-filling a list of notices with extra data
- &$notices: Notices that were pre-filled
- &$profiles: Profiles that were pre-filled
- $avatarSize: The avatar size for the list
......@@ -92,8 +92,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
*/
function prepare($args)
{
common_debug("in apisearchatom prepare()");
parent::prepare($args);
$this->query = $this->trimmed('q');
......
......@@ -63,8 +63,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
*/
function prepare($args)
{
common_debug("apisearchjson prepare()");
parent::prepare($args);
$this->query = $this->trimmed('q');
......
......@@ -185,7 +185,7 @@ class ProfilesettingsAction extends SettingsAction
$this->checkbox('autosubscribe',
// TRANS: Checkbox label in form for profile settings.
_('Automatically subscribe to whoever '.
'subscribes to me (best for non-humans).'),
'subscribes to me (best for non-humans)'),
($this->arg('autosubscribe')) ?
$this->boolean('autosubscribe') : $user->autosubscribe);
$this->elementEnd('li');
......
......@@ -159,6 +159,11 @@ class PublicAction extends Action
$this->element('link', array('rel' => 'EditURI',
'type' => 'application/rsd+xml',
'href' => $rsd));
if ($this->page != 1) {
$this->element('link', array('rel' => 'canonical',
'href' => common_local_url('public')));
}
}
/**
......
......@@ -233,4 +233,12 @@ class ShowgroupAction extends GroupAction
$this->raw(common_markup_to_html($m));
$this->elementEnd('div');
}
function extraHead()
{
if ($this->page != 1) {
$this->element('link', array('rel' => 'canonical',
'href' => $this->group->homeUrl()));
}
}
}
......@@ -212,6 +212,11 @@ class ShowstreamAction extends ProfileAction
$this->element('link', array('rel' => 'EditURI',
'type' => 'application/rsd+xml',
'href' => $rsd));
if ($this->page != 1) {
$this->element('link', array('rel' => 'canonical',
'href' => $this->profile->profileurl));
}
}
function showEmptyListMessage()
......
......@@ -29,8 +29,6 @@ class UserrssAction extends Rss10Action
function prepare($args)
{
common_debug("UserrssAction");
parent::prepare($args);
$nickname = $this->trimmed('nickname');
$this->user = User::staticGet('nickname', $nickname);
......
......@@ -217,13 +217,20 @@ class File extends Managed_DataObject
function isRespectsQuota($user,$fileSize) {
if ($fileSize > common_config('attachments', 'file_quota')) {
// TRANS: Message used to be inserted as %2$s in the text "No file may
// TRANS: be larger than %1$d byte and the file you sent was %2$s.".
// TRANS: %1$d is the number of bytes of an uploaded file.
$fileSizeText = sprintf(_m('%1$d byte','%1$d bytes',$fileSize),$fileSize);
$fileQuota = common_config('attachments', 'file_quota');
// TRANS: Message given if an upload is larger than the configured maximum.
// TRANS: %1$d is the byte limit for uploads, %2$d is the byte count for the uploaded file.
// TRANS: %1$s is used for plural.
return sprintf(_m('No file may be larger than %1$d byte and the file you sent was %2$d bytes. Try to upload a smaller version.',
'No file may be larger than %1$d bytes and the file you sent was %2$d bytes. Try to upload a smaller version.',
common_config('attachments', 'file_quota')),
common_config('attachments', 'file_quota'), $fileSize);
// TRANS: %1$d (used for plural) is the byte limit for uploads,
// TRANS: %2$s is the proper form of "n bytes". This is the only ways to have
// TRANS: gettext support multiple plurals in the same message, unfortunately...
return sprintf(_m('No file may be larger than %1$d byte and the file you sent was %2$s. Try to upload a smaller version.',
'No file may be larger than %1$d bytes and the file you sent was %2$s. Try to upload a smaller version.',
$fileQuota),
$fileQuota, $fileSizeText);
}
$query = "select sum(size) as total from file join file_to_post on file_to_post.file_id = file.id join notice on file_to_post.post_id = notice.id where profile_id = {$user->id} and file.url like '%/notice/%/file'";
......
......@@ -1008,10 +1008,7 @@ class Notice extends Managed_DataObject
$users = $ptag->getUserSubscribers();
foreach ($users as $id) {
if (!array_key_exists($id, $ni)) {
$user = User::staticGet('id', $id);
if (!$user->hasBlocked($profile)) {
$ni[$id] = NOTICE_INBOX_SOURCE_PROFILE_TAG;
}
$ni[$id] = NOTICE_INBOX_SOURCE_PROFILE_TAG;
}
}
}
......@@ -1020,23 +1017,24 @@ class Notice extends Managed_DataObject
if (!array_key_exists($recipient, $ni)) {
$ni[$recipient] = NOTICE_INBOX_SOURCE_REPLY;
}
}
// Exclude any deleted, non-local, or blocking recipients.
$profile = $this->getProfile();
$originalProfile = null;
if ($this->repeat_of) {
// Check blocks against the original notice's poster as well.
$original = Notice::staticGet('id', $this->repeat_of);
if ($original) {
$originalProfile = $original->getProfile();
}
// Exclude any deleted, non-local, or blocking recipients.
$profile = $this->getProfile();
$originalProfile = null;
if ($this->repeat_of) {
// Check blocks against the original notice's poster as well.
$original = Notice::staticGet('id', $this->repeat_of);
if ($original) {
$originalProfile = $original->getProfile();
}
foreach ($ni as $id => $source) {
$user = User::staticGet('id', $id);
if (empty($user) || $user->hasBlocked($profile) ||
($originalProfile && $user->hasBlocked($originalProfile))) {
unset($ni[$id]);
}
}
foreach ($ni as $id => $source) {
$user = User::staticGet('id', $id);
if (empty($user) || $user->hasBlocked($profile) ||
($originalProfile && $user->hasBlocked($originalProfile))) {
unset($ni[$id]);
}
}
......@@ -2365,7 +2363,11 @@ class Notice extends Managed_DataObject
$result = self::cacheGet($keypart);
if ($result === false) {
$bResult = $this->_inScope($profile);
$bResult = false;
if (Event::handle('StartNoticeInScope', array($this, $profile, &$bResult))) {
$bResult = $this->_inScope($profile);
Event::handle('EndNoticeInScope', array($this, $profile, &$bResult));
}
$result = ($bResult) ? 1 : 0;
self::cacheSet($keypart, $result, 0, 300);
}
......@@ -2383,75 +2385,100 @@ class Notice extends Managed_DataObject
// If there's no scope, anyone (even anon) is in scope.
if ($scope == 0) {
return true;
}
if ($scope == 0) { // Not private
// If there's scope, anon cannot be in scope
return !$this->isHiddenSpam($profile);
if (empty($profile)) {
return false;
}
} else { // Private, somehow