From: Michael M Slusarz Date: Thu, 14 Jan 2010 21:49:34 +0000 (-0700) Subject: Update hylax to new Horde_Registry_Application format X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8976e91b8d972f01583ab242adeb977b2f1852ce;p=horde.git Update hylax to new Horde_Registry_Application format --- diff --git a/hylax/compose.php b/hylax/compose.php index 31a6989b5..84bdebb9d 100644 --- a/hylax/compose.php +++ b/hylax/compose.php @@ -11,7 +11,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -$hylax = new Hylax_Application(array('init' => true)); +$hylax = Horde_Registry::appInit('hylax'); /* Load Cover Page templates */ require HYLAX_BASE . '/config/covers.php'; diff --git a/hylax/folder.php b/hylax/folder.php index 91e646110..48f24ac65 100644 --- a/hylax/folder.php +++ b/hylax/folder.php @@ -7,7 +7,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -$hylax = new Hylax_Application(array('init' => true)); +$hylax = Horde_Registry::appInit('hylax'); $folder = strtolower(Horde_Util::getFormData('folder', 'inbox')); $path = Horde_Util::getFormData('path'); diff --git a/hylax/img.php b/hylax/img.php index 83f583b6f..0f91bacc1 100644 --- a/hylax/img.php +++ b/hylax/img.php @@ -6,21 +6,15 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -// FIXME: Do we need AUTH_HANDLER here? -//@define('AUTH_HANDLER', true); require_once dirname(__FILE__) . '/lib/Application.php'; -$hylax = new Hylax_Application(array('init' => true)); +$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none')); $fax_id = Horde_Util::getFormData('fax_id'); $page = Horde_Util::getFormData('page'); $preview = Horde_Util::getFormData('preview'); /* Set up the cache object. */ -require_once 'Horde/Cache.php'; -$cache = &Horde_Cache::singleton($conf['cache']['driver'], Horde::getDriverConfig('cache', $conf['cache']['driver'])); -if (is_a($cache, 'PEAR_Error')) { - Horde::fatal($cache, __FILE__, __LINE__); -} +$cache = Horde_Cache::singleton($conf['cache']['driver'], Horde::getDriverConfig('cache', $conf['cache']['driver'])); /* Call the get the image data using cache. */ $id = $fax_id . '_' . $page . ($preview ? '_p' : ''); diff --git a/hylax/lib/Application.php b/hylax/lib/Application.php index 6f40e2eed..b7e5e90a0 100644 --- a/hylax/lib/Application.php +++ b/hylax/lib/Application.php @@ -9,7 +9,6 @@ * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. - * */ if (!defined('HYLAX_BASE')) { @@ -32,56 +31,28 @@ require_once HORDE_BASE . '/lib/core.php'; class Hylax_Application extends Horde_Registry_Application { + public $version = 'H4 (0.1-git)'; + public $gateway = null; public $storage = null; - function __construct($args = array()) + protected function _init() { - if (!empty($args['init'])) { - - // Registry. - $registry = &Horde_Registry::singleton(); - $GLOBALS['registry'] = &$registry; - - try { - $registry->pushApp('hylax', !defined('AUTH_HANDLER')); - } catch (Horde_Exception $e) { - if ($e->getCode() == 'permission_denied') { - Horde_Auth::authenticateFailure('hylax', $e); - } - Horde::fatal($e, __FILE__, __LINE__, false); - } - - $conf = &$GLOBALS['conf']; - define('HYLAX_TEMPLATES', $registry->get('templates')); - - /* Notification system. */ - $notification = &Horde_Notification::singleton(); - $notification->attach('status'); - $GLOBALS['notification'] = &$notification; - - /* Find the base file path of Hylax. */ - define('HYLAX_BASE', dirname(__FILE__) . '/..'); + if (!defined('HYLAX_TEMPLATES')) { + define('HYLAX_TEMPLATES', $GLOBALS['registry']->get('templates')); + } - /* Hylax Driver */ - $this->gateway = &Hylax_Driver::singleton($conf['fax']['driver'], - $conf['fax']['params']); + /* Notification system. */ + $notification = Horde_Notification::singleton(); + $notification->attach('status'); + $GLOBALS['notification'] = &$notification; - /* Hylax storage driver. */ - $this->storage = &Hylax_Storage::singleton('sql', $conf['sql']); + /* Hylax Driver */ + $this->gateway = Hylax_Driver::singleton($conf['fax']['driver'], + $conf['fax']['params']); - /* Start compression, if requested. */ - Horde::compressOutput(); - } + /* Hylax storage driver. */ + $this->storage = Hylax_Storage::singleton('sql', $conf['sql']); } - public function perms() - { - static $perms = array(); - if (!empty($perms)) { - return $perms; - } - - return $perms; - } } diff --git a/hylax/lib/Storage/sql.php b/hylax/lib/Storage/sql.php index 7a86d78cd..48b21045b 100644 --- a/hylax/lib/Storage/sql.php +++ b/hylax/lib/Storage/sql.php @@ -168,7 +168,6 @@ class Hylax_Storage_sql extends Hylax_Storage { } /* Unserialize the gateway params. */ - require_once 'Horde/Serialize.php'; $gateway['gateway_params'] = Horde_Serialize::unserialize($gateway['gateway_params'], Horde_Serialize::UTF7_BASIC); /* Unserialize the gateway send params. */ @@ -203,7 +202,6 @@ class Hylax_Storage_sql extends Hylax_Storage { } /* Serialize the gateway params. */ - require_once 'Horde/Serialize.php'; if (!empty($info['gateway_params'])) { $info['gateway_params'] = Horde_Serialize::serialize($info['gateway_params'], Horde_Serialize::UTF7_BASIC); } else { @@ -275,7 +273,6 @@ class Hylax_Storage_sql extends Hylax_Storage { } /* Serialize the message params. */ - require_once 'Horde/Serialize.php'; $message_params = Horde_Serialize::serialize($message_params, Horde_Serialize::UTF7_BASIC); $sql = 'INSERT INTO swoosh_messages (message_id, user_uid, gateway_id, message_batch_id, message_text, message_params, message_submitted) VALUES (?, ?, ?, ?, ?, ?, ?)'; diff --git a/hylax/print.php b/hylax/print.php index 68ef37f76..e088c8dab 100644 --- a/hylax/print.php +++ b/hylax/print.php @@ -7,7 +7,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -$hylax = new Hylax_Application(array('init' => true)); +$hylax = Horde_Registry::appInit('hylax'); $fax_id = Horde_Util::getFormData('fax_id'); $url = Horde_Util::getFormData('url', 'folder.php'); diff --git a/hylax/scripts/fax_create.php b/hylax/scripts/fax_create.php index 28190a012..bedc0dacf 100755 --- a/hylax/scripts/fax_create.php +++ b/hylax/scripts/fax_create.php @@ -1,11 +1,8 @@ #!/usr/bin/php true)); +$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none')); // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { diff --git a/hylax/scripts/fax_create_recv.php b/hylax/scripts/fax_create_recv.php index 9ef775167..6aec1edad 100755 --- a/hylax/scripts/fax_create_recv.php +++ b/hylax/scripts/fax_create_recv.php @@ -1,11 +1,8 @@ #!/usr/bin/php true)); +$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none')); // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { diff --git a/hylax/scripts/fax_save_data.php b/hylax/scripts/fax_save_data.php index aafc04af7..75921e5ec 100755 --- a/hylax/scripts/fax_save_data.php +++ b/hylax/scripts/fax_save_data.php @@ -1,11 +1,8 @@ #!/usr/bin/php true)); +$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none')); // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { @@ -14,7 +11,7 @@ if (!Horde_Cli::runningFromCLI()) { /* Load the CLI environment - make sure there's no time limit, init some * variables, etc. */ -$cli = &new Horde_Cli(); +$cli = new Horde_Cli(); $cli->init(); /* Store the raw fax postscript data. */ diff --git a/hylax/scripts/fax_save_recv_data.php b/hylax/scripts/fax_save_recv_data.php index c5c1330f7..3e7a1f12d 100755 --- a/hylax/scripts/fax_save_recv_data.php +++ b/hylax/scripts/fax_save_recv_data.php @@ -1,11 +1,8 @@ #!/usr/bin/php true)); +$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none')); // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { diff --git a/hylax/scripts/install_cups_drivers.php b/hylax/scripts/install_cups_drivers.php index 072980b0f..99665a182 100755 --- a/hylax/scripts/install_cups_drivers.php +++ b/hylax/scripts/install_cups_drivers.php @@ -1,11 +1,8 @@ #!/usr/bin/php true)); +$hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none')); // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { diff --git a/hylax/send.php b/hylax/send.php index 76928a570..0472ecdc1 100644 --- a/hylax/send.php +++ b/hylax/send.php @@ -7,7 +7,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -$hylax = new Hylax_Application(array('init' => true)); +$hylax = Horde_Registry::appInit('hylax'); $fax_id = Horde_Util::getFormData('fax_id'); $folder = strtolower(Horde_Util::getFormData('folder')); diff --git a/hylax/summary.php b/hylax/summary.php index d1d492019..cb95a48d5 100644 --- a/hylax/summary.php +++ b/hylax/summary.php @@ -7,7 +7,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -$hylax = new Hylax_Application(array('init' => true)); +$hylax = Horde_Registry::appInit('hylax'); $fmt_inbox = array(); $inbox = $hylax->gateway->getFolder('inbox'); diff --git a/hylax/view.php b/hylax/view.php index 368c09b16..0d15ae236 100644 --- a/hylax/view.php +++ b/hylax/view.php @@ -7,7 +7,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -$hylax = new Hylax_Application(array('init' => true)); +$hylax = Horde_Registry::appInit('hylax'); $fax_id = Horde_Util::getFormData('fax_id'); $url = Horde_Util::getFormData('url');