mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
Use OC_Helper::linkTo also for absolute urls.
One central place to check for https.
This commit is contained in:
parent
80f5942868
commit
760b47a62f
7 changed files with 14 additions and 19 deletions
|
|
@ -2,7 +2,7 @@
|
|||
<h2 class="bookmarks_headline"><?php echo isset($_GET["tag"]) ? 'Bookmarks with tag: ' . urldecode($_GET["tag"]) : 'All bookmarks'; ?></h2>
|
||||
<div class="bookmarks_menu">
|
||||
<input type="button" class="bookmarks_addBtn" value="Add Bookmark"/>
|
||||
<a class="bookmarks_addBml" href="javascript:var url = encodeURIComponent(location.href);window.open('<?php echo (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . OC_Helper::linkTo('bookmarks', 'addBm.php'); ?>?url='+url, 'owncloud-bookmarks');" title="Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.">Add page to ownCloud</a>
|
||||
<a class="bookmarks_addBml" href="javascript:var url = encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkTo('bookmarks', 'addBm.php', null, true); ?>?url='+url, 'owncloud-bookmarks');" title="Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.">Add page to ownCloud</a>
|
||||
</div>
|
||||
<div class="bookmarks_add">
|
||||
<p><label class="bookmarks_label">Address</label><input type="text" id="bookmark_add_url" class="bookmarks_input" /></p>
|
||||
|
|
|
|||
|
|
@ -37,11 +37,7 @@ OC_App::setActiveNavigationEntry( "files_publiclink_administration" );
|
|||
|
||||
OC_Util::addScript( 'files_publiclink', 'admin' );
|
||||
|
||||
if(isset($_SERVER['HTTPS'])) {
|
||||
$baseUrl= "https://". $_SERVER['SERVER_NAME'] . OC_Helper::linkTo('files_publiclink','get.php');
|
||||
}else{
|
||||
$baseUrl= "http://". $_SERVER['SERVER_NAME'] . OC_Helper::linkTo('files_publiclink','get.php');
|
||||
}
|
||||
$baseUrl = OC_Helper::linkTo('files_publiclink','get.php', null, true);
|
||||
|
||||
|
||||
// return template
|
||||
|
|
|
|||
|
|
@ -166,11 +166,6 @@ class OC_MEDIA_AMPACHE{
|
|||
}
|
||||
$artistName=utf8_decode(htmlentities($artistName));
|
||||
$albumName=utf8_decode(htmlentities($albumName));
|
||||
if (isset($_SERVER['HTTPS'])) {
|
||||
$PROTO="https://";
|
||||
} else {
|
||||
$PROTO="http://";
|
||||
}
|
||||
$id=$song['song_id'];
|
||||
$name=utf8_decode(htmlentities($song['song_name']));
|
||||
$artist=$song['song_artist'];
|
||||
|
|
@ -179,7 +174,7 @@ class OC_MEDIA_AMPACHE{
|
|||
echo("\t\t<title>$name</title>\n");
|
||||
echo("\t\t<artist id='$artist'>$artistName</artist>\n");
|
||||
echo("\t\t<album id='$album'>$albumName</album>\n");
|
||||
$url="$PROTO{$_SERVER["HTTP_HOST"]}$WEBROOT/apps/media/server/xml.server.php?action=play&song=$id&auth={$_GET['auth']}";
|
||||
$url=OC_Helper::linkTo('media', 'server/xml.server.php', null, true)."?action=play&song=$id&auth={$_GET['auth']}";
|
||||
$url=htmlentities($url);
|
||||
echo("\t\t<url>$url</url>\n");
|
||||
echo("\t\t<time>{$song['song_length']}</time>\n");
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ if (!in_array ('curl', get_loaded_extensions())){
|
|||
return;
|
||||
}
|
||||
|
||||
$urlBase=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'];
|
||||
|
||||
$userName='';
|
||||
if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'=')){
|
||||
if(strpos($_SERVER["REQUEST_URI"],'/?')){
|
||||
|
|
@ -16,8 +14,8 @@ if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'='))
|
|||
}
|
||||
}
|
||||
|
||||
OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'.$userName));
|
||||
OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'.$userName));
|
||||
OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$userName));
|
||||
OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$userName));
|
||||
|
||||
OC_APP::registerPersonal('user_openid','settings');
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ if(!OC_User::userExists($USERNAME)){
|
|||
$USERNAME='';
|
||||
}
|
||||
global $WEBROOT;
|
||||
$IDENTITY=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$WEBROOT.'/apps/user_openid/user.php/'.$USERNAME;
|
||||
$IDENTITY=OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$USERNAME;
|
||||
|
||||
require_once 'phpmyid.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class OC_Helper {
|
|||
*
|
||||
* Returns a url to the given app and file.
|
||||
*/
|
||||
public static function linkTo( $app, $file , $redirect_url=NULL ){
|
||||
public static function linkTo( $app, $file, $redirect_url=NULL, $absolute=false ){
|
||||
global $WEBROOT;
|
||||
global $SERVERROOT;
|
||||
|
||||
|
|
@ -57,6 +57,12 @@ class OC_Helper {
|
|||
}
|
||||
}
|
||||
|
||||
if($absolute){
|
||||
// Checking if the request was made through HTTPS. The last in line is for IIS
|
||||
$protocol = isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off');
|
||||
$urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo;
|
||||
}
|
||||
|
||||
if($redirect_url)
|
||||
return $urlLinkTo.'?redirect_url='.$redirect_url;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<p class="personalblock">
|
||||
<strong>WebDAV</strong>
|
||||
<?php echo ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].OC::$WEBROOT.'/files/webdav.php'; ?><br />
|
||||
<?php echo OC_Helper::linkTo('files', 'webdav.php', null, true); ?><br />
|
||||
<em><?php echo $l->t('use this address to connect to your ownCloud in your file manager');?></em>
|
||||
</p>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue