]> source.dussan.org Git - nextcloud-server.git/commitdiff
Create a function for linking to remote.php
authorBart Visscher <bartv@thisnet.nl>
Mon, 7 May 2012 18:22:55 +0000 (20:22 +0200)
committerBart Visscher <bartv@thisnet.nl>
Mon, 7 May 2012 19:47:14 +0000 (21:47 +0200)
apps/calendar/templates/calendar.php
apps/calendar/templates/settings.php
apps/calendar/templates/share.dropdown.php
apps/contacts/templates/index.php
apps/contacts/templates/settings.php
apps/media/lib_ampache.php
apps/media/templates/settings.php
index.php
lib/helper.php
lib/public/util.php
settings/templates/personal.php

index 19c9a4d8d765eb149a74f270d22deb09d0738f30..832194f0fe1ed32c33a3f35f944ee87009a8c3e4 100755 (executable)
@@ -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
index 0d6c8735ecc139d88de2909e9ce183540bd48b32..12117750ca55392beb3003553d17dc6bd01c10f2 100755 (executable)
@@ -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>
index 0796a880f1faeda97656bbc8398771d122c5a23f..356a8d4fab14e26f8c20a423db860f7be90b095f 100755 (executable)
@@ -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>
\ No newline at end of file
+       <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>
index 791e3ced26c61dd3e47462c6ca74ffe72fdf6221..7d212e71ba830f096f8d8da68f1cb4168c69410b 100755 (executable)
@@ -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>
index ce14e52e0ce18a5668972708c4a55f9d38f42e86..216003b6c698938437807adb6dbb54317f88a5fb 100755 (executable)
@@ -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>
index 510aba3f7e78bec241709f7353b395f44d715595..f5c91661abee3747c1f69ec30b446951b4261793 100755 (executable)
@@ -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");
index 162b52b8d9b7f709384b8d613f487280a40bd88d..a7dc0775c44784e440c46a2a7dc68fe3733b1b83 100755 (executable)
@@ -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>
index b0b77969c57e5a7b11043e3186a190f676bfe15a..5d5307065bd7d36f2b6064c6a9973d36d36c7a93 100644 (file)
--- a/index.php
+++ b/index.php
@@ -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();
 }
 
index 757f562bfed2189be83c52dece447f8d538a480b..f5e247ca9ebab9cea9c35dfc85319e1ca1472813 100644 (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
index 6a8adff0f5a9ca4d5fc1d6a37062fc6708061cc0..f9f3759fe5bdb79557e8c7c18ce861d05e0b30a0 100644 (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
index 799606e6a9117c28a58d76743c49b94ac8c41549..014996a5b2071c5fd278fabe64c7c08a90449479 100644 (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>