summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-02-26 14:21:06 +0100
committerRobin Appelman <icewind@owncloud.com>2012-02-26 14:21:06 +0100
commitd4d09b06f80462394983fe04d291a0345dd57280 (patch)
treee4452055533c7ec7bb6fa49ac7f6b5c93ba8c4f7 /apps
parentea8f71a19c59e7138d4a504bacc0beb410fc77e8 (diff)
parent3d0d47957e65a72e17d33a924c9c4efcd5088ed2 (diff)
downloadnextcloud-server-d4d09b06f80462394983fe04d291a0345dd57280.tar.gz
nextcloud-server-d4d09b06f80462394983fe04d291a0345dd57280.zip
merge master into encryption
Diffstat (limited to 'apps')
-rwxr-xr-xapps/calendar/ajax/settings/guesstimezone.php45
-rwxr-xr-xapps/calendar/js/geo.js1
-rw-r--r--apps/files_encryption/lib/proxy.php10
-rw-r--r--apps/files_sharing/sharedstorage.php10
-rw-r--r--apps/gallery/ajax/galleryOp.php3
-rw-r--r--apps/gallery/ajax/getAlbums.php2
-rw-r--r--apps/gallery/js/albums.js6
-rw-r--r--apps/media/ajax/api.php5
-rw-r--r--apps/media/lib_scanner.php2
-rw-r--r--apps/remoteStorage/BearerAuth.php61
-rw-r--r--apps/remoteStorage/WebDAV.php9
-rw-r--r--apps/remoteStorage/appinfo/info.xml4
-rw-r--r--apps/remoteStorage/auth.php7
-rw-r--r--apps/remoteStorage/lib_remoteStorage.php32
-rw-r--r--apps/remoteStorage/oauth_ro_auth.php25
-rw-r--r--apps/user_webfinger/appinfo/info.xml4
-rw-r--r--apps/user_webfinger/host-meta.php4
-rw-r--r--apps/user_webfinger/webfinger.php4
18 files changed, 137 insertions, 97 deletions
diff --git a/apps/calendar/ajax/settings/guesstimezone.php b/apps/calendar/ajax/settings/guesstimezone.php
index cfa92e1aee8..d45a70e1ce3 100755
--- a/apps/calendar/ajax/settings/guesstimezone.php
+++ b/apps/calendar/ajax/settings/guesstimezone.php
@@ -5,44 +5,23 @@
* later.
* See the COPYING-README file.
*/
-function make_array_out_of_xml ($xml){
- $returnarray = array();
- $xml = (array)$xml ;
- foreach ($xml as $property => $value){
- $value = (array)$value;
- if(!isset($value[0])){
- $returnarray[$property] = make_array_out_of_xml($value);
- }else{
- $returnarray[$property] = trim($value[0]);
- }
- }
- return $returnarray;
-}
require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
+
$l = new OC_L10N('calendar');
+
$lat = $_GET['lat'];
-$long = $_GET['long'];
-if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'position') == $lat . '-' . $long && OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone') != null){
- OC_JSON::success();
- exit;
-}
-OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'position', $lat . '-' . $long);
-$geolocation = file_get_contents('http://ws.geonames.org/timezone?lat=' . $lat . '&lng=' . $long);
-//Information are by Geonames (http://www.geonames.org) and licensed under the Creative Commons Attribution 3.0 License
-$geoxml = simplexml_load_string($geolocation);
-$geoarray = make_array_out_of_xml($geoxml);
-if($geoarray['timezone']['timezoneId'] == OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone')){
+$lng = $_GET['long'];
+
+$timezone = OC_Geo::timezone($lat, $lng);
+
+if($timezone == OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone')){
OC_JSON::success();
exit;
}
-if(in_array($geoarray['timezone']['timezoneId'], DateTimeZone::listIdentifiers())){
- OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezone', $geoarray['timezone']['timezoneId']);
- $message = array('message'=> $l->t('New Timezone:') . $geoarray['timezone']['timezoneId']);
- OC_JSON::success($message);
-}else{
- OC_JSON::error();
-}
-
-?>
+OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezone', $timezone);
+$message = array('message'=> $l->t('New Timezone:') . $timezone);
+OC_JSON::success($message);
+?> \ No newline at end of file
diff --git a/apps/calendar/js/geo.js b/apps/calendar/js/geo.js
index c9cc5dd0955..7018c6298a2 100755
--- a/apps/calendar/js/geo.js
+++ b/apps/calendar/js/geo.js
@@ -10,7 +10,6 @@ if (navigator.geolocation) {
function(data){
if (data.status == 'success' && typeof(data.message) != 'undefined'){
$('#notification').html(data.message);
- $('#notification').attr('title', 'CC BY 3.0 by Geonames.org');
$('#notification').slideDown();
window.setTimeout(function(){$('#notification').slideUp();}, 5000);
}else{
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index ed3907cccfe..5c83171dda2 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -104,16 +104,6 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
}
return $result;
}
-
- public function preReadFile($path){
- if(self::isEncrypted($path)){
- $stream=fopen('crypt://'.$path,'r');
- while(!feof($stream)){
- print(fread($stream,8192));
- }
- return false;//cancel the original request
- }
- }
public function postGetMimeType($path,$mime){
if((!OC_FileCache::inCache($path) and self::shouldEncrypt($path)) or self::isEncrypted($path)){
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index 07653fc11b5..3067d4d34c0 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -58,7 +58,7 @@ class OC_Filestorage_Shared extends OC_Filestorage {
}
public function mkdir($path) {
- if ($path == "" || $path == "/" || !$this->is_writeable($path)) {
+ if ($path == "" || $path == "/" || !$this->is_writable($path)) {
return false;
} else {
$source = $this->getSource($path);
@@ -280,14 +280,6 @@ class OC_Filestorage_Shared extends OC_Filestorage {
}
}
- public function readfile($path) {
- $source = $this->getSource($path);
- if ($source) {
- $storage = OC_Filesystem::getStorage($source);
- return $storage->readfile($this->getInternalPath($source));
- }
- }
-
public function filectime($path) {
if ($path == "" || $path == "/") {
$ctime = 0;
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index 5ac6d295108..f07814056a3 100644
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -41,7 +41,8 @@ function handleRemove($name) {
function handleGetThumbnails($albumname) {
OC_Response::enableCaching(3600 * 24); // 24 hour
- $thumbnail = OC::$CONFIG_DATADIRECTORY.'/../gallery/'.$albumname.'.png';
+ error_log(htmlentities($albumname));
+ $thumbnail = OC::$CONFIG_DATADIRECTORY.'/../gallery/'.urldecode($albumname).'.png';
header('Content-Type: '.OC_Image::getMimeTypeForFile($thumbnail));
OC_Response::sendFile($thumbnail);
}
diff --git a/apps/gallery/ajax/getAlbums.php b/apps/gallery/ajax/getAlbums.php
index 9e9c6ef496c..be87af2abd3 100644
--- a/apps/gallery/ajax/getAlbums.php
+++ b/apps/gallery/ajax/getAlbums.php
@@ -33,7 +33,7 @@ while ($r = $result->fetchRow()) {
$album_name = $r['album_name'];
$tmp_res = OC_Gallery_Photo::find($r['album_id']);
- $a[] = array('name' => $album_name, 'numOfItems' => min($tmp_res->numRows(), 10), 'bgPath' => OC::$WEBROOT.'/data/'.OC_User::getUser().'/gallery/'.$album_name.'.png');
+ $a[] = array('name' => utf8_encode($album_name), 'numOfItems' => min($tmp_res->numRows(), 10), 'bgPath' => OC::$WEBROOT.'/data/'.OC_User::getUser().'/gallery/'.$album_name.'.png');
}
OC_JSON::success(array('albums'=>$a));
diff --git a/apps/gallery/js/albums.js b/apps/gallery/js/albums.js
index 987412f28e0..adecd24cc75 100644
--- a/apps/gallery/js/albums.js
+++ b/apps/gallery/js/albums.js
@@ -54,9 +54,9 @@ Albums={
event.preventDefault();
galleryRemove(event.data.name);
});
- $("a.view", local).attr('href','?view='+escape(a.name));
- $('h1',local).text(a.name);
- $(".gallery_album_cover", local).attr('title',a.name);
+ $("a.view", local).attr('href','?view='+decodeURIComponent(escape(a.name)));
+ $('h1',local).text(decodeURIComponent(escape(a.name)));
+ $(".gallery_album_cover", local).attr('title',decodeURIComponent(escape(a.name)));
$(".gallery_album_cover", local).css('background-repeat', 'no-repeat');
$(".gallery_album_cover", local).css('background-position', '0');
$(".gallery_album_cover", local).css('background-image','url("ajax/galleryOp.php?operation=get_covers&albumname='+escape(a.name)+'")');
diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php
index bb4502690b5..9d9c14deb17 100644
--- a/apps/media/ajax/api.php
+++ b/apps/media/ajax/api.php
@@ -120,7 +120,10 @@ if($arguments['action']){
OC_Filesystem::readfile($arguments['path']);
exit;
case 'find_music':
- OC_JSON::encodedPrint(OC_FileCache::searchByMime('audio'));
+ $music=OC_FileCache::searchByMime('audio');
+ $ogg=OC_FileCache::searchByMime('application','ogg');
+ $music=array_merge($music,$ogg);
+ OC_JSON::encodedPrint($music);
exit;
}
}
diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php
index ea594ee8e3c..39658b27ba9 100644
--- a/apps/media/lib_scanner.php
+++ b/apps/media/lib_scanner.php
@@ -38,6 +38,8 @@ class OC_MEDIA_SCANNER{
*/
public static function scanCollection($eventSource=null){
$music=OC_FileCache::searchByMime('audio');
+ $ogg=OC_FileCache::searchByMime('application','ogg');
+ $music=array_merge($music,$ogg);
$eventSource->send('count',count($music));
$songs=0;
foreach($music as $file){
diff --git a/apps/remoteStorage/BearerAuth.php b/apps/remoteStorage/BearerAuth.php
new file mode 100644
index 00000000000..ebcf189dfb9
--- /dev/null
+++ b/apps/remoteStorage/BearerAuth.php
@@ -0,0 +1,61 @@
+<?php
+
+/**
+ * HTTP Bearer Authentication handler
+ *
+ * Use this class for easy http authentication setup
+ *
+ * @package Sabre
+ * @subpackage HTTP
+ * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class Sabre_HTTP_BearerAuth extends Sabre_HTTP_AbstractAuth {
+
+ /**
+ * Returns the supplied username and password.
+ *
+ * The returned array has two values:
+ * * 0 - username
+ * * 1 - password
+ *
+ * If nothing was supplied, 'false' will be returned
+ *
+ * @return mixed
+ */
+ public function getUserPass() {
+
+ // Apache and mod_php
+ if (($user = $this->httpRequest->getRawServerValue('PHP_AUTH_USER')) && ($pass = $this->httpRequest->getRawServerValue('PHP_AUTH_PW'))) {
+
+ return array($user,$pass);
+
+ }
+
+ // Most other webservers
+ $auth = $this->httpRequest->getHeader('Authorization');
+
+ if (!$auth) return false;
+
+ if (strpos(strtolower($auth),'bearer')!==0) return false;
+
+ return explode(':', base64_decode(substr($auth, 7)));
+
+ }
+
+ /**
+ * Returns an HTTP 401 header, forcing login
+ *
+ * This should be called when username and password are incorrect, or not supplied at all
+ *
+ * @return void
+ */
+ public function requireLogin() {
+
+ $this->httpResponse->setHeader('WWW-Authenticate','Basic realm="' . $this->realm . '"');
+ $this->httpResponse->sendStatus(401);
+
+ }
+
+}
diff --git a/apps/remoteStorage/WebDAV.php b/apps/remoteStorage/WebDAV.php
index e048d19e8f2..cad465181a9 100644
--- a/apps/remoteStorage/WebDAV.php
+++ b/apps/remoteStorage/WebDAV.php
@@ -33,6 +33,7 @@ require_once('../../lib/base.php');
OC_Util::checkAppEnabled('remoteStorage');
require_once('Sabre/autoload.php');
require_once('lib_remoteStorage.php');
+require_once('BearerAuth.php');
require_once('oauth_ro_auth.php');
ini_set('default_charset', 'UTF-8');
@@ -68,7 +69,10 @@ if(count($pathParts) >= 3 && $pathParts[0] == '') {
$server->setBaseUri(OC::$WEBROOT."/apps/remoteStorage/WebDAV.php/$ownCloudUser");
// Auth backend
- $authBackend = new OC_Connector_Sabre_Auth_ro_oauth(OC_remoteStorage::getValidTokens($ownCloudUser, $category));
+ $authBackend = new OC_Connector_Sabre_Auth_ro_oauth(
+ OC_remoteStorage::getValidTokens($ownCloudUser, $category),
+ $category
+ );
$authPlugin = new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud');//should use $validTokens here
$server->addPlugin($authPlugin);
@@ -81,5 +85,6 @@ if(count($pathParts) >= 3 && $pathParts[0] == '') {
// And off we go!
$server->exec();
} else {
- die('not the right address format '.var_export($pathParts, true));
+ //die('not the right address format '.var_export($pathParts, true));
+ die('not the right address format');
}
diff --git a/apps/remoteStorage/appinfo/info.xml b/apps/remoteStorage/appinfo/info.xml
index 8179ca99112..1fc146aac73 100644
--- a/apps/remoteStorage/appinfo/info.xml
+++ b/apps/remoteStorage/appinfo/info.xml
@@ -3,8 +3,8 @@
<id>remoteStorage</id>
<name>remoteStorage compatibility</name>
<description>Enables your users to use ownCloud as their remote storage for unhosted applications.</description>
- <version>0.2</version>
- <licence>AGPL</licence>
+ <version>0.4</version>
+ <licence>AGPL or MIT</licence>
<author>Michiel de Jong</author>
<require>2</require>
</info>
diff --git a/apps/remoteStorage/auth.php b/apps/remoteStorage/auth.php
index 85421ba3d88..cc40e895e01 100644
--- a/apps/remoteStorage/auth.php
+++ b/apps/remoteStorage/auth.php
@@ -68,14 +68,14 @@ if(count($pathParts) == 2 && $pathParts[0] == '') {
} else if($k=='redirect_uri'){
$appUrl=$v;
} else if($k=='scope'){
- $category=$v;
+ $categories=$v;
}
}
$currUser = OC_User::getUser();
if($currUser == $ownCloudUser) {
if(isset($_POST['allow'])) {
//TODO: check if this can be faked by editing the cookie in firebug!
- $token=OC_remoteStorage::createCategory($appUrl, $category);
+ $token=OC_remoteStorage::createCategories($appUrl, $categories);
header('Location: '.$_GET['redirect_uri'].'#access_token='.$token.'&token_type=bearer');
} else {
echo '<form method="POST"><input name="allow" type="submit" value="Allow this web app to store stuff on your owncloud."></form>';
@@ -96,5 +96,6 @@ if(count($pathParts) == 2 && $pathParts[0] == '') {
.'<form method="POST"><input name="allow" type="submit" value="Click here"></form>');
}
} else {
- die('please use auth.php/username?params. '.var_export($pathParts, true));
+ //die('please use auth.php/username?params. '.var_export($pathParts, true));
+ die('please use auth.php/username?params.');
}
diff --git a/apps/remoteStorage/lib_remoteStorage.php b/apps/remoteStorage/lib_remoteStorage.php
index 4f19310904e..a9b73516aad 100644
--- a/apps/remoteStorage/lib_remoteStorage.php
+++ b/apps/remoteStorage/lib_remoteStorage.php
@@ -2,11 +2,13 @@
class OC_remoteStorage {
public static function getValidTokens($ownCloudUser, $category) {
- $query=OC_DB::prepare("SELECT token,appUrl FROM *PREFIX*authtoken WHERE user=? AND category=? LIMIT 100");
- $result=$query->execute(array($ownCloudUser,$category));
+ $query=OC_DB::prepare("SELECT token,appUrl,category FROM *PREFIX*authtoken WHERE user=? LIMIT 100");
+ $result=$query->execute(array($ownCloudUser));
$ret = array();
while($row=$result->fetchRow()){
- $ret[$row['token']]=true;
+ if(in_array($category, explode(',', $row['category']))) {
+ $ret[$row['token']]=true;
+ }
}
return $ret;
}
@@ -19,7 +21,7 @@ class OC_remoteStorage {
while($row=$result->fetchRow()){
$ret[$row['token']] = array(
'appUrl' => $row['appurl'],
- 'category' => $row['category'],
+ 'categories' => $row['category'],
);
}
return $ret;
@@ -30,21 +32,23 @@ class OC_remoteStorage {
$query=OC_DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?");
$result=$query->execute(array($token,$user));
}
- private static function addToken($token, $appUrl, $category){
+ private static function addToken($token, $appUrl, $categories){
$user=OC_User::getUser();
$query=OC_DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`category`) VALUES(?,?,?,?)");
- $result=$query->execute(array($token,$appUrl,$user,$category));
+ $result=$query->execute(array($token,$appUrl,$user,$categories));
}
- public static function createCategory($appUrl, $category) {
+ public static function createCategories($appUrl, $categories) {
$token=uniqid();
- self::addToken($token, $appUrl, $category);
- //TODO: input checking on $category
OC_Util::setupFS(OC_User::getUser());
- $scopePathParts = array('remoteStorage', $category);
- for($i=0;$i<=count($scopePathParts);$i++){
- $thisPath = '/'.implode('/', array_slice($scopePathParts, 0, $i));
- if(!OC_Filesystem::file_exists($thisPath)) {
- OC_Filesystem::mkdir($thisPath);
+ self::addToken($token, $appUrl, $categories);
+ foreach(explode(',', $categories) as $category) {
+ //TODO: input checking on $category
+ $scopePathParts = array('remoteStorage', $category);
+ for($i=0;$i<=count($scopePathParts);$i++){
+ $thisPath = '/'.implode('/', array_slice($scopePathParts, 0, $i));
+ if(!OC_Filesystem::file_exists($thisPath)) {
+ OC_Filesystem::mkdir($thisPath);
+ }
}
}
return base64_encode('remoteStorage:'.$token);
diff --git a/apps/remoteStorage/oauth_ro_auth.php b/apps/remoteStorage/oauth_ro_auth.php
index 5403fbe20c9..085a5469920 100644
--- a/apps/remoteStorage/oauth_ro_auth.php
+++ b/apps/remoteStorage/oauth_ro_auth.php
@@ -16,9 +16,10 @@
class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBasic {
private $validTokens;
-
- public function __construct($validTokensArg) {
+ private $category;
+ public function __construct($validTokensArg, $categoryArg) {
$this->validTokens = $validTokensArg;
+ $this->category = $categoryArg;
}
/**
@@ -31,29 +32,31 @@ class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBa
*/
protected function validateUserPass($username, $password){
//always give read-only:
- if(in_array($_SERVER['REQUEST_METHOD'], array('GET', 'HEAD', 'OPTIONS'))) {
- OC_Util::setUpFS();
- return true;
- } else if(isset($this->validTokens[$password]) && $this->validTokens[$password] == $username) {
+ if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
+ || (isset($this->validTokens[$password]))
+ || (($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
+ ) {
OC_Util::setUpFS();
return true;
} else {
-var_export($_SERVER);
-var_export($this->validTokens);
-die('not getting in with "'.$username.'"/"'.$password.'"!');
+ //var_export($_SERVER);
+ //var_export($this->validTokens);
+ //die('not getting in with "'.$username.'"/"'.$password.'"!');
return false;
}
}
//overwriting this to make it not automatically fail if no auth header is found:
public function authenticate(Sabre_DAV_Server $server,$realm) {
- $auth = new Sabre_HTTP_BasicAuth();
+ $auth = new Sabre_HTTP_BearerAuth();
$auth->setHTTPRequest($server->httpRequest);
$auth->setHTTPResponse($server->httpResponse);
$auth->setRealm($realm);
$userpass = $auth->getUserPass();
if (!$userpass) {
- if(in_array($_SERVER['REQUEST_METHOD'], array('OPTIONS'))) {
+ if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
+ ||(($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
+ ) {
$userpass = array('', '');
} else {
$auth->requireLogin();
diff --git a/apps/user_webfinger/appinfo/info.xml b/apps/user_webfinger/appinfo/info.xml
index a4071dae172..55cf2cf2201 100644
--- a/apps/user_webfinger/appinfo/info.xml
+++ b/apps/user_webfinger/appinfo/info.xml
@@ -3,8 +3,8 @@
<id>user_webfinger</id>
<name>Webfinger</name>
<description>Provide WebFinger for all users so they get a user address like user@owncloudinstance which can be used for unhosted applications. If you don't run ownCloud in the root of your domain, for instance if you run it on example.com/owncloud/, then make sure you link example.com/.well-known/ to example.com/owncloud/apps/user_webfinger/ - by running something like "ln -s /var/www/owncloud/apps/user_webfinger /var/www/.well-known". Only enable this app if you run this ownCloud installation on a public web address, not if you run it on an intranet or on localhost.</description>
- <version>0.1</version>
- <licence>AGPL</licence>
+ <version>0.2</version>
+ <licence>AGPL or MIT</licence>
<author>Michiel de Jong</author>
<require>2</require>
</info>
diff --git a/apps/user_webfinger/host-meta.php b/apps/user_webfinger/host-meta.php
index ceb15f22da4..ac577cf9a0c 100644
--- a/apps/user_webfinger/host-meta.php
+++ b/apps/user_webfinger/host-meta.php
@@ -4,13 +4,13 @@ if($_SERVER['SCRIPT_NAME'] == '/.well-known/host-meta.php') {
} else {
header('Please-first: activate');
}
-header("Content-Type: application/xml+xrd");
+header("Content-Type: application/xrd+xml");
echo "<";
?>
?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0">
<hm:Host xmlns="http://host-meta.net/xrd/1.0"><?php echo $_SERVER['SERVER_NAME'] ?></hm:Host>
- <Link rel="lrdd" template="http<?php echo ($_SERVER['HTTPS']?'s':''); ?>://<?php echo $_SERVER['SERVER_NAME'] ?>/.well-known/webfinger.php?q={uri}">
+ <Link rel="lrdd" template="http<?php echo (isset($_SERVER['HTTPS'])?'s':''); ?>://<?php echo $_SERVER['SERVER_NAME'] ?>/.well-known/webfinger.php?q={uri}">
</Link>
</XRD>
diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php
index d695a833f31..5c2a24aa070 100644
--- a/apps/user_webfinger/webfinger.php
+++ b/apps/user_webfinger/webfinger.php
@@ -4,7 +4,7 @@ if($_SERVER['SCRIPT_NAME'] == '/.well-known/webfinger.php') {
} else {
header('Please-first: activate');
}
-// header("Content-Type: application/xml+xrd");
+header("Content-Type: application/xrd+xml");
// calculate the documentroot
// modified version of the one in lib/base.php that takes the .well-known symlink into account
@@ -22,7 +22,7 @@ if($_GET['q']) {
if(substr($userName, 0, 5) == 'acct:') {
$userName = substr($userName, 5);
}
-if($_SERVER['HTTPS']) {
+if(isset($_SERVER['HTTPS'])) {
$baseAddress = 'https://'.$_SERVER['SERVER_NAME'].'/apps/remoteStorage/';
} else {
$baseAddress = 'http://'.$_SERVER['SERVER_NAME'].'/apps/remoteStorage/';