From 02d755c4f13fcc243bfebbff5a9e5f18187d496f Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 30 Jul 2010 13:03:24 -0600 Subject: [PATCH] Use Horde_Url::redirect() --- imp/compose.php | 9 ++++----- imp/folders-mimp.php | 3 +-- imp/folders.php | 3 +-- imp/lib/Application.php | 3 +-- imp/lib/Ui/Compose.php | 4 ++-- imp/mailbox.php | 11 +++-------- imp/message-mimp.php | 12 ++++-------- imp/search-basic.php | 3 +-- imp/search.php | 9 ++++----- kronolith/add.php | 5 ++--- kronolith/attendees.php | 6 ++---- kronolith/calendars/create.php | 9 +++------ kronolith/calendars/delete.php | 18 ++++++------------ kronolith/calendars/edit.php | 15 +++++---------- kronolith/calendars/index.php | 6 ++---- kronolith/calendars/remote_edit.php | 12 ++++-------- kronolith/calendars/remote_subscribe.php | 9 +++------ kronolith/calendars/remote_unsubscribe.php | 12 ++++-------- kronolith/contacts.php | 3 +-- kronolith/data.php | 3 +-- kronolith/day.php | 3 +-- kronolith/delete.php | 8 +++----- kronolith/edit.php | 5 ++--- kronolith/event.php | 12 ++++-------- kronolith/month.php | 3 +-- kronolith/new.php | 8 +++----- kronolith/perms.php | 3 +-- kronolith/resources/create.php | 8 +++----- kronolith/resources/delete.php | 15 +++++---------- kronolith/resources/edit.php | 15 +++++---------- kronolith/resources/groups/create.php | 6 ++---- kronolith/resources/groups/delete.php | 12 ++++-------- kronolith/resources/groups/edit.php | 12 ++++-------- kronolith/resources/groups/index.php | 3 +-- kronolith/resources/index.php | 6 ++---- kronolith/search.php | 3 +-- kronolith/view.php | 3 +-- kronolith/week.php | 3 +-- kronolith/workweek.php | 2 +- kronolith/year.php | 2 +- 40 files changed, 100 insertions(+), 187 deletions(-) diff --git a/imp/compose.php b/imp/compose.php index 822e30c2c..f3aa9efe6 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -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; diff --git a/imp/folders-mimp.php b/imp/folders-mimp.php index 36d0cd215..19b2d3b90 100644 --- a/imp/folders-mimp.php +++ b/imp/folders-mimp.php @@ -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 */ diff --git a/imp/folders.php b/imp/folders.php index d14165b31..698a68d65 100644 --- a/imp/folders.php +++ b/imp/folders.php @@ -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 */ diff --git a/imp/lib/Application.php b/imp/lib/Application.php index 83d4fc5a7..abaef477a 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -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(); } } diff --git a/imp/lib/Ui/Compose.php b/imp/lib/Ui/Compose.php index 0df1b8eb8..167e96964 100644 --- a/imp/lib/Ui/Compose.php +++ b/imp/lib/Ui/Compose.php @@ -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) { diff --git a/imp/mailbox.php b/imp/mailbox.php index 17f489906..8f1403b99 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -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 */ diff --git a/imp/message-mimp.php b/imp/message-mimp.php index cf9b79bb2..6509201b8 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -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. */ diff --git a/imp/search-basic.php b/imp/search-basic.php index 768a3c612..5395650ee 100644 --- a/imp/search-basic.php +++ b/imp/search-basic.php @@ -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(); diff --git a/imp/search.php b/imp/search.php index eb7763b66..e4ae4603f 100644 --- a/imp/search.php +++ b/imp/search.php @@ -83,10 +83,10 @@ if (!empty($criteria)) { print '' . Horde::wrapInlineScript(array('window.parent.DimpBase.go(' . Horde_Serialize::serialize('folder:' . $id, Horde_Serialize::JSON, $charset) . ')')) . ''; - } 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)); } diff --git a/kronolith/add.php b/kronolith/add.php index eedec33fa..25eb2a36c 100644 --- a/kronolith/add.php +++ b/kronolith/add.php @@ -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(); diff --git a/kronolith/attendees.php b/kronolith/attendees.php index 11dfea519..707ee040d 100644 --- a/kronolith/attendees.php +++ b/kronolith/attendees.php @@ -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. diff --git a/kronolith/calendars/create.php b/kronolith/calendars/create.php index c2695ea26..618fa8f1f 100644 --- a/kronolith/calendars/create.php +++ b/kronolith/calendars/create.php @@ -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(); diff --git a/kronolith/calendars/delete.php b/kronolith/calendars/delete.php index 70ab50197..9d5b98154 100644 --- a/kronolith/calendars/delete.php +++ b/kronolith/calendars/delete.php @@ -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(); diff --git a/kronolith/calendars/edit.php b/kronolith/calendars/edit.php index e42b69518..75566ddae 100644 --- a/kronolith/calendars/edit.php +++ b/kronolith/calendars/edit.php @@ -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')); diff --git a/kronolith/calendars/index.php b/kronolith/calendars/index.php index 341b59fd7..e2485c761 100644 --- a/kronolith/calendars/index.php +++ b/kronolith/calendars/index.php @@ -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'); diff --git a/kronolith/calendars/remote_edit.php b/kronolith/calendars/remote_edit.php index d5d43f3d2..2be7ef527 100644 --- a/kronolith/calendars/remote_edit.php +++ b/kronolith/calendars/remote_edit.php @@ -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'); diff --git a/kronolith/calendars/remote_subscribe.php b/kronolith/calendars/remote_subscribe.php index 749871bb6..f2b66a418 100644 --- a/kronolith/calendars/remote_subscribe.php +++ b/kronolith/calendars/remote_subscribe.php @@ -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(); diff --git a/kronolith/calendars/remote_unsubscribe.php b/kronolith/calendars/remote_unsubscribe.php index 36abebe17..49ebcc1bc 100644 --- a/kronolith/calendars/remote_unsubscribe.php +++ b/kronolith/calendars/remote_unsubscribe.php @@ -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']); diff --git a/kronolith/contacts.php b/kronolith/contacts.php index 5d0d5df33..90fd67f97 100644 --- a/kronolith/contacts.php +++ b/kronolith/contacts.php @@ -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()) { diff --git a/kronolith/data.php b/kronolith/data.php index 0a773a1c6..1d3f977eb 100644 --- a/kronolith/data.php +++ b/kronolith/data.php @@ -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']) { diff --git a/kronolith/day.php b/kronolith/day.php index af563036d..29aa12112 100644 --- a/kronolith/day.php +++ b/kronolith/day.php @@ -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'); diff --git a/kronolith/delete.php b/kronolith/delete.php index 453ab7462..d2bfc8519 100644 --- a/kronolith/delete.php +++ b/kronolith/delete.php @@ -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(); diff --git a/kronolith/edit.php b/kronolith/edit.php index 1bec575f4..71fdaa6c5 100644 --- a/kronolith/edit.php +++ b/kronolith/edit.php @@ -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(); diff --git a/kronolith/event.php b/kronolith/event.php index 253e2bf2b..55cc99bd6 100644 --- a/kronolith/event.php +++ b/kronolith/event.php @@ -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; } diff --git a/kronolith/month.php b/kronolith/month.php index 1082ec823..6219dafbb 100644 --- a/kronolith/month.php +++ b/kronolith/month.php @@ -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'); diff --git a/kronolith/new.php b/kronolith/new.php index ce97761a1..4ce04bdb7 100644 --- a/kronolith/new.php +++ b/kronolith/new.php @@ -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(); diff --git a/kronolith/perms.php b/kronolith/perms.php index 154836fe1..770ad7d37 100644 --- a/kronolith/perms.php +++ b/kronolith/perms.php @@ -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. diff --git a/kronolith/resources/create.php b/kronolith/resources/create.php index 859f462ce..33aeb1c2e 100644 --- a/kronolith/resources/create.php +++ b/kronolith/resources/create.php @@ -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; } diff --git a/kronolith/resources/delete.php b/kronolith/resources/delete.php index f25854719..39df9e677 100644 --- a/kronolith/resources/delete.php +++ b/kronolith/resources/delete.php @@ -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(); diff --git a/kronolith/resources/edit.php b/kronolith/resources/edit.php index 4c546f760..12d0d32b3 100644 --- a/kronolith/resources/edit.php +++ b/kronolith/resources/edit.php @@ -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')); diff --git a/kronolith/resources/groups/create.php b/kronolith/resources/groups/create.php index 05b3652ff..56a2ef311 100644 --- a/kronolith/resources/groups/create.php +++ b/kronolith/resources/groups/create.php @@ -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(); diff --git a/kronolith/resources/groups/delete.php b/kronolith/resources/groups/delete.php index af8ee4c0f..0e8edd18e 100644 --- a/kronolith/resources/groups/delete.php +++ b/kronolith/resources/groups/delete.php @@ -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(); diff --git a/kronolith/resources/groups/edit.php b/kronolith/resources/groups/edit.php index bfd05b09b..5be03a537 100644 --- a/kronolith/resources/groups/edit.php +++ b/kronolith/resources/groups/edit.php @@ -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')); diff --git a/kronolith/resources/groups/index.php b/kronolith/resources/groups/index.php index bfc95835a..d5d5e70f9 100644 --- a/kronolith/resources/groups/index.php +++ b/kronolith/resources/groups/index.php @@ -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")); diff --git a/kronolith/resources/index.php b/kronolith/resources/index.php index 0fc6bd8e2..2a4eef916 100644 --- a/kronolith/resources/index.php +++ b/kronolith/resources/index.php @@ -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")); diff --git a/kronolith/search.php b/kronolith/search.php index 84dac2e3a..b6edae8cf 100644 --- a/kronolith/search.php +++ b/kronolith/search.php @@ -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. */ diff --git a/kronolith/view.php b/kronolith/view.php index d36db6b13..a8f64dfd1 100644 --- a/kronolith/view.php +++ b/kronolith/view.php @@ -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')); diff --git a/kronolith/week.php b/kronolith/week.php index 24d55f998..043ca1f2f 100644 --- a/kronolith/week.php +++ b/kronolith/week.php @@ -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'); diff --git a/kronolith/workweek.php b/kronolith/workweek.php index c091ce155..9fdca60e2 100644 --- a/kronolith/workweek.php +++ b/kronolith/workweek.php @@ -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; } diff --git a/kronolith/year.php b/kronolith/year.php index 68f4eca0f..02eefd860 100644 --- a/kronolith/year.php +++ b/kronolith/year.php @@ -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; } -- 2.11.0