Use Horde_Url::redirect()
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 30 Jul 2010 19:03:24 +0000 (13:03 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 30 Jul 2010 21:04:33 +0000 (15:04 -0600)
40 files changed:
imp/compose.php
imp/folders-mimp.php
imp/folders.php
imp/lib/Application.php
imp/lib/Ui/Compose.php
imp/mailbox.php
imp/message-mimp.php
imp/search-basic.php
imp/search.php
kronolith/add.php
kronolith/attendees.php
kronolith/calendars/create.php
kronolith/calendars/delete.php
kronolith/calendars/edit.php
kronolith/calendars/index.php
kronolith/calendars/remote_edit.php
kronolith/calendars/remote_subscribe.php
kronolith/calendars/remote_unsubscribe.php
kronolith/contacts.php
kronolith/data.php
kronolith/day.php
kronolith/delete.php
kronolith/edit.php
kronolith/event.php
kronolith/month.php
kronolith/new.php
kronolith/perms.php
kronolith/resources/create.php
kronolith/resources/delete.php
kronolith/resources/edit.php
kronolith/resources/groups/create.php
kronolith/resources/groups/delete.php
kronolith/resources/groups/edit.php
kronolith/resources/groups/index.php
kronolith/resources/index.php
kronolith/search.php
kronolith/view.php
kronolith/week.php
kronolith/workweek.php
kronolith/year.php

index 822e30c..f3aa9ef 100644 (file)
@@ -331,7 +331,7 @@ case 'redirect_send':
             if ($prefs->getValue('compose_confirm')) {
                 $notification->push(_("Message redirected successfully."), 'horde.success');
             }
-            header('Location: ' . $imp_ui->mailboxReturnUrl(false));
+            $imp_ui->mailboxReturnUrl()->redirect();
         }
         exit;
     } catch (Horde_Exception $e) {
@@ -389,8 +389,7 @@ case 'send_message':
                         $notification->push($result, 'horde.success');
                         if ($prefs->getValue('close_draft')) {
                             $imp_compose->destroy('save_draft');
-                            header('Location: ' . $imp_ui->mailboxReturnUrl(false));
-                            exit;
+                            $imp_ui->mailboxReturnUrl()->redirect();
                         }
                     }
                 }
@@ -473,7 +472,7 @@ case 'send_message':
         if ($prefs->getValue('compose_confirm') && $sent) {
             $notification->push(_("Message sent successfully."), 'horde.success');
         }
-        header('Location: ' . $imp_ui->mailboxReturnUrl(false));
+        $imp_ui->mailboxReturnUrl()->redirect();
     }
     exit;
 
@@ -489,7 +488,7 @@ case 'cancel_compose':
     if ($isPopup) {
         echo Horde::wrapInlineScript(array('window.close();'));
     } else {
-        header('Location: ' . $imp_ui->mailboxReturnUrl(false));
+        $imp_ui->mailboxReturnUrl()->redirect();
     }
     exit;
 
index 36d0cd2..19b2d3b 100644 (file)
@@ -24,8 +24,7 @@ Horde_Registry::appInit('imp', array('impmode' => 'mimp'));
 /* Redirect back to the mailbox if folder use is not allowed. */
 if (empty($conf['user']['allow_folders'])) {
     $notification->push(_("Folder use is not enabled."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('mailbox-mimp.php', true));
-    exit;
+    Horde::applicationUrl('mailbox-mimp.php', true)->redirect();
 }
 
 /* Decide whether or not to show all the unsubscribed folders */
index d14165b..698a68d 100644 (file)
@@ -23,8 +23,7 @@ Horde::addScriptFile('folders.js', 'imp');
 /* Redirect back to the mailbox if folder use is not allowed. */
 if (!$conf['user']['allow_folders']) {
     $notification->push(_("Folder use is not enabled."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('mailbox.php', true));
-    exit;
+    Horde::applicationUrl('mailbox.php', true)->redirect();
 }
 
 /* Decide whether or not to show all the unsubscribed folders */
index 83d4fc5..abaef47 100644 (file)
@@ -140,8 +140,7 @@ class IMP_Application extends Horde_Registry_Application
         }
 
         if ($redirect && ($GLOBALS['registry']->initialApp == 'imp')) {
-            header('Location: ' . IMP_Auth::getInitialPage(true)->setRaw(true));
-            exit;
+            IMP_Auth::getInitialPage(true)->redirect();
         }
     }
 
