2008-11-26 22:50:40 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* AgileBill - Open Billing Software
|
|
|
|
*
|
|
|
|
* This body of work is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the Open AgileBill License
|
|
|
|
* License as published at http://www.agileco.com/agilebill/license1-4.txt
|
2009-08-03 04:10:16 +00:00
|
|
|
*
|
|
|
|
* Originally authored by Tony Landis, AgileBill LLC
|
|
|
|
* Recent modifications by Deon George
|
|
|
|
*
|
|
|
|
* @author Deon George <deonATleenooksDOTnet>
|
|
|
|
* @copyright 2009 Deon George
|
|
|
|
* @link http://osb.leenooks.net
|
2008-11-26 22:50:40 +00:00
|
|
|
*
|
|
|
|
* @link http://www.agileco.com/
|
|
|
|
* @copyright 2004-2008 Agileco, LLC.
|
|
|
|
* @license http://www.agileco.com/agilebill/license1-4.txt
|
2009-08-03 04:10:16 +00:00
|
|
|
* @author Tony Landis <tony@agileco.com>
|
2008-11-26 22:50:40 +00:00
|
|
|
* @package AgileBill
|
2009-08-03 04:10:16 +00:00
|
|
|
* @subpackage Core
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The main AgileBill Index Page
|
2008-11-26 22:50:40 +00:00
|
|
|
*/
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
ob_start();
|
|
|
|
|
|
|
|
# Check if we are task, and if so, override our default id
|
|
|
|
$runTasks = false;
|
|
|
|
if (isset($_SERVER['argv']) && is_array($_SERVER['argv']))
|
|
|
|
foreach ($_SERVER['argv'] as $key => $values)
|
|
|
|
if ($values == '_task=1')
|
|
|
|
$runTasks = true;
|
|
|
|
elseif (preg_match('/^site=/',$values))
|
|
|
|
$_SERVER['SERVER_NAME'] = preg_replace('/^site=(.*)$/',"$1",$values);
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
require_once('config.inc.php');
|
|
|
|
require_once('modules/module.inc.php');
|
2008-11-26 22:50:40 +00:00
|
|
|
require_once('modules/core/vars.inc.php');
|
2009-08-03 04:10:16 +00:00
|
|
|
$C_vars = new CORE_vars;
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# Set our _REQUEST vars
|
|
|
|
$VAR = $C_vars->f;
|
|
|
|
|
|
|
|
# Jump to install if we havent been installed.
|
|
|
|
if (! defined('PATH_AGILE')) {
|
|
|
|
if (is_file('install/install.inc'))
|
2008-11-26 22:50:40 +00:00
|
|
|
require_once('install/install.inc');
|
|
|
|
exit;
|
2009-08-03 04:10:16 +00:00
|
|
|
}
|
2008-11-26 22:50:40 +00:00
|
|
|
|
|
|
|
require_once('includes/adodb/adodb.inc.php');
|
|
|
|
require_once('includes/smarty/Smarty.class.php');
|
|
|
|
require_once(PATH_CORE.'auth.inc.php');
|
|
|
|
require_once(PATH_CORE.'database.inc.php');
|
|
|
|
require_once(PATH_CORE.'list.inc.php');
|
|
|
|
require_once(PATH_CORE.'method.inc.php');
|
|
|
|
require_once(PATH_CORE.'session.inc.php');
|
|
|
|
require_once(PATH_CORE.'theme.inc.php');
|
|
|
|
require_once(PATH_CORE.'translate.inc.php');
|
|
|
|
require_once(PATH_CORE.'setup.inc.php');
|
|
|
|
require_once(PATH_CORE.'xml.inc.php');
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
$C_debug = new CORE_debugger;
|
|
|
|
$C_setup = new CORE_setup;
|
|
|
|
$C_sess = new CORE_session;
|
2008-11-26 22:50:40 +00:00
|
|
|
$C_sess->session_constant();
|
2009-08-03 04:10:16 +00:00
|
|
|
$C_method = new CORE_method;
|
|
|
|
$C_translate = new CORE_translate;
|
2008-11-26 22:50:40 +00:00
|
|
|
|
|
|
|
if ((isset($VAR['_login'])) && (isset($VAR['_username'])) && (isset($VAR['_password']))) {
|
2009-08-03 04:10:16 +00:00
|
|
|
require_once(PATH_CORE.'login.inc.php');
|
2008-11-26 22:50:40 +00:00
|
|
|
$C_login = new CORE_login_handler();
|
|
|
|
$C_login->login($VAR);
|
2009-08-03 04:10:16 +00:00
|
|
|
|
|
|
|
} elseif (isset($VAR['_logout'])) {
|
|
|
|
require_once(PATH_CORE.'login.inc.php');
|
|
|
|
$C_login = new CORE_login_handler();
|
2008-11-26 22:50:40 +00:00
|
|
|
$C_login->logout($VAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
$C_sess->session_constant_log();
|
2009-08-03 04:10:16 +00:00
|
|
|
$C_auth = new CORE_auth(false);
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
$smarty = new Smarty;
|
|
|
|
$C_list = new CORE_list;
|
|
|
|
$C_block = new CORE_block;
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# See if we are being called to pust do task activities
|
|
|
|
if ($runTasks) {
|
|
|
|
require_once(PATH_MODULES.'task/task.inc.php');
|
2008-11-26 22:50:40 +00:00
|
|
|
$task = new task;
|
2009-08-03 04:10:16 +00:00
|
|
|
|
2008-11-26 22:50:40 +00:00
|
|
|
$task->run_all();
|
|
|
|
exit;
|
2009-08-03 04:10:16 +00:00
|
|
|
}
|
2008-11-26 22:50:40 +00:00
|
|
|
|
|
|
|
$C_method->do_all();
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
if (isset($C_auth2) && $C_auth2 != false && defined('FORCE_SESS_ACCOUNT')) {
|
|
|
|
$smarty->assign('SESS_LOGGED',FORCE_SESS_LOGGED);
|
|
|
|
$smarty->assign('SESS_ACCOUNT',FORCE_SESS_ACCOUNT);
|
2008-11-26 22:50:40 +00:00
|
|
|
} else {
|
2009-08-03 04:10:16 +00:00
|
|
|
$smarty->assign('SESS_LOGGED',SESS_LOGGED);
|
|
|
|
$smarty->assign('SESS_ACCOUNT',SESS_ACCOUNT);
|
2008-11-26 22:50:40 +00:00
|
|
|
}
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
$smarty->assign_by_ref('method',$C_method);
|
|
|
|
$smarty->assign_by_ref('list',$C_list);
|
|
|
|
$smarty->assign_by_ref('block',$C_block);
|
|
|
|
$smarty->assign_by_ref('alert',$C_debug->alert);
|
|
|
|
$smarty->assign('VAR',$VAR);
|
|
|
|
$smarty->assign('SESS',SESS);
|
|
|
|
$smarty->assign('SSL_URL',SSL_URL);
|
|
|
|
$smarty->assign('URL',URL);
|
|
|
|
|
|
|
|
$C_theme = new CORE_theme;
|
2008-11-26 22:50:40 +00:00
|
|
|
|
|
|
|
ob_end_flush();
|
|
|
|
?>
|