Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
ISSO - Blob - ViewGit - Blue Static
<?php
/*=====================================================================*\
|| ###################################################################
|| # Blue Static ISSO Framework
|| # Copyright (c)2005-2009 Blue Static
|| #
|| # This program is free software; you can redistribute it and/or modify
|| # it under the terms of the GNU General Public License as published by
|| # the Free Software Foundation; version 2 of the License.
|| #
|| # This program is distributed in the hope that it will be useful, but
|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|| # more details.
|| #
|| # You should have received a copy of the GNU General Public License along
|| # with this program; if not, write to the Free Software Foundation, Inc.,
|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|| ###################################################################
\*=====================================================================*/

/**
 * ISSO Application Root (App.php)
 *
 * @package	ISSO
 */

// we need PHP 5.2.0 to run
if (!function_exists('array_fill_keys'))
{
	print('You need PHP version 5.2.0 or newer to run ISSO');
	exit;
}

// get rid of register_globals
if ((bool)ini_get('register_globals') === true)
{
	$superglobals = array('_GET', '_COOKIE', '_FILES', '_POST', '_SERVER', '_ENV');
	foreach ($superglobals as $global)
	{
		if (is_array(${$global}))
		{
			foreach (${$global} as $_key => $_val)
			{
				if (isset(${$_key}))
				{
					unset(${$_key});
				}
			}
		}
	}
}

require_once ISSO . '/ExceptionHandler.php';
set_exception_handler(array('BSExceptionHandler', 'handle'));

/**
 * Application Class
 *
 * This is an ISSO application class. It holds all of the ISSO system variables as well
 * as serving as an object registry that is avaliable in the global scope to prevent
 * globalization of variables. There can only be one instance of this existing
 * at any given time.
 *
 * @author		Blue Static
 * @copyright	Copyright (c)2005 - 2009, Blue Static
 * @package		ISSO
 *
 */
class BSApp
{
	/**
	 * Debug mode?
	 * @var	bool
	 */
	private static $debug = false;

	/**
	 * An array of debug messages
	 * @var	array
	 */
	private static $debugInfo = array();

	/**
	 * Constructor
	 */
	private function __construct()
	{}

	/**
	 * Sets the debug state
	 *
	 * @param	bool	Debug mode on?
	 */
	public static function set_debug($debug)
	{
		self::$debug = $debug;
	}

	/**
	 * Gets the debug mode state
	 *
	 * @return	bool	Debug mode on?
	 */
	public static function get_debug()
	{
		return self::$debug;
	}

	/**
	 * Adds a debug message to the array. This only works when debug mode
	 * is enabled.
	 *
	 * @param	string	Debug message
	 */
	public static function debug($msg)
	{
		if (self::$debug)
		{
			self::$debugInfo[] = $msg;
		}
	}

	/**
	 * Returns a <select> menu of all the debug notices
	 *
	 * @return	string	Debug list
	 */
	public static function get_debug_list()
	{
		$output = '<select><option>Debug Notices (' . sizeof(self::$debugInfo) . ')</option>';
		foreach (self::$debugInfo as $notice)
		{
			$output .= "<option>--- $notice</option>";
		}
		return "$output</select>";
	}

	// ###################################################################
	// modules

	/**
	 * BSDate
	 * @var object
	 */
	public static $date;

	/**
	 * BSDb
	 * @var object
	 */
	public static $db;

	/**
	 * BSInput
	 * @var object
	 */
	public static $input;

	/**
	 * BSTemplate
	 * @var object
	 */
	public static $template;
}

?>