* @author Joel Vandal <joel@scopserv.com>
*/
-@define('HYLAX_BASE', dirname(__FILE__));
-require_once HYLAX_BASE . '/lib/base.php';
-require_once 'Horde/Form.php';
-require_once 'Horde/Form/Renderer.php';
-require_once 'Horde/Form/Action.php';
-require_once 'Horde/Template.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
/* Load Cover Page templates */
require HYLAX_BASE . '/config/covers.php';
*
* $Horde: incubator/hylax/folder.php,v 1.7 2009/06/10 05:24:17 slusarz Exp $
*/
-@define('HYLAX_BASE', dirname(__FILE__));
-require_once HYLAX_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
$folder = strtolower(Horde_Util::getFormData('folder', 'inbox'));
$path = Horde_Util::getFormData('path');
} elseif (empty($value['fax_number']) && $value['fax_type'] == 0) {
$folder_list[$key]['fax_number'] = _("unknown");
}
- $folder_list[$key]['fax_status'] = $gateway->getStatus($value['job_id']);
+ $folder_list[$key]['fax_status'] = $hylax->gateway->getStatus($value['job_id']);
}
/* Set up actions. */
* $Horde: incubator/hylax/img.php,v 1.4 2009/06/10 05:24:17 slusarz Exp $
*/
-@define('AUTH_HANDLER', true);
-@define('HYLAX_BASE', dirname(__FILE__));
-require_once HYLAX_BASE . '/lib/base.php';
+// 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));
$fax_id = Horde_Util::getFormData('fax_id');
$page = Horde_Util::getFormData('page');
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
- * $Horde: incubator/hylax/lib/base.php,v 1.16 2009/07/13 20:05:46 slusarz Exp $
*/
if (!defined('HYLAX_BASE')) {
class Hylax_Application extends Horde_Registry_Application
{
+ public $gateway = null;
+ public $storage = null;
+
function __constructor($args = array())
{
if (!empty($args['init'])) {
define('HYLAX_BASE', dirname(__FILE__) . '/..');
/* Hylax Driver */
- $gateway = Hylax_Driver::singleton($conf['fax']['driver'], $conf['fax']['params']);
+ $this->gateway = Hylax_Driver::singleton($conf['fax']['driver'],
+ $conf['fax']['params']);
/* Hylax storage driver. */
- $hylax_storage = Hylax_Storage::singleton('sql', $conf['sql']);
+ $this->storage = Hylax_Storage::singleton('sql', $conf['sql']);
/* Start compression, if requested. */
Horde::compressOutput();
function send($fax_id, $number)
{
- global $conf, $gateway;
+ global $hylax;
$this->_setFaxNumber($fax_id, $number);
$data = $this->getFaxData($fax_id);
- $job_id = $gateway->send($number, $data);
+ $job_id = $hylax->gateway->send($number, $data);
$this->_setJobId($fax_id, $job_id);
}
+++ /dev/null
-<?php
-/**
- * Hylax base inclusion file.
- *
- * This file brings in all of the dependencies that every Hylax script will
- * need, and sets up objects that all scripts use.
- *
- * Copyright 2003-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * $Horde: incubator/hylax/lib/base.php,v 1.16 2009/07/13 20:05:46 slusarz Exp $
- */
-
-if (!defined('HYLAX_BASE')) {
- define('HYLAX_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(HYLAX_BASE. '/config/horde.local.php')) {
- include HYLAX_BASE . '/config/horde.local.php';
- } else {
- define('HORDE_BASE', HYLAX_BASE . '/..');
- }
-}
-
-// Load the Horde Framework core, and set up inclusion paths.
-require_once HORDE_BASE . '/lib/core.php';
-
-// Registry.
-$registry = Horde_Registry::singleton();
-try {
- $registry->pushApp('hylax', !defined('AUTH_HANDLER'));
-} catch (Horde_Exception $e) {
- if ($e->getCode() == 'permission_denied') {
- Horde::authenticationFailureRedirect();
- }
- Horde::fatal($e, __FILE__, __LINE__, false);
-}
-
-$conf = &$GLOBALS['conf'];
-@define('HYLAX_TEMPLATES', $registry->get('templates'));
-
-/* Notification system. */
-$notification = &Horde_Notification::singleton();
-$notification->attach('status');
-
-/* Find the base file path of Hylax. */
-@define('HYLAX_BASE', dirname(__FILE__) . '/..');
-
-/* Hylax base libraries. */
-require_once HYLAX_BASE . '/lib/Hylax.php';
-require_once HYLAX_BASE . '/lib/Driver.php';
-require_once HYLAX_BASE . '/lib/Storage.php';
-
-/* Hylax Driver */
-$gateway = &Hylax_Driver::singleton($conf['fax']['driver'], $conf['fax']['params']);
-
-/* Hylax storage driver. */
-$hylax_storage = &Hylax_Storage::singleton('sql', $conf['sql']);
-
-/* Start compression, if requested. */
-Horde::compressOutput();
* $Horde: incubator/hylax/print.php,v 1.5 2009/06/10 05:24:17 slusarz Exp $
*/
-@define('HYLAX_BASE', dirname(__FILE__));
-require_once HYLAX_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
$fax_id = Horde_Util::getFormData('fax_id');
$url = Horde_Util::getFormData('url', 'folder.php');
// No need for auth.
@define('AUTH_HANDLER', true);
-// Find the base file paths.
-@define('HORDE_BASE', dirname(__FILE__) . '/../..');
-@define('HYLAX_BASE', dirname(__FILE__) . '/..');
-
-// Do CLI checks and environment setup first.
-require_once HYLAX_BASE . '/lib/base.php';
-require_once 'Console/Getopt.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
// Make sure no one runs this from the web.
if (!Horde_Cli::runningFromCLI()) {
}
Horde::logMessage(sprintf('Creating fax ID %s for user %s.', $info['fax_id'], $info['fax_user']), __FILE__, __LINE__, PEAR_LOG_DEBUG);
-$hylax_storage->createFax($info, true);
+$hylax->storage->createFax($info, true);
// No need for auth.
@define('AUTH_HANDLER', true);
-// Find the base file paths.
-@define('HORDE_BASE', dirname(__FILE__) . '/../..');
-@define('HYLAX_BASE', dirname(__FILE__) . '/..');
-
-// Do CLI checks and environment setup first.
-require_once HYLAX_BASE . '/lib/base.php';
-require_once 'Console/Getopt.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
// Make sure no one runs this from the web.
if (!Horde_Cli::runningFromCLI()) {
// No need for auth.
@define('AUTH_HANDLER', true);
-// Find the base file paths.
-@define('HORDE_BASE', dirname(__FILE__) . '/../..');
-@define('HYLAX_BASE', dirname(__FILE__) . '/..');
-
-// Do CLI checks and environment setup first.
-require_once HYLAX_BASE . '/lib/base.php';
-require_once 'Console/Getopt.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
// Make sure no one runs this from the web.
if (!Horde_Cli::runningFromCLI()) {
// No need for auth.
@define('AUTH_HANDLER', true);
-// Find the base file paths.
-@define('HORDE_BASE', dirname(__FILE__) . '/../..');
-@define('HYLAX_BASE', dirname(__FILE__) . '/..');
-
-// Do CLI checks and environment setup first.
-require_once HYLAX_BASE . '/lib/base.php';
-require_once 'Console/Getopt.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
// Make sure no one runs this from the web.
if (!Horde_Cli::runningFromCLI()) {
}
/* Get the file and store into VFS. */
-$fax_id = $hylax_storage->saveFaxData($data, '.ps');
+$fax_id = $hylax->storage->saveFaxData($data, '.ps');
if (is_a($fax_id, 'PEAR_Error')) {
echo '0';
exit;
// No need for auth.
@define('AUTH_HANDLER', true);
-// Find the base file paths.
-@define('HORDE_BASE', dirname(__FILE__) . '/../..');
-@define('HYLAX_BASE', dirname(__FILE__) . '/..');
-
-// Do CLI checks and environment setup first.
-require_once HYLAX_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
// Make sure no one runs this from the web.
if (!Horde_Cli::runningFromCLI()) {
* $Horde: incubator/hylax/send.php,v 1.8 2009/06/10 17:33:26 slusarz Exp $
*/
-@define('HYLAX_BASE', dirname(__FILE__));
-require_once HYLAX_BASE . '/lib/base.php';
-require_once 'Horde/Form.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
$fax_id = Horde_Util::getFormData('fax_id');
$folder = strtolower(Horde_Util::getFormData('folder'));
$fax_id = $vars->get('fax_id');
$url = $vars->get('url', 'folder.php');
-$fax = $hylax_storage->getFax($fax_id);
+$fax = $hylax->storage->getFax($fax_id);
if (is_a($fax, 'PEAR_Error')) {
$notification->push(sprintf(_("Could not open fax ID \"%s\". %s"), $fax_id, $fax->getMessage()), 'horde.error');
$url = Horde::applicationUrl($url, true);
if ($form->validate($vars)) {
$form->getInfo($vars, $info);
- $send = $hylax_storage->send($info['fax_id'], $info['fax_number']);
+ $send = $hylax->storage->send($info['fax_id'], $info['fax_number']);
if (is_a($send, 'PEAR_Error')) {
$notification->push(sprintf(_("Could not send fax ID \"%s\". %s"), $info['fax_id'], $send->getMessage()), 'horde.error');
} else {
* $Horde: incubator/hylax/summary.php,v 1.6 2009/06/10 05:24:17 slusarz Exp $
*/
-@define('HYLAX_BASE', dirname(__FILE__));
-require_once HYLAX_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
$fmt_inbox = array();
-$inbox = $gateway->getInbox();
+$inbox = $hylax->gateway->getInbox();
foreach ($inbox as $item) {
$fmt_inbox[] = array('owner' => $item[2]);
}
/* Set up actions. */
$template = new Horde_Template();
-$template->set('in_faxes', $gateway->numFaxesIn());
-$template->set('out_faxes', $gateway->numFaxesOut());
+$template->set('in_faxes', $hylax->gateway->numFaxesIn());
+$template->set('out_faxes', $hylax->gateway->numFaxesOut());
$template->set('inbox', $fmt_inbox, true);
$template->set('outbox', $fmt_outbox, true);
$template->set('menu', Hylax::getMenu('string'));
* $Horde: incubator/hylax/view.php,v 1.7 2009/06/10 05:24:18 slusarz Exp $
*/
-@define('HYLAX_BASE', dirname(__FILE__));
-require_once HYLAX_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+$hylax = new Hylax_Application(array('init' => true));
$fax_id = Horde_Util::getFormData('fax_id');
$url = Horde_Util::getFormData('url');
exit;
}
-$fax = $hylax_storage->getFax($fax_id);
+$fax = $hylax->storage->getFax($fax_id);
if (is_a($fax, 'PEAR_Error')) {
$notification->push(sprintf(_("Could not open fax ID \"%s\". %s"), $fax_id, $fax->getMessage()), 'horde.error');
if (empty($url)) {