Create a function for linking to remote.php

This commit is contained in:
Bart Visscher 2012-05-07 20:22:55 +02:00
parent 9b5e0bebef
commit 4dbc2093c6
11 changed files with 34 additions and 11 deletions

View File

@ -19,7 +19,7 @@
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 OCP\Util::linkToAbsolute('remote.php', 'caldav'); ?>/calendars';
var totalurl = '<?php echo OCP\Util::linkToRemote('caldav'); ?>calendars';
var firstDay = '<?php echo (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0'); ?>';
$(document).ready(function() {
<?php

View File

@ -47,6 +47,6 @@
</table>
<?php echo $l->t('Calendar CalDAV syncing address:');?>
<code><?php echo OCP\Util::linkToAbsolute('remote.php', 'caldav/'); ?></code><br />
<code><?php echo OCP\Util::linkToRemote('caldav'); ?></code><br />
</fieldset>
</form>

View File

@ -73,5 +73,5 @@ echo OCP\html_select_options($allgroups, array());
</ul>
<div id="public">
<input type="checkbox" id="publish" <?php echo ($public['share'])?'checked="checked"':'' ?>><label for="publish"><?php echo $l->t('make public'); ?></label><br>
<input type="text" id="public_token" value="<?php echo OCP\Util::linkToAbsolute('', 'public.php?service=calendar&t=' . $public['share'], null, true) ; ?>" onmouseover="$('#public_token').select();" style="<?php echo (!$public['share'])?'display:none':'' ?>">
</div>
<input type="text" id="public_token" value="<?php echo OCP\Util::linkToAbsolute('', 'public.php').'?service=calendar&t=' . $public['share'] ?>" onmouseover="$('#public_token').select();" style="<?php echo (!$public['share'])?'display:none':'' ?>">
</div>

View File

@ -1,5 +1,5 @@
<script type='text/javascript'>
var totalurl = '<?php echo OCP\Util::linkToAbsolute('remote.php', 'carddav'); ?>/addressbooks';
var totalurl = '<?php echo OCP\Util::linkToRemote('carddav'); ?>addressbooks';
var categories = <?php echo json_encode($_['categories']); ?>;
var lang = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>';
</script>

View File

@ -4,9 +4,9 @@
<?php echo $l->t('CardDAV syncing addresses'); ?> (<a href="http://owncloud.org/synchronisation/" target="_blank"><?php echo $l->t('more info'); ?></a>)
<dl>
<dt><?php echo $l->t('Primary address (Kontact et al)'); ?></dt>
<dd><code><?php echo OCP\Util::linkToAbsolute('remote.php', 'carddav/'); ?></code></dd>
<dd><code><?php echo OCP\Util::linkToRemote('carddav'); ?></code></dd>
<dt><?php echo $l->t('iOS/OS X'); ?></dt>
<dd><code><?php echo OCP\Util::linkToAbsolute('remote.php', 'carddav/'); ?>principals/<?php echo OCP\USER::getUser(); ?></code>/</dd>
<dd><code><?php echo OCP\Util::linkToRemote('carddav'); ?>principals/<?php echo OCP\USER::getUser(); ?></code>/</dd>
</dl>
Powered by <a href="http://geonames.org/" target="_blank">geonames.org webservice</a>
</fieldset>

View File

@ -207,7 +207,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=OCP\Util::linkToAbsolute('remote.php', 'ampache/server/xml.server.php/')."?action=play&song=$id&auth={$_GET['auth']}";
$url=OCP\Util::linkToRemote('ampache')."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");

View File

@ -2,6 +2,6 @@
<fieldset class="personalblock">
<strong>Media</strong><br />
Ampache address:
<code><?php echo OCP\Util::linkToAbsolute('remote.php', 'ampache'); ?>/</code><br />
<code><?php echo OCP\Util::linkToRemote('ampache'); ?></code><br />
</fieldset>
</form>

View File

@ -44,7 +44,7 @@ if($not_installed) {
// Handle WebDAV
if($_SERVER['REQUEST_METHOD']=='PROPFIND'){
header('location: '.OC_Helper::linkToAbsolute('remote.php','webdav/'));
header('location: '.OC_Helper::linkToRemote('webdav'));
exit();
}

View File

@ -105,6 +105,17 @@ class OC_Helper {
return $urlLinkTo;
}
/**
* @brief Creates an absolute url for remote use
* @param $service id
* @returns the url
*
* Returns a absolute url to the given service.
*/
public static function linkToRemote( $service ) {
return self::linkToAbsolute( '', 'remote.php') . '/' . $service . '/';
}
/**
* @brief Creates path to an image
* @param $app app

View File

@ -130,6 +130,18 @@ class Util {
}
/**
* @brief Creates an absolute url for remote use
* @param $service id
* @returns the url
*
* Returns a absolute url to the given app and file.
*/
public static function linkToRemote( $service ) {
return(\OC_Helper::linkToRemote( $service ));
}
/**
* @brief Creates an url
* @param $app app

View File

@ -47,7 +47,7 @@
<p class="personalblock">
<strong>WebDAV</strong>
<code><?php echo OC_Helper::linkToAbsolute('remote.php', 'webdav/'); ?></code><br />
<code><?php echo OC_Helper::linkToRemote('webdav'); ?></code><br />
<em><?php echo $l->t('use this address to connect to your ownCloud in your file manager');?></em>
</p>