Added function to make url absolute
This commit is contained in:
parent
6d0390dcca
commit
c4f1a1de5b
|
@ -120,8 +120,19 @@ class OC_Helper {
|
||||||
*/
|
*/
|
||||||
public static function linkToAbsolute( $app, $file ) {
|
public static function linkToAbsolute( $app, $file ) {
|
||||||
$urlLinkTo = self::linkTo( $app, $file );
|
$urlLinkTo = self::linkTo( $app, $file );
|
||||||
$urlLinkTo = self::serverProtocol(). '://' . self::serverHost() . $urlLinkTo;
|
return self::makeURLAbsolute($urlLinkTo);
|
||||||
return $urlLinkTo;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Makes an $url absolute
|
||||||
|
* @param $url the url
|
||||||
|
* @returns the absolute url
|
||||||
|
*
|
||||||
|
* Returns a absolute url to the given app and file.
|
||||||
|
*/
|
||||||
|
public static function makeURLAbsolute( $url )
|
||||||
|
{
|
||||||
|
return self::serverProtocol(). '://' . self::serverHost() . $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -348,7 +348,7 @@ class OC_Util {
|
||||||
else {
|
else {
|
||||||
$defaultpage = OC_Appconfig::getValue('core', 'defaultpage');
|
$defaultpage = OC_Appconfig::getValue('core', 'defaultpage');
|
||||||
if ($defaultpage) {
|
if ($defaultpage) {
|
||||||
$location = OC_Helper::serverProtocol().'://'.OC_Helper::serverHost().OC::$WEBROOT.'/'.$defaultpage;
|
$location = OC_Helper::makeURLAbsolute(OC::$WEBROOT.'/'.$defaultpage);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$location = OC_Helper::linkToAbsolute( 'files', 'index.php' );
|
$location = OC_Helper::linkToAbsolute( 'files', 'index.php' );
|
||||||
|
@ -476,7 +476,7 @@ class OC_Util {
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
|
|
||||||
// accessing the file via http
|
// accessing the file via http
|
||||||
$url = OC_Helper::serverProtocol(). '://' . OC_Helper::serverHost() . OC::$WEBROOT.'/data'.$filename;
|
$url = OC_Helper::makeURLAbsolute(OC::$WEBROOT.'/data'.$filename);
|
||||||
$fp = @fopen($url, 'r');
|
$fp = @fopen($url, 'r');
|
||||||
$content=@fread($fp, 2048);
|
$content=@fread($fp, 2048);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
|
|
Loading…
Reference in New Issue