index 0df1b8e..167e969 100644 (file)
@@ -227,10 +227,10 @@ class IMP_Ui_Compose
      *
      * @return string  The mailbox return URL.
      */
-    public function mailboxReturnUrl($url)
+    public function mailboxReturnUrl($url = null)
     {
         if (!$url) {
-            $url = Horde::applicationUrl('mailbox.php')->setRaw(true);
+            $url = Horde::applicationUrl('mailbox.php');
         }
 
         foreach (array('start', 'page', 'mailbox', 'thismailbox') as $key) {
index 17f4899..8f1403b 100644 (file)
@@ -42,9 +42,7 @@ $registry->setTimeZone();
 try {
     $redirect = Horde::callHook('mbox_redirect', array(IMP::$mailbox), 'imp');
     if (!empty($redirect)) {
-        $redirect = Horde::applicationUrl($redirect, true);
-        header('Location: ' . $redirect);
-        exit;
+        Horde::applicationUrl($redirect, true)->redirect();
     }
 } catch (Horde_Exception_HookNotSet $e) {}
 
@@ -136,8 +134,7 @@ case 'fwd_digest':
                 Horde::popupJs(Horde::applicationUrl('compose.php'), array('novoid' => true, 'params' => array_merge(array('popup' => 1), $options)))
             ), 'dom');
         } else {
-            header('Location: ' . Horde::applicationUrl('compose.php', true)->add($options));
-            exit;
+            Horde::applicationUrl('compose.php', true)->add($options)->redirect();
         }
     }
     break;
@@ -190,9 +187,7 @@ case 'empty_mailbox':
     break;
 
 case 'view_messages':
-    $redirect = IMP::generateIMPUrl('thread.php', IMP::$mailbox, null, null, false)->setRaw(true)->add(array('mode' => 'msgview', 'msglist' => strval($indices)));
-    header('Location: ' . $redirect);
-    exit;
+    IMP::generateIMPUrl('thread.php', IMP::$mailbox, null, null, false)->add(array('mode' => 'msgview', 'msglist' => strval($indices)))->redirect();
 }
 
 /* Token to use in requests */
index cf9b79b..6509201 100644 (file)
@@ -31,8 +31,7 @@ $vars = Horde_Variables::getDefaultVariables();
 /* Make sure we have a valid index. */
 $imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid));
 if (!$imp_mailbox->isValidIndex(false)) {
-    header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->setRaw(true)->add('a', 'm'));
-    exit;
+    IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->add('a', 'm')->redirect();
 }
 
 $readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly(IMP::$mailbox);
@@ -91,8 +90,7 @@ if ($msg_delete && $imp_ui->moveAfterAction()) {
  * case. */
 if (!$imp_mailbox->isValidIndex() ||
     ($msg_delete && $prefs->getValue('mailbox_return'))) {
-    header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->setRaw(true)->add('s', $msg_index));
-    exit;
+    IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->add('s', $msg_index)->redirect();
 }
 
 /* Now that we are done processing the messages, get the index and
@@ -113,8 +111,7 @@ try {
         Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => $readonly))
     ), array('ids' => array($uid)));
 } catch (Horde_Imap_Client_Exception $e) {
-    header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name)->setRaw(true)->add('a', 'm'));
-    exit;
+    IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name)->add('a', 'm')->redirect();
 }
 
 $envelope = $fetch_ret[$uid]['envelope'];
@@ -126,8 +123,7 @@ $use_pop = ($_SESSION['imp']['protocol'] == 'pop');
 try {
     $imp_contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($imp_mailbox));
 } catch (IMP_Exception $e) {
-    header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name)->setRaw(true)->add('a', 'm'));
-    exit;
+    IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name)->add('a', 'm')->redirect();
 }
 
 /* Get the starting index for the current message and the message count. */
