From: Michael J. Rubinsky Date: Sat, 9 Oct 2010 14:02:15 +0000 (-0400) Subject: Move binders to factories in ansel X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=29a5a0975e4472ba821b65511549aaecc3da5fdb;p=horde.git Move binders to factories in ansel --- diff --git a/ansel/disclamer.php b/ansel/disclamer.php index eb38eb242..405961225 100644 --- a/ansel/disclamer.php +++ b/ansel/disclamer.php @@ -13,7 +13,7 @@ Horde_Registry::appInit('ansel'); $vars = Horde_Variables::getDefaultVariables(); try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($vars->get('gallery')); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($vars->get('gallery')); } catch (Ansel_Exception $e) { $notification->push($gallery->getMessage()); Horde::url('view.php?view=List', true)->redirect(); diff --git a/ansel/edit_dates.php b/ansel/edit_dates.php index 2eae3952a..7a95b43a0 100644 --- a/ansel/edit_dates.php +++ b/ansel/edit_dates.php @@ -18,7 +18,7 @@ $page = Horde_Util::getFormData('page', 0); /* If we have a single gallery, check perms now */ if (!empty($gallery_id)) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) { $notification->push(_("You are not allowed to edit these photos."), 'horde.error'); echo Horde::wrapInlineScript(array( @@ -47,10 +47,10 @@ if ($actionID == 'edit_dates') { $count = 0; foreach (array_keys($images) as $image_id) { try { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); if (empty($gallery_id)) { // Images might be from different galleries - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) { continue; } @@ -82,7 +82,7 @@ $html = ''; foreach ($keys as $key) { $html .= '[thumbnail]'; } -$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage(array_pop($keys)); +$image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage(array_pop($keys)); /* Display the form */ $vars->set('image', $images); $vars->set('gallery', $gallery_id); diff --git a/ansel/faces/claim.php b/ansel/faces/claim.php index 16600206a..3aef1987d 100644 --- a/ansel/faces/claim.php +++ b/ansel/faces/claim.php @@ -35,7 +35,7 @@ if ($form->validate()) { $notification->push(_("Action was cancelled."), 'horde.warning'); } else { $report = Ansel_Report::factory(); - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($face['gallery_id']); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($face['gallery_id']); $face_link = Horde::url('faces/custom.php', true)->add( array('name' => $vars->get('person'), diff --git a/ansel/faces/custom.php b/ansel/faces/custom.php index 623a3ac55..5252a817c 100644 --- a/ansel/faces/custom.php +++ b/ansel/faces/custom.php @@ -24,14 +24,14 @@ if (!empty($url)) { $form_post = Horde::url('faces/savecustom.php')->add($urlparams); try { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); } catch (Ansel_Exception $e) { $notification->push($image); Horde::url('list.php')->redirect(); exit; } -$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); +$gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) { $notification->push(_("Access denied editing the photo.")); Ansel::getUrlFor('view', array('gallery' => $image->gallery))->redirect(); diff --git a/ansel/faces/gallery.php b/ansel/faces/gallery.php index 044a3c4d4..c684f2626 100644 --- a/ansel/faces/gallery.php +++ b/ansel/faces/gallery.php @@ -22,7 +22,7 @@ if (empty($gallery_id)) { exit; } try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); } catch (Ansel_Exception $e) { $notification->push($e->getMessage(), 'horde.error'); Ansel::getUrlFor('view', array('gallery' => $gallery_id))->redirect(); diff --git a/ansel/faces/image.php b/ansel/faces/image.php index 60922e5dc..fbf144282 100644 --- a/ansel/faces/image.php +++ b/ansel/faces/image.php @@ -24,7 +24,7 @@ $result = $faces->getImageFacesData($image_id); // Attempt to get faces from the picture if we don't already have results, // or if we were asked to explicitly try again. if (($reload || empty($result))) { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); try { $image->createView('screen'); $result = $faces->getFromPicture($image_id, $autocreate); diff --git a/ansel/faces/name.php b/ansel/faces/name.php index 32af2a785..8dcb4b0ab 100644 --- a/ansel/faces/name.php +++ b/ansel/faces/name.php @@ -17,8 +17,8 @@ $image_id = (int)Horde_Util::getFormData('image'); $face_id = (int)Horde_Util::getFormData('face'); $name = Horde_Util::getFormData('name'); -$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); -$gallery = $$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()>getGallery($image->gallery); +$image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); +$gallery = $$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()>getGallery($image->gallery); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception('Access denied editing the photo.'); } diff --git a/ansel/faces/report.php b/ansel/faces/report.php index c5ef49eb5..c6c7e261e 100644 --- a/ansel/faces/report.php +++ b/ansel/faces/report.php @@ -39,7 +39,7 @@ if ($form->validate()) { } else { require ANSEL_BASE . '/lib/Report.php'; $report = Ansel_Report::factory(); - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($face['gallery_id']); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($face['gallery_id']); $face_link = Horde::url('faces/face.php', true)->add( array('name' => $vars->get('person'), diff --git a/ansel/gallery.php b/ansel/gallery.php index 8c151de8e..53a63b44c 100644 --- a/ansel/gallery.php +++ b/ansel/gallery.php @@ -33,7 +33,7 @@ case 'modify': case 'downloadzip': $galleryId = Horde_Util::getFormData('gallery'); - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); if (!$registry->getAuth() || !$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) { @@ -51,7 +51,7 @@ case 'empty': $galleryId = Horde_Util::getFormData('gallery'); if ($galleryId) { try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); require ANSEL_TEMPLATES . '/common-header.inc'; echo Horde::menu(); $notification->notify(array('listeners' => 'status')); @@ -71,7 +71,7 @@ case 'generateDefault': // Re-generate the default pretty gallery image. $galleryId = Horde_Util::getFormData('gallery'); try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); $gallery->clearStacks(); $notification->push(_("The gallery's default photo has successfully been reset."), 'horde.success'); Horde::url('view.php', true)->add('gallery', $galleryId)->redirect(); @@ -86,7 +86,7 @@ case 'generateThumbs': // Re-generate all of this gallery's prettythumbs. $galleryId = Horde_Util::getFormData('gallery'); try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); } catch (Ansel_Exception $e) { $notification->push($gallery->getMessage(), 'horde.error'); Horde::url('index.php', true)->redirect(); @@ -101,7 +101,7 @@ case 'deleteCache': // Delete all cached image views. $galleryId = Horde_Util::getFormData('gallery'); try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); } catch (Ansel_Exception $e) { $notification->push($gallery->getMessage(), 'horde.error'); Horde::url('index.php', true)->redirect(); diff --git a/ansel/gallery/captions.php b/ansel/gallery/captions.php index 0862dd7a3..bdbd95aa5 100644 --- a/ansel/gallery/captions.php +++ b/ansel/gallery/captions.php @@ -17,7 +17,7 @@ if (!$galleryId) { exit; } try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); } catch (Ansel_Exception $e) { $notification->push(sprintf(_("Error accessing %s: %s"), $galleryId, $e->getMessage()), 'horde.error'); Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect(); diff --git a/ansel/gallery/delete.php b/ansel/gallery/delete.php index 329efa679..afcef4dbb 100644 --- a/ansel/gallery/delete.php +++ b/ansel/gallery/delete.php @@ -17,7 +17,7 @@ $galleryId = Horde_Util::getPost('gallery'); if ($galleryId) { try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); } catch (Ansel_Exception $e) { $notification->push($e->getMessage(), 'horde.error'); // Return to the default view. @@ -31,7 +31,7 @@ if ($galleryId) { $gallery->get('name')), 'horde.error'); } else { try { - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->removeGallery($gallery); + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->removeGallery($gallery); $notification->push(sprintf(_("Successfully deleted %s."), $gallery->get('name')), 'horde.success'); } catch (Ansel_Exception $e) { $notification->push(sprintf( @@ -58,7 +58,7 @@ if ($galleryId) { $gallery->get('name')), 'horde.error'); } else { - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->emptyGallery($gallery); + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->emptyGallery($gallery); $notification->push(sprintf(_("Successfully emptied \"%s\""), $gallery->get('name'))); } Ansel::getUrlFor('view', diff --git a/ansel/gallery/sort.php b/ansel/gallery/sort.php index b941e345a..38f705d4c 100644 --- a/ansel/gallery/sort.php +++ b/ansel/gallery/sort.php @@ -19,7 +19,7 @@ if (!isset($galleryId)) { exit; } try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); } catch (Ansel_Excception $e) { $notification->push(_("There was an error accessing the gallery."), 'horde.error'); Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect(); diff --git a/ansel/group.php b/ansel/group.php index 30f704952..dbad0147a 100644 --- a/ansel/group.php +++ b/ansel/group.php @@ -29,9 +29,9 @@ $groups_perpage = $prefs->getValue('groupsperpage'); switch ($groupby) { case 'owner': try { - if ($num_groups = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->shares->countOwners(Horde_Perms::SHOW, null, false)) { + if ($num_groups = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->shares->countOwners(Horde_Perms::SHOW, null, false)) { - $groups = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->shares->listOwners(Horde_Perms::SHOW, + $groups = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->shares->listOwners(Horde_Perms::SHOW, null, false, $gbpage * $groups_perpage, diff --git a/ansel/image.php b/ansel/image.php index 51993efed..88969615a 100644 --- a/ansel/image.php +++ b/ansel/image.php @@ -53,7 +53,7 @@ if (is_null($actionID) && is_null($tags)) { /* Get the gallery object and style information */ try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); } catch (Ansel_Exception $e) { $notification->push(sprintf(_("Gallery %s not found."), $gallery_id), 'horde.error'); Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect(); @@ -64,7 +64,7 @@ try { if (!is_null($tags) && strlen($tags)) { $tags = explode(',', $tags); if (!empty($image_id)) { - $resource = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $resource = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); } else { $resource = $gallery; } @@ -101,7 +101,7 @@ switch ($actionID) { case 'deletetags': $tag = Horde_Util::getFormData('tag'); if (!empty($image_id)) { - $resource = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $resource = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $page = Horde_Util::getFormData('page', 0); $url = Ansel::getUrlFor('view', array_merge( array('view' => 'Image', @@ -126,7 +126,7 @@ case 'deletetags': case 'modify': try { - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $ret = Horde_Util::getFormData('ret', 'gallery'); } catch (Ansel_Exception $e) { $notification->push(_("Photo not found."), 'horde.error'); @@ -202,7 +202,7 @@ case 'save': } catch (Horde_Browser_Exception $e) {} } - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->caption = $vars->get('image_desc'); $image->setTags(explode(',' , $vars->get('image_tags'))); @@ -307,7 +307,7 @@ case 'resizeedit': } /* Retrieve image details. */ - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $title = sprintf(_("Edit %s :: %s"), $gallery->get('name'), $image->filename); @@ -365,7 +365,7 @@ case 'watermark': true)->redirect(); exit; } else { - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->watermark('screen', $watermark, $watermark_halign, $watermark_valign, $watermark_font); $image->updateData($image->raw('screen'), 'screen'); @@ -393,7 +393,7 @@ case 'resize': 'horde.error'); } else { try { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); } catch (Ansel_Exception $e) { $notification->push($e->getMessage(), 'horde.error'); Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect(); @@ -456,7 +456,7 @@ case 'resize': case 'setwatermark': $title = _("Watermark"); try { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); } catch (Ansel_Exception $e) { $notification->push($image->getMessage(), 'horde.error'); Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect(); @@ -503,7 +503,7 @@ case 'previewrotate270': $action = substr($actionID, 7); /* Retrieve image details. */ - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $title = sprintf(_("Preview changes for %s :: %s"), $gallery->get('name'), $image->filename); @@ -521,35 +521,35 @@ case 'imagerotate180': case 'imagerotate270': $view = Horde_Util::getFormData('view'); $angle = intval(substr($actionID, 11)); - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->rotate($view, $angle); $image->display($view); exit; case 'imageflip': $view = Horde_Util::getFormData('view'); - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->flip($view); $image->display($view); exit; case 'imagemirror': $view = Horde_Util::getFormData('view'); - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->mirror($view); $image->display($view); exit; case 'imagegrayscale': $view = Horde_Util::getFormData('view'); - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->grayscale($view); $image->display($view); exit; case 'imagewatermark': $view = Horde_Util::getFormData('view'); - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->watermark($view, $watermark, $watermark_halign, $watermark_valign, $watermark_font); $image->display($view); @@ -611,7 +611,7 @@ case 'move': $newGallery = Horde_Util::getFormData('new_gallery'); if ($images && $newGallery) { try { - $newGallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($newGallery); + $newGallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($newGallery); $result = $gallery->moveImagesTo($images, $newGallery); $notification->push( sprintf(ngettext("Moved %d photo from \"%s\" to \"%s\"", @@ -655,7 +655,7 @@ case 'copy': $newGallery = Horde_Util::getFormData('new_gallery'); if ($images && $newGallery) { try { - $newGallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($newGallery); + $newGallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($newGallery); $result = $gallery->copyImagesTo($images, $newGallery); $notification->push( sprintf(ngettext("Copied %d photo to %s", @@ -682,7 +682,7 @@ case 'copy': case 'downloadzip': $galleryId = Horde_Util::getFormData('gallery'); if ($galleryId) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); if (!$registry->getAuth() || !$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ) || $gallery->hasPasswd() || !$gallery->isOldEnough()) { @@ -728,7 +728,7 @@ case 'previewcrop': $action = substr($actionID, 7); /* Retrieve image details. */ - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $title = sprintf(_("Preview changes for %s :: %s"), $gallery->get('name'), $image->filename); @@ -746,7 +746,7 @@ case 'imagecrop': if ($gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) { $params = Horde_Util::getFormData('params'); list($x1, $y1, $x2, $y2) = explode('.', $params); - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->load('full'); $image->crop($x1, $y1, $x2, $y2); $image->display(); diff --git a/ansel/img/download.php b/ansel/img/download.php index 620812d90..e62c57c85 100644 --- a/ansel/img/download.php +++ b/ansel/img/download.php @@ -11,8 +11,8 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('ansel'); -$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage(Horde_Util::getFormData('image')); -$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); +$image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage(Horde_Util::getFormData('image')); +$gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ) || !$gallery->canDownload()) { throw new Horde_Exception_PermissionDenied(_("Access denied viewing this photo."), __FILE__, __LINE__); } diff --git a/ansel/img/ecard.php b/ansel/img/ecard.php index 01bbf3a05..73e8b704b 100644 --- a/ansel/img/ecard.php +++ b/ansel/img/ecard.php @@ -17,7 +17,7 @@ if (empty($conf['ecard']['enable'])) { } /* Get the gallery and the image, and abort if either fails. */ -$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(Horde_Util::getFormData('gallery')); +$gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery(Horde_Util::getFormData('gallery')); $image = $gallery->getImage(Horde_Util::getFormData('image')); /* Run through the action handlers. */ diff --git a/ansel/img/full.php b/ansel/img/full.php index d6b801af2..5bc185d09 100644 --- a/ansel/img/full.php +++ b/ansel/img/full.php @@ -11,8 +11,8 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('ansel'); -$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage(Horde_Util::getFormData('image')); -$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); +$image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage(Horde_Util::getFormData('image')); +$gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ) || !$gallery->canDownload()) { throw new Horde_Exception_PermissionDenied(_("Access denied viewing this photo.")); } diff --git a/ansel/img/index.php b/ansel/img/index.php index 451529ce9..7a031b9cc 100644 --- a/ansel/img/index.php +++ b/ansel/img/index.php @@ -11,8 +11,8 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('ansel'); -$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage(Horde_Util::getFormData('image')); -$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); +$image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage(Horde_Util::getFormData('image')); +$gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) { throw new Horde_Exception_PermissionDenied(_("Access denied viewing this photo.")); } diff --git a/ansel/img/mini.php b/ansel/img/mini.php index 951579515..367453850 100644 --- a/ansel/img/mini.php +++ b/ansel/img/mini.php @@ -11,8 +11,8 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('ansel'); -$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage(Horde_Util::getFormData('image')); -$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(abs($image->gallery)); +$image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage(Horde_Util::getFormData('image')); +$gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery(abs($image->gallery)); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) { throw new Horde_Exception_PermissionDenied(_("Access denied viewing this photo.")); } diff --git a/ansel/img/prettythumb.php b/ansel/img/prettythumb.php index 55947e6ea..d342a787d 100644 --- a/ansel/img/prettythumb.php +++ b/ansel/img/prettythumb.php @@ -21,8 +21,8 @@ if ($thumbstyle && $background) { } else { $style = null; } -$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage(Horde_Util::getFormData('image')); -$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(abs($image->gallery)); +$image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage(Horde_Util::getFormData('image')); +$gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery(abs($image->gallery)); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) { throw new Horde_Exception_PermissionDenied(_("Access denied viewing this photo.")); } diff --git a/ansel/img/screen.php b/ansel/img/screen.php index 06441ab77..53c0f2165 100644 --- a/ansel/img/screen.php +++ b/ansel/img/screen.php @@ -11,8 +11,8 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('ansel'); -$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage(Horde_Util::getFormData('image')); -$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); +$image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage(Horde_Util::getFormData('image')); +$gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) { throw new Horde_Exception_PermissionDenied(_("Access denied viewing this photo.")); } diff --git a/ansel/img/thumb.php b/ansel/img/thumb.php index b18d17832..0156a3e38 100644 --- a/ansel/img/thumb.php +++ b/ansel/img/thumb.php @@ -11,8 +11,8 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('ansel'); -$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage(Horde_Util::getFormData('image')); -$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(abs($image->gallery)); +$image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage(Horde_Util::getFormData('image')); +$gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery(abs($image->gallery)); if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) { throw new Horde_Exception_PermissionDenied(_("Access denied viewing this photo.")); } diff --git a/ansel/img/upload.php b/ansel/img/upload.php index d4225d0e8..59d319ef7 100644 --- a/ansel/img/upload.php +++ b/ansel/img/upload.php @@ -13,7 +13,7 @@ Horde_Registry::appInit('ansel'); $gallery_id = Horde_Util::getFormData('gallery'); try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); } catch (Ansel_Exception $e) { $notification->push(sprintf(_("Gallery %s not found."), $gallery_id), 'horde.error'); Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect(); diff --git a/ansel/img/upload_preview.php b/ansel/img/upload_preview.php index b73b4d09a..d61c782bd 100644 --- a/ansel/img/upload_preview.php +++ b/ansel/img/upload_preview.php @@ -11,7 +11,7 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('ansel'); try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery((int)Horde_Util::getFormData('gallery')); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery((int)Horde_Util::getFormData('gallery')); } catch (Ansel_Exception $e) { echo $e->getMessage(); Horde::logMessage($e->getMessage(), 'err'); diff --git a/ansel/lib/Ajax/Imple/EditCaption.php b/ansel/lib/Ajax/Imple/EditCaption.php index c75af0216..e84866d55 100644 --- a/ansel/lib/Ajax/Imple/EditCaption.php +++ b/ansel/lib/Ajax/Imple/EditCaption.php @@ -56,7 +56,7 @@ class Ansel_Ajax_Imple_EditCaption extends Horde_Core_Ajax_Imple /* Are we requesting the unformatted text? */ if (!empty($args['action']) && $args['action'] == 'load') { $id = $args['id']; - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($id); $caption = $image->caption; return $caption; @@ -68,8 +68,8 @@ class Ansel_Ajax_Imple_EditCaption extends Horde_Core_Ajax_Imple return ''; } $id = $args['id']; - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($id); - $g = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($id); + $g = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if ($g->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { $image->caption = $pref_value; try { diff --git a/ansel/lib/Ajax/Imple/EditFaces.php b/ansel/lib/Ajax/Imple/EditFaces.php index f10b2ad94..f303c93d5 100644 --- a/ansel/lib/Ajax/Imple/EditFaces.php +++ b/ansel/lib/Ajax/Imple/EditFaces.php @@ -49,7 +49,7 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Core_Ajax_Imple // Attempt to get faces from the picture if we don't already have results, // or if we were asked to explicitly try again. if (($reload || empty($result))) { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->createView('screen'); $result = $faces->getFromPicture($image_id, $autocreate); } @@ -70,8 +70,8 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Core_Ajax_Imple case 'delete': // delete - deletes a single face from an image. $face_id = (int)$post['face']; - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception('Access denied editing the photo.'); } @@ -87,8 +87,8 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Core_Ajax_Imple } $name = $post['facename']; - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); - $gallery = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); + $gallery = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception('You are not allowed to edit this photo'); } diff --git a/ansel/lib/Ajax/Imple/EditGalleryFaces.php b/ansel/lib/Ajax/Imple/EditGalleryFaces.php index febbb012e..a2dcec02b 100644 --- a/ansel/lib/Ajax/Imple/EditGalleryFaces.php +++ b/ansel/lib/Ajax/Imple/EditGalleryFaces.php @@ -29,7 +29,7 @@ class Ansel_Ajax_Imple_EditGalleryFaces extends Horde_Ajax_Imple_Base $autocreate = true; $result = $faces->getImageFacesData($image_id); if (empty($result)) { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($this->_params['image_id']); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($this->_params['image_id']); $image->createView('screen'); $result = $faces->getFromPicture($this->_params['image_id'], $autocreate); } @@ -67,7 +67,7 @@ class Ansel_Ajax_Imple_EditGalleryFaces extends Horde_Ajax_Imple_Base // Attempt to get faces from the picture if we don't already have results, // or if we were asked to explicitly try again. if (($reload || empty($result))) { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->createView('screen'); $result = $faces->getFromPicture($image_id, $autocreate); } @@ -89,8 +89,8 @@ class Ansel_Ajax_Imple_EditGalleryFaces extends Horde_Ajax_Imple_Base case 'delete': // delete - deletes a single face from an image. $face_id = (int)$post['face']; - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); - $gallery = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); + $gallery = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception('Access denied editing the photo.'); } @@ -107,8 +107,8 @@ class Ansel_Ajax_Imple_EditGalleryFaces extends Horde_Ajax_Imple_Base } $name = $post['facename']; - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); - $gallery = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); + $gallery = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception('You are not allowed to edit this photo'); } diff --git a/ansel/lib/Ajax/Imple/GallerySlugCheck.php b/ansel/lib/Ajax/Imple/GallerySlugCheck.php index 55ccabbe2..f734a999a 100644 --- a/ansel/lib/Ajax/Imple/GallerySlugCheck.php +++ b/ansel/lib/Ajax/Imple/GallerySlugCheck.php @@ -38,7 +38,7 @@ class Ansel_Ajax_Imple_GallerySlugCheck extends Horde_Core_Ajax_Imple return array('response' => '0'); } - $exists = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->slugExists($slug) ? 0 : 1; + $exists = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->slugExists($slug) ? 0 : 1; return array('response' => $exists); } diff --git a/ansel/lib/Ajax/Imple/ImageSaveGeotag.php b/ansel/lib/Ajax/Imple/ImageSaveGeotag.php index c8df82061..7049896b5 100644 --- a/ansel/lib/Ajax/Imple/ImageSaveGeotag.php +++ b/ansel/lib/Ajax/Imple/ImageSaveGeotag.php @@ -39,8 +39,8 @@ class Ansel_Ajax_Imple_ImageSaveGeotag extends Horde_Core_Ajax_Imple // Get the image and gallery to check perms try { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage((int)$img); - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage((int)$img); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); } catch (Ansel_Exception $e) { return array('response' => 0); } @@ -64,7 +64,7 @@ class Ansel_Ajax_Imple_ImageSaveGeotag extends Horde_Core_Ajax_Imple // Now get the "add geotag" stuff $addurl = Horde::url('map_edit.php')->add('image', $img); $addLink = $addurl->link(array('onclick' => Horde::popupJs(Horde::url('map_edit.php'), array('params' => array('image' => $img), 'urlencode' => true, 'width' => '750', 'height' => '600')) . 'return false;')); - $imgs = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRecentImagesGeodata($GLOBALS['registry']->getAuth()); + $imgs = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRecentImagesGeodata($GLOBALS['registry']->getAuth()); if (count($imgs) > 0) { $imgsrc = '
'; foreach ($imgs as $id => $data) { diff --git a/ansel/lib/Ajax/Imple/LocationAutoCompleter.php b/ansel/lib/Ajax/Imple/LocationAutoCompleter.php index 31a9b98ad..5134d0241 100644 --- a/ansel/lib/Ajax/Imple/LocationAutoCompleter.php +++ b/ansel/lib/Ajax/Imple/LocationAutoCompleter.php @@ -27,7 +27,7 @@ class Ansel_Ajax_Imple_LocationAutoCompleter extends Horde_Core_Ajax_Imple_AutoC /* Use ajax? */ if (!isset($_SESSION['ansel']['ajax_locationac'])) { - $results = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->searchLocations(); + $results = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->searchLocations(); if ($results instanceof PEAR_Error) { Horde::logMessage($results, 'ERR'); } else { @@ -39,7 +39,7 @@ class Ansel_Ajax_Imple_LocationAutoCompleter extends Horde_Core_Ajax_Imple_AutoC $ret['ajax'] = 'LocationAutoCompleter'; } else { if (empty($results)) { - $results = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->searchLocations(); + $results = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->searchLocations(); } $ret['browser'] = Horde_Serialize::serialize($results, Horde_Serialize::JSON); } @@ -55,7 +55,7 @@ class Ansel_Ajax_Imple_LocationAutoCompleter extends Horde_Core_Ajax_Imple_AutoC return array(); } try { - $locs = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->searchLocations($input); + $locs = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->searchLocations($input); if (!count($locs)) { $locs = new StdClass(); } diff --git a/ansel/lib/Ajax/Imple/TagActions.php b/ansel/lib/Ajax/Imple/TagActions.php index 1d4cbaca2..40c721452 100644 --- a/ansel/lib/Ajax/Imple/TagActions.php +++ b/ansel/lib/Ajax/Imple/TagActions.php @@ -54,11 +54,11 @@ class Ansel_Ajax_Imple_TagActions extends Horde_Core_Ajax_Imple /* Get the resource owner */ if ($type == 'gallery') { - $resource = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($id); + $resource = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($id); $parent = $resource; } else { - $resource = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($id); - $parent = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($resource->gallery); + $resource = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($id); + $parent = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($resource->gallery); } switch ($action) { diff --git a/ansel/lib/Ansel.php b/ansel/lib/Ansel.php index 00f587b86..b5792a901 100644 --- a/ansel/lib/Ansel.php +++ b/ansel/lib/Ansel.php @@ -87,8 +87,8 @@ class Ansel { $params = new Horde_Support_Array($params); $galleries = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries($params); $tree = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Tree')->create('gallery_tree', 'Select'); @@ -204,8 +204,8 @@ class Ansel // Getting these objects is not ideal, but at this point // they should already be locally cached so the cost // is minimized. - $i = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($data['image']); - $g = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($data['gallery']); + $i = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($data['image']); + $g = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($data['gallery']); if ($g->get('view_mode') == 'Date') { $imgDate = new Horde_Date($i->originalDate); $data['year'] = $imgDate->year; @@ -405,7 +405,7 @@ class Ansel // We have to make sure the image exists first, since we won't // be going through img/*.php to auto-create it. try { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($imageId); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($imageId); } catch (Ansel_Exception $e) { Horde::logMessage($e, 'ERR'); return Horde::url((string)Ansel::getErrorImage($view), $full); @@ -541,7 +541,7 @@ class Ansel { global $prefs; - $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); $groupby = Horde_Util::getFormData('groupby', $prefs->getValue('groupby')); $owner = Horde_Util::getFormData('owner'); $image_id = (int)Horde_Util::getFormData('image'); @@ -871,11 +871,11 @@ class Ansel $zipfiles = array(); foreach ($images as $id) { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($id); // If we didn't select an entire gallery, check the download // size for each image. if (!isset($view)) { - $g = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $g = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); $v = $g->canDownload() ? 'full' : 'screen'; } else { $v = $view; diff --git a/ansel/lib/Api.php b/ansel/lib/Api.php index 967f80add..7867267ed 100644 --- a/ansel/lib/Api.php +++ b/ansel/lib/Api.php @@ -36,7 +36,7 @@ class Ansel_Api extends Horde_Registry_Api $path = trim($path, '/'); $parts = explode('/', $path); - $storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); if (empty($path)) { $owners = array(); $galleries = $storage->listGalleries(array('allLevels' => false)); @@ -80,7 +80,7 @@ class Ansel_Api extends Horde_Registry_Api // This request if for a certain gallery, list all sub-galleries // and images. $gallery_id = end($parts); - $galleries = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGalleries(array($gallery_id)); + $galleries = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGalleries(array($gallery_id)); if (!isset($galleries[$gallery_id]) || !$galleries[$gallery_id]->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) { @@ -92,7 +92,7 @@ class Ansel_Api extends Horde_Registry_Api } elseif (count($parts) > 2 && $this->galleryExists(null, $parts[count($parts) - 2]) && - ($image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage(end($parts)))) { + ($image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage(end($parts)))) { return array('data' => $image->raw(), 'mimetype' => $image->type, @@ -189,10 +189,10 @@ class Ansel_Api extends Horde_Registry_Api } $image_name = array_pop($parts); $gallery_id = end($parts); - if (!$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->galleryExists($gallery_id)) { + if (!$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->galleryExists($gallery_id)) { throw new Horde_Exception_NotFound("Gallery does not exist"); } - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception_PermissionDenied(_("Access denied adding photos to \"%s\".")); } @@ -218,7 +218,7 @@ class Ansel_Api extends Horde_Registry_Api } try { - if (!($image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id))) { + if (!($image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id))) { return false; } } catch (Ansel_Exception $e) { @@ -337,9 +337,9 @@ class Ansel_Api extends Horde_Registry_Api throw new InvalidArgumentException(_("A gallery to add this photo to is required.")); } if (!empty($params['slug'])) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGalleryBySlug($params['slug']); - } elseif ($GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->galleryExists($gallery_id)) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGalleryBySlug($params['slug']); + } elseif ($GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->galleryExists($gallery_id)) { + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); } /* Check perms for requested gallery */ @@ -421,8 +421,8 @@ class Ansel_Api extends Horde_Registry_Api $GLOBALS['injector']->getInstance('Ansel_Config')->set('scope', $params['scope']); } - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) { throw new Horde_Exception_PermissionDenied(sprintf(_("Access denied deleting photos from \"%s\"."), $gallery->get('name'))); } @@ -472,7 +472,7 @@ class Ansel_Api extends Horde_Registry_Api } /* Create the gallery */ - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->createGallery($attributes, $permobj, $parent); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->createGallery($attributes, $permobj, $parent); return $gallery->id; } @@ -502,11 +502,11 @@ class Ansel_Api extends Horde_Registry_Api } /* Get, and check perms on the gallery */ - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) { throw new Horde_Exception_PermissionDenied(sprintf(_("Access denied deleting gallery \"%s\"."), $gallery->get('name'))); } else { - return $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->removeGallery($gallery); + return $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->removeGallery($gallery); } } @@ -530,9 +530,9 @@ class Ansel_Api extends Horde_Registry_Api try { if (!empty($params['slug'])) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGalleryBySlug($params['slug']); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGalleryBySlug($params['slug']); } else { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); } return (int)$gallery->countImages(); } catch (Ansel_Exception $e) { @@ -560,9 +560,9 @@ class Ansel_Api extends Horde_Registry_Api } if (!empty($params['slug'])) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGalleryBySlug($params['slug']); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGalleryBySlug($params['slug']); } else { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); } return $gallery->getKeyImage(empty($params['style']) ? 'ansel_default' : $params['style']); @@ -619,8 +619,8 @@ class Ansel_Api extends Horde_Registry_Api } /* Get image and gallery */ - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); /* Check age and password */ if (!$gallery->hasPasswd() || !$gallery->isOldEnough()) { @@ -681,8 +681,8 @@ class Ansel_Api extends Horde_Registry_Api $GLOBALS['injector']->getInstance('Ansel_Config')->set('scope', $params['scope']); } $galleries = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries($params); $return = array(); foreach ($galleries as $gallery) { @@ -709,9 +709,9 @@ class Ansel_Api extends Horde_Registry_Api } if (count($slugs)) { - $results = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGalleriesBySlugs($slugs); + $results = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGalleriesBySlugs($slugs); } else { - $results = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGalleries($ids); + $results = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGalleries($ids); } // We can't just return the results of the getGalleries call - we need @@ -782,7 +782,7 @@ class Ansel_Api extends Horde_Registry_Api $GLOBALS['injector']->getInstance('Ansel_Config')->set('scope', $app); } - $storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); // Determine the default gallery when none is given. The first gallery // in the list is the default gallery. if (is_null($gallery_id) && empty($slug)) { @@ -848,7 +848,7 @@ class Ansel_Api extends Horde_Registry_Api if (!is_null($app)) { $GLOBALS['injector']->getInstance('Ansel_Config')->set('scope', $app); } - $images = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRecentImages($galleries, $limit, $slugs); + $images = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRecentImages($galleries, $limit, $slugs); $imagelist = array(); if ($style) { $style = Ansel::getStyleDefinition($style); @@ -894,7 +894,7 @@ class Ansel_Api extends Horde_Registry_Api $GLOBALS['injector']->getInstance('Ansel_Config')->set('scope', $app); } - return $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->countGalleries($GLOBALS['registry']->getAuth(), $perm, + return $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->countGalleries($GLOBALS['registry']->getAuth(), $perm, $attributes, $parent, $allLevels); } @@ -951,7 +951,7 @@ class Ansel_Api extends Horde_Registry_Api $return = array(); if (!empty($results['images'])) { foreach ($results['images'] as $image_id) { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $desc = $image->caption; $title = $image->filename; $view_url = Ansel::getUrlFor('view', @@ -969,7 +969,7 @@ class Ansel_Api extends Horde_Registry_Api if (!empty($results['galleries'])) { foreach ($results['galleries'] as $gallery) { - $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery); + $gal = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery); $view_url = Horde::url('view.php')->add( array('gallery' => $gallery, 'view' => 'Gallery')); @@ -998,7 +998,7 @@ class Ansel_Api extends Horde_Registry_Api $GLOBALS['injector']->getInstance('Ansel_Config')->set('scope', $app); } - return $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->galleryExists($gallery_id, $slug); + return $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->galleryExists($gallery_id, $slug); } /** diff --git a/ansel/lib/Application.php b/ansel/lib/Application.php index 1ddb85abc..79c66c0ba 100644 --- a/ansel/lib/Application.php +++ b/ansel/lib/Application.php @@ -65,13 +65,13 @@ class Ansel_Application extends Horde_Registry_Application throw new Horde_Exception('The Content_Tagger class could not be found. Make sure the registry entry for the Content system is present.'); } - $binders = array( - 'Ansel_Styles' => new Ansel_Injector_Binder_Styles(), - 'Ansel_Faces' => new Ansel_Injector_Binder_Faces(), - 'Ansel_Storage' => new Ansel_Injector_Binder_Storage() + $factories = array( + 'Ansel_Styles' => array('Ansel_Injector_Factory_Styles', 'create'), + 'Ansel_Faces' => array('Ansel_Injector_Factory_Faces', 'create'), + 'Ansel_Storage' => array('Ansel_Injector_Factory_Storage', 'create'), ); - foreach ($binders as $interface => $binder) { - $GLOBALS['injector']->addBinder($interface, $binder); + foreach ($factories as $interface => $v) { + $GLOBALS['injector']->bindFactory($interface, $v[0], $v[1]); } // Create db, share, and vfs instances. diff --git a/ansel/lib/Block/gallery.php b/ansel/lib/Block/gallery.php index be2bb44b5..8d44e2a1d 100644 --- a/ansel/lib/Block/gallery.php +++ b/ansel/lib/Block/gallery.php @@ -49,7 +49,7 @@ class Horde_Block_ansel_gallery extends Horde_Block 'type' => 'checkbox', 'default' => true)); - $storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); if ($storage->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) { foreach ($storage->listGalleries() as $gal) { $params['gallery']['values'][$gal->id] = $gal->get('name'); @@ -139,9 +139,9 @@ class Horde_Block_ansel_gallery extends Horde_Block // Get the gallery object and cache it. if (isset($this->_params['gallery']) && $this->_params['gallery'] != '__random') { - $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_params['gallery']); + $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($this->_params['gallery']); } else { - $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRandomGallery(); + $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRandomGallery(); } // Protect at least a little bit against getting an empty gallery. We diff --git a/ansel/lib/Block/my_galleries.php b/ansel/lib/Block/my_galleries.php index 42ececa98..0c9455db5 100644 --- a/ansel/lib/Block/my_galleries.php +++ b/ansel/lib/Block/my_galleries.php @@ -57,8 +57,8 @@ class Horde_Block_ansel_my_galleries extends Horde_Block /* Get the top level galleries */ try { - $galleries = $GLOBALS['injector']->getInstance('Ansel_Storage') - ->getScope()->listGalleries(array('perm' => Horde_Perms::EDIT, + $galleries = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage') + ->create()->listGalleries(array('perm' => Horde_Perms::EDIT, 'filter' => $GLOBALS['registry']->getAuth(), 'allLevels' => false, 'count' => empty($this->_params['limit']) ? 0 : $this->_params['limit'], diff --git a/ansel/lib/Block/random_photo.php b/ansel/lib/Block/random_photo.php index 50e8c2205..7a103db3e 100644 --- a/ansel/lib/Block/random_photo.php +++ b/ansel/lib/Block/random_photo.php @@ -44,7 +44,7 @@ class Horde_Block_ansel_random_photo extends Horde_Block */ protected function _content() { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRandomGallery(); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRandomGallery(); if (!$gallery) { return _("There are no photo galleries available."); } diff --git a/ansel/lib/Block/recent_comments.php b/ansel/lib/Block/recent_comments.php index 8f6b7fdca..340391f74 100644 --- a/ansel/lib/Block/recent_comments.php +++ b/ansel/lib/Block/recent_comments.php @@ -40,8 +40,8 @@ class Horde_Block_ansel_recent_comments extends Horde_Block 'type' => 'enum', 'default' => '__random', 'values' => array('all' => 'All'))); - $storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); - if ($storage->getScope()->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) { + $storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); + if ($storage->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) { foreach ($storage->listGalleries(array('perm' => Horde_Perms::READ)) as $id => $gal) { $params['gallery']['values'][$id] = $gal->get('name'); } @@ -121,7 +121,7 @@ class Horde_Block_ansel_recent_comments extends Horde_Block foreach ($results as $comment) { try { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($comment['image_id']); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($comment['image_id']); $url = Ansel::getUrlFor('view', array('view' => 'Image', 'gallery' => abs($image->gallery), @@ -163,9 +163,9 @@ class Horde_Block_ansel_recent_comments extends Horde_Block // Get the gallery object and cache it. if (isset($this->_params['gallery']) && $this->_params['gallery'] != '__random') { - $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_params['gallery']); + $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($this->_params['gallery']); } else { - $this->_gallery =$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRandomGallery(); + $this->_gallery =$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRandomGallery(); } if (empty($this->_gallery)) { diff --git a/ansel/lib/Block/recently_added.php b/ansel/lib/Block/recently_added.php index b2bae650e..c873791cc 100644 --- a/ansel/lib/Block/recently_added.php +++ b/ansel/lib/Block/recently_added.php @@ -44,8 +44,8 @@ class Horde_Block_ansel_recently_added extends Horde_Block 'default' => 10), ); - if ($GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) { - foreach ($GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->listGalleries(array('perm' => Horde_Perms::READ)) as $id => $gal) { + if ($GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) { + foreach ($GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->listGalleries(array('perm' => Horde_Perms::READ)) as $id => $gal) { if (!$gal->hasPasswd() && $gal->isOldEnough()) { $params['gallery']['values'][$id] = $gal->get('name'); } @@ -98,7 +98,7 @@ class Horde_Block_ansel_recently_added extends Horde_Block // Retrieve the images, but protect against very large values for limit. try { - $results = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRecentImages( + $results = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRecentImages( $galleries, min($this->_params['limit'], 100)); } catch (Ansel_Exception $e) { return $e->getMessage(); @@ -130,7 +130,7 @@ function previewImage(e, image_id) { HEADER; foreach ($results as $image) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); // Don't show locked galleries in the block. if (!$gallery->isOldEnough() || $gallery->hasPasswd()) { @@ -187,9 +187,9 @@ HEADER; /* Get the gallery object and cache it. */ if (isset($this->_params['gallery']) && $this->_params['gallery'] != '__random') { - $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_params['gallery']); + $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($this->_params['gallery']); } else { - $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRandomGallery(); + $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRandomGallery(); } if (empty($this->_gallery)) { diff --git a/ansel/lib/Block/recently_added_geodata.php b/ansel/lib/Block/recently_added_geodata.php index 941f8eaf8..d4d54c3de 100644 --- a/ansel/lib/Block/recently_added_geodata.php +++ b/ansel/lib/Block/recently_added_geodata.php @@ -53,14 +53,14 @@ class Horde_Block_ansel_recently_added_geodata extends Horde_Block protected function _content() { try { - $images = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRecentImagesGeodata(null, 0, min($this->_params['limit'], 100)); + $images = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRecentImagesGeodata(null, 0, min($this->_params['limit'], 100)); } catch (Ansel_Exception $e) { return $e->getMessage(); } $images = array_reverse($images); foreach ($images as $key => $image) { $id = $image['image_id']; - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image['gallery_id']); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image['gallery_id']); /* Don't show locked galleries in the block. */ if (!$gallery->isOldEnough() || $gallery->hasPasswd()) { diff --git a/ansel/lib/Faces/Base.php b/ansel/lib/Faces/Base.php index f288ab22f..cb8499c90 100644 --- a/ansel/lib/Faces/Base.php +++ b/ansel/lib/Faces/Base.php @@ -169,7 +169,7 @@ class Ansel_Faces_Base // should be encapsulated by the shares driver and not parsed from // an internally generated query string fragment. Will need to split // this out into two seperate operations somehow. - $share = substr($GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->shares->getShareCriteria( + $share = substr($GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->shares->getShareCriteria( $GLOBALS['registry']->getAuth(), Horde_Perms::READ), 5); $sql = 'SELECT f.face_id, f.gallery_id, f.image_id, f.face_name FROM ansel_faces f, ' @@ -209,7 +209,7 @@ class Ansel_Faces_Base { // add gallery permission // FIXME: Ditto on the REALLY ugly hack comment from above! - $share = substr($GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->shares->getShareCriteria( + $share = substr($GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->shares->getShareCriteria( $GLOBALS['registry']->getAuth(), Horde_Perms::READ), 5); $sql = 'SELECT COUNT(*) FROM ansel_faces f, ' @@ -352,7 +352,7 @@ class Ansel_Faces_Base return false; } $data = $this->getFaceById($face_id, true); - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); // Actually create the image. $this->createView( @@ -445,8 +445,8 @@ class Ansel_Faces_Base */ public function saveCustomFace($face_id, $image, $x1, $y1, $x2, $y2, $name = '') { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image); - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception_PermissionDenied('Access denied editing the photo.'); } @@ -534,8 +534,8 @@ class Ansel_Faces_Base { // get image if ID is passed if (!($image instanceof Ansel_Image)) { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image); - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception_PermissionDenied('Access denied editing the photo.'); } @@ -730,7 +730,7 @@ class Ansel_Faces_Base */ public function getFromGallery($gallery_id, $create = false, $force = false) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception(sprintf("Access denied editing gallery \"%s\".", $gallery->get('name'))); } diff --git a/ansel/lib/Gallery.php b/ansel/lib/Gallery.php index 5a664b798..775187b23 100644 --- a/ansel/lib/Gallery.php +++ b/ansel/lib/Gallery.php @@ -29,7 +29,7 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical { /* Pass on up the chain */ parent::__construct($attributes); - $this->setShareOb($GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->shares); + $this->setShareOb($GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->shares); $mode = isset($attributes['attribute_view_mode']) ? $attributes['attribute_view_mode'] : 'Normal'; $this->_setModeHelper($mode); } @@ -137,7 +137,7 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical } // Check for slug uniqueness - $slugGalleryId = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->slugExists($this->data['attribute_slug']); + $slugGalleryId = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->slugExists($this->data['attribute_slug']); if ($slugGalleryId > 0 && $slugGalleryId <> $this->id) { throw InvalidArgumentException( sprintf(_("Could not save gallery, the slug, \"%s\", already exists."), @@ -257,7 +257,7 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical /* Check for a supported multi-page image */ if ($image->isMultiPage() === true) { $params['name'] = $image->getImagePageCount() . ' page image: ' . $image->filename; - $mGallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->createGallery($params, $this->getPermission(), $this->getId()); + $mGallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->createGallery($params, $this->getPermission(), $this->getId()); $i = 1; foreach ($image as $page) { $page->caption = sprintf(_("Page %d"), $i++); @@ -551,7 +551,7 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical */ public function getRecentImages($limit = 10) { - return $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRecentImages(array($this->id), + return $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRecentImages(array($this->id), $limit); } @@ -564,7 +564,7 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical */ public function &getImage($id) { - return $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($id); + return $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($id); } /** @@ -665,8 +665,8 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical /* Fall through to a key image of a sub gallery. */ try { $galleries = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('parent' => $this, 'allLevels' => false)); foreach ($galleries as $galleryId => $gallery) { @@ -856,7 +856,7 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical { /* Make sure we have a gallery object */ if (!is_null($parent) && !($parent instanceof Ansel_Gallery)) { - $parent = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($parent); + $parent = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($parent); } /* Check this now since we don't know if we are updating the DB or not */ @@ -986,7 +986,7 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical public function __wakeup() { - $this->setShareOb($GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->shares); + $this->setShareOb($GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->shares); $mode = $this->get('view_mode'); $this->_setModeHelper($mode); } diff --git a/ansel/lib/Gallery/Decorator/Date.php b/ansel/lib/Gallery/Decorator/Date.php index a05860630..9932f7a92 100644 --- a/ansel/lib/Gallery/Decorator/Date.php +++ b/ansel/lib/Gallery/Decorator/Date.php @@ -112,8 +112,8 @@ class Ansel_Gallery_Decorator_Date */ public function getRecentImages($limit = 10) { - return $GLOBALS['injector']->getInstance('Ansel_Storage') - ->getScope() + return $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->getRecentImages(array($this->_gallery->id), $limit); } @@ -126,7 +126,7 @@ class Ansel_Gallery_Decorator_Date */ public function getImage($id) { - return $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($id); + return $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($id); } /** diff --git a/ansel/lib/GalleryMode/Date.php b/ansel/lib/GalleryMode/Date.php index edd92d125..8998d7631 100644 --- a/ansel/lib/GalleryMode/Date.php +++ b/ansel/lib/GalleryMode/Date.php @@ -158,7 +158,7 @@ class Ansel_GalleryMode_Date extends Ansel_GalleryMode_Base static $children = array(); /* Ansel Storage */ - $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); $cache_key = md5($this->_gallery->id . serialize($this->_date) . $from . $to); if (!empty($children[$cache_key])) { @@ -418,7 +418,7 @@ class Ansel_GalleryMode_Date extends Ansel_GalleryMode_Base */ if ($this->_gallery->get('has_subgalleries')) { $gallery_ids = array(); - $images = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImages(array('ids' => $ids)); + $images = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImages(array('ids' => $ids)); foreach ($images as $image) { if (empty($gallery_ids[$image->gallery])) { $gallery_ids[$image->gallery] = 1; @@ -429,12 +429,12 @@ class Ansel_GalleryMode_Date extends Ansel_GalleryMode_Base } /* Bulk update the images to their new gallery_id */ - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->setImagesGallery($ids, $gallery->id); + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->setImagesGallery($ids, $gallery->id); /* Update the gallery counts for each affected gallery */ if ($this->_gallery->get('has_subgalleries')) { foreach ($gallery_ids as $id => $count) { - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope() + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create() ->getGallery($id) ->updateImageCount($count, false); } @@ -467,7 +467,7 @@ class Ansel_GalleryMode_Date extends Ansel_GalleryMode_Base { /* Make sure $image is an Ansel_Image; if not, try loading it. */ if (!($image instanceof Ansel_Image)) { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image); } /* Make sure the image is in this gallery. */ @@ -497,11 +497,11 @@ class Ansel_GalleryMode_Date extends Ansel_GalleryMode_Base } catch (VFS_Exception $e) {} /* Delete from storage */ - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope() + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create() ->removeImage($image->id); if (!$isStack) { - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope() + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create() ->getGallery($image_gallery) ->updateImageCount(1, false); } @@ -611,8 +611,8 @@ class Ansel_GalleryMode_Date extends Ansel_GalleryMode_Base if (!is_array($this->_subGalleries)) { /* Get a list of all the subgalleries */ $subs = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('parent' => $this->_gallery)); $this->_subGalleries = array_keys($subs); } diff --git a/ansel/lib/GalleryMode/Normal.php b/ansel/lib/GalleryMode/Normal.php index 4f1093901..8ffa5de94 100644 --- a/ansel/lib/GalleryMode/Normal.php +++ b/ansel/lib/GalleryMode/Normal.php @@ -37,7 +37,7 @@ class Ansel_GalleryMode_Normal extends Ansel_GalleryMode_Base $galleries = array(); $num_galleries = 0; if ($this->hasSubGalleries()) { - $storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); /* Get the number of images and galleries */ $numimages = $this->countImages(); $num_galleries = $storage->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::SHOW, null, $this->_gallery, false); @@ -109,8 +109,8 @@ class Ansel_GalleryMode_Normal extends Ansel_GalleryMode_Base return $this->_gallery->data['attribute_images']; } - $gCnt = $GLOBALS['injector']->getInstance('Ansel_Storage') - ->getScope() + $gCnt = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->countGalleries($GLOBALS['registry']->getAuth(), $perm, null, $this->_gallery, false); @@ -134,8 +134,8 @@ class Ansel_GalleryMode_Normal extends Ansel_GalleryMode_Base */ public function listImages($from = 0, $count = 0) { - return $GLOBALS['injector']->getInstance('Ansel_Storage') - ->getScope() + return $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listImages($this->_gallery->id, $from, $count); } @@ -166,7 +166,7 @@ class Ansel_GalleryMode_Normal extends Ansel_GalleryMode_Base } } - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->setImagesGallery($ids, $gallery->id); + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->setImagesGallery($ids, $gallery->id); $this->_gallery->updateImageCount(count($ids), false); $gallery->updateImageCount(count($ids), true); @@ -215,7 +215,7 @@ class Ansel_GalleryMode_Normal extends Ansel_GalleryMode_Base } catch (VFS_Exception $e) {} /* Delete from storage */ - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->removeImage($image->id); + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->removeImage($image->id); if (!$isStack) { $this->_gallery->updateImageCount(1, false); } @@ -262,8 +262,8 @@ class Ansel_GalleryMode_Normal extends Ansel_GalleryMode_Base */ public function getImages($from = 0, $count = 0) { - $images = $GLOBALS['injector']->getInstance('Ansel_Storage') - ->getScope() + $images = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->getImages(array('gallery_id' => $this->_gallery->id, 'count' => $count, 'from' => $from)); @@ -295,8 +295,8 @@ class Ansel_GalleryMode_Normal extends Ansel_GalleryMode_Base if ($subgalleries && $this->hasSubGalleries()) { $count = $this->countImages(false); $galleries = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('parent' => $this->_gallery)); foreach ($galleries as $galleryId => $gallery) { diff --git a/ansel/lib/Image.php b/ansel/lib/Image.php index b221c2236..f7ec8b0ea 100644 --- a/ansel/lib/Image.php +++ b/ansel/lib/Image.php @@ -505,11 +505,11 @@ class Ansel_Image Implements Iterator /* Existing image, just save and exit */ if ($this->id) { /* Save image details */ - return $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->saveImage($this); + return $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->saveImage($this); } /* New image, need to save the image files */ - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->saveImage($this); + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->saveImage($this); /* The EXIF functions require a stream, so we need to save before we read */ $this->_writeData(); @@ -538,7 +538,7 @@ class Ansel_Image Implements Iterator /* Save again if EXIF changed any values */ if (!empty($needUpdate)) { - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->saveImage($this); + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->saveImage($this); } return $this->id; @@ -655,7 +655,7 @@ class Ansel_Image Implements Iterator /* Save attributes. */ foreach ($exif_fields as $name => $value) { - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->saveImageAttribute($this->id, $name, $value); + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->saveImageAttribute($this->id, $name, $value); $this->_exif[$name] = Horde_Image_Exif::getHumanReadable($name, $value); } @@ -754,7 +754,7 @@ class Ansel_Image Implements Iterator if ($view == 'all' || $view == 'prettythumb') { $styles = Horde::loadConfiguration('styles.php', 'styles', 'ansel'); - $hashes = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getHashes(); + $hashes = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getHashes(); foreach ($hashes as $hash) { $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs') @@ -816,7 +816,7 @@ class Ansel_Image Implements Iterator { if ($view == 'full' && !$this->_dirty) { // Check full photo permissions - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->gallery); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($this->gallery); if ($gallery instanceof PEAR_Error) { throw new Ansel_Exception($gallery); } @@ -1093,7 +1093,7 @@ class Ansel_Image Implements Iterator if (count($this->_tags)) { return $this->_tags; } - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->gallery); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($this->gallery); if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) { return $GLOBALS['injector']->getInstance('Ansel_Tagger')->getTags($this->id, 'image'); } else { @@ -1111,7 +1111,7 @@ class Ansel_Image Implements Iterator */ public function setTags($tags) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(abs($this->gallery)); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery(abs($this->gallery)); if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { // Clear the local cache. $this->_tags = array(); @@ -1174,7 +1174,7 @@ class Ansel_Image Implements Iterator } if (is_null($style)) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(abs($this->gallery)); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery(abs($this->gallery)); $style = $gallery->getStyle(); } $view = md5($style->thumbstyle . '.' . $style->background); @@ -1192,7 +1192,7 @@ class Ansel_Image Implements Iterator */ public function getAttributes($format = false) { - $attributes = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImageAttributes($this->id); + $attributes = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImageAttributes($this->id); $exif = Horde_Image_Exif::factory($GLOBALS['conf']['exif']['driver'], !empty($GLOBALS['conf']['exif']['params']) ? $GLOBALS['conf']['exif']['params'] : array()); $fields = Horde_Image_Exif::getFields($exif); $output = array(); diff --git a/ansel/lib/ImageGenerator.php b/ansel/lib/ImageGenerator.php index 8e4f8831b..1c375152a 100644 --- a/ansel/lib/ImageGenerator.php +++ b/ansel/lib/ImageGenerator.php @@ -149,8 +149,8 @@ class Ansel_ImageGenerator protected function _getGalleryWithImages($parent) { $galleries = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('parent' => $parent, 'allLevels' => false)); foreach ($galleries as $gallery) { diff --git a/ansel/lib/ImageGenerator/PolaroidThumb.php b/ansel/lib/ImageGenerator/PolaroidThumb.php index 27a9b7f62..2062a646b 100644 --- a/ansel/lib/ImageGenerator/PolaroidThumb.php +++ b/ansel/lib/ImageGenerator/PolaroidThumb.php @@ -29,7 +29,7 @@ class Ansel_ImageGenerator_PolaroidThumb extends Ansel_ImageGenerator (which will have a negative gallery_id). */ if ($this->_image->gallery > 0) { if (is_null($this->_style)) { - $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_image->gallery); + $gal = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($this->_image->gallery); $styleDef = $gal->getStyle(); } else { $styleDef = $this->_style; diff --git a/ansel/lib/ImageGenerator/RoundedThumb.php b/ansel/lib/ImageGenerator/RoundedThumb.php index c60ce13d8..e7f7d1e6e 100644 --- a/ansel/lib/ImageGenerator/RoundedThumb.php +++ b/ansel/lib/ImageGenerator/RoundedThumb.php @@ -29,7 +29,7 @@ class Ansel_ImageGenerator_RoundedThumb extends Ansel_ImageGenerator * (which will have a negative gallery_id). */ if ($this->_image->gallery > 0) { if (is_null($this->_style)) { - $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_image->gallery); + $gal = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($this->_image->gallery); $styleDef = $gal->getStyle(); } else { $styleDef = $this->_style; diff --git a/ansel/lib/ImageGenerator/ShadowThumb.php b/ansel/lib/ImageGenerator/ShadowThumb.php index 6be90f9ad..95aed414b 100644 --- a/ansel/lib/ImageGenerator/ShadowThumb.php +++ b/ansel/lib/ImageGenerator/ShadowThumb.php @@ -29,7 +29,7 @@ class Ansel_ImageGenerator_ShadowThumb extends Ansel_ImageGenerator * (which will have a negative gallery_id). */ if ($this->_image->gallery > 0) { if (is_null($this->_style)) { - $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_image->gallery); + $gal = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($this->_image->gallery); $styleDef = $gal->getStyle(); } else { $styleDef = $this->_style; diff --git a/ansel/lib/Injector/Binder/Faces.php b/ansel/lib/Injector/Binder/Faces.php deleted file mode 100644 index 99d8be596..000000000 --- a/ansel/lib/Injector/Binder/Faces.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @category Horde - * @license http://www.fsf.org/copyleft/gpl.html GPL - * @package Ansel - */ -class Ansel_Injector_Binder_Faces Implements Horde_Injector_Binder -{ - public function create (Horde_Injector $injector) - { - $driver = $GLOBALS['conf']['faces']['driver']; - $params = $GLOBALS['conf']['faces']; - $class_name = 'Ansel_Faces_' . ucfirst($driver); - - return new $class_name($params); - } - - /** - */ - public function equals(Horde_Injector_Binder $binder) - { - return false; - } -} \ No newline at end of file diff --git a/ansel/lib/Injector/Binder/Storage.php b/ansel/lib/Injector/Binder/Storage.php deleted file mode 100644 index fdb963227..000000000 --- a/ansel/lib/Injector/Binder/Storage.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @category Horde - * @license http://www.fsf.org/copyleft/gpl.html GPL - * @package Ansel - */ -class Ansel_Injector_Binder_Storage Implements Horde_Injector_Binder -{ - public function create(Horde_Injector $injector) - { - return new Ansel_Injector_Factory_Storage($injector); - } - - /** - */ - public function equals(Horde_Injector_Binder $binder) - { - return false; - } -} \ No newline at end of file diff --git a/ansel/lib/Injector/Binder/Styles.php b/ansel/lib/Injector/Binder/Styles.php deleted file mode 100644 index 9a8d20ada..000000000 --- a/ansel/lib/Injector/Binder/Styles.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @category Horde - * @license http://www.fsf.org/copyleft/gpl.html GPL - * @package Ansel - */ -class Ansel_Injector_Binder_Styles Implements Horde_Injector_Binder -{ - public function create (Horde_Injector $injector) - { - /* Brings in the $styles array in this scope only */ - $styles = Horde::loadConfiguration('styles.php', 'styles', 'ansel'); - - /* No prettythumbs allowed at all by admin choice */ - if (empty($GLOBALS['conf']['image']['prettythumbs'])) { - $test = $styles; - foreach ($test as $key => $style) { - if ($style['thumbstyle'] != 'Thumb') { - unset($styles[$key]); - } - } - } - - /* Check if the browser / server has png support */ - if ($GLOBALS['browser']->hasQuirk('png_transparency') || - $GLOBALS['conf']['image']['type'] != 'png') { - - $test = $styles; - foreach ($test as $key => $style) { - if (!empty($style['requires_png'])) { - if (!empty($style['fallback'])) { - $styles[$key] = $styles[$style['fallback']]; - } else { - unset($styles[$key]); - } - } - } - } - - return $styles; - } - - /** - */ - public function equals(Horde_Injector_Binder $binder) - { - return false; - } -} \ No newline at end of file diff --git a/ansel/lib/Injector/Factory/Faces.php b/ansel/lib/Injector/Factory/Faces.php new file mode 100644 index 000000000..513c676e2 --- /dev/null +++ b/ansel/lib/Injector/Factory/Faces.php @@ -0,0 +1,21 @@ + + * @category Horde + * @license http://www.fsf.org/copyleft/gpl.html GPL + * @package Ansel + */ +class Ansel_Injector_Factory_Faces +{ + public function create (Horde_Injector $injector) + { + $driver = $GLOBALS['conf']['faces']['driver']; + $params = $GLOBALS['conf']['faces']; + $class_name = 'Ansel_Faces_' . ucfirst($driver); + + return new $class_name($params); + } + +} \ No newline at end of file diff --git a/ansel/lib/Injector/Factory/Storage.php b/ansel/lib/Injector/Factory/Storage.php index a75893f56..0b691be2f 100644 --- a/ansel/lib/Injector/Factory/Storage.php +++ b/ansel/lib/Injector/Factory/Storage.php @@ -33,7 +33,7 @@ class Ansel_Injector_Factory_Storage * * @return Ansel_Storage */ - public function getScope() + public function create() { $scope = $this->_injector->getInstance('Ansel_Config')->get('scope'); if (empty($this->_instances[$scope])) { diff --git a/ansel/lib/Injector/Factory/Styles.php b/ansel/lib/Injector/Factory/Styles.php new file mode 100644 index 000000000..d4527cdd7 --- /dev/null +++ b/ansel/lib/Injector/Factory/Styles.php @@ -0,0 +1,46 @@ + + * @category Horde + * @license http://www.fsf.org/copyleft/gpl.html GPL + * @package Ansel + */ +class Ansel_Injector_Factory_Styles +{ + public function create (Horde_Injector $injector) + { + /* Brings in the $styles array in this scope only */ + $styles = Horde::loadConfiguration('styles.php', 'styles', 'ansel'); + + /* No prettythumbs allowed at all by admin choice */ + if (empty($GLOBALS['conf']['image']['prettythumbs'])) { + $test = $styles; + foreach ($test as $key => $style) { + if ($style['thumbstyle'] != 'Thumb') { + unset($styles[$key]); + } + } + } + + /* Check if the browser / server has png support */ + if ($GLOBALS['browser']->hasQuirk('png_transparency') || + $GLOBALS['conf']['image']['type'] != 'png') { + + $test = $styles; + foreach ($test as $key => $style) { + if (!empty($style['requires_png'])) { + if (!empty($style['fallback'])) { + $styles[$key] = $styles[$style['fallback']]; + } else { + unset($styles[$key]); + } + } + } + } + + return $styles; + } + +} \ No newline at end of file diff --git a/ansel/lib/Search/Tag.php b/ansel/lib/Search/Tag.php index 483ea50ed..51ce0ae02 100644 --- a/ansel/lib/Search/Tag.php +++ b/ansel/lib/Search/Tag.php @@ -113,7 +113,7 @@ class Ansel_Search_Tag /* Instantiate the Gallery objects */ $galleries = array(); foreach ($gresults as $gallery) { - $galleries[] = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery); + $galleries[] = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery); } /* Do we need to get images? */ @@ -121,7 +121,7 @@ class Ansel_Search_Tag $count = $perpage - count($galleries); if ($count > 0) { $iresults = array_slice($this->_results['images'], $istart, $count); - $images = count($iresults) ? array_values($GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImages(array('ids' => $iresults))) : array(); + $images = count($iresults) ? array_values($GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImages(array('ids' => $iresults))) : array(); if (($conf['comments']['allow'] == 'all' || ($conf['comments']['allow'] == 'authenticated' && $GLOBALS['registry']->getAuth())) && $registry->hasMethod('forums/numMessagesBatch')) { diff --git a/ansel/lib/Storage.php b/ansel/lib/Storage.php index 444e484b3..adb9d56f5 100644 --- a/ansel/lib/Storage.php +++ b/ansel/lib/Storage.php @@ -884,7 +884,7 @@ class Ansel_Storage $image = $this->getImage($id); $gallery_id = abs($image->gallery); if (empty($galleries[$gallery_id])) { - $galleries[$gallery_id]['gallery'] = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $galleries[$gallery_id]['gallery'] = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); } // Any authentication that needs to take place for any of the diff --git a/ansel/lib/Tagger.php b/ansel/lib/Tagger.php index bd754bd10..0efc8aa7c 100644 --- a/ansel/lib/Tagger.php +++ b/ansel/lib/Tagger.php @@ -368,7 +368,7 @@ class Ansel_Tagger { $args = array('typeId' => 'image', 'limit' => 1); if ($ownerOnly) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); $args['userId'] = $gallery->get('owner'); } @@ -383,7 +383,7 @@ class Ansel_Tagger } try { - $images = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImages(array('ids' => array_keys($ids))); + $images = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImages(array('ids' => array_keys($ids))); } catch (Horde_Exception_NotFound $e) { $images = array(); } diff --git a/ansel/lib/Tile/Image.php b/ansel/lib/Tile/Image.php index 56dfae674..93d05d5a2 100644 --- a/ansel/lib/Tile/Image.php +++ b/ansel/lib/Tile/Image.php @@ -27,7 +27,7 @@ class Ansel_Tile_Image { global $conf, $registry; - $parent = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); + $parent = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (is_null($style)) { $style = $parent->getStyle(); } diff --git a/ansel/lib/View/Base.php b/ansel/lib/View/Base.php index 0ef80ef5c..9aac1ee6e 100644 --- a/ansel/lib/View/Base.php +++ b/ansel/lib/View/Base.php @@ -141,9 +141,9 @@ abstract class Ansel_View_Base // If we have a slug, use it. try { if (!empty($slug)) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGalleryBySlug($slug); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGalleryBySlug($slug); } else { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); } } catch (Ansel_Exception $e) { throw new Horde_Exception_NotFound($e->getmessage()); diff --git a/ansel/lib/View/EmbeddedRenderer/GalleryLink.php b/ansel/lib/View/EmbeddedRenderer/GalleryLink.php index 3d986f31d..c0640a95f 100644 --- a/ansel/lib/View/EmbeddedRenderer/GalleryLink.php +++ b/ansel/lib/View/EmbeddedRenderer/GalleryLink.php @@ -81,7 +81,7 @@ class Ansel_View_EmbeddedRenderer_GalleryLink extends Ansel_View_Gallery $images[] = $gallery->getKeyImage($gallery_style); } } - $json = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImageJson($images, null, true, $thumbsize, true); + $json = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImageJson($images, null, true, $thumbsize, true); /* Some paths */ $cssurl = Horde::url($GLOBALS['registry']->get('themesuri', 'ansel') . '/jsembed.css', true); diff --git a/ansel/lib/View/EmbeddedRenderer/Mini.php b/ansel/lib/View/EmbeddedRenderer/Mini.php index 063d3fca6..0c030f258 100644 --- a/ansel/lib/View/EmbeddedRenderer/Mini.php +++ b/ansel/lib/View/EmbeddedRenderer/Mini.php @@ -76,8 +76,8 @@ class Ansel_View_EmbeddedRenderer_Mini extends Ansel_View_Gallery 'count' => $count, 'view_links' => true)); } else { - $json = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImageJson($images, null, true, $thumbsize, true); - $json_full = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImageJson($images, null, true, 'screen', true); + $json = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImageJson($images, null, true, $thumbsize, true); + $json_full = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImageJson($images, null, true, 'screen', true); } /* Some paths */ diff --git a/ansel/lib/View/GalleryProperties.php b/ansel/lib/View/GalleryProperties.php index 8718361f7..3356f9ffd 100644 --- a/ansel/lib/View/GalleryProperties.php +++ b/ansel/lib/View/GalleryProperties.php @@ -149,7 +149,7 @@ class Ansel_View_GalleryProperties // permissions to add to it. $parentId = $this->_params['gallery']; try { - $parent = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($parentId); + $parent = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($parentId); } catch (Ansel_Exception $e) { $GLOBALS['notification']->push($e->getMessage(), 'horde.error'); Horde::url('view.php?view=List', true)->redirect(); @@ -182,7 +182,7 @@ class Ansel_View_GalleryProperties } try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_params['gallery']); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($this->_params['gallery']); $parent = $gallery->getParent(); $this->_properties = array( 'name' => $gallery->get('name'), @@ -255,10 +255,10 @@ class Ansel_View_GalleryProperties $gallery_parent = null; } if ($galleryId && - ($exists = ($GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->galleryExists($galleryId)) === true)) { + ($exists = ($GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->galleryExists($galleryId)) === true)) { // Modifying an existing gallery. - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { $GLOBALS['notification']->push(sprintf(_("Access denied saving gallery \"%s\"."), $gallery->get('name')), 'horde.error'); } else { @@ -287,7 +287,7 @@ class Ansel_View_GalleryProperties } if ($gallery_parent != $old_parent_id) { if (!is_null($gallery_parent)) { - $new_parent = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_parent); + $new_parent = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_parent); } else { $new_parent = null; } @@ -310,7 +310,7 @@ class Ansel_View_GalleryProperties // Is this a new subgallery? if ($gallery_parent) { try { - $parent = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_parent); + $parent = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_parent); } catch (Ansel_Exception $e) { $GLOBALS['notification']->push($e->getMessage(), 'horde.error'); Horde::url(Ansel::getUrlFor('view', array('view' => 'List'), true))->redirect(); @@ -340,7 +340,7 @@ class Ansel_View_GalleryProperties $parent = (!empty($gallery_parent)) ? $gallery_parent : null; try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->createGallery( + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->createGallery( array('name' => $gallery_name, 'desc' => $gallery_desc, 'tags' => explode(',', $gallery_tags), @@ -369,7 +369,7 @@ class Ansel_View_GalleryProperties // Make sure that the style hash is recorded, ignoring non-styled thumbs if ($style->thumbstyle != 'Thumb') { - $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->ensureHash($gallery->getViewHash('prettythumb')); + $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->ensureHash($gallery->getViewHash('prettythumb')); } // Clear the OtherGalleries widget cache diff --git a/ansel/lib/View/GalleryRenderer/Gallery.php b/ansel/lib/View/GalleryRenderer/Gallery.php index 7fe5cee55..c7b73c4f7 100644 --- a/ansel/lib/View/GalleryRenderer/Gallery.php +++ b/ansel/lib/View/GalleryRenderer/Gallery.php @@ -49,8 +49,8 @@ class Ansel_View_GalleryRenderer_Gallery extends Ansel_View_GalleryRenderer_Base if (empty($this->view->api)) { $option_edit = $this->view->gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT); $option_select = $option_delete = $this->view->gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE); - $option_move = ($option_delete && $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->countGalleries(Horde_Perms::EDIT)); - $option_copy = ($option_edit && $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->countGalleries(Horde_Perms::EDIT)); + $option_move = ($option_delete && $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->countGalleries(Horde_Perms::EDIT)); + $option_copy = ($option_edit && $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->countGalleries(Horde_Perms::EDIT)); /* See if we requested a show_actions change */ if (Horde_Util::getFormData('actionID', '') == 'show_actions') { diff --git a/ansel/lib/View/GalleryRenderer/GalleryLightbox.php b/ansel/lib/View/GalleryRenderer/GalleryLightbox.php index 5fba62d40..b9820f7bc 100644 --- a/ansel/lib/View/GalleryRenderer/GalleryLightbox.php +++ b/ansel/lib/View/GalleryRenderer/GalleryLightbox.php @@ -73,8 +73,8 @@ class Ansel_View_GalleryRenderer_GalleryLightbox extends Ansel_View_GalleryRende Horde_Perms::EDIT); $option_select = $option_delete = $this->view->gallery->hasPermission( $GLOBALS['registry']->getAuth(), Horde_Perms::DELETE); - $option_move = ($option_delete && $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->countGalleries(Horde_Perms::EDIT)); - $option_copy = ($option_edit && $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->countGalleries(Horde_Perms::EDIT)); + $option_move = ($option_delete && $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->countGalleries(Horde_Perms::EDIT)); + $option_copy = ($option_edit && $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->countGalleries(Horde_Perms::EDIT)); /* See if we requested a show_actions change (fallback for non-js) */ if (Horde_Util::getFormData('actionID', '') == 'show_actions') { $prefs->setValue('show_actions', (int)!$prefs->getValue('show_actions')); diff --git a/ansel/lib/View/Image.php b/ansel/lib/View/Image.php index 3aecaaf3b..804351329 100644 --- a/ansel/lib/View/Image.php +++ b/ansel/lib/View/Image.php @@ -32,7 +32,7 @@ class Ansel_View_Image extends Ansel_View_Base parent::__construct($params); /* Get the Ansel_Image */ - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($params['image_id']); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($params['image_id']); /* Get the Ansel_Gallery */ $this->gallery = $this->_getGallery(); diff --git a/ansel/lib/View/List.php b/ansel/lib/View/List.php index b7f3bdea4..0d0d66b75 100644 --- a/ansel/lib/View/List.php +++ b/ansel/lib/View/List.php @@ -52,7 +52,7 @@ class Ansel_View_List extends Ansel_View_Base $notification = $GLOBALS['injector']->getInstance('Horde_Notification'); /* Ansel_Storage */ - $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); // We'll need this in the template. $this->_sortBy = !empty($this->_params['sort']) ? $this->_params['sort'] : 'name'; diff --git a/ansel/lib/View/Results.php b/ansel/lib/View/Results.php index f257e53f3..d50c8fb41 100644 --- a/ansel/lib/View/Results.php +++ b/ansel/lib/View/Results.php @@ -55,7 +55,7 @@ class Ansel_View_Results extends Ansel_View_Base global $prefs, $conf; $notification = $GLOBALS['injector']->getInstance('Horde_Notification'); - $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); $this->_owner = Horde_Util::getFormData('owner', ''); //@TODO: Inject the search object when we have more then just a tag search @@ -226,7 +226,7 @@ class Ansel_View_Results extends Ansel_View_Base global $conf, $prefs; /* Ansel Storage*/ - $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); // Get the slice of galleries/images to view on this page. $results = $this->_search->getSlice($this->_page, $this->_perPage); diff --git a/ansel/lib/View/Upload.php b/ansel/lib/View/Upload.php index 038e18756..ece2e0cb6 100644 --- a/ansel/lib/View/Upload.php +++ b/ansel/lib/View/Upload.php @@ -166,7 +166,7 @@ EOT; $cnt = count($image_ids); for ($i = 0; $i < $conf['image']['autogen'] && $cnt > $i; $i++) { $image_id = $image_ids[$i]; - $image = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); + $image = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); $image->createView('screen'); $image->createView('thumb'); $image->createView('mini'); diff --git a/ansel/lib/Widget/Geotag.php b/ansel/lib/Widget/Geotag.php index d93ca8616..cb5c3e494 100644 --- a/ansel/lib/Widget/Geotag.php +++ b/ansel/lib/Widget/Geotag.php @@ -69,7 +69,7 @@ class Ansel_Widget_Geotag extends Ansel_Widget_Base */ public function html() { - $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); $geodata = $ansel_storage->getImagesGeodata($this->_params['images']); $url = Horde::url('map_edit.php', true); $rtext = _("Relocate this image"); @@ -260,7 +260,7 @@ EOT; */ protected function _getGalleryImagesWithGeodata() { - return $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImagesGeodata(array(), $this->_view->gallery->id); + return $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImagesGeodata(array(), $this->_view->gallery->id); } /** diff --git a/ansel/lib/Widget/OtherGalleries.php b/ansel/lib/Widget/OtherGalleries.php index 880ebf6b0..4d0b1092d 100644 --- a/ansel/lib/Widget/OtherGalleries.php +++ b/ansel/lib/Widget/OtherGalleries.php @@ -67,8 +67,8 @@ class Ansel_Widget_OtherGalleries extends Ansel_Widget_Base $tree = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Tree')->create('otherAnselGalleries_' . md5($owner), 'Javascript', array('class' => 'anselWidgets')); try { - $galleries = $GLOBALS['injector']->getInstance('Ansel_Storage') - ->getScope() + $galleries = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('filter' => $owner)); } catch (Ansel_Exception $e) { Horde::logMessage($e, 'ERR'); diff --git a/ansel/lib/Widget/SimilarPhotos.php b/ansel/lib/Widget/SimilarPhotos.php index 5ac5408de..7bcb64f4a 100755 --- a/ansel/lib/Widget/SimilarPhotos.php +++ b/ansel/lib/Widget/SimilarPhotos.php @@ -49,7 +49,7 @@ class Ansel_Widget_SimilarPhotos extends Ansel_Widget_Base */ public function _getRelatedImages() { - $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); + $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create(); $html = ''; $args = array('typeId' => 'image', @@ -60,7 +60,7 @@ class Ansel_Widget_SimilarPhotos extends Ansel_Widget_Base $i = 0; foreach ($results as $result) { $img = $result['image']; - $rGal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($img->gallery); + $rGal = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($img->gallery); if ($rGal->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) $html .= Ansel::getUrlFor( 'view', diff --git a/ansel/map_edit.php b/ansel/map_edit.php index 855bb993e..6ad31de3f 100644 --- a/ansel/map_edit.php +++ b/ansel/map_edit.php @@ -22,8 +22,8 @@ $image_id = Horde_Util::getFormData('image'); if (empty($image_id)) { throw new Ansel_Exception(_("An error has occured retrieving the image. Details have been logged.")); } -$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id); -$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($image->gallery); +$image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id); +$gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($image->gallery); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception_PermissionDenied(_("Not Authorized. Details have been logged for the server administrator.")); } @@ -72,7 +72,7 @@ $gtUrl = $gt->getUrl(); $loadingImg = Horde::img('loading.gif', _("Loading...")); /* Obtain other geotagged images to possibly locate this image at */ -$imgs = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRecentImagesGeodata($GLOBALS['registry']->getAuth()); +$imgs = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRecentImagesGeodata($GLOBALS['registry']->getAuth()); if (count($imgs) > 0) { $other_images = '
' . _("Click on a thumbnail to locate at the same point.") . '
'; foreach ($imgs as $id => $data) { diff --git a/ansel/perms.php b/ansel/perms.php index 5ea772fec..6baf30b23 100644 --- a/ansel/perms.php +++ b/ansel/perms.php @@ -27,13 +27,13 @@ $actionID = Horde_Util::getFormData('actionID', 'edit'); switch ($actionID) { case 'edit': try { - $share = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(Horde_Util::getFormData('cid')); + $share = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery(Horde_Util::getFormData('cid')); $form = 'edit.inc'; $perm = &$share->getPermission(); } catch (Horde_Share_Exception $e) { if (($share_name = Horde_Util::getFormData('share')) !== null) { try { - $share = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->shares->getShare($share_name); + $share = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->shares->getShare($share_name); $form = 'edit.inc'; $perm = $share->getPermission(); } catch (Horde_Share_Exception $e) { @@ -51,7 +51,7 @@ case 'edit': case 'editform': case 'editforminherit': try { - $share = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(Horde_Util::getFormData('cid')); + $share = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery(Horde_Util::getFormData('cid')); } catch (Horde_Share_Exception $e) { $notification->push(_("Attempt to edit a non-existent share."), 'horde.error'); } @@ -251,8 +251,8 @@ if (empty($share)) { $title = _("Edit Permissions"); } else { $children = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('perm' => Horde_Perms::READ, 'parent' => $share)); $title = sprintf(_("Edit Permissions for %s"), $share->get('name')); diff --git a/ansel/preview.php b/ansel/preview.php index 7356b2be3..5e5282514 100644 --- a/ansel/preview.php +++ b/ansel/preview.php @@ -13,8 +13,8 @@ Horde_Registry::appInit('ansel'); $imageId = Horde_Util::getFormData('image'); try { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($imageId); - $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(abs($image->gallery)); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($imageId); + $gal = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery(abs($image->gallery)); $img = Ansel::getImageUrl($imageId, 'thumb', false); } catch (Ansel_Exception $e) { Horde::logMessage($e->getMessage(), 'ERR'); diff --git a/ansel/protect.php b/ansel/protect.php index 09eab390c..c7128e53d 100644 --- a/ansel/protect.php +++ b/ansel/protect.php @@ -13,7 +13,7 @@ Horde_Registry::appInit('ansel'); $vars = Horde_Variables::getDefaultVariables(); try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($vars->get('gallery')); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($vars->get('gallery')); } catch (Ansel_Exception $e) { $notification->push($e->getMessage()); Horde::url('list.php')->redirect(); diff --git a/ansel/report.php b/ansel/report.php index 495dc090f..0a1a338ab 100644 --- a/ansel/report.php +++ b/ansel/report.php @@ -17,7 +17,7 @@ Horde_Registry::appInit('ansel'); $title = _("Do you really want to report this gallery?"); $gallery_id = (int)Horde_Util::getFormData('gallery'); try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); } catch (Ansel_Exception $e) { $notification->push($gallery->getMessage()); Horde::url('view.php?view=List', true)->redirect(); diff --git a/ansel/rss.php b/ansel/rss.php index 4008a51e7..22d2d9241 100644 --- a/ansel/rss.php +++ b/ansel/rss.php @@ -41,7 +41,7 @@ if (empty($rss)) { switch ($stream_type) { case 'all': try { - $images = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRecentImages(); + $images = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRecentImages(); } catch (Ansel_Exception $e) { $images = array(); } @@ -73,23 +73,23 @@ if (empty($rss)) { // Retrieve latest from specified gallery // Try a slug first. if ($slug) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGalleryBySlug($slug); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGalleryBySlug($slug); } elseif (is_numeric($id)) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($id); } if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::SHOW) && !$gallery->hasPasswd() && $gallery->isOldEnough()) { if (!$gallery->countImages() && $gallery->hasSubGalleries()) { $subgalleries = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('parent' => $gallery)); $subs = array(); foreach ($subgalleries as $subgallery) { $subs[] = $subgallery->id; } - $images = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRecentImages($subs); + $images = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getRecentImages($subs); } else { $images = $gallery->getRecentImages(); $owner = $gallery->getIdentity(); @@ -104,7 +104,7 @@ if (empty($rss)) { array('view' => 'Gallery', 'gallery' => $id), true); - $img = &$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default'))); + $img = &$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default'))); $params = array('last_modified' => $gallery->get('last_modified'), 'name' => sprintf(_("%s on %s"), $gallery->get('name'), @@ -125,8 +125,8 @@ if (empty($rss)) { $galleries = array(); try { $shares = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('filter' => $id)); foreach ($shares as $gallery) { if ($gallery->isOldEnough() && !$gallery->hasPasswd()) { @@ -140,8 +140,8 @@ if (empty($rss)) { if (isset($galleries) && count($galleries)) { try { $images = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->getRecentImages($galleries); } catch (Ansel_Exception $e) { Horde::logMessage($e->getMessage(), 'ERR'); @@ -180,7 +180,7 @@ if (empty($rss)) { $images = $GLOBALS['injector']->getInstance('Ansel_Tagger')->search(array($id), $filter); try { - $images = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImages(array('ids' => $images['images'])); + $images = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImages(array('ids' => $images['images'])); } catch (Ansel_Exception $e) { Horde::logMessage($e->getMessage(), 'ERR'); $images = array(); @@ -214,7 +214,7 @@ if (empty($rss)) { $gallery_id = $images[$i]->gallery; if (empty($galleries[$gallery_id])) { try { - $galleries[$gallery_id]['gallery'] = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $galleries[$gallery_id]['gallery'] = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); } catch (Ansel_Exception $e) {} } if (!isset($galleries[$gallery_id]['perm'])) { diff --git a/ansel/scripts/all_images_exif_to_tags.php b/ansel/scripts/all_images_exif_to_tags.php index 2c38753fa..b6421b692 100755 --- a/ansel/scripts/all_images_exif_to_tags.php +++ b/ansel/scripts/all_images_exif_to_tags.php @@ -79,7 +79,7 @@ if ($results instanceof PEAR_Error) { $image_ids = $results->fetchAll(MDB2_FETCHMODE_ASSOC); $results->free(); foreach (array_values($image_ids) as $image_id) { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($image_id['image_id']); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($image_id['image_id']); $results = $image->exifToTags($exif_fields); $cli->message(sprintf(_("Extracted exif fields from %s"), $image->filename), 'cli.success'); } diff --git a/ansel/scripts/ansel.php b/ansel/scripts/ansel.php index 84ba350c0..7ca27c0b2 100755 --- a/ansel/scripts/ansel.php +++ b/ansel/scripts/ansel.php @@ -102,12 +102,12 @@ if (!empty($username) && !empty($password)) { // Choose the gallery to add to (or use the created one). if (!empty($galleryId)) { - if (!$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->galleryExists($galleryId)) { + if (!$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->galleryExists($galleryId)) { $error = sprintf(_("Invalid gallery \"%s\" specified."), $galleryId); Horde::logMessage($error, 'WARN'); $cli->fatal($error); } else { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { $error = sprintf(_("Access denied adding photos to \"%s\"."), $galleryId); Horde::logMessage($error, 'WARN'); @@ -128,7 +128,7 @@ if (!empty($createGallery)) { 'desc' => $gallery_desc, 'owner' => $gallery_owner); try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->createGallery($attributes, null, $parent); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->createGallery($attributes, null, $parent); } catch (Ansel_Exception $e) { $galleryId = null; $error = sprintf(_("The gallery \"%s\" couldn't be created: %s"), @@ -150,11 +150,11 @@ if (!empty($list)) { $images = array_keys($images); foreach ($images as $id) { - $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getImage($id); + $image = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImage($id); $cli->writeln(str_pad($image->filename, 30) . $image->getVFSPath() . '/' . $id); } } else { - $galleries = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->listGalleries(); + $galleries = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->listGalleries(); $cli->message(_("Listing Gallery/Name"), 'cli.success'); $cli->writeln(); foreach ($galleries as $id => $gallery) { diff --git a/ansel/scripts/recursive_import.php b/ansel/scripts/recursive_import.php index 9e2b43216..21a37b6d5 100755 --- a/ansel/scripts/recursive_import.php +++ b/ansel/scripts/recursive_import.php @@ -87,7 +87,7 @@ if (!empty($order) && $order != 'date' && $order != 'name' && $order != 'random' $gallery_id = processDirectory($dir); if (!$keepEmpties) { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery_id); emptyGalleryCheck($gallery); } exit; @@ -101,22 +101,22 @@ function emptyGalleryCheck($gallery) { if ($gallery->hasSubGalleries()) { $children = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('parent' => $gallery)); foreach ($children as $child) { // First check all children to see if they are empty... emptyGalleryCheck($child); if (!$child->countImages() && !$child->hasSubGalleries()) { - $result = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->removeGallery($child); + $result = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->removeGallery($child); $GLOBALS['cli']->message(sprintf(_("Deleting empty gallery, \"%s\""), $child->get('name')), 'cli.success'); } // Refresh the gallery values since we mucked around a bit with it - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery->getId()); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery->getId()); // Now that any empty children are removed, see if we are empty if (!$gallery->countImages() && !$gallery->hasSubGalleries()) { - $result = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->removeGallery($gallery); + $result = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->removeGallery($gallery); $GLOBALS['cli']->message(sprintf(_("Deleting empty gallery, \"%s\""), $gallery->get('name')), 'cli.success'); } } @@ -182,7 +182,7 @@ function processDirectory($dir, $parent = null) // Create a gallery for this directory level. $name = basename($dir); $cli->message(sprintf(_("Creating gallery: \"%s\""), $name), 'cli.message'); - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->createGallery(array('name' => $name), null, $parent); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->createGallery(array('name' => $name), null, $parent); $cli->message(sprintf(_("The gallery \"%s\" was created successfully."), $name), 'cli.success'); // Read all the files into an array. diff --git a/ansel/scripts/remote_import.php b/ansel/scripts/remote_import.php index fc3780967..61e5bd3a5 100755 --- a/ansel/scripts/remote_import.php +++ b/ansel/scripts/remote_import.php @@ -115,22 +115,22 @@ function emptyGalleryCheck($gallery) { if ($gallery->hasSubGalleries()) { $children = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('parent' => $gallery)); foreach ($children as $child) { // First check all children to see if they are empty... emptyGalleryCheck($child); if (!$child->countImages() && !$child->hasSubGalleries()) { - $result = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->removeGallery($child); + $result = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->removeGallery($child); $GLOBALS['cli']->message(sprintf(_("Deleting empty gallery, \"%s\""), $child->get('name')), 'cli.success'); } // Refresh the gallery values since we mucked around a bit with it - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery->getId()); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($gallery->getId()); // Now that any empty children are removed, see if we are empty if (!$gallery->countImages() && !$gallery->hasSubGalleries()) { - $result = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->removeGallery($gallery); + $result = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->removeGallery($gallery); $GLOBALS['cli']->message(sprintf(_("Deleting empty gallery, \"%s\""), $gallery->get('name')), 'cli.success'); } } diff --git a/ansel/templates/gallery/delete_confirmation.inc b/ansel/templates/gallery/delete_confirmation.inc index dbfd99a60..48c0b1aab 100644 --- a/ansel/templates/gallery/delete_confirmation.inc +++ b/ansel/templates/gallery/delete_confirmation.inc @@ -1,5 +1,5 @@

- getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); printf($actionID == 'delete' ? _("Really delete %s and all of its subgalleries?") : _("Really empty %s?"), htmlspecialchars($gallery->get('name'))) ?>

diff --git a/ansel/templates/group/owner.inc b/ansel/templates/group/owner.inc index db4700fa9..786d0f194 100644 --- a/ansel/templates/group/owner.inc +++ b/ansel/templates/group/owner.inc @@ -26,18 +26,18 @@ $link = Ansel::getUrlFor('view', array('groupby' => $groupby, 'owner' => $group, 'view' => 'List'))->link(); -$num_galleries = $GLOBALS['injector']->getInstance('Ansel_Storage') - ->getScope() +$num_galleries = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::SHOW, $group, null, false); if ($num_galleries < 5) { $mini_galleries = $GLOBALS['injector']-> - getInstance('Ansel_Storage')-> - getScope()->listGalleries(array('filter' => $group, 'allLevels' => false)); + getInstance('Ansel_Injector_Factory_Storage')-> + create()->listGalleries(array('filter' => $group, 'allLevels' => false)); } else { $mini_galleries = $GLOBALS['injector'] - ->getInstance('Ansel_Storage') - ->getScope() + ->getInstance('Ansel_Injector_Factory_Storage') + ->create() ->listGalleries(array('filter' => $group, 'from' => rand(0, $num_galleries - 4), 'count' => 4)); diff --git a/ansel/xppublish.php b/ansel/xppublish.php index 2e74f5fea..45e67a131 100644 --- a/ansel/xppublish.php +++ b/ansel/xppublish.php @@ -79,11 +79,11 @@ if ($cmd == 'list') { // Check if a gallery was selected from the list. if ($cmd == 'select') { - if (!$galleryId || !$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->galleryExists($galleryId)) { + if (!$galleryId || !$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->galleryExists($galleryId)) { $error = _("Invalid gallery specified.") . "
\n"; } else { try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); $error = false; } catch (Ansel_Exception $e) { $error = _("There was an error accessing the gallery"); @@ -114,7 +114,7 @@ if ($cmd == 'new') { if ($create) { /* Creating a new gallery. */ try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->createGallery( + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->createGallery( array('name' => $gallery_name, 'desc' => $gallery_desc)); $galleryId = $gallery->id; $msg = sprintf(_("The gallery \"%s\" was created successfully."), $gallery_name); @@ -166,11 +166,11 @@ if ($cmd == 'add') { $galleryId = Horde_Util::getFormData('gallery'); $name = isset($_FILES['imagefile']['name']) ? Horde_Util::dispelMagicQuotes($_FILES['imagefile']['name']) : null; $file = isset($_FILES['imagefile']['tmp_name']) ? $_FILES['imagefile']['tmp_name'] : null; - if (!$galleryId || !$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->galleryExists($galleryId)) { + if (!$galleryId || !$GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->galleryExists($galleryId)) { $error = _("Invalid gallery specified.") . "
\n"; } else { try { - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { $error = sprintf(_("Access denied adding photos to \"%s\"."), $gallery->get('name')); } else { @@ -191,7 +191,7 @@ if ($cmd == 'add') { $error = $e->getMessage(); } - $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($galleryId); + $gallery = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getGallery($galleryId); try { $image_id = $gallery->addImage($image); $error = false;