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-05 03:18:44 +0000
commit54171248847e0c535697c6b1e8ff0e89f42f0087 (patch)
treeb53031f0aa07a405337a1e333332a33d3733dc67 /lib/api.php
parente9ecd8062a5d8223b7c0914255a24288c317d2a1 (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 10a2fae28..f81975216 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -1249,10 +1249,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;