diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-02-05 23:29:12 +0400 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-02-05 23:29:12 +0400 |
commit | cf29d962ab4d3138dca7e1d49334cad2ca636934 (patch) | |
tree | 8210932cdff44fbb291008ef06e7ab90a2b97a5a /user_webfinger | |
parent | 9c8afcf48d9208d7d42eb8d545d8fd859d872953 (diff) |
code style
Diffstat (limited to 'user_webfinger')
-rw-r--r-- | user_webfinger/webfinger.php | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/user_webfinger/webfinger.php b/user_webfinger/webfinger.php index 8df44488c..b430a0b2e 100644 --- a/user_webfinger/webfinger.php +++ b/user_webfinger/webfinger.php @@ -10,13 +10,14 @@ header("Content-Type: application/xrd+json"); * To include your app in the webfinger JSON, add a new script with file name * 'webfinger.php' to /apps/yourapp/appinfo/, which prints out the XML parts * to be included. That script can make use of the constants WF_USER (e. g. - * "user"), WF_ID (user@host) and WF_BASEURL (e. g. https://host/owncloud). + * "user"), WF_ID (user + * @host) and WF_BASEURL (e. g. https://host/owncloud). * An example could look like this: - * + * * { - * "rel":"myProfile", - * "type":"text/html", - * "href":"<?php echo WF_BASEURL; ?>/apps/myApp/profile.php?user=<?php echo WF_USER; ?>" + * "rel":"myProfile", + * "type":"text/html", + * "href":"<?php echo WF_BASEURL; ?>/apps/myApp/profile.php?user=<?php echo WF_USER; ?>" * } * * but can also use complex database queries to generate the webfinger result @@ -25,28 +26,28 @@ header("Content-Type: application/xrd+json"); $userName = ''; $hostName = ''; $request = strip_tags(urldecode($_GET['q'])); -if($_GET['q']) { +if ($_GET['q']) { $reqParts = explode('@', $request); - if(count($reqParts)==2) { + if (count($reqParts) == 2) { $userName = $reqParts[0]; $hostName = $reqParts[1]; } } -if(substr($userName, 0, 5) == 'acct:') { +if (substr($userName, 0, 5) == 'acct:') { $userName = substr($userName, 5); } -if($userName == "") { +if ($userName == "") { $id = ""; } else { $id = $userName . '@' . $hostName; } -if(isset($_SERVER['HTTPS'])) { +if (isset($_SERVER['HTTPS'])) { $baseAddress = 'https://'; } else { $baseAddress = 'http://'; } -$baseAddress .= $_SERVER['SERVER_NAME'].OC::$WEBROOT; -if(empty($id)) { +$baseAddress .= $_SERVER['SERVER_NAME'] . OC::$WEBROOT; +if (empty($id)) { header("HTTP/1.0 400 Bad Request"); } define('WF_USER', $userName); @@ -54,9 +55,9 @@ define('WF_ID', $id); define('WF_BASEURL', $baseAddress); echo "{\"links\":["; $apps = OC_Appconfig::getApps(); -foreach($apps as $app) { - if(OCP\App::isEnabled($app)) { - if(is_file(OC_App::getAppPath($app). '/appinfo/webfinger.php')) { +foreach ($apps as $app) { + if (OCP\App::isEnabled($app)) { + if (is_file(OC_App::getAppPath($app) . '/appinfo/webfinger.php')) { require $app . '/appinfo/webfinger.php'; } } |