diff options
author | Brion Vibber <brion@pobox.com> | 2010-06-26 10:18:03 -0400 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-06-26 10:18:03 -0400 |
commit | 00e129b01343e37dbd662b95f423e731b0867023 (patch) | |
tree | ba7e1bb3706adb6081bb61fd9499bef38213be8e /lib | |
parent | dad0b06a386092b159118780a6a6801f3cf674de (diff) | |
parent | 696e4ba393c658d5b2e1fe46e1389bd7b2cfdb34 (diff) |
Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 1.0.x
Diffstat (limited to 'lib')
-rw-r--r-- | lib/apiaction.php | 42 | ||||
-rw-r--r-- | lib/atomgroupnoticefeed.php | 19 | ||||
-rw-r--r-- | lib/atomnoticefeed.php | 2 | ||||
-rw-r--r-- | lib/avatarlink.php | 2 | ||||
-rw-r--r-- | lib/installer.php | 2 | ||||
-rw-r--r-- | lib/router.php | 16 | ||||
-rw-r--r-- | lib/themeuploader.php | 4 |
7 files changed, 60 insertions, 27 deletions
diff --git a/lib/apiaction.php b/lib/apiaction.php index a9fad16f8..e6b516453 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -273,11 +273,13 @@ class ApiAction extends Action // Is the requesting user following this user? $twitter_user['following'] = false; + $twitter_user['statusnet:blocking'] = false; $twitter_user['notifications'] = false; if (isset($this->auth_user)) { $twitter_user['following'] = $this->auth_user->isSubscribed($profile); + $twitter_user['statusnet:blocking'] = $this->auth_user->hasBlocked($profile); // Notifications on? $sub = Subscription::pkeyGet(array('subscriber' => @@ -411,20 +413,32 @@ class ApiAction extends Action function twitterGroupArray($group) { - $twitter_group=array(); - $twitter_group['id']=$group->id; - $twitter_group['url']=$group->permalink(); - $twitter_group['nickname']=$group->nickname; - $twitter_group['fullname']=$group->fullname; - $twitter_group['original_logo']=$group->original_logo; - $twitter_group['homepage_logo']=$group->homepage_logo; - $twitter_group['stream_logo']=$group->stream_logo; - $twitter_group['mini_logo']=$group->mini_logo; - $twitter_group['homepage']=$group->homepage; - $twitter_group['description']=$group->description; - $twitter_group['location']=$group->location; - $twitter_group['created']=$this->dateTwitter($group->created); - $twitter_group['modified']=$this->dateTwitter($group->modified); + $twitter_group = array(); + + $twitter_group['id'] = $group->id; + $twitter_group['url'] = $group->permalink(); + $twitter_group['nickname'] = $group->nickname; + $twitter_group['fullname'] = $group->fullname; + + if (isset($this->auth_user)) { + $twitter_group['member'] = $this->auth_user->isMember($group); + $twitter_group['blocked'] = Group_block::isBlocked( + $group, + $this->auth_user->getProfile() + ); + } + + $twitter_group['member_count'] = $group->getMemberCount(); + $twitter_group['original_logo'] = $group->original_logo; + $twitter_group['homepage_logo'] = $group->homepage_logo; + $twitter_group['stream_logo'] = $group->stream_logo; + $twitter_group['mini_logo'] = $group->mini_logo; + $twitter_group['homepage'] = $group->homepage; + $twitter_group['description'] = $group->description; + $twitter_group['location'] = $group->location; + $twitter_group['created'] = $this->dateTwitter($group->created); + $twitter_group['modified'] = $this->dateTwitter($group->modified); + return $twitter_group; } diff --git a/lib/atomgroupnoticefeed.php b/lib/atomgroupnoticefeed.php index c7c36af82..39a1fd456 100644 --- a/lib/atomgroupnoticefeed.php +++ b/lib/atomgroupnoticefeed.php @@ -96,4 +96,23 @@ class AtomGroupNoticeFeed extends AtomNoticeFeed return $this->group; } + function initFeed() + { + parent::initFeed(); + + $attrs = array(); + + if (!empty($this->cur)) { + $attrs['member'] = $this->cur->isMember($this->group) + ? 'true' : 'false'; + $attrs['blocked'] = Group_block::isBlocked( + $this->group, + $this->cur->getProfile() + ) ? 'true' : 'false'; + } + + $attrs['member_count'] = $this->group->getMemberCount(); + + $this->element('statusnet:group_info', $attrs, null); + } } diff --git a/lib/atomnoticefeed.php b/lib/atomnoticefeed.php index ef44de4b6..6ed803ce4 100644 --- a/lib/atomnoticefeed.php +++ b/lib/atomnoticefeed.php @@ -95,7 +95,7 @@ class AtomNoticeFeed extends Atom10Feed $this->addNamespace( 'statusnet', - 'http://status.net/ont/' + 'http://status.net/schema/api/1/' ); } diff --git a/lib/avatarlink.php b/lib/avatarlink.php index e67799e2e..7d4256d6e 100644 --- a/lib/avatarlink.php +++ b/lib/avatarlink.php @@ -76,8 +76,8 @@ class AvatarLink $alink = new AvatarLink(); $alink->url = $filename; $alink->height = $size; + $alink->width = $size; if (!empty($filename)) { - $alink->width = $size; $alink->type = self::mediatype($filename); } else { $alink->url = User_group::defaultLogo($size); diff --git a/lib/installer.php b/lib/installer.php index 56b9b6f4a..bd9d69cd4 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -447,7 +447,7 @@ abstract class Installer case 'mysqli': $res = $conn->query($stmt); if ($res === false) { - $error = $conn->error(); + $error = $conn->error; } break; case 'pgsql': diff --git a/lib/router.php b/lib/router.php index 6cbae8247..ca3c2e880 100644 --- a/lib/router.php +++ b/lib/router.php @@ -263,7 +263,7 @@ class Router $m->connect('tag', array('action' => 'publictagcloud')); $m->connect('tag/:tag/rss', array('action' => 'tagrss'), - array('tag' => '[a-zA-Z0-9]+')); + array('tag' => '[\pL\pN_\-\.]{1,64}')); $m->connect('tag/:tag', array('action' => 'tag'), array('tag' => '[\pL\pN_\-\.]{1,64}')); @@ -673,9 +673,9 @@ class Router ); // search - $m->connect('api/search.atom', array('action' => 'twitapisearchatom')); - $m->connect('api/search.json', array('action' => 'twitapisearchjson')); - $m->connect('api/trends.json', array('action' => 'twitapitrends')); + $m->connect('api/search.atom', array('action' => 'ApiSearchAtom')); + $m->connect('api/search.json', array('action' => 'ApiSearchJSON')); + $m->connect('api/trends.json', array('action' => 'ApiTrends')); $m->connect('api/oauth/request_token', array('action' => 'apioauthrequesttoken')); @@ -762,12 +762,12 @@ class Router $m->connect('tag/:tag/rss', array('action' => 'userrss', 'nickname' => $nickname), - array('tag' => '[a-zA-Z0-9]+')); + array('tag' => '[\pL\pN_\-\.]{1,64}')); $m->connect('tag/:tag', array('action' => 'showstream', 'nickname' => $nickname), - array('tag' => '[a-zA-Z0-9]+')); + array('tag' => '[\pL\pN_\-\.]{1,64}')); $m->connect('rsd.xml', array('action' => 'rsd', @@ -828,12 +828,12 @@ class Router $m->connect(':nickname/tag/:tag/rss', array('action' => 'userrss'), array('nickname' => '[a-zA-Z0-9]{1,64}'), - array('tag' => '[a-zA-Z0-9]+')); + array('tag' => '[\pL\pN_\-\.]{1,64}')); $m->connect(':nickname/tag/:tag', array('action' => 'showstream'), array('nickname' => '[a-zA-Z0-9]{1,64}'), - array('tag' => '[a-zA-Z0-9]+')); + array('tag' => '[\pL\pN_\-\.]{1,64}')); $m->connect(':nickname/rsd.xml', array('action' => 'rsd'), diff --git a/lib/themeuploader.php b/lib/themeuploader.php index 18ef8c4d1..370965db0 100644 --- a/lib/themeuploader.php +++ b/lib/themeuploader.php @@ -55,10 +55,10 @@ class ThemeUploader public static function fromUpload($name) { if (!isset($_FILES[$name]['error'])) { - throw new ServerException(_("Theme upload missing or failed.")); + throw new ServerException(_("The theme file is missing or the upload failed.")); } if ($_FILES[$name]['error'] != UPLOAD_ERR_OK) { - throw new ServerException(_("Theme upload missing or failed.")); + throw new ServerException(_("The theme file is missing or the upload failed.")); } return new ThemeUploader($_FILES[$name]['tmp_name']); } |