Update hylax to new Horde_Registry_Application format
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 14 Jan 2010 21:49:34 +0000 (14:49 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 15 Jan 2010 06:54:35 +0000 (23:54 -0700)
14 files changed:
hylax/compose.php
hylax/folder.php
hylax/img.php
hylax/lib/Application.php
hylax/lib/Storage/sql.php
hylax/print.php
hylax/scripts/fax_create.php
hylax/scripts/fax_create_recv.php
hylax/scripts/fax_save_data.php
hylax/scripts/fax_save_recv_data.php
hylax/scripts/install_cups_drivers.php
hylax/send.php
hylax/summary.php
hylax/view.php

index 31a6989..84bdebb 100644 (file)
@@ -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';
index 91e6461..48f24ac 100644 (file)
@@ -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');
index 83f583b..0f91bac 100644 (file)
@@ -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' : '');
index 6f40e2e..b7e5e90 100644 (file)
@@ -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;
-    }
 }
index 7a86d78..48b2104 100644 (file)
@@ -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 (?, ?, ?, ?, ?, ?, ?)';
index 68ef37f..e088c8d 100644 (file)
@@ -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');
index 28190a0..bedc0da 100755 (executable)
@@ -1,11 +1,8 @@
 #!/usr/bin/php
 <?php
 
-// No need for auth.
-@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'));
 
 // Make sure no one runs this from the web.
 if (!Horde_Cli::runningFromCLI()) {
index 9ef7751..6aec1ed 100755 (executable)
@@ -1,11 +1,8 @@
 #!/usr/bin/php
 <?php
 
-// No need for auth.
-@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'));
 
 // Make sure no one runs this from the web.
 if (!Horde_Cli::runningFromCLI()) {
index aafc04a..75921e5 100755 (executable)
@@ -1,11 +1,8 @@
 #!/usr/bin/php
 <?php
 
-// No need for auth.
-@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'));
 
 // 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. */
index c5c1330..3e7a1f1 100755 (executable)
@@ -1,11 +1,8 @@
 #!/usr/bin/php
 <?php
 
-// No need for auth.
-@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'));
 
 // Make sure no one runs this from the web.
 if (!Horde_Cli::runningFromCLI()) {
index 072980b..99665a1 100755 (executable)
@@ -1,11 +1,8 @@
 #!/usr/bin/php
 <?php
 
-// No need for auth.
-@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'));
 
 // Make sure no one runs this from the web.
 if (!Horde_Cli::runningFromCLI()) {
index 76928a5..0472ecd 100644 (file)
@@ -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'));
index d1d4920..cb95a48 100644 (file)
@@ -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');
index 368c09b..0d15ae2 100644 (file)
@@ -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');