$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($vars->get('gallery'));
} catch (Ansel_Exception $e) {
$notification->push($gallery->getMessage());
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
}
$url = $vars->get('url');
if ($form->isSubmitted()) {
if (Horde_Util::getFormData('submitbutton') == _("Cancel")) {
$notification->push("You are not authorised to view this photo.", 'horde.warning');
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
} else {
$_SESSION['ansel']['user_age'] = (int)$gallery->get('age');
- header('Location: ' . $url, true);
+ $url->redirect();
exit;
}
}
$face = $faces->getFaceById($face_id);
} catch (Horde_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . Horde::applicationUrl('faces/search/all.php'));
+ Horde::applicationUrl('faces/search/all.php')->redirect();
exit;
}
}
}
- header('Location: ' . Ansel_Faces::getLink($face));
+ Ansel_Faces::getLink($face)->redirect();
exit;
}
$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id);
} catch (Ansel_Exception $e) {
$notification->push($image);
- header('Location: ' . Horde::applicationUrl('list.php'));
+ Horde::applicationUrl('list.php')->redirect();
exit;
}
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery);
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied editing the photo."));
- header('Location: ' . Ansel::getUrlFor('view', array('gallery' => $image->gallery)));
+ Ansel::getUrlFor('view', array('gallery' => $image->gallery))->redirect();
exit;
}
}
} catch (Horde_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . Horde::applicationUrl('list.php'));
+ Horde::applicationUrl('list.php')->redirect();
}
}
$face = $faces->getFaceById($face_id);
} catch (Horde_Exception $e) {
$notification->push($face->getMessage());
- header('Location: ' . Horde::applicationUrl('faces/index.php'));
+ Horde::applicationUrl('faces/index.php')->redirect();
exit;
}
$gallery_id = (int)Horde_Util::getFormData('gallery');
if (empty($gallery_id)) {
$notification->push(_("No gallery specified"), 'horde.error');
- header('Location: ' . Ansel::getUrlFor('default_view', array()));
+ Ansel::getUrlFor('default_view', array())->redirect();
exit;
}
try {
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id);
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage(), 'horde.error');
- header('Location: ' . Ansel::getUrlFor('view', array('gallery' => $gallery_id)));
+ Ansel::getUrlFor('view', array('gallery' => $gallery_id))->redirect();
exit;
}
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('gallery' => $gallery_id)));
+ Ansel::getUrlFor('view', array('gallery' => $gallery_id))->redirect();
exit;
}
$gallery->setDate(Ansel::getDateParameter());
$face = $faces->getFaceById($face_id);
} catch (Horde_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . Horde::applicationUrl('faces/search/all.php'));
+ Horde::applicationUrl('faces/search/all.php')->redirect();
exit;
}
$notification->push(_("The owner of the photo was notified."), 'horde.success');
}
- header('Location: ' . Ansel_Faces::getLink($face));
+ Ansel_Faces::getLink($face)->redirect();
exit;
}
if (Horde_Util::getPost('submit') == _("Cancel")) {
$notification->push(_("Changes cancelled."), 'horde.warning');
- header('Location: ' . $back_url);
+ $back_url->redirect();
exit;
}
try {
Horde_Util::getFormData('name'));
} catch (Horde_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . $back_url);
+ $back_url->redirect();
exit;
}
$notification->push(_("Face successfuly updated"), 'horde.success');
}
-header('Location: ' . $back_url);
+$back_url->redirect();
exit;
$dimensions = $img->getDimensions();
} catch (Horde_Image_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
exit;
}
if ($dimensions['width'] < 50 || $dimensions['height'] < 50) {
$notification->push(_("Photo is too small. Search photo must be at least 50x50 pixels."));
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
exit;
}
min($conf['screen']['height'], $dimensions['height']));
} catch (Horde_Image_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
exit;
}
$path = $tmp . '/search_face_' . $registry->getAuth() . Ansel_Faces::getExtension();
if (file_put_contents($path, $img->raw())) {
- header('Location: ' . Horde::applicationUrl('faces/search/image_define.php'));
+ Horde::applicationUrl('faces/search/image_define.php')->redirect();
} else {
$notification->push(_("Cannot store search photo"));
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
}
exit;
if (file_exists($path) !== true) {
$notification->push(_("You must upload the search photo first"));
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
}
$title = _("Create a new face");
if (!file_exists($path)) {
$notification->push(_("You must upload the search photo first"));
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
}
$x1 = (int)Horde_Util::getFormData('x1');
if ($x2 - $x1 < 50 || $y2 - $y1 < 50) {
$notification->push(_("Photo is too small. Search photo must be at least 50x50 pixels."));
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
exit;
}
$result = $img->loadFile($path);
} catch (Horde_Image_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
exit;
}
$result = $img->crop($x1, $y1, $x2, $y2);
} catch (Horde_Image_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
exit;
}
}
} catch (Horde_Image_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
}
/* Save image. */
$path = $tmp . '/search_face_thumb_' . $registry->getAuth() . Ansel_Faces::getExtension();
if (!file_put_contents($path, $img->raw())) {
$notification->push(_("Cannot store search photo"));
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
exit;
}
$signature = $faces->getSignatureFromFile($path);
if (empty($signature)) {
$notification->push(_("Cannot read photo signature"));
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
exit;
}
/* Save signature. */
$path = $tmp . '/search_face_' . $registry->getAuth() . '.sig';
if (file_put_contents($path, $signature)) {
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
exit;
}
$notification->push(_("Cannot save photo signature"));
-header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+Horde::applicationUrl('faces/search/image.php')->redirect();
exit;
$results = $faces->getSignatureMatches($signature, $face_id, $perpage * $page, $perpage);
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
}
} else {
$tmp = Horde::getTempDir();
$path = $tmp . '/search_face_' . $registry->getAuth() . '.sig';
if (file_exists($path) !== true) {
$notification->push(_("You must upload the search photo first"));
- header('Location: ' . Horde::applicationUrl('faces/search/image.php'));
+ Horde::applicationUrl('faces/search/image.php')->redirect();
}
$signature = file_get_contents($path);
try {
// Redirect to the gallery list if no action has been requested.
$actionID = Horde_Util::getFormData('actionID');
if (is_null($actionID)) {
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
}
$parent = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($parentId);
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage(), 'horde.error');
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
}
if (!$parent->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied adding a gallery to \"%s\"."),
$parent->get('name')), 'horde.error');
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
}
!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) {
$notification->push(sprintf(_("Access denied downloading photos from \"%s\"."), $gallery->get('name')), 'horde.error');
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
}
($injector->getInstance('Horde_Perms')->exists('ansel') &&
!$injector->getInstance('Horde_Perms')->hasPermission('ansel', $registry->getAuth(), Horde_Perms::EDIT))) {
$notification->push(_("Access denied editing galleries."), 'horde.error');
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
}
$result = $gallery->setParent($new_parent);
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage(), 'horde.error');
- header('Location: ' . Horde::applicationUrl(Ansel::getUrlFor('view', array('view' => 'List'), true)));
+ Horde::applicationUrl(Ansel::getUrlFor('view', array('view' => 'List'), true))->redirect();
exit;
}
}
$parent = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_parent);
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage(), 'horde.error');
- header('Location: ' . Horde::applicationUrl(Ansel::getUrlFor('view', array('view' => 'List'), true)));
+ Horde::applicationUrl(Ansel::getUrlFor('view', array('view' => 'List'), true))->redirect();
exit;
}
if (!$parent->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
_("You do not have permission to add children to %s."),
$parent->get('name')), 'horde.error');
- header('Location: ' . Horde::applicationUrl(Ansel::getUrlFor('view', array('view' => 'List'), true)));
+ Horde::applicationUrl(Ansel::getUrlFor('view', array('view' => 'List'), true))->redirect();
exit;
}
}
} elseif (empty($url)) {
$url = Horde::applicationUrl('index.php', true);
}
- header('Location: ' . $url);
+ $url->redirect();
exit;
case 'delete':
}
// Return to the gallery list.
- header('Location: ' . Horde::applicationUrl(Ansel::getUrlFor('view', array('view' => 'List'), true)));
+ Horde::applicationUrl(Ansel::getUrlFor('view', array('view' => 'List'), true))->redirect();
exit;
case 'generateDefault':
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId);
$gallery->clearStacks();
$notification->push(_("The gallery's default photo has successfully been reset."), 'horde.success');
- header('Location: ' . Horde::applicationUrl('view.php', true)->add('gallery', $galleryId));
+ Horde::applicationUrl('view.php', true)->add('gallery', $galleryId)->redirect();
exit;
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage(), 'horde.error');
- header('Location: ' . Horde::applicationUrl('index.php', true));
+ Horde::applicationUrl('index.php', true)->redirect();
exit;
}
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId);
} catch (Ansel_Exception $e) {
$notification->push($gallery->getMessage(), 'horde.error');
- header('Location: ' . Horde::applicationUrl('index.php', true));
+ Horde::applicationUrl('index.php', true)->redirect();
exit;
}
$gallery->clearThumbs();
$notification->push(_("The gallery's thumbnails have successfully been reset."), 'horde.success');
- header('Location: ' . Horde::applicationUrl('view.php', true)->add('gallery', $galleryId));
+ Horde::applicationUrl('view.php', true)->add('gallery', $galleryId)->redirect();
exit;
case 'deleteCache':
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId);
} catch (Ansel_Exception $e) {
$notification->push($gallery->getMessage(), 'horde.error');
- header('Location: ' . Horde::applicationUrl('index.php', true));
+ Horde::applicationUrl('index.php', true)->redirect();
exit;
}
$gallery->clearViews();
$notification->push(_("The gallery's views have successfully been reset."), 'horde.success');
- header('Location: ' . Horde::applicationUrl('view.php', true)->add('gallery', $galleryId));
+ Horde::applicationUrl('view.php', true)->add('gallery', $galleryId)->redirect();
exit;
default:
- header('Location: ' . Horde::applicationUrl(Ansel::getUrlFor('view', array('view' => 'List'), true)));
+ Horde::applicationUrl(Ansel::getUrlFor('view', array('view' => 'List'), true))->redirect();
exit;
}
$galleryId = Horde_Util::getFormData('gallery');
if (!$galleryId) {
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'),
- true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
try {
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId);
} catch (Ansel_Exception $e) {
$notification->push(sprintf(_("Error accessing %s: %s"), $galleryId, $e->getMessage()), 'horde.error');
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'), true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied setting captions for %s."), $gallery->get('name')), 'horde.error');
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'), true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
$notification->push(_("Captions Saved."), 'horde.success');
$style = $gallery->getStyle();
- header('Location: ' . Ansel::getUrlFor('view', array_merge(
- array('gallery' => $galleryId,
- 'slug' => $gallery->get('slug'),
- 'view' => 'Gallery'),
- $date), true));
+ Ansel::getUrlFor('view', array_merge(array('gallery' => $galleryId,
+ 'slug' => $gallery->get('slug'),
+ 'view' => 'Gallery'),
+ $date), true)->redirect();
exit;
}
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage(), 'horde.error');
// Return to the default view.
- header('Location: ' . Ansel::getUrlFor('default_view', array()));
+ Ansel::getUrlFor('default_view', array())->redirect();
exit;
}
switch ($actionID) {
}
// Return to the default view.
- header('Location: ' . Ansel::getUrlFor('default_view', array()));
+ Ansel::getUrlFor('default_view', array())->redirect();
exit;
case 'empty':
$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->emptyGallery($gallery);
$notification->push(sprintf(_("Successfully emptied \"%s\""), $gallery->get('name')));
}
- header('Location: '
- . Ansel::getUrlFor('view',
- array('view' => 'Gallery',
- 'gallery' => $galleryId,
- 'slug' => $gallery->get('slug')),
- true));
+ Ansel::getUrlFor('view',
+ array('view' => 'Gallery',
+ 'gallery' => $galleryId,
+ 'slug' => $gallery->get('slug')),
+ true)->redirect();
exit;
}
}
* list. */
$galleryId = Horde_Util::getFormData('gallery');
if (!isset($galleryId)) {
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'),
- true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
try {
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId);
} catch (Ansel_Excception $e) {
$notification->push(_("There was an error accessing the gallery."), 'horde.error');
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'), true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
$notification->push(_("Gallery sorted."), 'horde.success');
$style = $gallery->getStyle();
- header('Location: ' . Ansel::getUrlFor('view', array_merge(
- array('view' => 'Gallery',
- 'gallery' => $galleryId,
- 'slug' => $gallery->get('slug')),
- $date),
- true));
+ Ansel::getUrlFor('view',
+ array_merge(
+ array('view' => 'Gallery',
+ 'gallery' => $galleryId,
+ 'slug' => $gallery->get('slug')),
+ $date
+ ),
+ true)->redirect();
exit;
}
break;
default:
- header('Location: ' . Ansel::getUrlFor('view',
- array(
- 'view' => 'List',
- 'groupby' => $groupby
- ),
- true));
+ Ansel::getUrlFor('view',
+ array(
+ 'view' => 'List',
+ 'groupby' => $groupby
+ ),
+ true)->redirect();
exit;
}
/* Redirect to the image list if no other action has been requested. */
if (is_null($actionID) && is_null($tags)) {
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'),
- true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id);
} catch (Ansel_Exception $e) {
$notification->push(sprintf(_("Gallery %s not found."), $gallery_id), 'horde.error');
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'), true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
true);
}
- header('Location: ' . $url);
+ $url->redirect();
exit;
}
}
$eTags = $resource->getTags();
unset($eTags[$tag]);
$resource->setTags($eTags);
- header('Location: ' . $url);
+ $url->redirect();
exit;
case 'modify':
$ret = Horde_Util::getFormData('ret', 'gallery');
} catch (Ansel_Exception $e) {
$notification->push(_("Photo not found."), 'horde.error');
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'), true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied saving photo to \"%s\"."), $gallery->get('name')),
'horde.error');
- $imageurl = Ansel::getUrlFor('view', array_merge(
- array('gallery' => $gallery_id,
- 'slug' => $gallery->get('slug'),
- 'view' => 'Gallery',
- 'page' => $page),
- $date),
- true);
- header('Location: ' . $imageurl);
+ Ansel::getUrlFor('view',
+ array_merge(array('gallery' => $gallery_id,
+ 'slug' => $gallery->get('slug'),
+ 'view' => 'Gallery',
+ 'page' => $page),
+ $date),
+ true)->redirect();
exit;
}
true);
if ($actionID == 'save') {
/* Return to the image view. */
- header('Location: ' . $imageurl);
+ $imageurl->redirect();
} elseif ($actionID == 'saveclose') {
echo Horde::wrapInlineScript(array(
'window.opener.location.href = window.opener.location.href;',
'horde.error');
/* Return to the image view. */
- header('Location: ' . $ImageGenerator_url);
+ $ImageGenerator_url->redirect();
exit;
}
$gallery->get('name')),
'horde.error');
/* Return to the image view. */
- $imageurl = Ansel::getUrlFor('view', array_merge(
+ Ansel::getUrlFor('view', array_merge(
array('gallery' => $gallery_id,
'image' => $image_id,
'view' => 'Image',
'page' => $page,
'slug' => $gallery->get('slug')),
$date),
- true);
- header('Location: ' . $imageurl);
+ true)->redirect();
exit;
} else {
$image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id);
$image->watermark('screen', $watermark, $watermark_halign,
$watermark_valign, $watermark_font);
$image->updateData($image->raw('screen'), 'screen');
- $imageurl = Horde::applicationUrl('image.php', true)->add(
+ Horde::applicationUrl('image.php', true)->add(
array_merge(
array('gallery' => $gallery_id,
'image' => $image_id,
'actionID' => 'editimage',
'page' => $page),
- $date));
- header('Location: ' . $imageurl);
+ $date))->redirect();
exit;
}
$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id);
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage(), 'horde.error');
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'), true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
}
}
- $imageurl = Horde::applicationUrl('image.php', true)->add(
+ Horde::applicationUrl('image.php', true)->add(
array_merge(
array('gallery' => $gallery_id,
'image' => $image_id,
'actionID' => 'editimage',
'page' => $page),
- $date));
- header('Location: ' . $imageurl);
+ $date))->redirect();
exit;
case 'setwatermark':
$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id);
} catch (Ansel_Exception $e) {
$notification->push($image->getMessage(), 'horde.error');
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'), true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
/* Set up the form object. */
}
/* Return to the image list. */
- $imageurl = Ansel::getUrlFor('view', array_merge(
- array('gallery' => $gallery_id,
- 'view' => 'Gallery',
- 'page' => $page,
- 'slug' => $gallery->get('slug')),
- $date),
- true);
- header('Location: ' . $imageurl);
+ Ansel::getUrlFor('view',
+ array_merge(
+ array('gallery' => $gallery_id,
+ 'view' => 'Gallery',
+ 'page' => $page,
+ 'slug' => $gallery->get('slug')),
+ $date),
+ true)->redirect();
exit;
case 'move':
}
/* Return to the image list. */
- $imageurl = Ansel::getUrlFor('view', array_merge(
+ Ansel::getUrlFor('view', array_merge(
array('gallery' => $gallery_id,
'view' => 'Gallery',
'page' => $page,
'slug' => $gallery->get('slug')),
$date),
- true);
- header('Location: ' . $imageurl);
+ true)->redirect();
exit;
case 'copy':
}
/* Return to the image list. */
- $imageurl = Ansel::getUrlFor('view', array_merge(
- array('gallery' => $gallery_id,
- 'view' => 'Gallery',
- 'page' => $page,
- 'slug' => $gallery->get('slug')),
- $date),
- true);
- header('Location: ' . $imageurl);
+ Ansel::getUrlFor('view',
+ array_merge(
+ array('gallery' => $gallery_id,
+ 'view' => 'Gallery',
+ 'page' => $page,
+ 'slug' => $gallery->get('slug')),
+ $date),
+ true)->redirect();
exit;
case 'downloadzip':
$gallery->hasPasswd() || !$gallery->isOldEnough()) {
$notification->push(sprintf(_("Access denied downloading photos from \"%s\"."), $gallery->get('name')), 'horde.error');
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
}
}
} else {
$url = Ansel::getUrlFor('view', array('view' => 'List'));
}
- header('Location: ' . $url);
+ $url->redirect();
exit;
}
exit;
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied editing the photo."), 'horde.error');
- $imageurl = Ansel::getUrlFor(
+ Ansel::getUrlFor(
'view', array('gallery' => $gallery_id,
'image' => $image_id,
'view' => 'Image',
- 'page' => $page));
- header('Location: ' . $imageurl);
+ 'page' => $page))->redirect();
} else {
$x1 = (int)Horde_Util::getFormData('x1');
$y1 = (int)Horde_Util::getFormData('y1');
exit;
default:
- header('Location: ' . Ansel::getUrlFor('default_view', array()));
+ Ansel::getUrlFor('default_view', array())->redirect();
exit;
}
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id);
} catch (Ansel_Exception $e) {
$notification->push(sprintf(_("Gallery %s not found."), $gallery_id), 'horde.error');
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'), true));
+ Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
exit;
}
if ($valid) {
/* Return to the gallery view. */
- $imageurl = Ansel::getUrlFor('view',
- array('gallery' => $gallery_id,
- 'slug' => $gallery->get('slug'),
- 'view' => 'Gallery',
- 'page' => $page),
- true);
-
- header('Location: ' . $imageurl);
+ Ansel::getUrlFor('view',
+ array('gallery' => $gallery_id,
+ 'slug' => $gallery->get('slug'),
+ 'view' => 'Gallery',
+ 'page' => $page),
+ true)->redirect();
exit;
}
}
require_once dirname(__FILE__) . '/lib/Application.php';
Horde_Registry::appInit('ansel');
-
-header('Location: ' . Ansel::getUrlFor('default_view', array()));
+Ansel::getUrlFor('default_view', array())->redirect();
$parent = (empty($params['parent'])) ? null : $params['parent']->id;
if ((!empty($params['parent']) && !empty($galleries[$params['parent']])) ||
(empty($params['parent']))) {
-
+
$tree->addNode($gallery->id, $parent, $label, $indents, true, $treeparams);
}
}
if (count($extras)) {
$url->add($extras);
}
-
+
/* Slight hack until we delegate at least some of the url
* generation to the gallery/image/view object. */
if ($data['view'] == 'Image' &&
}
return Horde::applicationUrl($url, $full, $append_session);
-
+
} else {
$url = Horde::applicationUrl('view.php', $full, $append_session);
-
+
/* See note above about delegating url generation to gallery/view */
if ($data['view'] == 'Image' &&
!empty($data['gallery_view']) &&
if (empty($GLOBALS['conf']['gallery']['downloadzip'])) {
$GLOBALS['notification']->push(_("Downloading zip files is not enabled. Talk to your server administrator."));
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
}
if (!count($images)) {
$notification->push(sprintf(_("There are no photos in %s to download."),
$gallery->get('name')), 'horde.message');
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
}
true);
$params = array('gallery' => $this->gallery->id, 'url' => $galleryurl);
- header('Location: ' . Horde::applicationUrl('disclamer.php')->add($params)->setRaw(true));
+
+ Horde::applicationUrl('disclamer.php')->add($params)->setRaw(true)->redirect();
exit;
}
true);
$params = array('gallery' => $this->gallery->id, 'url' => $galleryurl);
- header('Location: ' . Horde::applicationUrl('protect.php')->add($params)->setRaw(true));
+ Horde::applicationUrl('protect.php')->add($params)->setRaw(true)->redirect();
exit;
}
$params = array('gallery' => $this->gallery->id, 'url' => $url);
- header('Location: ' . Horde::applicationUrl('disclamer.php')->add($params)->setRaw(true));
+ Horde::applicationUrl('disclamer.php')->add($params)->setRaw(true)->redirect();
exit;
}
$params = array('gallery' => $this->gallery->id, 'url' => $url);
- header('Location: ' . Horde::applicationUrl('protect.php')->add($params)->setRaw(true));
+ Horde::applicationUrl('protect.php')->add($params)->setRaw(true)->redirect();
exit;
}
$this->_category = $this->_params['category'];
}
if (!$this->_owner && !$this->_category && !$this->_special && $this->_groupby != 'none' ) {
- header('Location: ' . Ansel::getUrlFor('group', array('groupby' => $this->_groupby), true));
+ Ansel::getUrlFor('group', array('groupby' => $this->_groupby))->redirect();
exit;
}
$this->_page = Horde_Util::getFormData('page', 0);
}
$this->_g_perPage = $prefs->getValue('tilesperpage');
-
+
// If we are calling from the api, we can just pass a list of gallery
// ids instead of doing grouping stuff.
if (!empty($this->_params['api']) &&
if ($this->_numGalleries == 0 && empty($this->_params['api'])) {
if ($this->_owner && $filter == $this->_owner && $this->_owner == $GLOBALS['registry']->getAuth()) {
- $notification->push(_("You have no photo galleries, add one!"),
- 'horde.message');
- header('Location: ' .Horde::applicationUrl('gallery.php')->add('actionID', 'add'));
+ $notification->push(_("You have no photo galleries, add one!"), 'horde.message');
+ Horde::applicationUrl('gallery.php')->add('actionID', 'add')->redirect();
exit;
}
$notification->push(_("There are no photo galleries available."), 'horde.message');
}
}
- header('Location: ' . Ansel::getUrlFor('view',
- array('view' => 'Results'),
- true));
+ Ansel::getUrlFor('view', array('view' => 'Results'), true)->redirect();
exit;
case 'move':
$notification->push(_("Bad input."), 'horde.error');
}
}
- header('Location: ' . Ansel::getUrlFor('view',
- array('view' => 'Results'),
- true));
+
+ Ansel::getUrlFor('view', array('view' => 'Results'), true)->redirect();
exit;
case 'copy':
$notification->push(_("Bad input."), 'horde.error');
}
}
- header('Location: ' . Ansel::getUrlFor('view', array('view' => 'Results'), true));
+ Ansel::getUrlFor('view', array('view' => 'Results'), true)->redirect();
exit;
/* Tag related actions */
/* Check for empty tag search and redirect if empty */
if ($this->_search->tagCount() < 1) {
- header('Location: ' . Horde::applicationUrl('browse.php', true));
+ Horde::applicationUrl('browse.php', true)->redirect();
exit;
}
}
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($vars->get('gallery'));
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage());
- header('Location: ' . Horde::applicationUrl('list.php'));
+ Horde::applicationUrl('list.php')->redirect();
exit;
}
$form = new Horde_Form($vars, _("This gallery is protected by a password. Please enter it below."));
if (empty($url)) {
$url = Horde::applicationUrl('view.php')->add('gallery', $gallery->id);
}
- header('Location: ' . $url);
+ $url->redirect();
exit;
}
}
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id);
} catch (Ansel_Exception $e) {
$notification->push($gallery->getMessage());
- header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
+ Horde::applicationUrl('view.php?view=List', true)->redirect();
exit;
}
} else {
$notification->push(_("Gallery was not reported."), 'horde.warning');
}
- header('Location: ' . $return_url);
+ $return_url->redirect();
exit;
}