summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api.php15
-rw-r--r--lib/default.php2
-rw-r--r--lib/omb.php1
-rw-r--r--lib/router.php4
4 files changed, 14 insertions, 8 deletions
diff --git a/lib/api.php b/lib/api.php
index 539aac4af..e2ea87b43 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -1142,10 +1142,15 @@ class ApiAction extends Action
function getTargetUser($id)
{
- if (!preg_match('/^[a-zA-Z0-9]+$/', $id)) {
+ if (empty($id)) {
// Twitter supports these other ways of passing the user ID
- if ($this->arg('user_id')) {
+ if (is_numeric($this->arg('id'))) {
+ return User::staticGet($this->arg('id'));
+ } else if ($this->arg('id')) {
+ $nickname = common_canonical_nickname($this->arg('id'));
+ return User::staticGet('nickname', $nickname);
+ } else if ($this->arg('user_id')) {
// This is to ensure that a non-numeric user_id still
// overrides screen_name even if it doesn't get used
if (is_numeric($this->arg('user_id'))) {
@@ -1154,12 +1159,6 @@ class ApiAction extends Action
} else if ($this->arg('screen_name')) {
$nickname = common_canonical_nickname($this->arg('screen_name'));
return User::staticGet('nickname', $nickname);
-
- } else if (is_numeric($this->arg('id'))) {
- return User::staticGet($this->arg('id'));
- } else if ($this->arg('id')) {
- $nickname = common_canonical_nickname($this->arg('id'));
- return User::staticGet('nickname', $nickname);
} else {
// Fall back to trying the currently authenticated user
return $this->auth_user;
diff --git a/lib/default.php b/lib/default.php
index 95366e0b3..d4ef045ea 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -226,4 +226,6 @@ $default =
array('contentlimit' => null),
'location' =>
array('namespace' => 1), // 1 = geonames, 2 = Yahoo Where on Earth
+ 'omb' =>
+ array('timeout' => 5), // HTTP request timeout in seconds when contacting remote hosts for OMB updates
);
diff --git a/lib/omb.php b/lib/omb.php
index e2a6d9f3f..0f38a4936 100644
--- a/lib/omb.php
+++ b/lib/omb.php
@@ -167,6 +167,7 @@ class StatusNet_OMB_Service_Consumer extends OMB_Service_Consumer {
$this->datastore = omb_oauth_datastore();
$this->oauth_consumer = omb_oauth_consumer();
$this->fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
+ $this->fetcher->timeout = intval(common_config('omb', 'timeout'));
}
}
diff --git a/lib/router.php b/lib/router.php
index beb98eb04..1a090861e 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -358,6 +358,10 @@ class Router
// users
+ $m->connect('api/users/show.:format',
+ array('action' => 'ApiUserShow',
+ 'format' => '(xml|json)'));
+
$m->connect('api/users/show/:id.:format',
array('action' => 'ApiUserShow',
'id' => '[a-zA-Z0-9]+',