Major theme rework

This commit is contained in:
Deon George
2012-01-29 17:23:24 +11:00
parent 3d1c43687c
commit 89bb9004ed
49 changed files with 663 additions and 1320 deletions

222
index.php
View File

@@ -1,131 +1,121 @@
<?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
*
* 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
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @subpackage Core
*/
/**
* The main AgileBill Index Page
* The directory in which your application specific resources are located.
* The application directory must contain the bootstrap.php file.
*
* @see http://kohanaframework.org/guide/about.install#application
*/
$application = 'application';
/**
* The directory in which your modules are located.
*
* @see http://kohanaframework.org/guide/about.install#modules
*/
$modules = 'modules';
/**
* The directory in which upstream Kohana resources (modules) are located.
*/
$sysmodules = 'includes/kohana/modules';
/**
* The directory in which the Kohana resources are located. The system
* directory must contain the classes/kohana.php file.
*
* @see http://kohanaframework.org/guide/about.install#system
*/
$system = 'includes/kohana/system';
/**
* The default extension of resource files. If you change this, all resources
* must be renamed to use the new extension.
*
* @see http://kohanaframework.org/guide/about.install#ext
*/
define('EXT', '.php');
/**
* Set the PHP error reporting level. If you set this in php.ini, you remove this.
* @see http://php.net/error_reporting
*
* When developing your application, it is highly recommended to enable notices
* and strict warnings. Enable them by using: E_ALL | E_STRICT
*
* In a production environment, it is safe to ignore notices and strict warnings.
* Disable them by using: E_ALL ^ E_NOTICE
*
* When using a legacy application with PHP >= 5.3, it is recommended to disable
* deprecated notices. Disable with: E_ALL & ~E_DEPRECATED
*/
error_reporting(E_ALL | E_STRICT);
/**
* End of standard configuration! Changing any of the code below should only be
* attempted by those with a working knowledge of Kohana internals.
*
* @see http://kohanaframework.org/guide/using.configuration
*/
date_default_timezone_set('Australia/Melbourne');
// Set the full path to the docroot
define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
ob_start();
// Make the application relative to the docroot, for symlink'd index.php
if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
$application = DOCROOT.$application;
# Check if we are task, and if so, override our default id
$runTasks = false;
if (isset($_SERVER['argv']) && is_array($_SERVER['argv'])) {
# Pre-set our SERVER_NAME
if (! isset($_SERVER['SERVER_NAME']))
$_SERVER['SERVER_NAME'] = isset($_SERVER['HOSTNAME']) ? $_SERVER['HOSTNAME'] : trim(shell_exec('hostname'));
// Make the modules relative to the docroot, for symlink'd index.php
if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
$modules = DOCROOT.$modules;
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);
elseif (preg_match('/^debug=/',$values))
$hardcode['debug'] = preg_replace('/^debug=(.*)$/',"$1",$values);
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($sysmodules) AND is_dir(DOCROOT.$sysmodules))
$sysmodules = DOCROOT.$sysmodules;
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
$system = DOCROOT.$system;
// Define the absolute paths for configured directories
define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('SMDPATH', realpath($sysmodules).DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
// Clean up the configuration vars
unset($application, $modules, $sysmodules, $system);
if (file_exists('install'.EXT))
{
// Load the installation check
return include 'install'.EXT;
}
require_once('config.inc.php');
require_once('modules/module.inc.php');
require_once('modules/core/vars.inc.php');
$C_vars = new CORE_vars;
# 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'))
require_once('install/install.inc');
exit;
/**
* Define the start time of the application, used for profiling.
*/
if ( ! defined('KOHANA_START_TIME'))
{
define('KOHANA_START_TIME', microtime(TRUE));
}
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');
$C_debug = new CORE_debugger;
$C_setup = new CORE_setup;
$C_sess = new CORE_session;
$C_sess->session_constant();
$C_method = new CORE_method;
$C_translate = new CORE_translate;
if ((isset($VAR['_login'])) && (isset($VAR['_username'])) && (isset($VAR['_password']))) {
require_once(PATH_CORE.'login.inc.php');
$C_login = new CORE_login_handler();
$C_login->login($VAR);
} elseif (isset($VAR['_logout'])) {
require_once(PATH_CORE.'login.inc.php');
$C_login = new CORE_login_handler();
$C_login->logout($VAR);
/**
* Define the memory usage at the start of the application, used for profiling.
*/
if ( ! defined('KOHANA_START_MEMORY'))
{
define('KOHANA_START_MEMORY', memory_get_usage());
}
$C_sess->session_constant_log();
$C_auth = new CORE_auth(false);
// Bootstrap the application
require APPPATH.'bootstrap'.EXT;
$smarty = new Smarty;
$C_list = new CORE_list;
$C_block = new CORE_block;
# See if we are being called to do task activities
if ($runTasks) {
require_once(PATH_MODULES.'task/task.inc.php');
$task = new task;
$task->run_all();
exit;
}
$C_method->do_all();
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);
} else {
$smarty->assign('SESS_LOGGED',SESS_LOGGED);
$smarty->assign('SESS_ACCOUNT',SESS_ACCOUNT);
}
$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;
ob_end_flush();
?>
/**
* Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
* If no source is specified, the URI will be automatically detected.
*/
echo Request::factory()
->execute()
->send_headers()
->body();