From fe6450002d6059260c743f48b6f40378454fa1dc Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Mon, 6 Aug 2012 18:49:06 +0200 Subject: [PATCH] Change hardcoded urls to use linkTo function --- apps/calendar/index.php | 13 +++++++++++-- .../templates/part.choosecalendar.rowfields.php | 2 +- apps/calendar/templates/part.editevent.php | 6 +++--- apps/calendar/templates/part.newevent.php | 2 +- apps/gallery/js/pictures.js | 4 ++-- lib/util.php | 10 ++++++++-- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 4b87119592..cbfe0027b7 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -24,8 +24,17 @@ foreach($calendars as $calendar){ } } -$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable'=>'true'); -$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_r', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'false'); +$events_baseURL = OCP\Util::linkTo('calendar', 'ajax/events.php'); +$eventSources[] = array('url' => $events_baseURL.'?calendar_id=shared_rw', + 'backgroundColor' => '#1D2D44', + 'borderColor' => '#888', + 'textColor' => 'white', + 'editable'=>'true'); +$eventSources[] = array('url' => $events_baseURL.'?calendar_id=shared_r', + 'backgroundColor' => '#1D2D44', + 'borderColor' => '#888', + 'textColor' => 'white', + 'editable' => 'false'); OCP\Util::emitHook('OC_Calendar', 'getSources', array('sources' => &$eventSources)); $categories = OC_Calendar_App::getCategoryOptions(); diff --git a/apps/calendar/templates/part.choosecalendar.rowfields.php b/apps/calendar/templates/part.choosecalendar.rowfields.php index 4492ce731c..d29113c9a6 100644 --- a/apps/calendar/templates/part.choosecalendar.rowfields.php +++ b/apps/calendar/templates/part.choosecalendar.rowfields.php @@ -11,7 +11,7 @@ - + diff --git a/apps/calendar/templates/part.editevent.php b/apps/calendar/templates/part.editevent.php index 102366f8f0..ea91192cc6 100644 --- a/apps/calendar/templates/part.editevent.php +++ b/apps/calendar/templates/part.editevent.php @@ -5,9 +5,9 @@ inc("part.eventform"); ?>
- " onclick="Calendar.UI.validateEventForm('?app=calendar&getfile=ajax/event/edit.php');"> - " onclick="Calendar.UI.submitDeleteEventForm('?app=calendar&getfile=ajax/event/delete.php');"> - " onclick="window.location='?app=calendar&getfile=export.php?eventid=';"> + " onclick="Calendar.UI.validateEventForm('');"> + " onclick="Calendar.UI.submitDeleteEventForm('');"> + " onclick="window.location='?eventid=';"> diff --git a/apps/calendar/templates/part.newevent.php b/apps/calendar/templates/part.newevent.php index f4bb867b18..a4f48aecbc 100644 --- a/apps/calendar/templates/part.newevent.php +++ b/apps/calendar/templates/part.newevent.php @@ -3,7 +3,7 @@ inc("part.eventform"); ?>
- " onclick="Calendar.UI.validateEventForm('?app=calendar&getfile=ajax/event/new.php');"> + " onclick="Calendar.UI.validateEventForm('');"> diff --git a/apps/gallery/js/pictures.js b/apps/gallery/js/pictures.js index 91fbf5be96..47f727e0de 100644 --- a/apps/gallery/js/pictures.js +++ b/apps/gallery/js/pictures.js @@ -61,8 +61,8 @@ function deplode(element) { function openNewGal(album_name) { root = root + decodeURIComponent(album_name) + "/"; - var url = window.location.toString().replace(window.location.search, ''); - url = url + "?app=gallery&root="+encodeURIComponent(root); + var url = window.location.protocol+"//"+window.location.hostname+OC.linkTo('gallery', 'index.php'); + url = url + "?root="+encodeURIComponent(root); window.location = url; } diff --git a/lib/util.php b/lib/util.php index 6e62ed9bf5..f26fa63e44 100755 --- a/lib/util.php +++ b/lib/util.php @@ -343,10 +343,16 @@ class OC_Util { $location = $_REQUEST['redirect_url']; } else if (isset(OC::$REQUESTEDAPP) && !empty(OC::$REQUESTEDAPP)) { - $location = OC::$WEBROOT.'/?app='.OC::$REQUESTEDAPP; + $location = OC_Helper::linkToAbsolute( OC::$REQUESTEDAPP, 'index.php' ); } else { - $location = OC::$WEBROOT.'/'.OC_Appconfig::getValue('core', 'defaultpage', '?app=files'); + $defaultpage = OC_Appconfig::getValue('core', 'defaultpage'); + if ($defaultpage) { + $location = OC_Helper::serverProtocol().'://'.OC_Helper::serverHost().OC::$WEBROOT.'/'.$defaultpage; + } + else { + $location = OC_Helper::linkToAbsolute( 'files', 'index.php' ); + } } OC_Log::write('core', 'redirectToDefaultPage: '.$location, OC_Log::DEBUG); header( 'Location: '.$location );