summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-06-29 08:53:05 -0700
committerBrion Vibber <brion@pobox.com>2010-06-29 08:53:05 -0700
commitc038164c0f41ba5c33f578f395c9fede80d96db8 (patch)
tree1452f6e5ae5786048a5a2835275c553e80c60462 /actions
parent7b7f09195a8082c8e26e87f7deb8b1002b852689 (diff)
parent452123916d08354d11a198517cbc91980a113fcd (diff)
Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'actions')
-rw-r--r--actions/apiaccountverifycredentials.php2
-rw-r--r--actions/apiblockcreate.php4
-rw-r--r--actions/apiblockdestroy.php4
-rw-r--r--actions/apifriendshipscreate.php6
-rw-r--r--actions/apifriendshipsdestroy.php7
-rw-r--r--actions/apifriendshipsexists.php19
-rw-r--r--actions/apisearchatom.php (renamed from actions/twitapisearchatom.php)12
-rw-r--r--actions/apisearchjson.php (renamed from actions/twitapisearchjson.php)7
-rw-r--r--actions/apisubscriptions.php3
-rw-r--r--actions/apitrends.php (renamed from actions/twitapitrends.php)8
-rw-r--r--actions/showgroup.php10
11 files changed, 41 insertions, 41 deletions
diff --git a/actions/apiaccountverifycredentials.php b/actions/apiaccountverifycredentials.php
index ea61a3205..79416e9b2 100644
--- a/actions/apiaccountverifycredentials.php
+++ b/actions/apiaccountverifycredentials.php
@@ -75,7 +75,7 @@ class ApiAccountVerifyCredentialsAction extends ApiAuthAction
if ($this->format == 'xml') {
$this->initDocument('xml');
- $this->showTwitterXmlUser($twitter_user);
+ $this->showTwitterXmlUser($twitter_user, 'user', true);
$this->endDocument('xml');
} elseif ($this->format == 'json') {
$this->initDocument('json');
diff --git a/actions/apiblockcreate.php b/actions/apiblockcreate.php
index c26485f59..b355cd1c7 100644
--- a/actions/apiblockcreate.php
+++ b/actions/apiblockcreate.php
@@ -23,7 +23,7 @@
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -65,7 +65,7 @@ class ApiBlockCreateAction extends ApiAuthAction
parent::prepare($args);
$this->user = $this->auth_user;
- $this->other = $this->getTargetUser($this->arg('id'));
+ $this->other = $this->getTargetProfile($this->arg('id'));
return true;
}
diff --git a/actions/apiblockdestroy.php b/actions/apiblockdestroy.php
index 666f308f4..7ea201677 100644
--- a/actions/apiblockdestroy.php
+++ b/actions/apiblockdestroy.php
@@ -23,7 +23,7 @@
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -64,7 +64,7 @@ class ApiBlockDestroyAction extends ApiAuthAction
parent::prepare($args);
$this->user = $this->auth_user;
- $this->other = $this->getTargetUser($this->arg('id'));
+ $this->other = $this->getTargetProfile($this->arg('id'));
return true;
}
diff --git a/actions/apifriendshipscreate.php b/actions/apifriendshipscreate.php
index 1de2cc32e..a7ec5b28a 100644
--- a/actions/apifriendshipscreate.php
+++ b/actions/apifriendshipscreate.php
@@ -24,7 +24,7 @@
* @author Dan Moore <dan@moore.cx>
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -67,7 +67,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
parent::prepare($args);
$this->user = $this->auth_user;
- $this->other = $this->getTargetUser($id);
+ $this->other = $this->getTargetProfile($this->arg('id'));
return true;
}
@@ -106,7 +106,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
if (empty($this->other)) {
$this->clientError(
- _('Could not follow user: User not found.'),
+ _('Could not follow user: profile not found.'),
403,
$this->format
);
diff --git a/actions/apifriendshipsdestroy.php b/actions/apifriendshipsdestroy.php
index d48a57756..551d01682 100644
--- a/actions/apifriendshipsdestroy.php
+++ b/actions/apifriendshipsdestroy.php
@@ -24,7 +24,7 @@
* @author Dan Moore <dan@moore.cx>
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -67,7 +67,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
parent::prepare($args);
$this->user = $this->auth_user;
- $this->other = $this->getTargetUser($id);
+ $this->other = $this->getTargetProfile($this->arg('id'));
return true;
}
@@ -125,8 +125,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
}
// throws an exception on error
- Subscription::cancel($this->user->getProfile(),
- $this->other->getProfile());
+ Subscription::cancel($this->user->getProfile(), $this->other);
$this->initDocument($this->format);
$this->showProfile($this->other, $this->format);
diff --git a/actions/apifriendshipsexists.php b/actions/apifriendshipsexists.php
index ca62b5f51..725178fd4 100644
--- a/actions/apifriendshipsexists.php
+++ b/actions/apifriendshipsexists.php
@@ -24,7 +24,7 @@
* @author Dan Moore <dan@moore.cx>
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -50,8 +50,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
class ApiFriendshipsExistsAction extends ApiPrivateAuthAction
{
- var $user_a = null;
- var $user_b = null;
+ var $profile_a = null;
+ var $profile_b = null;
/**
* Take arguments for running
@@ -66,11 +66,8 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction
{
parent::prepare($args);
- $user_a_id = $this->trimmed('user_a');
- $user_b_id = $this->trimmed('user_b');
-
- $this->user_a = $this->getTargetUser($user_a_id);
- $this->user_b = $this->getTargetUser($user_b_id);
+ $this->profile_a = $this->getTargetProfile($this->trimmed('user_a'));
+ $this->profile_b = $this->getTargetProfile($this->trimmed('user_b'));
return true;
}
@@ -89,16 +86,16 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction
{
parent::handle($args);
- if (empty($this->user_a) || empty($this->user_b)) {
+ if (empty($this->profile_a) || empty($this->profile_b)) {
$this->clientError(
- _('Two user ids or screen_names must be supplied.'),
+ _('Two valid IDs or screen_names must be supplied.'),
400,
$this->format
);
return;
}
- $result = $this->user_a->isSubscribed($this->user_b);
+ $result = Subscription::exists($this->profile_a, $this->profile_b);
switch ($this->format) {
case 'xml':
diff --git a/actions/twitapisearchatom.php b/actions/apisearchatom.php
index 51e8a8881..60bb8b040 100644
--- a/actions/twitapisearchatom.php
+++ b/actions/apisearchatom.php
@@ -22,7 +22,7 @@
* @category Search
* @package StatusNet
* @author Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2010 StatusNet, Inc.
* @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,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
+require_once INSTALLDIR.'/lib/apiprivateauth.php';
+
/**
* Action for outputting search results in Twitter compatible Atom
* format.
@@ -44,10 +46,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*
- * @see ApiAction
+ * @see ApiPrivateAuthAction
*/
-class TwitapisearchatomAction extends ApiAction
+class ApiSearchAtomAction extends ApiPrivateAuthAction
{
var $cnt;
@@ -96,8 +98,11 @@ class TwitapisearchatomAction extends ApiAction
function prepare($args)
{
+ common_debug("in apisearchatom prepare()");
+
parent::prepare($args);
+
$this->query = $this->trimmed('q');
$this->lang = $this->trimmed('lang');
$this->rpp = $this->trimmed('rpp');
@@ -138,6 +143,7 @@ class TwitapisearchatomAction extends ApiAction
function handle($args)
{
parent::handle($args);
+ common_debug("In apisearchatom handle()");
$this->showAtom();
}
diff --git a/actions/twitapisearchjson.php b/actions/apisearchjson.php
index b5c006aa7..e44634684 100644
--- a/actions/twitapisearchjson.php
+++ b/actions/apisearchjson.php
@@ -22,7 +22,7 @@
* @category Search
* @package StatusNet
* @author Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2010 StatusNet, Inc.
* @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 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
+require_once INSTALLDIR.'/lib/apiprivateauth.php';
require_once INSTALLDIR.'/lib/jsonsearchresultslist.php';
/**
@@ -44,7 +45,7 @@ require_once INSTALLDIR.'/lib/jsonsearchresultslist.php';
* @see ApiAction
*/
-class TwitapisearchjsonAction extends ApiAction
+class ApiSearchJSONAction extends ApiPrivateAuthAction
{
var $query;
var $lang;
@@ -64,6 +65,8 @@ class TwitapisearchjsonAction extends ApiAction
function prepare($args)
{
+ common_debug("apisearchjson prepare()");
+
parent::prepare($args);
$this->query = $this->trimmed('q');
diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php
index 0ba324057..63d65f289 100644
--- a/actions/apisubscriptions.php
+++ b/actions/apisubscriptions.php
@@ -206,7 +206,8 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
{
switch ($this->format) {
case 'xml':
- $this->elementStart('users', array('type' => 'array'));
+ $this->elementStart('users', array('type' => 'array',
+ 'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
foreach ($this->profiles as $profile) {
$this->showProfile(
$profile,
diff --git a/actions/twitapitrends.php b/actions/apitrends.php
index 5a04569a2..5b74636c6 100644
--- a/actions/twitapitrends.php
+++ b/actions/apitrends.php
@@ -22,7 +22,7 @@
* @category Search
* @package StatusNet
* @author Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2010 StatusNet, Inc.
* @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,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
+require_once INSTALLDIR.'/lib/apiprivateauth.php';
+
/**
* Returns the top ten queries that are currently trending
*
@@ -43,7 +45,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @see ApiAction
*/
-class TwitapitrendsAction extends ApiAction
+class ApiTrendsAction extends ApiPrivateAuthAction
{
var $callback;
@@ -82,7 +84,7 @@ class TwitapitrendsAction extends ApiAction
*/
function showTrends()
{
- $this->serverError(_('API method under construction.'), $code = 501);
+ $this->serverError(_('API method under construction.'), 501);
}
} \ No newline at end of file
diff --git a/actions/showgroup.php b/actions/showgroup.php
index 3d369e9eb..17c37e4d7 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -430,14 +430,6 @@ class ShowgroupAction extends GroupDesignAction
function showStatistics()
{
- // XXX: WORM cache this
- $members = $this->group->getMembers();
- $members_count = 0;
- /** $member->count() doesn't work. */
- while ($members->fetch()) {
- $members_count++;
- }
-
$this->elementStart('div', array('id' => 'entity_statistics',
'class' => 'section'));
@@ -451,7 +443,7 @@ class ShowgroupAction extends GroupDesignAction
$this->elementStart('dl', 'entity_members');
$this->element('dt', null, _('Members'));
- $this->element('dd', null, (is_int($members_count)) ? $members_count : '0');
+ $this->element('dd', null, $this->group->getMemberCount());
$this->elementEnd('dl');
$this->elementEnd('div');