index 768a3c6..5395650 100644 (file)
@@ -35,8 +35,7 @@ if ($search_mailbox) {
     $id = $imp_ui_search->processBasicSearch($search_mailbox, Horde_Util::getFormData('search_criteria'), Horde_Util::getFormData('search_criteria_text'), Horde_Util::getFormData('search_criteria_not'), Horde_Util::getFormData('search_flags'));
 
     /* Redirect to the mailbox screen. */
-    header('Location: ' . Horde::applicationUrl('mailbox.php', true)->setRaw(true)->add('mailbox', $imp_search->createSearchID($id)));
-    exit;
+    Horde::applicationUrl('mailbox.php', true)->add('mailbox', $imp_search->createSearchID($id))->redirect();
 }
 
 $f_fields = $s_fields = array();
index eb7763b..e4ae460 100644 (file)
@@ -83,10 +83,10 @@ if (!empty($criteria)) {
         print '<html><head>' .
             Horde::wrapInlineScript(array('window.parent.DimpBase.go(' . Horde_Serialize::serialize('folder:' . $id, Horde_Serialize::JSON, $charset) . ')')) .
             '</head></html>';
-    } else {
-        header('Location: ' . Horde::applicationUrl('mailbox.php', true)->setRaw(true)->add('mailbox', $id));
+        exit;
     }
-    exit;
+
+    Horde::applicationUrl('mailbox.php', true)->add('mailbox', $id)->redirect();
 }
 
 /* Generate master folder list. */
@@ -149,8 +149,7 @@ if (!is_null($edit_query) && $imp_search->isSearchMbox($edit_query)) {
     if ($imp_search->isVFolder($edit_query)) {
         if (!$imp_search->isEditableVFolder($edit_query)) {
             $notification->push(_("Special Virtual Folders cannot be edited."), 'horde.error');
-            header('Location: ' . Horde::applicationUrl('mailbox.php', true));
-            exit;
+            Horde::applicationUrl('mailbox.php', true)->redirect();
         }
         $t->set('edit_query_vfolder', htmlspecialchars($edit_query));
     }
index eedec33..25eb2a3 100644 (file)
@@ -10,8 +10,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 if (!Horde_Util::getFormData('cancel')) {
@@ -64,4 +63,4 @@ if (!empty($url)) {
 }
 
 // Make sure URL is unique.
-header('Location: ' . $url->unique());
+$url->unique()->redirect();
index 11dfea5..707ee04 100644 (file)
@@ -11,8 +11,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 // Get the current attendees array from the session cache.
@@ -163,8 +162,7 @@ case 'dismiss':
     }
 
     // Make sure URL is unique.
-    header('Location: ' . $url->unique());
-    exit;
+    $url->unique()->redirect();
 
 case 'clear':
     // Remove all the attendees and resources.
index c2695ea..618fa8f 100644 (file)
@@ -12,8 +12,7 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('calendar:internal'));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('calendar:internal')->redirect();
 }
 
 require_once KRONOLITH_BASE . '/lib/Forms/CreateCalendar.php';
@@ -21,8 +20,7 @@ require_once KRONOLITH_BASE . '/lib/Forms/CreateCalendar.php';
 // Exit if this isn't an authenticated user or if the user can't
 // create new calendars (default share is locked).
 if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('default_share')) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -36,8 +34,7 @@ if ($form->validate($vars)) {
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
     }
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 
 $title = $form->getTitle();
