summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-07-18 01:13:18 -0400
committerEvan Prodromou <evan@prodromou.name>2008-07-18 01:13:18 -0400
commit1c9e4f5f838d651a771e5fbfd8e30ae002cdd21e (patch)
tree4e17680f31d40d337d58883018e9dc75a4deb5b7 /actions
parent3ffc9ac41df08dc100ee6b8223eb77b096a9dd6b (diff)
add api data
darcs-hash:20080718051318-84dde-6776fb3ce4bb69b7abc377532857cd916ac56a29.gz
Diffstat (limited to 'actions')
-rw-r--r--actions/twitapistatuses.php60
1 files changed, 35 insertions, 25 deletions
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index 80871ff06..c306985d8 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -608,7 +608,7 @@ class TwitapistatusesAction extends TwitterapiAction {
*/
function friends($args, $apidata) {
parent::handle($args);
- return $this->subscriptions('subscribed', 'subscriber');
+ return $this->subscriptions($apidata, 'subscribed', 'subscriber');
}
/*
@@ -631,33 +631,17 @@ class TwitapistatusesAction extends TwitterapiAction {
function followers($args, $apidata) {
parent::handle($args);
- return $this->subscriptions('subscriber', 'subscribed');
+ return $this->subscriptions($apidata, 'subscriber', 'subscribed');
}
-
- function subscriptions($other_attr, $user_attr) {
- $user = null;
+
+ function subscriptions($apidata, $other_attr, $user_attr) {
- // function was called with an argument /statuses/user_timeline/api_arg.format
- if (isset($apidata['api_arg'])) {
+ $user = $this->get_subs_user($apidata);
+
+ # XXX: id
+ # XXX: page
+ # XXX: lite
- if (is_numeric($apidata['api_arg'])) {
- $user = User::staticGet($apidata['api_arg']);
- } else {
- $nickname = common_canonical_nickname($apidata['api_arg']);
- $user = User::staticGet('nickname', $nickname);
- }
- } else {
-
- // if no user was specified, then we'll use the authenticated user
- $user = $apidata['user'];
- }
-
- if (!$user) {
- // Set the user to be the auth user if asked-for can't be found
- // honestly! This is what Twitter does, I swear --Zach
- $user = $apidata['user'];
- }
-
$profile = $user->getProfile();
if (!$profile) {
@@ -691,6 +675,32 @@ class TwitapistatusesAction extends TwitterapiAction {
exit();
}
+ function get_subs_user($apidata) {
+
+ // function was called with an argument /statuses/user_timeline/api_arg.format
+ if (isset($apidata['api_arg'])) {
+
+ if (is_numeric($apidata['api_arg'])) {
+ $user = User::staticGet($apidata['api_arg']);
+ } else {
+ $nickname = common_canonical_nickname($apidata['api_arg']);
+ $user = User::staticGet('nickname', $nickname);
+ }
+ } else {
+
+ // if no user was specified, then we'll use the authenticated user
+ $user = $apidata['user'];
+ }
+
+ if (!$user) {
+ // Set the user to be the auth user if asked-for can't be found
+ // honestly! This is what Twitter does, I swear --Zach
+ $user = $apidata['user'];
+ }
+
+ return $user;
+ }
+
function show_profiles($profiles, $type) {
switch ($type) {
case 'xml':