$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 */
/* 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. */
$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. */
} else {
$notification->push(_("Forum not deleted."), 'horde.message');
}
- header('Location: ' . $url);
- exit;
+ Horde::applicationUrl('forums.php', true)->redirect();
}
/* Set up template variables. */
/* 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);
$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;
}
$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? */
$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 */
$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 */
$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 */
$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. */
$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 */
$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 */
$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 */
$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 */
$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');
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. */
$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 */
$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 */
$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'])) {
/* 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. */
$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'];
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();
$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();
}
}
}
$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();
}
}
}
$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");
}
}
-header('Location: ' . $url);
-exit;
+$url->redirect();
$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);
$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) {
$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])) {
$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'];
// 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')) {
/* 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');
// 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();
/* 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. */
$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');
}
/* 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")) {
$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);
/* 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;
}
/* 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")) {
$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);
} 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();
// 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();
$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();
// 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);
$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();
// 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);
}
}
- header('Location: ' . Horde::applicationUrl('ledgers/', true));
- exit;
+ Horde::applicationUrl('ledgers/', true)->redirect();
}
$vars->set('name', $ledger->get('name'));
$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;
$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;
$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) {
}
/* 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. */
$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');
}
/* 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;
// 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.
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;
$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();
}
}
$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');
$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(
$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');
} else {
$folks_driver->logActivity(_("Updated his/her profile picture."));
}
- header('Location: ' . Horde::applicationUrl('edit/edit.php'));
- exit;
+ Horde::applicationUrl('edit/edit.php')->redirect();
}
break;
// 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
$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';
$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);
} 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();
}
}
}
$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';
$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();
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');
$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();
$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);
$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();
}
}
}
$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;
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);
$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();
}
}
$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();
}
}
$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');
$friends->sendNotification($user, $title, $body);
-header('Location: ' . Horde::applicationUrl('edit/friends/index.php'));
-exit;
+Horde::applicationUrl('edit/friends/index.php')->redirect();
$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"),
$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
$notification->push($result);
} else {
$notification->push(_("Activity successfully posted"), 'horde.success');
- header('Location: ' . Horde::applicationUrl('friends.php'));
- exit;
+ Horde::applicationUrl('friends.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();
}
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';
$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?");
} 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';
$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')) {
$notification->push($result);
} else {
$notification->push(_("Search criteria deleted."), 'horde.success');
- header('Location: ' . Horde::applicationUrl('search.php'));
- exit;
+ Horde::applicationUrl('search.php')->redirect();
}
}
$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
$notification->push($result);
} else {
$notification->push(_("Activity successfully posted"), 'horde.success');
- header('Location: ' . Horde::applicationUrl('user.php'));
- exit;
+ Horde::applicationUrl('user.php')->redirect();
}
}
}
if (!empty($url)) {
$url = new Horde_Url($url);
- header('Location: ' . strval($url->unique()->setRaw(true)));
+ $url->unique()->redirect();
}
}
$_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();
} 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;
$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();
$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;
$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)) {
'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(
}
}
- header('Location: ' . Horde::applicationUrl('time.php'));
- exit;
+ Horde::applicationUrl('time.php')->redirect();
}
require HERMES_TEMPLATES . '/common-header.inc';
$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");
}
/* Redirect back. */
-$url = Horde::applicationUrl($url, true);
-header('Location: ' . $url);
-exit;
+Horde::applicationUrl($url, true)->redirect();
$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");
} 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. */
$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");
/* 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. */
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);
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);
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;
/* 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. */
/* 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. */
$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. */
$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. */
/* 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 = '';
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. */
$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. */
/* 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. */
/* 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. */
/* 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);
$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. */
}
}
- 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'));
}
}
- 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"));
$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. */
$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();
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();
}
}
}
$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();
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']);
$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. */
$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. */
$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();
$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. */
$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();
}
}
$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);
$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. */
/* 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. */
$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);
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 */
|| $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();
}
}
|| $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();
}
}
} else {
$url = $this->urlFor(array('controller' => 'index', 'action' => 'login'));
}
- header('Location: ' . $url);
- exit;
+ $url->redirect();
}
}
}
{
$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");
} 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()) {
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();
}
}
$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) {
$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();
$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) {
$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) {
}
if (isset($registry)) {
- header('Location: ' . $registry->get('webroot', 'koward'));
+ $registry->get('webroot', 'koward')->redirect();
}
}
$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.
$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. */
$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)) {
$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);
$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);
/* 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);
}
/* 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. */
}
/* 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);
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'];
$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. */
$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
// 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();
$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();
// 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);
$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();
// 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 = $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);
}
}
- header('Location: ' . Horde::applicationUrl('notepads/', true));
- exit;
+ Horde::applicationUrl('notepads/', true)->redirect();
}
$vars->set('name', $notepad->get('name'));
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");
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'];
$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. */
$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. */
} 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);
}
/* 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';
/* 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. */
$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');
}
/* 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")) {
$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. */
$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. */
/* 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;
$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();
// 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();
$notification->push($e, 'horde.error');
}
- header('Location: ' . Horde::applicationUrl('tasklists/', true));
- exit;
+ Horde::applicationUrl('tasklists/', true)->redirect();
}
$title = $form->getTitle();
// 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);
$notification->push($e, 'horde.error');
}
- header('Location: ' . Horde::applicationUrl('tasklists/', true));
- exit;
+ Horde::applicationUrl('tasklists/', true)->redirect();
}
$title = $form->getTitle();
// 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 = $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);
$notification->push($e, 'horde.error');
}
- header('Location: ' . Horde::applicationUrl('tasklists/', true));
- exit;
+ Horde::applicationUrl('tasklists/', true)->redirect();
}
$vars->set('name', $tasklist->get('name'));
$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;
$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;
$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. */
/* 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 */
$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. */
$notification->push($sources);
} else {
News::deleteImage($id);
- header('Location: ' . News::getUrlFor('news', $id));
- exit;
+ News::getUrlFor('news', $id)->redirect();
}
}
$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
$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
$notification->push(_("News updated."), 'horde.success');
}
- header('Location: ' . $url);
- exit;
+ $url->redirect();
} elseif ($id && !$form->isSubmitted()) {
} 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';
$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();
}
}
} 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';
$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();
}
}
// 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
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();
$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';
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();
}
- 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';
$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);
$notification->push(sprintf(_("News \"%s\" (%s): %s"), $article['title'], $id, _("picture deleted")), 'horde.success');
}
- header('Location: ' . $browse_url);
- exit;
+ $browse_url->redirect();
break;
}
$notification->push(sprintf(_("News \"%s\" (%s): %s"), $article['title'], $id, _("deactivated")), 'horde.success');
- header('Location: ' . $browse_url);
- exit;
+ $browse_url->redirect();
break;
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';
}
$notification->push(sprintf(_("News \"%s\" (%s): %s"), $article['title'], $id, _("locked")), 'horde.success');
- header('Location: ' . $browse_url);
- exit;
+ $browse_url->redirect();
break;
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';
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");
$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()) {
$notification->push($e);
}
-header('Location: ' . News::getUrlFor('news', $id));
-exit;
+News::getUrlFor('news', $id)->redirect();
// 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
$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"
header('Location: ' . $registry->getInitialPage('mnemo'));
} catch (Horde_Exception $e) {
$notification->push($e);
- header('Location: ' . News::getUrlFor('news', $id));
+ News::getUrlFor('news', $id)->redirect();
}
// 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.
// 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();
}
$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');
}
$menus = $shout->storage->getMenus($curaccount['code']);
if (empty($menus)) {
- header('Location: ' . Horde::applicationUrl('wizard.php', true));
+ Horde::applicationUrl('wizard.php', true)->redirect();
}
switch($action) {
$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();
$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
/* 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();
$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;
}
// 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();
$prefs->setValue('display_classes', serialize($GLOBALS['display_classes']));
}
- header('Location: ' . Horde::applicationUrl('classes/', true));
- exit;
+ Horde::applicationUrl('classes/', true)->redirect();
}
$title = $form->getTitle();
// 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($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);
$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();
// 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')) {
}
}
- header('Location: ' . Horde::applicationUrl('classes/', true));
- exit;
+ Horde::applicationUrl('classes/', true)->redirect();
}
if (!$vars->exists('name')) {
// 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');
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();
// 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();
$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']);
$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();
}
}
}
$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();
}
}
/* 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) {
$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');
$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;
}
$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);
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;
}
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();
}
/* 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();
}
}
$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');
$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';
}
}
$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;
}
// 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');
}
// 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');
}
// 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. */
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;
$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");
++$bookmark->clicks;
$bookmark->save();
-header('Location: ' . Horde::externalUrl($bookmark->url));
+Horde::externalUrl($bookmark->url)->redirect();
$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. */
$url = $url
? Horde::url($url, true)
: Horde::applicationUrl('index.php', true);
- header('Location: ' . $url);
- exit;
+ $url->redirect();
}
$contact = new Turba_Object($driver);
$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();
$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);
$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();
$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);
}
}
- header('Location: ' . Horde::applicationUrl('addressbooks/', true));
- exit;
+ Horde::applicationUrl('addressbooks/', true)->redirect();
}
$vars->set('name', $addressbook->get('name'));
$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;
$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();
}
}
$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();
}
}
$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');
} 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();
$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;
if ($source === null || !isset($cfgSources[$source])) {
$notification->push(_("Not found"), 'horde.error');
- header('Location: ' . $url);
- exit;
+ $url->redirect();
}
$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();
}
}
} else {
$url = new Horde_Url($url, true);
}
- header('Location: ' . $url->unique());
- exit;
+ $url->unique()->redirect();
}
$title = sprintf(_("Edit \"%s\""), $contact->getValue('name'));
$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);
}
}
}
- header('Location: ' . $next_page->setRaw(true));
- exit;
+ $next_page->redirect();
}
}
// 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();
}
}
$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();
$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. */
$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. */
$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);
$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'));
$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. */
$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();
}
}
}
$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'];
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)) {
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. */
/* 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');
$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
$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. */
$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();
}
}
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) {
$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');
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');
*/
function show()
{
- header('Location: ' . Whups::urlFor('ticket', $this->_id, true));
- exit;
+ Whups::urlFor('ticket', $this->_id, true)->redirect();
}
/**
$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);
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;
$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();
} 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.
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.
}
}
$_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')) {
$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;
}
$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();
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');
}
$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'));
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();
}
$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();
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();
}
// 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');
$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();
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();
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__);
}
/* 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
$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 == '?') {
/* 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());
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;
'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')) {
'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');
$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());
{
if (!strlen($this->referrer())) {
$GLOBALS['notification']->push(_("Page name must not be empty"));
- header('Location: ' . Wicked::url('', true));
- exit;
+ Wicked::url('', true)->redirect();
}
}
{
$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();
}
}
$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)) {
$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();
}
}
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());
}
// Show the newly saved page.
- header('Location: ' . Wicked::url($this->referrer(), true));
- exit;
+ Wicked::url($this->referrer(), true)->redirect();
}
}
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();
}
}
- header('Location: ' . Wicked::url($new_name, true));
- exit;
+ Wicked::url($new_name, true)->redirect();
}
}
{
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();
}
}
}
// Show the newly created page.
- header('Location: ' . Wicked::url($this->referrer(), true));
- exit;
+ Wicked::url($this->referrer(), true)->redirect();
}
}
{
$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();
}
}
$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();
}
}
$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'));
$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();
}
}
$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();
}
/**
$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();
}
/**