index 70ab501..9d5b981 100644 (file)
@@ -15,35 +15,30 @@ require_once KRONOLITH_BASE . '/lib/Forms/DeleteCalendar.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
 $calendar_id = $vars->get('c');
 if ($calendar_id == $GLOBALS['registry']->getAuth()) {
     $notification->push(_("This calendar cannot be deleted."), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('calendar:internal|' . $calendar_id));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('calendar:internal|' . $calendar_id)->redirect();
 }
 
 try {
     $calendar = $kronolith_shares->getShare($calendar_id);
 } catch (Exception $e) {
     $notification->push($e, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 if ($calendar->get('owner') != $GLOBALS['registry']->getAuth() &&
     (!is_null($calendar->get('owner')) || !$registry->isAdmin())) {
     $notification->push(_("You are not allowed to delete this calendar."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 $form = new Kronolith_DeleteCalendarForm($vars, $calendar);
 
@@ -55,8 +50,7 @@ if ($form->validate(new Horde_Variables($_POST))) {
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
     }
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 
 $title = $form->getTitle();
index e42b695..75566dd 100644 (file)
@@ -14,30 +14,26 @@ Horde_Registry::appInit('kronolith');
 $vars = Horde_Variables::getDefaultVariables();
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('calendar:internal|' . $vars->get('c')));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('calendar:internal|' . $vars->get('c'))->redirect();
 }
 
 require_once KRONOLITH_BASE . '/lib/Forms/EditCalendar.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 try {
     $calendar = $kronolith_shares->getShare($vars->get('c'));
 } catch (Exception $e) {
     $notification->push($e, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 if ($calendar->get('owner') != $GLOBALS['registry']->getAuth() &&
     (!is_null($calendar->get('owner')) || !$registry->isAdmin())) {
     $notification->push(_("You are not allowed to change this calendar."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 $form = new Kronolith_EditCalendarForm($vars, $calendar);
 
@@ -54,8 +50,7 @@ if ($form->validate($vars)) {
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
     }
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 
 $vars->set('name', $calendar->get('name'));
index 341b59f..e2485c7 100644 (file)
@@ -25,14 +25,12 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php'));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php')->redirect();
 }
 
 $edit_url_base = Horde::applicationUrl('calendars/edit.php');
index d5d43f3..2be7ef5 100644 (file)
@@ -15,8 +15,7 @@ $vars = Horde_Variables::getDefaultVariables();
 $url = $vars->get('url');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('calendar:remote|' . rawurlencode($url)));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('calendar:remote|' . rawurlencode($url))->redirect();
 }
 
 require_once KRONOLITH_BASE . '/lib/Forms/EditRemoteCalendar.php';
@@ -24,8 +23,7 @@ require_once KRONOLITH_BASE . '/lib/Forms/EditRemoteCalendar.php';
 // Exit if this isn't an authenticated user or if the user can't
 // subscribe to remote calendars (remote_cals is locked).
 if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('remote_cals')) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 $remote_calendar = null;
@@ -38,8 +36,7 @@ foreach ($remote_calendars as $key => $calendar) {
 }
 if (is_null($remote_calendar)) {
     $notification->push(_("The remote calendar was not found."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 
 $form = new Kronolith_EditRemoteCalendarForm($vars, $remote_calendar);
@@ -52,8 +49,7 @@ if ($form->validate($vars)) {
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
     }
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 
 $key = $registry->getAuthCredential('password');
index 749871b..f2b66a4 100644 (file)
@@ -15,8 +15,7 @@ $vars = Horde_Variables::getDefaultVariables();
 $url = $vars->get('url');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('calendar:remote|' . rawurlencode($url)));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('calendar:remote|' . rawurlencode($url))->redirect();
 }
 
 require_once KRONOLITH_BASE . '/lib/Forms/SubscribeRemoteCalendar.php';
@@ -24,8 +23,7 @@ require_once KRONOLITH_BASE . '/lib/Forms/SubscribeRemoteCalendar.php';
 // Exit if this isn't an authenticated user or if the user can't
 // subscribe to remote calendars (remote_cals is locked).
 if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('remote_cals')) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 $form = new Kronolith_SubscribeRemoteCalendarForm($vars);
@@ -38,8 +36,7 @@ if ($form->validate($vars)) {
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
     }
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 
 $title = $form->getTitle();
index 36abebe..49ebcc1 100644 (file)
@@ -15,8 +15,7 @@ $vars = Horde_Variables::getDefaultVariables();
 $url = $vars->get('url');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('calendar:remote|' . rawurlencode($url)));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('calendar:remote|' . rawurlencode($url))->redirect();
 }
 
 require_once KRONOLITH_BASE . '/lib/Forms/UnsubscribeRemoteCalendar.php';
@@ -24,8 +23,7 @@ require_once KRONOLITH_BASE . '/lib/Forms/UnsubscribeRemoteCalendar.php';
 // Exit if this isn't an authenticated user or if the user can't
 // subscribe to remote calendars (remote_cals is locked).
 if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('remote_cals')) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 $remote_calendar = null;
