From 8de3644626a2ef66aa2c8ce2abfbd7e9e5a1a020 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Sat, 28 Aug 2010 02:05:22 -0600 Subject: [PATCH] Get rid of some include_once() & require_once() calls --- horde/lib/Block/metar.php | 4 ++-- horde/lib/Block/vatid.php | 1 - horde/lib/Block/weatherdotcom.php | 10 +++++----- turba/config/sources.php.dist | 1 - turba/scripts/import_squirrelmail_file_abook.php | 2 -- turba/scripts/import_squirrelmail_sql_abook.php | 2 -- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/horde/lib/Block/metar.php b/horde/lib/Block/metar.php index f6f2012c8..eb0971ff0 100644 --- a/horde/lib/Block/metar.php +++ b/horde/lib/Block/metar.php @@ -1,6 +1,6 @@ '; - @include_once 'SOAP/Client.php'; if (!class_exists('SOAP_Client')) { $html .= $this->_error(sprintf(_("%s not found."), 'SOAP')); } else { diff --git a/horde/lib/Block/weatherdotcom.php b/horde/lib/Block/weatherdotcom.php index 459099ba3..b25e7303b 100644 --- a/horde/lib/Block/weatherdotcom.php +++ b/horde/lib/Block/weatherdotcom.php @@ -39,9 +39,9 @@ class Horde_Block_Horde_weatherdotcom extends Horde_Block */ protected function _params() { - if (!(@include_once 'Services/Weather.php') || - !(@include_once 'Cache.php') || - !(@include_once 'XML/Serializer.php') || + if (!class_exists('Services_Weather') || + !class_exists('Cache') || + !class_exists('XML_Serializer') || !ini_get('allow_url_fopen')) { Horde::logMessage('The weather.com block will not work without PEAR\'s Services_Weather, Cache, and XML_ Serializer packages, and allow_url_fopen enabled. Run `pear install Services_Weather Cache XML_Serializer´ and ensure that allow_url_fopen is enabled in php.ini.', 'ERR'); $params = array( @@ -99,8 +99,8 @@ class Horde_Block_Horde_weatherdotcom extends Horde_Block */ protected function _content() { - if (!(@include_once 'Services/Weather.php') || - !(@include_once 'Cache.php') || + if (!class_exists('Services_Weather') || + !class_exists('Cache') || !ini_get('allow_url_fopen')) { Horde::logMessage('The weather.com block will not work without the PEARServices_Weather and Cache packages, and allow_url_fopen enabled. Run pear install Services_Weather Cache, and ensure that allow_url_fopen_wrappers is enabled in php.ini.', 'ERR'); throw new Horde_Block_Exception(_("The weather.com block is not available.")); diff --git a/turba/config/sources.php.dist b/turba/config/sources.php.dist index cf384a4ca..11b5a7731 100644 --- a/turba/config/sources.php.dist +++ b/turba/config/sources.php.dist @@ -830,7 +830,6 @@ if (!empty($GLOBALS['conf']['imsp']['enabled']) || * will override any entries gathered dynamically below. */ if (empty($cfgSources['imsp']['use_shares'])) { - require_once 'Net/IMSP/Utils.php'; $result = Net_IMSP_Utils::getAllBooks($cfgSources['imsp']); if (!is_a($result, 'PEAR_Error')) { diff --git a/turba/scripts/import_squirrelmail_file_abook.php b/turba/scripts/import_squirrelmail_file_abook.php index f8dc02372..7892ed4a0 100755 --- a/turba/scripts/import_squirrelmail_file_abook.php +++ b/turba/scripts/import_squirrelmail_file_abook.php @@ -20,8 +20,6 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true, 'user_admin' => true)); -require_once TURBA_BASE . '/lib/Object/Group.php'; - // Read command line parameters. if ($argc != 2) { $cli->message('Too many or too few parameters.', 'cli.error'); diff --git a/turba/scripts/import_squirrelmail_sql_abook.php b/turba/scripts/import_squirrelmail_sql_abook.php index b7882faef..0cedbd5e4 100755 --- a/turba/scripts/import_squirrelmail_sql_abook.php +++ b/turba/scripts/import_squirrelmail_sql_abook.php @@ -19,8 +19,6 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true, 'user_admin' => true)); -require_once TURBA_BASE . '/lib/Object/Group.php'; - // Read command line parameters. if ($argc != 2) { $cli->message('Too many or too few parameters.', 'cli.error'); -- 2.11.0