Use Horde_Url#redirect().
authorJan Schneider <jan@horde.org>
Tue, 3 Aug 2010 22:43:06 +0000 (00:43 +0200)
committerJan Schneider <jan@horde.org>
Tue, 3 Aug 2010 22:43:31 +0000 (00:43 +0200)
178 files changed:
agora/ban.php
agora/deleteforum.php
agora/editforum.php
agora/messages/abuse.php
agora/messages/delete.php
agora/messages/edit.php
agora/messages/index.php
agora/messages/lock.php
agora/messages/merge.php
agora/messages/move.php
agora/messages/split.php
agora/moderate.php
agora/moderators.php
agora/search.php
agora/threads.php
ansel/gallery/sort.php
babel/edit.php
babel/upload.php
beatnik/autogenerate.php
beatnik/commit.php
beatnik/delete.php
beatnik/editrec.php
beatnik/lib/Driver.php
beatnik/viewzone.php
chora/cvsgraph.php
chora/history.php
chora/patchsets.php
fima/account.php
fima/ledgers/create.php
fima/ledgers/delete.php
fima/ledgers/edit.php
fima/postings.php
folks/account/resetpassword.php
folks/config/hooks.php.dist
folks/edit/activity.php
folks/edit/comments.php
folks/edit/edit.php
folks/edit/facebook.php
folks/edit/friends/add.php
folks/edit/friends/approve.php
folks/edit/friends/blacklist.php
folks/edit/friends/groups.php
folks/edit/friends/reject.php
folks/edit/privacy.php
folks/friends.php
folks/report.php
folks/save_search.php
folks/user.php
framework/Block/lib/Horde/Block/Layout/Manager.php
framework/Service_Twitter/doc/twitter.php.example
gollem/lib/Auth.php
gollem/permissions.php
gollem/view.php
hermes/entry.php
hermes/invoicing.php
horde/admin/perms/edit.php
hylax/print.php
hylax/send.php
hylax/view.php
ingo/blacklist.php
ingo/filters.php
ingo/forward.php
ingo/rule.php
ingo/script.php
ingo/spam.php
ingo/vacation.php
ingo/whitelist.php
jonah/channels/aggregate.php
jonah/channels/delete.php
jonah/channels/edit.php
jonah/channels/index.php
jonah/delivery/html.php
jonah/stories/delete.php
jonah/stories/edit.php
jonah/stories/index.php
jonah/stories/results.php
jonah/stories/share.php
jonah/stories/view.php
koward/lib/Koward/Cli.php
koward/lib/Koward/Controller/Application.php
koward/lib/Koward/Controller/IndexController.php
koward/lib/Koward/Controller/ObjectController.php
koward/www/htdocs/koward/koward.php
luxor/search.php
mnemo/memo.php
mnemo/note/pdf.php
mnemo/notepads/create.php
mnemo/notepads/delete.php
mnemo/notepads/edit.php
mnemo/notes/index.php
mnemo/view.php
nag/quick.php
nag/task.php
nag/tasklists/create.php
nag/tasklists/delete.php
nag/tasklists/edit.php
nag/tasks/index.php
nag/view.php
news/add.php
news/admin/categories/delete.php
news/admin/categories/edit.php
news/admin/sources/delete.php
news/admin/sources/edit.php
news/browse.php
news/delete.php
news/delete_file.php
news/edit.php
news/mail.php
news/news.php
news/note.php
news/pdf.php
news/search.php
pastie/paste.php
shout/dialplan.php
shout/index.php
shout/wizard.php
skoli/add.php
skoli/classes/create.php
skoli/classes/delete.php
skoli/classes/edit.php
skoli/classes/index.php
skoli/data.php
skoli/entry.php
skoli/list.php
trean/add.php
trean/bookmark.php
trean/browse.php
trean/data.php
trean/edit.php
trean/redirect.php
turba/add.php
turba/addressbooks/create.php
turba/addressbooks/delete.php
turba/addressbooks/edit.php
turba/contact.php
turba/delete.php
turba/deletefile.php
turba/edit.php
turba/lib/Form/AddContact.php
turba/lib/Form/EditContactGroup.php
turba/lib/View/Browse.php
turba/merge.php
turba/search.php
turba/vcard.php
vilma/domains/delete.php
vilma/domains/edit.php
vilma/users/delete.php
vilma/users/editAlias.php
vilma/users/index.php
vilma/virtuals/delete.php
vilma/virtuals/edit.php
vilma/virtuals/index.php
whups/admin/index.php
whups/data.php
whups/lib/Ticket.php
whups/lib/Whups.php
whups/query/index.php
whups/query/run.php
whups/queue/index.php
whups/search.php
whups/ticket/create.php
whups/ticket/delete.php
whups/ticket/delete_attachment.php
whups/ticket/delete_history.php
whups/ticket/queue.php
whups/ticket/type.php
whups/ticket/update.php
whups/view.php
wicked/diff.php
wicked/display.php
wicked/history.php
wicked/lib/Page/AddPage.php
wicked/lib/Page/DeletePage.php
wicked/lib/Page/EditPage.php
wicked/lib/Page/MergeOrRename.php
wicked/lib/Page/NewPage.php
wicked/lib/Page/RevertPage.php
wicked/lib/Page/SyncPages.php