@@ -39,8 +37,7 @@ foreach ($remote_calendars as $key => $calendar) {
 }
 if (is_null($remote_calendar)) {
     $notification->push(_("The remote calendar was not found."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 $form = new Kronolith_UnsubscribeRemoteCalendarForm($vars, $remote_calendar);
 
@@ -52,8 +49,7 @@ if ($form->validate(new Horde_Variables($_POST))) {
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
     }
-    header('Location: ' . Horde::applicationUrl('calendars/', true));
-    exit;
+    Horde::applicationUrl('calendars/', true)->redirect();
 }
 
 $vars->set('url', $calendar['url']);
index 5d0d5df..90fd67f 100644 (file)
@@ -10,8 +10,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 if (!$GLOBALS['registry']->getAuth()) {
index 0a773a1..1d3f977 100644 (file)
@@ -19,8 +19,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 if (!$conf['menu']['import_export']) {
index af56303..29aa121 100644 (file)
@@ -13,8 +13,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('day:' . Kronolith::currentDate()->dateString()));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('day:' . Kronolith::currentDate()->dateString())->redirect();
 }
 
 $view = Kronolith::getView('Day');
index 453ab74..d2bfc85 100644 (file)
@@ -13,8 +13,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 if (Kronolith_Resource::isResourceCalendar($c = Horde_Util::getFormData('calendar'))) {
@@ -31,8 +30,7 @@ if ($eventID = Horde_Util::getFormData('eventID')) {
         if (($url = Horde_Util::getFormData('url')) === null) {
             $url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true);
         }
-        header('Location: ' . $url);
-        exit;
+        (new Horde_Url($url))->redirect();
     }
     if ($driver != 'Resource') {
         $share = $kronolith_shares->getShare($event->calendar);
@@ -104,4 +102,4 @@ if (!empty($url)) {
 }
 
 // Make sure URL is unique.
-header('Location: ' . $url->unique());
+$url->unique()->redirect();
index 1bec575..71fdaa6 100644 (file)
@@ -43,8 +43,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 $kronolith_driver = Kronolith::getDriver();
@@ -195,4 +194,4 @@ if (!empty($url)) {
 }
 
 // Make sure URL is unique.
-header('Location: ' . $url->unique());
+$url->unique()->redirect();
index 253e2bf..55cc99b 100644 (file)
@@ -16,13 +16,11 @@ $viewName = Horde_Util::getFormData('view', 'Event');
 $view = Kronolith::getView($viewName);
 if (is_string($view->event)) {
     $notification->push($view->event, 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('event:' . $view->event->calendarType . '|' . $view->event->calendar . ':' . $view->event->id . ':' . Horde_Util::getFormData('datetime', Kronolith::currentDate()->dateString())));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('event:' . $view->event->calendarType . '|' . $view->event->calendar . ':' . $view->event->id . ':' . Horde_Util::getFormData('datetime', Kronolith::currentDate()->dateString()))->redirect();
 }
 
 switch ($viewName) {
@@ -31,8 +29,7 @@ case 'DeleteEvent':
     if (!$view->event->recurs() &&
         !($prefs->getValue('confirm_delete') ||
           Horde_Util::getFormData('confirm'))) {
-        header('Location: ' . Horde::applicationUrl('delete.php?' . $_SERVER['QUERY_STRING'], true));
-        exit;
+        Horde::applicationUrl('delete.php?' . $_SERVER['QUERY_STRING'], true)->redirect();
     }
     break;
 
@@ -45,8 +42,7 @@ case 'EditEvent':
         } else {
             $url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true);
         }
-        header('Location: ' . $url->unique());
-        exit;
+        $url->unique()->redirect();
     }
     break;
 }
index 1082ec8..6219daf 100644 (file)
@@ -12,8 +12,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('month:' . Kronolith::currentDate()->dateString()));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('month:' . Kronolith::currentDate()->dateString())->redirect();
 }
 
 $view = Kronolith::getView('Month');
index ce97761..4ce04bd 100644 (file)
@@ -12,8 +12,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('event'));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('event')->redirect();
 }
 
 /* Check permissions. */
@@ -30,13 +29,12 @@ if ($perms->hasAppPermission('max_events') !== true &&
         $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
     }
     $notification->push($message, 'horde.error', array('content.raw'));
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 }
 
 $calendar_id = Horde_Util::getFormData('calendar', Kronolith::getDefaultCalendar(Horde_Perms::EDIT));
 if (!$calendar_id) {
-    header('Location: ' . $url);
+    $url->redirect();
 }
 
 $event = Kronolith::getDriver()->getEvent();
