Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 1.0.x
Conflicts: lib/default.php lib/util.php plugins/UrlShortener/UrlShortenerPlugin.php (has been removed?)
This commit is contained in:
commit
b1a68e15b7
|
@ -18,15 +18,19 @@
|
|||
*
|
||||
* @category Actions
|
||||
* @package Actions
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Mike Cochrane <mikec@mikenz.geek.nz>
|
||||
* @author Robin Millette <millette@controlyourself.ca>
|
||||
* @author Adrian Lang <mail@adrianlang.de>
|
||||
* @author Meitar Moscovitz <meitarm@gmail.com>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Brenda Wallace <shiny@cpan.org>
|
||||
* @author Brion Vibber <brion@pobox.com>
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@controlyourself.ca>
|
||||
* @author Meitar Moscovitz <meitarm@gmail.com>
|
||||
* @author Mike Cochrane <mikec@mikenz.geek.nz>
|
||||
* @author Robin Millette <millette@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Siebrand Mazeland <s.mazeland@xs4all.nl>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license GNU Affero General Public License http://www.gnu.org/licenses/
|
||||
* @link http://status.net
|
||||
*/
|
||||
|
|
|
@ -21,8 +21,10 @@
|
|||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Brion Vibber <brion@pobox.com>
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Robin Millette <robin@millette.info>
|
||||
* @author Siebrand Mazeland <s.mazeland@xs4all.nl>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Siebrand Mazeland <s.mazeland@xs4all.nl>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* @author Robin Millette <robin@millette.info>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -120,18 +121,11 @@ class ApiStatusesDestroyAction extends ApiAuthAction
|
|||
$replies->get('notice_id', $this->notice_id);
|
||||
$replies->delete();
|
||||
$this->notice->delete();
|
||||
|
||||
if ($this->format == 'xml') {
|
||||
$this->showSingleXmlStatus($this->notice);
|
||||
} elseif ($this->format == 'json') {
|
||||
$this->show_single_json_status($this->notice);
|
||||
}
|
||||
$this->showNotice();
|
||||
} else {
|
||||
$this->clientError(_('You may not delete another user\'s status.'),
|
||||
403, $this->format);
|
||||
}
|
||||
|
||||
$this->showNotice();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* @author Robin Millette <robin@millette.info>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* @author Robin Millette <robin@millette.info>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009-2010 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009-2010 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -150,7 +151,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
|||
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
$atom = new AtomNoticeFeed();
|
||||
$atom = new AtomNoticeFeed($this->auth_user);
|
||||
|
||||
$atom->setId($id);
|
||||
$atom->setTitle($title);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* @author Robin Millette <robin@millette.info>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009-2010 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -248,7 +249,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
|||
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
$atom = new AtomNoticeFeed();
|
||||
$atom = new AtomNoticeFeed($this->auth_user);
|
||||
|
||||
$atom->setId($id);
|
||||
$atom->setTitle($title);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -105,7 +106,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
|||
function showTimeline()
|
||||
{
|
||||
// We'll pull common formatting out of this for other formats
|
||||
$atom = new AtomGroupNoticeFeed($this->group);
|
||||
$atom = new AtomGroupNoticeFeed($this->group, $this->auth_user);
|
||||
|
||||
$self = $this->getSelfUri();
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* @author Robin Millette <robin@millette.info>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -152,7 +153,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
|||
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
$atom = new AtomNoticeFeed();
|
||||
$atom = new AtomNoticeFeed($this->auth_user);
|
||||
|
||||
$atom->setId($id);
|
||||
$atom->setTitle($title);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* @author Robin Millette <robin@millette.info>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -151,7 +152,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
|||
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
$atom = new AtomNoticeFeed();
|
||||
$atom = new AtomNoticeFeed($this->auth_user);
|
||||
|
||||
$atom->setId($id);
|
||||
$atom->setTitle($title);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* @author Robin Millette <robin@millette.info>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -219,7 +220,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
|||
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
$atom = new AtomNoticeFeed();
|
||||
$atom = new AtomNoticeFeed($this->auth_user);
|
||||
|
||||
$atom->setId($id);
|
||||
$atom->setTitle($title);
|
||||
|
|
|
@ -117,7 +117,7 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
|||
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
$atom = new AtomNoticeFeed();
|
||||
$atom = new AtomNoticeFeed($this->auth_user);
|
||||
|
||||
$atom->setId($id);
|
||||
$atom->setTitle($title);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009-2010 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -138,7 +139,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
|||
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
$atom = new AtomNoticeFeed();
|
||||
$atom = new AtomNoticeFeed($this->auth_user);
|
||||
|
||||
$atom->setId($id);
|
||||
$atom->setTitle($title);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* @author Robin Millette <robin@millette.info>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -115,7 +116,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
|||
|
||||
// We'll use the shared params from the Atom stub
|
||||
// for other feed types.
|
||||
$atom = new AtomUserNoticeFeed($this->user);
|
||||
$atom = new AtomUserNoticeFeed($this->user, $this->auth_user);
|
||||
|
||||
$link = common_local_url(
|
||||
'showstream',
|
||||
|
|
|
@ -87,13 +87,15 @@ class BlockAction extends ProfileFormAction
|
|||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if ($this->arg('no')) {
|
||||
$this->returnToArgs();
|
||||
$this->returnToPrevious();
|
||||
} elseif ($this->arg('yes')) {
|
||||
$this->handlePost();
|
||||
$this->returnToArgs();
|
||||
$this->returnToPrevious();
|
||||
} else {
|
||||
$this->showPage();
|
||||
}
|
||||
} else {
|
||||
$this->showPage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,6 +120,12 @@ class BlockAction extends ProfileFormAction
|
|||
*/
|
||||
function areYouSureForm()
|
||||
{
|
||||
// @fixme if we ajaxify the confirmation form, skip the preview on ajax hits
|
||||
$profile = new ArrayWrapper(array($this->profile));
|
||||
$preview = new ProfileList($profile, $this);
|
||||
$preview->show();
|
||||
|
||||
|
||||
$id = $this->profile->id;
|
||||
$this->elementStart('form', array('id' => 'block-' . $id,
|
||||
'method' => 'post',
|
||||
|
@ -187,4 +195,38 @@ class BlockAction extends ProfileFormAction
|
|||
$this->autofocus('form_action-yes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Override for form session token checks; on our first hit we're just
|
||||
* requesting confirmation, which doesn't need a token. We need to be
|
||||
* able to take regular GET requests from email!
|
||||
*
|
||||
* @throws ClientException if token is bad on POST request or if we have
|
||||
* confirmation parameters which could trigger something.
|
||||
*/
|
||||
function checkSessionToken()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' ||
|
||||
$this->arg('yes') ||
|
||||
$this->arg('no')) {
|
||||
|
||||
return parent::checkSessionToken();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If we reached this form without returnto arguments, return to the
|
||||
* current user's subscription list.
|
||||
*
|
||||
* @return string URL
|
||||
*/
|
||||
function defaultReturnTo()
|
||||
{
|
||||
$user = common_current_user();
|
||||
if ($user) {
|
||||
return common_local_url('subscribers',
|
||||
array('nickname' => $user->nickname));
|
||||
} else {
|
||||
return common_local_url('public');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,10 +92,10 @@ class DeleteuserAction extends ProfileFormAction
|
|||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if ($this->arg('no')) {
|
||||
$this->returnToArgs();
|
||||
$this->returnToPrevious();
|
||||
} elseif ($this->arg('yes')) {
|
||||
$this->handlePost();
|
||||
$this->returnToArgs();
|
||||
$this->returnToPrevious();
|
||||
} else {
|
||||
$this->showPage();
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -117,7 +117,7 @@ class GroupblockAction extends RedirectingAction
|
|||
parent::handle($args);
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if ($this->arg('no')) {
|
||||
$this->returnToArgs();
|
||||
$this->returnToPrevious();
|
||||
} elseif ($this->arg('yes')) {
|
||||
$this->blockProfile();
|
||||
} elseif ($this->arg('blockto')) {
|
||||
|
@ -207,7 +207,7 @@ class GroupblockAction extends RedirectingAction
|
|||
return false;
|
||||
}
|
||||
|
||||
$this->returnToArgs();
|
||||
$this->returnToPrevious();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @author Robin Millette <millette@status.net>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*
|
||||
|
@ -44,6 +46,7 @@ require_once INSTALLDIR.'/lib/xrdsoutputter.php';
|
|||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Robin Millette <millette@status.net>
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*
|
||||
|
|
|
@ -41,6 +41,8 @@ if (!defined('STATUSNET')) {
|
|||
* @category Info
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -116,7 +116,11 @@ class File extends Memcached_DataObject
|
|||
return false;
|
||||
}
|
||||
|
||||
function processNew($given_url, $notice_id=null) {
|
||||
/**
|
||||
* @fixme refactor this mess, it's gotten pretty scary.
|
||||
* @param bool $followRedirects
|
||||
*/
|
||||
function processNew($given_url, $notice_id=null, $followRedirects=true) {
|
||||
if (empty($given_url)) return -1; // error, no url to process
|
||||
$given_url = File_redirection::_canonUrl($given_url);
|
||||
if (empty($given_url)) return -1; // error, no url to process
|
||||
|
@ -124,6 +128,10 @@ class File extends Memcached_DataObject
|
|||
if (empty($file)) {
|
||||
$file_redir = File_redirection::staticGet('url', $given_url);
|
||||
if (empty($file_redir)) {
|
||||
// @fixme for new URLs this also looks up non-redirect data
|
||||
// such as target content type, size, etc, which we need
|
||||
// for File::saveNew(); so we call it even if not following
|
||||
// new redirects.
|
||||
$redir_data = File_redirection::where($given_url);
|
||||
if (is_array($redir_data)) {
|
||||
$redir_url = $redir_data['url'];
|
||||
|
@ -134,11 +142,19 @@ class File extends Memcached_DataObject
|
|||
throw new ServerException("Can't process url '$given_url'");
|
||||
}
|
||||
// TODO: max field length
|
||||
if ($redir_url === $given_url || strlen($redir_url) > 255) {
|
||||
if ($redir_url === $given_url || strlen($redir_url) > 255 || !$followRedirects) {
|
||||
$x = File::saveNew($redir_data, $given_url);
|
||||
$file_id = $x->id;
|
||||
} else {
|
||||
$x = File::processNew($redir_url, $notice_id);
|
||||
// This seems kind of messed up... for now skipping this part
|
||||
// if we're already under a redirect, so we don't go into
|
||||
// horrible infinite loops if we've been given an unstable
|
||||
// redirect (where the final destination of the first request
|
||||
// doesn't match what we get when we ask for it again).
|
||||
//
|
||||
// Seen in the wild with clojure.org, which redirects through
|
||||
// wikispaces for auth and appends session data in the URL params.
|
||||
$x = File::processNew($redir_url, $notice_id, /*followRedirects*/false);
|
||||
$file_id = $x->id;
|
||||
File_redirection::saveNew($redir_data, $file_id, $given_url);
|
||||
}
|
||||
|
|
|
@ -115,9 +115,12 @@ class Inbox extends Memcached_DataObject
|
|||
*/
|
||||
static function insertNotice($user_id, $notice_id)
|
||||
{
|
||||
$inbox = DB_DataObject::staticGet('inbox', 'user_id', $user_id);
|
||||
|
||||
if (empty($inbox)) {
|
||||
// Going straight to the DB rather than trusting our caching
|
||||
// during an update. Note: not using DB_DataObject::staticGet,
|
||||
// which is unsafe to use directly (in-process caching causes
|
||||
// memory leaks, which accumulate in queue processes).
|
||||
$inbox = new Inbox();
|
||||
if (!$inbox->get('user_id', $user_id)) {
|
||||
$inbox = Inbox::initialize($user_id);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* @author Robin Millette <millette@controlyourself.ca>
|
||||
* @author Sarven Capadisli <csarven@controlyourself.ca>
|
||||
* @author Tom Adams <tom@holizz.com>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license GNU Affero General Public License http://www.gnu.org/licenses/
|
||||
*/
|
||||
|
||||
|
@ -97,6 +98,10 @@ class Notice extends Memcached_DataObject
|
|||
// For auditing purposes, save a record that the notice
|
||||
// was deleted.
|
||||
|
||||
// @fixme we have some cases where things get re-run and so the
|
||||
// insert fails.
|
||||
$deleted = Deleted_notice::staticGet('id', $this->id);
|
||||
if (!$deleted) {
|
||||
$deleted = new Deleted_notice();
|
||||
|
||||
$deleted->id = $this->id;
|
||||
|
@ -106,6 +111,7 @@ class Notice extends Memcached_DataObject
|
|||
$deleted->deleted = common_sql_now();
|
||||
|
||||
$deleted->insert();
|
||||
}
|
||||
|
||||
// Clear related records
|
||||
|
||||
|
@ -1236,7 +1242,7 @@ class Notice extends Memcached_DataObject
|
|||
|
||||
$noticeInfoAttr = array(
|
||||
'local_id' => $this->id, // local notice ID (useful to clients for ordering)
|
||||
'source' => $this->source // the client name (source attribution)
|
||||
'source' => $this->source, // the client name (source attribution)
|
||||
);
|
||||
|
||||
$ns = $this->getSource();
|
||||
|
@ -1247,7 +1253,11 @@ class Notice extends Memcached_DataObject
|
|||
}
|
||||
|
||||
if (!empty($cur)) {
|
||||
$noticeInfoAttr['favorited'] = ($cur->hasFave($this)) ? 'true' : 'false';
|
||||
$noticeInfoAttr['favorite'] = ($cur->hasFave($this)) ? "true" : "false";
|
||||
}
|
||||
|
||||
if (!empty($this->repeat_of)) {
|
||||
$noticeInfoAttr['repeat_of'] = $this->repeat_of;
|
||||
}
|
||||
|
||||
$xs->element('statusnet:notice_info', $noticeInfoAttr, null);
|
||||
|
@ -1855,4 +1865,16 @@ class Notice extends Memcached_DataObject
|
|||
return $ns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the notice was locally created
|
||||
*
|
||||
* @return boolean locality
|
||||
*/
|
||||
|
||||
public function isLocal()
|
||||
{
|
||||
return ($this->is_local == Notice::LOCAL_PUBLIC ||
|
||||
$this->is_local == Notice::LOCAL_NONPUBLIC);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -152,18 +152,12 @@ class Status_network extends Safe_DataObject
|
|||
|
||||
/**
|
||||
* @param string $servername hostname
|
||||
* @param string $pathname URL base path
|
||||
* @param string $wildcard hostname suffix to match wildcard config
|
||||
* @return mixed Status_network or null
|
||||
*/
|
||||
static function setupSite($servername, $pathname, $wildcard)
|
||||
static function getFromHostname($servername, $wildcard)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$sn = null;
|
||||
|
||||
// XXX I18N, probably not crucial for hostnames
|
||||
// XXX This probably needs a tune up
|
||||
|
||||
if (0 == strncasecmp(strrev($wildcard), strrev($servername), strlen($wildcard))) {
|
||||
// special case for exact match
|
||||
if (0 == strcasecmp($servername, $wildcard)) {
|
||||
|
@ -182,6 +176,23 @@ class Status_network extends Safe_DataObject
|
|||
}
|
||||
}
|
||||
}
|
||||
return $sn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $servername hostname
|
||||
* @param string $pathname URL base path
|
||||
* @param string $wildcard hostname suffix to match wildcard config
|
||||
*/
|
||||
static function setupSite($servername, $pathname, $wildcard)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$sn = null;
|
||||
|
||||
// XXX I18N, probably not crucial for hostnames
|
||||
// XXX This probably needs a tune up
|
||||
$sn = self::getFromHostname($servername, $wildcard);
|
||||
|
||||
if (!empty($sn)) {
|
||||
|
||||
|
|
|
@ -81,3 +81,42 @@ ALTER TABLE profile ADD COLUMN lon decimal(10,7) /*comment 'longitude'*/;
|
|||
ALTER TABLE profile ADD COLUMN location_id integer /* comment 'location id if possible'*/;
|
||||
ALTER TABLE profile ADD COLUMN location_ns integer /* comment 'namespace for location'*/;
|
||||
|
||||
ALTER TABLE consumer add COLUMN consumer_secret varchar(255) not null ; /*comment 'secret value'*/
|
||||
|
||||
ALTER TABLE token ADD COLUMN verifier varchar(255); /* comment 'verifier string for OAuth 1.0a',*/
|
||||
ALTER TABLE token ADD COLUMN verified_callback varchar(255); /* comment 'verified callback URL for OAuth 1.0a',*/
|
||||
|
||||
create table queue_item_new (
|
||||
id serial /* comment 'unique identifier'*/,
|
||||
frame bytea not null /* comment 'data: object reference or opaque string'*/,
|
||||
transport varchar(8) not null /*comment 'queue for what? "email", "jabber", "sms", "irc", ...'*/,
|
||||
created timestamp not null default CURRENT_TIMESTAMP /*comment 'date this record was created'*/,
|
||||
claimed timestamp /*comment 'date this item was claimed'*/,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
insert into queue_item_new (frame,transport,created,claimed)
|
||||
select ('0x' || notice_id::text)::bytea,transport,created,claimed from queue_item;
|
||||
alter table queue_item rename to queue_item_old;
|
||||
alter table queue_item_new rename to queue_item;
|
||||
|
||||
ALTER TABLE confirm_address ALTER column sent set default CURRENT_TIMESTAMP;
|
||||
|
||||
create table user_location_prefs (
|
||||
user_id integer not null /*comment 'user who has the preference'*/ references "user" (id),
|
||||
share_location int default 1 /* comment 'Whether to share location data'*/,
|
||||
created timestamp not null /*comment 'date this record was created'*/,
|
||||
modified timestamp /* comment 'date this record was modified'*/,
|
||||
|
||||
primary key (user_id)
|
||||
);
|
||||
|
||||
create table inbox (
|
||||
|
||||
user_id integer not null /* comment 'user receiving the notice' */ references "user" (id),
|
||||
notice_ids bytea /* comment 'packed list of notice ids' */,
|
||||
|
||||
primary key (user_id)
|
||||
|
||||
);
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ VALUES
|
|||
('bti','bti','http://gregkh.github.com/bti/', now()),
|
||||
('choqok', 'Choqok', 'http://choqok.gnufolks.org/', now()),
|
||||
('cliqset', 'Cliqset', 'http://www.cliqset.com/', now()),
|
||||
('DarterosStatus', 'Darteros Status', 'http://www.darteros.com/doc/Darteros_Status', now()),
|
||||
('deskbar','Deskbar-Applet','http://www.gnome.org/projects/deskbar-applet/', now()),
|
||||
('Do','Gnome Do','http://do.davebsd.com/wiki/index.php?title=Microblog_Plugin', now()),
|
||||
('drupal','Drupal','http://drupal.org/', now()),
|
||||
|
|
|
@ -187,6 +187,7 @@ create index fave_modified_idx on fave using btree(modified);
|
|||
|
||||
create table consumer (
|
||||
consumer_key varchar(255) primary key /* comment 'unique identifier, root URL' */,
|
||||
consumer_secret varchar(255) not null /* comment 'secret value', */,
|
||||
seed char(32) not null /* comment 'seed for new tokens by this consumer' */,
|
||||
|
||||
created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
|
||||
|
@ -200,6 +201,9 @@ create table token (
|
|||
type integer not null default 0 /* comment 'request or access' */,
|
||||
state integer default 0 /* comment 'for requests 0 = initial, 1 = authorized, 2 = used' */,
|
||||
|
||||
verifier varchar(255) /*comment 'verifier string for OAuth 1.0a'*/,
|
||||
verified_callback varchar(255) /*comment 'verified callback URL for OAuth 1.0a'*/,
|
||||
|
||||
created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */,
|
||||
modified timestamp /* comment 'date this record was modified' */,
|
||||
|
||||
|
@ -272,7 +276,7 @@ create table confirm_address (
|
|||
address_extra varchar(255) not null default '' /* comment 'carrier ID, for SMS' */,
|
||||
address_type varchar(8) not null /* comment 'address type ("email", "jabber", "sms")' */,
|
||||
claimed timestamp /* comment 'date this was claimed for queueing' */,
|
||||
sent timestamp /* comment 'date this was sent for queueing' */,
|
||||
sent timestamp default CURRENT_TIMESTAMP /* comment 'date this was sent for queueing' */,
|
||||
modified timestamp /* comment 'date this record was modified' */
|
||||
);
|
||||
|
||||
|
@ -283,14 +287,12 @@ create table remember_me (
|
|||
);
|
||||
|
||||
create table queue_item (
|
||||
|
||||
notice_id integer not null /* comment 'notice queued' */ references notice (id) ,
|
||||
id serial /* comment 'unique identifier'*/,
|
||||
frame bytea not null /* comment 'data: object reference or opaque string'*/,
|
||||
transport varchar(8) not null /*comment 'queue for what? "email", "jabber", "sms", "irc", ...'*/,
|
||||
created timestamp not null default CURRENT_TIMESTAMP /*comment 'date this record was created'*/,
|
||||
claimed timestamp /*comment 'date this item was claimed'*/,
|
||||
|
||||
primary key (notice_id, transport)
|
||||
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
create index queue_item_created_idx on queue_item using btree(created);
|
||||
|
||||
|
|
|
@ -19,16 +19,20 @@
|
|||
* @category StatusNet
|
||||
* @package StatusNet
|
||||
* @author Brenda Wallace <shiny@cpan.org>
|
||||
* @author Brion Vibber <brion@pobox.com>
|
||||
* @author Christopher Vollick <psycotica0@gmail.com>
|
||||
* @author CiaranG <ciaran@ciarang.com>
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @author Evan Prodromou <evan@controlezvous.ca>
|
||||
* @author Gina Haeussge <osd@foosel.net>
|
||||
* @author James Walker <walkah@walkah.net>
|
||||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @author Mike Cochrane <mikec@mikenz.geek.nz>
|
||||
* @author Robin Millette <millette@controlyourself.ca>
|
||||
* @author Sarven Capadisli <csarven@controlyourself.ca>
|
||||
* @author Tom Adams <tom@holizz.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
*
|
||||
* @license GNU Affero General Public License http://www.gnu.org/licenses/
|
||||
*/
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Tom Adams <tom@holizz.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license GNU Affero General Public License http://www.gnu.org/licenses/
|
||||
* @version 0.9.x
|
||||
* @link http://status.net
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
* @author Toby Inkster <mail@tobyinkster.co.uk>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009-2010 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -50,12 +50,13 @@ class AtomGroupNoticeFeed extends AtomNoticeFeed
|
|||
* Constructor
|
||||
*
|
||||
* @param Group $group the group for the feed
|
||||
* @param User $cur the current authenticated user, if any
|
||||
* @param boolean $indent flag to turn indenting on or off
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function __construct($group, $indent = true) {
|
||||
parent::__construct($indent);
|
||||
function __construct($group, $cur = null, $indent = true) {
|
||||
parent::__construct($cur, $indent);
|
||||
$this->group = $group;
|
||||
|
||||
// TRANS: Title in atom group notice feed. %s is a group name.
|
||||
|
|
|
@ -44,9 +44,22 @@ if (!defined('STATUSNET'))
|
|||
*/
|
||||
class AtomNoticeFeed extends Atom10Feed
|
||||
{
|
||||
function __construct($indent = true) {
|
||||
var $cur;
|
||||
|
||||
/**
|
||||
* Constructor - adds a bunch of XML namespaces we need in our
|
||||
* notice-specific Atom feeds, and allows setting the current
|
||||
* authenticated user (useful for API methods).
|
||||
*
|
||||
* @param User $cur the current authenticated user (optional)
|
||||
* @param boolean $indent Whether to indent XML output
|
||||
*
|
||||
*/
|
||||
function __construct($cur = null, $indent = true) {
|
||||
parent::__construct($indent);
|
||||
|
||||
$this->cur = $cur;
|
||||
|
||||
// Feeds containing notice info use these namespaces
|
||||
|
||||
$this->addNamespace(
|
||||
|
@ -115,7 +128,7 @@ class AtomNoticeFeed extends Atom10Feed
|
|||
$source = $this->showSource();
|
||||
$author = $this->showAuthor();
|
||||
|
||||
$cur = common_current_user();
|
||||
$cur = empty($this->cur) ? common_current_user() : $this->cur;
|
||||
|
||||
$this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur));
|
||||
}
|
||||
|
|
|
@ -50,13 +50,14 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
|
|||
* Constructor
|
||||
*
|
||||
* @param User $user the user for the feed
|
||||
* @param User $cur the current authenticated user, if any
|
||||
* @param boolean $indent flag to turn indenting on or off
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function __construct($user, $indent = true) {
|
||||
parent::__construct($indent);
|
||||
function __construct($user, $cur = null, $indent = true) {
|
||||
parent::__construct($cur, $indent);
|
||||
$this->user = $user;
|
||||
if (!empty($user)) {
|
||||
$profile = $user->getProfile();
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* @category Plugin
|
||||
* @package StatusNet
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* @category Plugin
|
||||
* @package StatusNet
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
|
@ -309,5 +309,8 @@ $default =
|
|||
'url' =>
|
||||
array('shortener' => 'ur1.ca',
|
||||
'maxlength' => 25,
|
||||
'maxnoticelength' => -1)
|
||||
'maxnoticelength' => -1),
|
||||
'http' => // HTTP client settings when contacting other sites
|
||||
array('ssl_cafile' => false // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt')
|
||||
),
|
||||
);
|
||||
|
|
|
@ -133,6 +133,18 @@ class HTTPClient extends HTTP_Request2
|
|||
// it gracefully in that case as well.
|
||||
$this->config['protocol_version'] = '1.0';
|
||||
|
||||
// Default state of OpenSSL seems to have no trusted
|
||||
// SSL certificate authorities, which breaks hostname
|
||||
// verification and means we have a hard time communicating
|
||||
// with other sites' HTTPS interfaces.
|
||||
//
|
||||
// Turn off verification unless we've configured a CA bundle.
|
||||
if (common_config('http', 'ssl_cafile')) {
|
||||
$this->config['ssl_cafile'] = common_config('http', 'ssl_cafile');
|
||||
} else {
|
||||
$this->config['ssl_verify_peer'] = false;
|
||||
}
|
||||
|
||||
parent::__construct($url, $method, $config);
|
||||
$this->setHeader('User-Agent', $this->userAgent());
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Tom Adams <tom@holizz.com>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license GNU Affero General Public License http://www.gnu.org/licenses/
|
||||
* @version 0.9.x
|
||||
* @link http://status.net
|
||||
|
|
|
@ -61,7 +61,7 @@ if (!function_exists('dpgettext')) {
|
|||
* Not currently exposed in PHP's gettext module; implemented to be compat
|
||||
* with gettext.h's macros.
|
||||
*
|
||||
* @param string $domain domain identifier, or null for default domain
|
||||
* @param string $domain domain identifier
|
||||
* @param string $context context identifier, should be some key like "menu|file"
|
||||
* @param string $msgid English source text
|
||||
* @return string original or translated message
|
||||
|
@ -106,7 +106,7 @@ if (!function_exists('dnpgettext')) {
|
|||
* Not currently exposed in PHP's gettext module; implemented to be compat
|
||||
* with gettext.h's macros.
|
||||
*
|
||||
* @param string $domain domain identifier, or null for default domain
|
||||
* @param string $domain domain identifier
|
||||
* @param string $context context identifier, should be some key like "menu|file"
|
||||
* @param string $msg singular English source text
|
||||
* @param string $plural plural English source text
|
||||
|
@ -180,7 +180,11 @@ function _m($msg/*, ...*/)
|
|||
}
|
||||
|
||||
/**
|
||||
* Looks for which plugin we've been called from to set the gettext domain.
|
||||
* Looks for which plugin we've been called from to set the gettext domain;
|
||||
* if not in a plugin subdirectory, we'll use the default 'statusnet'.
|
||||
*
|
||||
* Note: we can't return null for default domain since most of the PHP gettext
|
||||
* wrapper functions turn null into "" before passing to the backend library.
|
||||
*
|
||||
* @param array $backtrace debug_backtrace() output
|
||||
* @return string
|
||||
|
@ -206,12 +210,19 @@ function _mdomain($backtrace)
|
|||
if (DIRECTORY_SEPARATOR !== '/') {
|
||||
$path = strtr($path, DIRECTORY_SEPARATOR, '/');
|
||||
}
|
||||
$cut = strpos($path, '/plugins/');
|
||||
if ($cut) {
|
||||
$cut += strlen('/plugins/');
|
||||
$plug = strpos($path, '/plugins/');
|
||||
if ($plug === false) {
|
||||
// We're not in a plugin; return default domain.
|
||||
return 'statusnet';
|
||||
} else {
|
||||
$cut = $plug + 9;
|
||||
$cut2 = strpos($path, '/', $cut);
|
||||
if ($cut && $cut2) {
|
||||
$final = substr($path, $cut, $cut2 - $cut);
|
||||
if ($cut2) {
|
||||
$cached[$path] = substr($path, $cut, $cut2 - $cut);
|
||||
} else {
|
||||
// We might be running directly from the plugins dir?
|
||||
// If so, there's no place to store locale info.
|
||||
return 'statusnet';
|
||||
}
|
||||
}
|
||||
$cached[$path] = $final;
|
||||
|
|
|
@ -147,5 +147,30 @@ class LiberalStomp extends Stomp
|
|||
}
|
||||
return $frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write frame to server
|
||||
*
|
||||
* @param StompFrame $stompFrame
|
||||
*/
|
||||
protected function _writeFrame (StompFrame $stompFrame)
|
||||
{
|
||||
if (!is_resource($this->_socket)) {
|
||||
require_once 'Stomp/Exception.php';
|
||||
throw new StompException('Socket connection hasn\'t been established');
|
||||
}
|
||||
|
||||
$data = $stompFrame->__toString();
|
||||
|
||||
// Make sure the socket's in a writable state; if not, wait a bit.
|
||||
stream_set_blocking($this->_socket, 1);
|
||||
|
||||
$r = fwrite($this->_socket, $data, strlen($data));
|
||||
stream_set_blocking($this->_socket, 0);
|
||||
if ($r === false || $r == 0) {
|
||||
$this->_reconnect();
|
||||
$this->_writeFrame($stompFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
10
lib/mail.php
10
lib/mail.php
|
@ -245,6 +245,11 @@ function mail_subscribe_notify_profile($listenee, $other)
|
|||
$other->getBestName(),
|
||||
common_config('site', 'name'));
|
||||
|
||||
$blocklink = sprintf(_("If you believe this account is being used abusively, " .
|
||||
"you can block them from your subscribers list and " .
|
||||
"report as spam to site administrators at %s"),
|
||||
common_local_url('block', array('profileid' => $other->id)));
|
||||
|
||||
// TRANS: Main body of new-subscriber notification e-mail
|
||||
$body = sprintf(_('%1$s is now listening to your notices on %2$s.'."\n\n".
|
||||
"\t".'%3$s'."\n\n".
|
||||
|
@ -264,9 +269,10 @@ function mail_subscribe_notify_profile($listenee, $other)
|
|||
($other->homepage) ?
|
||||
// TRANS: Profile info line in new-subscriber notification e-mail
|
||||
sprintf(_("Homepage: %s"), $other->homepage) . "\n" : '',
|
||||
($other->bio) ?
|
||||
(($other->bio) ?
|
||||
// TRANS: Profile info line in new-subscriber notification e-mail
|
||||
sprintf(_("Bio: %s"), $other->bio) . "\n\n" : '',
|
||||
sprintf(_("Bio: %s"), $other->bio) . "\n" : '') .
|
||||
"\n\n" . $blocklink . "\n",
|
||||
common_config('site', 'name'),
|
||||
common_local_url('emailsettings'));
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class PopularNoticeSection extends NoticeSection
|
|||
$qry .= ' GROUP BY notice.id,notice.profile_id,notice.content,notice.uri,' .
|
||||
'notice.rendered,notice.url,notice.created,notice.modified,' .
|
||||
'notice.reply_to,notice.is_local,notice.source,notice.conversation, ' .
|
||||
'notice.lat,notice.lon,location_id,location_ns,notice.repeat_of,notice.location' .
|
||||
'notice.lat,notice.lon,location_id,location_ns,notice.repeat_of' .
|
||||
' ORDER BY weight DESC';
|
||||
|
||||
$offset = 0;
|
||||
|
|
|
@ -60,7 +60,16 @@ class ProfileFormAction extends RedirectingAction
|
|||
$this->checkSessionToken();
|
||||
|
||||
if (!common_logged_in()) {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$this->clientError(_('Not logged in.'));
|
||||
} else {
|
||||
// Redirect to login.
|
||||
common_set_returnto($this->selfUrl());
|
||||
$user = common_current_user();
|
||||
if (Event::handle('RedirectToLogin', array($this, $user))) {
|
||||
common_redirect(common_local_url('login'), 303);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -97,7 +106,7 @@ class ProfileFormAction extends RedirectingAction
|
|||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$this->handlePost();
|
||||
$this->returnToArgs();
|
||||
$this->returnToPrevious();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,12 +53,13 @@ class RedirectingAction extends Action
|
|||
*
|
||||
* To be called only after successful processing.
|
||||
*
|
||||
* @fixme rename this -- it obscures Action::returnToArgs() which
|
||||
* returns a list of arguments, and is a bit confusing.
|
||||
* Note: this was named returnToArgs() up through 0.9.2, which
|
||||
* caused problems because there's an Action::returnToArgs()
|
||||
* already which does something different.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function returnToArgs()
|
||||
function returnToPrevious()
|
||||
{
|
||||
// Now, gotta figure where we go back to
|
||||
$action = false;
|
||||
|
@ -77,7 +78,7 @@ class RedirectingAction extends Action
|
|||
if ($action) {
|
||||
common_redirect(common_local_url($action, $args, $params), 303);
|
||||
} else {
|
||||
$url = $this->defaultReturnToUrl();
|
||||
$url = $this->defaultReturnTo();
|
||||
}
|
||||
common_redirect($url, 303);
|
||||
}
|
||||
|
|
|
@ -136,6 +136,11 @@ class Router
|
|||
$m->connect('main/'.$a, array('action' => $a));
|
||||
}
|
||||
|
||||
// Also need a block variant accepting ID on URL for mail links
|
||||
$m->connect('main/block/:profileid',
|
||||
array('action' => 'block'),
|
||||
array('profileid' => '[0-9]+'));
|
||||
|
||||
$m->connect('main/sup/:seconds', array('action' => 'sup'),
|
||||
array('seconds' => '[0-9]+'));
|
||||
|
||||
|
|
|
@ -115,14 +115,27 @@ class StompQueueManager extends QueueManager
|
|||
*
|
||||
* @param mixed $object
|
||||
* @param string $queue
|
||||
* @param string $siteNickname optional override to drop into another site's queue
|
||||
*
|
||||
* @return boolean true on success
|
||||
* @throws StompException on connection or send error
|
||||
*/
|
||||
public function enqueue($object, $queue)
|
||||
public function enqueue($object, $queue, $siteNickname=null)
|
||||
{
|
||||
$this->_connect();
|
||||
return $this->_doEnqueue($object, $queue, $this->defaultIdx);
|
||||
if (common_config('queue', 'stomp_enqueue_on')) {
|
||||
// We're trying to force all writes to a single server.
|
||||
// WARNING: this might do odd things if that server connection dies.
|
||||
$idx = array_search(common_config('queue', 'stomp_enqueue_on'),
|
||||
$this->servers);
|
||||
if ($idx === false) {
|
||||
common_log(LOG_ERR, 'queue stomp_enqueue_on setting does not match our server list.');
|
||||
$idx = $this->defaultIdx;
|
||||
}
|
||||
} else {
|
||||
$idx = $this->defaultIdx;
|
||||
}
|
||||
return $this->_doEnqueue($object, $queue, $idx, $siteNickname);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,10 +145,10 @@ class StompQueueManager extends QueueManager
|
|||
* @return boolean true on success
|
||||
* @throws StompException on connection or send error
|
||||
*/
|
||||
protected function _doEnqueue($object, $queue, $idx)
|
||||
protected function _doEnqueue($object, $queue, $idx, $siteNickname=null)
|
||||
{
|
||||
$rep = $this->logrep($object);
|
||||
$envelope = array('site' => common_config('site', 'nickname'),
|
||||
$envelope = array('site' => $siteNickname ? $siteNickname : common_config('site', 'nickname'),
|
||||
'handler' => $queue,
|
||||
'payload' => $this->encode($object));
|
||||
$msg = serialize($envelope);
|
||||
|
|
14
lib/util.php
14
lib/util.php
|
@ -1270,9 +1270,8 @@ function common_enqueue_notice($notice)
|
|||
$transports[] = 'plugin';
|
||||
}
|
||||
|
||||
// @fixme move these checks into QueueManager and/or individual handlers
|
||||
if ($notice->is_local == Notice::LOCAL_PUBLIC ||
|
||||
$notice->is_local == Notice::LOCAL_NONPUBLIC) {
|
||||
// We can skip these for gatewayed notices.
|
||||
if ($notice->isLocal()) {
|
||||
$transports = array_merge($transports, $localTransports);
|
||||
}
|
||||
|
||||
|
@ -1969,6 +1968,15 @@ function common_url_to_nickname($url)
|
|||
$path = preg_replace('@/$@', '', $parts['path']);
|
||||
$path = preg_replace('@^/@', '', $path);
|
||||
$path = basename($path);
|
||||
|
||||
// Hack for MediaWiki user pages, in the form:
|
||||
// http://example.com/wiki/User:Myname
|
||||
// ('User' may be localized.)
|
||||
if (strpos($path, ':')) {
|
||||
$parts = array_filter(explode(':', $path));
|
||||
$path = $parts[count($parts) - 1];
|
||||
}
|
||||
|
||||
if ($path) {
|
||||
return common_nicknamize($path);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
* @package StatusNet
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @copyright 2008 StatusNet, Inc.
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user