index b8336bf..eba6e71 100644 (file)
@@ -16,15 +16,13 @@ list($forum_id, , $scope) = Agora::getAgoraId();
 $forums = &Agora_Messages::singleton($scope, $forum_id);
 if ($forums instanceof PEAR_Error) {
     $notification->push($forums->message, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('forums.php'));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Check permissions */
 if (!$forums->hasPermission(Horde_Perms::DELETE)) {
     $notification->push(sprintf(_("You don't have permissions to ban users from forum %s."), $forum_id), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php'));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Ban action */
index 60da3d8..d4b5ada 100644 (file)
@@ -17,13 +17,11 @@ Horde_Registry::appInit('agora');
 /* Set up the forums object. */
 $scope = Horde_Util::getFormData('scope', 'agora');
 $forums = &Agora_Messages::singleton($scope);
-$url = Horde::applicationUrl('forums.php');
 
 /* Check permissions */
 if (!$forums->hasPermission(Horde_Perms::DELETE)) {
     $notification->push(sprintf(_("You don't have permissions to delete forums in %s"), $registry->get('name', $scope)), 'horde.warning');
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Get forum. */
@@ -31,8 +29,7 @@ list($forum_id) = Agora::getAgoraId();
 $forum = $forums->getForum($forum_id);
 if ($forum instanceof PEAR_Error) {
     $notification->push($forum->message, 'horde.error');
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Prepare forum. */
@@ -67,8 +64,7 @@ if ($form->validate()) {
     } else {
         $notification->push(_("Forum not deleted."), 'horde.message');
     }
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Set up template variables. */
index 80ed3d1..13de196 100644 (file)
@@ -25,12 +25,11 @@ $vars->set('forum_id', $forum_id);
 /* Check permissions */
 if ($forum_id && !$registry->isAdmin(array('permission' => 'agora:admin'))) {
     $notification->push(sprintf(_("You don't have permissions to edit forum %s"), $registry->get('name', $scope)), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
-} elseif (!$registry->isAdmin(array('permission' => 'agora:admin'))) {
+    Horde::applicationUrl('forums.php', true)->redirect();
+}
+if (!$registry->isAdmin(array('permission' => 'agora:admin'))) {
     $notification->push(sprintf(_("You don't have permissions to create a new forum in %s"), $registry->get('name', $scope)), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 $form = new ForumForm($vars, $title);
@@ -38,11 +37,10 @@ if ($form->validate()) {
     $forum_id = $form->execute($vars);
     if ($forum_id instanceof PEAR_Error) {
         $notification->push(sprintf(_("Could not create the forum. %s"), $forum_id->message), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('forums.php', true));
-    } else {
-        $notification->push($vars->get('forum_id') ? _("Forum Modified") : _("Forum created."), 'horde.success');
-        header('Location: ' . Agora::setAgoraId($forum_id, null, Horde::applicationUrl('threads.php', true)));
+        Horde::applicationUrl('forums.php', true)->redirect();
     }
+    $notification->push($vars->get('forum_id') ? _("Forum Modified") : _("Forum created."), 'horde.success');
+    header('Location: ' . Agora::setAgoraId($forum_id, null, Horde::applicationUrl('threads.php', true)));
     exit;
 }
 
index 282e4b3..7d31ac3 100644 (file)
@@ -16,17 +16,14 @@ list($forum_id, $message_id, $scope) = Agora::getAgoraId();
 $messages = &Agora_Messages::singleton($scope, $forum_id);
 if ($messages instanceof PEAR_Error) {
     $notification->push($messages->getMessage(), 'horde.warning');
-    $url = Horde::applicationUrl('forums.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Get requested message, if fail then back to forums list. */
 $message = $messages->getMessage($message_id);
 if ($message instanceof PEAR_Error) {
     $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* We have any moderators? */
index 014cdd0..c6881c5 100644 (file)
@@ -18,17 +18,14 @@ list($forum_id, $message_id, $scope) = Agora::getAgoraId();
 $messages = &Agora_Messages::singleton($scope, $forum_id);
 if ($messages instanceof PEAR_Error) {
     $notification->push($messages->getMessage(), 'horde.warning');
-    $url = Horde::applicationUrl('forums.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Get requested message, if fail then back to forums list. */
 $message = $messages->getMessage($message_id);
 if ($message instanceof PEAR_Error) {
     $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Check delete permissions */
index 4647811..7a1ce5c 100644 (file)
@@ -25,9 +25,7 @@ $formname = $vars->get('formname');
 $messages = &Agora_Messages::singleton($scope, $forum_id);
 if ($messages instanceof PEAR_Error) {
     $notification->push(_("Could not post the message: ") . $messages->getMessage(), 'horde.warning');
-    $url = Horde::applicationUrl('forums.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Check edit permissions */
index 60959d0..c60e3f0 100644 (file)
@@ -18,17 +18,14 @@ list($forum_id, $message_id, $scope) = Agora::getAgoraId();
 $messages = &Agora_Messages::singleton($scope, $forum_id);
 if ($messages instanceof PEAR_Error) {
     $notification->push($messages->getMessage(), 'horde.warning');
-    $url = Horde::applicationUrl('forums.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Get requested message, if fail then back to forums list. */
 $message = $messages->getMessage($message_id);
 if ($message instanceof PEAR_Error) {
     $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Check if we must show bodies */
@@ -127,8 +124,7 @@ if ($messages->hasPermission(Horde_Perms::DELETE)) {
 $threads_list = $messages->getThreads($message['message_thread'], true, $sort_by, $sort_dir, ($view_bodies ? 1 : 0), '', null, $thread_start, $thread_per_page);
 if ($threads_list instanceof PEAR_Error) {
     $notification->push($threads_list->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Set up pager. */
index ab83227..b25b851 100644 (file)
@@ -18,17 +18,14 @@ list($forum_id, $message_id, $scope) = Agora::getAgoraId();
 $messages = &Agora_Messages::singleton($scope, $forum_id);
 if ($messages instanceof PEAR_Error) {
     $notification->push($messages->getMessage(), 'horde.warning');
-    $url = Horde::applicationUrl('forums.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Get requested message, if fail then back to forums list. */
 $message = $messages->getMessage($message_id);
 if ($message instanceof PEAR_Error) {
     $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Check delete permissions */
index bbe125d..77d751a 100644 (file)
@@ -16,17 +16,14 @@ list($forum_id, $message_id, $scope) = Agora::getAgoraId();
 $messages = &Agora_Messages::singleton($scope, $forum_id);
 if ($messages instanceof PEAR_Error) {
     $notification->push($messages->getMessage(), 'horde.warning');
-    $url = Horde::applicationUrl('forums.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Get requested message, if fail then back to forums list. */
 $message = $messages->getMessage($message_id);
 if ($message instanceof PEAR_Error) {
     $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Check delete permissions */
index 4daf3f5..4d23c2d 100644 (file)
@@ -16,17 +16,14 @@ list($forum_id, $message_id, $scope) = Agora::getAgoraId();
 $messages = &Agora_Messages::singleton($scope, $forum_id);
 if ($messages instanceof PEAR_Error) {
     $notification->push($messages->getMessage(), 'horde.warning');
-    $url = Horde::applicationUrl('forums.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Get requested message, if fail then back to forums list. */
 $message = $messages->getMessage($message_id);
 if ($message instanceof PEAR_Error) {
     $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Check delete permissions */
index a0d7752..14ced75 100644 (file)
@@ -16,17 +16,14 @@ list($forum_id, $message_id, $scope) = Agora::getAgoraId();
 $messages = &Agora_Messages::singleton($scope, $forum_id);
 if ($messages instanceof PEAR_Error) {
     $notification->push($messages->getMessage(), 'horde.warning');
-    $url = Horde::applicationUrl('forums.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Get requested message, if fail then back to forums list. */
 $message = $messages->getMessage($message_id);
 if ($message instanceof PEAR_Error) {
     $notification->push(sprintf(_("Could not open the message. %s"), $message->getMessage()), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Check delete permissions */
index abec439..302ad75 100644 (file)
@@ -43,8 +43,7 @@ case _("Delete"):
 $messages_list = $messages->getModerateList($sort_by, $sort_dir);
 if ($messages_list instanceof PEAR_Error) {
     $notification->push($messages_list->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 } elseif (empty($messages_list)) {
     $messages_count = 0;
     $notification->push(_("No messages are waiting for moderation."), 'horde.message');
index 30dce9f..c299d9e 100644 (file)
@@ -15,8 +15,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('agora');
 
 if (!$registry->isAdmin()) {
-    header('Location: ' . Horde::applicationUrl('forums.php'));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Set up the messages object. */
@@ -24,9 +23,7 @@ $scope = Horde_Util::getFormData('scope', 'agora');
 $messages = &Agora_Messages::singleton($scope);
 if ($messages instanceof PEAR_Error) {
     $notification->push($messages->getMessage(), 'horde.warning');
-    $url = Horde::applicationUrl('forums.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Moderator action */
@@ -39,16 +36,14 @@ if ($action) {
         $notification->push($result->getMessage(), 'horde.error');
     }
 
-    header('Location: ' . Horde::applicationUrl('moderators.php', true));
-    exit;
+    Horde::applicationUrl('moderators.php', true)->redirect();
 }
 
 /* Get the list of forums. */
 $forums_list = $messages->getForums(0, true, 'forum_name');
 if ($forums_list instanceof PEAR_Error) {
     $notification->push($forums_list->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Add delete links to moderators */
index e03be90..b32a235 100644 (file)
@@ -40,8 +40,7 @@ if ($form->isSubmitted() || $thread_page != null) {
     $searchResults = $messages->search($info, $sort_by, $sort_dir, $thread_start, $thread_per_page);
     if ($searchResults instanceof PEAR_Error) {
         $notification->push($searchResults->getMessage(), 'horde.error');
-        header('Location:' . Horde::applicationUrl('search.php'));
-        exit;
+        Horde::applicationUrl('search.php')->redirect();
     }
 
     if ($searchResults['total'] > count($searchResults['results'])) {
index e300818..0606cad 100644 (file)
@@ -17,16 +17,14 @@ Horde_Registry::appInit('agora', array('authentication' => 'none', 'cli' => true
 /* Make sure we have a forum id. */
 list($forum_id, , $scope) = Agora::getAgoraId();
 if (empty($forum_id)) {
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Check if this is a valid thread, otherwise show the forum list. */
 $threads = &Agora_Messages::singleton($scope, $forum_id);
 if ($threads instanceof PEAR_Error) {
     $notification->push(sprintf(_("Could not list threads. %s"), $threads->getMessage()), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
+    Horde::applicationUrl('forums.php', true)->redirect();
 }
 
 /* Which thread page are we on?  Default to page 0. */
@@ -45,9 +43,9 @@ $sort_dir = Agora::getSortDir('threads');
 $threads_list = $threads->getThreads(0, false, $sort_by, $sort_dir, false, '', null, $thread_start, $threads_per_page);
 if ($threads_list instanceof PEAR_Error) {
     $notification->push($threads_list->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('forums.php', true));
-    exit;
-} elseif (empty($threads_list)) {
+    Horde::applicationUrl('forums.php', true)->redirect();
+}
+if (empty($threads_list)) {
     $threads_count = 0;
 } else {
     $threads_count = $threads->_forum['thread_count'];
index d2f9a51..e743d90 100644 (file)
@@ -28,8 +28,7 @@ try {
 
 if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
     $notification->push(sprintf(_("Access denied editing gallery \"%s\"."), $gallery->get('name')), 'horde.error');
-    header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'), true));
-    exit;
+    Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
 }
 
 $style = $gallery->getStyle();
index fa824fb..12de055 100644 (file)
@@ -66,10 +66,7 @@ if ($app && Horde_Util::getFormData('submitbutton') == _("Save")) {
        $po->save($pofile);
 
        if (Horde_Util::getFormData('url') == 'view') {
-           $url = Horde::applicationUrl('view.php');
-           $url = Horde_Util::addParameter($url, array('module' => $app));
-           header('Location: ' . $url);
-           exit;
+           Horde::applicationUrl('view.php')->add('module' => $app)->redirect();
        }
     }
 }
index 69d4ebf..2a6468c 100644 (file)
@@ -46,10 +46,8 @@ if (Horde_Util::getFormData('submitbutton') == _("Upload")) {
                $cmd = "cp $po_file_path " . HORDE_BASE . "/$mod/po/$lang.po";
                system($cmd);
                
-               $url = Horde::applicationUrl('upload.php');
                // Redirect to page URL
-               header('Location: ' . $url);
-               exit;
+               Horde::applicationUrl('upload.php')->redirect();
            }
        }
     }
index ad5bc0e..5ba37bb 100644 (file)
@@ -26,15 +26,13 @@ if ($form->validate($vars)) {
             $result = Beatnik::autogenerate($vars);
         } catch (Exception $e) {
             $notification->push($e->getMessage(), 'horde.error');
-            header('Location:' . Horde::applicationUrl('listzones.php'));
-            exit;
+            Horde::applicationUrl('listzones.php')->redirect();
         }
     } else {
         $notification->push(_("Autogeneration not performed"), 'horde.warning');
     }
 
-    header('Location: ' . $viewurl);
-    exit;
+    $viewurl->redirect();
 }
 
 $title = _("Autogenerate");
index 23768b8..a115fad 100644 (file)
@@ -49,5 +49,4 @@ foreach ($domains as $domain) {
     }
 }
 
-header('Location: ' . $url);
-exit;
+$url->redirect();
index 0c426c0..6da1e2b 100644 (file)
@@ -25,20 +25,18 @@ if ($form->validate($vars)) {
             $result = $beatnik->driver->deleteRecord($info);
         } catch (Exception $e) {
             $notification->push($e->getMessage(), 'horde.error');
-            header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('viewzone.php'), $info));
-            exit;
+            Horde::applicationUrl('viewzone.php')->add($info)->redirect();
         }
         $notification->push(_("Record deleted"), 'horde.success');
         if ($info['rectype'] == 'soa') {
-            header('Location: ' . Horde::applicationUrl('listzones.php'));
+            Horde::applicationUrl('listzones.php')->redirect();
         } else {
-            header('Location: ' . Horde::applicationUrl('viewzone.php'));
+            Horde::applicationUrl('viewzone.php')->redirect();
         }
     } else {
         $notification->push(_("Record not deleted"), 'horde.warning');
-        header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('viewzone.php'), $info));
+        Horde::applicationUrl('viewzone.php')->add($info)->redirect();
     }
-    exit;
 } elseif (!$form->isSubmitted() && $record) {
     foreach ($record as $field => $value) {
         $vars->set($field, $value);
index e1afc6d..2b99ee6 100644 (file)
@@ -32,14 +32,12 @@ if ($form->validate($vars)) {
     $edit = $vars->get('id');
     if ($info['rectype'] == 'soa' && !$edit) {
         // if added a soa redirect to the autogeneration page
-        $url = Horde_Util::addParameter(Horde::applicationUrl('autogenerate.php'),
-                                  array('rectype' => 'soa', 'curdomain' => $info['zonename']), false, false);
+        $url = Horde::applicationUrl('autogenerate.php')->add(array('rectype' => 'soa', 'curdomain' => $info['zonename']));
     } else {
         $url = Horde::applicationUrl('viewzone.php');
     }
 
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 
 } elseif (!$form->isSubmitted() && $record) {
     foreach ($record as $field => $value) {
index fa7b395..03515a8 100644 (file)
@@ -165,8 +165,7 @@ class Beatnik_Driver {
             $zonedata = $this->getRecords($_SESSION['beatnik']['curdomain']['zonename']);
         } catch (Exception $e) {
             $notification->push($e, 'horde.error');
-            header('Location:' . Horde::applicationUrl('listzones.php'));
-            exit;
+            Horde::applicationUrl('listzones.php')->redirect);
         }
 
         if (isset($zonedata[$rectype])) {
index 5acf527..b99c4aa 100644 (file)
@@ -13,8 +13,7 @@ try {
     $zonedata = $beatnik->driver->getRecords($_SESSION['beatnik']['curdomain']['zonename']);
 } catch (Exception $e) {
     $notification->push($e, 'horde.error');
-    header('Location:' . Horde::applicationUrl('listzones.php'));
-    exit;
+    Horde::applicationUrl('listzones.php')->redirect();
 }
 
 $title = $_SESSION['beatnik']['curdomain']['zonename'];
index 5be547f..a341b0f 100644 (file)
@@ -17,8 +17,7 @@ Horde_Registry::appInit('chora');
 
 // Exit if cvsgraph isn't active or it's not supported.
 if (empty($conf['paths']['cvsgraph']) || !$VC->hasFeature('branches')) {
-    header('Location: ' . Chora::url('browsefile', $where));
-    exit;
+    Chora::url('browsefile', $where)->redirect();
 }
 
 if (!is_file($fullname . ',v')) {
index 6e2a5ec..e732453 100644 (file)
@@ -17,8 +17,7 @@ Chora::fatal('History display is currently broken', '500 Internal Server Error')
 
 /* Exit if it's not supported. */
 if (!$VC->hasFeature('branches')) {
-    header('Location: ' . Chora::url('browsefile', $where));
-    exit;
+    Chora::url('browsefile', $where)->redirect();
 }
 
 $colset = array('#ccdeff', '#ecf', '#fec', '#efc', '#cfd', '#dcdba0');
index 7bc7196..b240d3d 100644 (file)
@@ -18,8 +18,7 @@ Horde_Registry::appInit('chora');
 
 // Exit if patchset feature is not available.
 if (!$GLOBALS['VC']->hasFeature('patchsets')) {
-    header('Location: ' . Chora::url('browsefile', $where));
-    exit;
+    Chora::url('browsefile', $where)->redirect();
 }
 
 $ps_opts = array();
index 6230694..be7ead9 100644 (file)
@@ -14,8 +14,7 @@ $vars = Horde_Variables::getDefaultVariables();
 /* Redirect to the account list if no action has been requested. */
 $actionID = $vars->get('actionID');
 if (is_null($actionID)) {
-    header('Location: ' . Horde::applicationUrl('accounts.php', true));
-    exit;
+    Horde::applicationUrl('accounts.php', true)->redirect();
 }
 
 /* Get ledger. */
@@ -23,8 +22,7 @@ $ledger = Fima::getActiveLedger();
 $share = &$GLOBALS['fima_shares']->getShare($ledger);
 if (is_a($share, 'PEAR_Error')) {
     $notification->push(sprintf(_("Access denied on account: %s"), $share->getMessage()), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('accounts.php', true));
-    exit;
+    Horde::applicationUrl('accounts.php', true)->redirect();
 }
 $ledger_name = $share->get('name');
 
@@ -83,8 +81,7 @@ case 'modify_account':
     }
 
     /* Return to the accounts. */
-    header('Location: ' . Horde::applicationUrl('accounts.php', true));
-    exit;
+    Horde::applicationUrl('accounts.php', true)->redirect();
 
 case 'save_account':
     if ($vars->get('submitbutton') == _("Delete this account")) {
@@ -102,8 +99,7 @@ case 'save_account':
     $form->getInfo($vars, $info);
     if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
         $notification->push(sprintf(_("Access denied saving account to %s."), $share->get('name')), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('accounts.php', true));
-        exit;
+        Horde::applicationUrl('accounts.php', true)->redirect();
     }
 
     $storage = &Fima_Driver::singleton($ledger);
@@ -159,10 +155,9 @@ case 'save_account':
         /* Return to the accounts. */
         if ($vars->get('submitbutton') == _("Save and New")) {
             header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('account.php', true), array('account' => $vars->get('parent_id'), 'actionID' => 'add_account'), null, false));
-        } else {
-            header('Location: ' . Horde::applicationUrl('accounts.php', true));
+            exit;
         }
-        exit;
+        Horde::applicationUrl('accounts.php', true)->redirect();
     }
 
     break;
@@ -186,8 +181,7 @@ case 'delete_account':
     }
 
     /* Return to the accounts. */
-    header('Location: ' . Horde::applicationUrl('accounts.php', true));
-    exit;
+    Horde::applicationUrl('accounts.php', true)->redirect();
 
 case 'purge_account':
     if ($vars->get('submitbutton') == _("Edit this account")) {
@@ -205,8 +199,7 @@ case 'purge_account':
     $form->getInfo($vars, $info);
     if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
         $notification->push(sprintf(_("Access denied deleting account from %s."), $share->get('name')), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('accounts.php', true));
-        exit;
+        Horde::applicationUrl('accounts.php', true)->redirect();
     }
 
     $storage = &Fima_Driver::singleton($ledger);
@@ -220,15 +213,13 @@ case 'purge_account':
     } else {
         $notification->push(sprintf(_("Deleted %s."), trim($info['number_new'] . ' ' . $info['name'])), 'horde.success');
         /* Return to the accounts. */
-        header('Location: ' . Horde::applicationUrl('accounts.php', true));
-        exit;
+        Horde::applicationUrl('accounts.php', true)->redirect();
     }
 
     break;
 
 default:
-    header('Location: ' . Horde::applicationUrl('accounts.php', true));
-    exit;
+    Horde::applicationUrl('accounts.php', true)->redirect();
 }
 
 $title = $form->getTitle();
index 2587c81..80d4514 100644 (file)
@@ -13,8 +13,7 @@ require_once FIMA_BASE . '/lib/Forms/CreateLedger.php';
 // Exit if this isn't an authenticated user or if the user can't
 // create new task lists (default share is locked).
 if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('active_ledger')) {
-    header('Location: ' . Horde::applicationUrl('postings.php', true));
-    exit;
+    Horde::applicationUrl('postings.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -29,8 +28,7 @@ if ($form->validate($vars)) {
         $notification->push(sprintf(_("The ledger \"%s\" has been created."), $vars->get('name')), 'horde.success');
     }
 
-    header('Location: ' . Horde::applicationUrl('ledgers/', true));
-    exit;
+    Horde::applicationUrl('ledgers/', true)->redirect();
 }
 
 $title = $form->getTitle();
index 94398c1..3634b2d 100644 (file)
@@ -12,27 +12,24 @@ require_once FIMA_BASE . '/lib/Forms/DeleteLedger.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('postings.php', true));
-    exit;
+    Horde::applicationUrl('postings.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
 $ledger_id = $vars->get('l');
 if ($ledger_id == $GLOBALS['registry']->getAuth()) {
     $notification->push(_("This ledger cannot be deleted."), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('ledgers/', true));
-    exit;
+    Horde::applicationUrl('ledgers/', true)->redirect();
 }
 
 $ledger = $fima_shares->getShare($ledger_id);
 if (is_a($ledger, 'PEAR_Error')) {
     $notification->push($ledger, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('ledgers/', true));
-    exit;
-} elseif ($ledger->get('owner') != $GLOBALS['registry']->getAuth()) {
+    Horde::applicationUrl('ledgers/', true)->redirect();
+}
+if ($ledger->get('owner') != $GLOBALS['registry']->getAuth()) {
     $notification->push(_("You are not allowed to delete this ledger."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('ledgers/', true));
-    exit;
+    Horde::applicationUrl('ledgers/', true)->redirect();
 }
 
 $form = new Fima_DeleteLedgerForm($vars, $ledger);
@@ -46,8 +43,7 @@ if ($form->validate(new Horde_Variables($_POST))) {
         $notification->push(sprintf(_("The ledger \"%s\" has been deleted."), $ledger->get('name')), 'horde.success');
     }
 
-    header('Location: ' . Horde::applicationUrl('ledgers/', true));
-    exit;
+    Horde::applicationUrl('ledgers/', true)->redirect();
 }
 
 $title = $form->getTitle();
index c606e04..782b4e8 100644 (file)
@@ -12,20 +12,18 @@ require_once FIMA_BASE . '/lib/Forms/EditLedger.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('postings.php', true));
-    exit;
+    Horde::applicationUrl('postings.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
 $ledger = $fima_shares->getShare($vars->get('l'));
 if (is_a($ledger, 'PEAR_Error')) {
     $notification->push($ledger, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('ledgers/', true));
-    exit;
-} elseif ($ledger->get('owner') != $GLOBALS['registry']->getAuth()) {
+    Horde::applicationUrl('ledgers/', true)->redirect();
+}
+if ($ledger->get('owner') != $GLOBALS['registry']->getAuth()) {
     $notification->push(_("You are not allowed to change this ledger."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('ledgers/', true));
-    exit;
+    Horde::applicationUrl('ledgers/', true)->redirect();
 }
 $form = new Fima_EditLedgerForm($vars, $ledger);
 
@@ -43,8 +41,7 @@ if ($form->validate($vars)) {
         }
     }
 
-    header('Location: ' . Horde::applicationUrl('ledgers/', true));
-    exit;
+    Horde::applicationUrl('ledgers/', true)->redirect();
 }
 
 $vars->set('name', $ledger->get('name'));
index 00d6c73..5e138ff 100644 (file)
@@ -169,9 +169,9 @@ case 'save_postings':
     $share = &$GLOBALS['fima_shares']->getShare($ledger);
     if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
         $notification->push(sprintf(_("Access denied saving postings to %s."), $share->get('name')), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('postings.php', true));
-        exit;
-    } elseif ($postingset !== null) {
+        Horde::applicationUrl('postings.php', true)->redirect();
+    }
+    if ($postingset !== null) {
         $pageOb['mode'] = 'edit';
         $title = _("Edit Postings");
         $posting_owner = $ledger;
@@ -267,13 +267,11 @@ case 'save_postings':
             $notification->push(sprintf(_("%d postings not saved."), count($postings)), 'horde.error');
         } else {
             /* Return to the posting list. */
-            header('Location: ' . Horde::applicationUrl('postings.php', true));
-            exit;
+            Horde::applicationUrl('postings.php', true)->redirect();
         }
     } else {
         /* Return to the posting list. */
-        header('Location: ' . Horde::applicationUrl('postings.php', true));
-        exit;
+        Horde::applicationUrl('postings.php', true)->redirect();
     }
     break;
 
@@ -284,9 +282,9 @@ case 'delete_postings':
     $share = &$GLOBALS['fima_shares']->getShare($ledger);
     if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
         $notification->push(sprintf(_("Access denied deleting postings from %s."), $share->get('name')), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('postings.php', true));
-        exit;
-    } elseif ($postingset !== null) {
+        Horde::applicationUrl('postings.php', true)->redirect();
+    }
+    if ($postingset !== null) {
         $storage = &Fima_Driver::singleton($ledger);
         $delcount = 0;
         foreach($postingset as $index => $posting_id) {
@@ -304,9 +302,7 @@ case 'delete_postings':
     }
 
     /* Return to the posting list. */
-    header('Location: ' . Horde::applicationUrl('postings.php', true));
-    exit;
-    break;
+    Horde::applicationUrl('postings.php', true)->redirect();
 
 case 'update_postings':
     /* Get the form values. */
@@ -315,9 +311,9 @@ case 'update_postings':
     $share = &$GLOBALS['fima_shares']->getShare($ledger);
     if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
         $notification->push(sprintf(_("Access denied shifting postings in %s."), $share->get('name')), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('postings.php', true));
-        exit;
-    } elseif ($postingset !== null) {
+        Horde::applicationUrl('postings.php', true)->redirect();
+    }
+    if ($postingset !== null) {
         $posting_type = Horde_Util::getFormData('type');
         $posting_asset = Horde_Util::getFormData('asset');
         $posting_account = Horde_Util::getFormData('account');
@@ -342,161 +338,155 @@ case 'update_postings':
     }
 
     /* Return to the posting list. */
-    header('Location: ' . Horde::applicationUrl('postings.php', true));
-    exit;
-    break;
+    Horde::applicationUrl('postings.php', true)->redirect();
 
 case 'copymove_postings':
     $share = &$GLOBALS['fima_shares']->getShare($ledger);
     if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
         $notification->push(sprintf(_("Access denied transfering postings in %s."), $share->get('name')), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('postings.php', true));
-        exit;
-    } elseif (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE) && (!Horde_Util::getFormData('keep') || Horde_Util::getFormData('delete'))) {
+        Horde::applicationUrl('postings.php', true)->redirect();
+    }
+    if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE) && (!Horde_Util::getFormData('keep') || Horde_Util::getFormData('delete'))) {
         $notification->push(sprintf(_("Access denied transfering postings in %s."), $share->get('name')), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('postings.php', true));
-        exit;
-    } else {
-        $type_from = Horde_Util::getFormData('type_from');
-        $period_from = Horde_Util::getFormData('period_from');
-        $keep = Horde_Util::getFormData('keep');
-        $summarize = Horde_Util::getFormData('summarize');
-        $summarize_account = Horde_Util::getFormData('summarize_post_account');
-        $type_to = Horde_Util::getFormData('type_to');
-        $period_to = Horde_Util::getFormData('period_to');
-        $delete = Horde_Util::getFormData('delete');
-
-        $period_from_start = mktime(0, 0, 0, ($period_from['month'] === '') ? 1 : $period_from['month'], 1, (int)$period_from['year']);
-        $period_from_end = mktime(0, 0, 0, ($period_from['month'] === '') ? 12 : $period_from['month'] + 1, ($period_from['month'] === '') ? 31 : 0, (int)$period_from['year']);
-        $period_to_start = mktime(0, 0, 0, ($period_to['month'] === '') ? 1 : $period_to['month'], 1, (int)$period_to['year']);
-        $period_to_end = mktime(0, 0, 0, ($period_to['month'] === '') ? 12 : $period_to['month'] + 1, ($period_to['month'] === '') ? 31 : 0, (int)$period_to['year']);
-
-        $storage = &Fima_Driver::singleton($ledger);
-
-        /* Delete existing. */
-        if ($delete) {
-            $transferfilters = array(array('type', $type_to),
-                               array('date', $period_to_start, '>='),
-                               array('date', $period_to_end, '<='));
-            $postings = Fima::listPostings($transferfilters);
-            $delcount = 0;
-            foreach ($postings as $postingId => $posting) {
-                $result = $storage->deletePosting($postingId);
-                if (is_a($result, 'PEAR_Error')) {
-                    $notification->push(sprintf(_("There was a problem deleting an existing posting: %s"),
-                                                $result->getMessage()), 'horde.error');
-                } else {
-                    $delcount++;
-                }
-            }
-            if ($delcount > 0) {
-                $notification->push(sprintf(_("Deleted %d existing postings."), $delcount), 'horde.success');
+        Horde::applicationUrl('postings.php', true)->redirect();
+    }
+    $type_from = Horde_Util::getFormData('type_from');
+    $period_from = Horde_Util::getFormData('period_from');
+    $keep = Horde_Util::getFormData('keep');
+    $summarize = Horde_Util::getFormData('summarize');
+    $summarize_account = Horde_Util::getFormData('summarize_post_account');
+    $type_to = Horde_Util::getFormData('type_to');
+    $period_to = Horde_Util::getFormData('period_to');
+    $delete = Horde_Util::getFormData('delete');
+
+    $period_from_start = mktime(0, 0, 0, ($period_from['month'] === '') ? 1 : $period_from['month'], 1, (int)$period_from['year']);
+    $period_from_end = mktime(0, 0, 0, ($period_from['month'] === '') ? 12 : $period_from['month'] + 1, ($period_from['month'] === '') ? 31 : 0, (int)$period_from['year']);
+    $period_to_start = mktime(0, 0, 0, ($period_to['month'] === '') ? 1 : $period_to['month'], 1, (int)$period_to['year']);
+    $period_to_end = mktime(0, 0, 0, ($period_to['month'] === '') ? 12 : $period_to['month'] + 1, ($period_to['month'] === '') ? 31 : 0, (int)$period_to['year']);
+
+    $storage = &Fima_Driver::singleton($ledger);
+
+    /* Delete existing. */
+    if ($delete) {
+        $transferfilters = array(array('type', $type_to),
+                                 array('date', $period_to_start, '>='),
+                                 array('date', $period_to_end, '<='));
+        $postings = Fima::listPostings($transferfilters);
+        $delcount = 0;
+        foreach ($postings as $postingId => $posting) {
+            $result = $storage->deletePosting($postingId);
+            if (is_a($result, 'PEAR_Error')) {
+                $notification->push(sprintf(_("There was a problem deleting an existing posting: %s"),
+                                            $result->getMessage()), 'horde.error');
+            } else {
+                $delcount++;
             }
         }
+        if ($delcount > 0) {
+            $notification->push(sprintf(_("Deleted %d existing postings."), $delcount), 'horde.success');
+        }
+    }
 
-        /* Copy postings. */
-        $transferfilters = array(array('type', $type_from),
-                                 array('date', $period_from_start, '>='),
-                                 array('date', $period_from_end, '<='));
-        $postings = Fima::listPostings($transferfilters);
-
-        if ($summarize != 'none') {
-            $accounts = Fima::listAccounts();
-            $postingscopy = array();
-
-            foreach ($postings as $postingId => $posting) {
-                $asset = (isset($accounts[$posting['asset']]))
-                         ? (($accounts[$posting['asset']]['parent_id'] !== null) ? $accounts[$posting['asset']]['parent_id'] : $accounts[$posting['asset']]['account_id'])
-                         : $posting['asset'];
-                $account = (isset($accounts[$posting['account']]))
-                           ? (($accounts[$posting['account']]['parent_id'] !== null) ? $accounts[$posting['account']]['parent_id'] : $accounts[$posting['account']]['account_id'])
-                           : $posting['account'];
+    /* Copy postings. */
+    $transferfilters = array(array('type', $type_from),
+                             array('date', $period_from_start, '>='),
+                             array('date', $period_from_end, '<='));
+    $postings = Fima::listPostings($transferfilters);
 
-                if ($summarize == 'combine') {
-                    $copyId = $asset . '_' . $account . '_' . strftime('%Y%m', $posting['date']);
+    if ($summarize != 'none') {
+        $accounts = Fima::listAccounts();
+        $postingscopy = array();
 
-                    if (isset($postingscopy[$copyId])) {
-                        $postingscopy[$copyId]['amount'] += $posting['amount'];
-                    } else {
-                        $postingscopy[$copyId] = $posting;
-                        $postingscopy[$copyId]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
-                        $postingscopy[$copyId]['asset'] = $asset;
-                        $postingscopy[$copyId]['account'] = $account;
-                        $postingscopy[$copyId]['eo'] = 0;
-                        $postingscopy[$copyId]['desc'] = _("Summarized");
-                    }
-                } elseif ($summarize == 'post') {
-                    $copyIdAsset = $asset . '_' . strftime('%Y%m', $posting['date']);
-                    $copyIdAccount = $account . '_' . strftime('%Y%m', $posting['date']);
+        foreach ($postings as $postingId => $posting) {
+            $asset = (isset($accounts[$posting['asset']]))
+                ? (($accounts[$posting['asset']]['parent_id'] !== null) ? $accounts[$posting['asset']]['parent_id'] : $accounts[$posting['asset']]['account_id'])
+                : $posting['asset'];
+            $account = (isset($accounts[$posting['account']]))
+                ? (($accounts[$posting['account']]['parent_id'] !== null) ? $accounts[$posting['account']]['parent_id'] : $accounts[$posting['account']]['account_id'])
+                : $posting['account'];
+
+            if ($summarize == 'combine') {
+                $copyId = $asset . '_' . $account . '_' . strftime('%Y%m', $posting['date']);
+
+                if (isset($postingscopy[$copyId])) {
+                    $postingscopy[$copyId]['amount'] += $posting['amount'];
+                } else {
+                    $postingscopy[$copyId] = $posting;
+                    $postingscopy[$copyId]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
+                    $postingscopy[$copyId]['asset'] = $asset;
+                    $postingscopy[$copyId]['account'] = $account;
+                    $postingscopy[$copyId]['eo'] = 0;
+                    $postingscopy[$copyId]['desc'] = _("Summarized");
+                }
+            } elseif ($summarize == 'post') {
+                $copyIdAsset = $asset . '_' . strftime('%Y%m', $posting['date']);
+                $copyIdAccount = $account . '_' . strftime('%Y%m', $posting['date']);
 
-                    if (isset($postingscopy[$copyIdAsset])) {
-                        $postingscopy[$copyIdAsset]['amount'] += $posting['amount'];
-                    } else {
-                        $postingscopy[$copyIdAsset] = $posting;
-                        $postingscopy[$copyIdAsset]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
-                        $postingscopy[$copyIdAsset]['asset'] = $asset;
-                        $postingscopy[$copyIdAsset]['account'] = $summarize_account;
-                        $postingscopy[$copyIdAsset]['eo'] = 0;
-                        $postingscopy[$copyIdAsset]['desc'] = _("Summarized");
-                    }
+                if (isset($postingscopy[$copyIdAsset])) {
+                    $postingscopy[$copyIdAsset]['amount'] += $posting['amount'];
+                } else {
+                    $postingscopy[$copyIdAsset] = $posting;
+                    $postingscopy[$copyIdAsset]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
+                    $postingscopy[$copyIdAsset]['asset'] = $asset;
+                    $postingscopy[$copyIdAsset]['account'] = $summarize_account;
+                    $postingscopy[$copyIdAsset]['eo'] = 0;
+                    $postingscopy[$copyIdAsset]['desc'] = _("Summarized");
+                }
 
-                    if (isset($postingscopy[$copyIdAccount])) {
-                        $postingscopy[$copyIdAccount]['amount'] += $posting['amount'];
-                    } else {
-                        $postingscopy[$copyIdAccount] = $posting;
-                        $postingscopy[$copyIdAccount]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
-                        $postingscopy[$copyIdAccount]['asset'] = $summarize_account;
-                        $postingscopy[$copyIdAccount]['account'] = $account;
-                        $postingscopy[$copyIdAccount]['eo'] = 0;
-                        $postingscopy[$copyIdAccount]['desc'] = _("Summarized");
-                    }
+                if (isset($postingscopy[$copyIdAccount])) {
+                    $postingscopy[$copyIdAccount]['amount'] += $posting['amount'];
+                } else {
+                    $postingscopy[$copyIdAccount] = $posting;
+                    $postingscopy[$copyIdAccount]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
+                    $postingscopy[$copyIdAccount]['asset'] = $summarize_account;
+                    $postingscopy[$copyIdAccount]['account'] = $account;
+                    $postingscopy[$copyIdAccount]['eo'] = 0;
+                    $postingscopy[$copyIdAccount]['desc'] = _("Summarized");
                 }
             }
-        } else {
-            $postingscopy = &$postings;
-            foreach ($postingscopy as $postingId => $posting) {
-                $postingscopy[$postingId]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], strftime('%d', $posting['date']), (int)$period_to['year']);
-            }
         }
-
-        $addcount = 0;
+    } else {
+        $postingscopy = &$postings;
         foreach ($postingscopy as $postingId => $posting) {
-            $result = $storage->addPosting($type_to, $posting['date'], $posting['asset'], $posting['account'],
-                                           $posting['eo'], $posting['amount'], $posting['desc']);
+            $postingscopy[$postingId]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], strftime('%d', $posting['date']), (int)$period_to['year']);
+        }
+    }
 
-            // Check our results.
+    $addcount = 0;
+    foreach ($postingscopy as $postingId => $posting) {
+        $result = $storage->addPosting($type_to, $posting['date'], $posting['asset'], $posting['account'],
+                                       $posting['eo'], $posting['amount'], $posting['desc']);
+
+        // Check our results.
+        if (is_a($result, 'PEAR_Error')) {
+            $notification->push(sprintf(_("There was a problem saving the posting: %s."), $result->getMessage()), 'horde.error');
+        } else {
+            $addcount++;
+        }
+    }
+    if ($addcount > 0) {
+        $notification->push(sprintf($summarize ? _("Summarized %d postings.") : _("Transfered %d postings."), $addcount), 'horde.success');
+    }
+
+    /* Delete original postings. */
+    if (!$keep) {
+        $delcount = 0;
+        foreach ($postings as $postingId => $posting) {
+            $result = $storage->deletePosting($postingId);
             if (is_a($result, 'PEAR_Error')) {
-                $notification->push(sprintf(_("There was a problem saving the posting: %s."), $result->getMessage()), 'horde.error');
+                $notification->push(sprintf(_("There was a problem deleting an original posting: %s"),
+                                            $result->getMessage()), 'horde.error');
             } else {
-                $addcount++;
+                $delcount++;
             }
         }
-        if ($addcount > 0) {
-            $notification->push(sprintf($summarize ? _("Summarized %d postings.") : _("Transfered %d postings."), $addcount), 'horde.success');
-        }
-
-        /* Delete original postings. */
-        if (!$keep) {
-            $delcount = 0;
-            foreach ($postings as $postingId => $posting) {
-                $result = $storage->deletePosting($postingId);
-                if (is_a($result, 'PEAR_Error')) {
-                    $notification->push(sprintf(_("There was a problem deleting an original posting: %s"),
-                                                $result->getMessage()), 'horde.error');
-                } else {
-                    $delcount++;
-                }
-            }
-            if ($delcount > 0) {
-                $notification->push(sprintf(_("Deleted %d original postings."), $delcount), 'horde.success');
-            }
+        if ($delcount > 0) {
+            $notification->push(sprintf(_("Deleted %d original postings."), $delcount), 'horde.success');
         }
     }
 
     /* Return to the posting list. */
-    header('Location: ' . Horde::applicationUrl('postings.php', true));
-    exit;
-    break;
+    Horde::applicationUrl('postings.php', true)->redirect();
 
 default:
     break;
index 6849e66..323abad 100644 (file)
@@ -30,8 +30,7 @@ function _getCAPTCHA($new = false)
 
 // We are already logged
 if ($registry->isAuthenticated()) {
-    header('Location: ' . Folks::getUrlFor('user', $GLOBALS['registry']->getAuth()));
-    exit;
+    Folks::getUrlFor('user', $GLOBALS['registry']->getAuth())->redirect();
 }
 
 // Make sure auth backend allows passwords to be reset.
index d49051e..9f2346b 100644 (file)
@@ -219,8 +219,9 @@ class Folks_Hooks
                 require $GLOBALS['registry']->get('fileroot', 'gollem') .  '/redirect.php';
                 exit;
             } else {
-                header('Location: ' .  $GLOBALS['registry']->link('wiki/show',  array('page' => 'PaidFiles')));
-                exit;
+                $GLOBALS['registry']
+                    ->link('wiki/show', array('page' => 'PaidFiles'))
+                    ->redirect();
             }
             break;
 
index 7a1b939..31101df 100644 (file)
@@ -26,8 +26,7 @@ if ($activity_scope && $activity_date) {
         $notification->push($result);
     } else {
         $notification->push(_("Activity successfully deleted"), 'horde.success');
-        header('Location: ' . Horde::applicationUrl('edit/activity.php'));
-        exit;
+        Horde::applicationUrl('edit/activity.php')->redirect();
     }
 }
 
@@ -38,16 +37,14 @@ if ($form->validate()) {
         $notification->push($result);
     } else {
         $notification->push(_("Activity successfully posted"), 'horde.success');
-        header('Location: ' . Horde::applicationUrl('edit/activity.php'));
-        exit;
+        Horde::applicationUrl('edit/activity.php')->redirect();
     }
 }
 
 $activities = $folks_driver->getActivity($GLOBALS['registry']->getAuth());
 if ($activities instanceof PEAR_Error) {
     $notification->push($activities);
-    header('Location: ' . Folks::getUrlFor('list', 'list'));
-    exit;
+    Folks::getUrlFor('list', 'list')->redirect();
 }
 
 $delete_url = Horde::applicationUrl('edit/activity.php');
index 196c3aa..7caac64 100644 (file)
@@ -19,8 +19,7 @@ $title = _("Comments");
 $profile = $folks_driver->getProfile();
 if ($profile instanceof PEAR_Error) {
     $notification->push($profile);
-    header('Location: ' . Folks::getUrlFor('list', 'list'));
-    exit;
+    Folks::getUrlFor('list', 'list')->redirect();
 }
 
 $comments = array(
index 6b3a4bb..3fc31e8 100644 (file)
@@ -20,8 +20,7 @@ $title = _("Edit my profile");
 $profile = $folks_driver->getRawProfile($GLOBALS['registry']->getAuth());
 if ($profile instanceof PEAR_Error) {
     $notification->push($profile);
-    header('Location: ' . Folks::getUrlFor('list', 'list'));
-    exit;
+    Folks::getUrlFor('list', 'list')->redirect();
 }
 
 $form = new Horde_Form($vars, $title, 'editprofile');
@@ -69,8 +68,7 @@ if ($form->validate()) {
             } else {
                 $folks_driver->logActivity(_("Updated his/her profile picture."));
             }
-            header('Location: ' . Horde::applicationUrl('edit/edit.php'));
-            exit;
+            Horde::applicationUrl('edit/edit.php')->redirect();
         }
     break;
 
index 9220ce5..53efe7f 100644 (file)
@@ -20,8 +20,7 @@ $title = _("Facebook");
 // Check FB installation
 if (!$conf['facebook']['enabled']) {
     $notification->push(sprintf(_("Could not find authorization for %s to interact with your Facebook account."), $GLOBALS['registry']->get('name', 'horde')));
-    header('Location: ' . Horde::applicationUrl('user.php'));
-    exit;
+    Horde::applicationUrl('user.php')->redirect();
 }
 
 // Load horde central block
@@ -29,15 +28,11 @@ try {
     $block = $registry->call('horde/blockContent', array('horde', 'fb_summary'));
 } catch (Horde_Exception $e) {
     $notification->push($e);
-    header('Location: ' . Horde::applicationUrl('user.php'));
-    exit;
+    Horde::applicationUrl('user.php')->redirect();
 }
 
 require FOLKS_TEMPLATES . '/common-header.inc';
 require FOLKS_TEMPLATES . '/menu.inc';
-
 echo $tabs->render('facebook');
-
 echo $block;
-
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index 892af7d..93ff9cd 100644 (file)
@@ -30,8 +30,7 @@ if ($user) {
             $notification->push($result);
         } else {
             $notification->push(sprintf(_("User \"%s\" was removed from your friend list."), $user), 'horde.success');
-            header('Location: ' . Horde::applicationUrl('edit/friends/index.php'));
-            exit;
+            Horde::applicationUrl('edit/friends/index.php')->redirect();
         }
     } else {
         $result = $friends->addFriend($user);
@@ -53,12 +52,10 @@ if ($user) {
             } else {
                 $notification->push(sprintf(_("A confirmation was send to \"%s\"."), $user), 'horde.warning');
             }
-            header('Location: ' . Horde::applicationUrl('edit/friends/index.php'));
-            exit;
+            Horde::applicationUrl('edit/friends/index.php')->redirect();
         } else {
             $notification->push(sprintf(_("User \"%s\" was added as your friend."), $user), 'horde.success');
-            header('Location: ' . Horde::applicationUrl('edit/friends/index.php'));
-            exit;
+            Horde::applicationUrl('edit/friends/index.php')->redirect();
         }
     }
 }
@@ -66,13 +63,10 @@ if ($user) {
 $friend_form = new Folks_AddFriend_Form($vars, _("Add or remove user"), 'blacklist');
 
 Horde::addScriptFile('tables.js', 'horde');
-
 require FOLKS_TEMPLATES . '/common-header.inc';
 require FOLKS_TEMPLATES . '/menu.inc';
-
 echo $tabs->render('add');
 require FOLKS_TEMPLATES . '/edit/header.php';
 require FOLKS_TEMPLATES . '/edit/add.php';
 require FOLKS_TEMPLATES . '/edit/footer.php';
-
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index 5f27092..ad67b82 100644 (file)
@@ -21,8 +21,7 @@ if (!$registry->isAuthenticated()) {
 $user = Horde_Util::getGet('user');
 if (empty($user)) {
     $notification->push(_("You must supply a username."));
-    header('Location: ' . Horde::applicationUrl('edit/friends/index.php'));
-    exit;
+    Horde::applicationUrl('edit/friends/index.php')->redirect();
 }
 
 $friends = Folks_Friends::singleton();
@@ -30,8 +29,7 @@ $result = $friends->approveFriend($user);
 if ($result instanceof PEAR_Error) {
     $notification->push($result);
     $notification->push($result->getDebugInfo());
-    header('Location: ' . Horde::applicationUrl('edit/friends/index.php'));
-    exit;
+    Horde::applicationUrl('edit/friends/index.php')->redirect();
 }
 
 $notification->push(sprintf(_("User \"%s\" was confirmed as a friend."), $user), 'horde.success');
@@ -50,5 +48,4 @@ $friends->sendNotification($user, $title, $body);
 $link = '<a href="' . Folks::getUrlFor('user', $user) . '">' . $user . '</a>';
 $folks_driver->logActivity(sprintf(_("Added user %s as a friend."), $link));
 
-header('Location: ' . Horde::applicationUrl('edit/friends/index.php'));
-exit;
+Horde::applicationUrl('edit/friends/index.php')->redirect();
index 1b17397..eb4913f 100644 (file)
@@ -30,8 +30,7 @@ if ($user) {
             $notification->push($result);
         } else {
             $notification->push(sprintf(_("User \"%s\" was removed from your blacklist."), $user), 'horde.success');
-            header('Location: ' . Horde::applicationUrl('edit/friends/blacklist.php'));
-            exit;
+            Horde::applicationUrl('edit/friends/blacklist.php')->redirect();
         }
     } else {
         $result = $friends->addBlacklisted($user);
@@ -39,8 +38,7 @@ if ($user) {
             $notification->push($result);
         } else {
             $notification->push(sprintf(_("User \"%s\" was added to your blacklist."), $user), 'horde.success');
-            header('Location: ' . Horde::applicationUrl('edit/friends/blacklist.php'));
-            exit;
+            Horde::applicationUrl('edit/friends/blacklist.php')->redirect();
         }
     }
 }
index 53daea9..c49ec4f 100644 (file)
@@ -41,8 +41,7 @@ case 'delete':
         $notification->push(sprintf(_("Group \"%s\" has been deleted."), $groups[$g]), 'horde.success');
     }
 
-    header('Location: ' . Horde::applicationUrl('edit/groups.php'));
-    exit;
+    Horde::applicationUrl('edit/groups.php')->redirect();
 
 break;
 
@@ -60,8 +59,7 @@ case 'edit':
 
     if (Horde_Util::getFormData('submitbutton') == _("Cancel")) {
         $notification->push(sprintf(_("Group \"%s\" has not been renamed."), $groups[$g]), 'horde.warning');
-        header('Location: ' . Horde::applicationUrl('edit/groups.php'));
-        exit;
+        Horde::applicationUrl('edit/groups.php')->redirect();
     } elseif (Horde_Util::getFormData('submitbutton') == _("Rename")) {
         $new_name = Horde_Util::getFormData('new_name');
         $result = $friends->renameGroup($g, $new_name);
@@ -69,8 +67,7 @@ case 'edit':
             $notification->push($result);
         } else {
             $notification->push(sprintf(_("Group \"%s\" has been renamed to \"%s\"."), $groups[$g], $new_name), 'horde.success');
-            header('Location: ' . Horde::applicationUrl('edit/groups.php'));
-            exit;
+            Horde::applicationUrl('edit/groups.php')->redirect();
         }
     }
 
@@ -101,8 +98,7 @@ default:
                 $name = $translated[$info['translated_name']];
             }
             $notification->push(sprintf(_("Group \"%s\" was success added."), $name), 'horde.success');
-            header('Location: ' . Horde::applicationUrl('edit/groups.php'));
-            exit;
+            Horde::applicationUrl('edit/groups.php')->redirect();
         }
     }
 
index 4eeed93..022f6df 100644 (file)
@@ -21,16 +21,14 @@ if (!$registry->isAuthenticated()) {
 $user = Horde_Util::getGet('user');
 if (empty($user)) {
     $notification->push(_("You must supply a username."));
-    header('Location: ' . Horde::applicationUrl('edit/friends/index.php'));
-    exit;
+    Horde::applicationUrl('edit/friends/index.php')->redirect();
 }
 
 $friends = Folks_Friends::singleton(null, array('user' => $user));
 $result = $friends->removeFriend($GLOBALS['registry']->getAuth());
 if ($result instanceof PEAR_Error) {
     $notification->push($result);
-    header('Location: ' . Horde::applicationUrl('edit/friends/index.php'));
-    exit;
+    Horde::applicationUrl('edit/friends/index.php')->redirect();
 }
 
 $notification->push(sprintf(_("User \"%s\" was rejected as a friend."), $user), 'horde.success');
@@ -46,5 +44,4 @@ $body = sprintf(_("User %s rejected you as a friend on %s.. \nTo see to his prof
 
 $friends->sendNotification($user, $title, $body);
 
-header('Location: ' . Horde::applicationUrl('edit/friends/index.php'));
-exit;
+Horde::applicationUrl('edit/friends/index.php')->redirect();
index f3ab162..05a919d 100644 (file)
@@ -20,8 +20,7 @@ $title = _("Privacy");
 $profile = $folks_driver->getRawProfile($GLOBALS['registry']->getAuth());
 if ($profile instanceof PEAR_Error) {
     $notification->push($profile);
-    header('Location: ' . Folks::getUrlFor('list', 'list'));
-    exit;
+    Folks::getUrlFor('list', 'list')->redirect();
 }
 
 $statuses = array('public' => _("Public"),
@@ -63,16 +62,13 @@ if ($form->validate()) {
         $notification->push($result);
     } else {
         $notification->push(_("Your data were successfully updated."), 'horde.success');
-        header('Location: ' . Horde::applicationUrl('edit/privacy.php'));
-        exit;
+        Horde::applicationUrl('edit/privacy.php')->redirect();
     }
 
 }
 
 require FOLKS_TEMPLATES . '/common-header.inc';
 require FOLKS_TEMPLATES . '/menu.inc';
-
 echo $tabs->render('privacy');
 $form->renderActive(null, null, null, 'post');
-
 require $registry->get('templates', 'horde') . '/common-footer.inc';
\ No newline at end of file
index b4db402..c61d63e 100644 (file)
@@ -28,8 +28,7 @@ if ($form->validate()) {
         $notification->push($result);
     } else {
         $notification->push(_("Activity successfully posted"), 'horde.success');
-        header('Location: ' . Horde::applicationUrl('friends.php'));
-        exit;
+        Horde::applicationUrl('friends.php')->redirect();
     }
 }
 
@@ -62,15 +61,11 @@ $firendActivities = array_slice($firendActivities, 0, 30);
 $activities = $folks_driver->getActivity($GLOBALS['registry']->getAuth());
 if ($activities instanceof PEAR_Error) {
     $notification->push($activities);
-    header('Location: ' . Folks::getUrlFor('list', 'list'));
-    exit;
+    Folks::getUrlFor('list', 'list')->redirect();
 }
 
 Horde::addScriptFile('stripe.js', 'horde');
-
 require FOLKS_TEMPLATES . '/common-header.inc';
 require FOLKS_TEMPLATES . '/menu.inc';
-
 require FOLKS_TEMPLATES . '/friends/friends.php';
-
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index 02a8d79..20b059c 100644 (file)
@@ -16,8 +16,7 @@ require_once dirname(__FILE__) . '/lib/base.php';
 $user = Horde_Util::getFormData('user');
 if (empty($user)) {
     $notification->push(_("User is not selected"), 'horde.warning');
-    header('Location: ' . Folks::getUrlFor('list', 'list'));
-    exit;
+    Folks::getUrlFor('list', 'list')->redirect();
 }
 
 $title = _("Do you really want to report this user?");
@@ -60,8 +59,7 @@ if ($form->validate()) {
     } else {
         $notification->push(_("User was not reported."), 'horde.warning');
     }
-    header('Location: ' . Folks::getUrlFor('user', $user));
-    exit;
+    Folks::getUrlFor('user', $user)->redirect();
 }
 
 require FOLKS_TEMPLATES . '/common-header.inc';
index e307fea..25c5d7b 100644 (file)
@@ -25,8 +25,7 @@ if (Horde_Util::getFormData('submitbutton') == _("Close")) {
         $notification->push($result);
     } else {
         $notification->push(_("Search criteria saved successfuly"), 'horde.success');
-        header('Location: ' . Horde::applicationUrl('search.php'));
-        exit;
+        Horde::applicationUrl('search.php')->redirect();
     }
 
 } elseif ((Horde_Util::getGet('delete') == 1) && Horde_Util::getGet('query')) {
@@ -36,8 +35,7 @@ if (Horde_Util::getFormData('submitbutton') == _("Close")) {
         $notification->push($result);
     } else {
         $notification->push(_("Search criteria deleted."), 'horde.success');
-        header('Location: ' . Horde::applicationUrl('search.php'));
-        exit;
+        Horde::applicationUrl('search.php')->redirect();
     }
 }
 
index 7679392..7dcaaae 100644 (file)
@@ -18,8 +18,7 @@ $user = Horde_Util::getFormData('user', $GLOBALS['registry']->getAuth());
 $profile = $folks_driver->getProfile($user);
 if ($profile instanceof PEAR_Error) {
     $notification->push($profile);
-    header('Location: ' . Folks::getUrlFor('list', 'list'));
-    exit;
+    Folks::getUrlFor('list', 'list')->redirect();
 }
 
 // Load its friend list
@@ -55,8 +54,7 @@ if ($user == $GLOBALS['registry']->getAuth()) {
             $notification->push($result);
         } else {
             $notification->push(_("Activity successfully posted"), 'horde.success');
-            header('Location: ' . Horde::applicationUrl('user.php'));
-            exit;
+            Horde::applicationUrl('user.php')->redirect();
         }
     }
 }
index 743aae3..36de35e 100644 (file)
@@ -295,7 +295,7 @@ class Horde_Block_Layout_Manager extends Horde_Block_Layout
 
         if (!empty($url)) {
             $url = new Horde_Url($url);
-            header('Location: ' . strval($url->unique()->setRaw(true)));
+            $url->unique()->redirect();
         }
     }
 
index 2580f3b..d6eff85 100644 (file)
@@ -79,4 +79,4 @@ $results = $twitter->auth->getRequestToken();
 $_SESSION['twitter_request_secret'] = $results->secret;
 
 // Redirect to auth url
-header('Location:' . Horde::externalUrl($twitter->auth->getUserAuthorizationUrl($results), false));
+Horde::externalUrl($twitter->auth->getUserAuthorizationUrl($results), false)->redirect();
index d918169..ba9294c 100644 (file)
@@ -124,12 +124,9 @@ class Gollem_Auth
                 } else {
                     $url = Horde_Auth::addLogoutParameters(self::logoutUrl());
                 }
-                $url = Horde_Util::addParameter($url, 'url', Horde::selfUrl(true, true, true), false);
-                header('Location: ' . $url);
-                exit;
-            } else {
-                return false;
+                $url->add('url', Horde::selfUrl(true, true, true))->redirect();
             }
+            return false;
         }
 
         return true;
index 7943822..db9b467 100644 (file)
@@ -36,13 +36,13 @@ if ($perms->exists($backendTag)) {
     $result = $perms->addPermission($permission, $app);
     if ($result instanceof PEAR_Error) {
         $notification->push(sprintf(_("Unable to create backend permission: %s"), $result->getMessage()), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('redirect.php', true));
-        exit;
+        Horde::applicationUrl('redirect.php', true)->redirect();
     }
     $perm_id = $perms->getPermissionId($permission);
     $notification->push(sprintf(_("Created empty permissions for \"%s\". You must explicitly grant access to this backend now."), $key), 'horde.warning');
 }
 
 /* Redirect to horde permissions administration interface. */
-$url = Horde_Util::addParameter($registry->get('webroot', 'horde') . '/admin/perms/edit.php', 'perm_id', $permission->getId());
-header('Location: ' . Horde::url($url, true));
+Horde::url($registry->get('webroot', 'horde') . '/admin/perms/edit.php', true)
+  ->add('perm_id', $permission->getId())
+  ->redirect();
index 9bc2caa..75f6098 100644 (file)
@@ -21,9 +21,11 @@ $filename = Horde_Util::getFormData('file');
 $type = Horde_Util::getFormData('type');
 
 if ($driver != $GLOBALS['gollem_be']['driver']) {
-    $url = Horde_Util::addParameter(Horde::applicationUrl('login.php'), array('backend_key' => $driver, 'change_backend' => 1, 'url' => Horde::selfURL(true)), null, false);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('login.php')
+        ->add(array('backend_key' => $driver,
+                    'change_backend' => 1,
+                    'url' => Horde::selfURL(true)))
+        ->redirect();
 }
 
 $stream = null;
index bb3e6fe..4da5465 100644 (file)
@@ -69,8 +69,7 @@ default:
         $id = $vars->get('id');
         if (!Hermes::canEditTimeslice($id)) {
             $notification->push(_("Access denied; user cannot modify this timeslice."), 'horde.error');
-            header('Location: ' . Horde::applicationUrl('time.php'));
-            exit;
+            Horde::applicationUrl('time.php')->redirect();
         }
         $myhours = $hermes->driver->getHours(array('id' => $id));
         if (is_array($myhours)) {
index 43dca1c..0ad2c2d 100644 (file)
@@ -19,16 +19,15 @@ $hours = $hermes->driver->getHours(array('billable' => true,
                                  'submitted' => true));
 if (is_a($hours, 'PEAR_Error')) {
     $notification->push($hours->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('time.php'));
-    exit;
-} elseif (empty($hours)) {
+    Horde::applicationUrl('time.php')->redirect();
+}
+if (empty($hours)) {
     $notification->push(_("There is no submitted billable hours."), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('time.php'));
-    exit;
-} elseif (!$registry->hasMethod('invoices/save')) {
+    Horde::applicationUrl('time.php')->redirect();
+}
+if (!$registry->hasMethod('invoices/save')) {
     $notification->push(_("Invoicing system is not installed."), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('time.php'));
-    exit;
+    Horde::applicationUrl('time.php')->redirect();
 }
 
 $headers = array(
@@ -121,8 +120,7 @@ if ($form->validate()) {
         }
     }
 
-    header('Location: ' . Horde::applicationUrl('time.php'));
-    exit;
+    Horde::applicationUrl('time.php')->redirect();
 }
 
 require HERMES_TEMPLATES . '/common-header.inc';
index 1034746..6525e78 100644 (file)
@@ -102,10 +102,9 @@ if ($ui->validateEditForm($info)) {
     $permission->updatePermissions($info);
     $permission->save();
     $notification->push(sprintf(_("Updated \"%s\"."), $perms->getTitle($permission->getName())), 'horde.success');
-    $url = Horde_Util::addParameter('admin/perms/edit.php', 'perm_id', $permission->getId());
-    $url = Horde::applicationUrl($url, true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('admin/perms/edit.php', true)
+        ->add('perm_id', $permission->getId())
+        ->redirect();
 }
 
 $title = _("Permissions Administration");
index e088c8d..c67f8d6 100644 (file)
@@ -19,6 +19,4 @@ if (is_a($print, 'PEAR_Error')) {
 }
 
 /* Redirect back. */
-$url = Horde::applicationUrl($url, true);
-header('Location: ' . $url);
-exit;
+Horde::applicationUrl($url, true)->redirect();
index 7ea2b8d..577f30b 100644 (file)
@@ -21,14 +21,10 @@ $url = $vars->get('url', 'folder.php');
 $fax = $hylax->storage->getFax($fax_id);
 if (is_a($fax, 'PEAR_Error')) {
     $notification->push(sprintf(_("Could not open fax ID \"%s\". %s"), $fax_id, $fax->getMessage()), 'horde.error');
-    $url = Horde::applicationUrl($url, true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl($url, true)->redirect();
 } elseif (!empty($fax['fax_number'])) {
     $notification->push(sprintf(_("Fax ID \"%s\" already has a fax number set."), $fax_id), 'horde.error');
-    $url = Horde::applicationUrl($url, true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl($url, true)->redirect();
 }
 
 $title = _("Send Fax");
@@ -48,9 +44,7 @@ if ($form->validate($vars)) {
     } else {
         $notification->push(sprintf(_("Fax ID \"%s\" submitted successfully."), $info['fax_id']), 'horde.success');
     }
-    $url = Horde::applicationUrl($url, true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl($url, true)->redirect();
 }
 
 /* Get the preview pages. */
index 1619f22..ba2a08a 100644 (file)
@@ -27,9 +27,10 @@ if (is_a($fax, 'PEAR_Error')) {
     $notification->push(sprintf(_("Could not open fax ID \"%s\". %s"), $fax_id, $fax->getMessage()), 'horde.error');
     if (empty($url)) {
         $url = Horde::applicationUrl('folder.php', true);
+    } else {
+        $url = new Horde_Url($url);
     }
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 }
 
 $title = _("View Fax");
index 944331d..be679b8 100644 (file)
@@ -17,8 +17,7 @@ Horde_Registry::appInit('ingo');
 /* Redirect if blacklist is not available. */
 if (!in_array(Ingo_Storage::ACTION_BLACKLIST, $_SESSION['ingo']['script_categories'])) {
     $notification->push(_("Blacklist is not supported in the current filtering driver."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 /* Get the backend. */
index 685dde6..427e4f6 100644 (file)
@@ -42,15 +42,13 @@ case 'rule_disable':
 case 'rule_enable':
     if (!$edit_allowed) {
         $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('filters.php', true));
-        exit;
+        Horde::applicationUrl('filters.php', true)->redirect();
     }
     switch ($vars->actionID) {
     case 'rule_delete':
         if (!$delete_allowed) {
             $notification->push(_("You do not have permission to delete filter rules."), 'horde.error');
-            header('Location: ' . Horde::applicationUrl('filters.php', true));
-            exit;
+            Horde::applicationUrl('filters.php', true)->redirect();
         }
 
         $tmp = $filters->getFilter($vars->rulenumber);
@@ -116,8 +114,7 @@ case 'rule_enable':
 case 'settings_save':
     if (!$edit_allowed) {
         $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('filters.php', true));
-        exit;
+        Horde::applicationUrl('filters.php', true)->redirect();
     }
     $prefs->setValue('show_filter_msg', $vars->show_filter_msg);
     $prefs->setValue('filter_seen', $vars->filter_seen);
@@ -127,8 +124,7 @@ case 'settings_save':
 case 'apply_filters':
     if (!$edit_allowed) {
         $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('filters.php', true));
-        exit;
+        Horde::applicationUrl('filters.php', true)->redirect();
     }
     $ingo_script->apply();
     break;
index 6080648..27fd989 100644 (file)
@@ -16,8 +16,7 @@ Horde_Registry::appInit('ingo');
 /* Redirect if forward is not available. */
 if (!in_array(Ingo_Storage::ACTION_FORWARD, $_SESSION['ingo']['script_categories'])) {
     $notification->push(_("Forward is not supported in the current filtering driver."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 /* Get the forward object and rule. */
@@ -29,8 +28,7 @@ $fwd_rule = $filters->getRule($fwd_id);
 /* Load libraries. */
 $vars = Horde_Variables::getDefaultVariables();
 if ($vars->submitbutton == _("Return to Rules List")) {
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 /* Build form. */
index a0f5366..83bb2ce 100644 (file)
@@ -23,8 +23,7 @@ if (!$perms->hasAppPermission('allow_rules')) {
         $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, $GLOBALS['registry']->getCharset());
     }
     $notification->push($message, 'horde.error', array('content.raw'));
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 /* Load the Ingo_Script:: driver. */
@@ -34,8 +33,7 @@ $ingo_script = Ingo::loadIngoScript();
 $availActions = $ingo_script->availableActions();
 if (empty($availActions)) {
     $notification->push(_("Individual rules are not supported in the current filtering driver."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 /* This provides the $ingo_fields array. */
index 77a3b5d..7376268 100644 (file)
@@ -13,8 +13,7 @@ Horde_Registry::appInit('ingo');
 
 /* Redirect if script updating is not available. */
 if (!$_SESSION['ingo']['script_generate']) {
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 $script = '';
index 999404e..b42cc30 100644 (file)
@@ -43,8 +43,7 @@ class Horde_Form_Type_ingo_folders extends Horde_Form_Type {
 
 if (!in_array(Ingo_Storage::ACTION_SPAM, $_SESSION['ingo']['script_categories'])) {
     $notification->push(_("Simple spam filtering is not supported in the current filtering driver."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 /* Get the spam object and rule. */
@@ -55,8 +54,7 @@ $spam_rule = $filters->getRule($spam_id);
 
 $vars = Horde_Variables::getDefaultVariables();
 if ($vars->submitbutton == _("Return to Rules List")) {
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 /* Build form. */
index 22d091c..ae2187d 100644 (file)
@@ -16,8 +16,7 @@ Horde_Registry::appInit('ingo');
 /* Redirect if vacation is not available. */
 if (!in_array(Ingo_Storage::ACTION_VACATION, $_SESSION['ingo']['script_categories'])) {
     $notification->push(_("Vacation is not supported in the current filtering driver."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 /* Get vacation object and rules. */
@@ -29,8 +28,7 @@ $vac_rule = $filters->getRule($vac_id);
 /* Load libraries. */
 $vars = Horde_Variables::getDefaultVariables();
 if ($vars->submitbutton == _("Return to Rules List")) {
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 /* Build form. */
index dfec272..8968b77 100644 (file)
@@ -18,8 +18,7 @@ Horde_Registry::appInit('ingo');
 /* Redirect if whitelist not available. */
 if (!in_array(Ingo_Storage::ACTION_WHITELIST, $_SESSION['ingo']['script_categories'])) {
     $notification->push(_("Whitelist is not supported in the current filtering driver."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('filters.php', true));
-    exit;
+    Horde::applicationUrl('filters.php', true)->redirect();
 }
 
 $whitelist = $ingo_storage->retrieve(Ingo_Storage::ACTION_WHITELIST);
index 60db93a..feea1ff 100644 (file)
@@ -38,8 +38,9 @@ $ids = preg_split('/:/', $channel['channel_url'], -1, PREG_SPLIT_NO_EMPTY);
 $channel_type = $channel['channel_type'];
 if ($channel_type != Jonah::AGGREGATED_CHANNEL) {
     $notification->push(_("This is no aggregated channel."), 'horde.error');
-    header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('channels/edit.php', true), 'channel_id', $channel_id));
-    exit;
+    Horde::applicationUrl('channels/edit.php', true)
+        ->add('channel_id', $channel_id)
+        ->redirect();
 }
 
 /* Check permissions and deny if not allowed. */
@@ -82,8 +83,9 @@ if ($form->validate($vars)) {
             }
         }
 
-        header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('channels/aggregate.php', true), 'channel_id', $channel_id));
-        exit;
+        Horde::applicationUrl('channels/aggregate.php', true)
+            ->add('channel_id', $channel_id)
+            ->redirect();
     }
 } elseif ($vars->get('action') == 'delete') {
     $subchannel = $news->getChannel($vars->get('subchannel_id'));
@@ -102,8 +104,9 @@ if ($form->validate($vars)) {
         }
     }
 
-    header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('channels/aggregate.php', true), 'channel_id', $channel_id));
-    exit;
+    Horde::applicationUrl('channels/aggregate.php', true)
+        ->add('channel_id', $channel_id)
+        ->redirect();
 } elseif ($vars->get('action') == 'edit') {
     $form->addHidden('', 'subchannel_id', 'int', false);
     $form->setButtons(_("Update"));
index 0efe92e..61cc7b9 100644 (file)
@@ -26,9 +26,7 @@ $channel_id = $vars->get('channel_id');
 $channel = $news->getChannel($channel_id);
 if (is_a($channel, 'PEAR_Error')) {
     $notification->push(_("Invalid channel specified for deletion."), 'horde.message');
-    $url = Horde::applicationUrl('channels/index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('channels/index.php', true)->redirect();
 }
 
 /* Check permissions and deny if not allowed. */
@@ -65,16 +63,12 @@ if ($form_submit == _("Delete")) {
             $notification->push(sprintf(_("There was an error deleting the channel: %s"), $delete->getMessage()), 'horde.error');
         } else {
             $notification->push(_("The channel has been deleted."), 'horde.success');
-            $url = Horde::applicationUrl('channels/index.php', true);
-            header('Location: ' . $url);
-            exit;
+            Horde::applicationUrl('channels/index.php', true)->redirect();
         }
     }
 } elseif (!empty($form_submit)) {
     $notification->push(_("Channel has not been deleted."), 'horde.message');
-    $url = Horde::applicationUrl('channels/index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('channels/index.php', true)->redirect();
 }
 
 $template = new Horde_Template();
index 189a96a..2180991 100644 (file)
@@ -69,8 +69,7 @@ if ($formname && !$changed_type) {
             if ($channel_type == Jonah::AGGREGATED_CHANNEL) {
                 $notification->push(_("You can now edit the sub-feeds."), 'horde.message');
             } else {
-                header('Location: ' . Horde::applicationUrl('channels/index.php', true));
-                exit;
+                Horde::applicationUrl('channels/index.php', true)->redirect();
             }
         }
     }
index ab8684f..2ea7222 100644 (file)
@@ -22,9 +22,7 @@ if (!Jonah::checkPermissions('jonah:news', Horde_Perms::EDIT)) {
 $have_news = Jonah_News::getAvailableTypes();
 if (empty($have_news)) {
     $notification->push(_("News is not enabled."), 'horde.warning');
-    $url = Horde::applicationUrl('index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('index.php', true)->redirect();
 }
 
 $news = Jonah_News::factory();
index c2cfbcf..7373e73 100644 (file)
@@ -39,9 +39,7 @@ $channel = $news->getChannel($criteria['channel_id']);
 if (is_a($channel, 'PEAR_Error')) {
     Horde::logMessage($channel, 'ERR');
     $notification->push(_("Invalid channel."), 'horde.error');
-    $url = Horde::applicationUrl('delivery/index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('delivery/index.php', true)->redirect();
 }
 
 $title = sprintf(_("HTML Delivery for \"%s\""), $channel['channel_name']);
index 1013270..eb670b2 100644 (file)
@@ -28,9 +28,7 @@ $news = Jonah_News::factory();
 $channel = $news->isChannelEditable($channel_id);
 if (is_a($channel, 'PEAR_Error')) {
     $notification->push(sprintf(_("Story editing failed: %s"), $channel->getMessage()), 'horde.error');
-    $url = Horde::applicationUrl('channels/index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('channels/index.php', true)->redirect();
 }
 
 /* Check permissions. */
@@ -42,9 +40,7 @@ if (!Jonah::checkPermissions(Jonah::typeToPermName($channel['channel_type']), Ho
 $story = $news->getStory($channel_id, $story_id);
 if (is_a($story, 'PEAR_Error')) {
     $notification->push(_("No valid story requested for deletion."), 'horde.message');
-    $url = Horde::applicationUrl('channels/index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('channels/index.php', true)->redirect();
 }
 
 /* If not yet submitted set up the form vars from the fetched story. */
@@ -69,18 +65,16 @@ if ($form_submit == _("Delete")) {
             $notification->push(sprintf(_("There was an error deleting the story: %s"), $delete->getMessage()), 'horde.error');
         } else {
             $notification->push(_("The story has been deleted."), 'horde.success');
-            $url = Horde::applicationUrl('stories/index.php', true);
-            $url = Horde_Util::addParameter($url, 'channel_id', $channel_id, false);
-            header('Location: ' . $url);
-            exit;
+            Horde::applicationUrl('stories/index.php', true)
+                ->add('channel_id', $channel_id)
+                ->redirect();
         }
     }
 } elseif (!empty($form_submit)) {
     $notification->push(_("Story has not been deleted."), 'horde.message');
-    $url = Horde::applicationUrl('stories/index.php', true);
-    $url = Horde_Util::addParameter($url, 'channel_id', $channel_id, false);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('stories/index.php', true)
+        ->add('channel_id', $channel_id)
+        ->redirect();
 }
 
 $template = new Horde_Template();
index 5bb7332..96454c6 100644 (file)
@@ -30,9 +30,7 @@ $channel_id = $vars->get('channel_id');
 $channel = $news->isChannelEditable($channel_id);
 if (is_a($channel, 'PEAR_Error')) {
     $notification->push(sprintf(_("Story editing failed: %s"), $channel->getMessage()), 'horde.error');
-    $url = Horde::applicationUrl('channels/index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('channels/index.php', true)->redirect();
 }
 
 /* Check permissions. */
@@ -58,9 +56,9 @@ if ($form->validate($vars)) {
         $notification->push(sprintf(_("There was an error saving the story: %s"), $result->getMessage()), 'horde.error');
     } else {
         $notification->push(sprintf(_("The story \"%s\" has been saved."), $info['story_title']), 'horde.success');
-        $url = Horde_Util::addParameter('stories/index.php', 'channel_id', $channel_id);
-        header('Location: ' . Horde::applicationUrl($url, true));
-        exit;
+        Horde::applicationUrl('stories/index.php', true)
+            ->add('channel_id', $channel_id)
+            ->redirect();
     }
 }
 
index 00fad84..5e3b19c 100644 (file)
@@ -17,9 +17,7 @@ $news = Jonah_News::factory();
 $channel_id = Horde_Util::getFormData('channel_id');
 if (empty($channel_id)) {
     $notification->push(_("No channel requested."), 'horde.error');
-    $url = Horde::applicationUrl('channels/index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('channels/index.php', true)->redirect();
 }
 
 $channel = $news->getChannel($channel_id);
@@ -37,9 +35,7 @@ $url = Horde_Util::getFormData('url');
 $stories = $news->getStories($channel_id, null, 0, !empty($refresh), null, true);
 if (is_a($stories, 'PEAR_Error')) {
     $notification->push(sprintf(_("Invalid channel requested. %s"), $stories->getMessage()), 'horde.error');
-    $url = Horde::applicationUrl('channels/index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('channels/index.php', true)->redirect();
 }
 
 /* Do some state tests. */
index 53f00bc..e3e001a 100644 (file)
@@ -35,18 +35,14 @@ if (!is_null($channel_id)) {
 /* Make sure we actually requested a tag search */
 if (empty($tag_id)) {
     $notification->push(_("No tag requested."), 'horde.error');
-    $url = Horde::applicationUrl('channels/index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('channels/index.php', true)->redirect();
 }
 $tag_name = array_shift($news->getTagNames(array($tag_id)));
 
 $stories = $news->searchTagsById(array($tag_id), 10, 0, $channel_ids);
 if (is_a($stories, 'PEAR_Error')) {
     $notification->push(sprintf(_("Invalid channel requested. %s"), $stories->getMessage()), 'horde.error');
-    $url = Horde::applicationUrl('channels/index.php', true);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('channels/index.php', true)->redirect();
 }
 
 /* Do some state tests. */
index 5e53898..a03a57a 100644 (file)
@@ -56,10 +56,9 @@ $channel_id = $vars->get('channel_id');
 $story_id = $vars->get('story_id');
 
 if (!$conf['sharing']['allow']) {
-    $url = Horde::applicationUrl('stories/view.php', true);
-    $url = Horde_Util::addParameter($url, array('story_id' => $story_id, 'channel_id' => $channel_id));
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('stories/view.php', true)
+        ->add(array('story_id' => $story_id, 'channel_id' => $channel_id))
+        ->redirect();
 }
 
 $story = $news->getStory($channel_id, $story_id);
index 994d42f..f75ca57 100644 (file)
@@ -36,8 +36,7 @@ if (is_a($story, 'PEAR_Error')) {
     require $registry->get('templates', 'horde') . '/common-footer.inc';
     exit;
 } elseif (empty($story['story_body']) && !empty($story['story_url'])) {
-    header('Location: ' . Horde::externalUrl($story['story_url']));
-    exit;
+    Horde::externalUrl($story['story_url'])->redirect();
 }
 
 /* Grab tag related content for entire channel */
index f08990f..520863a 100644 (file)
@@ -94,8 +94,8 @@ class Koward_Cli extends Horde_Controller_Request_Base
                                || $this->auth_handler != $this->params[':action']);
         } catch (Horde_Exception $e) {
             if ($e->getCode() == 'permission_denied') {
-                header('Location: ' . $this->urlFor(array('controller' => 'index', 'action' => 'login')));
-                exit;
+                $this->urlFor(array('controller' => 'index', 'action' => 'login'))
+                    ->redirect();
             }
         }
 
index d6661cb..dcb345c 100644 (file)
@@ -14,8 +14,8 @@ class Koward_Controller_Application extends Horde_Controller_Base
                                || $this->auth_handler != $this->params[':action']);
         } catch (Horde_Exception $e) {
             if ($e->getCode() == 'permission_denied') {
-                header('Location: ' . $this->urlFor(array('controller' => 'index', 'action' => 'login')));
-                exit;
+                $this->urlFor(array('controller' => 'index', 'action' => 'login'))
+                    ->redirect();
             }
         }
 
@@ -104,8 +104,7 @@ class Koward_Controller_Application extends Horde_Controller_Base
             } else {
                 $url = $this->urlFor(array('controller' => 'index', 'action' => 'login'));
             }
-            header('Location: ' . $url);
-            exit;
+            $url->redirect();
         }
     }
 }
index ec6413b..b21d2f8 100644 (file)
@@ -19,8 +19,8 @@ class IndexController extends Koward_Controller_Application
     {
         $auth = $GLOBALS['registry']->getAuth();
         if (!empty($auth)) {
-            header('Location: ' . $this->urlFor(array('controller' => 'index', 'action' => 'index')));
-            exit;
+            $this->urlFor(array('controller' => 'index', 'action' => 'index'))
+                ->redirect();
         }
 
         $this->title = _("Login");
@@ -46,13 +46,11 @@ class IndexController extends Koward_Controller_Application
                 } else {
                     $url = $this->urlFor(array('controller' => 'index', 'action' => 'index'));
                 }
-                header('Location: ' . $url);
-                exit;
-            } else {
-                $entry = sprintf('FAILED LOGIN for %s [%s] to Horde',
-                                 Horde_Util::getFormData('horde_user'), $_SERVER['REMOTE_ADDR']);
-                Horde::logMessage($entry, 'ERR');
+                $url->redirect();
             }
+            $entry = sprintf('FAILED LOGIN for %s [%s] to Horde',
+                             Horde_Util::getFormData('horde_user'), $_SERVER['REMOTE_ADDR']);
+            Horde::logMessage($entry, 'ERR');
         }
 
         if ($reason = $this->koward->auth->getLogoutReasonString()) {
@@ -68,7 +66,7 @@ class IndexController extends Koward_Controller_Application
         Horde::logMessage($entry, 'NOTICE');
         $GLOBALS['registry']->clearAuth();
 
-        header('Location: ' . $this->urlFor(array('controller' => 'index', 'action' => 'login')));
-        exit;
+        $this->urlFor(array('controller' => 'index', 'action' => 'login'))
+            ->redirect();
     }
 }
index a22cf2b..9a84b9b 100644 (file)
@@ -115,9 +115,9 @@ class ObjectController extends Koward_Controller_Application
                         $this->koward->notification->push(_("Failed to delete the object."),
                                                           'horde.error');
                     }
-                    header('Location: ' . $this->urlFor(array('controller' => 'object',
-                                                              'action' => 'listall')));
-                    exit;
+                    $this->urlFor(array('controller' => 'object',
+                                        'action' => 'listall'))
+                        ->redirect();
                 }
             }
         } catch (Exception $e) {
@@ -171,11 +171,12 @@ class ObjectController extends Koward_Controller_Application
                                 $this->koward->notification->push(_("Failed to delete the object."),
                                                                   'horde.error');
                             }
-                            header('Location: ' . $this->urlFor(array('controller' => 'object',
-                                                                      'action' => 'view',
-                                                                      'id' => $this->params->id)));
-                            exit;
-                        } else if ($this->actions->validate()) {
+                            $this->urlFor(array('controller' => 'object',
+                                                'action' => 'view',
+                                                'id' => $this->params->id))
+                                ->redirect();
+                        }
+                        if ($this->actions->validate()) {
                             $action = $this->actions->execute();
                             //FIXME: Hack
                             $result = $this->object->$action();
@@ -292,10 +293,10 @@ class ObjectController extends Koward_Controller_Application
                 $object = $this->form->execute();
 
                 if (!empty($object)) {
-                    header('Location: ' . $this->urlFor(array('controller' => 'object',
-                                                              'action' => 'view',
-                                                              'id' => $object->get(Horde_Kolab_Server_Object::ATTRIBUTE_UID))));
-                    exit;
+                    $this->urlFor(array('controller' => 'object',
+                                        'action' => 'view',
+                                        'id' => $object->get(Horde_Kolab_Server_Object::ATTRIBUTE_UID)))
+                        ->redirect();
                 }
             }
         } catch (Exception $e) {
@@ -338,11 +339,12 @@ class ObjectController extends Koward_Controller_Application
                 $uids = array_keys($this->objectlist);
 
                 if (count($uids) == 1) {
-                    header('Location: ' . $this->urlFor(array('controller' => 'object',
-                                                              'action' => 'view',
-                                                              'id' => $uids[0])));
-                    exit;
-                } else if (count($uids) == 0) {
+                    $this->urlFor(array('controller' => 'object',
+                                        'action' => 'view',
+                                        'id' => $uids[0]))
+                        ->redirect();
+                }
+                if (count($uids) == 0) {
                     $this->koward->notification->push(_("No results found!"), 'horde.message');
                 } else {
                     foreach ($this->objectlist as $uid => $info) {
index b729710..fced4e3 100644 (file)
@@ -25,6 +25,6 @@ try {
     }
 
     if (isset($registry)) {
-        header('Location: ' . $registry->get('webroot', 'koward'));
+        $registry->get('webroot', 'koward')->redirect();
     }
 }
index 707e53b..8dfe8bd 100644 (file)
@@ -14,15 +14,13 @@ Horde_Registry::appInit('luxor');
 
 $symbol = Horde_Util::getFormData('s');
 if (!$symbol) {
-    header('Location: ' . Horde::applicationUrl('source.php', true));
-    exit;
+    Horde::applicationUrl('source.php', true)->redirect();
 }
 
 $ids = $index->searchSymbols($symbol);
 if (count($ids) == 1) {
     $id = current($ids);
-    header('Location: ' . Horde::applicationUrl('symbol.php?i=' . $id, true));
-    exit;
+    Horde::applicationUrl('symbol.php', true)->add('i', $id)->redirect();
 }
 
 // If there are multiple search results, display some info for all of them.
index df41463..0a199f7 100644 (file)
@@ -60,8 +60,7 @@ $memo_id = Horde_Util::getFormData('memo');
 $memolist_id = Horde_Util::getFormData('memolist');
 $actionID = Horde_Util::getFormData('actionID');
 if (is_null($actionID)) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 /* Load category manager. */
@@ -78,8 +77,7 @@ case 'add_memo':
             $message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
         }
         $notification->push($message, 'horde.error', array('content.raw'));
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
     /* Set up the note attributes. */
     if (empty($memolist_id)) {
@@ -104,8 +102,7 @@ case 'modify_memo':
     $memo = Mnemo::getMemo($memolist_id, $memo_id, $passphrase);
     if (!$memo || !isset($memo['memo_id'])) {
         $notification->push(_("Note not found."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
     $storage = &Mnemo_Driver::singleton($memolist_id);
 
@@ -146,8 +143,7 @@ case 'save_memo':
             $memo = Mnemo::getMemo($memolist_original, $memo_id);
             if (!$memo || !isset($memo['memo_id'])) {
                 $notification->push(_("Note not found."), 'horde.error');
-                header('Location: ' . Horde::applicationUrl('list.php', true));
-                exit;
+                Horde::applicationUrl('list.php', true)->redirect();
             }
             $title = sprintf(_("Edit: %s"), $memo['desc']);
             $show_passphrase = showPassphrase($memo);
@@ -203,8 +199,7 @@ case 'save_memo':
             /* Check permissions. */
             if ($injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') !== true &&
                 $injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') <= Mnemo::countMemos()) {
-                header('Location: ' . Horde::applicationUrl('list.php', true));
-                exit;
+                Horde::applicationUrl('list.php', true)->redirect();
             }
             /* Creating a new note. */
             $storage = Mnemo_Driver::singleton($notepad_target);
@@ -223,8 +218,7 @@ case 'save_memo':
     }
 
     /* Return to the notepad view. */
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 
 case 'delete_memos':
     /* Delete the note if we're provided with a valid note ID. */
@@ -251,12 +245,10 @@ case 'delete_memos':
     }
 
     /* Return to the notepad. */
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 
 default:
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $notepads = Mnemo::listNotepads(false, Horde_Perms::EDIT);
index 6f73d6a..e0673d5 100644 (file)
@@ -21,8 +21,7 @@ $storage = &Mnemo_Driver::singleton();
 if ($uid = Horde_Util::getFormData('uid')) {
     $note = $storage->getByUID($uid, $passphrase);
     if ($note instanceof PEAR_Error) {
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
 
     $note_id = $note['memo_id'];
@@ -33,8 +32,7 @@ if ($uid = Horde_Util::getFormData('uid')) {
     $note_id = Horde_Util::getFormData('note');
     $notelist_id = Horde_Util::getFormData('notepad');
     if (!isset($note_id) || !$notelist_id) {
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
 
     /* Get the current memo. */
@@ -44,20 +42,17 @@ try {
     $share = $GLOBALS['mnemo_shares']->getShare($notelist_id);
 } catch (Horde_Share_Exception $e) {
     $notification->push(sprintf(_("There was an error viewing this notepad: %s"), $e->getMessage()), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
     $notification->push(sprintf(_("You do not have permission to view the notepad %s."), $share->get('name')), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 /* If the requested note doesn't exist, display an error message. */
 if (!$note || !isset($note['memo_id'])) {
     $notification->push(_("Note not found."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 /* Let's assume that the note content can be converted to ISO-8859-1 if this
index 402f23d..e6c2c8b 100644 (file)
@@ -17,8 +17,7 @@ require_once MNEMO_BASE . '/lib/Forms/CreateNotepad.php';
 // Exit if this isn't an authenticated user or if the user can't
 // create new notepads (default share is locked).
 if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('default_notepad')) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -33,8 +32,7 @@ if ($form->validate($vars)) {
         $notification->push(sprintf(_("The notepad \"%s\" has been created."), $vars->get('name')), 'horde.success');
     }
 
-    header('Location: ' . Horde::applicationUrl('notepads/', true));
-    exit;
+    Horde::applicationUrl('notepads/', true)->redirect();
 }
 
 $title = $form->getTitle();
index 2deadf8..cf7ca31 100644 (file)
@@ -16,28 +16,24 @@ require_once MNEMO_BASE . '/lib/Forms/DeleteNotepad.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
 $notepad_id = $vars->get('n');
 if ($notepad_id == $GLOBALS['registry']->getAuth()) {
     $notification->push(_("This notepad cannot be deleted"), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('notepads/', true));
-    exit;
+    Horde::applicationUrl('notepads/', true)->redirect();
 }
 try {
     $notepad = $mnemo_shares->getShare($notepad_id);
 } catch (Horde_Share_Exception $e) {
     $notification->push($e->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('notepads/', true));
-    exit;
+    Horde::applicationUrl('notepads/', true)->redirect();
 }
 if (!$GLOBALS['registry']->getAuth() || $notepad->get('owner') != $GLOBALS['registry']->getAuth()) {
     $notification->push(_("You are not allowed to delete this notepad."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('notepads/', true));
-    exit;
+    Horde::applicationUrl('notepads/', true)->redirect();
 }
 
 $form = new Mnemo_DeleteNotepadForm($vars, $notepad);
@@ -51,8 +47,7 @@ if ($form->validate(new Horde_Variables($_POST))) {
         $notification->push(sprintf(_("The notepad \"%s\" has been deleted."), $notepad->get('name')), 'horde.success');
     }
 
-    header('Location: ' . Horde::applicationUrl('notepads/', true));
-    exit;
+    Horde::applicationUrl('notepads/', true)->redirect();
 }
 
 $title = $form->getTitle();
index 5cb9196..836b6c5 100644 (file)
@@ -16,8 +16,7 @@ require_once MNEMO_BASE . '/lib/Forms/EditNotepad.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -25,15 +24,13 @@ try {
     $notepad = $mnemo_shares->getShare($vars->get('n'));
 } catch (Horde_Share_Exception $e) {
     $notification->push($e->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('notepads/', true));
-    exit;
+    Horde::applicationUrl('notepads/', true)->redirect();
 }
 if (!$GLOBALS['registry']->getAuth() ||
     $notepad->get('owner') != $GLOBALS['registry']->getAuth()) {
 
     $notification->push(_("You are not allowed to change this notepad."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('notepads/', true));
-    exit;
+    Horde::applicationUrl('notepads/', true)->redirect();
 }
 $form = new Mnemo_EditNotepadForm($vars, $notepad);
 
@@ -51,8 +48,7 @@ if ($form->validate($vars)) {
         }
     }
 
-    header('Location: ' . Horde::applicationUrl('notepads/', true));
-    exit;
+    Horde::applicationUrl('notepads/', true)->redirect();
 }
 
 $vars->set('name', $notepad->get('name'));
index 228c838..613b146 100644 (file)
@@ -30,8 +30,9 @@ foreach ($memos as $memo_id => $memo) {
 
 if (count($search_results) == 1) {
     $note = array_shift($search_results);
-    header('Location: ' . Horde::applicationUrl(Horde_Util::addParameter('view.php', array('memo' => $note['memo_id'], 'memolist' => $note['memolist_id'])), true));
-    exit;
+    Horde::applicationUrl('view.php', true)
+        ->add(array('memo' => $note['memo_id'], 'memolist' => $note['memolist_id']))
+        ->redirect();
 }
 
 $title = _("Search Results");
index a21d94f..7564478 100644 (file)
@@ -19,8 +19,7 @@ $storage = Mnemo_Driver::singleton();
 if ($uid = Horde_Util::getFormData('uid')) {
     $memo = $storage->getByUID($uid, $passphrase);
     if (is_a($memo, 'PEAR_Error')) {
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
 
     $memo_id = $memo['memo_id'];
@@ -31,8 +30,7 @@ if ($uid = Horde_Util::getFormData('uid')) {
     $memo_id = Horde_Util::getFormData('memo');
     $memolist_id = Horde_Util::getFormData('memolist');
     if (!isset($memo_id) || !$memolist_id) {
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
 
     /* Get the current memo. */
@@ -42,20 +40,17 @@ try {
     $share = $GLOBALS['mnemo_shares']->getShare($memolist_id);
 } catch (Horde_Share_Exception $e) {
     $notification->push(sprintf(_("There was an error viewing this notepad: %s"), $e->getMessage()), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
     $notification->push(sprintf(_("You do not have permission to view the notepad %s."), $share->get('name')), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 /* If the requested note doesn't exist, display an error message. */
 if (!$memo || !isset($memo['memo_id'])) {
     $notification->push(_("Note not found."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 /* Get the note's history. */
index 7205686..5b6fe3d 100644 (file)
@@ -11,9 +11,7 @@ if ($quickText = Horde_Util::getPost('quickText')) {
         } else {
             $notification->push(sprintf(_("Added %s tasks"), count($result)), 'horde.success');
         }
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit(0);
-    } else {
-        Horde::fatal($result);
+        Horde::applicationUrl('list.php', true)->redirect();
     }
+    Horde::fatal($result);
 }
index 6566656..d425706 100644 (file)
@@ -44,10 +44,9 @@ function _delete($task_id, $tasklist_id)
     /* Return to the last page or to the task list. */
     if ($url = Horde_Util::getFormData('url')) {
         header('Location: ' . $url);
-    } else {
-        header('Location: ' . Horde::applicationUrl('list.php', true));
+        exit;
     }
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 require_once dirname(__FILE__) . '/lib/Application.php';
@@ -59,8 +58,7 @@ $vars = Horde_Variables::getDefaultVariables();
 /* Redirect to the task list if no action has been requested. */
 $actionID = $vars->get('actionID');
 if (is_null($actionID)) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 /* Run through the action handlers. */
@@ -76,8 +74,7 @@ case 'add_task':
             $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
         }
         $notification->push($message, 'horde.error', array('content.raw'));
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
 
     $vars->set('actionID', 'save_task');
@@ -114,8 +111,7 @@ case 'modify_task':
     }
 
     /* Return to the task list. */
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 
 case 'save_task':
     if ($vars->get('submitbutton') == _("Delete this task")) {
@@ -136,13 +132,11 @@ case 'save_task':
         $share = $GLOBALS['nag_shares']->getShare($info['tasklist_id']);
     } catch (Horde_Share_Exception $e) {
         $notification->push(sprintf(_("Access denied saving task: %s"), $e->getMessage()), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
     if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
         $notification->push(sprintf(_("Access denied saving task to %s."), $share->get('name')), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
 
     /* Add new category. */
@@ -171,8 +165,7 @@ case 'save_task':
         $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
         if ($perms->hasAppPermission('max_tasks') !== true &&
             $perms->hasAppPermission('max_tasks') <= Nag::countTasks()) {
-            header('Location: ' . Horde::applicationUrl('list.php', true));
-            exit;
+            Horde::applicationUrl('list.php', true)->redirect();
         }
 
         /* Creating a new task. */
@@ -195,10 +188,9 @@ case 'save_task':
         /* Return to the last page or to the task list. */
         if ($url = Horde_Util::getFormData('url')) {
             header('Location: ' . $url);
-        } else {
-            header('Location: ' . Horde::applicationUrl('list.php', true));
+            exit;
         }
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
 
     break;
@@ -241,14 +233,12 @@ case 'complete_task':
     $url = $vars->get('url');
     if (!empty($url)) {
         header('Location: ' . $url);
-    } else {
-        header('Location: ' . Horde::applicationUrl('list.php', true));
+        exit;
     }
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 
 default:
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $title = $form->getTitle();
index b7d3aab..413f745 100644 (file)
@@ -14,8 +14,7 @@ require_once NAG_BASE . '/lib/Forms/CreateTaskList.php';
 // Exit if this isn't an authenticated user or if the user can't
 // create new task lists (default share is locked).
 if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('default_tasklist')) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -30,8 +29,7 @@ if ($form->validate($vars)) {
         $notification->push($e, 'horde.error');
     }
 
-    header('Location: ' . Horde::applicationUrl('tasklists/', true));
-    exit;
+    Horde::applicationUrl('tasklists/', true)->redirect();
 }
 
 $title = $form->getTitle();
index 28f24ea..4c43289 100644 (file)
@@ -13,29 +13,25 @@ require_once NAG_BASE . '/lib/Forms/DeleteTaskList.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
 $tasklist_id = $vars->get('t');
 if ($tasklist_id == $GLOBALS['registry']->getAuth()) {
     $notification->push(_("This task list cannot be deleted."), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('tasklists/', true));
-    exit;
+    Horde::applicationUrl('tasklists/', true)->redirect();
 }
 try {
     $tasklist = $nag_shares->getShare($tasklist_id);
 } catch (Horde_Share_Exception $e) {
     $notification->push($tasklist, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('tasklists/', true));
-    exit;
+    Horde::applicationUrl('tasklists/', true)->redirect();
 }
 if ($tasklist->get('owner') != $GLOBALS['registry']->getAuth() &&
     (!is_null($tasklist->get('owner')) || !$GLOBALS['registry']->isAdmin())) {
     $notification->push(_("You are not allowed to delete this task list."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('tasklists/', true));
-    exit;
+    Horde::applicationUrl('tasklists/', true)->redirect();
 }
 
 $form = new Nag_DeleteTaskListForm($vars, $tasklist);
@@ -49,8 +45,7 @@ if ($form->validate(new Horde_Variables($_POST))) {
         $notification->push($e, 'horde.error');
     }
 
-    header('Location: ' . Horde::applicationUrl('tasklists/', true));
-    exit;
+    Horde::applicationUrl('tasklists/', true)->redirect();
 }
 
 $title = $form->getTitle();
index a49c8c1..7842185 100644 (file)
@@ -13,8 +13,7 @@ require_once NAG_BASE . '/lib/Forms/EditTaskList.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -22,14 +21,12 @@ try {
     $tasklist = $nag_shares->getShare($vars->get('t'));
 } catch (Horde_Share_Exception $e) {
     $notification->push($e->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('tasklists/', true));
-    exit;
+    Horde::applicationUrl('tasklists/', true)->redirect();
 }
 if ($tasklist->get('owner') != $GLOBALS['registry']->getAuth() &&
     (!is_null($tasklist->get('owner')) || !$GLOBALS['registry']->isAdmin())) {
     $notification->push(_("You are not allowed to change this task list."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('tasklists/', true));
-    exit;
+    Horde::applicationUrl('tasklists/', true)->redirect();
 }
 $form = new Nag_EditTaskListForm($vars, $tasklist);
 
@@ -47,8 +44,7 @@ if ($form->validate($vars)) {
         $notification->push($e, 'horde.error');
     }
 
-    header('Location: ' . Horde::applicationUrl('tasklists/', true));
-    exit;
+    Horde::applicationUrl('tasklists/', true)->redirect();
 }
 
 $vars->set('name', $tasklist->get('name'));
index 16dfc98..45cc4dd 100644 (file)
@@ -37,8 +37,7 @@ while ($task = &$tasks->each()) {
 $search_results->reset();
 if ($search_results->count() == 1) {
     $task = $search_results->each();
-    header('Location: ' . Horde::url($task->view_link, true));
-    exit;
+    Horde::url($task->view_link, true)->redirect();
 }
 
 $tasks = $search_results;
index 8cecc65..6c850ad 100644 (file)
@@ -15,8 +15,7 @@ if ($uid = Horde_Util::getFormData('uid')) {
     $storage = Nag_Driver::singleton();
     $task = $storage->getByUID($uid);
     if ($task instanceof PEAR_Error) {
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
 
     $task_id = $task->id;
@@ -27,8 +26,7 @@ if ($uid = Horde_Util::getFormData('uid')) {
     $task_id = Horde_Util::getFormData('task');
     $tasklist_id = Horde_Util::getFormData('tasklist');
     if (!isset($task_id) || !$tasklist_id) {
-        header('Location: ' . Horde::applicationUrl('list.php', true));
-        exit;
+        Horde::applicationUrl('list.php', true)->redirect();
     }
 
     /* Get the current task. */
@@ -38,8 +36,7 @@ if ($uid = Horde_Util::getFormData('uid')) {
 /* If the requested task doesn't exist, display an error message. */
 if (!isset($task) || !isset($task->id)) {
     $notification->push(_("Task not found."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 /* Load child tasks */
@@ -49,8 +46,7 @@ $task->loadChildren();
 $share = $GLOBALS['nag_shares']->getShare($tasklist_id);
 if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
     $notification->push(_("You do not have permission to view this tasklist."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 /* Get the task's history. */
index b56da9d..355150c 100644 (file)
@@ -106,8 +106,7 @@ if ($id && Horde_Util::getFormData('submitbutton') == _("Delete existing picture
         $notification->push($sources);
     } else {
         News::deleteImage($id);
-        header('Location: ' . News::getUrlFor('news', $id));
-        exit;
+        News::getUrlFor('news', $id)->redirect();
     }
 }
 
@@ -335,8 +334,7 @@ if ($form->validate()) {
         $id = $news->write_db->nextID($news->prefix);
         if ($id instanceof PEAR_Error) {
             $notification->push($id);
-            header('Location: ' . Horde::applicationUrl('browse.php'));
-            exit;
+            Horde::applicationUrl('browse.php')->redirect();
         }
 
         $query = 'INSERT INTO ' . $news->prefix
@@ -396,8 +394,7 @@ if ($form->validate()) {
     $result = $news->write_db->query($query, $data);
     if ($result instanceof PEAR_Error) {
         $notification->push($result->getDebugInfo(), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('edit.php'));
-        exit;
+        Horde::applicationUrl('edit.php')->redirect();
     }
 
     // Picture
@@ -553,8 +550,7 @@ if ($form->validate()) {
         $notification->push(_("News updated."), 'horde.success');
     }
 
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 
 } elseif ($id && !$form->isSubmitted()) {
 
index 85c969f..aa92471 100644 (file)
@@ -31,8 +31,7 @@ if ($form->validate()) {
     } else {
         $notification->push(_("Category was not deleted."), 'horde.warning');
     }
-    header('Location: ' . Horde::applicationUrl('admin/categories/index.php'));
-    exit;
+    Horde::applicationUrl('admin/categories/index.php')->redirect();
 }
 
 require NEWS_BASE . '/templates/common-header.inc';
index 1e0d83c..33fdefb 100644 (file)
@@ -44,9 +44,7 @@ if ($form->validate()) {
         $notification->push($result->getMessage() . ': ' . $result->getDebugInfo(), 'horde.error');
     } else {
         $notification->push(sprintf(_("Category succesfully saved.")));
-        $url = Horde::applicationUrl('admin/categories/index.php', true);
-        header('Location: ' . $url);
-        exit;
+        Horde::applicationUrl('admin/categories/index.php', true)->redirect();
     }
 }
 
index 861788f..968db28 100644 (file)
@@ -32,8 +32,7 @@ if ($form->validate()) {
     } else {
         $notification->push(_("Source was not deleted."), 'horde.warning');
     }
-    header('Location: ' . Horde::applicationUrl('admin/sources/index.php'));
-    exit;
+    Horde::applicationUrl('admin/sources/index.php')->redirect();
 }
 
 require NEWS_BASE . '/templates/common-header.inc';
index aa69e69..e99fe78 100644 (file)
@@ -43,8 +43,7 @@ if ($form->validate()) {
         $notification->push($result->getMessage() . ': ' . $result->getDebugInfo(), 'horde.error');
     } else {
         $notification->push(_("Source saved succesfully."));
-        header('Location: ' . Horde::applicationUrl('admin/sources/index.php'));
-        exit;
+        Horde::applicationUrl('admin/sources/index.php')->redirect();
     }
 }
 
index 68e1256..deaf089 100644 (file)
@@ -46,8 +46,7 @@ if ($rows instanceof PEAR_Error) {
 
 // If we have only one row redirect ot it
 if ($count == 1 && sizeof($cats) < 2 && $page < 1) {
-    header('Location: '. News::getUrlFor('news', $rows[0]['id']));
-    exit;
+    News::getUrlFor('news', $rows[0]['id'])->redirect();
 }
 
 // Get pager
index ff03684..e8f26ff 100644 (file)
@@ -17,8 +17,7 @@ require_once dirname(__FILE__) . '/lib/base.php';
 
 if (!$registry->isAdmin(array('permission' => 'news:admin'))) {
     $notification->push(_("Only admin can delete a news."));
-    header('Location: ' . Horde::applicationUrl('edit.php'));
-    exit;
+    Horde::applicationUrl('edit.php')->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -86,13 +85,10 @@ if ($form->validate()) {
         $notification->push(sprintf(_("News %s: %s"), $id, _("not deleted")), 'horde.warning');
     }
 
-    header('Location: ' . Horde::applicationUrl('edit.php'));
-    exit;
+    Horde::applicationUrl('edit.php')->redirect();
 }
 
 require NEWS_TEMPLATES . '/common-header.inc';
 require NEWS_TEMPLATES . '/menu.inc';
-
 $form->renderActive(null, null, null, 'post');
-
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index 4078fcd..0615d8d 100644 (file)
@@ -17,8 +17,7 @@ require_once dirname(__FILE__) . '/lib/base.php';
 
 if (!$registry->isAdmin(array('permission' => 'news:admin'))) {
     $notification->push(_("Only admin can delete a news."));
-    header('Location: ' . Horde::applicationUrl('edit.php'));
-    exit;
+    Horde::applicationUrl('edit.php')->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -83,13 +82,10 @@ if ($form->validate()) {
 
     }
 
-    header('Location: ' . News::getUrlFor('news', $news_id));
-    exit;
+    News::getUrlFor('news', $news_id)->redirect();
 }
 
 require NEWS_TEMPLATES . '/common-header.inc';
 require NEWS_TEMPLATES . '/menu.inc';
-
 $form->renderActive(null, null, null, 'post');
-
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index c4ac01c..57b7dea 100644 (file)
@@ -19,8 +19,7 @@ require_once dirname(__FILE__) . '/lib/base.php';
 $allowed_cats = $news_cat->getAllowed(Horde_Perms::DELETE);
 if (empty($allowed_cats)) {
     $notification->push(_("You have not editor permission on any category."));
-    header('Location: ' . Horde::applicationUrl('add.php'));
-    exit;
+    Horde::applicationUrl('add.php')->redirect();
 }
 
 $id = (int)Horde_Util::getFormData('id', 0);
@@ -57,8 +56,7 @@ case 'deletepicture';
         $notification->push(sprintf(_("News \"%s\" (%s): %s"), $article['title'], $id, _("picture deleted")), 'horde.success');
     }
 
-    header('Location: ' . $browse_url);
-    exit;
+    $browse_url->redirect();
 
 break;
 
@@ -70,8 +68,7 @@ case 'deactivate';
     }
 
     $notification->push(sprintf(_("News \"%s\" (%s): %s"), $article['title'], $id, _("deactivated")), 'horde.success');
-    header('Location: ' . $browse_url);
-    exit;
+    $browse_url->redirect();
 
 break;
 case 'activate';
@@ -82,8 +79,7 @@ case 'activate';
     }
 
     $notification->push(sprintf(_("News \"%s\" (%s): %s"), $article['title'], $id, _("activated")), 'horde.success');
-    header('Location: ' . $browse_url);
-    exit;
+    $browse_url->redirect();
 
 break;
 case 'lock';
@@ -94,8 +90,7 @@ case 'lock';
     }
 
     $notification->push(sprintf(_("News \"%s\" (%s): %s"), $article['title'], $id, _("locked")), 'horde.success');
-    header('Location: ' . $browse_url);
-    exit;
+    $browse_url->redirect();
 
 break;
 case 'unlock';
@@ -106,8 +101,8 @@ case 'unlock';
     }
 
     $notification->push(sprintf(_("News \"%s\" (%s): %s"), $article['title'], $id, _("unlocked")), 'horde.success');
-    header('Location: ' . $browse_url);
-    exit;
+    $browse_url->redirect();
+
 
 break;
 case 'renew';
@@ -145,10 +140,7 @@ case 'renew';
                                 array($id, $version, $GLOBALS['registry']->getAuth(), serialize($new_version)));
 
     $notification->push(sprintf(_("News \"%s\" (%s): %s"), $article['title'], $id, _("renewed")), 'horde.success');
-    header('Location: ' . $browse_url);
-    exit;
-
-break;
+    $browse_url->redirect();
 }
 
 $title = _("Edit");
index 7202734..90e76a1 100644 (file)
@@ -19,16 +19,14 @@ $id = Horde_Util::getFormData('id');
 $row = $news->get($id);
 if ($row instanceof PEAR_Error) {
     $notification->push($row);
-    header('Location: ' . Horde::applicationUrl('browse.php'));
-    exit;
+    Horde::applicationUrl('browse.php')->redirect();
 }
 
 /* Error handler */
 function _error($msg)
 {
     $GLOBALS['notification']->push($msg, 'horde.error');
-    header('Location: ' . News::getUrlFor('news', $GLOBALS['id']));
-    exit;
+    News::getUrlFor('news', $GLOBALS['id'])->redirect();
 }
 
 if (!$registry->isAuthenticated()) {
@@ -61,5 +59,4 @@ try {
     $notification->push($e);
 }
 
-header('Location: ' . News::getUrlFor('news', $id));
-exit;
+News::getUrlFor('news', $id)->redirect();
index 0226243..c508b4d 100644 (file)
@@ -21,8 +21,7 @@ $row = $news->get($id);
 // check if the news exists
 if ($row instanceof PEAR_Error) {
     $notification->push($row);
-    header('Location: ' . Horde::applicationUrl('index.php'));
-    exit;
+    Horde::applicationUrl('index.php')->redirect();
 }
 
 // check if the news exists
index a5fcf30..e482d79 100644 (file)
@@ -19,8 +19,7 @@ $id = Horde_Util::getFormData('id');
 $row = $news->get($id);
 if ($row instanceof PEAR_Error) {
     $notification->push($row);
-    header('Location: ' . Horde::applicationUrl('browse.php'));
-    exit;
+    Horde::applicationUrl('browse.php')->redirect();
 }
 
 $body = $row['title'] . "\n\n"
@@ -40,5 +39,5 @@ try {
     header('Location: ' . $registry->getInitialPage('mnemo'));
 } catch (Horde_Exception $e) {
     $notification->push($e);
-    header('Location: ' . News::getUrlFor('news', $id));
+    News::getUrlFor('news', $id)->redirect();
 }
index bc4a252..42be47b 100644 (file)
@@ -22,8 +22,7 @@ $row = $news->get($id);
 // Check if the news exists
 if ($row instanceof PEAR_Error) {
     $notification->push($row);
-    header('Location: ' . Horde::applicationUrl('browse.php'));
-    exit;
+    Horde::applicationUrl('browse.php')->redirect();
 }
 
 // Set up the PDF object.
index e6bb543..76ff685 100644 (file)
@@ -44,8 +44,7 @@ $pager->preserve($criteria);
 
 // If we have only one row redirect ot it
 if ($count == 1 && sizeof($cats) < 2 && $page < 1) {
-    header('Location: '. News::getUrlFor('news', $rows[0]['id']));
-    exit;
+    News::getUrlFor('news', $rows[0]['id'])->redirect();
 }
 
 
index c35dd85..ae98e9d 100644 (file)
@@ -28,9 +28,7 @@ if ($form->validate($vars)) {
 
         $notification->push(sprintf('Paste saved. %s', $uuid), 'horde.success');
 
-        $url = Horde::applicationUrl('uuid/' . $uuid, true);
-        header('Location: ' . $url);
-        exit;
+        Horde::applicationUrl('uuid/' . $uuid, true)->redirect();
     } catch (Exception $e) {
         $notification->push($e->getMessage(), 'horde.error');
     }
index 42041e6..4eb0b76 100644 (file)
@@ -20,7 +20,7 @@ $curaccount = $_SESSION['shout']['curaccount'];
 
 $menus = $shout->storage->getMenus($curaccount['code']);
 if (empty($menus)) {
-    header('Location: ' . Horde::applicationUrl('wizard.php', true));
+    Horde::applicationUrl('wizard.php', true)->redirect();
 }
 
 switch($action) {
index 1bf9193..8d07acc 100644 (file)
@@ -19,8 +19,6 @@ $curaccount = $_SESSION['shout']['curaccount'];
 $menus = $shout->storage->getMenus($curaccount['code']);
 
 if (empty($menus)) {
-    header('Location: ' . Horde::applicationUrl('wizard.php', true));
-} else {
-    header('Location: ' . Horde::applicationUrl('dialplan.php', true));
-    exit;
-}
\ No newline at end of file
+    Horde::applicationUrl('wizard.php', true)->redirect();
+}
+Horde::applicationUrl('dialplan.php', true)->redirect();
index 6f7f6e2..a0e124e 100644 (file)
@@ -29,8 +29,7 @@ try {
     $menus = $shout->storage->getMenus($curaccount['code']);
 
     if (!empty($menus) && !empty($menus[Shout::MAIN_MENU])) {
-        header('Location: ' . Horde::applicationUrl('dialplan.php', true));
-        exit;
+        Horde::applicationUrl('dialplan.php', true)->redirect();
     }
 
     // Create the default recording for the main menu
index bc78aa8..ef69536 100644 (file)
@@ -15,8 +15,7 @@ require_once SKOLI_BASE . '/lib/Forms/Entry.php';
 /* Redirect to create a new class if we don't have access to any class */
 if (count(Skoli::listClasses(false, Horde_Perms::EDIT)) == 0 && $GLOBALS['registry']->getAuth()) {
     $notification->push(_("Please create a new Class first."), 'horde.message');
-    header('Location: ' . Horde::applicationUrl('classes/create.php', true));
-    exit;
+    Horde::applicationUrl('classes/create.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -31,7 +30,9 @@ if ($form->validate($vars)) {
         $notification->push(sprintf(_("The new entry for \"%s\" has been added."), $result), 'horde.success');
     }
 
-    header('Location: ' . Horde::applicationUrl(Horde_Util::addParameter('add.php', 'class', $vars->get('class_id')), true));
+    Horde::applicationUrl('add.php', true)
+        ->add('class', $vars->get('class_id'))
+        ->redirect();
     exit;
 }
 
index 4cab4e3..c8019fd 100644 (file)
@@ -12,16 +12,14 @@ require_once SKOLI_BASE . '/lib/Forms/CreateClass.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 // Exit if we don't have access to addressbooks.
 require_once SKOLI_BASE . '/lib/School.php';
 if (!count(Skoli_School::listAddressBooks())) {
     $notification->push(_("You don't have access to any valid addressbook."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('classes/', true));
-    exit;
+    Horde::applicationUrl('classes/', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -38,8 +36,7 @@ if ($form->validate($vars)) {
         $prefs->setValue('display_classes', serialize($GLOBALS['display_classes']));
     }
 
-    header('Location: ' . Horde::applicationUrl('classes/', true));
-    exit;
+    Horde::applicationUrl('classes/', true)->redirect();
 }
 
 $title = $form->getTitle();
index e043597..3860f1f 100644 (file)
@@ -12,8 +12,7 @@ require_once SKOLI_BASE . '/lib/Forms/DeleteClass.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -22,12 +21,10 @@ $class_id = $vars->get('c');
 $class = $skoli_shares->getShare($class_id);
 if (is_a($class, 'PEAR_Error')) {
     $notification->push($class, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('classes/', true));
-    exit;
+    Horde::applicationUrl('classes/', true)->redirect();
 } elseif (!$class->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
     $notification->push(_("You are not allowed to delete this class."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('classes/', true));
-    exit;
+    Horde::applicationUrl('classes/', true)->redirect();
 }
 
 $form = new Skoli_DeleteClassForm($vars, $class);
@@ -41,8 +38,7 @@ if ($form->validate(new Horde_Variables($_POST))) {
         $notification->push(sprintf(_("The class \"%s\" has been deleted."), $class->get('name')), 'horde.success');
     }
 
-    header('Location: ' . Horde::applicationUrl('classes/', true));
-    exit;
+    Horde::applicationUrl('classes/', true)->redirect();
 }
 
 $title = $form->getTitle();
index 02423db..33b84fc 100644 (file)
@@ -12,20 +12,17 @@ require_once SKOLI_BASE . '/lib/Forms/EditClass.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
 $class = $skoli_shares->getShare($vars->get('c'));
 if (is_a($class, 'PEAR_Error')) {
     $notification->push($class, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('classes/', true));
-    exit;
+    Horde::applicationUrl('classes/', true)->redirect();
 } elseif (!$class->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
     $notification->push(_("You are not allowed to change this class."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('classes/', true));
-    exit;
+    Horde::applicationUrl('classes/', true)->redirect();
 }
 $vars->set('school', $class->get('school'));
 if (!$vars->exists('marks')) {
@@ -51,8 +48,7 @@ if ($form->validate($vars)) {
         }
     }
 
-    header('Location: ' . Horde::applicationUrl('classes/', true));
-    exit;
+    Horde::applicationUrl('classes/', true)->redirect();
 }
 
 if (!$vars->exists('name')) {
index 459df31..95ef721 100644 (file)
@@ -11,8 +11,7 @@ require_once SKOLI_BASE . '/lib/base.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $edit_url_base = Horde::applicationUrl('classes/edit.php');
index 627a10f..301f53a 100644 (file)
@@ -11,8 +11,7 @@
 require_once dirname(__FILE__) . '/lib/base.php';
 
 if (!$conf['menu']['export']) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $classes = Skoli::listClasses();
index b10ee2a..4a19a47 100644 (file)
@@ -13,8 +13,7 @@ require_once SKOLI_BASE . '/lib/base.php';
 
 // Exit if this isn't an authenticated user.
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('list.php', true));
-    exit;
+    Horde::applicationUrl('list.php', true)->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -22,16 +21,16 @@ $driver = &Skoli_Driver::singleton();
 $entry = $driver->getEntry($vars->get('entry'));
 if (is_a($entry, 'PEAR_Error') || !count($entry)) {
     $notification->push(_("Entry not found."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('search.php', true));
-    exit;
+    Horde::applicationUrl('search.php', true)->redirect();
 }
 $share = $GLOBALS['skoli_shares']->getShare($entry['class_id']);
 
 // Check permissions
 if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
     $notification->push(_("You are not allowed to view this entry."), 'horde.error');
-    header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('search.php', true), 'actionID', 'search'));
-    exit;
+    Horde::applicationUrl('search.php', true)
+        ->add('actionID', 'search')
+        ->redirect();
 }
 
 $studentdetails = Skoli::getStudent($share->get('address_book'), $entry['student_id']);
@@ -60,8 +59,9 @@ if ($viewName != 'DeleteEntry') {
                 $notification->push(sprintf(_("Couldn't update this entry: %s"), $result->getMessage()), 'horde.error');
             } else {
                 $notification->push(sprintf(_("The entry for \"%s\" has been saved."), $studentdetails[$conf['addresses']['name_field']]), 'horde.success');
-                header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('search.php', true), 'actionID', 'search'));
-                exit;
+                Horde::applicationUrl('search.php', true)
+                    ->add('actionID', 'search')
+                    ->redirect();
             }
         }
     }
@@ -74,8 +74,9 @@ if ($actionID == 'delete') {
         $notification->push(sprintf(_("There was an error deleting this entry: %s"), $deleted->getMessage()), 'horde.error');
     } else {
         $notification->push(sprintf(_("The entry for \"%s\" has been deleted."), $studentdetails[$conf['addresses']['name_field']]), 'horde.success');
-        header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('search.php', true), 'actionID', 'search'));
-        exit;
+        Horde::applicationUrl('search.php', true)
+            ->add('actionID', 'search')
+            ->redirect();
     }
 }
 
index 2c8680d..09a5787 100644 (file)
@@ -54,8 +54,7 @@ if ($app == false || $registry->get('status', $app) == 'inactive' || !$registry-
 /* Redirect to create a new class if we don't have access to any class */
 if (count(Skoli::listClasses()) == 0 && $GLOBALS['registry']->getAuth()) {
     $notification->push(_("Please create a new Class first."), 'horde.message');
-    header('Location: ' . Horde::applicationUrl('classes/create.php', true));
-    exit;
+    Horde::applicationUrl('classes/create.php', true)->redirect();
 }
 
 switch ($actionID) {
index 45e9673..e6c1439 100644 (file)
@@ -25,8 +25,7 @@ case 'add_bookmark':
             $message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
         }
         $notification->push($message, 'horde.error', array('content.raw'));
-        header('Location: ' . Horde::applicationUrl('browse.php', true));
-        exit;
+        Horde::applicationUrl('browse.php', true)->redirect();
     }
 
     $folderId = Horde_Util::getFormData('f');
@@ -66,9 +65,10 @@ case 'add_bookmark':
             $notification->push(_("Bookmark Added"), 'horde.success');
             require TREAN_TEMPLATES . '/common-header.inc';
             $notification->notify();
-            exit;
         } else {
-            header('Location: ' . Horde::applicationUrl(Horde_Util::addParameter('browse.php', 'f', $folderId), true));
+            Horde::applicationUrl('browse.php', true)
+                ->add('f', $folderId)
+                ->redirect();
         }
         exit;
     }
@@ -88,8 +88,9 @@ case 'add_folder':
             $message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
         }
         $notification->push($message, 'horde.error', array('content.raw'));
-        header('Location: ' . Horde::applicationUrl(Horde_Util::addParameter('browse.php', 'f', $parent_id), true));
-        exit;
+        Horde::applicationUrl('browse.php', true)
+            ->add('f', $parent_id)
+            ->redirect();
     }
 
     $parent = &$trean_shares->getFolder($parent_id);
@@ -101,8 +102,9 @@ case 'add_folder':
     if (is_a($result, 'PEAR_Error')) {
         $notification->push(sprintf(_("There was an error adding the folder: %s"), $result->getMessage()), 'horde.error');
     } else {
-        header('Location: ' . Horde::applicationUrl(Horde_Util::addParameter('browse.php', 'f', $result), true));
-        exit;
+        Horde::applicationUrl('browse.php', true)
+            ->add('f', $result)
+            ->redirect();
     }
     break;
 }
index cf0733f..ee777c7 100644 (file)
@@ -44,5 +44,7 @@ if (Horde_Util::getFormData('partial')) {
 if (!is_null($url = Horde_Util::getFormData('nu'))) {
     header('Location: ' . $url);
 } else {
-    header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('browse.php', true), 'f', $bookmark->folder));
+    Horde::applicationUrl('browse.php', true)
+        ->add('f', $bookmark->folder)
+        ->redirect();
 }
index 746ce93..f212500 100644 (file)
@@ -44,8 +44,7 @@ if (empty($folderId) && $registry->getAuth()) {
     /* Make sure user has permission to view this folder. */
     if (!$folder->hasPermission($registry->getAuth(), Horde_Perms::READ)) {
         $notification->push(_("You do not have permission to view this folder."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('browse.php', true));
-        exit;
+        Horde::applicationUrl('browse.php', true)->redirect();
     }
 }
 
index e544b0b..5cd6e04 100644 (file)
@@ -155,9 +155,9 @@ case 'import':
 
     $notification->push(sprintf(_("%d Folders and %d Bookmarks imported."), $folders, $bookmarks), 'horde.success');
 
-    $url = Horde_Util::addParameter('browse.php', 'f', $root->getId());
-    header('Location: ' . Horde::applicationUrl($url, true));
-    exit;
+    Horde::applicationUrl('browse.php', true)
+        ->add('f', $root->getId())
+        ->redirect();
 
 case 'export':
     $folderId = Horde_Util::getFormData('export_folder');
index e0a60f2..2963203 100644 (file)
@@ -17,14 +17,14 @@ $folderId = Horde_Util::getFormData('f', $trean_shares->getId($GLOBALS['registry
 
 $actionID = Horde_Util::getFormData('actionID');
 if ($actionID == 'button') {
-    if (Horde_Util::getFormData('new_bookmark')
-        || !is_null(Horde_Util::getFormData('new_bookmark_x'))) {
-        header('Location: ' . Horde::applicationUrl('add.php?f=' . $folderId, true));
-        exit;
-    } elseif (Horde_Util::getFormData('edit_bookmarks')) {
+    if (Horde_Util::getFormData('new_bookmark') ||
+        !is_null(Horde_Util::getFormData('new_bookmark_x'))) {
+        Horde::applicationUrl('add.php', true)->add('f', $folderId)->redirect();
+    }
+    if (Horde_Util::getFormData('edit_bookmarks')) {
         $actionID = null;
-    } elseif (Horde_Util::getFormData('delete_bookmarks')
-              || !is_null(Horde_Util::getFormData('delete_bookmarks_x'))) {
+    } elseif (Horde_Util::getFormData('delete_bookmarks') ||
+              !is_null(Horde_Util::getFormData('delete_bookmarks_x'))) {
         $actionID = 'delete';
     }
 }
@@ -96,8 +96,9 @@ case 'save':
             $notification->notify();
         }
     } else {
-        $url = Horde_Util::addParameter('browse.php', 'f', $folderId);
-        header('Location: ' . Horde::applicationUrl($url, true));
+        Horde::applicationUrl('browse.php', true)
+            ->add('f', $folderId)
+            ->redirect();
     }
     exit;
 
@@ -129,9 +130,7 @@ case 'delete':
     }
 
     // Return to the folder listing
-    $url = Horde_Util::addParameter('browse.php', 'f', $folderId);
-    header('Location: ' . Horde::applicationUrl($url, true));
-    exit;
+    Horde::applicationUrl('browse.php', true)->add('f', $folderId)->redirect();
 
 case 'move':
     $create_folder = Horde_Util::getFormData('create_folder');
@@ -180,9 +179,7 @@ case 'move':
     }
 
     // Return to the folder listing
-    $url = Horde_Util::addParameter('browse.php', 'f', $folderId);
-    header('Location: ' . Horde::applicationUrl($url, true));
-    exit;
+    Horde::applicationUrl('browse.php', true)->add('f', $folderId)->redirect();
 
 case 'copy':
     $create_folder = Horde_Util::getFormData('create_folder');
@@ -223,9 +220,7 @@ case 'copy':
     }
 
     // Return to the folder listing
-    $url = Horde_Util::addParameter('browse.php', 'f', $folderId);
-    header('Location: ' . Horde::applicationUrl($url, true));
-    exit;
+    Horde::applicationUrl('browse.php', true)->add('f', $folderId)->redirect();
 
 case 'rename':
     /* Rename a Bookmark Folder. */
@@ -236,9 +231,7 @@ case 'rename':
     if (is_a($result, 'PEAR_Error')) {
         $notification->push(sprintf(_("\"%s\" was not renamed: %s."), $name, $result->getMessage()), 'horde.error');
     } else {
-        $url = Horde_Util::addParameter('browse.php', 'f', $folderId);
-        header('Location: ' . Horde::applicationUrl($url, true));
-        exit;
+        Horde::applicationUrl('browse.php', true)->add('f', $folderId)->redirect();
     }
     break;
 
@@ -260,33 +253,27 @@ case 'del_folder_confirmed':
     $folder = &$trean_shares->getFolder($folderId);
     if (is_a($folder, 'PEAR_Error')) {
         $notification->push($folder->getMessage(), 'horde.error');
-        header('Location: ' . Horde::applicationUrl('browse.php'));
-        exit;
+        Horde::applicationUrl('browse.php')->redirect();
     }
 
     $parent = $folder->getParent();
     $result = $folder->delete();
     if (is_a($result, 'PEAR_Error')) {
         $notification->push($result->getMessage(), 'horde.error');
-        header('Location: ' . Horde::applicationUrl(Horde_Util::addParameter('browse.php', 'f', $folderId), true));
     } else {
         $notification->push(sprintf(_("Deleted the folder \"%s\""), $folder->get('name')), 'horde.success');
-        header('Location: ' . Horde::applicationUrl(Horde_Util::addParameter('browse.php', 'f', $parent), true));
     }
+    Horde::applicationUrl('browse.php', true)->add('f', $folderId)->redirect();
     exit;
 
 case 'cancel':
-    $url = Horde_Util::addParameter('browse.php', 'f', $folderId);
-    header('Location: ' . Horde::applicationUrl($url, true));
-    exit;
+    Horde::applicationUrl('browse.php', true)->add('f', $folderId)->redirect();
 }
 
 // Return to browse if there is nothing to edit.
 if (!count($bookmarks) && !count($folder)) {
     $notification->push(_("Nothing to edit."), 'horde.message');
-    $url = Horde_Util::addParameter('browse.php', 'f', $folderId);
-    header('Location: ' . Horde::applicationUrl($url, true));
-    exit;
+    Horde::applicationUrl('browse.php', true)->add('f', $folderId)->redirect();
 }
 
 $title = _("Edit Bookmark");
index 179df76..89a1de9 100644 (file)
@@ -27,4 +27,4 @@ if (is_a($bookmark, 'PEAR_Error')) {
 ++$bookmark->clicks;
 $bookmark->save();
 
-header('Location: ' . Horde::externalUrl($bookmark->url));
+Horde::externalUrl($bookmark->url)->redirect();
index 4cbbc5d..cb8c0ed 100644 (file)
@@ -28,8 +28,7 @@ if (!$addSources) {
     $url = $url
         ? Horde::url($url, true)
         : Horde::applicationUrl('index.php', true);
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 }
 
 /* A source has been selected, connect and set up the fields. */
@@ -51,8 +50,7 @@ if ($source) {
             $url = $url
                 ? Horde::url($url, true)
                 : Horde::applicationUrl('index.php', true);
-            header('Location: ' . $url);
-            exit;
+            $url->redirect();
         }
 
         $contact = new Turba_Object($driver);
index a5695ca..ae6c462 100644 (file)
@@ -31,8 +31,7 @@ if ($form->validate($vars)) {
         $notification->push(sprintf(_("The address book \"%s\" has been created."), $vars->get('name')), 'horde.success');
     }
 
-    header('Location: ' . Horde::applicationUrl('addressbooks/', true));
-    exit;
+    Horde::applicationUrl('addressbooks/', true)->redirect();
 }
 
 $title = $form->getTitle();
index 340bb79..2665ecf 100644 (file)
@@ -23,23 +23,20 @@ $vars = Horde_Variables::getDefaultVariables();
 $addressbook_id = $vars->get('a');
 if ($addressbook_id == $GLOBALS['registry']->getAuth()) {
     $notification->push(_("This addressbook cannot be deleted"), 'horde.warning');
-    header('Location: ' . Horde::applicationUrl('addressbooks/', true));
-    exit;
+    Horde::applicationUrl('addressbooks/', true)->redirect();
 }
 
 try {
     $addressbook = $turba_shares->getShare($addressbook_id);
 } catch (Horde_Share_Exception $e) {
     $notification->push($e, 'horde.error');
-    header('Location: ' . Horde::applicationUrl('addressbooks/', true));
-    exit;
+    Horde::applicationUrl('addressbooks/', true)->redirect();
 }
 if (!$GLOBALS['registry']->getAuth() ||
     $addressbook->get('owner') != $GLOBALS['registry']->getAuth()) {
 
     $notification->push(_("You are not allowed to delete this addressbook."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('addressbooks/', true));
-    exit;
+    Horde::applicationUrl('addressbooks/', true)->redirect();
 }
 
 $form = new Turba_Form_DeleteAddressBook($vars, $addressbook);
@@ -53,8 +50,7 @@ if ($form->validate(new Horde_Variables($_POST))) {
         $notification->push(sprintf(_("The addressbook \"%s\" has been deleted."), $addressbook->get('name')), 'horde.success');
     }
 
-    header('Location: ' . Horde::applicationUrl('addressbooks/', true));
-    exit;
+    Horde::applicationUrl('addressbooks/', true)->redirect();
 }
 
 $title = $form->getTitle();
index 502a81a..18c670f 100644 (file)
@@ -24,15 +24,13 @@ try {
     $addressbook = $turba_shares->getShare($vars->get('a'));
 } catch (Horde_Share_Exception $e) {
     $notification->push($e->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('addressbooks/', true));
-    exit;
+    Horde::applicationUrl('addressbooks/', true)->redirect();
 }
 if (!$GLOBALS['registry']->getAuth() ||
     $addressbook->get('owner') != $GLOBALS['registry']->getAuth()) {
 
     $notification->push(_("You are not allowed to change this addressbook."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl('addressbooks/', true));
-    exit;
+    Horde::applicationUrl('addressbooks/', true)->redirect();
 }
 $form = new Turba_Form_EditAddressBook($vars, $addressbook);
 
@@ -50,8 +48,7 @@ if ($form->validate($vars)) {
         }
     }
 
-    header('Location: ' . Horde::applicationUrl('addressbooks/', true));
-    exit;
+    Horde::applicationUrl('addressbooks/', true)->redirect();
 }
 
 $vars->set('name', $addressbook->get('name'));
index 42ab9d9..2b52407 100644 (file)
@@ -17,16 +17,14 @@ $vars = Horde_Variables::getDefaultVariables();
 $source = $vars->get('source');
 if (!isset($GLOBALS['cfgSources'][$source])) {
     $notification->push(_("The contact you requested does not exist."));
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
 }
 
 /* Set the contact from the key requested. */
 $driver = Turba_Driver::singleton($source);
 if ($driver instanceof PEAR_Error) {
     $notification->push($driver->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
 }
 
 $contact = null;
@@ -42,8 +40,7 @@ if (!$contact || ($contact instanceof PEAR_Error)) {
     $contact = $driver->getObject($vars->get('key'));
     if ($contact instanceof PEAR_Error) {
         $notification->push($contact->getMessage(), 'horde.error');
-        header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-        exit;
+        Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
     }
 }
 
index 0ccca96..f2931d0 100644 (file)
@@ -21,13 +21,11 @@ if ($conf['documents']['type'] != 'none') {
     $object = $driver->getObject($key);
     if (is_a($object, 'PEAR_Error')) {
         $notification->push($object->getMessage(), 'horde.error');
-        header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-        exit;
+        Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
     }
     if (is_a($deleted = $object->deleteFiles(), 'PEAR_Error')) {
         $notification->push($deleted, 'horde.error');
-        header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-        exit;
+        Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
     }
 }
 
index 9eeafbb..775acc1 100644 (file)
@@ -20,22 +20,19 @@ if ($conf['documents']['type'] == 'none') {
 $source = Horde_Util::getPost('source');
 if ($source === null || !isset($cfgSources[$source])) {
     $notification->push(_("Not found"), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
 }
 
 $driver = Turba_Driver::singleton($source);
 $contact = $driver->getObject(Horde_Util::getPost('key'));
 if (is_a($contact, 'PEAR_Error')) {
     $notification->push($contact, 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
 }
 
 if (!$contact->isEditable()) {
     $notification->push(_("Permission denied"), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
 }
 
 $file = Horde_Util::getPost('file');
@@ -45,4 +42,4 @@ if (is_a($result, 'PEAR_Error')) {
 } else {
     $notification->push(sprintf(_("The file \"%s\" has been deleted."), $file), 'horde.success');
 }
-$url = header('Location: ' . $contact->url('Contact', true));
+$contact->url('Contact', true)->redirect();
index dd9893e..c8bd0a5 100644 (file)
@@ -20,14 +20,13 @@ $original_source = $vars->get('original_source');
 $key = $vars->get('key');
 $groupedit = $vars->get('actionID') == 'groupedit';
 $objectkeys = $vars->get('objectkeys');
-$url = Horde_Util::getFormData('url', Horde::applicationUrl($prefs->getValue('initial_page'), true));
+$url = new Horde_Url(Horde_Util::getFormData('url', Horde::applicationUrl($prefs->getValue('initial_page'), true));
 
 /* Edit the first of a list of contacts? */
 if ($groupedit && (!$key || $key == '**search')) {
     if (!count($objectkeys)) {
         $notification->push(_("You must select at least one contact first."), 'horde.warning');
-        header('Location: ' . $url);
-        exit;
+        $url->redirect();
     }
     if ($key == '**search') {
         $original_source = $key;
@@ -43,8 +42,7 @@ if ($groupedit && (!$key || $key == '**search')) {
 
 if ($source === null || !isset($cfgSources[$source])) {
     $notification->push(_("Not found"), 'horde.error');
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 }
 
 $driver = Turba_Driver::singleton($source);
@@ -53,20 +51,17 @@ $driver = Turba_Driver::singleton($source);
 $contact = $driver->getObject($key);
 if (is_a($contact, 'PEAR_Error')) {
     $notification->push($contact, 'horde.error');
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 }
 
 /* Check permissions on this contact. */
 if (!$contact->hasPermission(Horde_Perms::EDIT)) {
     if (!$contact->hasPermission(Horde_Perms::READ)) {
         $notification->push(_("You do not have permission to view this contact."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-        exit;
+        $url->redirect();
     } else {
         $notification->push(_("You only have permission to view this contact."), 'horde.error');
-        header('Location: ' . $contact->url('Contact', true));
-        exit;
+        $contact->url('Contact', true)->redirect();
     }
 }
 
@@ -86,8 +81,7 @@ if (!is_a($edited, 'PEAR_Error')) {
     } else {
         $url = new Horde_Url($url, true);
     }
-    header('Location: ' . $url->unique());
-    exit;
+    $url->unique()->redirect();
 }
 
 $title = sprintf(_("Edit \"%s\""), $contact->getValue('name'));
index 5c3b0f8..05dd7e9 100644 (file)
@@ -80,8 +80,10 @@ class Turba_Form_AddContact extends Turba_Form_Contact
                 $ob = $driver->getObject($key);
                 if (!is_a($ob, 'PEAR_Error')) {
                     $notification->push(sprintf(_("%s added."), $ob->getValue('name')), 'horde.success');
-                    header('Location: ' . (!empty($info['url']) ? $info['url'] : $ob->url('Contact', true)));
-                    exit;
+                    $url = empty($info['url'])
+                        ? $ob->url('Contact', true)
+                        : new Horde_Url($info['url']);
+                    $url->redirect();
                 }
                 sleep(1);
             }
index a443caa..d175b98 100644 (file)
@@ -88,8 +88,7 @@ class Turba_Form_EditContactGroup extends Turba_Form_EditContact
             }
         }
 
-        header('Location: ' . $next_page->setRaw(true));
-        exit;
+        $next_page->redirect();
     }
 
 }
index 3bf8c33..6c71b5e 100644 (file)
@@ -331,8 +331,8 @@ class Turba_View_Browse {
             // We might get here from the search page but are not allowed to browse
             // the current address book.
             if ($actionID && empty($cfgSources[$source]['browse'])) {
-                header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-                exit;
+                Horde::applicationUrl($prefs->getValue('initial_page'), true)
+                    ->redirect();
             }
         }
 
index 00b1a3e..10a2852 100644 (file)
@@ -25,28 +25,23 @@ if ($url = Horde_Util::getFormData('url')) {
 $contact = $driver->getObject($mergeInto);
 if (is_a($contact, 'PEAR_Error')) {
     $notification->push($contact);
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 }
 $toMerge = $driver->getObject($key);
 if (is_a($toMerge, 'PEAR_Error')) {
     $notification->push($toMerge);
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 }
 
 $contact->merge($toMerge);
 if (is_a($result = $contact->store(), 'PEAR_Error')) {
     $notification->push($result);
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 }
 if (is_a($result = $driver->delete($key), 'PEAR_Error')) {
     $notification->push($result);
-    header('Location: ' . $url);
-    exit;
+    $url->redirect();
 }
 
 $notification->push(_("Successfully merged two contacts."), 'horde.success');
-header('Location: ' . $url);
-exit;
+$url->redirect();
index cf1b60d..4e3608e 100644 (file)
@@ -141,8 +141,7 @@ if (is_a($driver, 'PEAR_Error')) {
             $vname = Horde_Util::getFormData('vbook_name');
             if (empty($vname)) {
                 $notification->push(_("You must provide a name for virtual address books."), 'horde.error');
-                header('Location: ' . Horde::applicationUrl('search.php', true));
-                exit;
+                Horde::applicationUrl('search.php', true)->redirect();
             }
 
             /* Create the vbook. */
@@ -154,14 +153,13 @@ if (is_a($driver, 'PEAR_Error')) {
             $vid = _createVBook($params);
             if (is_a($vid, 'PEAR_Error')) {
                 $notification->push(sprintf(_("There was a problem creating the virtual address book: %s"), $vid->getMessage()), 'horde.error');
-                header('Location: ' . Horde::applicationUrl('search.php', true));
-                exit;
+                Horde::applicationUrl('search.php', true)->redirect();
             }
             $notification->push(sprintf(_("Successfully created virtual address book \"%s\""), $vname), 'horde.success');
 
-            $url = Horde::applicationURL('browse.php', true)->add('source', $vid);;
-            header('Location: ' . $url->setRaw(true));
-            exit;
+            Horde::applicationUrl('browse.php', true)
+                ->add('source', $vid)
+                ->redirect();
         }
 
         /* Perform a search. */
index 0a5a469..e2168da 100644 (file)
@@ -16,8 +16,7 @@ Horde_Registry::appInit('turba');
 $source = Horde_Util::getFormData('source');
 if (!isset($cfgSources[$source])) {
     $notification->push(_("The contact you requested does not exist."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
 }
 
 $driver = Turba_Driver::singleton($source);
@@ -27,15 +26,13 @@ $key = Horde_Util::getFormData('key');
 $object = $driver->getObject($key);
 if (is_a($object, 'PEAR_Error')) {
     $notification->push($object->getMessage(), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
 }
 
 /* Check permissions on this contact. */
 if (!$object->hasPermission(Horde_Perms::READ)) {
     $notification->push(_("You do not have permission to view this object."), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('initial_page'), true)->redirect();
 }
 
 $filename = str_replace(' ', '_', $object->getValue('name'));
index 185cde4..6b0d2a5 100644 (file)
@@ -30,15 +30,12 @@ if ($vars->get('submitbutton') == _("Delete")) {
             $notification->push(sprintf(_("Error deleting domain. %s."), $delete->getMessage()), 'horde.error');
         } else {
             $notification->push(_("Domain deleted."), 'horde.success');
-            $url = Horde::applicationUrl('domains/index.php', true);
-            header('Location: ' . $url);
-            exit;
+            Horde::applicationUrl('domains/index.php', true)->redirect();
         }
     }
 } elseif ($vars->get('submitbutton') == _("Do not delete")) {
     $notification->push(_("Domain not deleted."), 'horde.message');
-    header('Location: ' . Horde::applicationUrl('domains/index.php'));
-    exit;
+    Horde::applicationUrl('domains/index.php', true)->redirect();
 }
 
 /* Render the form. */
index d45a86f..32cc2c7 100644 (file)
@@ -31,9 +31,7 @@ if ($form->validate($vars)) {
         $notification->push(sprintf(_("Error saving domain: %s."), $domain_id->getMessage()), 'horde.error');
     } else {
         $notification->push(_("Domain saved."), 'horde.success');
-        $url = Horde::applicationUrl('domains/index.php', true);
-        header('Location: ' . $url);
-        exit;
+        Horde::applicationUrl('domains/index.php', true)->redirect();
     }
 }
 
index 2a7c9d4..46d1e11 100644 (file)
@@ -105,28 +105,25 @@ if($groupsCount > 0) {
 }
 $form->addVariable(sprintf(_($desc), $user_name), 'description', 'description', false);
 if ($vars->get('submitbutton') == _("Delete")) {
-    if($type == 'alias') {
+    if ($type == 'alias') {
         if ($form->validate($vars)) {
             $form->getInfo($vars, $info);
             $deleteInfo = array();
-             $deleteInfo['address'] = $address['destination'];
-             $deleteInfo['alias'] = $user_id;
-             $delete = $vilma->driver->deleteAlias($deleteInfo);
+            $deleteInfo['address'] = $address['destination'];
+            $deleteInfo['alias'] = $user_id;
+            $delete = $vilma->driver->deleteAlias($deleteInfo);
             if (is_a($delete, 'PEAR_Error')) {
                 Horde::logMessage($delete, 'ERR');
-                 $notification->push(sprintf(_("Error deleting alias. %s."), $delete->getMessage()), 'horde.error');
-                 $url = Util::addParameter(Horde::applicationUrl('users/index.php'), 'domain_id', $domain['id'], false);
-                 header('Location: ' . $url);
-                 exit;
-             } else {
-                 $notification->push(_("Alias deleted."), 'horde.success');
-                 $url = Util::addParameter(Horde::applicationUrl('users/index.php'), 'domain_id', $domain['id'], false);
-                 header('Location: ' . $url);
-                 exit;
-             }
-         }
-     } elseif ($type == 'forward') {
-      if ($form->validate($vars)) {
+                $notification->push(sprintf(_("Error deleting alias. %s."), $delete->getMessage()), 'horde.error');
+            } else {
+                $notification->push(_("Alias deleted."), 'horde.success');
+            }
+            Horde::applicationUrl('users/index.php')
+                ->add('domain_id', $domain['id'])
+                ->redirect();
+        }
+    } elseif ($type == 'forward') {
+        if ($form->validate($vars)) {
             $form->getInfo($vars, $info);
             $deleteInfo = array();
             $deleteInfo['address'] = $address['destination'];
@@ -135,15 +132,12 @@ if ($vars->get('submitbutton') == _("Delete")) {
             if (is_a($delete, 'PEAR_Error')) {
                 Horde::logMessage($delete, 'ERR');
                 $notification->push(sprintf(_("Error deleting forward. %s."), $delete->getMessage()), 'horde.error');
-                $url = Horde_Util::addParameter(Horde::applicationUrl('users/index.php'), 'domain_id', $domain['id'], false);
-                header('Location: ' . $url);
-                exit;
             } else {
                 $notification->push(_("Forward deleted."), 'horde.success');
-                $url = Horde_Util::addParameter(Horde::applicationUrl('users/index.php'), 'domain_id', $domain['id'], false);
-                header('Location: ' . $url);
-                exit;
             }
+            Horde::applicationUrl('users/index.php')
+                ->add('domain_id', $domain['id'])
+                ->redirect();
         }
     } else {
         if ($form->validate($vars)) {
@@ -153,22 +147,19 @@ if ($vars->get('submitbutton') == _("Delete")) {
             if (is_a($delete, 'PEAR_Error')) {
                 Horde::logMessage($delete, 'ERR');
                 $notification->push(sprintf(_("Error deleting user. %s."), $delete->getMessage()), 'horde.error');
-                $url = Horde_Util::addParameter(Horde::applicationUrl('users/index.php'), 'domain_id', $domain['id'], false);
-                header('Location: ' . $url);
-                exit;
             } else {
                 $notification->push(_("$type deleted."), 'horde.success');
-                $url = Horde_Util::addParameter(Horde::applicationUrl('users/index.php'), 'domain_id', $domain['id'], false);
-                header('Location: ' . $url);
-                exit;
             }
+            Horde::applicationUrl('users/index.php')
+                ->add('domain_id', $domain['id'])
+                ->redirect();
         }
     }
 } elseif ($vars->get('submitbutton') == _("Do not delete")) {
     $notification->push(_("User not deleted."), 'horde.message');
-    $url = Horde_Util::addParameter(Horde::applicationUrl('users/index.php'), 'domain_id', $domain['domain_id'], false);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('users/index.php')
+        ->add('domain_id', $domain['id'])
+        ->redirect();
 }
 
 /* Render the form. */
index c38bf7c..83dfd95 100644 (file)
@@ -23,36 +23,37 @@ $vars = Variables::getDefaultVariables();
 
 /* If the form is submitted, $vars['mode'] will be set. Catch this and process the submission so that the displayed form accurately indicates the result of the transaction. */
 if ($vars->exists('mode')) {
-  Horde::logMessage("Submit Detected: " . print_r(serialize($vars), true), 'DEBUG');
-  $form = &new EditAliasForm($vars);
+    Horde::logMessage("Submit Detected: " . print_r(serialize($vars), true), 'DEBUG');
+    $form = &new EditAliasForm($vars);
 
-  if ($form->validate($vars)) {
-      $form->getInfo($vars, $info);
-      $alias_id = $vilma->driver->saveAlias($info);
-      if (is_a($alias_id, 'PEAR_Error')) {
-          Horde::logMessage($user_id, 'ERR');
-          $notification->push(sprintf(_("Error saving alias. %s"), $alias_id->getMessage()), 'horde.error');
-          // remove the mode, and rearrange the alias information to clean up the form.
-          $vars->remove('mode');
-          $vars->add('retry', true);
-          if ($vars->exists('alias')) {
-            $vars->remove('alias_address');
-          } elseif ($vars->exists('address')) {
-            $vars->remove('alias_address');
-            $vars->remove('alias');
-          }
-      } else {
-          $notification->push(_("Alias saved."), 'horde.success');
-          $url = Util::addParameter(Horde::applicationUrl('users/index.php'), 'domain_id', $domain['id'], false);
-          header('Location: ' . $url);
-          exit;
-      }
-  }
-} // if
+    if ($form->validate($vars)) {
+        $form->getInfo($vars, $info);
+        $alias_id = $vilma->driver->saveAlias($info);
+        if (is_a($alias_id, 'PEAR_Error')) {
+            Horde::logMessage($user_id, 'ERR');
+            $notification->push(sprintf(_("Error saving alias. %s"), $alias_id->getMessage()), 'horde.error');
+            // remove the mode, and rearrange the alias information to clean
+            // up the form.
+            $vars->remove('mode');
+            $vars->add('retry', true);
+            if ($vars->exists('alias')) {
+                $vars->remove('alias_address');
+            } elseif ($vars->exists('address')) {
+                $vars->remove('alias_address');
+                $vars->remove('alias');
+            }
+        } else {
+            $notification->push(_("Alias saved."), 'horde.success');
+            Horde::applicationUrl('users/index.php')
+                ->add('domain_id', $domain['id'])
+                ->redirect();
+        }
+    }
+}
 
 /* Check if a form is being edited. */
 if (!$vars->exists('mode') || $vars->getExists('retry')) {
-  Horde::logMessage("No-Submit Detected: " . print_r(serialize($vars), true), 'DEBUG');
+    Horde::logMessage("No-Submit Detected: " . print_r(serialize($vars), true), 'DEBUG');
     if ($vars->exists("alias")) {
         $alias = $vars->get("alias");
         Horde::logMessage("Alias Detected: $alias", 'DEBUG');
index 0affc5d..7bfe881 100644 (file)
@@ -31,7 +31,7 @@ $tabs = Vilma::getUserMgrTabs($vars);
 $addresses = $vilma->driver->getAddresses($curdomain['domain_name'], $section);
 if (is_a($addresses, 'PEAR_Error')) {
     $notification->push($addresses);
-    header('Location: ' . Horde::applicationUrl('index.php'));
+    Horde::applicationUrl('index.php')->redirect();
 }
 
 // Page results
index a73fdfd..1b35457 100644 (file)
@@ -40,16 +40,16 @@ if ($vars->get('submitbutton') == _("Delete")) {
             $notification->push(sprintf(_("Error deleting virtual email. %s."), $delete->getMessage()), 'horde.error');
         } else {
             $notification->push(_("Virtual email deleted."), 'horde.success');
-            $url = Horde_Util::addParameter(Horde::applicationUrl('virtuals/index.php'), 'domain_id', $domain['domain_id'], false);
-            header('Location: ' . $url);
-            exit;
+            Horde::applicationUrl('virtuals/index.php')
+                ->add('domain_id', $domain['domain_id'])
+                ->redirect();
         }
     }
 } elseif ($vars->get('submitbutton') == _("Do not delete")) {
     $notification->push(_("Virtual email not deleted."), 'horde.message');
-    $url = Horde_Util::addParameter(Horde::applicationUrl('virtuals/index.php'), 'domain_id', $domain['domain_id'], false);
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('virtuals/index.php')
+        ->add('domain_id', $domain['domain_id'])
+        ->redirect();
 }
 
 /* Render the form. */
index 987f866..245fdef 100644 (file)
@@ -72,9 +72,9 @@ if ($form->validate($vars)) {
         $notification->push(sprintf(_("Error saving virtual email. %s."), $virtual_id->getMessage()), 'horde.error');
     } else {
         $notification->push(_("Virtual email saved."), 'horde.success');
-        $url = Horde::applicationUrl('virtuals/index.php', true);
-        header('Location: ' . Horde_Util::addParameter($url, 'user', $info['virtual_destination'], false));
-        exit;
+        Horde::applicationUrl('virtuals/index.php')
+            ->add('user', $info['virtual_destination'])
+            ->redirect();
     }
 }
 
index f8e9bb8..9632583 100644 (file)
@@ -27,7 +27,7 @@ if (!empty($user)) {
 
 if (is_a($virtuals, 'PEAR_Error')) {
     $notification->push($virtuals);
-    header('Location: ' . Horde::applicationUrl('index.php'));
+    Horde::applicationUrl('index.php')->redirect();
 }
 
 foreach ($virtuals as $id => $virtual) {
index 3c6413b..0949ea2 100644 (file)
@@ -195,8 +195,7 @@ case 'clonetypeform':
         $notification->push(sprintf(_("Successfully Cloned %s to %s."),
                                     $type['name'], $vars->get('name')),
                             'horde.success');
-        header('Location: ' . Horde::applicationUrl('admin/?action=type', true));
-        exit;
+        Horde::applicationUrl('admin/?action=type', true)->redirect();
     } else {
         _open();
         $form->renderActive($renderer, $vars, $adminurl, 'post');
index 6a5b282..4c84a0f 100644 (file)
@@ -14,8 +14,7 @@ Horde_Registry::appInit('whups');
 require WHUPS_BASE . '/config/templates.php';
 
 if (!$GLOBALS['registry']->getAuth()) {
-    header('Location: ' . Horde::applicationUrl('search.php', true));
-    exit;
+    Horde::applicationUrl('search.php', true)->redirect();
 }
 
 $tpl = Horde_Util::getFormData('template');
index 5b07809..8ca2731 100644 (file)
@@ -529,8 +529,7 @@ class Whups_Ticket {
      */
     function show()
     {
-        header('Location: ' . Whups::urlFor('ticket', $this->_id, true));
-        exit;
+        Whups::urlFor('ticket', $this->_id, true)->redirect();
     }
 
     /**
index d372470..5b88390 100644 (file)
@@ -261,8 +261,8 @@ class Whups {
         $id = preg_replace('|\D|', '', Horde_Util::getFormData('id'));
         if (!$id) {
             $GLOBALS['notification']->push(_("Invalid Ticket Id"), 'horde.error');
-            header('Location: ' . Horde::applicationUrl($GLOBALS['prefs']->getValue('whups_default_view') . '.php', true));
-            exit;
+            Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+                ->redirect();
         }
 
         $ticket = Whups_Ticket::makeTicket($id);
@@ -270,14 +270,11 @@ class Whups {
             if ($ticket->code === 0) {
                 // No permissions to this ticket.
                 $GLOBALS['notification']->push($ticket->getMessage(), 'horde.warning');
-                $url = Horde::applicationUrl($GLOBALS['prefs']->getValue('whups_default_view') . '.php', true);
             } else {
                 $GLOBALS['notification']->push($ticket->getMessage(), 'horde.error');
-                $url = Horde::applicationUrl($GLOBALS['prefs']->getValue('whups_default_view') . '.php', true);
             }
-
-            header('Location: ' . $url);
-            exit;
+            Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+                ->redirect();
         }
 
         return $ticket;
index 1ef651a..aae5028 100644 (file)
@@ -28,8 +28,8 @@ if (isset($_SESSION['whups']['query'])) {
     $whups_query = unserialize($_SESSION['whups']['query']);
     if (!$whups_query->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
         $notification->push(_("Permission denied."), 'horde.error');
-        header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
-        exit;
+        Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+            ->redirect();
     }
 } else {
     $whups_query = $qManager->newQuery();
index 8631149..1dd7d2a 100644 (file)
@@ -42,8 +42,8 @@ if (!isset($whups_query) ||
     } elseif (isset($whups_query)) {
         $notification->push(_("Permission denied."), 'horde.error');
     }
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+        ->redirect();
 }
 
 // Query actions.
index ccffc79..c580a4e 100644 (file)
@@ -25,8 +25,8 @@ if ($slug) {
 
 if (!$id || is_a($queue, 'PEAR_Error')) {
     $notification->push(_("Invalid queue"), 'horde.error');
-    header('Location: ' . Horde::applicationUrl(basename($prefs->getValue('whups_default_view')) . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+        ->redirect();
 }
 
 // Update sorting preferences.
index a0a7d36..bb7c622 100644 (file)
@@ -130,8 +130,9 @@ if (($vars->get('formname') || $vars->get('summary') || $vars->get('states') ||
             }
         }
         $_SESSION['whups']['query'] = serialize($whups_query);
-        header('Location: ' . Horde::applicationUrl(Horde_Util::addParameter('query/index.php', 'action', 'save'), true));
-        exit;
+        Horde::applicationUrl('query/index.php', true)
+            ->add('action', 'save')
+            ->redirect();
     }
     $tickets = $whups_driver->getTicketsByProperties($info);
     if (is_a($tickets, 'PEAR_Error')) {
index e2d3d17..4733163 100644 (file)
@@ -52,11 +52,10 @@ if ($valid1 && $valid2 && $valid3 &&
         $notification->push(sprintf(_("Adding your ticket failed: %s."),
                                     $ticket->getMessage()),
                             'horde.error');
-        header('Location: ' . Horde::applicationUrl('ticket/create.php', true));
-    } else {
-        $notification->push(sprintf(_("Your ticket ID is %s. An appropriate person has been notified of this request."), $ticket->getId()), 'horde.success');
-        $ticket->show();
+        Horde::applicationUrl('ticket/create.php', true)->redirect();
     }
+    $notification->push(sprintf(_("Your ticket ID is %s. An appropriate person has been notified of this request."), $ticket->getId()), 'horde.success');
+    $ticket->show();
     exit;
 }
 
index d0c65cf..973c99e 100644 (file)
@@ -45,8 +45,8 @@ $ticket = Whups::getCurrentTicket();
 $details = $ticket->getDetails();
 if (!Whups::hasPermission($details['queue'], 'queue', Horde_Perms::DELETE)) {
     $notification->push(_("Permission Denied"), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+        ->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -65,11 +65,10 @@ if ($vars->get('formname') == 'deleteticketform') {
 
             if (!is_a($result, 'PEAR_Error')) {
                 $notification->push(sprintf(_("Ticket %d has been deleted."), $info['id']), 'horde.success');
-                header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
-                exit;
-            } else {
-                $notification->push(_("There was an error deleting the ticket:") . ' ' . $result->getMessage(), 'horde.error');
+                Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+                    ->redirect();
             }
+            $notification->push(_("There was an error deleting the ticket:") . ' ' . $result->getMessage(), 'horde.error');
         } else {
             $notification->push(_("The ticket was not deleted."), 'horde.message');
         }
index d9b0edb..aef0695 100644 (file)
@@ -15,8 +15,8 @@ Horde_Registry::appInit('whups');
 $ticket = Whups::getCurrentTicket();
 if (!Whups::hasPermission($ticket->get('queue'), 'queue', Horde_Perms::DELETE)) {
     $notification->push(_("Permission Denied"), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+        ->redirect();
 }
 
 $file = basename(Horde_Util::getFormData('file'));
@@ -31,5 +31,6 @@ if (is_a($result, 'PEAR_Error')) {
 if ($url = Horde_Util::getFormData('url')) {
     header('Location: ' . $url);
 } else {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
+    Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+        ->redirect();
 }
index b7973d3..da984b8 100644 (file)
@@ -14,8 +14,8 @@ Horde_Registry::appInit('whups');
 $ticket = Whups::getCurrentTicket();
 if (!Whups::hasPermission($ticket->get('queue'), 'queue', Horde_Perms::DELETE)) {
     $notification->push(_("Permission Denied"), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+        ->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -29,5 +29,6 @@ if (is_a($result, 'PEAR_Error')) {
 if ($url = Horde_Util::getFormData('url')) {
     header('Location: ' . $url);
 } else {
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
+    Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+        ->redirect();
 }
index 3bdfb4d..0787314 100644 (file)
@@ -125,8 +125,8 @@ foreach ($ticket->getDetails() as $varname => $value) {
 // Check permissions on this ticket.
 if (!Whups::hasPermission($ticket->get('queue'), 'queue', Horde_Perms::DELETE)) {
     $notification->push(_("Permission Denied"), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+        ->redirect();
 }
 
 $form = $vars->get('formname');
index 6e2fee0..03bb182 100644 (file)
@@ -68,8 +68,8 @@ $ticket = Whups::getCurrentTicket();
 $details = $ticket->getDetails();
 if (!Whups::hasPermission($details['queue'], 'queue', 'update')) {
     $notification->push(_("Permission Denied"), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+        ->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
index e7ee12c..318aae3 100644 (file)
@@ -16,8 +16,8 @@ $ticket = Whups::getCurrentTicket();
 
 if (!Whups::hasPermission($ticket->get('queue'), 'queue', 'update')) {
     $notification->push(_("Permission Denied"), 'horde.error');
-    header('Location: ' . Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true));
-    exit;
+    Horde::applicationUrl($prefs->getValue('whups_default_view') . '.php', true)
+        ->redirect();
 }
 
 $vars = Horde_Variables::getDefaultVariables();
index a0c442d..a90fee5 100644 (file)
@@ -24,10 +24,9 @@ $details = $whups_driver->getTicketDetails($id);
 if (is_a($details, 'PEAR_Error')) {
     if ($details->code === 0) {
         // No permissions to this ticket.
-        $url = Horde::url($registry->get('webroot', 'horde') . '/login.php', true);
-        $url = Horde_Util::addParameter($url, 'url', Horde::selfUrl(true));
-        header('Location: ' . $url);
-        exit;
+        Horde::url($registry->get('webroot', 'horde') . '/login.php', true)
+            ->add('url', Horde::selfUrl(true))
+            ->redirect();
     } else {
         Horde::fatal($details->getMessage(), __FILE__, __LINE__);
     }
index 2335375..f72164d 100644 (file)
@@ -17,10 +17,9 @@ $v2 = Horde_Util::getFormData('v2');
 /* Bail out if we didn't get any versions - at least one of these has
  * to be non-empty. */
 if (!$v1 && !$v2) {
-    $url = Horde::applicationUrl('history.php', true);
-    $url = Horde_Util::addParameter($url, 'page', Horde_Util::getFormData('page'));
-    header('Location: ' . $url);
-    exit;
+    Horde::applicationUrl('history.php', true)
+        ->add('page', Horde_Util::getFormData('page'))
+        ->redirect();
 }
 
 /* Make sure that $v2 is a higher version than $v1. Empty string is
@@ -35,8 +34,7 @@ if (!$v1 || ($v2 && version_compare($v1, $v2) > 0) || $v2 == '?') {
 $page = Page::getPage(Horde_Util::getFormData('page'), $v2);
 if (is_a($page, 'PEAR_Error')) {
     $notification->push(sprintf(_("Internal error viewing requested page: %s"), $page->getMessage()), 'horde.error');
-    header('Location: ' . Wicked::url('WikiHome', true));
-    exit;
+    Wicked::url('WikiHome', true)->redirect();
 }
 
 if ($v1 == '?') {
@@ -46,9 +44,9 @@ if ($v1 == '?') {
 /* Kick back to the display page if we're not allowed to diff this
  * page. */
 if (!$page->allows(WICKED_MODE_DIFF)) {
-    $url = Horde_Util::addParameter(Wicked::url($page->pageName(), true), 'actionID', 'diff');
-    header('Location: ' . $url);
-    exit;
+    Wicked::url($page->pageName(), true)
+        ->add('actionID', 'diff')
+        ->redirect();
 }
 
 $title = sprintf(_("Diff for %s between %s and %s"), $page->pageName(), $v1, $page->version());
index f7a258c..17a1fbb 100644 (file)
@@ -50,10 +50,9 @@ case 'unlock':
 case 'history':
     if ($page->allows(WICKED_MODE_HISTORY)) {
         /* Redirect to history page. */
-        $url = Horde::applicationUrl('history.php', true);
-        $url = Horde_Util::addParameter($url, 'page', $page->pageName());
-        header('Location: ' . $url);
-        exit;
+        Horde::applicationUrl('history.php')
+            ->add('page', $page->pageName())
+            ->redirect();
     }
     $notification->push(_("This page does not have a history"), 'horde.error');
     break;
@@ -68,10 +67,8 @@ case 'export':
                             'horde.error');
         if ($page->pageName() == 'WikiHome') {
             Horde::fatal(_("You don't have permission to view this page."), __FILE__, __LINE__);
-        } else {
-            header('Location: ' . Wicked::url('WikiHome', true));
         }
-        exit;
+        Wicked::url('WikiHome', true)->redirect();
     }
 
     switch (Horde_Util::getGet('format')) {
@@ -114,10 +111,8 @@ if (!$page->allows(WICKED_MODE_DISPLAY)) {
                         'horde.error');
     if ($page->pageName() == 'WikiHome') {
         Horde::fatal(_("You don't have permission to view this page."), __FILE__, __LINE__);
-    } else {
-        header('Location: ' . Wicked::url('WikiHome', true));
     }
-    exit;
+    Wicked::url('WikiHome', true)->redirect();
 }
 
 $params = Horde_Util::getFormData('params');
index d84900c..808561e 100644 (file)
@@ -14,15 +14,12 @@ Horde_Registry::appInit('wicked');
 $page = Page::getCurrentPage();
 if (is_a($page, 'PEAR_Error')) {
     $notification->push(_("Internal error viewing requested page"), 'horde.error');
-    header('Location: ' . Wicked::url('WikiHome', true));
-    exit;
+    Wicked::url('WikiHome', true)->redirect();
 }
 
 if (!$page->allows(WICKED_MODE_HISTORY)) {
     /* Redirect to display page and force it to display an error. */
-    $url = Horde_Util::addParameter(Wicked::url($page->pageName(), true), 'actionID', 'history');
-    header('Location: ' . $url);
-    exit;
+    Wicked::url($page->pageName(), true)->add('actionID', 'history')->redirect();
 }
 
 $title = sprintf(_("History: %s"), $page->pageName());
index 95afcb6..83ce23c 100644 (file)
@@ -49,8 +49,7 @@ class AddPage extends Page {
     {
         if (!strlen($this->referrer())) {
             $GLOBALS['notification']->push(_("Page name must not be empty"));
-            header('Location: ' . Wicked::url('', true));
-            exit;
+            Wicked::url('', true)->redirect();
         }
     }
 
index 2fa29bb..313bd3e 100644 (file)
@@ -58,8 +58,7 @@ class DeletePage extends Page {
     {
         $page = Page::getPage($this->referrer());
         if (!$page->allows(WICKED_MODE_REMOVE)) {
-            header('Location: ' . Wicked::url($this->referrer(), true));
-            exit;
+            Wicked::url($this->referrer(), true)->redirect();
         }
     }
 
@@ -73,8 +72,7 @@ class DeletePage extends Page {
         $version = Horde_Util::getFormData('version');
         $page = Page::getPage($this->referrer(), $version);
         if (!$page->isValid()) {
-            header('Location: ' . Wicked::url('WikiHome', true));
-            exit;
+            Wicked::url('WikiHome', true)->redirect();
         }
 
         if (empty($version)) {
@@ -134,20 +132,17 @@ class DeletePage extends Page {
                 $GLOBALS['notification']->push(sprintf(_("Successfully deleted \"%s\"."), $pagename), 'horde.success');
                 Wicked::mail("Deleted page: $pagename\n",
                              array('Subject' => '[' . $GLOBALS['registry']->get('name') . '] deleted: ' . $pagename));
-                header('Location: ' . Wicked::url('WikiHome', true));
-            } else {
-                $GLOBALS['wicked']->removeVersion($pagename, $version);
-                $GLOBALS['notification']->push(sprintf(_("Deleted version %s of \"%s\"."), $version, $pagename), 'horde.success');
-                Wicked::mail("Deleted version: $version of $pagename\n",
-                             array('Subject' => '[' . $GLOBALS['registry']->get('name') . '] deleted: ' . $pagename . ' [' . $version . ']'));
-                header('Location: ' . Wicked::url($pagename, true));
+                Wicked::url('WikiHome', true)->redirect();
             }
-            exit;
+            $GLOBALS['wicked']->removeVersion($pagename, $version);
+            $GLOBALS['notification']->push(sprintf(_("Deleted version %s of \"%s\"."), $version, $pagename), 'horde.success');
+            Wicked::mail("Deleted version: $version of $pagename\n",
+                         array('Subject' => '[' . $GLOBALS['registry']->get('name') . '] deleted: ' . $pagename . ' [' . $version . ']'));
+            Wicked::url($pagename, true)->redirect();
         }
 
         $GLOBALS['notification']->push(sprintf(_("You don't have permission to delete \"%s\"."), $pagename), 'horde.warning');
-        header('Location: ' . Wicked::url($this->referrer(), true));
-        exit;
+        Wicked::url($this->referrer(), true)->redirect();
     }
 
 }
index 72fb40b..9fd3db4 100644 (file)
@@ -83,8 +83,7 @@ class EditPage extends Page {
     function preDisplay()
     {
         if (!$this->allows(WICKED_MODE_EDIT)) {
-            header('Location: ' . Wicked::url($this->referrer(), true));
-            exit;
+            Wicked::url($this->referrer(), true)->redirect();
         }
         if ($this->allows(WICKED_MODE_LOCKING)) {
             $page = Page::getPage($this->referrer());
@@ -193,8 +192,7 @@ class EditPage extends Page {
         }
 
         // Show the newly saved page.
-        header('Location: ' . Wicked::url($this->referrer(), true));
-        exit;
+        Wicked::url($this->referrer(), true)->redirect();
     }
 
 }
index f92d6f5..b0fcf47 100644 (file)
@@ -158,8 +158,7 @@ class MergeOrRename extends Page {
         global $wicked, $notification, $registry;
 
         if (Horde_Util::getFormData('submit') == _("Cancel")) {
-            header('Location: ' . Wicked::url($this->referrer(), true));
-            exit;
+            Wicked::url($this->referrer(), true)->redirect();
         }
 
         $referrer = $this->referrer();
@@ -298,8 +297,7 @@ class MergeOrRename extends Page {
             }
         }
 
-        header('Location: ' . Wicked::url($new_name, true));
-        exit;
+        Wicked::url($new_name, true)->redirect();
     }
 
 }
index e5cbe4c..a81d4da 100644 (file)
@@ -68,13 +68,11 @@ class NewPage extends Page {
     {
         if (!strlen($this->referrer())) {
             $GLOBALS['notification']->push(_("Page name must not be empty"));
-            header('Location: ' . Wicked::url('', true));
-            exit;
+            Wicked::url('', true)->redirect();
         }
 
         if (!$this->allows(WICKED_MODE_EDIT)) {
-            header('Location: ' . Wicked::url($this->referrer(), true));
-            exit;
+            Wicked::url($this->referrer(), true)->redirect();
         }
     }
 
@@ -139,8 +137,7 @@ class NewPage extends Page {
         }
 
         // Show the newly created page.
-        header('Location: ' . Wicked::url($this->referrer(), true));
-        exit;
+        Wicked::url($this->referrer(), true)->redirect();
     }
 
 }
index 76af97a..b06ddd4 100644 (file)
@@ -52,8 +52,7 @@ class RevertPage extends Page {
     {
         $page = Page::getPage($this->referrer());
         if (!$page->allows(WICKED_MODE_EDIT)) {
-            header('Location: ' . Wicked::url($this->referrer(), true));
-            exit;
+            Wicked::url($this->referrer(), true)->redirect();
         }
     }
 
@@ -116,21 +115,18 @@ class RevertPage extends Page {
             $version = Horde_Util::getPost('version');
             if (empty($version)) {
                 $notification->push(sprintf(_("Can't revert to an unknown version.")), 'horde.error');
-                header('Location: ' . Wicked::url($this->referrer(), true));
-            } else {
-                $oldpage = Page::getPage($this->referrer(), $version);
-                $minor = substr($page->version(), 0, strpos($page->version(), '.')) ==
-                    substr($oldpage->version(), 0, strpos($oldpage->version(), '.'));
-                $page->updateText($oldpage->getText(), 'Revert', $minor);
-                $notification->push(sprintf(_("Reverted to version %s of \"%s\"."), $version, $page->pageName()));
-                header('Location: ' . Wicked::url($page->pageName(), true));
+                Wicked::url($this->referrer(), true)->redirect();
             }
-            exit;
+            $oldpage = Page::getPage($this->referrer(), $version);
+            $minor = substr($page->version(), 0, strpos($page->version(), '.')) ==
+                substr($oldpage->version(), 0, strpos($oldpage->version(), '.'));
+            $page->updateText($oldpage->getText(), 'Revert', $minor);
+            $notification->push(sprintf(_("Reverted to version %s of \"%s\"."), $version, $page->pageName()));
+            Wicked::url($page->pageName(), true)->redirect();
         }
 
         $notification->push(sprintf(_("You don't have permission to edit \"%s\"."), $page->pageName()), 'horde.warning');
-        header('Location: ' . Wicked::url($this->referrer(), true));
-        exit;
+        Wicked::url($this->referrer(), true)->redirect();
     }
 
 }
index fe2ef3e..01b56c2 100644 (file)
@@ -291,8 +291,7 @@ class SyncPages extends Page {
                 $GLOBALS['prefs']->setValue('sync_data', serialize($data));
                 $GLOBALS['notification']->push(_("Sync login info was stored"), 'horde.success');
 
-                header('Location: ' . Wicked::url('SyncPages', true));
-                exit;
+                Wicked::url('SyncPages', true)->redirect();
 
             case _("Remove login info"):
                 $data = unserialize($GLOBALS['prefs']->getValue('sync_data'));
@@ -301,8 +300,7 @@ class SyncPages extends Page {
                 $GLOBALS['prefs']->setValue('sync_data', serialize($data));
                 $GLOBALS['notification']->push(_("Sync login info was removed."), 'horde.success');
 
-                header('Location: ' . Wicked::url('SyncPages', true));
-                exit;
+                Wicked::url('SyncPages', true)->redirect();
             }
         }
 
@@ -394,8 +392,7 @@ class SyncPages extends Page {
         $GLOBALS['notification']->push(sprintf(_("Page \"%s\" was sucessfuly downloaded from remote to local wiki."), $pageName), 'horde.success');
 
         // Show the newly saved page.
-        header('Location: ' . Wicked::url($pageName, true));
-        exit;
+        Wicked::url($pageName, true)->redirect();
     }
 
     /**
@@ -424,8 +421,7 @@ class SyncPages extends Page {
         $GLOBALS['notification']->push(sprintf(_("Page \"%s\" was sucessfully uploaded from local to remote wiki."), $pageName), 'horde.success');
 
         // Show the newly updated page.
-        header('Location: ' . Wicked::url($pageName, true));
-        exit;
+        Wicked::url($pageName, true)->redirect();
     }
 
     /**