From: Michael M Slusarz Date: Wed, 20 Jan 2010 01:39:44 +0000 (-0700) Subject: Fully convert ansel to Horde_Registry_Application X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=982b8eb77ff8eedb5da2510adfeaccbb3f8c0d22;p=horde.git Fully convert ansel to Horde_Registry_Application --- diff --git a/ansel/browse.php b/ansel/browse.php index 062fe2cdc..10bdcc52e 100644 --- a/ansel/browse.php +++ b/ansel/browse.php @@ -6,7 +6,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); Horde::addScriptFile('prototype.js', 'horde'); $layout = new Horde_Block_Layout_View( diff --git a/ansel/browse_edit.php b/ansel/browse_edit.php index 1b61f5722..049640776 100644 --- a/ansel/browse_edit.php +++ b/ansel/browse_edit.php @@ -6,7 +6,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); // Instantiate the blocks objects. $blocks = Horde_Block_Collection::singleton('myphotos', array('ansel')); diff --git a/ansel/disclamer.php b/ansel/disclamer.php index 7e52ecf74..0bdd75a49 100644 --- a/ansel/disclamer.php +++ b/ansel/disclamer.php @@ -8,7 +8,8 @@ * @author Jan Zagar */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); $vars = Horde_Variables::getDefaultVariables(); $gallery = $ansel_storage->getGallery($vars->get('gallery')); diff --git a/ansel/edit_dates.php b/ansel/edit_dates.php index ccedb31f6..36216719c 100644 --- a/ansel/edit_dates.php +++ b/ansel/edit_dates.php @@ -7,7 +7,9 @@ * * @author Michael J. Rubinsky */ -require_once dirname(__FILE__) . '/lib/base.php'; + +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); $images = Horde_Util::getFormData('image', array()); $actionID = Horde_Util::getFormData('actionID'); diff --git a/ansel/faces/claim.php b/ansel/faces/claim.php index da8a384e6..c55c16253 100644 --- a/ansel/faces/claim.php +++ b/ansel/faces/claim.php @@ -9,7 +9,9 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $faces = Ansel_Faces::factory(); $face_id = Horde_Util::getFormData('face'); @@ -68,4 +70,4 @@ require ANSEL_TEMPLATES . '/menu.inc'; $form->renderActive(null, null, null, 'post'); -require $registry->get('templates', 'horde') . '/common-footer.inc'; \ No newline at end of file +require $registry->get('templates', 'horde') . '/common-footer.inc'; diff --git a/ansel/faces/custom.php b/ansel/faces/custom.php index 85416cd4a..617c4ae88 100644 --- a/ansel/faces/custom.php +++ b/ansel/faces/custom.php @@ -9,7 +9,9 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $image_id = (int)Horde_Util::getFormData('image'); $face_id = (int)Horde_Util::getFormData('face'); diff --git a/ansel/faces/delete.php b/ansel/faces/delete.php index 075d5003a..54148a5ca 100644 --- a/ansel/faces/delete.php +++ b/ansel/faces/delete.php @@ -9,7 +9,9 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $image_id = (int)Horde_Util::getFormData('image'); $face_id = (int)Horde_Util::getFormData('face'); diff --git a/ansel/faces/face.php b/ansel/faces/face.php index 3ee2224fe..1d664fe96 100644 --- a/ansel/faces/face.php +++ b/ansel/faces/face.php @@ -13,7 +13,10 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); + $faces = Ansel_Faces::factory(); $face_id = Horde_Util::getFormData('face'); try { @@ -29,4 +32,4 @@ $title = _("Face") . ' :: ' . $face['face_name']; require ANSEL_TEMPLATES . '/common-header.inc'; require ANSEL_TEMPLATES . '/menu.inc'; require_once ANSEL_TEMPLATES . '/faces/face.inc'; -require $registry->get('templates', 'horde') . '/common-footer.inc'; \ No newline at end of file +require $registry->get('templates', 'horde') . '/common-footer.inc'; diff --git a/ansel/faces/gallery.php b/ansel/faces/gallery.php index 413323fdf..932966c53 100644 --- a/ansel/faces/gallery.php +++ b/ansel/faces/gallery.php @@ -11,7 +11,9 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $gallery_id = (int)Horde_Util::getFormData('gallery'); if (empty($gallery_id)) { diff --git a/ansel/faces/image.php b/ansel/faces/image.php index d1d0733bd..734faa7e2 100644 --- a/ansel/faces/image.php +++ b/ansel/faces/image.php @@ -9,7 +9,9 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $faces = Ansel_Faces::factory(); @@ -38,4 +40,4 @@ if (!empty($result)) { require_once ANSEL_TEMPLATES . '/faces/image.inc'; } else { echo _("No faces found"); -} \ No newline at end of file +} diff --git a/ansel/faces/img.php b/ansel/faces/img.php index f07659c5d..625ab9263 100644 --- a/ansel/faces/img.php +++ b/ansel/faces/img.php @@ -9,7 +9,9 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $face_id = Horde_Util::getFormData('face'); $faces = Ansel_Faces::factory(); diff --git a/ansel/faces/name.php b/ansel/faces/name.php index 717552d8c..5ba560660 100644 --- a/ansel/faces/name.php +++ b/ansel/faces/name.php @@ -9,7 +9,9 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $image_id = (int)Horde_Util::getFormData('image'); $face_id = (int)Horde_Util::getFormData('face'); diff --git a/ansel/faces/report.php b/ansel/faces/report.php index fc201cd66..0d9a7f38c 100644 --- a/ansel/faces/report.php +++ b/ansel/faces/report.php @@ -9,7 +9,9 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $face_id = Horde_Util::getFormData('face'); @@ -68,4 +70,4 @@ require ANSEL_TEMPLATES . '/menu.inc'; $form->renderActive(null, null, null, 'post'); -require $registry->get('templates', 'horde') . '/common-footer.inc'; \ No newline at end of file +require $registry->get('templates', 'horde') . '/common-footer.inc'; diff --git a/ansel/faces/savecustom.php b/ansel/faces/savecustom.php index 39824fbb6..5fba25904 100644 --- a/ansel/faces/savecustom.php +++ b/ansel/faces/savecustom.php @@ -9,7 +9,9 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $image_id = (int)Horde_Util::getFormData('image_id'); $gallery_id = (int)Horde_Util::getFormData('gallery_id'); diff --git a/ansel/faces/search/img.php b/ansel/faces/search/img.php index 6b78b51af..b87e85175 100644 --- a/ansel/faces/search/img.php +++ b/ansel/faces/search/img.php @@ -9,12 +9,9 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../../lib/base.php'; -/* Face search is allowd only to */ -if (!Horde_Auth::isauthenticated()) { - exit; -} +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('ansel'); $thumb = Horde_Util::getGet('thumb'); $tmp = Horde::getTempDir(); diff --git a/ansel/faces/search/tabs.php b/ansel/faces/search/tabs.php index 59e682bec..aef5a040c 100644 --- a/ansel/faces/search/tabs.php +++ b/ansel/faces/search/tabs.php @@ -9,13 +9,11 @@ * * @author Duck */ -require_once dirname(__FILE__) . '/../../lib/base.php'; + +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('ansel'); $faces = Ansel_Faces::factory(); -/* Face search is allowed only to authenticated users */ -if (!Horde_Auth::isauthenticated()) { - Horde_Auth::authenticateFailure(); -} /* Show tabs */ $vars = Horde_Variables::getDefaultVariables(); diff --git a/ansel/gallery.php b/ansel/gallery.php index 12961706c..599beddf6 100644 --- a/ansel/gallery.php +++ b/ansel/gallery.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); // Redirect to the gallery list if no action has been requested. $actionID = Horde_Util::getFormData('actionID'); diff --git a/ansel/gallery/captions.php b/ansel/gallery/captions.php index 30558db30..a95e814eb 100644 --- a/ansel/gallery/captions.php +++ b/ansel/gallery/captions.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $galleryId = Horde_Util::getFormData('gallery'); if (!$galleryId) { diff --git a/ansel/gallery/delete.php b/ansel/gallery/delete.php index 7276fe5fb..6048d1a66 100644 --- a/ansel/gallery/delete.php +++ b/ansel/gallery/delete.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); // Delete/empty the gallery if we're provided with a valid galleryId. $actionID = Horde_Util::getPost('action'); diff --git a/ansel/gallery/sort.php b/ansel/gallery/sort.php index 3a9756a73..1fb9d0653 100644 --- a/ansel/gallery/sort.php +++ b/ansel/gallery/sort.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); /* If we aren't provided with a gallery, redirect to the gallery * list. */ diff --git a/ansel/group.php b/ansel/group.php index d46f9941b..20e9c2c76 100644 --- a/ansel/group.php +++ b/ansel/group.php @@ -9,7 +9,8 @@ * @author Ben Chavet */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); // check for grouping $groupby = basename(Horde_Util::getFormData('groupby', $prefs->getValue('groupby'))); diff --git a/ansel/image.php b/ansel/image.php index 31942edf0..78ef5d259 100644 --- a/ansel/image.php +++ b/ansel/image.php @@ -12,7 +12,8 @@ * @author Michael J. Rubinsky */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); /* Get all the form data */ $actionID = Horde_Util::getFormData('actionID'); diff --git a/ansel/img/download.php b/ansel/img/download.php index 405b7c169..984725c02 100644 --- a/ansel/img/download.php +++ b/ansel/img/download.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $id = Horde_Util::getFormData('image'); $image = &$ansel_storage->getImage($id); diff --git a/ansel/img/ecard.php b/ansel/img/ecard.php index 4578afe8a..861e24f21 100644 --- a/ansel/img/ecard.php +++ b/ansel/img/ecard.php @@ -8,7 +8,8 @@ * @author Michael Slusarz */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); /* Abort if ecard sending is disabled. */ if (empty($conf['ecard']['enable'])) { diff --git a/ansel/img/full.php b/ansel/img/full.php index 431100236..462627745 100644 --- a/ansel/img/full.php +++ b/ansel/img/full.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $id = Horde_Util::getFormData('image'); $image = &$ansel_storage->getImage($id); diff --git a/ansel/img/index.php b/ansel/img/index.php index 526c19545..acefa9459 100644 --- a/ansel/img/index.php +++ b/ansel/img/index.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $id = Horde_Util::getFormData('image'); $image = &$ansel_storage->getImage($id); diff --git a/ansel/img/mini.php b/ansel/img/mini.php index 85aee68eb..19aadaab1 100644 --- a/ansel/img/mini.php +++ b/ansel/img/mini.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $id = Horde_Util::getFormData('image'); $image = &$ansel_storage->getImage($id); diff --git a/ansel/img/prettythumb.php b/ansel/img/prettythumb.php index 4b31b1783..dc28e2585 100644 --- a/ansel/img/prettythumb.php +++ b/ansel/img/prettythumb.php @@ -8,7 +8,8 @@ * @author Michael J. Rubinsky */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $style = Horde_Util::getFormData('style'); $id = Horde_Util::getFormData('image'); diff --git a/ansel/img/screen.php b/ansel/img/screen.php index ea67fb4fe..3b5680eaa 100644 --- a/ansel/img/screen.php +++ b/ansel/img/screen.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $id = Horde_Util::getFormData('image'); $image = &$ansel_storage->getImage($id); diff --git a/ansel/img/thumb.php b/ansel/img/thumb.php index eb832213d..cb6e3d6f6 100644 --- a/ansel/img/thumb.php +++ b/ansel/img/thumb.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $id = Horde_Util::getFormData('image'); $image = &$ansel_storage->getImage($id); diff --git a/ansel/img/upload.php b/ansel/img/upload.php index 1c3c74ba7..dcf0186f3 100644 --- a/ansel/img/upload.php +++ b/ansel/img/upload.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $gallery_id = Horde_Util::getFormData('gallery'); $gallery = &$ansel_storage->getGallery($gallery_id); diff --git a/ansel/img/upload_preview.php b/ansel/img/upload_preview.php index a74f0bc0d..904ab7bf3 100644 --- a/ansel/img/upload_preview.php +++ b/ansel/img/upload_preview.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('ansel'); $gallery_id = (int)Horde_Util::getFormData('gallery'); $gallery = $ansel_storage->getGallery($gallery_id); diff --git a/ansel/index.php b/ansel/index.php index 3fea9342f..689c02298 100644 --- a/ansel/index.php +++ b/ansel/index.php @@ -8,5 +8,7 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); + header('Location: ' . Ansel::getUrlFor('default_view', array())); diff --git a/ansel/lib/Ajax/Imple/EditCaption.php b/ansel/lib/Ajax/Imple/EditCaption.php index a94ba50ee..ee0aee94a 100644 --- a/ansel/lib/Ajax/Imple/EditCaption.php +++ b/ansel/lib/Ajax/Imple/EditCaption.php @@ -50,8 +50,6 @@ class Ansel_Ajax_Imple_EditCaption extends Horde_Ajax_Imple_Base public function handle($args, $post) { - include_once dirname(__FILE__) . '/../../base.php'; - if (Horde_Auth::getAuth()) { /* Are we requesting the unformatted text? */ if (!empty($args['action']) && $args['action'] == 'load') { diff --git a/ansel/lib/Ajax/Imple/EditFaces.php b/ansel/lib/Ajax/Imple/EditFaces.php index 78a1ad0a3..0d800149a 100644 --- a/ansel/lib/Ajax/Imple/EditFaces.php +++ b/ansel/lib/Ajax/Imple/EditFaces.php @@ -30,8 +30,6 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Ajax_Imple_Base function handle($args, $post) { - include_once dirname(__FILE__) . '/../../base.php'; - if (Horde_Auth::getAuth()) { $action = $args['action']; $image_id = (int)$post['image']; diff --git a/ansel/lib/Ajax/Imple/Embed.php b/ansel/lib/Ajax/Imple/Embed.php index 16b583de1..81d8885e1 100644 --- a/ansel/lib/Ajax/Imple/Embed.php +++ b/ansel/lib/Ajax/Imple/Embed.php @@ -30,8 +30,6 @@ class Ansel_Ajax_Imple_Embed extends Horde_Ajax_Imple_Base */ public function handle($args, $post) { - include_once dirname(__FILE__) . '/../../base.php'; - /* First, determine the type of view we are asking for */ $view = empty($args['gallery_view']) ? 'Mini' : $args['gallery_view']; $class = 'Ansel_View_EmbeddedRenderer_' . basename($view); diff --git a/ansel/lib/Ajax/Imple/GallerySlugCheck.php b/ansel/lib/Ajax/Imple/GallerySlugCheck.php index a77718b6f..8c2b167fc 100644 --- a/ansel/lib/Ajax/Imple/GallerySlugCheck.php +++ b/ansel/lib/Ajax/Imple/GallerySlugCheck.php @@ -26,7 +26,6 @@ class Ansel_Ajax_Imple_GallerySlugCheck extends Horde_Ajax_Imple_Base public function handle($args, $post) { - include_once dirname(__FILE__) . '/../../base.php'; if (empty($args['input'])) { return array('response' => '1'); } diff --git a/ansel/lib/Ajax/Imple/ImageSaveGeotag.php b/ansel/lib/Ajax/Imple/ImageSaveGeotag.php index 5f8c75354..92467230e 100644 --- a/ansel/lib/Ajax/Imple/ImageSaveGeotag.php +++ b/ansel/lib/Ajax/Imple/ImageSaveGeotag.php @@ -23,8 +23,6 @@ class Ansel_Ajax_Imple_ImageSaveGeotag extends Horde_Ajax_Imple_Base public function handle($args, $post) { - include_once dirname(__FILE__) . '/../../base.php'; - $type = $args['action']; $location = empty($post['location']) ? null : $post['location']; $lat = empty($post['lat']) ? null : $post['lat']; diff --git a/ansel/lib/Ajax/Imple/LocationAutoCompleter.php b/ansel/lib/Ajax/Imple/LocationAutoCompleter.php index 4b287dcad..fbab220e0 100644 --- a/ansel/lib/Ajax/Imple/LocationAutoCompleter.php +++ b/ansel/lib/Ajax/Imple/LocationAutoCompleter.php @@ -50,8 +50,6 @@ class Ansel_Ajax_Imple_LocationAutoCompleter extends Horde_Ajax_Imple_AutoComple public function handle($args, $post) { - include_once dirname(__FILE__) . '/../../base.php'; - // Avoid errors if 'input' isn't set and short-circuit empty searches. if (empty($args['input']) || !($input = Horde_Util::getFormData($args['input']))) { diff --git a/ansel/lib/Ajax/Imple/TagActions.php b/ansel/lib/Ajax/Imple/TagActions.php index 6f339f214..6bfd92a5b 100644 --- a/ansel/lib/Ajax/Imple/TagActions.php +++ b/ansel/lib/Ajax/Imple/TagActions.php @@ -31,8 +31,6 @@ class Ansel_Ajax_Imple_TagActions extends Horde_Ajax_Imple_Base public function handle($args, $post) { - include_once dirname(__FILE__) . '/../../base.php'; - $action = $args['action']; $tags = $post['tags']; if (empty($action) || empty($tags)) { diff --git a/ansel/lib/Api.php b/ansel/lib/Api.php index b44771b6c..15375000c 100644 --- a/ansel/lib/Api.php +++ b/ansel/lib/Api.php @@ -25,8 +25,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function browse($path = '', $properties = array()) { - require_once dirname(__FILE__) . '/base.php'; - // Default properties. if (!$properties) { $properties = array('name', 'icon', 'browseable'); @@ -181,8 +179,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function put($path, $content, $content_type) { - require_once dirname(__FILE__) . '/base.php'; - if (substr($path, 0, 5) == 'ansel') { $path = substr($path, 9); } @@ -217,8 +213,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function commentCallback($image_id) { - require_once dirname(__FILE__) . '/base.php'; - if (!$GLOBALS['conf']['comments']['allow']) { return false; } @@ -238,8 +232,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function hasComments() { - require_once dirname(__FILE__) . '/base.php'; - if (($GLOBALS['conf']['comments']['allow'] == 'all' || ($GLOBALS['conf']['comments']['allow'] == 'authenticated' && Horde_Auth::getAuth()))) { @@ -314,8 +306,6 @@ class Ansel_Api extends Horde_Registry_Api $gallery_data = null, $encoding = null, $slug = null, $compression = 'none', $skiphook = false) { - require_once dirname(__FILE__) . '/base.php'; - $image_data = null; /* If no app is given use Ansel's own gallery which is initialized @@ -405,7 +395,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function postBatchUpload($image_ids) { - require_once dirname(__FILE__) . '/base.php'; if (!empty($conf['hooks']['postupload'])) { return Horde::callHook('_ansel_hook_postupload', array($image_ids), 'ansel'); } @@ -420,8 +409,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function removeImage($app = null, $gallery_id, $image_id) { - require_once dirname(__FILE__) . '/base.php'; - /* Check global Ansel permissions */ if (!($GLOBALS['perms']->getPermissions('ansel'))) { return PEAR::raiseError(_("Access denied deleting galleries.")); @@ -462,8 +449,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function createGallery($app = null, $attributes = array(), $perm = null, $parent = null) { - require_once dirname(__FILE__) . '/base.php'; - if (!(Horde_Auth::isAdmin() || (!$GLOBALS['perms']->exists('ansel') && Horde_Auth::getAuth()) || $GLOBALS['perms']->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT))) { @@ -500,8 +485,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function removeGallery($app = null, $gallery_id) { - require_once dirname(__FILE__) . '/base.php'; - /* Check global Ansel permissions */ if (!($GLOBALS['perms']->getPermissions('ansel'))) { return PEAR::raiseError(_("Access denied deleting galleries.")); @@ -549,8 +532,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function count($app = null, $gallery_id = null, $slug = '') { - require_once dirname(__FILE__) . '/base.php'; - /* If no app is given use Ansel's own gallery which is initialized in base.php */ if (!is_null($app)) { @@ -583,8 +564,6 @@ class Ansel_Api extends Horde_Registry_Api public function getDefaultImage($app = null, $gallery_id = null, $style = 'ansel_default', $slug = '') { - require_once dirname(__FILE__) . '/base.php'; - /* If no app is given use Ansel's own gallery which is initialized in base.php */ if (!is_null($app)) { @@ -618,8 +597,6 @@ class Ansel_Api extends Horde_Registry_Api public function getImageUrl($app = null, $image_id, $view = 'screen', $full = false, $style = null) { - require_once dirname(__FILE__) . '/base.php'; - /* If no app is given use Ansel's own gallery which is initialized in base.php */ if (!is_null($app)) { @@ -646,8 +623,6 @@ class Ansel_Api extends Horde_Registry_Api public function getImageContent($image_id, $view = 'screen', $style = null, $app = null, $encoding = null, $compression = 'none') { - require_once dirname(__FILE__) . '/base.php'; - /* If no app is given use Ansel's own gallery which is initialized in base.php */ if (!is_null($app)) { @@ -716,8 +691,6 @@ class Ansel_Api extends Horde_Registry_Api $allLevels = true, $from = 0, $count = 0, $attributes = null, $sort_by = null, $direction = 0) { - require_once dirname(__FILE__) . '/base.php'; - /* If no app is given use Ansel's own gallery which is initialized in base.php */ if (!is_null($app)) { @@ -751,8 +724,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function getGalleries($ids = array(), $app = null, $slugs = array()) { - require_once dirname(__FILE__) . '/base.php'; - if (!is_null($app)) { $GLOBALS['ansel_storage'] = new Ansel_Storage($app); } @@ -798,8 +769,6 @@ class Ansel_Api extends Horde_Registry_Api $allLevels = true, $from = 0, $count = 0, $default = null) { - require_once dirname(__FILE__) . '/base.php'; - /* If no app is given use Ansel's own gallery which is initialized in base.php */ if (!is_null($app)) { @@ -834,8 +803,6 @@ class Ansel_Api extends Horde_Registry_Api $view = 'screen', $full = false, $from = 0, $count = 0, $style = null, $slug = '') { - require_once dirname(__FILE__) . '/base.php'; - /* If no app is given use Ansel's own gallery which is initialized in base.php */ if (!is_null($app)) { @@ -908,7 +875,6 @@ class Ansel_Api extends Horde_Registry_Api $full = false, $limit = 10, $style = null, $slugs = array()) { - require_once dirname(__FILE__) . '/base.php'; if (!is_null($app)) { $GLOBALS['ansel_storage'] = new Ansel_Storage($app); } @@ -952,8 +918,6 @@ class Ansel_Api extends Horde_Registry_Api public function countGalleries($app = null, $perm = Horde_Perms::SHOW, $attributes = null, $parent = null, $allLevels = true) { - require_once dirname(__FILE__) . '/base.php'; - /* If no app is given use Ansel's own gallery which is initialized * in base.php */ if (!is_null($app)) { @@ -976,8 +940,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function listTagInfo($tags = null) { - require_once dirname(__FILE__) . '/base.php'; - return Ansel_Tags::listTagInfo($tags); } @@ -1008,8 +970,6 @@ class Ansel_Api extends Horde_Registry_Api $resource_type = 'all', $user = null, $raw = false, $app = null) { - require_once dirname(__FILE__) . '/base.php'; - if (!is_null($app)) { $GLOBALS['ansel_storage'] = new Ansel_Storage($app); } else { @@ -1071,8 +1031,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function galleryExists($app, $gallery_id = null, $slug = '') { - require_once dirname(__FILE__) . '/base.php'; - if (!is_null($app)) { $GLOBALS['ansel_storage'] = new Ansel_Storage($app); } @@ -1087,8 +1045,6 @@ class Ansel_Api extends Horde_Registry_Api */ public function getGalleryStyles() { - require_once dirname(__FILE__) . '/base.php'; - return Ansel::getAvailableStyles(); } @@ -1107,8 +1063,6 @@ class Ansel_Api extends Horde_Registry_Api public function renderView($params = array(), $app = null, $view = 'Gallery') { - require_once dirname(__FILE__) . '/base.php'; - if (!is_null($app)) { $GLOBALS['ansel_storage'] = new Ansel_Storage($app); } diff --git a/ansel/lib/Application.php b/ansel/lib/Application.php index 747d1fd97..da5aa69b1 100644 --- a/ansel/lib/Application.php +++ b/ansel/lib/Application.php @@ -2,6 +2,9 @@ /** * Ansel application API. * + * This file defines Horde's core API interface. Other core Horde libraries + * can interact with Horde through this API. + * * Copyright 2004-2010 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (GPL). If you @@ -12,11 +15,70 @@ * @author Michael J. Rubinsky * @package Ansel */ + +if (!defined('ANSEL_BASE')) { + define('ANSEL_BASE', dirname(__FILE__) . '/..'); +} + +if (!defined('HORDE_BASE')) { + /* If horde does not live directly under the app directory, the HORDE_BASE + * constant should be defined in config/horde.local.php. */ + if (file_exists(ANSEL_BASE . '/config/horde.local.php')) { + include ANSEL_BASE . '/config/horde.local.php'; + } else { + define('HORDE_BASE', ANSEL_BASE . '/..'); + } +} + +/* Load the Horde Framework core (needed to autoload + * Horde_Registry_Application::). */ +require_once HORDE_BASE . '/lib/core.php'; + class Ansel_Application extends Horde_Registry_Application { + /** + * The application's version. + * + * @var string + */ public $version = 'H4 (2.0-git)'; /** + * Initialization function. + * + * Global variables defined: + * $ansel_db - TODO + * $ansel_storage - TODO + * $ansel_styles - TODO + * $ansel_vfs - TODO + * $cache - A Horde_Cache object. + * + * @throws Horde_Exception + */ + protected function _init() + { + // Create a cache object if we need it. + if ($GLOBALS['conf']['ansel_cache']['usecache']) { + $GLOBALS['cache'] = Horde_Cache::singleton($GLOBALS['conf']['cache']['driver'], Horde::getDriverConfig('cache', $GLOBALS['conf']['cache']['driver'])); + } + + // Create db, share, and vfs instances. + $GLOBALS['ansel_db'] = Ansel::getDb(); + if (is_a($GLOBALS['ansel_db'], 'PEAR_Error')) { + throw new Horde_Exception($GLOBALS['ansel_db']); + } + + $GLOBALS['ansel_storage'] = new Ansel_Storage(); + $GLOBALS['ansel_vfs'] = Ansel::getVFS(); + + // Get list of available styles for this client. + $GLOBALS['ansel_styles'] = Ansel::getAvailableStyles(); + if ($logger = Horde::getLogger()) { + $GLOBALS['ansel_vfs']->setLogger($logger, $GLOBALS['conf']['log']['priority' + ]); + } + + /** * Returns a list of available permissions. * * @return array An array describing all available permissions. diff --git a/ansel/lib/Block/cloud.php b/ansel/lib/Block/cloud.php index 5d5df1c46..cec6253d5 100644 --- a/ansel/lib/Block/cloud.php +++ b/ansel/lib/Block/cloud.php @@ -33,8 +33,6 @@ class Horde_Block_ansel_cloud extends Horde_Block { function _content() { - require_once dirname(__FILE__) . '/../base.php'; - global $registry; /* Get the tags */ diff --git a/ansel/lib/Block/gallery.php b/ansel/lib/Block/gallery.php index 30d12ff73..6134d049e 100644 --- a/ansel/lib/Block/gallery.php +++ b/ansel/lib/Block/gallery.php @@ -22,8 +22,6 @@ class Horde_Block_ansel_gallery extends Horde_Block { function _params() { - require_once dirname(__FILE__) . '/../base.php'; - $params = array('gallery' => array( 'name' => _("Gallery"), 'type' => 'enum', @@ -112,8 +110,6 @@ class Horde_Block_ansel_gallery extends Horde_Block { function _getGallery($retry = false) { - require_once dirname(__FILE__) . '/../base.php'; - // Make sure we haven't already selected a gallery. if (is_a($this->_gallery, 'Ansel_Gallery')) { return $this->_gallery; diff --git a/ansel/lib/Block/random_photo.php b/ansel/lib/Block/random_photo.php index 352bf407d..33a0902c1 100644 --- a/ansel/lib/Block/random_photo.php +++ b/ansel/lib/Block/random_photo.php @@ -28,8 +28,6 @@ class Horde_Block_ansel_random_photo extends Horde_Block { function _content() { - require_once dirname(__FILE__) . '/../base.php'; - $gallery = $GLOBALS['ansel_storage']->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 1e5ce09d7..5ba569e51 100644 --- a/ansel/lib/Block/recent_comments.php +++ b/ansel/lib/Block/recent_comments.php @@ -23,8 +23,6 @@ class Horde_Block_ansel_recent_comments extends Horde_Block { function _params() { - require_once dirname(__FILE__) . '/../base.php'; - $params = array('gallery' => array( 'name' => _("Gallery"), 'type' => 'enum', @@ -42,8 +40,6 @@ class Horde_Block_ansel_recent_comments extends Horde_Block { function _title() { - require_once dirname(__FILE__) . '/../base.php'; - if ($this->_params['gallery'] != 'all') { $gallery = $this->_getGallery(); if (is_a($gallery, 'PEAR_Error')) { diff --git a/ansel/lib/Block/recent_faces.php b/ansel/lib/Block/recent_faces.php index a47b5f669..ae22e2a0a 100644 --- a/ansel/lib/Block/recent_faces.php +++ b/ansel/lib/Block/recent_faces.php @@ -34,7 +34,6 @@ class Horde_Block_ansel_recent_faces extends Horde_Block function _content() { - require_once dirname(__FILE__) . '/../base.php'; $faces = Ansel_Faces::factory(); $results = $faces->allFaces(0, $this->_params['limit']); $html = ''; diff --git a/ansel/lib/Block/recently_added.php b/ansel/lib/Block/recently_added.php index 1ff45471a..aa0779368 100644 --- a/ansel/lib/Block/recently_added.php +++ b/ansel/lib/Block/recently_added.php @@ -20,8 +20,6 @@ class Horde_Block_ansel_recently_added extends Horde_Block { function _params() { - require_once dirname(__FILE__) . '/../base.php'; - $params = array('gallery' => array( 'name' => _("Gallery"), 'type' => 'enum', @@ -46,8 +44,6 @@ class Horde_Block_ansel_recently_added extends Horde_Block { function _title() { - require_once dirname(__FILE__) . '/../base.php'; - if ($this->_params['gallery'] != 'all') { $gallery = $this->_getGallery(); if (is_a($gallery, 'PEAR_Error')) { @@ -78,8 +74,6 @@ class Horde_Block_ansel_recently_added extends Horde_Block { function _content() { - require_once dirname(__FILE__) . '/../base.php'; - if ($this->_params['gallery'] == 'all') { $galleries = array(); } elseif (!is_array($this->_params['gallery'])) { diff --git a/ansel/lib/Block/recently_added_geodata.php b/ansel/lib/Block/recently_added_geodata.php index 1ffb37509..996ebde3d 100644 --- a/ansel/lib/Block/recently_added_geodata.php +++ b/ansel/lib/Block/recently_added_geodata.php @@ -20,8 +20,6 @@ class Horde_Block_ansel_recently_added_geodata extends Horde_Block { function _params() { - require_once dirname(__FILE__) . '/../base.php'; - $params = array('gallery' => array( 'name' => _("Gallery"), 'type' => 'enum', @@ -50,8 +48,6 @@ class Horde_Block_ansel_recently_added_geodata extends Horde_Block { function _title() { - require_once dirname(__FILE__) . '/../base.php'; - Horde::addScriptFile('http://maps.google.com/maps?file=api&v=2&sensor=false&key=' . $GLOBALS['conf']['api']['googlemaps'], 'ansel', array('external' => true)); Horde::addScriptFile('http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/1.1/src/markermanager.js', 'ansel', array('external' => true)); Horde::addScriptFile('googlemap.js'); @@ -85,8 +81,6 @@ class Horde_Block_ansel_recently_added_geodata extends Horde_Block { function _content() { - require_once dirname(__FILE__) . '/../base.php'; - if ($this->_params['gallery'] == 'all') { $galleries = array(); } elseif (!is_array($this->_params['gallery'])) { diff --git a/ansel/lib/base.load.php b/ansel/lib/base.load.php deleted file mode 100644 index ce4e2ead5..000000000 --- a/ansel/lib/base.load.php +++ /dev/null @@ -1,25 +0,0 @@ - - * @author Michael J. Rubinsky - * - * @package Ansel - */ - -// Determine BASE directories. -require_once dirname(__FILE__) . '/base.load.php'; - -// Load the Horde Framework core, and set up inclusion paths. -require_once HORDE_BASE . '/lib/core.php'; - -// Registry. -$s_ctrl = 0; -switch (Horde_Util::nonInputVar('imp_session_control')) { -case 'readonly': - $s_ctrl = Horde_Registry::SESSION_READONLY; - break; -} -$registry = Horde_Registry::singleton($s_ctrl); - -// Authentication -try { - $registry->pushApp('ansel', array('check_perms' => (Horde_Util::nonInputVar('ansel_authentication') != 'none'), 'logintasks' => true)); -} catch (Horde_Exception $e) { - Horde_Auth::authenticateFailure('ansel', $e); -} -$conf = $GLOBALS['conf']; -define('ANSEL_TEMPLATES', $registry->get('templates')); - -// Notification system. -$GLOBALS['notification'] = Horde_Notification::singleton(); -$GLOBALS['notification']->attach('status'); - -// Create a cache object if we need it. -if ($conf['ansel_cache']['usecache']) { - $GLOBALS['cache'] = Horde_Cache::singleton($conf['cache']['driver'], - Horde::getDriverConfig('cache', $conf['cache']['driver'])); -} - -// Create db, share, and vfs instances. -$GLOBALS['ansel_db'] = Ansel::getDb(); -if (is_a($GLOBALS['ansel_db'], 'PEAR_Error')) { - Horde::fatal($GLOBALS['ansel_db'], __FILE__, __LINE__, false); -} -$GLOBALS['ansel_storage'] = new Ansel_Storage(); -$GLOBALS['ansel_vfs'] = Ansel::getVFS(); - -// Get list of available styles for this client. -$GLOBALS['ansel_styles'] = Ansel::getAvailableStyles(); -if ($logger = Horde::getLogger()) { - $GLOBALS['ansel_vfs']->setLogger($logger, $GLOBALS['conf']['log']['priority']); -} diff --git a/ansel/map_edit.php b/ansel/map_edit.php index 100224665..bb0b855ed 100644 --- a/ansel/map_edit.php +++ b/ansel/map_edit.php @@ -8,7 +8,8 @@ * @author Michael J. Rubinsky */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); /* Script includes */ Horde::addScriptFile('http://maps.google.com/maps?file=api&v=2&sensor=false&key=' . $GLOBALS['conf']['api']['googlemaps'], 'ansel', array('external' => true)); diff --git a/ansel/perms.php b/ansel/perms.php index 2d2a72f05..4732bc9e2 100644 --- a/ansel/perms.php +++ b/ansel/perms.php @@ -15,7 +15,9 @@ $fieldsList = array( 'delete' => 3 ); -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); + require_once 'Horde/Group.php'; $groups = Group::singleton(); diff --git a/ansel/preview.php b/ansel/preview.php index 1ade5bb94..230580942 100644 --- a/ansel/preview.php +++ b/ansel/preview.php @@ -8,7 +8,9 @@ * @author Michael Rubinsky */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); + $imageId = Horde_Util::getFormData('image'); $image = &$ansel_storage->getImage($imageId); if (is_a($image, 'PEAR_Error')) { diff --git a/ansel/protect.php b/ansel/protect.php index e27a3e7e1..d47edc79f 100644 --- a/ansel/protect.php +++ b/ansel/protect.php @@ -8,7 +8,8 @@ * @author Duck */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); $vars = Horde_Variables::getDefaultVariables(); $gallery = $ansel_storage->getGallery($vars->get('gallery')); diff --git a/ansel/report.php b/ansel/report.php index 1a39d6511..00dc50087 100644 --- a/ansel/report.php +++ b/ansel/report.php @@ -11,7 +11,8 @@ * @package Ansel */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); $title = _("Do you really want to report this gallery?"); $gallery_id = (int)Horde_Util::getFormData('gallery'); diff --git a/ansel/rss.php b/ansel/rss.php index dd410ab70..e1bff4257 100644 --- a/ansel/rss.php +++ b/ansel/rss.php @@ -10,8 +10,8 @@ * @package Ansel */ -$ansel_session_control = 'readonly'; -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel', array('session_control' => 'readonly')); // Get form data $stream_type = Horde_Util::getFormData('stream_type', 'all'); diff --git a/ansel/scripts/all_images_exif_to_tags.php b/ansel/scripts/all_images_exif_to_tags.php index 0deb7a9b9..51a031509 100755 --- a/ansel/scripts/all_images_exif_to_tags.php +++ b/ansel/scripts/all_images_exif_to_tags.php @@ -10,8 +10,7 @@ */ // Do CLI checks and environment setup first. -require_once dirname(__FILE__) . '/../../lib/base.load.php'; -require_once HORDE_BASE . '/lib/core.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { @@ -62,8 +61,7 @@ foreach ($opts as $opt) { } } -$ansel_authentication = 'none'; -require_once ANSEL_BASE . '/lib/base.php'; +Horde_Registry::appInit('ansel', array('authentication' => 'none')); // Login to horde if username & password are set. if (!empty($username) && !empty($password)) { diff --git a/ansel/scripts/ansel.php b/ansel/scripts/ansel.php index 51fcc0f3f..e97c16ea5 100755 --- a/ansel/scripts/ansel.php +++ b/ansel/scripts/ansel.php @@ -10,8 +10,7 @@ */ // Do CLI checks and environment setup first. -require_once dirname(__FILE__) . '/../../lib/base.load.php'; -require_once HORDE_BASE . '/lib/core.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { @@ -23,8 +22,7 @@ Horde_Cli::init(); $cli = Horde_Cli::singleton(); // Load Ansel. -$ansel_authentication = 'none'; -require_once ANSEL_BASE . '/lib/base.php'; +Horde_Registry::appInit('ansel', array('authentication' => 'none')); // We accept the user name on the command-line. $ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), diff --git a/ansel/scripts/garbage_collection.php b/ansel/scripts/garbage_collection.php index bc08260bd..871e4812b 100755 --- a/ansel/scripts/garbage_collection.php +++ b/ansel/scripts/garbage_collection.php @@ -10,8 +10,7 @@ */ // Do CLI checks and environment setup first. -require_once dirname(__FILE__) . '/../../lib/base.load.php'; -require_once HORDE_BASE . '/lib/core.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { @@ -22,8 +21,7 @@ if (!Horde_Cli::runningFromCLI()) { // some variables, etc. Horde_Cli::init(); -$ansel_authentication = 'none'; -require_once ANSEL_BASE . '/lib/base.php'; +Horde_Registry::appInit('ansel', array('authentication' => 'none')); // Default arguments. $move = false; diff --git a/ansel/scripts/recursive_import.php b/ansel/scripts/recursive_import.php index 44bd97923..b485df33a 100755 --- a/ansel/scripts/recursive_import.php +++ b/ansel/scripts/recursive_import.php @@ -10,8 +10,7 @@ */ // Do CLI checks and environment setup first. -require_once dirname(__FILE__) . '/../../lib/base.load.php'; -require_once HORDE_BASE . '/lib/core.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { @@ -23,8 +22,7 @@ Horde_Cli::init(); $cli = Horde_Cli::singleton(); // Load Ansel. -$ansel_authentication = 'none'; -require_once ANSEL_BASE . '/lib/base.php'; +Horde_Registry::appInit('ansel', array('authentication' => 'none')); // We accept the user name on the command-line. $ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), 'hu:p:lc:g:a:d:k', diff --git a/ansel/scripts/upgrades/1.0_to_1.1.php b/ansel/scripts/upgrades/1.0_to_1.1.php index ad0989566..767d08b04 100644 --- a/ansel/scripts/upgrades/1.0_to_1.1.php +++ b/ansel/scripts/upgrades/1.0_to_1.1.php @@ -10,8 +10,7 @@ */ // Do CLI checks and environment setup first. -require_once dirname(__FILE__) . '/../../lib/base.load.php'; -require_once HORDE_BASE . '/lib/core.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; // Make sure no one runs this from the web. if (!Horde_CLI::runningFromCLI()) { @@ -22,8 +21,7 @@ if (!Horde_CLI::runningFromCLI()) { Horde_CLI::init(); $cli = Horde_CLI::singleton(); -$ansel_authentication = 'none'; -require_once ANSEL_BASE . '/lib/base.php'; +Horde_Registry::appInit('ansel', array('authentication' => 'none')); // First update the tables $alter = array("ALTER TABLE ansel_images ADD COLUMN image_latitude VARCHAR(32) NOT NULL DEFAULT ''", diff --git a/ansel/scripts/upgrades/2008-09-16_add_original_date_values.php b/ansel/scripts/upgrades/2008-09-16_add_original_date_values.php index f3dcacbcb..d7bd97c59 100755 --- a/ansel/scripts/upgrades/2008-09-16_add_original_date_values.php +++ b/ansel/scripts/upgrades/2008-09-16_add_original_date_values.php @@ -12,8 +12,7 @@ */ // Do CLI checks and environment setup first. -require_once dirname(__FILE__) . '/../../lib/base.load.php'; -require_once HORDE_BASE . '/lib/core.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { @@ -24,8 +23,7 @@ if (!Horde_Cli::runningFromCLI()) { Horde_Cli::init(); $cli = Horde_Cli::singleton(); -$ansel_authentication = 'none'; -require_once ANSEL_BASE . '/lib/base.php'; +Horde_Registry::appInit('ansel', array('authentication' => 'none')); $sql = 'SELECT image_id, image_original_date, image_uploaded_date FROM ansel_images'; $results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC); diff --git a/ansel/scripts/upgrades/2009-06-14_fix_geolocation_values.php b/ansel/scripts/upgrades/2009-06-14_fix_geolocation_values.php index cd8849413..4d0964778 100755 --- a/ansel/scripts/upgrades/2009-06-14_fix_geolocation_values.php +++ b/ansel/scripts/upgrades/2009-06-14_fix_geolocation_values.php @@ -10,8 +10,7 @@ */ // Do CLI checks and environment setup first. -require_once dirname(__FILE__) . '/../../base.load.php'; -require_once HORDE_BASE . '/lib/core.php'; +require_once dirname(__FILE__) . '/../../Application.php'; // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { @@ -22,8 +21,7 @@ if (!Horde_Cli::runningFromCLI()) { Horde_Cli::init(); $cli = Horde_Cli::singleton(); -$ansel_authentication = 'none'; -require_once ANSEL_BASE . '/lib/base.php'; +Horde_Registry::appInit('ansel', array('authentication' => 'none')); $sql = 'SELECT image_id, image_latitude, image_longitude FROM ansel_images_geolocation;'; $results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC); diff --git a/ansel/scripts/upgrades/2009-06-22_move_geolocation_values.php b/ansel/scripts/upgrades/2009-06-22_move_geolocation_values.php index 85b4b33db..5e8853bef 100644 --- a/ansel/scripts/upgrades/2009-06-22_move_geolocation_values.php +++ b/ansel/scripts/upgrades/2009-06-22_move_geolocation_values.php @@ -10,8 +10,7 @@ */ // Do CLI checks and environment setup first. -require_once dirname(__FILE__) . '/lib/base.load.php'; -require_once HORDE_BASE . '/lib/core.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { @@ -22,8 +21,7 @@ if (!Horde_Cli::runningFromCLI()) { Horde_Cli::init(); $cli = Horde_Cli::singleton(); -$ansel_authentication = 'none'; -require_once ANSEL_BASE . '/lib/base.php'; +Horde_Registry::appInit('ansel', array('authentication' => 'none')); $sql = 'SELECT image_id, image_latitude, image_longitude FROM ansel_images_geolocation;'; $results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC); diff --git a/ansel/view.php b/ansel/view.php index abd493b92..e08cee91c 100644 --- a/ansel/view.php +++ b/ansel/view.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel'); $viewname = basename(Horde_Util::getFormData('view', 'Gallery')); $view = 'Ansel_View_' . $viewname; diff --git a/ansel/xppublish.php b/ansel/xppublish.php index 985e77861..339c4a171 100644 --- a/ansel/xppublish.php +++ b/ansel/xppublish.php @@ -8,8 +8,8 @@ * @author Chuck Hagenbuch */ -$ansel_authentication = 'none'; -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('ansel', array('authentication' => 'none')); $cmd = Horde_Util::getFormData('cmd'); if (empty($cmd)) {