forked from GNUsocial/gnu-social
Merge remote-tracking branch 'mainline/1.0.x' into people_tags_rebase
This commit is contained in:
commit
4d61760154
@ -55,17 +55,17 @@ class AllAction extends ProfileAction
|
|||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
$cur = common_current_user();
|
|
||||||
|
|
||||||
if (!empty($cur) && $cur->id == $this->user->id) {
|
$stream = new InboxNoticeStream($this->user);
|
||||||
$this->notice = $this->user->noticeInboxThreaded(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
|
||||||
} else {
|
$this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
|
||||||
$this->notice = $this->user->noticesWithFriendsThreaded(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
NOTICES_PER_PAGE + 1,
|
||||||
}
|
null,
|
||||||
|
null);
|
||||||
|
|
||||||
if ($this->page > 1 && $this->notice->N == 0) {
|
if ($this->page > 1 && $this->notice->N == 0) {
|
||||||
// TRANS: Server error when page not found (404).
|
// TRANS: Server error when page not found (404).
|
||||||
$this->serverError(_('No such page.'), $code = 404);
|
$this->serverError(_('No such page.'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -83,16 +83,9 @@ class AllrssAction extends Rss10Action
|
|||||||
*/
|
*/
|
||||||
function getNotices($limit=0)
|
function getNotices($limit=0)
|
||||||
{
|
{
|
||||||
$cur = common_current_user();
|
$stream = new InboxNoticeStream($this->user);
|
||||||
$user = $this->user;
|
$notice = $stream->getNotices(0, $limit, null, null);
|
||||||
|
|
||||||
if (!empty($cur) && $cur->id == $user->id) {
|
|
||||||
$notice = $this->user->noticeInbox(0, $limit);
|
|
||||||
} else {
|
|
||||||
$notice = $this->user->noticesWithFriends(0, $limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
$notice = $user->noticesWithFriends(0, $limit);
|
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
|
@ -289,15 +289,12 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
|||||||
{
|
{
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
|
||||||
if (!empty($this->auth_user) && $this->auth_user->id == $this->user->id) {
|
$stream = new InboxNoticeStream($this->user);
|
||||||
$notice = $this->user->ownFriendsTimeline(($this->page-1) * $this->count,
|
|
||||||
$this->count, $this->since_id,
|
$notice = $stream->getNotices(($this->page-1) * $this->count,
|
||||||
|
$this->count,
|
||||||
|
$this->since_id,
|
||||||
$this->max_id);
|
$this->max_id);
|
||||||
} else {
|
|
||||||
$notice = $this->user->friendsTimeline(($this->page-1) * $this->count,
|
|
||||||
$this->count, $this->since_id,
|
|
||||||
$this->max_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
$notices[] = clone($notice);
|
$notices[] = clone($notice);
|
||||||
|
@ -192,19 +192,12 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
|||||||
{
|
{
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
|
||||||
if (!empty($this->auth_user) && $this->auth_user->id == $this->user->id) {
|
$stream = new InboxNoticeStream($this->user);
|
||||||
$notice = $this->user->noticeInbox(
|
|
||||||
($this->page-1) * $this->count,
|
$notice = $stream->getNotices(($this->page-1) * $this->count,
|
||||||
$this->count, $this->since_id,
|
$this->count,
|
||||||
$this->max_id
|
$this->since_id,
|
||||||
);
|
$this->max_id);
|
||||||
} else {
|
|
||||||
$notice = $this->user->noticesWithFriends(
|
|
||||||
($this->page-1) * $this->count,
|
|
||||||
$this->count, $this->since_id,
|
|
||||||
$this->max_id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
$notices[] = clone($notice);
|
$notices[] = clone($notice);
|
||||||
|
@ -157,168 +157,11 @@ class Inbox extends Memcached_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stream($user_id, $offset, $limit, $since_id, $max_id, $own=false)
|
|
||||||
{
|
|
||||||
$inbox = Inbox::staticGet('user_id', $user_id);
|
|
||||||
|
|
||||||
if (empty($inbox)) {
|
|
||||||
$inbox = Inbox::fromNoticeInbox($user_id);
|
|
||||||
if (empty($inbox)) {
|
|
||||||
return array();
|
|
||||||
} else {
|
|
||||||
$inbox->encache();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$ids = $inbox->unpack();
|
|
||||||
|
|
||||||
if (!empty($since_id)) {
|
|
||||||
$newids = array();
|
|
||||||
foreach ($ids as $id) {
|
|
||||||
if ($id > $since_id) {
|
|
||||||
$newids[] = $id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$ids = $newids;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($max_id)) {
|
|
||||||
$newids = array();
|
|
||||||
foreach ($ids as $id) {
|
|
||||||
if ($id <= $max_id) {
|
|
||||||
$newids[] = $id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$ids = $newids;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ids = array_slice($ids, $offset, $limit);
|
|
||||||
|
|
||||||
return $ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for Inbox::stream() and Notice::getStreamByIds() returning
|
|
||||||
* additional items up to the limit if we were short due to deleted
|
|
||||||
* notices still being listed in the inbox.
|
|
||||||
*
|
|
||||||
* This is meant to assist threaded views, and optimizes paging for
|
|
||||||
* threadness. Not ideal for very late pages, as we have to bump about
|
|
||||||
* through all previous items.
|
|
||||||
*
|
|
||||||
* Should avoid duplicates in paging, though.
|
|
||||||
*
|
|
||||||
* @param int $user_id
|
|
||||||
* @param int $offset skip past the most recent N notices (after since_id checks)
|
|
||||||
* @param int $limit
|
|
||||||
* @param mixed $since_id return only notices after but not including this id
|
|
||||||
* @param mixed $max_id return only notices up to and including this id
|
|
||||||
* @param mixed $own ignored?
|
|
||||||
* @return array of Notice objects
|
|
||||||
*
|
|
||||||
* @todo consider repacking the inbox when this happens?
|
|
||||||
* @fixme reimplement $own if we need it?
|
|
||||||
*/
|
|
||||||
function streamNoticesThreaded($user_id, $offset, $limit, $since_id, $max_id, $own=false)
|
|
||||||
{
|
|
||||||
// So what we want is:
|
|
||||||
// * slurp in the beginning of the notice list
|
|
||||||
// * filter out deleted notices
|
|
||||||
// * replace any reply notices with their conversation roots
|
|
||||||
// * filter out any duplicate conversations
|
|
||||||
// * return $limit notices after skipping $offset from the most recent
|
|
||||||
|
|
||||||
$ids = self::stream($user_id, 0, self::MAX_NOTICES, $since_id, $max_id, $own);
|
|
||||||
|
|
||||||
// Do a bulk lookup for the first $limit items
|
|
||||||
// Fast path when nothing's deleted.
|
|
||||||
$firstChunk = array_slice($ids, 0, $offset + $limit);
|
|
||||||
$notices = NoticeStream::getStreamByIds($firstChunk);
|
|
||||||
|
|
||||||
assert($notices instanceof ArrayWrapper);
|
|
||||||
$items = $notices->_items;
|
|
||||||
|
|
||||||
// Extract the latest non-deleted item in each convo
|
|
||||||
$noticeByConvo = array();
|
|
||||||
foreach ($items as $notice) {
|
|
||||||
if (empty($noticeByConvo[$notice->conversation])) {
|
|
||||||
$noticeByConvo[$notice->conversation] = $notice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$wanted = count($firstChunk); // raw entry count in the inbox up to our $limit
|
|
||||||
// There were deleted notices, we'll need to look for more.
|
|
||||||
$remainder = array_slice($ids, $limit);
|
|
||||||
|
|
||||||
for ($i = $offset + $limit; count($noticeByConvo) < $wanted && $i < count($ids); $i++) {
|
|
||||||
$notice = Notice::staticGet($ids[$i]);
|
|
||||||
if ($notice && empty($noticeByConvo[$notice->conversation])) {
|
|
||||||
$noticeByConvo[$notice->conversation] = $notice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$slice = array_slice($noticeByConvo, $offset, $limit, false);
|
|
||||||
return new ArrayWrapper($slice);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for Inbox::stream() and Notice::getStreamByIds() returning
|
|
||||||
* additional items up to the limit if we were short due to deleted
|
|
||||||
* notices still being listed in the inbox.
|
|
||||||
*
|
|
||||||
* The fast path (when no items are deleted) should be just as fast; the
|
|
||||||
* offset parameter is applied *before* lookups for maximum efficiency.
|
|
||||||
*
|
|
||||||
* This means offset-based paging may show duplicates, but similar behavior
|
|
||||||
* already exists when new notices are posted between page views, so we
|
|
||||||
* think people will be ok with this until id-based paging is introduced
|
|
||||||
* to the user interface.
|
|
||||||
*
|
|
||||||
* @param int $user_id
|
|
||||||
* @param int $offset skip past the most recent N notices (after since_id checks)
|
|
||||||
* @param int $limit
|
|
||||||
* @param mixed $since_id return only notices after but not including this id
|
|
||||||
* @param mixed $max_id return only notices up to and including this id
|
|
||||||
* @param mixed $own ignored?
|
|
||||||
* @return array of Notice objects
|
|
||||||
*
|
|
||||||
* @todo consider repacking the inbox when this happens?
|
|
||||||
* @fixme reimplement $own if we need it?
|
|
||||||
*/
|
|
||||||
function streamNotices($user_id, $offset, $limit, $since_id, $max_id, $own=false)
|
|
||||||
{
|
|
||||||
$ids = self::stream($user_id, $offset, self::MAX_NOTICES, $since_id, $max_id, $own);
|
|
||||||
|
|
||||||
// Do a bulk lookup for the first $limit items
|
|
||||||
// Fast path when nothing's deleted.
|
|
||||||
$firstChunk = array_slice($ids, 0, $limit);
|
|
||||||
$notices = NoticeStream::getStreamByIds($firstChunk);
|
|
||||||
|
|
||||||
$wanted = count($firstChunk); // raw entry count in the inbox up to our $limit
|
|
||||||
if ($notices->N >= $wanted) {
|
|
||||||
return $notices;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There were deleted notices, we'll need to look for more.
|
|
||||||
assert($notices instanceof ArrayWrapper);
|
|
||||||
$items = $notices->_items;
|
|
||||||
$remainder = array_slice($ids, $limit);
|
|
||||||
|
|
||||||
while (count($items) < $wanted && count($remainder) > 0) {
|
|
||||||
$notice = Notice::staticGet(array_shift($remainder));
|
|
||||||
if ($notice) {
|
|
||||||
$items[] = $notice;
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new ArrayWrapper($items);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves a list of integer notice_ids into a packed blob in this object.
|
* Saves a list of integer notice_ids into a packed blob in this object.
|
||||||
* @param array $ids list of integer notice_ids
|
* @param array $ids list of integer notice_ids
|
||||||
*/
|
*/
|
||||||
protected function pack(array $ids)
|
function pack(array $ids)
|
||||||
{
|
{
|
||||||
$this->notice_ids = call_user_func_array('pack', array_merge(array('N*'), $ids));
|
$this->notice_ids = call_user_func_array('pack', array_merge(array('N*'), $ids));
|
||||||
}
|
}
|
||||||
@ -326,7 +169,7 @@ class Inbox extends Memcached_DataObject
|
|||||||
/**
|
/**
|
||||||
* @return array of integer notice_ids
|
* @return array of integer notice_ids
|
||||||
*/
|
*/
|
||||||
protected function unpack()
|
function unpack()
|
||||||
{
|
{
|
||||||
return unpack('N*', $this->notice_ids);
|
return unpack('N*', $this->notice_ids);
|
||||||
}
|
}
|
||||||
|
@ -2297,6 +2297,21 @@ class Notice extends Memcached_DataObject
|
|||||||
* @return boolean whether the profile is in the notice's scope
|
* @return boolean whether the profile is in the notice's scope
|
||||||
*/
|
*/
|
||||||
function inScope($profile)
|
function inScope($profile)
|
||||||
|
{
|
||||||
|
$keypart = sprintf('notice:in-scope-for:%d:%d', $this->id, $profile->id);
|
||||||
|
|
||||||
|
$result = self::cacheGet($keypart);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
$bResult = $this->_inScope($profile);
|
||||||
|
$result = ($bResult) ? 1 : 0;
|
||||||
|
self::cacheSet($keypart, $result, 0, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($result == 1) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _inScope($profile)
|
||||||
{
|
{
|
||||||
// If there's no scope, anyone (even anon) is in scope.
|
// If there's no scope, anyone (even anon) is in scope.
|
||||||
|
|
||||||
|
@ -478,34 +478,45 @@ class User extends Memcached_DataObject
|
|||||||
return Fave::stream($this->id, $offset, $limit, $own, $since_id, $max_id);
|
return Fave::stream($this->id, $offset, $limit, $own, $since_id, $max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function noticeInbox($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
||||||
|
{
|
||||||
|
$stream = new InboxNoticeStream($this);
|
||||||
|
return $stream->getNotices($offset, $limit, $since_id, $before_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DEPRECATED, use noticeInbox()
|
||||||
|
|
||||||
function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
||||||
{
|
{
|
||||||
return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, false);
|
return $this->noticeInbox($offset, $limit, $since_id, $before_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DEPRECATED, use noticeInbox()
|
||||||
|
|
||||||
function noticesWithFriendsThreaded($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
function noticesWithFriendsThreaded($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
||||||
{
|
{
|
||||||
return Inbox::streamNoticesThreaded($this->id, $offset, $limit, $since_id, $before_id, false);
|
return $this->noticeInbox($offset, $limit, $since_id, $before_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function noticeInbox($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
// DEPRECATED, use noticeInbox()
|
||||||
{
|
|
||||||
return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function noticeInboxThreaded($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
function noticeInboxThreaded($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
||||||
{
|
{
|
||||||
return Inbox::streamNoticesThreaded($this->id, $offset, $limit, $since_id, $before_id, true);
|
return $this->noticeInbox($offset, $limit, $since_id, $before_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DEPRECATED, use noticeInbox()
|
||||||
|
|
||||||
function friendsTimeline($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
function friendsTimeline($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
||||||
{
|
{
|
||||||
return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, false);
|
return $this->noticeInbox($offset, $limit, $since_id, $before_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DEPRECATED, use noticeInbox()
|
||||||
|
|
||||||
function ownFriendsTimeline($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
function ownFriendsTimeline($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
|
||||||
{
|
{
|
||||||
return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, true);
|
$this->noticeInbox($offset, $limit, $since_id, $before_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function blowFavesCache()
|
function blowFavesCache()
|
||||||
|
135
lib/inboxnoticestream.php
Normal file
135
lib/inboxnoticestream.php
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* StatusNet - the distributed open-source microblogging tool
|
||||||
|
* Copyright (C) 2011, StatusNet, Inc.
|
||||||
|
*
|
||||||
|
* Stream of notices for the user's inbox
|
||||||
|
*
|
||||||
|
* PHP version 5
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @category Cache
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @copyright 2011 StatusNet, Inc.
|
||||||
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
|
* @link http://status.net/
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('STATUSNET')) {
|
||||||
|
// This check helps protect against security problems;
|
||||||
|
// your code file can't be executed directly from the web.
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stream of notices for the user's inbox
|
||||||
|
*
|
||||||
|
* @category General
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @copyright 2011 StatusNet, Inc.
|
||||||
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
|
* @link http://status.net/
|
||||||
|
*/
|
||||||
|
class InboxNoticeStream extends ScopingNoticeStream
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param User $user User to get a stream for
|
||||||
|
*/
|
||||||
|
function __construct($user, $profile = null)
|
||||||
|
{
|
||||||
|
// Note: we don't use CachingNoticeStream since RawInboxNoticeStream
|
||||||
|
// uses Inbox::staticGet(), which is cached.
|
||||||
|
parent::__construct(new RawInboxNoticeStream($user), $profile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raw stream of notices for the user's inbox
|
||||||
|
*
|
||||||
|
* @category General
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @copyright 2011 StatusNet, Inc.
|
||||||
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
|
* @link http://status.net/
|
||||||
|
*/
|
||||||
|
class RawInboxNoticeStream extends NoticeStream
|
||||||
|
{
|
||||||
|
protected $user = null;
|
||||||
|
protected $inbox = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param User $user User to get a stream for
|
||||||
|
*/
|
||||||
|
function __construct($user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
$this->inbox = Inbox::staticGet('user_id', $user->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get IDs in a range
|
||||||
|
*
|
||||||
|
* @param int $offset Offset from start
|
||||||
|
* @param int $limit Limit of number to get
|
||||||
|
* @param int $since_id Since this notice
|
||||||
|
* @param int $max_id Before this notice
|
||||||
|
*
|
||||||
|
* @return Array IDs found
|
||||||
|
*/
|
||||||
|
function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||||
|
{
|
||||||
|
if (empty($this->inbox)) {
|
||||||
|
$this->inbox = Inbox::fromNoticeInbox($user_id);
|
||||||
|
if (empty($this->inbox)) {
|
||||||
|
return array();
|
||||||
|
} else {
|
||||||
|
$this->inbox->encache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ids = $this->inbox->unpack();
|
||||||
|
|
||||||
|
if (!empty($since_id)) {
|
||||||
|
$newids = array();
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
if ($id > $since_id) {
|
||||||
|
$newids[] = $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ids = $newids;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($max_id)) {
|
||||||
|
$newids = array();
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
if ($id <= $max_id) {
|
||||||
|
$newids[] = $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ids = $newids;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ids = array_slice($ids, $offset, $limit);
|
||||||
|
|
||||||
|
return $ids;
|
||||||
|
}
|
||||||
|
}
|
@ -131,6 +131,7 @@ class oEmbedHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($api)) {
|
if (empty($api)) {
|
||||||
|
// TRANS: Server exception thrown in oEmbed action if no API endpoint is available.
|
||||||
throw new ServerException(_('No oEmbed API endpoint available.'));
|
throw new ServerException(_('No oEmbed API endpoint available.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +108,7 @@ class EchoPlugin extends Plugin
|
|||||||
'author' => 'Zach Copley',
|
'author' => 'Zach Copley',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:Echo',
|
'homepage' => 'http://status.net/wiki/Plugin:Echo',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('Use <a href="http://aboutecho.com/">Echo</a>'.
|
_m('Use <a href="http://aboutecho.com/">Echo</a>'.
|
||||||
' to add commenting to notice pages.'));
|
' to add commenting to notice pages.'));
|
||||||
return true;
|
return true;
|
||||||
|
@ -57,6 +57,7 @@ class EmailAuthenticationPlugin extends Plugin
|
|||||||
'author' => 'Craig Andrews',
|
'author' => 'Craig Andrews',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:EmailAuthentication',
|
'homepage' => 'http://status.net/wiki/Plugin:EmailAuthentication',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('The Email Authentication plugin allows users to login using their email address.'));
|
_m('The Email Authentication plugin allows users to login using their email address.'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
The Email Authentication plugin allows users to login using their email address.
|
The Email Authentication plugin allows users to login using their email address.
|
||||||
|
|
||||||
The provided email address is used to lookup the user's nickname, then that nickname and the provided password is checked.
|
The provided email address is used to lookup the user's nickname, then that
|
||||||
|
nickname and the provided password is checked.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
add "addPlugin('emailAuthentication');" to the bottom of your config.php
|
add "addPlugin('emailAuthentication');" to the bottom of your config.php.
|
||||||
|
@ -43,7 +43,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class EmailSummaryPlugin extends Plugin
|
class EmailSummaryPlugin extends Plugin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -51,13 +50,11 @@ class EmailSummaryPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onCheckSchema()
|
function onCheckSchema()
|
||||||
{
|
{
|
||||||
$schema = Schema::get();
|
$schema = Schema::get();
|
||||||
|
|
||||||
// For storing user-submitted flags on profiles
|
// For storing user-submitted flags on profiles
|
||||||
|
|
||||||
$schema->ensureTable('email_summary_status',
|
$schema->ensureTable('email_summary_status',
|
||||||
array(new ColumnDef('user_id', 'integer', null,
|
array(new ColumnDef('user_id', 'integer', null,
|
||||||
false, 'PRI'),
|
false, 'PRI'),
|
||||||
@ -82,7 +79,6 @@ class EmailSummaryPlugin extends Plugin
|
|||||||
* @return boolean hook value; true means continue processing, false means stop.
|
* @return boolean hook value; true means continue processing, false means stop.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onAutoload($cls)
|
function onAutoload($cls)
|
||||||
{
|
{
|
||||||
$dir = dirname(__FILE__);
|
$dir = dirname(__FILE__);
|
||||||
@ -107,9 +103,7 @@ class EmailSummaryPlugin extends Plugin
|
|||||||
* @param array &$versions array of version data
|
* @param array &$versions array of version data
|
||||||
*
|
*
|
||||||
* @return boolean hook value; true means continue processing, false means stop.
|
* @return boolean hook value; true means continue processing, false means stop.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onPluginVersion(&$versions)
|
function onPluginVersion(&$versions)
|
||||||
{
|
{
|
||||||
$versions[] = array('name' => 'EmailSummary',
|
$versions[] = array('name' => 'EmailSummary',
|
||||||
@ -117,6 +111,7 @@ class EmailSummaryPlugin extends Plugin
|
|||||||
'author' => 'Evan Prodromou',
|
'author' => 'Evan Prodromou',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:EmailSummary',
|
'homepage' => 'http://status.net/wiki/Plugin:EmailSummary',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('Send an email summary of the inbox to users.'));
|
_m('Send an email summary of the inbox to users.'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -128,7 +123,6 @@ class EmailSummaryPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndInitializeQueueManager($qm)
|
function onEndInitializeQueueManager($qm)
|
||||||
{
|
{
|
||||||
$qm->connect('sitesum', 'SiteEmailSummaryHandler');
|
$qm->connect('sitesum', 'SiteEmailSummaryHandler');
|
||||||
@ -143,7 +137,6 @@ class EmailSummaryPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndEmailFormData($action)
|
function onEndEmailFormData($action)
|
||||||
{
|
{
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
@ -151,7 +144,7 @@ class EmailSummaryPlugin extends Plugin
|
|||||||
$action->elementStart('li');
|
$action->elementStart('li');
|
||||||
$action->checkbox('emailsummary',
|
$action->checkbox('emailsummary',
|
||||||
// TRANS: Checkbox label in e-mail preferences form.
|
// TRANS: Checkbox label in e-mail preferences form.
|
||||||
_m('Send me a periodic summary of updates from my network.'),
|
_m('Send me a periodic summary of updates from my network'),
|
||||||
Email_summary_status::getSendSummary($user->id));
|
Email_summary_status::getSendSummary($user->id));
|
||||||
$action->elementEnd('li');
|
$action->elementEnd('li');
|
||||||
return true;
|
return true;
|
||||||
@ -164,7 +157,6 @@ class EmailSummaryPlugin extends Plugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndEmailSaveForm($action)
|
function onEndEmailSaveForm($action)
|
||||||
{
|
{
|
||||||
$sendSummary = $action->boolean('emailsummary');
|
$sendSummary = $action->boolean('emailsummary');
|
||||||
|
@ -46,7 +46,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
|||||||
*
|
*
|
||||||
* @see DB_DataObject
|
* @see DB_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Email_summary_status extends Memcached_DataObject
|
class Email_summary_status extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
public $__table = 'email_summary_status'; // table name
|
public $__table = 'email_summary_status'; // table name
|
||||||
@ -78,7 +77,6 @@ class Email_summary_status extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return array array of column definitions
|
* @return array array of column definitions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function table()
|
function table()
|
||||||
{
|
{
|
||||||
return array('user_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
|
return array('user_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
|
||||||
@ -93,7 +91,6 @@ class Email_summary_status extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return array list of key field names
|
* @return array list of key field names
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function keys()
|
function keys()
|
||||||
{
|
{
|
||||||
return array_keys($this->keyTypes());
|
return array_keys($this->keyTypes());
|
||||||
@ -121,7 +118,6 @@ class Email_summary_status extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return array magic three-false array that stops auto-incrementing.
|
* @return array magic three-false array that stops auto-incrementing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function sequenceKey()
|
function sequenceKey()
|
||||||
{
|
{
|
||||||
return array(false, false, false);
|
return array(false, false, false);
|
||||||
@ -134,7 +130,6 @@ class Email_summary_status extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return int flag for whether to send this user a summary email
|
* @return int flag for whether to send this user a summary email
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function getSendSummary($user_id)
|
static function getSendSummary($user_id)
|
||||||
{
|
{
|
||||||
$ess = Email_summary_status::staticGet('user_id', $user_id);
|
$ess = Email_summary_status::staticGet('user_id', $user_id);
|
||||||
@ -153,7 +148,6 @@ class Email_summary_status extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return Email_summary_status instance for this user, with count already incremented.
|
* @return Email_summary_status instance for this user, with count already incremented.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function getLastSummaryID($user_id)
|
static function getLastSummaryID($user_id)
|
||||||
{
|
{
|
||||||
$ess = Email_summary_status::staticGet('user_id', $user_id);
|
$ess = Email_summary_status::staticGet('user_id', $user_id);
|
||||||
|
@ -42,7 +42,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class SiteEmailSummaryHandler extends QueueHandler
|
class SiteEmailSummaryHandler extends QueueHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -55,7 +54,6 @@ class SiteEmailSummaryHandler extends QueueHandler
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function transport()
|
function transport()
|
||||||
{
|
{
|
||||||
return 'sitesum';
|
return 'sitesum';
|
||||||
@ -67,7 +65,6 @@ class SiteEmailSummaryHandler extends QueueHandler
|
|||||||
* @param mixed $object
|
* @param mixed $object
|
||||||
* @return boolean true on success, false on failure
|
* @return boolean true on success, false on failure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($object)
|
function handle($object)
|
||||||
{
|
{
|
||||||
$qm = QueueManager::get();
|
$qm = QueueManager::get();
|
||||||
@ -93,4 +90,3 @@ class SiteEmailSummaryHandler extends QueueHandler
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,11 +41,9 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class UserEmailSummaryHandler extends QueueHandler
|
class UserEmailSummaryHandler extends QueueHandler
|
||||||
{
|
{
|
||||||
// Maximum number of notices to include by default. This is probably too much.
|
// Maximum number of notices to include by default. This is probably too much.
|
||||||
|
|
||||||
const MAX_NOTICES = 200;
|
const MAX_NOTICES = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,7 +55,6 @@ class UserEmailSummaryHandler extends QueueHandler
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function transport()
|
function transport()
|
||||||
{
|
{
|
||||||
return 'sitesum';
|
return 'sitesum';
|
||||||
@ -69,7 +66,6 @@ class UserEmailSummaryHandler extends QueueHandler
|
|||||||
* @param mixed $object
|
* @param mixed $object
|
||||||
* @return boolean true on success, false on failure
|
* @return boolean true on success, false on failure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($user_id)
|
function handle($user_id)
|
||||||
{
|
{
|
||||||
// Skip if they've asked not to get summaries
|
// Skip if they've asked not to get summaries
|
||||||
@ -128,7 +124,9 @@ class UserEmailSummaryHandler extends QueueHandler
|
|||||||
'style' => 'background-color: #ffffff; border: 4px solid #4c609a; padding: 10px;'));
|
'style' => 'background-color: #ffffff; border: 4px solid #4c609a; padding: 10px;'));
|
||||||
|
|
||||||
$out->elementStart('div', array('style' => 'color: #ffffff; background-color: #4c609a; font-weight: bold; margin-bottom: 10px; padding: 4px;'));
|
$out->elementStart('div', array('style' => 'color: #ffffff; background-color: #4c609a; font-weight: bold; margin-bottom: 10px; padding: 4px;'));
|
||||||
$out->raw(sprintf(_m('Recent updates from %1s for %2s:'),
|
// TRANS: Text in e-mail summary.
|
||||||
|
// TRANS: %1$s is the StatusNet sitename, %2$s is the recipient's profile name.
|
||||||
|
$out->raw(sprintf(_m('Recent updates from %1$s for %2s:'),
|
||||||
common_config('site', 'name'),
|
common_config('site', 'name'),
|
||||||
$profile->getBestName()));
|
$profile->getBestName()));
|
||||||
$out->elementEnd('div');
|
$out->elementEnd('div');
|
||||||
@ -137,7 +135,6 @@ class UserEmailSummaryHandler extends QueueHandler
|
|||||||
'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6'));
|
'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6'));
|
||||||
|
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
|
|
||||||
$profile = Profile::staticGet('id', $notice->profile_id);
|
$profile = Profile::staticGet('id', $notice->profile_id);
|
||||||
|
|
||||||
if (empty($profile)) {
|
if (empty($profile)) {
|
||||||
@ -208,7 +205,6 @@ class UserEmailSummaryHandler extends QueueHandler
|
|||||||
array('Content-Type' => 'text/html; charset=UTF-8'));
|
array('Content-Type' => 'text/html; charset=UTF-8'));
|
||||||
|
|
||||||
if (empty($ess)) {
|
if (empty($ess)) {
|
||||||
|
|
||||||
$ess = new Email_summary_status();
|
$ess = new Email_summary_status();
|
||||||
|
|
||||||
$ess->user_id = $user_id;
|
$ess->user_id = $user_id;
|
||||||
@ -217,9 +213,7 @@ class UserEmailSummaryHandler extends QueueHandler
|
|||||||
$ess->modified = common_sql_now();
|
$ess->modified = common_sql_now();
|
||||||
|
|
||||||
$ess->insert();
|
$ess->insert();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$orig = clone($ess);
|
$orig = clone($ess);
|
||||||
|
|
||||||
$ess->last_summary_id = $new_top;
|
$ess->last_summary_id = $new_top;
|
||||||
|
@ -23,7 +23,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Queue handler for watching new notices and posting to enjit.
|
* Queue handler for watching new notices and posting to enjit.
|
||||||
* @fixme is this actually being used/functional atm?
|
* @todo FIXME: Is this actually being used/functional atm?
|
||||||
*/
|
*/
|
||||||
class EnjitQueueHandler extends QueueHandler
|
class EnjitQueueHandler extends QueueHandler
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,6 @@ class EventPlugin extends MicroappPlugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value; true means continue processing, false means stop.
|
* @return boolean hook value; true means continue processing, false means stop.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onRouterInitialized($m)
|
function onRouterInitialized($m)
|
||||||
{
|
{
|
||||||
$m->connect('main/event/new',
|
$m->connect('main/event/new',
|
||||||
@ -130,12 +129,14 @@ class EventPlugin extends MicroappPlugin
|
|||||||
'author' => 'Evan Prodromou',
|
'author' => 'Evan Prodromou',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:Event',
|
'homepage' => 'http://status.net/wiki/Plugin:Event',
|
||||||
'description' =>
|
'description' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('Event invitations and RSVPs.'));
|
_m('Event invitations and RSVPs.'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function appTitle() {
|
function appTitle() {
|
||||||
return _m('Event');
|
// TRANS: Title for event application.
|
||||||
|
return _m('TITLE','Event');
|
||||||
}
|
}
|
||||||
|
|
||||||
function tag() {
|
function tag() {
|
||||||
@ -162,12 +163,13 @@ class EventPlugin extends MicroappPlugin
|
|||||||
function saveNoticeFromActivity($activity, $actor, $options=array())
|
function saveNoticeFromActivity($activity, $actor, $options=array())
|
||||||
{
|
{
|
||||||
if (count($activity->objects) != 1) {
|
if (count($activity->objects) != 1) {
|
||||||
throw new Exception('Too many activity objects.');
|
throw new Exception(_('Too many activity objects.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$happeningObj = $activity->objects[0];
|
$happeningObj = $activity->objects[0];
|
||||||
|
|
||||||
if ($happeningObj->type != Happening::OBJECT_TYPE) {
|
if ($happeningObj->type != Happening::OBJECT_TYPE) {
|
||||||
|
// TRANS: Exception thrown when event plugin comes across a non-event type object.
|
||||||
throw new Exception(_m('Wrong type for object.'));
|
throw new Exception(_m('Wrong type for object.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,12 +191,14 @@ class EventPlugin extends MicroappPlugin
|
|||||||
$happening = Happening::staticGet('uri', $happeningObj->id);
|
$happening = Happening::staticGet('uri', $happeningObj->id);
|
||||||
if (empty($happening)) {
|
if (empty($happening)) {
|
||||||
// FIXME: save the event
|
// FIXME: save the event
|
||||||
|
// TRANS: Exception thrown when trying to RSVP for an unknown event.
|
||||||
throw new Exception(_m('RSVP for unknown event.'));
|
throw new Exception(_m('RSVP for unknown event.'));
|
||||||
}
|
}
|
||||||
$notice = RSVP::saveNew($actor, $happening, $activity->verb, $options);
|
$notice = RSVP::saveNew($actor, $happening, $activity->verb, $options);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception(_m('Unknown verb for events'));
|
// TRANS: Exception thrown when event plugin comes across a undefined verb.
|
||||||
|
throw new Exception(_m('Unknown verb for events.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $notice;
|
return $notice;
|
||||||
@ -207,7 +211,6 @@ class EventPlugin extends MicroappPlugin
|
|||||||
*
|
*
|
||||||
* @return ActivityObject
|
* @return ActivityObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function activityObjectFromNotice($notice)
|
function activityObjectFromNotice($notice)
|
||||||
{
|
{
|
||||||
$happening = null;
|
$happening = null;
|
||||||
@ -225,12 +228,14 @@ class EventPlugin extends MicroappPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($happening)) {
|
if (empty($happening)) {
|
||||||
|
// TRANS: Exception thrown when event plugin comes across a unknown object type.
|
||||||
throw new Exception(_m('Unknown object type.'));
|
throw new Exception(_m('Unknown object type.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$notice = $happening->getNotice();
|
$notice = $happening->getNotice();
|
||||||
|
|
||||||
if (empty($notice)) {
|
if (empty($notice)) {
|
||||||
|
// TRANS: Exception thrown when referring to a notice that is not an event an in event context.
|
||||||
throw new Exception(_m('Unknown event notice.'));
|
throw new Exception(_m('Unknown event notice.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +269,6 @@ class EventPlugin extends MicroappPlugin
|
|||||||
*
|
*
|
||||||
* @return ActivityObject
|
* @return ActivityObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndNoticeAsActivity($notice, &$act) {
|
function onEndNoticeAsActivity($notice, &$act) {
|
||||||
switch ($notice->object_type) {
|
switch ($notice->object_type) {
|
||||||
case RSVP::POSITIVE:
|
case RSVP::POSITIVE:
|
||||||
@ -282,7 +286,6 @@ class EventPlugin extends MicroappPlugin
|
|||||||
* @param Notice $notice
|
* @param Notice $notice
|
||||||
* @param HTMLOutputter $out
|
* @param HTMLOutputter $out
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showNotice($notice, $out)
|
function showNotice($notice, $out)
|
||||||
{
|
{
|
||||||
switch ($notice->object_type) {
|
switch ($notice->object_type) {
|
||||||
@ -365,6 +368,7 @@ class EventPlugin extends MicroappPlugin
|
|||||||
|
|
||||||
$out->elementStart('div', 'event-times'); // VEVENT/EVENT-TIMES IN
|
$out->elementStart('div', 'event-times'); // VEVENT/EVENT-TIMES IN
|
||||||
|
|
||||||
|
// TRANS: Field label for event description.
|
||||||
$out->element('strong', null, _m('Time:'));
|
$out->element('strong', null, _m('Time:'));
|
||||||
|
|
||||||
$out->element('abbr', array('class' => 'dtstart',
|
$out->element('abbr', array('class' => 'dtstart',
|
||||||
@ -385,6 +389,7 @@ class EventPlugin extends MicroappPlugin
|
|||||||
|
|
||||||
if (!empty($event->location)) {
|
if (!empty($event->location)) {
|
||||||
$out->elementStart('div', 'event-location');
|
$out->elementStart('div', 'event-location');
|
||||||
|
// TRANS: Field label for event description.
|
||||||
$out->element('strong', null, _m('Location:'));
|
$out->element('strong', null, _m('Location:'));
|
||||||
$out->element('span', 'location', $event->location);
|
$out->element('span', 'location', $event->location);
|
||||||
$out->elementEnd('div');
|
$out->elementEnd('div');
|
||||||
@ -392,6 +397,7 @@ class EventPlugin extends MicroappPlugin
|
|||||||
|
|
||||||
if (!empty($event->description)) {
|
if (!empty($event->description)) {
|
||||||
$out->elementStart('div', 'event-description');
|
$out->elementStart('div', 'event-description');
|
||||||
|
// TRANS: Field label for event description.
|
||||||
$out->element('strong', null, _m('Description:'));
|
$out->element('strong', null, _m('Description:'));
|
||||||
$out->element('span', 'description', $event->description);
|
$out->element('span', 'description', $event->description);
|
||||||
$out->elementEnd('div');
|
$out->elementEnd('div');
|
||||||
@ -400,6 +406,7 @@ class EventPlugin extends MicroappPlugin
|
|||||||
$rsvps = $event->getRSVPs();
|
$rsvps = $event->getRSVPs();
|
||||||
|
|
||||||
$out->elementStart('div', 'event-rsvps');
|
$out->elementStart('div', 'event-rsvps');
|
||||||
|
// TRANS: Field label for event description.
|
||||||
$out->element('strong', null, _m('Attending:'));
|
$out->element('strong', null, _m('Attending:'));
|
||||||
$out->element('span', 'event-rsvps',
|
$out->element('span', 'event-rsvps',
|
||||||
// TRANS: RSVP counts.
|
// TRANS: RSVP counts.
|
||||||
@ -433,7 +440,6 @@ class EventPlugin extends MicroappPlugin
|
|||||||
* @param HTMLOutputter $out
|
* @param HTMLOutputter $out
|
||||||
* @return Widget
|
* @return Widget
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function entryForm($out)
|
function entryForm($out)
|
||||||
{
|
{
|
||||||
return new EventForm($out);
|
return new EventForm($out);
|
||||||
@ -444,7 +450,6 @@ class EventPlugin extends MicroappPlugin
|
|||||||
*
|
*
|
||||||
* @param Notice $notice
|
* @param Notice $notice
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function deleteRelated($notice)
|
function deleteRelated($notice)
|
||||||
{
|
{
|
||||||
switch ($notice->object_type) {
|
switch ($notice->object_type) {
|
||||||
|
@ -47,7 +47,6 @@ if (!defined('STATUSNET')) {
|
|||||||
*
|
*
|
||||||
* @see Managed_DataObject
|
* @see Managed_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Happening extends Managed_DataObject
|
class Happening extends Managed_DataObject
|
||||||
{
|
{
|
||||||
const OBJECT_TYPE = 'http://activitystrea.ms/schema/1.0/event';
|
const OBJECT_TYPE = 'http://activitystrea.ms/schema/1.0/event';
|
||||||
@ -122,6 +121,7 @@ class Happening extends Managed_DataObject
|
|||||||
if (array_key_exists('uri', $options)) {
|
if (array_key_exists('uri', $options)) {
|
||||||
$other = Happening::staticGet('uri', $options['uri']);
|
$other = Happening::staticGet('uri', $options['uri']);
|
||||||
if (!empty($other)) {
|
if (!empty($other)) {
|
||||||
|
// TRANS: Client exception thrown when trying to create an event that already exists.
|
||||||
throw new ClientException(_m('Event already exists.'));
|
throw new ClientException(_m('Event already exists.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,6 +163,9 @@ class Happening extends Managed_DataObject
|
|||||||
$location,
|
$location,
|
||||||
$description);
|
$description);
|
||||||
|
|
||||||
|
// TRANS: Rendered event description. %1$s is a title, %2$s is start time, %3$s is start time,
|
||||||
|
// TRANS: %4$s is end time, %5$s is end time, %6$s is location, %7$s is description.
|
||||||
|
// TRANS: Class names should not be translated.
|
||||||
$rendered = sprintf(_m('<span class="vevent">'.
|
$rendered = sprintf(_m('<span class="vevent">'.
|
||||||
'<span class="summary">%1$s</span> '.
|
'<span class="summary">%1$s</span> '.
|
||||||
'<abbr class="dtstart" title="%2$s">%3$s</a> - '.
|
'<abbr class="dtstart" title="%2$s">%3$s</a> - '.
|
||||||
|
@ -42,7 +42,6 @@ if (!defined('STATUSNET')) {
|
|||||||
*
|
*
|
||||||
* @see Managed_DataObject
|
* @see Managed_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class RSVP extends Managed_DataObject
|
class RSVP extends Managed_DataObject
|
||||||
{
|
{
|
||||||
const POSITIVE = 'http://activitystrea.ms/schema/1.0/rsvp-yes';
|
const POSITIVE = 'http://activitystrea.ms/schema/1.0/rsvp-yes';
|
||||||
@ -64,7 +63,6 @@ class RSVP extends Managed_DataObject
|
|||||||
* @param mixed $v Value to lookup
|
* @param mixed $v Value to lookup
|
||||||
*
|
*
|
||||||
* @return RSVP object found, or null for no hits
|
* @return RSVP object found, or null for no hits
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function staticGet($k, $v=null)
|
function staticGet($k, $v=null)
|
||||||
{
|
{
|
||||||
@ -77,7 +75,6 @@ class RSVP extends Managed_DataObject
|
|||||||
* @param array $kv array of key-value mappings
|
* @param array $kv array of key-value mappings
|
||||||
*
|
*
|
||||||
* @return Bookmark object found, or null for no hits
|
* @return Bookmark object found, or null for no hits
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function pkeyGet($kv)
|
function pkeyGet($kv)
|
||||||
@ -141,6 +138,7 @@ class RSVP extends Managed_DataObject
|
|||||||
if (array_key_exists('uri', $options)) {
|
if (array_key_exists('uri', $options)) {
|
||||||
$other = RSVP::staticGet('uri', $options['uri']);
|
$other = RSVP::staticGet('uri', $options['uri']);
|
||||||
if (!empty($other)) {
|
if (!empty($other)) {
|
||||||
|
// TRANS: Client exception thrown when trying to save an already existing RSVP ("please respond").
|
||||||
throw new ClientException(_m('RSVP already exists.'));
|
throw new ClientException(_m('RSVP already exists.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,6 +147,7 @@ class RSVP extends Managed_DataObject
|
|||||||
'event_id' => $event->id));
|
'event_id' => $event->id));
|
||||||
|
|
||||||
if (!empty($other)) {
|
if (!empty($other)) {
|
||||||
|
// TRANS: Client exception thrown when trying to save an already existing RSVP ("please respond").
|
||||||
throw new ClientException(_m('RSVP already exists.'));
|
throw new ClientException(_m('RSVP already exists.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +216,8 @@ class RSVP extends Managed_DataObject
|
|||||||
return '?';
|
return '?';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception(sprintf(_m('Unknown verb "%s"'),$verb));
|
// TRANS: Exception thrown when requesting an undefined verb for RSVP.
|
||||||
|
throw new Exception(sprintf(_m('Unknown verb "%s".'),$verb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +234,7 @@ class RSVP extends Managed_DataObject
|
|||||||
return RSVP::POSSIBLE;
|
return RSVP::POSSIBLE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// TRANS: Exception thrown when requesting an undefined code for RSVP.
|
||||||
throw new Exception(sprintf(_m('Unknown code "%s".'),$code));
|
throw new Exception(sprintf(_m('Unknown code "%s".'),$code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,6 +243,8 @@ class RSVP extends Managed_DataObject
|
|||||||
{
|
{
|
||||||
$notice = Notice::staticGet('uri', $this->uri);
|
$notice = Notice::staticGet('uri', $this->uri);
|
||||||
if (empty($notice)) {
|
if (empty($notice)) {
|
||||||
|
// TRANS: Server exception thrown when requesting a non-exsting notice for an RSVP ("please respond").
|
||||||
|
// TRANS: %s is the RSVP with the missing notice.
|
||||||
throw new ServerException(sprintf(_m('RSVP %s does not correspond to a notice in the database.'),$this->id));
|
throw new ServerException(sprintf(_m('RSVP %s does not correspond to a notice in the database.'),$this->id));
|
||||||
}
|
}
|
||||||
return $notice;
|
return $notice;
|
||||||
@ -297,6 +300,8 @@ class RSVP extends Managed_DataObject
|
|||||||
{
|
{
|
||||||
$profile = Profile::staticGet('id', $this->profile_id);
|
$profile = Profile::staticGet('id', $this->profile_id);
|
||||||
if (empty($profile)) {
|
if (empty($profile)) {
|
||||||
|
// TRANS: Exception thrown when requesting a non-existing profile.
|
||||||
|
// TRANS: %s is the ID of the non-existing profile.
|
||||||
throw new Exception(sprintf(_m('No profile with ID %s.'),$this->profile_id));
|
throw new Exception(sprintf(_m('No profile with ID %s.'),$this->profile_id));
|
||||||
}
|
}
|
||||||
return $profile;
|
return $profile;
|
||||||
@ -306,6 +311,8 @@ class RSVP extends Managed_DataObject
|
|||||||
{
|
{
|
||||||
$event = Happening::staticGet('id', $this->event_id);
|
$event = Happening::staticGet('id', $this->event_id);
|
||||||
if (empty($event)) {
|
if (empty($event)) {
|
||||||
|
// TRANS: Exception thrown when requesting a non-existing event.
|
||||||
|
// TRANS: %s is the ID of the non-existing event.
|
||||||
throw new Exception(sprintf(_m('No event with ID %s.'),$this->event_id));
|
throw new Exception(sprintf(_m('No event with ID %s.'),$this->event_id));
|
||||||
}
|
}
|
||||||
return $event;
|
return $event;
|
||||||
@ -335,21 +342,34 @@ class RSVP extends Managed_DataObject
|
|||||||
|
|
||||||
switch ($response) {
|
switch ($response) {
|
||||||
case 'Y':
|
case 'Y':
|
||||||
|
// TRANS: HTML version of an RSVP ("please respond") status for a user.
|
||||||
|
// TRANS: %1$s is a profile URL, %2$s a profile name,
|
||||||
|
// TRANS: %3$s is an event URL, %4$s an event title.
|
||||||
$fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> is attending <a href='%3\$s'>%4\$s</a>.</span>");
|
$fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> is attending <a href='%3\$s'>%4\$s</a>.</span>");
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
|
// TRANS: HTML version of an RSVP ("please respond") status for a user.
|
||||||
|
// TRANS: %1$s is a profile URL, %2$s a profile name,
|
||||||
|
// TRANS: %3$s is an event URL, %4$s an event title.
|
||||||
$fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> is not attending <a href='%3\$s'>%4\$s</a>.</span>");
|
$fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> is not attending <a href='%3\$s'>%4\$s</a>.</span>");
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
|
// TRANS: HTML version of an RSVP ("please respond") status for a user.
|
||||||
|
// TRANS: %1$s is a profile URL, %2$s a profile name,
|
||||||
|
// TRANS: %3$s is an event URL, %4$s an event title.
|
||||||
$fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> might attend <a href='%3\$s'>%4\$s</a>.</span>");
|
$fmt = _m("<span class='automatic event-rsvp'><a href='%1\$s'>%2\$s</a> might attend <a href='%3\$s'>%4\$s</a>.</span>");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// TRANS: Exception thrown when requesting a user's RSVP status for a non-existing response code.
|
||||||
|
// TRANS: %s is the non-existing response code.
|
||||||
throw new Exception(sprintf(_m('Unknown response code %s.'),$response));
|
throw new Exception(sprintf(_m('Unknown response code %s.'),$response));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($event)) {
|
if (empty($event)) {
|
||||||
$eventUrl = '#';
|
$eventUrl = '#';
|
||||||
|
// TRANS: Used as event title when not event title is available.
|
||||||
|
// TRANS: Used as: Username [is [not ] attending|might attend] an unknown event.
|
||||||
$eventTitle = _m('an unknown event');
|
$eventTitle = _m('an unknown event');
|
||||||
} else {
|
} else {
|
||||||
$notice = $event->getNotice();
|
$notice = $event->getNotice();
|
||||||
@ -370,20 +390,30 @@ class RSVP extends Managed_DataObject
|
|||||||
|
|
||||||
switch ($response) {
|
switch ($response) {
|
||||||
case 'Y':
|
case 'Y':
|
||||||
|
// TRANS: Plain text version of an RSVP ("please respond") status for a user.
|
||||||
|
// TRANS: %1$s is a profile name, %2$s is an event title.
|
||||||
$fmt = _m('%1$s is attending %2$s.');
|
$fmt = _m('%1$s is attending %2$s.');
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
|
// TRANS: Plain text version of an RSVP ("please respond") status for a user.
|
||||||
|
// TRANS: %1$s is a profile name, %2$s is an event title.
|
||||||
$fmt = _m('%1$s is not attending %2$s.');
|
$fmt = _m('%1$s is not attending %2$s.');
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
|
// TRANS: Plain text version of an RSVP ("please respond") status for a user.
|
||||||
|
// TRANS: %1$s is a profile name, %2$s is an event title.
|
||||||
$fmt = _m('%1$s might attend %2$s.');
|
$fmt = _m('%1$s might attend %2$s.');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// TRANS: Exception thrown when requesting a user's RSVP status for a non-existing response code.
|
||||||
|
// TRANS: %s is the non-existing response code.
|
||||||
throw new Exception(sprintf(_m('Unknown response code %s.'),$response));
|
throw new Exception(sprintf(_m('Unknown response code %s.'),$response));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($event)) {
|
if (empty($event)) {
|
||||||
|
// TRANS: Used as event title when not event title is available.
|
||||||
|
// TRANS: Used as: Username [is [not ] attending|might attend] an unknown event.
|
||||||
$eventTitle = _m('an unknown event');
|
$eventTitle = _m('an unknown event');
|
||||||
} else {
|
} else {
|
||||||
$notice = $event->getNotice();
|
$notice = $event->getNotice();
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
if (!defined('STATUSNET')) {
|
||||||
// This check helps protect against security problems;
|
// This check helps protect against security problems;
|
||||||
// your code file can't be executed directly from the web.
|
// your code file can't be executed directly from the web.
|
||||||
@ -43,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CancelrsvpAction extends Action
|
class CancelrsvpAction extends Action
|
||||||
{
|
{
|
||||||
protected $user = null;
|
protected $user = null;
|
||||||
@ -55,10 +55,10 @@ class CancelrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return string Action title
|
* @return string Action title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
return _m('Cancel RSVP');
|
// TRANS: Title for RSVP ("please respond") action.
|
||||||
|
return _m('TITLE','Cancel RSVP');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +68,6 @@ class CancelrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($argarray)
|
function prepare($argarray)
|
||||||
{
|
{
|
||||||
parent::prepare($argarray);
|
parent::prepare($argarray);
|
||||||
@ -79,24 +78,28 @@ class CancelrsvpAction extends Action
|
|||||||
$rsvpId = $this->trimmed('rsvp');
|
$rsvpId = $this->trimmed('rsvp');
|
||||||
|
|
||||||
if (empty($rsvpId)) {
|
if (empty($rsvpId)) {
|
||||||
|
// TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item.
|
||||||
throw new ClientException(_m('No such RSVP.'));
|
throw new ClientException(_m('No such RSVP.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->rsvp = RSVP::staticGet('id', $rsvpId);
|
$this->rsvp = RSVP::staticGet('id', $rsvpId);
|
||||||
|
|
||||||
if (empty($this->rsvp)) {
|
if (empty($this->rsvp)) {
|
||||||
|
// TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item.
|
||||||
throw new ClientException(_m('No such RSVP.'));
|
throw new ClientException(_m('No such RSVP.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->event = Happening::staticGet('id', $this->rsvp->event_id);
|
$this->event = Happening::staticGet('id', $this->rsvp->event_id);
|
||||||
|
|
||||||
if (empty($this->event)) {
|
if (empty($this->event)) {
|
||||||
|
// TRANS: Client exception thrown when referring to a non-existing event.
|
||||||
throw new ClientException(_m('No such event.'));
|
throw new ClientException(_m('No such event.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client exception thrown when trying tp RSVP ("please respond") while not logged in.
|
||||||
throw new ClientException(_m('You must be logged in to RSVP for an event.'));
|
throw new ClientException(_m('You must be logged in to RSVP for an event.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +113,6 @@ class CancelrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($argarray=null)
|
function handle($argarray=null)
|
||||||
{
|
{
|
||||||
parent::handle($argarray);
|
parent::handle($argarray);
|
||||||
@ -129,7 +131,6 @@ class CancelrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function cancelRSVP()
|
function cancelRSVP()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -171,7 +172,6 @@ class CancelrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
if (!empty($this->error)) {
|
if (!empty($this->error)) {
|
||||||
@ -194,7 +194,6 @@ class CancelrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||||
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CancelRSVPForm extends Form
|
class CancelRSVPForm extends Form
|
||||||
{
|
{
|
||||||
protected $rsvp = null;
|
protected $rsvp = null;
|
||||||
@ -60,7 +59,6 @@ class CancelRSVPForm extends Form
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'form_event_rsvp';
|
return 'form_event_rsvp';
|
||||||
@ -71,7 +69,6 @@ class CancelRSVPForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'ajax';
|
return 'ajax';
|
||||||
@ -82,7 +79,6 @@ class CancelRSVPForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('cancelrsvp');
|
return common_local_url('cancelrsvp');
|
||||||
@ -93,7 +89,6 @@ class CancelRSVPForm extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', array('id' => 'new_rsvp_data'));
|
$this->out->elementStart('fieldset', array('id' => 'new_rsvp_data'));
|
||||||
@ -102,12 +97,15 @@ class CancelRSVPForm extends Form
|
|||||||
|
|
||||||
switch (RSVP::verbFor($this->rsvp->response)) {
|
switch (RSVP::verbFor($this->rsvp->response)) {
|
||||||
case RSVP::POSITIVE:
|
case RSVP::POSITIVE:
|
||||||
|
// TRANS: Possible status for RSVP ("please respond") item.
|
||||||
$this->out->text(_m('You will attend this event.'));
|
$this->out->text(_m('You will attend this event.'));
|
||||||
break;
|
break;
|
||||||
case RSVP::NEGATIVE:
|
case RSVP::NEGATIVE:
|
||||||
|
// TRANS: Possible status for RSVP ("please respond") item.
|
||||||
$this->out->text(_m('You will not attend this event.'));
|
$this->out->text(_m('You will not attend this event.'));
|
||||||
break;
|
break;
|
||||||
case RSVP::POSSIBLE:
|
case RSVP::POSSIBLE:
|
||||||
|
// TRANS: Possible status for RSVP ("please respond") item.
|
||||||
$this->out->text(_m('You might attend this event.'));
|
$this->out->text(_m('You might attend this event.'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -120,9 +118,9 @@ class CancelRSVPForm extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
|
// TRANS: Button text to cancel responding to an RSVP ("please respond") item.
|
||||||
$this->out->submit('cancel', _m('BUTTON', 'Cancel'));
|
$this->out->submit('cancel', _m('BUTTON', 'Cancel'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,3 @@
|
|||||||
.event-title { margin-left: 0px; }
|
.event-title { margin-left: 0px; }
|
||||||
#content .event .entry-title { margin-left: 0px; }
|
#content .event .entry-title { margin-left: 0px; }
|
||||||
#content .event .entry-content { margin-left: 0px; }
|
#content .event .entry-content { margin-left: 0px; }
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class EventForm extends Form
|
class EventForm extends Form
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -52,7 +51,6 @@ class EventForm extends Form
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'form_new_event';
|
return 'form_new_event';
|
||||||
@ -63,7 +61,6 @@ class EventForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings ajax-notice';
|
return 'form_settings ajax-notice';
|
||||||
@ -74,7 +71,6 @@ class EventForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('newevent');
|
return common_local_url('newevent');
|
||||||
@ -85,7 +81,6 @@ class EventForm extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', array('id' => 'new_bookmark_data'));
|
$this->out->elementStart('fieldset', array('id' => 'new_bookmark_data'));
|
||||||
@ -93,57 +88,73 @@ class EventForm extends Form
|
|||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('title',
|
$this->out->input('title',
|
||||||
|
// TRANS: Field label on event form.
|
||||||
_m('LABEL','Title'),
|
_m('LABEL','Title'),
|
||||||
null,
|
null,
|
||||||
|
// TRANS: Field title on event form.
|
||||||
_m('Title of the event.'));
|
_m('Title of the event.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('startdate',
|
$this->out->input('startdate',
|
||||||
|
// TRANS: Field label on event form.
|
||||||
_m('LABEL','Start date'),
|
_m('LABEL','Start date'),
|
||||||
null,
|
null,
|
||||||
|
// TRANS: Field title on event form.
|
||||||
_m('Date the event starts.'));
|
_m('Date the event starts.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('starttime',
|
$this->out->input('starttime',
|
||||||
|
// TRANS: Field label on event form.
|
||||||
_m('LABEL','Start time'),
|
_m('LABEL','Start time'),
|
||||||
null,
|
null,
|
||||||
|
// TRANS: Field title on event form.
|
||||||
_m('Time the event starts.'));
|
_m('Time the event starts.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('enddate',
|
$this->out->input('enddate',
|
||||||
|
// TRANS: Field label on event form.
|
||||||
_m('LABEL','End date'),
|
_m('LABEL','End date'),
|
||||||
null,
|
null,
|
||||||
|
// TRANS: Field title on event form.
|
||||||
_m('Date the event ends.'));
|
_m('Date the event ends.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('endtime',
|
$this->out->input('endtime',
|
||||||
|
// TRANS: Field label on event form.
|
||||||
_m('LABEL','End time'),
|
_m('LABEL','End time'),
|
||||||
null,
|
null,
|
||||||
|
// TRANS: Field title on event form.
|
||||||
_m('Time the event ends.'));
|
_m('Time the event ends.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('location',
|
$this->out->input('location',
|
||||||
|
// TRANS: Field label on event form.
|
||||||
_m('LABEL','Location'),
|
_m('LABEL','Location'),
|
||||||
null,
|
null,
|
||||||
|
// TRANS: Field title on event form.
|
||||||
_m('Event location.'));
|
_m('Event location.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('url',
|
$this->out->input('url',
|
||||||
|
// TRANS: Field label on event form.
|
||||||
_m('LABEL','URL'),
|
_m('LABEL','URL'),
|
||||||
null,
|
null,
|
||||||
|
// TRANS: Field title on event form.
|
||||||
_m('URL for more information.'));
|
_m('URL for more information.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('description',
|
$this->out->input('description',
|
||||||
|
// TRANS: Field label on event form.
|
||||||
_m('LABEL','Description'),
|
_m('LABEL','Description'),
|
||||||
null,
|
null,
|
||||||
|
// TRANS: Field title on event form.
|
||||||
_m('Description of the event.'));
|
_m('Description of the event.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
@ -162,9 +173,9 @@ class EventForm extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
|
// TRANS: Button text to save an event..
|
||||||
$this->out->submit('submit', _m('BUTTON', 'Save'));
|
$this->out->submit('submit', _m('BUTTON', 'Save'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
if (!defined('STATUSNET')) {
|
||||||
// This check helps protect against security problems;
|
// This check helps protect against security problems;
|
||||||
// your code file can't be executed directly from the web.
|
// your code file can't be executed directly from the web.
|
||||||
@ -43,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class NeweventAction extends Action
|
class NeweventAction extends Action
|
||||||
{
|
{
|
||||||
protected $user = null;
|
protected $user = null;
|
||||||
@ -60,10 +60,10 @@ class NeweventAction extends Action
|
|||||||
*
|
*
|
||||||
* @return string Action title
|
* @return string Action title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
return _m('New event');
|
// TRANS: Title for new event form.
|
||||||
|
return _m('TITLE','New event');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +73,6 @@ class NeweventAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($argarray)
|
function prepare($argarray)
|
||||||
{
|
{
|
||||||
parent::prepare($argarray);
|
parent::prepare($argarray);
|
||||||
@ -81,6 +80,7 @@ class NeweventAction extends Action
|
|||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client exception thrown when trying to post an event while not logged in.
|
||||||
throw new ClientException(_m('Must be logged in to post a event.'),
|
throw new ClientException(_m('Must be logged in to post a event.'),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
@ -92,6 +92,7 @@ class NeweventAction extends Action
|
|||||||
$this->title = $this->trimmed('title');
|
$this->title = $this->trimmed('title');
|
||||||
|
|
||||||
if (empty($this->title)) {
|
if (empty($this->title)) {
|
||||||
|
// TRANS: Client exception thrown when trying to post an event without providing a title.
|
||||||
throw new ClientException(_m('Title required.'));
|
throw new ClientException(_m('Title required.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +103,7 @@ class NeweventAction extends Action
|
|||||||
$startDate = $this->trimmed('startdate');
|
$startDate = $this->trimmed('startdate');
|
||||||
|
|
||||||
if (empty($startDate)) {
|
if (empty($startDate)) {
|
||||||
|
// TRANS: Client exception thrown when trying to post an event without providing a start date.
|
||||||
throw new ClientException(_m('Start date required.'));
|
throw new ClientException(_m('Start date required.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +116,7 @@ class NeweventAction extends Action
|
|||||||
$endDate = $this->trimmed('enddate');
|
$endDate = $this->trimmed('enddate');
|
||||||
|
|
||||||
if (empty($endDate)) {
|
if (empty($endDate)) {
|
||||||
|
// TRANS: Client exception thrown when trying to post an event without providing an end date.
|
||||||
throw new ClientException(_m('End date required.'));
|
throw new ClientException(_m('End date required.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,12 +138,16 @@ class NeweventAction extends Action
|
|||||||
$this->endTime = strtotime($end);
|
$this->endTime = strtotime($end);
|
||||||
|
|
||||||
if ($this->startTime == 0) {
|
if ($this->startTime == 0) {
|
||||||
|
// TRANS: Client exception thrown when trying to post an event with a date that cannot be processed.
|
||||||
|
// TRANS: %s is the data that could not be processed.
|
||||||
throw new Exception(sprintf(_m('Could not parse date "%s".'),
|
throw new Exception(sprintf(_m('Could not parse date "%s".'),
|
||||||
$start));
|
$start));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($this->endTime == 0) {
|
if ($this->endTime == 0) {
|
||||||
|
// TRANS: Client exception thrown when trying to post an event with a date that cannot be processed.
|
||||||
|
// TRANS: %s is the data that could not be processed.
|
||||||
throw new Exception(sprintf(_m('Could not parse date "%s".'),
|
throw new Exception(sprintf(_m('Could not parse date "%s".'),
|
||||||
$end));
|
$end));
|
||||||
}
|
}
|
||||||
@ -155,7 +162,6 @@ class NeweventAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($argarray=null)
|
function handle($argarray=null)
|
||||||
{
|
{
|
||||||
parent::handle($argarray);
|
parent::handle($argarray);
|
||||||
@ -174,19 +180,21 @@ class NeweventAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function newEvent()
|
function newEvent()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (empty($this->title)) {
|
if (empty($this->title)) {
|
||||||
|
// TRANS: Client exception thrown when trying to post an event without providing a title.
|
||||||
throw new ClientException(_m('Event must have a title.'));
|
throw new ClientException(_m('Event must have a title.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->startTime)) {
|
if (empty($this->startTime)) {
|
||||||
|
// TRANS: Client exception thrown when trying to post an event without providing a start time.
|
||||||
throw new ClientException(_m('Event must have a start time.'));
|
throw new ClientException(_m('Event must have a start time.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->endTime)) {
|
if (empty($this->endTime)) {
|
||||||
|
// TRANS: Client exception thrown when trying to post an event without providing an end time.
|
||||||
throw new ClientException(_m('Event must have an end time.'));
|
throw new ClientException(_m('Event must have an end time.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +247,6 @@ class NeweventAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
if (!empty($this->error)) {
|
if (!empty($this->error)) {
|
||||||
@ -262,7 +269,6 @@ class NeweventAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
if (!defined('STATUSNET')) {
|
||||||
// This check helps protect against security problems;
|
// This check helps protect against security problems;
|
||||||
// your code file can't be executed directly from the web.
|
// your code file can't be executed directly from the web.
|
||||||
@ -43,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class NewrsvpAction extends Action
|
class NewrsvpAction extends Action
|
||||||
{
|
{
|
||||||
protected $user = null;
|
protected $user = null;
|
||||||
@ -55,10 +55,10 @@ class NewrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return string Action title
|
* @return string Action title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
return _m('New RSVP');
|
// TRANS: Title for RSVP ("please respond") action.
|
||||||
|
return _m('TITLE','New RSVP');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +68,6 @@ class NewrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($argarray)
|
function prepare($argarray)
|
||||||
{
|
{
|
||||||
parent::prepare($argarray);
|
parent::prepare($argarray);
|
||||||
@ -79,18 +78,21 @@ class NewrsvpAction extends Action
|
|||||||
$eventId = $this->trimmed('event');
|
$eventId = $this->trimmed('event');
|
||||||
|
|
||||||
if (empty($eventId)) {
|
if (empty($eventId)) {
|
||||||
|
// TRANS: Client exception thrown when requesting a non-exsting event.
|
||||||
throw new ClientException(_m('No such event.'));
|
throw new ClientException(_m('No such event.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->event = Happening::staticGet('id', $eventId);
|
$this->event = Happening::staticGet('id', $eventId);
|
||||||
|
|
||||||
if (empty($this->event)) {
|
if (empty($this->event)) {
|
||||||
|
// TRANS: Client exception thrown when requesting a non-exsting event.
|
||||||
throw new ClientException(_m('No such event.'));
|
throw new ClientException(_m('No such event.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client exception thrown when trying to RSVP ("please respond") while not logged in.
|
||||||
throw new ClientException(_m('You must be logged in to RSVP for an event.'));
|
throw new ClientException(_m('You must be logged in to RSVP for an event.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +109,8 @@ class NewrsvpAction extends Action
|
|||||||
$this->verb = RSVP::POSSIBLE;
|
$this->verb = RSVP::POSSIBLE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ClientException('Unknown submit value.');
|
// TRANS: Client exception thrown when using an invalud value for RSVP ("please respond").
|
||||||
|
throw new ClientException(_('Unknown submit value.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -120,7 +123,6 @@ class NewrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($argarray=null)
|
function handle($argarray=null)
|
||||||
{
|
{
|
||||||
parent::handle($argarray);
|
parent::handle($argarray);
|
||||||
@ -139,7 +141,6 @@ class NewrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function newRSVP()
|
function newRSVP()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -158,7 +159,7 @@ class NewrsvpAction extends Action
|
|||||||
$this->xw->startDocument('1.0', 'UTF-8');
|
$this->xw->startDocument('1.0', 'UTF-8');
|
||||||
$this->elementStart('html');
|
$this->elementStart('html');
|
||||||
$this->elementStart('head');
|
$this->elementStart('head');
|
||||||
// TRANS: Page title after sending a notice.
|
// TRANS: Page title after creating an event.
|
||||||
$this->element('title', null, _m('Event saved'));
|
$this->element('title', null, _m('Event saved'));
|
||||||
$this->elementEnd('head');
|
$this->elementEnd('head');
|
||||||
$this->elementStart('body');
|
$this->elementStart('body');
|
||||||
@ -178,7 +179,6 @@ class NewrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
if (!empty($this->error)) {
|
if (!empty($this->error)) {
|
||||||
@ -201,7 +201,6 @@ class NewrsvpAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||||
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class RSVPForm extends Form
|
class RSVPForm extends Form
|
||||||
{
|
{
|
||||||
protected $event = null;
|
protected $event = null;
|
||||||
@ -60,7 +59,6 @@ class RSVPForm extends Form
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'form_event_rsvp';
|
return 'form_event_rsvp';
|
||||||
@ -71,7 +69,6 @@ class RSVPForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'ajax';
|
return 'ajax';
|
||||||
@ -82,7 +79,6 @@ class RSVPForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('newrsvp');
|
return common_local_url('newrsvp');
|
||||||
@ -93,11 +89,11 @@ class RSVPForm extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', array('id' => 'new_rsvp_data'));
|
$this->out->elementStart('fieldset', array('id' => 'new_rsvp_data'));
|
||||||
|
|
||||||
|
// TRANS: Field label on form to RSVP ("please respond") for an event.
|
||||||
$this->out->text(_m('RSVP:'));
|
$this->out->text(_m('RSVP:'));
|
||||||
|
|
||||||
$this->out->hidden('event', $this->event->id);
|
$this->out->hidden('event', $this->event->id);
|
||||||
@ -111,11 +107,13 @@ class RSVPForm extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
|
// TRANS: Button text for RSVP ("please respond") reply to confirm attendence.
|
||||||
$this->submitButton('yes', _m('BUTTON', 'Yes'));
|
$this->submitButton('yes', _m('BUTTON', 'Yes'));
|
||||||
|
// TRANS: Button text for RSVP ("please respond") reply to deny attendence.
|
||||||
$this->submitButton('no', _m('BUTTON', 'No'));
|
$this->submitButton('no', _m('BUTTON', 'No'));
|
||||||
|
// TRANS: Button text for RSVP ("please respond") reply to indicate one might attend.
|
||||||
$this->submitButton('maybe', _m('BUTTON', 'Maybe'));
|
$this->submitButton('maybe', _m('BUTTON', 'Maybe'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ if (!defined('STATUSNET')) {
|
|||||||
*/
|
*/
|
||||||
class ExtendedProfilePlugin extends Plugin
|
class ExtendedProfilePlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
function onPluginVersion(&$versions)
|
function onPluginVersion(&$versions)
|
||||||
{
|
{
|
||||||
$versions[] = array(
|
$versions[] = array(
|
||||||
@ -37,8 +36,8 @@ class ExtendedProfilePlugin extends Plugin
|
|||||||
'version' => STATUSNET_VERSION,
|
'version' => STATUSNET_VERSION,
|
||||||
'author' => 'Brion Vibber, Samantha Doherty, Zach Copley',
|
'author' => 'Brion Vibber, Samantha Doherty, Zach Copley',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:ExtendedProfile',
|
'homepage' => 'http://status.net/wiki/Plugin:ExtendedProfile',
|
||||||
'rawdescription' => _m(
|
// TRANS: Plugin description.
|
||||||
'UI extensions for additional profile fields.')
|
'rawdescription' => _m('UI extensions for additional profile fields.')
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -120,9 +119,9 @@ class ExtendedProfilePlugin extends Plugin
|
|||||||
$user = User::staticGet('id', $profile->id);
|
$user = User::staticGet('id', $profile->id);
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$url = common_local_url('profiledetail', array('nickname' => $user->nickname));
|
$url = common_local_url('profiledetail', array('nickname' => $user->nickname));
|
||||||
|
// TRANS: Link text on user profile page leading to extended profile page.
|
||||||
$out->element('a', array('href' => $url, 'class' => 'profiledetail'), _m('More details...'));
|
$out->element('a', array('href' => $url, 'class' => 'profiledetail'), _m('More details...'));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,6 @@ class Profile_detail extends Managed_DataObject
|
|||||||
* @return User_greeting_count object found, or null for no hits
|
* @return User_greeting_count object found, or null for no hits
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function staticGet($k, $v=null)
|
function staticGet($k, $v=null)
|
||||||
{
|
{
|
||||||
return Memcached_DataObject::staticGet('Profile_detail', $k, $v);
|
return Memcached_DataObject::staticGet('Profile_detail', $k, $v);
|
||||||
@ -98,7 +97,6 @@ class Profile_detail extends Managed_DataObject
|
|||||||
* @return Bookmark object found, or null for no hits
|
* @return Bookmark object found, or null for no hits
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function pkeyGet($kv)
|
function pkeyGet($kv)
|
||||||
{
|
{
|
||||||
return Memcached_DataObject::pkeyGet('Profile_detail', $kv);
|
return Memcached_DataObject::pkeyGet('Profile_detail', $kv);
|
||||||
@ -107,6 +105,7 @@ class Profile_detail extends Managed_DataObject
|
|||||||
static function schemaDef()
|
static function schemaDef()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
|
// No need for i18n. Table properties.
|
||||||
'description'
|
'description'
|
||||||
=> 'Additional profile details for the ExtendedProfile plugin',
|
=> 'Additional profile details for the ExtendedProfile plugin',
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
@ -138,5 +137,4 @@ class Profile_detail extends Managed_DataObject
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,7 @@ class ExtendedProfile
|
|||||||
|
|
||||||
if (empty($phones)) {
|
if (empty($phones)) {
|
||||||
$pArrays[] = array(
|
$pArrays[] = array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Phone'),
|
'label' => _m('Phone'),
|
||||||
'index' => 0,
|
'index' => 0,
|
||||||
'type' => 'phone',
|
'type' => 'phone',
|
||||||
@ -126,6 +127,7 @@ class ExtendedProfile
|
|||||||
} else {
|
} else {
|
||||||
for ($i = 0; $i < sizeof($phones); $i++) {
|
for ($i = 0; $i < sizeof($phones); $i++) {
|
||||||
$pa = array(
|
$pa = array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Phone'),
|
'label' => _m('Phone'),
|
||||||
'type' => 'phone',
|
'type' => 'phone',
|
||||||
'index' => intval($phones[$i]->value_index),
|
'index' => intval($phones[$i]->value_index),
|
||||||
@ -147,12 +149,14 @@ class ExtendedProfile
|
|||||||
|
|
||||||
if (empty($ims)) {
|
if (empty($ims)) {
|
||||||
$iArrays[] = array(
|
$iArrays[] = array(
|
||||||
|
// TRANS: Field label for extended profile properties (Instant Messaging).
|
||||||
'label' => _m('IM'),
|
'label' => _m('IM'),
|
||||||
'type' => 'im'
|
'type' => 'im'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
for ($i = 0; $i < sizeof($ims); $i++) {
|
for ($i = 0; $i < sizeof($ims); $i++) {
|
||||||
$ia = array(
|
$ia = array(
|
||||||
|
// TRANS: Field label for extended profile properties (Instant Messaging).
|
||||||
'label' => _m('IM'),
|
'label' => _m('IM'),
|
||||||
'type' => 'im',
|
'type' => 'im',
|
||||||
'index' => intval($ims[$i]->value_index),
|
'index' => intval($ims[$i]->value_index),
|
||||||
@ -173,12 +177,14 @@ class ExtendedProfile
|
|||||||
|
|
||||||
if (empty($sites)) {
|
if (empty($sites)) {
|
||||||
$wArrays[] = array(
|
$wArrays[] = array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Website'),
|
'label' => _m('Website'),
|
||||||
'type' => 'website'
|
'type' => 'website'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
for ($i = 0; $i < sizeof($sites); $i++) {
|
for ($i = 0; $i < sizeof($sites); $i++) {
|
||||||
$wa = array(
|
$wa = array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Website'),
|
'label' => _m('Website'),
|
||||||
'type' => 'website',
|
'type' => 'website',
|
||||||
'index' => intval($sites[$i]->value_index),
|
'index' => intval($sites[$i]->value_index),
|
||||||
@ -202,6 +208,7 @@ class ExtendedProfile
|
|||||||
|
|
||||||
if (empty($companies)) {
|
if (empty($companies)) {
|
||||||
$eArrays[] = array(
|
$eArrays[] = array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Employer'),
|
'label' => _m('Employer'),
|
||||||
'type' => 'experience',
|
'type' => 'experience',
|
||||||
'company' => null,
|
'company' => null,
|
||||||
@ -213,6 +220,7 @@ class ExtendedProfile
|
|||||||
} else {
|
} else {
|
||||||
for ($i = 0; $i < sizeof($companies); $i++) {
|
for ($i = 0; $i < sizeof($companies); $i++) {
|
||||||
$ea = array(
|
$ea = array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Employer'),
|
'label' => _m('Employer'),
|
||||||
'type' => 'experience',
|
'type' => 'experience',
|
||||||
'company' => $companies[$i]->field_value,
|
'company' => $companies[$i]->field_value,
|
||||||
@ -239,6 +247,7 @@ class ExtendedProfile
|
|||||||
if (empty($schools)) {
|
if (empty($schools)) {
|
||||||
$iArrays[] = array(
|
$iArrays[] = array(
|
||||||
'type' => 'education',
|
'type' => 'education',
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Institution'),
|
'label' => _m('Institution'),
|
||||||
'school' => null,
|
'school' => null,
|
||||||
'degree' => null,
|
'degree' => null,
|
||||||
@ -251,6 +260,7 @@ class ExtendedProfile
|
|||||||
for ($i = 0; $i < sizeof($schools); $i++) {
|
for ($i = 0; $i < sizeof($schools); $i++) {
|
||||||
$ia = array(
|
$ia = array(
|
||||||
'type' => 'education',
|
'type' => 'education',
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Institution'),
|
'label' => _m('Institution'),
|
||||||
'school' => $schools[$i]->field_value,
|
'school' => $schools[$i]->field_value,
|
||||||
'degree' => isset($degrees[$i]->field_value) ? $degrees[$i]->field_value : null,
|
'degree' => isset($degrees[$i]->field_value) ? $degrees[$i]->field_value : null,
|
||||||
@ -275,32 +285,39 @@ class ExtendedProfile
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'basic' => array(
|
'basic' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Personal'),
|
'label' => _m('Personal'),
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'fullname' => array(
|
'fullname' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Full name'),
|
'label' => _m('Full name'),
|
||||||
'profile' => 'fullname',
|
'profile' => 'fullname',
|
||||||
'vcard' => 'fn',
|
'vcard' => 'fn',
|
||||||
),
|
),
|
||||||
'title' => array(
|
'title' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Title'),
|
'label' => _m('Title'),
|
||||||
'vcard' => 'title',
|
'vcard' => 'title',
|
||||||
),
|
),
|
||||||
'manager' => array(
|
'manager' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Manager'),
|
'label' => _m('Manager'),
|
||||||
'type' => 'person',
|
'type' => 'person',
|
||||||
'vcard' => 'x-manager',
|
'vcard' => 'x-manager',
|
||||||
),
|
),
|
||||||
'location' => array(
|
'location' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Location'),
|
'label' => _m('Location'),
|
||||||
'profile' => 'location'
|
'profile' => 'location'
|
||||||
),
|
),
|
||||||
'bio' => array(
|
'bio' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Bio'),
|
'label' => _m('Bio'),
|
||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'profile' => 'bio',
|
'profile' => 'bio',
|
||||||
),
|
),
|
||||||
'tags' => array(
|
'tags' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Tags'),
|
'label' => _m('Tags'),
|
||||||
'type' => 'tags',
|
'type' => 'tags',
|
||||||
'profile' => 'tags',
|
'profile' => 'tags',
|
||||||
@ -308,6 +325,7 @@ class ExtendedProfile
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'contact' => array(
|
'contact' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Contact'),
|
'label' => _m('Contact'),
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'phone' => $this->getPhones(),
|
'phone' => $this->getPhones(),
|
||||||
@ -316,29 +334,35 @@ class ExtendedProfile
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'personal' => array(
|
'personal' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Personal'),
|
'label' => _m('Personal'),
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'birthday' => array(
|
'birthday' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Birthday'),
|
'label' => _m('Birthday'),
|
||||||
'type' => 'date',
|
'type' => 'date',
|
||||||
'vcard' => 'bday',
|
'vcard' => 'bday',
|
||||||
),
|
),
|
||||||
'spouse' => array(
|
'spouse' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Spouse\'s name'),
|
'label' => _m('Spouse\'s name'),
|
||||||
'vcard' => 'x-spouse',
|
'vcard' => 'x-spouse',
|
||||||
),
|
),
|
||||||
'kids' => array(
|
'kids' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Kids\' names')
|
'label' => _m('Kids\' names')
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'experience' => array(
|
'experience' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Work experience'),
|
'label' => _m('Work experience'),
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'experience' => $this->getExperiences()
|
'experience' => $this->getExperiences()
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'education' => array(
|
'education' => array(
|
||||||
|
// TRANS: Field label for extended profile properties.
|
||||||
'label' => _m('Education'),
|
'label' => _m('Education'),
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'education' => $this->getEducation()
|
'education' => $this->getEducation()
|
||||||
|
@ -80,9 +80,11 @@ class ExtendedProfileWidget extends Form
|
|||||||
// For JQuery UI modal dialog
|
// For JQuery UI modal dialog
|
||||||
$this->out->elementStart(
|
$this->out->elementStart(
|
||||||
'div',
|
'div',
|
||||||
array('id' => 'confirm-dialog', 'title' => 'Confirmation Required')
|
// TRANS: Title for extended profile entry deletion dialog.
|
||||||
|
array('id' => 'confirm-dialog', 'title' => _m('Confirmation Required'))
|
||||||
);
|
);
|
||||||
$this->out->text('Really delete this entry?');
|
// TRANS: Confirmation text for extended profile entry deletion dialog.
|
||||||
|
$this->out->text(_m('Really delete this entry?'));
|
||||||
$this->out->elementEnd('div');
|
$this->out->elementEnd('div');
|
||||||
$this->showSections();
|
$this->showSections();
|
||||||
}
|
}
|
||||||
@ -163,7 +165,9 @@ class ExtendedProfileWidget extends Form
|
|||||||
if (!empty($field['value'])) {
|
if (!empty($field['value'])) {
|
||||||
$this->out->text($field['value']);
|
$this->out->text($field['value']);
|
||||||
if (!empty($field['rel'])) {
|
if (!empty($field['rel'])) {
|
||||||
$this->out->text(' (' . $field['rel'] . ')');
|
// TRANS: Value between parentheses (phone number, website, or IM address).
|
||||||
|
$outtext = sprintf(_m('(%s)'),$field['rel']);
|
||||||
|
$this->out->text(' '.$outtext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->out->elementEnd('div');
|
$this->out->elementEnd('div');
|
||||||
@ -174,7 +178,9 @@ class ExtendedProfileWidget extends Form
|
|||||||
$this->out->elementStart('div', array('class' => 'im-display'));
|
$this->out->elementStart('div', array('class' => 'im-display'));
|
||||||
$this->out->text($field['value']);
|
$this->out->text($field['value']);
|
||||||
if (!empty($field['rel'])) {
|
if (!empty($field['rel'])) {
|
||||||
$this->out->text(' (' . $field['rel'] . ')');
|
// TRANS: Value between parentheses (phone number, website, or IM address).
|
||||||
|
$outtext = sprintf(_m('(%s)'),$field['rel']);
|
||||||
|
$this->out->text(' '.$outtext);
|
||||||
}
|
}
|
||||||
$this->out->elementEnd('div');
|
$this->out->elementEnd('div');
|
||||||
}
|
}
|
||||||
@ -196,7 +202,9 @@ class ExtendedProfileWidget extends Form
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($field['rel'])) {
|
if (!empty($field['rel'])) {
|
||||||
$this->out->text(' (' . $field['rel'] . ')');
|
// TRANS: Value between parentheses (phone number, website, or IM address).
|
||||||
|
$outtext = sprintf(_m('(%s)'),$field['rel']);
|
||||||
|
$this->out->text(' '.$outtext);
|
||||||
}
|
}
|
||||||
$this->out->elementEnd('div');
|
$this->out->elementEnd('div');
|
||||||
}
|
}
|
||||||
@ -314,11 +322,13 @@ class ExtendedProfileWidget extends Form
|
|||||||
protected function showExperience($name, $field)
|
protected function showExperience($name, $field)
|
||||||
{
|
{
|
||||||
$this->out->elementStart('div', 'experience-item');
|
$this->out->elementStart('div', 'experience-item');
|
||||||
|
// TRANS: Field label in experience area of extended profile.
|
||||||
$this->out->element('div', 'label', _m('Company'));
|
$this->out->element('div', 'label', _m('Company'));
|
||||||
|
|
||||||
if (!empty($field['company'])) {
|
if (!empty($field['company'])) {
|
||||||
$this->out->element('div', 'field', $field['company']);
|
$this->out->element('div', 'field', $field['company']);
|
||||||
|
|
||||||
|
// TRANS: Field label in experience area of extended profile (when did one start a position).
|
||||||
$this->out->element('div', 'label', _m('Start'));
|
$this->out->element('div', 'label', _m('Start'));
|
||||||
$this->out->element(
|
$this->out->element(
|
||||||
'div',
|
'div',
|
||||||
@ -326,6 +336,7 @@ class ExtendedProfileWidget extends Form
|
|||||||
date('j M Y', strtotime($field['start'])
|
date('j M Y', strtotime($field['start'])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
// TRANS: Field label in experience area of extended profile (when did one end a position).
|
||||||
$this->out->element('div', 'label', _m('End'));
|
$this->out->element('div', 'label', _m('End'));
|
||||||
$this->out->element(
|
$this->out->element(
|
||||||
'div',
|
'div',
|
||||||
@ -338,7 +349,8 @@ class ExtendedProfileWidget extends Form
|
|||||||
$this->out->element(
|
$this->out->element(
|
||||||
'div',
|
'div',
|
||||||
array('class' => 'field current'),
|
array('class' => 'field current'),
|
||||||
'(' . _m('Current') . ')'
|
// TRANS: Field value in experience area of extended profile (one still holds a position).
|
||||||
|
_m('(Current)')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -356,6 +368,7 @@ class ExtendedProfileWidget extends Form
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TRANS: Field label in experience edit area of extended profile (which company does one work for).
|
||||||
$this->out->element('div', 'label', _m('Company'));
|
$this->out->element('div', 'label', _m('Company'));
|
||||||
$this->out->input(
|
$this->out->input(
|
||||||
$id,
|
$id,
|
||||||
@ -363,6 +376,7 @@ class ExtendedProfileWidget extends Form
|
|||||||
isset($field['company']) ? $field['company'] : null
|
isset($field['company']) ? $field['company'] : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TRANS: Field label in experience edit area of extended profile (when did one start at a company).
|
||||||
$this->out->element('div', 'label', _m('Start'));
|
$this->out->element('div', 'label', _m('Start'));
|
||||||
$this->out->input(
|
$this->out->input(
|
||||||
$id . '-start',
|
$id . '-start',
|
||||||
@ -370,6 +384,7 @@ class ExtendedProfileWidget extends Form
|
|||||||
isset($field['start']) ? date('j M Y', strtotime($field['start'])) : null
|
isset($field['start']) ? date('j M Y', strtotime($field['start'])) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TRANS: Field label in experience edit area of extended profile (when did one terminate at a company).
|
||||||
$this->out->element('div', 'label', _m('End'));
|
$this->out->element('div', 'label', _m('End'));
|
||||||
|
|
||||||
$this->out->input(
|
$this->out->input(
|
||||||
@ -384,6 +399,7 @@ class ExtendedProfileWidget extends Form
|
|||||||
$this->out->elementStart('div', 'current-checkbox');
|
$this->out->elementStart('div', 'current-checkbox');
|
||||||
$this->out->checkbox(
|
$this->out->checkbox(
|
||||||
$id . '-current',
|
$id . '-current',
|
||||||
|
// TRANS: Checkbox label in experience edit area of extended profile (one still works at a company).
|
||||||
_m('Current'),
|
_m('Current'),
|
||||||
$field['current']
|
$field['current']
|
||||||
);
|
);
|
||||||
@ -396,14 +412,17 @@ class ExtendedProfileWidget extends Form
|
|||||||
protected function showEducation($name, $field)
|
protected function showEducation($name, $field)
|
||||||
{
|
{
|
||||||
$this->out->elementStart('div', 'education-item');
|
$this->out->elementStart('div', 'education-item');
|
||||||
|
// TRANS: Field label in education area of extended profile.
|
||||||
$this->out->element('div', 'label', _m('Institution'));
|
$this->out->element('div', 'label', _m('Institution'));
|
||||||
if (!empty($field['school'])) {
|
if (!empty($field['school'])) {
|
||||||
|
|
||||||
$this->out->element('div', 'field', $field['school']);
|
$this->out->element('div', 'field', $field['school']);
|
||||||
|
// TRANS: Field label in education area of extended profile.
|
||||||
$this->out->element('div', 'label', _m('Degree'));
|
$this->out->element('div', 'label', _m('Degree'));
|
||||||
$this->out->element('div', 'field', $field['degree']);
|
$this->out->element('div', 'field', $field['degree']);
|
||||||
|
// TRANS: Field label in education area of extended profile.
|
||||||
$this->out->element('div', 'label', _m('Description'));
|
$this->out->element('div', 'label', _m('Description'));
|
||||||
$this->out->element('div', 'field', $field['description']);
|
$this->out->element('div', 'field', $field['description']);
|
||||||
|
// TRANS: Field label in education area of extended profile (when did one start an education).
|
||||||
$this->out->element('div', 'label', _m('Start'));
|
$this->out->element('div', 'label', _m('Start'));
|
||||||
$this->out->element(
|
$this->out->element(
|
||||||
'div',
|
'div',
|
||||||
@ -411,6 +430,7 @@ class ExtendedProfileWidget extends Form
|
|||||||
date('j M Y', strtotime($field['start'])
|
date('j M Y', strtotime($field['start'])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
// TRANS: Field label in education area of extended profile (when did one end a education).
|
||||||
$this->out->element('div', 'label', _m('End'));
|
$this->out->element('div', 'label', _m('End'));
|
||||||
$this->out->element(
|
$this->out->element(
|
||||||
'div',
|
'div',
|
||||||
@ -432,6 +452,7 @@ class ExtendedProfileWidget extends Form
|
|||||||
'class' => 'education-item'
|
'class' => 'education-item'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
// TRANS: Field label in education edit area of extended profile.
|
||||||
$this->out->element('div', 'label', _m('Institution'));
|
$this->out->element('div', 'label', _m('Institution'));
|
||||||
$this->out->input(
|
$this->out->input(
|
||||||
$id,
|
$id,
|
||||||
@ -439,6 +460,7 @@ class ExtendedProfileWidget extends Form
|
|||||||
isset($field['school']) ? $field['school'] : null
|
isset($field['school']) ? $field['school'] : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TRANS: Field label in education edit area of extended profile.
|
||||||
$this->out->element('div', 'label', _m('Degree'));
|
$this->out->element('div', 'label', _m('Degree'));
|
||||||
$this->out->input(
|
$this->out->input(
|
||||||
$id . '-degree',
|
$id . '-degree',
|
||||||
@ -446,6 +468,7 @@ class ExtendedProfileWidget extends Form
|
|||||||
isset($field['degree']) ? $field['degree'] : null
|
isset($field['degree']) ? $field['degree'] : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TRANS: Field label in education edit area of extended profile.
|
||||||
$this->out->element('div', 'label', _m('Description'));
|
$this->out->element('div', 'label', _m('Description'));
|
||||||
|
|
||||||
$this->out->textarea(
|
$this->out->textarea(
|
||||||
@ -454,17 +477,21 @@ class ExtendedProfileWidget extends Form
|
|||||||
isset($field['description']) ? $field['description'] : null
|
isset($field['description']) ? $field['description'] : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TRANS: Field label in education edit area of extended profile (when did one start an education).
|
||||||
$this->out->element('div', 'label', _m('Start'));
|
$this->out->element('div', 'label', _m('Start'));
|
||||||
$this->out->input(
|
$this->out->input(
|
||||||
$id . '-start',
|
$id . '-start',
|
||||||
null,
|
null,
|
||||||
|
// @todo FIXME: does date format need i18n? If so, should probly be dealt with in core.
|
||||||
isset($field['start']) ? date('j M Y', strtotime($field['start'])) : null
|
isset($field['start']) ? date('j M Y', strtotime($field['start'])) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TRANS: Field label in education edit area of extended profile (when did one end an education).
|
||||||
$this->out->element('div', 'label', _m('End'));
|
$this->out->element('div', 'label', _m('End'));
|
||||||
$this->out->input(
|
$this->out->input(
|
||||||
$id . '-end',
|
$id . '-end',
|
||||||
null,
|
null,
|
||||||
|
// @todo FIXME: does date format need i18n? If so, should probly be dealt with in core.
|
||||||
isset($field['end']) ? date('j M Y', strtotime($field['end'])) : null
|
isset($field['end']) ? date('j M Y', strtotime($field['end'])) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -491,7 +518,8 @@ class ExtendedProfileWidget extends Form
|
|||||||
'href' => 'javascript://',
|
'href' => 'javascript://',
|
||||||
'style' => 'display: none;'
|
'style' => 'display: none;'
|
||||||
),
|
),
|
||||||
'Add another item'
|
// TRANS: Link description in extended profile page to add another profile element.
|
||||||
|
_m('Add another item')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,7 +629,8 @@ class ExtendedProfileWidget extends Form
|
|||||||
$this->showEditableEducation($name, $field);
|
$this->showEditableEducation($name, $field);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$out->input($id, null, "TYPE: $type");
|
// TRANS: Field label for undefined field in extended profile.
|
||||||
|
$out->input($id, null, sprintf(_m('TYPE: %s'),$type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,14 +639,16 @@ class ExtendedProfileWidget extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit(
|
$this->out->submit(
|
||||||
'save',
|
'save',
|
||||||
|
// TRANS: Button text for saving extended profile properties.
|
||||||
_m('BUTTON','Save'),
|
_m('BUTTON','Save'),
|
||||||
'submit form_action-secondary',
|
'submit form_action-secondary',
|
||||||
'save',
|
'save',
|
||||||
|
// TRANS: .
|
||||||
|
// TRANS: Button title for saving extended profile properties.
|
||||||
_m('Save details')
|
_m('Save details')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -627,7 +658,6 @@ class ExtendedProfileWidget extends Form
|
|||||||
*
|
*
|
||||||
* @return string ID of the form
|
* @return string ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'profile-details-' . $this->profile->id;
|
return 'profile-details-' . $this->profile->id;
|
||||||
@ -638,7 +668,6 @@ class ExtendedProfileWidget extends Form
|
|||||||
*
|
*
|
||||||
* @return string of the form class
|
* @return string of the form class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_profile_details form_settings';
|
return 'form_profile_details form_settings';
|
||||||
@ -649,7 +678,6 @@ class ExtendedProfileWidget extends Form
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('profiledetailsettings');
|
return common_local_url('profiledetailsettings');
|
||||||
|
@ -101,7 +101,6 @@ class FacebookBridgePlugin extends Plugin
|
|||||||
*/
|
*/
|
||||||
function onAutoload($cls)
|
function onAutoload($cls)
|
||||||
{
|
{
|
||||||
|
|
||||||
$dir = dirname(__FILE__);
|
$dir = dirname(__FILE__);
|
||||||
|
|
||||||
//common_debug("class = " . $cls);
|
//common_debug("class = " . $cls);
|
||||||
@ -128,7 +127,6 @@ class FacebookBridgePlugin extends Plugin
|
|||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -214,10 +212,11 @@ class FacebookBridgePlugin extends Plugin
|
|||||||
if ($this->hasApplication()) {
|
if ($this->hasApplication()) {
|
||||||
|
|
||||||
$action->menuItem(
|
$action->menuItem(
|
||||||
|
// TRANS: Menu item for "Facebook" login.
|
||||||
common_local_url('facebooklogin'),
|
common_local_url('facebooklogin'),
|
||||||
_m('MENU', 'Facebook'),
|
_m('MENU', 'Facebook'),
|
||||||
// TRANS: Tooltip for menu item "Facebook".
|
// TRANS: Menu title for "Facebook" login.
|
||||||
_m('Login or register using Facebook'),
|
_m('Login or register using Facebook.'),
|
||||||
'facebooklogin' === $action_name
|
'facebooklogin' === $action_name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -253,10 +252,10 @@ class FacebookBridgePlugin extends Plugin
|
|||||||
|
|
||||||
$nav->out->menuItem(
|
$nav->out->menuItem(
|
||||||
common_local_url('facebookadminpanel'),
|
common_local_url('facebookadminpanel'),
|
||||||
// TRANS: Menu item.
|
// TRANS: Menu item for "Facebook" in administration panel.
|
||||||
_m('MENU','Facebook'),
|
_m('MENU','Facebook'),
|
||||||
// TRANS: Tooltip for menu item "Facebook".
|
// TRANS: Menu title for "Facebook" in administration panel.
|
||||||
_m('Facebook integration configuration'),
|
_m('Facebook integration configuration.'),
|
||||||
$action_name == 'facebookadminpanel',
|
$action_name == 'facebookadminpanel',
|
||||||
'nav_facebook_admin_panel'
|
'nav_facebook_admin_panel'
|
||||||
);
|
);
|
||||||
@ -294,16 +293,14 @@ class FacebookBridgePlugin extends Plugin
|
|||||||
|
|
||||||
$action->menuItem(
|
$action->menuItem(
|
||||||
common_local_url('facebooksettings'),
|
common_local_url('facebooksettings'),
|
||||||
// TRANS: Menu item tab.
|
// TRANS: Menu item for "Facebook" in user settings.
|
||||||
_m('MENU','Facebook'),
|
_m('MENU','Facebook'),
|
||||||
// TRANS: Tooltip for menu item "Facebook".
|
// TRANS: Menu title for "Facebook" in user settings.
|
||||||
_m('Facebook settings'),
|
_m('Facebook settings.'),
|
||||||
$action_name === 'facebooksettings'
|
$action_name === 'facebooksettings'
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -324,7 +321,6 @@ class FacebookBridgePlugin extends Plugin
|
|||||||
if (!empty($appId) && !empty($secret)) {
|
if (!empty($appId) && !empty($secret)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -420,7 +416,6 @@ ENDOFSCRIPT;
|
|||||||
common_debug("LOGOUT URL = $logoutUrl");
|
common_debug("LOGOUT URL = $logoutUrl");
|
||||||
common_redirect($logoutUrl, 303);
|
common_redirect($logoutUrl, 303);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,6 +556,7 @@ ENDOFSCRIPT;
|
|||||||
'author' => 'Craig Andrews, Zach Copley',
|
'author' => 'Craig Andrews, Zach Copley',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:FacebookBridge',
|
'homepage' => 'http://status.net/wiki/Plugin:FacebookBridge',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('A plugin for integrating StatusNet with Facebook.')
|
_m('A plugin for integrating StatusNet with Facebook.')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -49,7 +49,8 @@ class FacebookadminpanelAction extends AdminPanelAction
|
|||||||
*/
|
*/
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
return _m('Facebook');
|
// TRANS: Title for Facebook administration panel.
|
||||||
|
return _m('TITLE','Facebook integration settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,6 +60,7 @@ class FacebookadminpanelAction extends AdminPanelAction
|
|||||||
*/
|
*/
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
|
// TRANS: Instruction for Facebook administration panel.
|
||||||
return _m('Facebook integration settings');
|
return _m('Facebook integration settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,12 +122,14 @@ class FacebookadminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
if (mb_strlen($values['facebook']['appid']) > 255) {
|
if (mb_strlen($values['facebook']['appid']) > 255) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when providing too long a Facebook application ID.
|
||||||
_m("Invalid Facebook ID. Maximum length is 255 characters.")
|
_m("Invalid Facebook ID. Maximum length is 255 characters.")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb_strlen($values['facebook']['secret']) > 255) {
|
if (mb_strlen($values['facebook']['secret']) > 255) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when providing too long a Facebook secret key.
|
||||||
_m("Invalid Facebook secret. Maximum length is 255 characters.")
|
_m("Invalid Facebook secret. Maximum length is 255 characters.")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -175,13 +179,16 @@ class FacebookAdminPanelForm extends AdminForm
|
|||||||
'fieldset',
|
'fieldset',
|
||||||
array('id' => 'settings_facebook-application')
|
array('id' => 'settings_facebook-application')
|
||||||
);
|
);
|
||||||
|
// TRANS: Fieldset legend.
|
||||||
$this->out->element('legend', null, _m('Facebook application settings'));
|
$this->out->element('legend', null, _m('Facebook application settings'));
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input(
|
$this->input(
|
||||||
'appid',
|
'appid',
|
||||||
|
// TRANS: Field label for Facebook application ID.
|
||||||
_m('Application ID'),
|
_m('Application ID'),
|
||||||
|
// TRANS: Field title for Facebook application ID.
|
||||||
_m('ID of your Facebook application.'),
|
_m('ID of your Facebook application.'),
|
||||||
'facebook'
|
'facebook'
|
||||||
);
|
);
|
||||||
@ -190,7 +197,9 @@ class FacebookAdminPanelForm extends AdminForm
|
|||||||
$this->li();
|
$this->li();
|
||||||
$this->input(
|
$this->input(
|
||||||
'secret',
|
'secret',
|
||||||
|
// TRANS: Field label for Facebook secret key.
|
||||||
_m('Secret'),
|
_m('Secret'),
|
||||||
|
// TRANS: Field title for Facebook secret key.
|
||||||
_m('Application secret.'),
|
_m('Application secret.'),
|
||||||
'facebook'
|
'facebook'
|
||||||
);
|
);
|
||||||
@ -207,6 +216,9 @@ class FacebookAdminPanelForm extends AdminForm
|
|||||||
*/
|
*/
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit', _m('BUTTON','Save'), 'submit', null, _m('Save Facebook settings.'));
|
// TRANS: Button text to save Facebook integration settings.
|
||||||
|
$this->out->submit('submit', _m('BUTTON','Save'),
|
||||||
|
// TRANS: Button title to save Facebook integration settings.
|
||||||
|
'submit', null, _m('Save Facebook settings.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,5 +140,4 @@ class FacebookdeauthorizeAction extends Action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -38,7 +38,6 @@ class FacebookfinishloginAction extends Action
|
|||||||
private $fbuser = null; // Facebook user object (JSON)
|
private $fbuser = null; // Facebook user object (JSON)
|
||||||
|
|
||||||
function prepare($args) {
|
function prepare($args) {
|
||||||
|
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
$this->facebook = new Facebook(
|
$this->facebook = new Facebook(
|
||||||
@ -64,7 +63,6 @@ class FacebookfinishloginAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->fbuser)) {
|
if (!empty($this->fbuser)) {
|
||||||
|
|
||||||
// OKAY, all is well... proceed to register
|
// OKAY, all is well... proceed to register
|
||||||
|
|
||||||
common_debug("Found a valid Facebook user.", __FILE__);
|
common_debug("Found a valid Facebook user.", __FILE__);
|
||||||
@ -85,6 +83,7 @@ class FacebookfinishloginAction extends Action
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to connect to Facebook while not logged in.
|
||||||
_m('You must be logged into Facebook to register a local account using Facebook.')
|
_m('You must be logged into Facebook to register a local account using Facebook.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -115,6 +114,8 @@ class FacebookfinishloginAction extends Action
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to connect to a Facebook account that is already linked
|
||||||
|
// TRANS: in the same StatusNet site.
|
||||||
_m('There is already a local account linked with that Facebook account.')
|
_m('There is already a local account linked with that Facebook account.')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -138,6 +139,7 @@ class FacebookfinishloginAction extends Action
|
|||||||
|
|
||||||
if (!$token || $token != common_session_token()) {
|
if (!$token || $token != common_session_token()) {
|
||||||
$this->showForm(
|
$this->showForm(
|
||||||
|
// TRANS: Client error displayed when the session token does not match or is not given.
|
||||||
_m('There was a problem with your session token. Try again, please.')
|
_m('There was a problem with your session token. Try again, please.')
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@ -147,6 +149,7 @@ class FacebookfinishloginAction extends Action
|
|||||||
|
|
||||||
if (!$this->boolean('license')) {
|
if (!$this->boolean('license')) {
|
||||||
$this->showForm(
|
$this->showForm(
|
||||||
|
// TRANS: Form validation error displayed when user has not agreed to the license.
|
||||||
_m('You cannot register if you do not agree to the license.'),
|
_m('You cannot register if you do not agree to the license.'),
|
||||||
$this->trimmed('newname')
|
$this->trimmed('newname')
|
||||||
);
|
);
|
||||||
@ -164,6 +167,7 @@ class FacebookfinishloginAction extends Action
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->showForm(
|
$this->showForm(
|
||||||
|
// TRANS: Form validation error displayed when an unhandled error occurs.
|
||||||
_m('An unknown error has occured.'),
|
_m('An unknown error has occured.'),
|
||||||
$this->trimmed('newname')
|
$this->trimmed('newname')
|
||||||
);
|
);
|
||||||
@ -180,8 +184,9 @@ class FacebookfinishloginAction extends Action
|
|||||||
|
|
||||||
$this->element(
|
$this->element(
|
||||||
'div', 'instructions',
|
'div', 'instructions',
|
||||||
// TRANS: %s is the site name.
|
|
||||||
sprintf(
|
sprintf(
|
||||||
|
// TRANS: Form instructions for connecting to Facebook.
|
||||||
|
// TRANS: %s is the site name.
|
||||||
_m('This is the first time you have logged into %s so we must connect your Facebook to a local account. You can either create a new local account, or connect with an existing local account.'),
|
_m('This is the first time you have logged into %s so we must connect your Facebook to a local account. You can either create a new local account, or connect with an existing local account.'),
|
||||||
common_config('site', 'name')
|
common_config('site', 'name')
|
||||||
)
|
)
|
||||||
@ -209,7 +214,7 @@ class FacebookfinishloginAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fixme much of this duplicates core code, which is very fragile.
|
* @todo FIXME: Much of this duplicates core code, which is very fragile.
|
||||||
* Should probably be replaced with an extensible mini version of
|
* Should probably be replaced with an extensible mini version of
|
||||||
* the core registration form.
|
* the core registration form.
|
||||||
*/
|
*/
|
||||||
@ -225,7 +230,7 @@ class FacebookfinishloginAction extends Action
|
|||||||
'class' => 'form_settings',
|
'class' => 'form_settings',
|
||||||
'action' => common_local_url('facebookfinishlogin')));
|
'action' => common_local_url('facebookfinishlogin')));
|
||||||
$this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options'));
|
$this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options'));
|
||||||
// TRANS: Legend.
|
// TRANS: Fieldset legend.
|
||||||
$this->element('legend', null, _m('Connection options'));
|
$this->element('legend', null, _m('Connection options'));
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
@ -252,9 +257,10 @@ class FacebookfinishloginAction extends Action
|
|||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
$this->element('legend', null,
|
$this->element('legend', null,
|
||||||
// TRANS: Legend.
|
// TRANS: Fieldset legend.
|
||||||
_m('Create new account'));
|
_m('Create new account'));
|
||||||
$this->element('p', null,
|
$this->element('p', null,
|
||||||
|
// TRANS: Form instructions.
|
||||||
_m('Create a new user with this nickname.'));
|
_m('Create a new user with this nickname.'));
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
@ -265,6 +271,7 @@ class FacebookfinishloginAction extends Action
|
|||||||
// TRANS: Field label.
|
// TRANS: Field label.
|
||||||
$this->input('newname', _m('New nickname'),
|
$this->input('newname', _m('New nickname'),
|
||||||
($this->username) ? $this->username : '',
|
($this->username) ? $this->username : '',
|
||||||
|
// TRANS: Field title.
|
||||||
_m('1-64 lowercase letters or numbers, no punctuation or spaces.'));
|
_m('1-64 lowercase letters or numbers, no punctuation or spaces.'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
|
||||||
@ -272,15 +279,16 @@ class FacebookfinishloginAction extends Action
|
|||||||
Event::handle('EndRegistrationFormData', array($this));
|
Event::handle('EndRegistrationFormData', array($this));
|
||||||
|
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
// TRANS: Submit button.
|
// TRANS: Submit button to create a new account.
|
||||||
$this->submit('create', _m('BUTTON','Create'));
|
$this->submit('create', _m('BUTTON','Create'));
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
|
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
// TRANS: Legend.
|
|
||||||
$this->element('legend', null,
|
$this->element('legend', null,
|
||||||
|
// TRANS: Fieldset legend.
|
||||||
_m('Connect existing account'));
|
_m('Connect existing account'));
|
||||||
$this->element('p', null,
|
$this->element('p', null,
|
||||||
|
// TRANS: Form instructions.
|
||||||
_m('If you already have an account, login with your username and password to connect it to your Facebook.'));
|
_m('If you already have an account, login with your username and password to connect it to your Facebook.'));
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
@ -288,10 +296,11 @@ class FacebookfinishloginAction extends Action
|
|||||||
$this->input('nickname', _m('Existing nickname'));
|
$this->input('nickname', _m('Existing nickname'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
|
// TRANS: Field label.
|
||||||
$this->password('password', _m('Password'));
|
$this->password('password', _m('Password'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
// TRANS: Submit button.
|
// TRANS: Submit button to connect a Facebook account to an existing StatusNet account.
|
||||||
$this->submit('connect', _m('BUTTON','Connect'));
|
$this->submit('connect', _m('BUTTON','Connect'));
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
|
|
||||||
@ -344,11 +353,13 @@ class FacebookfinishloginAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!User::allowed_nickname($nickname)) {
|
if (!User::allowed_nickname($nickname)) {
|
||||||
|
// TRANS: Form validation error displayed when picking a nickname that is not allowed.
|
||||||
$this->showForm(_m('Nickname not allowed.'));
|
$this->showForm(_m('Nickname not allowed.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (User::staticGet('nickname', $nickname)) {
|
if (User::staticGet('nickname', $nickname)) {
|
||||||
|
// TRANS: Form validation error displayed when picking a nickname that is already in use.
|
||||||
$this->showForm(_m('Nickname already in use. Try another one.'));
|
$this->showForm(_m('Nickname already in use. Try another one.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -377,6 +388,7 @@ class FacebookfinishloginAction extends Action
|
|||||||
$result = $this->flinkUser($user->id, $this->fbuid);
|
$result = $this->flinkUser($user->id, $this->fbuid);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
// TRANS: Server error displayed when connecting to Facebook fails.
|
||||||
$this->serverError(_m('Error connecting user to Facebook.'));
|
$this->serverError(_m('Error connecting user to Facebook.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -479,6 +491,7 @@ class FacebookfinishloginAction extends Action
|
|||||||
$password = $this->trimmed('password');
|
$password = $this->trimmed('password');
|
||||||
|
|
||||||
if (!common_check_user($nickname, $password)) {
|
if (!common_check_user($nickname, $password)) {
|
||||||
|
// TRANS: Form validation error displayed when username/password combination is incorrect.
|
||||||
$this->showForm(_m('Invalid username or password.'));
|
$this->showForm(_m('Invalid username or password.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -516,6 +529,7 @@ class FacebookfinishloginAction extends Action
|
|||||||
$result = $this->flinkUser($user->id, $this->fbuid);
|
$result = $this->flinkUser($user->id, $this->fbuid);
|
||||||
|
|
||||||
if (empty($result)) {
|
if (empty($result)) {
|
||||||
|
// TRANS: Server error displayed when connecting to Facebook fails.
|
||||||
$this->serverError(_m('Error connecting user to Facebook.'));
|
$this->serverError(_m('Error connecting user to Facebook.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -687,5 +701,4 @@ class FacebookfinishloginAction extends Action
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,12 +34,12 @@ if (!defined('STATUSNET')) {
|
|||||||
|
|
||||||
class FacebookloginAction extends Action
|
class FacebookloginAction extends Action
|
||||||
{
|
{
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (common_is_real_login()) {
|
if (common_is_real_login()) {
|
||||||
|
// TRANS: Client error displayed when trying to login while already logged in.
|
||||||
$this->clientError(_m('Already logged in.'));
|
$this->clientError(_m('Already logged in.'));
|
||||||
} else {
|
} else {
|
||||||
$this->showPage();
|
$this->showPage();
|
||||||
@ -48,7 +48,7 @@ class FacebookloginAction extends Action
|
|||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Instructions.
|
// TRANS: Form instructions.
|
||||||
return _m('Login with your Facebook Account');
|
return _m('Login with your Facebook Account');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,6 @@ class FacebookloginAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showContent() {
|
function showContent() {
|
||||||
|
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
|
|
||||||
$facebook = Facebookclient::getFacebook();
|
$facebook = Facebookclient::getFacebook();
|
||||||
@ -90,8 +89,10 @@ class FacebookloginAction extends Action
|
|||||||
|
|
||||||
$attrs = array(
|
$attrs = array(
|
||||||
'src' => Plugin::staticPath('FacebookBridge', 'images/login-button.png'),
|
'src' => Plugin::staticPath('FacebookBridge', 'images/login-button.png'),
|
||||||
'alt' => 'Login with Facebook',
|
// TRANS: Alt text for "Login with Facebook" image.
|
||||||
'title' => 'Login with Facebook'
|
'alt' => _m('Login with Facebook'),
|
||||||
|
// TRANS: Title for "Login with Facebook" image.
|
||||||
|
'title' => _m('Login with Facebook.')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->element('img', $attrs);
|
$this->element('img', $attrs);
|
||||||
@ -117,4 +118,3 @@ class FacebookloginAction extends Action
|
|||||||
$nav->show();
|
$nav->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ class FacebooksettingsAction extends SettingsAction {
|
|||||||
$token = $this->trimmed('token');
|
$token = $this->trimmed('token');
|
||||||
if (!$token || $token != common_session_token()) {
|
if (!$token || $token != common_session_token()) {
|
||||||
$this->showForm(
|
$this->showForm(
|
||||||
|
// TRANS: Client error displayed when the session token does not match or is not given.
|
||||||
_m('There was a problem with your session token. Try again, please.')
|
_m('There was a problem with your session token. Try again, please.')
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@ -102,7 +103,7 @@ class FacebooksettingsAction extends SettingsAction {
|
|||||||
*/
|
*/
|
||||||
function title() {
|
function title() {
|
||||||
// TRANS: Page title for Facebook settings.
|
// TRANS: Page title for Facebook settings.
|
||||||
return _m('Facebook settings');
|
return _m('TITLE','Facebook settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,6 +112,7 @@ class FacebooksettingsAction extends SettingsAction {
|
|||||||
* @return instructions for use
|
* @return instructions for use
|
||||||
*/
|
*/
|
||||||
function getInstructions() {
|
function getInstructions() {
|
||||||
|
// TRANS: Instructions for Facebook settings.
|
||||||
return _m('Facebook settings');
|
return _m('Facebook settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,6 +136,7 @@ class FacebooksettingsAction extends SettingsAction {
|
|||||||
|
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
|
|
||||||
|
// TRANS: Form note. User is connected to facebook.
|
||||||
$this->element('p', 'form_note', _m('Connected Facebook user'));
|
$this->element('p', 'form_note', _m('Connected Facebook user'));
|
||||||
|
|
||||||
$this->elementStart('p', array('class' => 'facebook-user-display'));
|
$this->elementStart('p', array('class' => 'facebook-user-display'));
|
||||||
@ -161,6 +164,7 @@ class FacebooksettingsAction extends SettingsAction {
|
|||||||
|
|
||||||
$this->checkbox(
|
$this->checkbox(
|
||||||
'noticesync',
|
'noticesync',
|
||||||
|
// TRANS: Checkbox label in Facebook settings.
|
||||||
_m('Publish my notices to Facebook.'),
|
_m('Publish my notices to Facebook.'),
|
||||||
($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND) : true
|
($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND) : true
|
||||||
);
|
);
|
||||||
@ -171,6 +175,7 @@ class FacebooksettingsAction extends SettingsAction {
|
|||||||
|
|
||||||
$this->checkbox(
|
$this->checkbox(
|
||||||
'replysync',
|
'replysync',
|
||||||
|
// TRANS: Checkbox label in Facebook settings.
|
||||||
_m('Send "@" replies to Facebook.'),
|
_m('Send "@" replies to Facebook.'),
|
||||||
($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true
|
($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true
|
||||||
);
|
);
|
||||||
@ -188,13 +193,14 @@ class FacebooksettingsAction extends SettingsAction {
|
|||||||
|
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
|
|
||||||
// TRANS: Legend.
|
// TRANS: Fieldset legend for form to disconnect from Facebook.
|
||||||
$this->element('legend', null, _m('Disconnect my account from Facebook'));
|
$this->element('legend', null, _m('Disconnect my account from Facebook'));
|
||||||
|
|
||||||
if (empty($this->user->password)) {
|
if (empty($this->user->password)) {
|
||||||
$this->elementStart('p', array('class' => 'form_guide'));
|
$this->elementStart('p', array('class' => 'form_guide'));
|
||||||
|
|
||||||
$msg = sprintf(
|
$msg = sprintf(
|
||||||
|
// TRANS: Notice in disconnect from Facebook form if user has no local StatusNet password.
|
||||||
_m(
|
_m(
|
||||||
'Disconnecting your Faceboook would make it impossible to '
|
'Disconnecting your Faceboook would make it impossible to '
|
||||||
. 'log in! Please [set a password](%s) first.'
|
. 'log in! Please [set a password](%s) first.'
|
||||||
@ -206,13 +212,10 @@ class FacebooksettingsAction extends SettingsAction {
|
|||||||
$this->elementEnd('p');
|
$this->elementEnd('p');
|
||||||
} else {
|
} else {
|
||||||
// @todo FIXME: i18n: This message is not being used.
|
// @todo FIXME: i18n: This message is not being used.
|
||||||
$msg = sprintf(
|
|
||||||
// TRANS: Message displayed when initiating disconnect of a StatusNet user
|
// TRANS: Message displayed when initiating disconnect of a StatusNet user
|
||||||
// TRANS: from a Facebook account. %1$s is the StatusNet site name.
|
// TRANS: from a Facebook account. %1$s is the StatusNet site name.
|
||||||
_m(
|
$msg = sprintf(_m('Keep your %1$s account but disconnect from Facebook. ' .
|
||||||
'Keep your %1$s account but disconnect from Facebook. ' .
|
'You\'ll use your %1$s password to log in.'),
|
||||||
'You\'ll use your %1$s password to log in.'
|
|
||||||
),
|
|
||||||
common_config('site', 'name')
|
common_config('site', 'name')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -240,6 +243,7 @@ class FacebooksettingsAction extends SettingsAction {
|
|||||||
$result = $this->flink->update($original);
|
$result = $this->flink->update($original);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
|
// TRANS: Notice in case saving of synchronisation preferences fail.
|
||||||
$this->showForm(_m('There was a problem saving your sync preferences.'));
|
$this->showForm(_m('There was a problem saving your sync preferences.'));
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Confirmation that synchronisation settings have been saved into the system.
|
// TRANS: Confirmation that synchronisation settings have been saved into the system.
|
||||||
@ -257,10 +261,12 @@ class FacebooksettingsAction extends SettingsAction {
|
|||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
common_log_db_error($user, 'DELETE', __FILE__);
|
common_log_db_error($user, 'DELETE', __FILE__);
|
||||||
|
// TRANS: Server error displayed when deleting the link to a Facebook account fails.
|
||||||
$this->serverError(_m('Could not delete link to Facebook.'));
|
$this->serverError(_m('Could not delete link to Facebook.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRANS: Confirmation message. StatusNet account was unlinked from Facebook.
|
||||||
$this->showForm(_m('You have disconnected from Facebook.'), true);
|
$this->showForm(_m('You have disconnected from Facebook.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
|||||||
*
|
*
|
||||||
* @see DB_DataObject
|
* @see DB_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Notice_to_item extends Memcached_DataObject
|
class Notice_to_item extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
public $__table = 'notice_to_item'; // table name
|
public $__table = 'notice_to_item'; // table name
|
||||||
@ -67,7 +66,6 @@ class Notice_to_item extends Memcached_DataObject
|
|||||||
* @return Notice_to_item object found, or null for no hits
|
* @return Notice_to_item object found, or null for no hits
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function staticGet($k, $v=null)
|
function staticGet($k, $v=null)
|
||||||
{
|
{
|
||||||
return Memcached_DataObject::staticGet('Notice_to_item', $k, $v);
|
return Memcached_DataObject::staticGet('Notice_to_item', $k, $v);
|
||||||
@ -81,7 +79,6 @@ class Notice_to_item extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return array array of column definitions
|
* @return array array of column definitions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function table()
|
function table()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
@ -109,7 +106,6 @@ class Notice_to_item extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return array list of key field names
|
* @return array list of key field names
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function keys()
|
function keys()
|
||||||
{
|
{
|
||||||
return array_keys($this->keyTypes());
|
return array_keys($this->keyTypes());
|
||||||
@ -127,7 +123,6 @@ class Notice_to_item extends Memcached_DataObject
|
|||||||
* 'K' for primary key: for compound keys, add an entry for each component;
|
* 'K' for primary key: for compound keys, add an entry for each component;
|
||||||
* 'U' for unique keys: compound keys are not well supported here.
|
* 'U' for unique keys: compound keys are not well supported here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function keyTypes()
|
function keyTypes()
|
||||||
{
|
{
|
||||||
return array('notice_id' => 'K', 'item_id' => 'U');
|
return array('notice_id' => 'K', 'item_id' => 'U');
|
||||||
@ -143,7 +138,6 @@ class Notice_to_item extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return array magic three-false array that stops auto-incrementing.
|
* @return array magic three-false array that stops auto-incrementing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function sequenceKey()
|
function sequenceKey()
|
||||||
{
|
{
|
||||||
return array(false, false, false);
|
return array(false, false, false);
|
||||||
@ -157,7 +151,6 @@ class Notice_to_item extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return Notice_to_item new object for this value
|
* @return Notice_to_item new object for this value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function saveNew($notice_id, $item_id)
|
static function saveNew($notice_id, $item_id)
|
||||||
{
|
{
|
||||||
$n2i = Notice_to_item::staticGet('notice_id', $notice_id);
|
$n2i = Notice_to_item::staticGet('notice_id', $notice_id);
|
||||||
|
@ -340,7 +340,8 @@ class Facebookclient
|
|||||||
function checkPermission($permission)
|
function checkPermission($permission)
|
||||||
{
|
{
|
||||||
if (!in_array($permission, array('publish_stream', 'status_update'))) {
|
if (!in_array($permission, array('publish_stream', 'status_update'))) {
|
||||||
throw new ServerException("No such permission!");
|
// TRANS: Server exception thrown when permission check fails.
|
||||||
|
throw new ServerException(_('No such permission!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$fbuid = $this->flink->foreign_id;
|
$fbuid = $this->flink->foreign_id;
|
||||||
@ -397,7 +398,6 @@ class Facebookclient
|
|||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ class Facebookclient
|
|||||||
),
|
),
|
||||||
__FILE__
|
__FILE__
|
||||||
);
|
);
|
||||||
// @fixme: We want to rety at a later time when the throttling has expired
|
// @todo FIXME: We want to rety at a later time when the throttling has expired
|
||||||
// instead of just giving up.
|
// instead of just giving up.
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
@ -582,7 +582,6 @@ class Facebookclient
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($result)) { // result will contain the item ID
|
if (!empty($result)) { // result will contain the item ID
|
||||||
|
|
||||||
// Save a mapping
|
// Save a mapping
|
||||||
Notice_to_item::saveNew($this->notice->id, $result);
|
Notice_to_item::saveNew($this->notice->id, $result);
|
||||||
|
|
||||||
@ -598,7 +597,6 @@ class Facebookclient
|
|||||||
),
|
),
|
||||||
__FILE__
|
__FILE__
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$msg = sprintf(
|
$msg = sprintf(
|
||||||
@ -740,7 +738,6 @@ class Facebookclient
|
|||||||
$result = $this->mailFacebookDisconnect();
|
$result = $this->mailFacebookDisconnect();
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
|
||||||
$msg = 'Unable to send email to notify %s (%d), fbuid %d '
|
$msg = 'Unable to send email to notify %s (%d), fbuid %d '
|
||||||
. 'about his/her Facebook link being removed.';
|
. 'about his/her Facebook link being removed.';
|
||||||
|
|
||||||
@ -755,9 +752,7 @@ class Facebookclient
|
|||||||
__FILE__
|
__FILE__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$msg = 'Unable to send email to notify %s (%d), fbuid %d '
|
$msg = 'Unable to send email to notify %s (%d), fbuid %d '
|
||||||
. 'about his/her Facebook link being removed because the '
|
. 'about his/her Facebook link being removed because the '
|
||||||
. 'user has not set an email address.';
|
. 'user has not set an email address.';
|
||||||
@ -789,26 +784,23 @@ class Facebookclient
|
|||||||
|
|
||||||
common_switch_locale($this->user->language);
|
common_switch_locale($this->user->language);
|
||||||
|
|
||||||
|
// TRANS: E-mail subject.
|
||||||
$subject = _m('Your Facebook connection has been removed');
|
$subject = _m('Your Facebook connection has been removed');
|
||||||
|
|
||||||
$msg = <<<BODY
|
// TRANS: E-mail body. %1$s is a username, %2$s is the StatusNet sitename.
|
||||||
Hi %1$s,
|
$msg = _m('Hi %1$s,\n\n'.
|
||||||
|
'We are sorry to inform you we are unable to publish your notice to\n'.
|
||||||
|
'Facebook, and have removed the connection between your %2$s account and\n'.
|
||||||
|
'Facebook.\n\n'.
|
||||||
|
'This may have happened because you have removed permission for %2$s\n'.
|
||||||
|
'to post on your behalf, or perhaps you have deactivated your Facebook\n'.
|
||||||
|
'account. You can reconnect your %2$s account to Facebook at any time by\n'.
|
||||||
|
'logging in with Facebook again.\n\n'.
|
||||||
|
'Sincerely,\n\n'.
|
||||||
|
'%2$s\n');
|
||||||
|
|
||||||
We're sorry to inform you we are unable to publish your notice to
|
|
||||||
Facebook, and have removed the connection between your %2$s account and
|
|
||||||
Facebook.
|
|
||||||
|
|
||||||
This may have happened because you have removed permission for %2$s
|
|
||||||
to post on your behalf, or perhaps you have deactivated your Facebook
|
|
||||||
account. You can reconnect your %s account to Facebook at any time by
|
|
||||||
logging in with Facebook again.
|
|
||||||
|
|
||||||
Sincerely,
|
|
||||||
|
|
||||||
%2$s
|
|
||||||
BODY;
|
|
||||||
$body = sprintf(
|
$body = sprintf(
|
||||||
_m($msg),
|
$msg,
|
||||||
$this->user->nickname,
|
$this->user->nickname,
|
||||||
$siteName
|
$siteName
|
||||||
);
|
);
|
||||||
@ -848,22 +840,21 @@ BODY;
|
|||||||
|
|
||||||
common_switch_locale($user->language);
|
common_switch_locale($user->language);
|
||||||
|
|
||||||
|
// TRANS: E-mail subject. %s is the StatusNet sitename.
|
||||||
$subject = _m('Contact the %s administrator to retrieve your account');
|
$subject = _m('Contact the %s administrator to retrieve your account');
|
||||||
|
|
||||||
$msg = <<<BODY
|
// TRANS: E-mail body. %1$s is a username,
|
||||||
Hi %1$s,
|
// TRANS: %2$s is the StatusNet sitename, %3$s is the site contact e-mail address.
|
||||||
|
$msg = _m('Hi %1$s,\n\n'.
|
||||||
|
'We have noticed you have deauthorized the Facebook connection for your\n'.
|
||||||
|
'%2$s account. You have not set a password for your %2$s account yet, so\n'.
|
||||||
|
'you will not be able to login. If you wish to continue using your %2$s\n'.
|
||||||
|
'account, please contact the site administrator (%3$s) to set a password.\n\n'.
|
||||||
|
'Sincerely,\n\n'.
|
||||||
|
'%2$s\n');
|
||||||
|
|
||||||
We've noticed you have deauthorized the Facebook connection for your
|
|
||||||
%2$s account. You have not set a password for your %2$s account yet, so
|
|
||||||
you will not be able to login. If you wish to continue using your %2$s
|
|
||||||
account, please contact the site administrator (%3$s) to set a password.
|
|
||||||
|
|
||||||
Sincerely,
|
|
||||||
|
|
||||||
%2$s
|
|
||||||
BODY;
|
|
||||||
$body = sprintf(
|
$body = sprintf(
|
||||||
_m($msg),
|
$msg,
|
||||||
$user->nickname,
|
$user->nickname,
|
||||||
$siteName,
|
$siteName,
|
||||||
$siteEmail
|
$siteEmail
|
||||||
@ -990,9 +981,7 @@ BODY;
|
|||||||
$n2i = Notice_to_item::staticGet('notice_id', $this->notice->id);
|
$n2i = Notice_to_item::staticGet('notice_id', $this->notice->id);
|
||||||
|
|
||||||
if (!empty($this->flink) && !empty($n2i)) {
|
if (!empty($this->flink) && !empty($n2i)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$result = $this->facebook->api(
|
$result = $this->facebook->api(
|
||||||
array(
|
array(
|
||||||
'method' => 'stream.remove',
|
'method' => 'stream.remove',
|
||||||
@ -1002,7 +991,6 @@ BODY;
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($result) && result == true) {
|
if (!empty($result) && result == true) {
|
||||||
|
|
||||||
common_log(
|
common_log(
|
||||||
LOG_INFO,
|
LOG_INFO,
|
||||||
sprintf(
|
sprintf(
|
||||||
@ -1020,7 +1008,6 @@ BODY;
|
|||||||
} else {
|
} else {
|
||||||
throw new FaceboookApiException(var_export($result, true));
|
throw new FaceboookApiException(var_export($result, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (FacebookApiException $e) {
|
} catch (FacebookApiException $e) {
|
||||||
common_log(
|
common_log(
|
||||||
LOG_WARNING,
|
LOG_WARNING,
|
||||||
@ -1049,9 +1036,7 @@ BODY;
|
|||||||
$n2i = Notice_to_item::staticGet('notice_id', $this->notice->id);
|
$n2i = Notice_to_item::staticGet('notice_id', $this->notice->id);
|
||||||
|
|
||||||
if (!empty($this->flink) && !empty($n2i)) {
|
if (!empty($this->flink) && !empty($n2i)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$result = $this->facebook->api(
|
$result = $this->facebook->api(
|
||||||
array(
|
array(
|
||||||
'method' => 'stream.addlike',
|
'method' => 'stream.addlike',
|
||||||
@ -1061,7 +1046,6 @@ BODY;
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($result) && result == true) {
|
if (!empty($result) && result == true) {
|
||||||
|
|
||||||
common_log(
|
common_log(
|
||||||
LOG_INFO,
|
LOG_INFO,
|
||||||
sprintf(
|
sprintf(
|
||||||
@ -1073,11 +1057,9 @@ BODY;
|
|||||||
),
|
),
|
||||||
__FILE__
|
__FILE__
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new FacebookApiException(var_export($result, true));
|
throw new FacebookApiException(var_export($result, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (FacebookApiException $e) {
|
} catch (FacebookApiException $e) {
|
||||||
common_log(
|
common_log(
|
||||||
LOG_WARNING,
|
LOG_WARNING,
|
||||||
@ -1105,9 +1087,7 @@ BODY;
|
|||||||
$n2i = Notice_to_item::staticGet('notice_id', $this->notice->id);
|
$n2i = Notice_to_item::staticGet('notice_id', $this->notice->id);
|
||||||
|
|
||||||
if (!empty($this->flink) && !empty($n2i)) {
|
if (!empty($this->flink) && !empty($n2i)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$result = $this->facebook->api(
|
$result = $this->facebook->api(
|
||||||
array(
|
array(
|
||||||
'method' => 'stream.removeLike',
|
'method' => 'stream.removeLike',
|
||||||
@ -1117,7 +1097,6 @@ BODY;
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($result) && result == true) {
|
if (!empty($result) && result == true) {
|
||||||
|
|
||||||
common_log(
|
common_log(
|
||||||
LOG_INFO,
|
LOG_INFO,
|
||||||
sprintf(
|
sprintf(
|
||||||
@ -1133,7 +1112,6 @@ BODY;
|
|||||||
} else {
|
} else {
|
||||||
throw new FacebookApiException(var_export($result, true));
|
throw new FacebookApiException(var_export($result, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (FacebookApiException $e) {
|
} catch (FacebookApiException $e) {
|
||||||
common_log(
|
common_log(
|
||||||
LOG_WARNING,
|
LOG_WARNING,
|
||||||
@ -1151,5 +1129,4 @@ BODY;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,11 +48,11 @@ class AllmapAction extends MapAction
|
|||||||
{
|
{
|
||||||
if (parent::prepare($args)) {
|
if (parent::prepare($args)) {
|
||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
if (!empty($cur) && $cur->id == $this->user->id) {
|
$stream = new InboxNoticeStream($this->user, $cur->getProfile());
|
||||||
$this->notice = $this->user->noticeInbox(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
$this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
|
||||||
} else {
|
NOTICES_PER_PAGE + 1,
|
||||||
$this->notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
null,
|
||||||
}
|
null);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -25,9 +25,8 @@ if (!defined('STATUSNET')) {
|
|||||||
* Check DB queries for filesorts and such and log em.
|
* Check DB queries for filesorts and such and log em.
|
||||||
*
|
*
|
||||||
* @package SQLStatsPlugin
|
* @package SQLStatsPlugin
|
||||||
* @maintainer Evan Prodromou <brion@status.net>
|
* @maintainer Evan Prodromou <evan@status.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class SQLStatsPlugin extends Plugin
|
class SQLStatsPlugin extends Plugin
|
||||||
{
|
{
|
||||||
protected $queryCount = 0;
|
protected $queryCount = 0;
|
||||||
@ -42,6 +41,7 @@ class SQLStatsPlugin extends Plugin
|
|||||||
'author' => 'Evan Prodromou',
|
'author' => 'Evan Prodromou',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:SQLStats',
|
'homepage' => 'http://status.net/wiki/Plugin:SQLStats',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin decription.
|
||||||
_m('Debug tool to watch for poorly indexed DB queries.'));
|
_m('Debug tool to watch for poorly indexed DB queries.'));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -82,7 +82,8 @@ function newNotice($i, $tagmax)
|
|||||||
|
|
||||||
if ($is_reply == 0) {
|
if ($is_reply == 0) {
|
||||||
common_set_user($user);
|
common_set_user($user);
|
||||||
$notices = $user->noticesWithFriends(0, 20);
|
$stream = new InboxNoticeStream($user);
|
||||||
|
$notices = $stream->getNotices(0, 20, null, null);
|
||||||
if ($notices->N > 0) {
|
if ($notices->N > 0) {
|
||||||
$nval = rand(0, $notices->N - 1);
|
$nval = rand(0, $notices->N - 1);
|
||||||
$notices->fetch(); // go to 0th
|
$notices->fetch(); // go to 0th
|
||||||
|
Loading…
x
Reference in New Issue
Block a user