Merge branch '0.7.x' of git://gitorious.org/laconica/mgrdcm-twitapibools into review/master
This commit is contained in:
commit
0dd90461cd
@ -133,11 +133,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_a->isSubscribed($user_b)) {
|
$result = $user_a->isSubscribed($user_b);
|
||||||
$result = 'true';
|
|
||||||
} else {
|
|
||||||
$result = 'false';
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($apidata['content-type']) {
|
switch ($apidata['content-type']) {
|
||||||
case 'xml':
|
case 'xml':
|
||||||
|
@ -82,8 +82,8 @@ class TwitapiusersAction extends TwitterapiAction
|
|||||||
$twitter_user['profile_text_color'] = '';
|
$twitter_user['profile_text_color'] = '';
|
||||||
$twitter_user['profile_link_color'] = '';
|
$twitter_user['profile_link_color'] = '';
|
||||||
$twitter_user['profile_sidebar_fill_color'] = '';
|
$twitter_user['profile_sidebar_fill_color'] = '';
|
||||||
$twitter_user['profile_sidebar_border_color'] = '';
|
$twitter_user['profile_sidebar_border_color'] = '';
|
||||||
$twitter_user['profile_background_tile'] = 'false';
|
$twitter_user['profile_background_tile'] = false;
|
||||||
|
|
||||||
$faves = DB_DataObject::factory('fave');
|
$faves = DB_DataObject::factory('fave');
|
||||||
$faves->user_id = $user->id;
|
$faves->user_id = $user->id;
|
||||||
@ -103,24 +103,16 @@ class TwitapiusersAction extends TwitterapiAction
|
|||||||
|
|
||||||
if (isset($apidata['user'])) {
|
if (isset($apidata['user'])) {
|
||||||
|
|
||||||
if ($apidata['user']->isSubscribed($profile)) {
|
$twitter_user['following'] = $apidata['user']->isSubscribed($profile);
|
||||||
$twitter_user['following'] = 'true';
|
|
||||||
} else {
|
// Notifications on?
|
||||||
$twitter_user['following'] = 'false';
|
$sub = Subscription::pkeyGet(array('subscriber' =>
|
||||||
|
$apidata['user']->id, 'subscribed' => $profile->id));
|
||||||
|
|
||||||
|
if ($sub) {
|
||||||
|
$twitter_user['notifications'] = ($sub->jabber || $sub->sms);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Notifications on?
|
|
||||||
$sub = Subscription::pkeyGet(array('subscriber' =>
|
|
||||||
$apidata['user']->id, 'subscribed' => $profile->id));
|
|
||||||
|
|
||||||
if ($sub) {
|
|
||||||
if ($sub->jabber || $sub->sms) {
|
|
||||||
$twitter_user['notifications'] = 'true';
|
|
||||||
} else {
|
|
||||||
$twitter_user['notifications'] = 'false';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($apidata['content-type'] == 'xml') {
|
if ($apidata['content-type'] == 'xml') {
|
||||||
$this->init_document('xml');
|
$this->init_document('xml');
|
||||||
|
@ -51,6 +51,26 @@ class TwitterapiAction extends Action
|
|||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides XMLOutputter::element to write booleans as strings (true|false).
|
||||||
|
* See that method's documentation for more info.
|
||||||
|
*
|
||||||
|
* @param string $tag Element type or tagname
|
||||||
|
* @param array $attrs Array of element attributes, as
|
||||||
|
* key-value pairs
|
||||||
|
* @param string $content string content of the element
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function element($tag, $attrs=null, $content=null)
|
||||||
|
{
|
||||||
|
if (is_bool($content)) {
|
||||||
|
$content = ($content ? 'true' : 'false');
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::element($tag, $attrs, $content);
|
||||||
|
}
|
||||||
|
|
||||||
function twitter_user_array($profile, $get_notice=false)
|
function twitter_user_array($profile, $get_notice=false)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -66,7 +86,7 @@ class TwitterapiAction extends Action
|
|||||||
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
|
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
|
||||||
|
|
||||||
$twitter_user['profile_image_url'] = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE);
|
$twitter_user['profile_image_url'] = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE);
|
||||||
$twitter_user['protected'] = 'false'; # not supported by Laconica yet
|
$twitter_user['protected'] = false; # not supported by Laconica yet
|
||||||
$twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null;
|
$twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null;
|
||||||
|
|
||||||
if ($get_notice) {
|
if ($get_notice) {
|
||||||
@ -86,7 +106,7 @@ class TwitterapiAction extends Action
|
|||||||
|
|
||||||
$twitter_status = array();
|
$twitter_status = array();
|
||||||
$twitter_status['text'] = $notice->content;
|
$twitter_status['text'] = $notice->content;
|
||||||
$twitter_status['truncated'] = 'false'; # Not possible on Laconica
|
$twitter_status['truncated'] = false; # Not possible on Laconica
|
||||||
$twitter_status['created_at'] = $this->date_twitter($notice->created);
|
$twitter_status['created_at'] = $this->date_twitter($notice->created);
|
||||||
$twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ?
|
$twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ?
|
||||||
intval($notice->reply_to) : null;
|
intval($notice->reply_to) : null;
|
||||||
@ -108,10 +128,9 @@ class TwitterapiAction extends Action
|
|||||||
($replier_profile) ? $replier_profile->nickname : null;
|
($replier_profile) ? $replier_profile->nickname : null;
|
||||||
|
|
||||||
if (isset($this->auth_user)) {
|
if (isset($this->auth_user)) {
|
||||||
$twitter_status['favorited'] =
|
$twitter_status['favorited'] = $this->auth_user->hasFave($notice);
|
||||||
($this->auth_user->hasFave($notice)) ? 'true' : 'false';
|
|
||||||
} else {
|
} else {
|
||||||
$twitter_status['favorited'] = 'false';
|
$twitter_status['favorited'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($include_user) {
|
if ($include_user) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user