From: Michael J. Rubinsky Date: Fri, 31 Jul 2009 19:10:13 +0000 (-0400) Subject: Revert "More autoload renaming / removal of require statements etc..." X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f582fb94e8459616cb9b84349209ec9f4e96fec6;p=horde.git Revert "More autoload renaming / removal of require statements etc..." This reverts commit fd74f07aeb4727f4ede5fd5f4f60ebd55f1421c2. --- diff --git a/ansel/browse.php b/ansel/browse.php index 347f4d9ca..265b2dd3f 100644 --- a/ansel/browse.php +++ b/ansel/browse.php @@ -7,6 +7,7 @@ */ require_once dirname(__FILE__) . '/lib/base.php'; +require_once ANSEL_BASE . '/lib/Tags.php'; Horde::addScriptFile('prototype.js', 'horde', true); $layout = new Horde_Block_Layout_View( diff --git a/ansel/group.php b/ansel/group.php index f31c16486..621f6ed07 100644 --- a/ansel/group.php +++ b/ansel/group.php @@ -42,6 +42,7 @@ case 'category': break; case 'owner': + require_once 'Horde/Identity.php'; $num_groups = $ansel_storage->shares->countOwners(PERMS_SHOW, null, false); if (is_a($num_groups, 'PEAR_Error')) { diff --git a/ansel/image.php b/ansel/image.php index e9cd97e23..4121bf9c4 100644 --- a/ansel/image.php +++ b/ansel/image.php @@ -27,6 +27,7 @@ $date = Ansel::getDateParameter(); /* Are we watermarking the image? */ if ($watermark) { + require_once 'Horde/Identity.php'; $identity = Identity::singleton(); $name = $identity->getValue('fullname'); if (empty($name)) { @@ -136,6 +137,7 @@ case 'modify': $title = sprintf(_("Edit properties :: %s"), $image->filename); /* Set up the form object. */ + require_once ANSEL_BASE . '/lib/Forms/Image.php'; $vars = Horde_Variables::getDefaultVariables(); if ($ret == 'gallery') { $vars->set('actionID', 'saveclose'); @@ -178,6 +180,7 @@ case 'save': } /* Validate the form object. */ + require_once ANSEL_BASE . '/lib/Forms/Image.php'; $vars = Horde_Variables::getDefaultVariables(); $vars->set('actionID', 'save'); $renderer = new Horde_Form_Renderer(); @@ -456,6 +459,7 @@ case 'setwatermark': exit; } /* Set up the form object. */ + require_once ANSEL_BASE . '/lib/Forms/Watermark.php'; $vars = Horde_Variables::getDefaultVariables(); $vars->set('actionID', 'previewcustomwatermark'); $form = new Ansel_Form_Watermark($vars, _("Watermark")); diff --git a/ansel/lib/Ansel.php b/ansel/lib/Ansel.php index de061d3e2..cea2ba0f5 100644 --- a/ansel/lib/Ansel.php +++ b/ansel/lib/Ansel.php @@ -6,6 +6,12 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ +/** Horde_Share */ +require_once 'Horde/Share.php'; + +/** Need to bring this in explicitly since we extend the object class */ +require_once 'Horde/Share/sql_hierarchical.php'; + /** * Ansel Base Class. * @@ -706,6 +712,7 @@ class Ansel { $owner, '', null, false); $fullname = $uprefs->getValue('grouptitle'); if (!$fullname) { + require_once 'Horde/Identity.php'; $identity = Identity::singleton('none', $owner); $fullname = $identity->getValue('fullname'); if (!$fullname) { @@ -1147,6 +1154,7 @@ class Ansel_Gallery extends Horde_Share_Object_sql_hierarchical { { $type = basename($type); $class = 'Ansel_GalleryMode_' . $type; + require_once dirname(__FILE__) . '/GalleryMode/' . $type . '.php'; $this->_modeHelper = new $class($this); $this->_modeHelper->init(); } @@ -1477,6 +1485,7 @@ class Ansel_Gallery extends Horde_Share_Object_sql_hierarchical { */ function getOwner() { + require_once 'Horde/Identity.php'; $identity = Identity::singleton('none', $this->data['share_owner']); return $identity; } @@ -1493,6 +1502,8 @@ class Ansel_Gallery extends Horde_Share_Object_sql_hierarchical { function getTile($parent = null, $style = null, $mini = false, $params = array()) { + require_once ANSEL_BASE . '/lib/Tile/Gallery.php'; + if (!is_null($parent) && is_null($style)) { $style = $parent->getStyle(); } else { @@ -1652,6 +1663,7 @@ class Ansel_Gallery extends Horde_Share_Object_sql_hierarchical { } // Don't already have one, must generate it. + require_once dirname(__FILE__) . '/ImageView.php'; $params = array('gallery' => $this, 'style' => $gal_style); $iview = Ansel_ImageView::factory( $gal_style['default_galleryimage_type'], $params); @@ -2279,6 +2291,8 @@ class Ansel_Image { return $result; } $styleDef = Ansel::getStyleDefinition($style); + + require_once dirname(__FILE__) . '/ImageView.php'; if ($view == 'prettythumb') { $viewType = $styleDef['thumbstyle']; } else { @@ -2835,6 +2849,7 @@ class Ansel_Image { } if (empty($watermark)) { + require_once 'Horde/Identity.php'; $identity = Identity::singleton(); $name = $identity->getValue('fullname'); if (empty($name)) { @@ -3184,6 +3199,7 @@ class Ansel_Storage { } if ($perms) { + require_once 'Horde/Group.php'; $groups = Group::singleton(); $group_list = $groups->getGroupMemberships(Horde_Auth::getAuth()); if (!is_a($group_list, 'PEAR_Error') && count($group_list)) { diff --git a/ansel/lib/Form/Ecard.php b/ansel/lib/Form/Ecard.php index ebcb47833..bf50f3f2f 100644 --- a/ansel/lib/Form/Ecard.php +++ b/ansel/lib/Form/Ecard.php @@ -23,6 +23,7 @@ class Ansel_Form_Ecard extends Horde_Form { if (empty($user)) { $this->addVariable(_("Use the following return address:"), 'ecard_retaddr', 'text', true); } else { + require_once 'Horde/Identity.php'; $identity = Identity::singleton(); $from_addr = $identity->getDefaultFromAddress(); $vars->set('ecard_retaddr', $from_addr); diff --git a/ansel/lib/GalleryMode/RemoteVimeo.php b/ansel/lib/GalleryMode/RemoteVimeo.php index 922283786..94245bdf9 100644 --- a/ansel/lib/GalleryMode/RemoteVimeo.php +++ b/ansel/lib/GalleryMode/RemoteVimeo.php @@ -30,6 +30,8 @@ class Ansel_GalleryMode_RemoteVimeo { */ function Ansel_GalleryMode_RemoteVimeo($gallery) { + require_once 'Horde/Autoloader.php'; + // Build a Horde_Service_Vimeo object // It *requires* a http client object and can make use of a cache object, $params = array('http_client' => new Horde_Http_Client(), diff --git a/ansel/lib/Report.php b/ansel/lib/Report.php index cb6a02252..f252f157e 100644 --- a/ansel/lib/Report.php +++ b/ansel/lib/Report.php @@ -55,6 +55,8 @@ class Ansel_Report { */ function _getUserEmail($user = null) { + require_once 'Horde/Identity.php'; + // Get user email $identity = Identity::singleton('none', $user); return $identity->getValue('from_addr'); diff --git a/ansel/lib/View/List.php b/ansel/lib/View/List.php index aea0364b0..b6a6c51ff 100644 --- a/ansel/lib/View/List.php +++ b/ansel/lib/View/List.php @@ -133,6 +133,7 @@ class Ansel_View_List extends Ansel_View_Base 'ansel', $owner, '', null, false); $fullname = $uprefs->getValue('grouptitle'); if (!$fullname) { + require_once 'Horde/Identity.php'; $identity = &Identity::singleton('none', $owner); $fullname = $identity->getValue('fullname'); if (!$fullname) { diff --git a/ansel/lib/View/Results.php b/ansel/lib/View/Results.php index 09db9bfaf..8af8b08f7 100644 --- a/ansel/lib/View/Results.php +++ b/ansel/lib/View/Results.php @@ -1,44 +1,73 @@ * @package Ansel */ -class Ansel_View_Results extends Ansel_View_Base -{ +class Ansel_View_Results extends Ansel_View_Abstract { + /** * Instance of our tag search * * @var Ansel_Tag_Search */ - protected $_search; + var $_search; /** * Gallery owner id * * @var string */ - protected $_owner; + var $_owner; /** * Contructor - just set some instance variables. * * @return Ansel_View_Results */ - public function __construct() + function Ansel_View_Results() { $this->_owner = Horde_Util::getFormData('owner', null); $this->_search = Ansel_Tags::getSearch(null, $this->_owner); } /** + * @static + * + * @return Ansel_View_Results The view object. + * + * @TODO use exceptions from the constructor instead of static + * instance-getting. + */ + function makeView($params = array()) + { + $view = new Ansel_View_Results(); + if (count($params)) { + $view->_params = $params; + } + return $view; + } + + /** * Return the title for this view. * * @return string The title for this view. */ - public function getTitle() + function getTitle() { return (!empty($this->_owner)) ? sprintf(_("Searching %s's photos tagged: "), $this->_owner) @@ -50,7 +79,7 @@ class Ansel_View_Results extends Ansel_View_Base * * @return string The HTML */ - public function html() + function html() { global $conf, $prefs, $registry, $ansel_storage; @@ -273,14 +302,9 @@ class Ansel_View_Results extends Ansel_View_Base return ob_get_clean(); } - public function viewType() + function viewType() { return 'Results'; } - public function getGalleryCrumbData() - { - return array(); - } - } diff --git a/ansel/lib/View/Slideshow.php b/ansel/lib/View/Slideshow.php index 7ebd00ce6..038a5f8ca 100644 --- a/ansel/lib/View/Slideshow.php +++ b/ansel/lib/View/Slideshow.php @@ -6,8 +6,19 @@ * @author Michael J. Rubinsky * @package Ansel */ -class Ansel_View_Slideshow extends Ansel_View_Base -{ + +/** Ansel_View_Abstract */ +require_once ANSEL_BASE . '/lib/Views/Abstract.php'; + +class Ansel_View_Slideshow extends Ansel_View_Abstract { + + /** + * The Ansel_Image object representing the first image selected for view. + * + * @var Ansel_Image + */ + var $image; + /** * @static * @@ -16,27 +27,37 @@ class Ansel_View_Slideshow extends Ansel_View_Base * @TODO use exceptions from the constructor instead of static * instance-getting. */ - public function __construct($params = array()) + function makeView($params = array()) { - parent::__construct($params); if (empty($params['image_id'])) { $image_id = Horde_Util::getFormData('image'); } else { $image_id = $params['image_id']; } $image = $GLOBALS['ansel_storage']->getImage($image_id); - $this->gallery = $this->getGallery($image->gallery); - $this->image = $image; + if (is_a($image, 'PEAR_Error')) { + return $image; + } + + $view = new Ansel_View_Slideshow(); + if (count($params)) { + $view->_params = $params; + } + $view->gallery = $view->getGallery($image->gallery); + if (is_a($view->gallery, 'PEAR_Error')) { + return $view->gallery; + } + $view->image = $image; // Check user age - if (!$this->gallery->isOldEnough()) { + if (!$view->gallery->isOldEnough()) { $date = Ansel::getDateParameter( - array('year' => !empty($this->_params['year']) ? $this->_params['year'] : 0, - 'month' => !empty($this->_params['month']) ? $this->_params['month'] : 0, - 'day' => !empty($this->_params['day']) ? $this->_params['day'] : 0)); + array('year' => isset($view->_params['year']) ? $view->_params['year'] : 0, + 'month' => isset($view->_params['month']) ? $view->_params['month'] : 0, + 'day' => isset($view->_params['day']) ? $view->_params['day'] : 0)); $url = Ansel::getUrlFor('view', array_merge( - array('gallery' => $this->gallery->id, + array('gallery' => $view->gallery->id, 'slug' => empty($params['slug']) ? '' : $params['slug'], 'page' => empty($params['page']) ? 0 : $params['page'], 'view' => 'Slideshow', @@ -44,21 +65,21 @@ class Ansel_View_Slideshow extends Ansel_View_Base $date), true); - $params = array('gallery' => $this->gallery->id, 'url' => $url); + $params = array('gallery' => $view->gallery->id, 'url' => $url); header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('disclamer.php'), $params, null, false)); exit; } // Check password - if ($this->gallery->hasPasswd()) { + if ($view->gallery->hasPasswd()) { $date = Ansel::getDateParameter( - array('year' => isset($this->_params['year']) ? $this->_params['year'] : 0, - 'month' => isset($this->_params['month']) ? $this->_params['month'] : 0, - 'day' => isset($this->_params['day']) ? $this->_params['day'] : 0)); + array('year' => isset($view->_params['year']) ? $view->_params['year'] : 0, + 'month' => isset($view->_params['month']) ? $view->_params['month'] : 0, + 'day' => isset($view->_params['day']) ? $view->_params['day'] : 0)); $url = Ansel::getUrlFor('view', array_merge( - array('gallery' => $this->gallery->id, + array('gallery' => $view->gallery->id, 'slug' => empty($params['slug']) ? '' : $params['slug'], 'page' => empty($params['page']) ? 0 : $params['page'], 'view' => 'Slideshow', @@ -66,7 +87,7 @@ class Ansel_View_Slideshow extends Ansel_View_Base $date), true); - $params = array('gallery' => $this->gallery->id, 'url' => $url); + $params = array('gallery' => $view->gallery->id, 'url' => $url); header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('protect.php'), $params, null, false)); exit; @@ -76,6 +97,8 @@ class Ansel_View_Slideshow extends Ansel_View_Base Horde::addScriptFile('effects.js', 'horde', true); Horde::addScriptFile('stripe.js', 'horde', true); Horde::addScriptFile('slideshow.js', 'ansel', true); + + return $view; } /** @@ -83,9 +106,9 @@ class Ansel_View_Slideshow extends Ansel_View_Base * * @return string The title. */ - public function getTitle() + function getTitle() { - return $this->resource->filename; + return $this->image->filename; } /** @@ -93,13 +116,17 @@ class Ansel_View_Slideshow extends Ansel_View_Base * * @return string The HTML. */ - public function html() + function html() { global $browser, $conf, $prefs, $registry; + if (is_a($this->gallery, 'PEAR_Error')) { + echo htmlspecialchars($this->gallery->getMessage()); + return; + } $page = Horde_Util::getFormData('page', 0); $galleryId = $this->gallery->id; - $imageId = $this->resource->id; + $imageId = $this->image->id; $galleryOwner = $this->gallery->get('owner'); $style = $this->gallery->getStyle(); @@ -144,7 +171,7 @@ class Ansel_View_Slideshow extends Ansel_View_Base return ob_get_clean(); } - public function viewType() + function viewType() { return 'Slideshow'; } diff --git a/ansel/lib/XPPublisher.php b/ansel/lib/XPPublisher.php index 7575fed5d..313fde91b 100644 --- a/ansel/lib/XPPublisher.php +++ b/ansel/lib/XPPublisher.php @@ -6,8 +6,8 @@ * @package Ansel * @author Chuck Hagenbuch */ -class Ansel_XPPublisher -{ +class Horde_XPPublisher { + /** * Generates a Windows Registry file that a user can double-click * to add your provider to their list of Providers for the @@ -30,7 +30,7 @@ class Ansel_XPPublisher * service. Usually displayed at 32x32, will be scaled if it's not * that size. */ - public function sendRegFile($appKey, $displayName, $description, $href, $icon) + function sendRegFile($appKey, $displayName, $description, $href, $icon) { $browser = Horde_Browser::singleton(); $browser->downloadHeaders('install_registry.reg', 'application/octet-stream'); diff --git a/ansel/lib/api.php b/ansel/lib/api.php index 214ea4838..a76fa38ec 100644 --- a/ansel/lib/api.php +++ b/ansel/lib/api.php @@ -1177,6 +1177,7 @@ function _ansel_countGalleries($app = null, $perm = PERMS_SHOW, $attributes = nu function _ansel_listTagInfo($tags = null) { require_once dirname(__FILE__) . '/base.php'; + require_once ANSEL_BASE . '/lib/Tags.php'; return Ansel_Tags::listTagInfo($tags); } @@ -1209,6 +1210,7 @@ function _ansel_searchTags($names, $max = 10, $from = 0, $app = null) { require_once dirname(__FILE__) . '/base.php'; + require_once ANSEL_BASE . '/lib/Tags.php'; if (!is_null($app)) { $GLOBALS['ansel_storage'] = new Ansel_Storage($app); @@ -1312,6 +1314,8 @@ function _ansel_renderView($params = array(), $app = null, if (!is_null($app)) { $GLOBALS['ansel_storage'] = new Ansel_Storage($app); } + + require_once ANSEL_BASE . '/lib/Views/' . basename($view) . '.php'; $classname = 'Ansel_View_' . basename($view); $params['api'] = true; $params['view'] = $view; diff --git a/ansel/perms.php b/ansel/perms.php index 29a0a88a8..36a53355b 100644 --- a/ansel/perms.php +++ b/ansel/perms.php @@ -16,6 +16,7 @@ $fieldsList = array( ); require_once dirname(__FILE__) . '/lib/base.php'; +require_once 'Horde/Group.php'; $groups = Group::singleton(); $auth = Horde_Auth::singleton($conf['auth']['driver']); diff --git a/ansel/protect.php b/ansel/protect.php index 2f984b7c2..db7e481f4 100644 --- a/ansel/protect.php +++ b/ansel/protect.php @@ -9,6 +9,7 @@ */ require_once dirname(__FILE__) . '/lib/base.php'; +require_once 'Horde/Form.php'; $vars = Horde_Variables::getDefaultVariables(); $gallery = $ansel_storage->getGallery($vars->get('gallery')); diff --git a/ansel/report.php b/ansel/report.php index 6fa156880..6c35fe0ea 100644 --- a/ansel/report.php +++ b/ansel/report.php @@ -12,6 +12,7 @@ */ require_once dirname(__FILE__) . '/lib/base.php'; +require_once 'Horde/Form.php'; $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 4d7b1d6f2..f6bbcc68c 100644 --- a/ansel/rss.php +++ b/ansel/rss.php @@ -140,6 +140,7 @@ if (empty($rss)) { if (isset($galleries) && count($galleries)) { $images = $ansel_storage->getRecentImages($galleries); if (!is_a($images, 'PEAR_Error') && count($images)) { + require_once('Horde/Identity.php'); $owner = Identity::singleton('none', $id); $name = $owner->getValue('fullname'); $author = $owner->getValue('from_addr'); diff --git a/ansel/xppublish.php b/ansel/xppublish.php index 06ab476fc..d23efa406 100644 --- a/ansel/xppublish.php +++ b/ansel/xppublish.php @@ -10,10 +10,11 @@ $ansel_authentication = 'none'; require_once dirname(__FILE__) . '/lib/base.php'; +require_once ANSEL_BASE . '/lib/XPPublisher.php'; $cmd = Horde_Util::getFormData('cmd'); if (empty($cmd)) { - $publisher = new Ansel_XPPublisher(); + $publisher = new Horde_XPPublisher(); $publisher->sendRegFile( $registry->getApp() . '-' . $conf['server']['name'], $registry->get('name'),