?>
<form id="bookmarks">
<fieldset class="personalblock">
- <span class="bold"><?php echo $l->t('Bookmarklet:');?></span> <a class="bookmarks_addBml" href="javascript:(function(){url=encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkTo('bookmarks', 'addBm.php', null, true); ?>?url='+url, 'owncloud-bookmarks') })()"><?php echo $l->t('Add page to ownCloud'); ?></a>
+ <span class="bold"><?php echo $l->t('Bookmarklet:');?></span> <a class="bookmarks_addBml" href="javascript:(function(){url=encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkToAbsolute('bookmarks', 'addBm.php'); ?>?url='+url, 'owncloud-bookmarks') })()"><?php echo $l->t('Add page to ownCloud'); ?></a>
<br/><em><?php echo $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?></em><br />
</fieldset>
</form>
var missing_field_totime = '<?php echo addslashes($l->t('To Time')) ?>';
var missing_field_startsbeforeends = '<?php echo addslashes($l->t('The event ends before it starts')) ?>';
var missing_field_dberror = '<?php echo addslashes($l->t('There was a database fail')) ?>';
- var totalurl = '<?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?>/calendars';
+ var totalurl = '<?php echo OC_Helper::linkToAbsolute('calendar', 'caldav.php'); ?>/calendars';
$(document).ready(function() {
<?php
if(array_key_exists('showevent', $_)){
</table>
<?php echo $l->t('Calendar CalDAV syncing address:');?>
- <?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?><br />
+ <?php echo OC_Helper::linkToAbsolute('calendar', 'caldav.php'); ?><br />
</fieldset>
</form>
<script type='text/javascript'>
- var totalurl = '<?php echo OC_Helper::linkTo('contacts', 'carddav.php', null, true); ?>/addressbooks';
+ var totalurl = '<?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks';
</script>
<div id="controls">
<form>
$wattr = isset($_['width'])?'width="'.$_['width'].'"':'';
$hattr = isset($_['height'])?'height="'.$_['height'].'"':'';
?>
-<img class="loading" id="contacts_details_photo" <?php echo $wattr; ?> <?php echo $hattr; ?> src="<?php echo OC_Helper::linkTo('contacts', 'photo.php', null, true); ?>?id=<?php echo $id; ?>&refresh=<?php echo rand(); ?>" />
+<img class="loading" id="contacts_details_photo" <?php echo $wattr; ?> <?php echo $hattr; ?> src="<?php echo OC_Helper::linkToAbsolute('contacts', 'photo.php'); ?>?id=<?php echo $id; ?>&refresh=<?php echo rand(); ?>" />
<progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress>
return true;
});*/
</script>
-<img id="cropbox" src="<?php echo OC_Helper::linkTo('contacts', 'dynphoto.php', null, true); ?>?tmp_path=<?php echo urlencode($tmp_path); ?>" />
+<img id="cropbox" src="<?php echo OC_Helper::linkToAbsolute('contacts', 'dynphoto.php'); ?>?tmp_path=<?php echo urlencode($tmp_path); ?>" />
<form id="cropform"
class="coords"
method="post"
enctype="multipart/form-data"
target="crop_target"
- action="<?php echo OC_Helper::linkTo('contacts', 'ajax/savecrop.php', null, true); ?>">
+ action="<?php echo OC_Helper::linkToAbsolute('contacts', 'ajax/savecrop.php'); ?>">
<input type="hidden" id="id" name="id" value="<?php echo $id; ?>" />
<input type="hidden" id="tmp_path" name="tmp_path" value="<?php echo $tmp_path; ?>" />
<fieldset class="personalblock">
<strong><?php echo $l->t('Contacts'); ?></strong><br />
<?php echo $l->t('CardDAV syncing address:'); ?>
- <?php echo OC_Helper::linkTo('apps/contacts', 'carddav.php', null, true); ?><br />
+ <?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?><br />
</fieldset>
</form>
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=OC_Helper::linkTo('media', 'server/xml.server.php', null, true)."?action=play&song=$id&auth={$_GET['auth']}";
+ $url=OC_Helper::linkToAbsolute('media', 'server/xml.server.php')."?action=play&song=$id&auth={$_GET['auth']}";
$url=self::fixXmlString($url);
echo("\t\t<url>$url</url>\n");
echo("\t\t<time>{$song['song_length']}</time>\n");
<fieldset class="personalblock">
<strong>Media</strong><br />
Ampache address:
- <?php echo OC_Helper::linkTo('apps/media', '', null, true); ?><br />
+ <?php echo OC_Helper::linkToAbsolute('media', ''); ?><br />
</fieldset>
</form>
}
}
-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_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName));
+OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName));
OC_APP::registerPersonal('user_openid','settings');
OC_Log::write('user_openid',$USERNAME.' doesn\'t exist',OC_Log::WARN);
$USERNAME='';
}
-$IDENTITY=OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$USERNAME;
+$IDENTITY=OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$USERNAME;
require_once 'phpmyid.php';
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token);
$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
if (!empty($email)) {
- $link = OC_Helper::linkTo('core/lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token;
+ $link = OC_Helper::linkToAbsolute('core/lostpassword', 'resetpassword.php').'?user='.$_POST['user'].'&token='.$token;
$tmpl = new OC_Template('core/lostpassword', 'email');
$tmpl->assign('link', $link);
$msg = $tmpl->fetchPage();
// Handle WebDAV
if($_SERVER['REQUEST_METHOD']=='PROPFIND'){
- header('location: '.OC_Helper::linkTo('files','webdav.php'));
+ header('location: '.OC_Helper::linkToAbsolute('files','webdav.php'));
exit();
}
}
}
- if($absolute){
- // Checking if the request was made through HTTPS. The last in line is for IIS
- $protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off');
- $urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo;
- }
-
if($redirect_url)
return $urlLinkTo.'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]);
else
}
+ /**
+ * @brief Creates an absolute url
+ * @param $app app
+ * @param $file file
+ * @param $redirect_url redirect_url variable is appended to the URL
+ * @returns the url
+ *
+ * Returns a absolute url to the given app and file.
+ */
+ public static function linkToAbsolute( $app, $file, $redirect_url=NULL ) {
+ $urlLinkTo = self::linkTo( $app, $file, $redirect_url );
+ // Checking if the request was made through HTTPS. The last in line is for IIS
+ $protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off');
+ $urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo;
+ return $urlLinkTo;
+ }
+
/**
* @brief Creates path to an image
* @param $app app
*/
public static function checkAppEnabled($app){
if( !OC_App::isEnabled($app)){
- header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true));
+ header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ));
exit();
}
}
public static function checkLoggedIn(){
// Check if we are a user
if( !OC_User::isLoggedIn()){
- header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true));
+ header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ));
exit();
}
}
// Check if we are a user
self::checkLoggedIn();
if( !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
- header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true));
+ header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ));
exit();
}
}
<p class="personalblock">
<strong>WebDAV</strong>
- <?php echo OC_Helper::linkTo('files', 'webdav.php', null, true); ?><br />
+ <?php echo OC_Helper::linkToAbsolute('files', 'webdav.php'); ?><br />
<em><?php echo $l->t('use this address to connect to your ownCloud in your file manager');?></em>
</p>