summaryrefslogtreecommitdiff
path: root/lib/api.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-02-02 08:47:14 +0000
committerZach Copley <zach@status.net>2010-02-02 08:47:14 +0000
commit5e90f744a6fb58c43f8f5332ef868ba38e82b3d1 (patch)
tree30d17875812abd0040fbfa26ebea41de6ded6e50 /lib/api.php
parentc03883fc88c678e62e02d201cb74b862b108188a (diff)
Linkify notice source when posting from registered OAuth apps
Diffstat (limited to 'lib/api.php')
-rw-r--r--lib/api.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/api.php b/lib/api.php
index 987f2cc1b..7d94eaee4 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -1250,10 +1250,27 @@ class ApiAction extends Action
case 'api':
break;
default:
+
+ $name = null;
+ $url = null;
+
$ns = Notice_source::staticGet($source);
+
if ($ns) {
- $source_name = '<a href="' . $ns->url . '">' . $ns->name . '</a>';
+ $name = $ns->name;
+ $url = $ns->url;
+ } else {
+ $app = Oauth_application::staticGet('name', $source);
+ if ($app) {
+ $name = $app->name;
+ $url = $app->source_url;
+ }
+ }
+
+ if (!empty($name) && !empty($url)) {
+ $source_name = '<a href="' . $url . '">' . $name . '</a>';
}
+
break;
}
return $source_name;