index 154836f..770ad7d 100644 (file)
@@ -13,8 +13,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 // Exit if the user shouldn't be able to change share permissions.
index 859f462..33aeb1c 100644 (file)
@@ -12,14 +12,12 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 // Exit if this isn't an authenticated, administrative user
 if (!$registry->isAdmin()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 require_once KRONOLITH_BASE . '/lib/Forms/CreateResource.php';
@@ -36,7 +34,7 @@ if ($form->validate($vars)) {
         $notification->push($e, 'horde.error');
     }
 
-    header('Location: ' . Horde::applicationUrl('resources/', true));
+    Horde::applicationUrl('resources/', true)->redirect();
     exit;
 }
 
index f258547..39df9e6 100644 (file)
@@ -12,16 +12,14 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 require_once KRONOLITH_BASE . '/lib/Forms/DeleteResource.php';
 
 // Exit if this isn't an authenticated administrative user.
 if (!$registry->isAdmin()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -29,13 +27,11 @@ try {
     $resource = Kronolith::getDriver('Resource')->getResource($vars->get('c'));
     if (!$resource->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
         $notification->push(_("You are not allowed to delete this resource."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('resources/', true));
-        exit;
+        Horde::applicationUrl('resources/', true)->redirect();
     }
 } catch (Exception $e) {
     $notification->push($e, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('resources/', true));
-    exit;
+    Horde::applicationUrl('resources/', true)->redirect();
 }
 
 $form = new Kronolith_DeleteResourceForm($vars, $resource);
@@ -49,8 +45,7 @@ if ($form->validate(new Horde_Variables($_POST))) {
         $notification->push($e, 'horde.error');
     }
 
-    header('Location: ' . Horde::applicationUrl('resources/', true));
-    exit;
+    Horde::applicationUrl('resources/', true)->redirect();
 }
 
 $title = $form->getTitle();
index 4c546f7..12d0d32 100644 (file)
@@ -12,16 +12,14 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 require_once KRONOLITH_BASE . '/lib/Forms/EditResource.php';
 
 // Exit if this isn't an authenticated administrative user.
 if (!$registry->isAdmin()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -29,13 +27,11 @@ try {
     $resource = Kronolith::getDriver('Resource')->getResource($vars->get('c'));
     if (!$resource->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
         $notification->push(_("You are not allowed to change this resource."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('resources/', true));
-        exit;
+        Horde::applicationUrl('resources/', true)->redirect();
     }
 } catch (Exception $e) {
     $notification->push($e, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('resources/', true));
-    exit;
+    Horde::applicationUrl('resources/', true)->redirect();
 }
 $form = new Kronolith_EditResourceForm($vars, $resource);
 
@@ -53,8 +49,7 @@ if ($form->validate($vars)) {
         $notification->push($e, 'horde.error');
     }
 
-    header('Location: ' . Horde::applicationUrl('resources/', true));
-    exit;
+    Horde::applicationUrl('resources/', true)->redirect();
 }
 
 $vars->set('name', $resource->get('name'));
index 05b3652..56a2ef3 100644 (file)
@@ -15,8 +15,7 @@ require_once KRONOLITH_BASE . '/lib/Forms/CreateResourceGroup.php';
 
 // Exit if this isn't an authenticated, administrative user
 if (!$registry->isAdmin()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -31,8 +30,7 @@ if ($form->validate($vars)) {
         $notification->push($e, 'horde.error');
     }
 
-    header('Location: ' . Horde::applicationUrl('resources/groups/', true));
-    exit;
+    Horde::applicationUrl('resources/groups/', true)->redirect();
 }
 
 $title = $form->getTitle();
index af8ee4c..0e8edd1 100644 (file)
@@ -15,8 +15,7 @@ require_once KRONOLITH_BASE . '/lib/Forms/DeleteResourceGroup.php';
 
 // Exit if this isn't an authenticated administrative user.
 if (!$registry->isAdmin()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -24,13 +23,11 @@ try {
     $resource = Kronolith::getDriver('Resource')->getResource($vars->get('c'));
     if (!$resource->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
         $notification->push(_("You are not allowed to delete this resource group."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('resources/groups/', true));
-        exit;
+        Horde::applicationUrl('resources/groups/', true)->redirect();
     }
 } catch (Exception $e) {
     $notification->push($e, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('resources/groups/', true));
-    exit;
+    Horde::applicationUrl('resources/groups/', true)->redirect();
 }
 
 $form = new Kronolith_DeleteResourceGroupForm($vars, $resource);
@@ -44,8 +41,7 @@ if ($form->validate(new Horde_Variables($_POST))) {
         $notification->push($e, 'horde.error');
     }
 
-    header('Location: ' . Horde::applicationUrl('resources/groups/', true));
-    exit;
+    Horde::applicationUrl('resources/groups/', true)->redirect();
 }
 
 $title = $form->getTitle();
index bfd05b0..5be03a5 100644 (file)
@@ -15,8 +15,7 @@ require_once KRONOLITH_BASE . '/lib/Forms/EditResourceGroup.php';
 
 // Exit if this isn't an authenticated administrative user.
 if (!$registry->isAdmin()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -24,13 +23,11 @@ try {
     $group = Kronolith::getDriver('Resource')->getResource($vars->get('c'));
     if (!$group->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
         $notification->push(_("You are not allowed to change this resource."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('resources/groups/', true));
-        exit;
+        Horde::applicationUrl('resources/groups/', true)->redirect();
     }
 } catch (Exception $e) {
     $notification->push($e, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('resources/groups/', true));
-    exit;
+    Horde::applicationUrl('resources/groups/', true)->redirect();
 }
 $form = new Kronolith_EditResourceGroupForm($vars, $group);
 
@@ -48,8 +45,7 @@ if ($form->validate($vars)) {
         $notification->push($e, 'horde.error');
     }
 
-    header('Location: ' . Horde::applicationUrl('resources/groups/', true));
-    exit;
+    Horde::applicationUrl('resources/groups/', true)->redirect();
 }
 
 $vars->set('name', $group->get('name'));
index bfc9583..d5d5e70 100644 (file)
@@ -14,8 +14,7 @@ require KRONOLITH_TEMPLATES . '/menu.inc';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php'));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php')->redirect();
 }
 $edit_url_base = Horde::applicationUrl('resources/groups/edit.php');
 $edit_img = Horde::img('edit.png', _("Edit"));
index 0fc6bd8..2a4eef9 100644 (file)
@@ -8,8 +8,7 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 $title = _("Edit resources");
@@ -19,8 +18,7 @@ require KRONOLITH_TEMPLATES . '/menu.inc';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php'));
-    exit;
+    Horde::applicationUrl($prefs->getValue('defaultview') . '.php')->redirect();
 }
 $edit_url_base = Horde::applicationUrl('resources/edit.php');
 $edit_img = Horde::img('edit.png', _("Edit"));
index 84dac2e..b6edae8 100644 (file)
@@ -12,8 +12,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 /* Get search parameters. */
index d36db6b..a8f64df 100644 (file)
@@ -12,8 +12,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true));
-    exit;
+    Horde::applicationUrl('', true)->redirect();
 }
 
 $view = Kronolith::getView(Horde_Util::getFormData('view'));
index 24d55f9..043ca1f 100644 (file)
@@ -13,8 +13,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('week:' . Kronolith::currentDate()->dateString()));
-    exit;
+    Horde::applicationUrl('', true)->setAnchor('week:' . Kronolith::currentDate()->dateString())->redirect();
 }
 
 $view = Kronolith::getView('Week');
index c091ce1..9fdca60 100644 (file)
@@ -13,7 +13,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('week:' . Kronolith::currentDate()->dateString()));
+    Horde::applicationUrl('', true)->setAnchor('week:' . Kronolith::currentDate()->dateString())->redirect();
     exit;
 }
 
index 68f4eca..02eefd8 100644 (file)
@@ -13,7 +13,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 if (Kronolith::showAjaxView()) {
-    header('Location: ' . Horde::applicationUrl('', true)->setAnchor('year:' . Kronolith::currentDate()->dateString()));
+    Horde::applicationUrl('', true)->setAnchor('year:' . Kronolith::currentDate()->dateString())->redirect();
     exit;
 }