Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @copyright ProFusion
- * @author ProFusion
- */
- if (!defined('NO_IMPORTS')) {
- require_once(PBB_DIR.'functions.php');
- }
- class PBB {
- /**
- * MySQLDatabase object
- * @name dbObj
- * @access static private
- *
- * @var object
- */
- static private $dbObj = null;
- /**
- * Cache object
- * @name dbObj
- * @access static private
- *
- * @var object
- */
- static private $cacheObj = null;
- /**
- * Template class object
- * @name tplObj
- * @access static private
- *
- * @var object
- */
- static private $tplObj = null;
- /**
- * Starts up PBB
- * @name __construct
- * @access public
- *
- * @return void
- */
- public function __construct() {
- $this->initDB();
- $this->initCache();
- $this->initTPL();
- }
- /**
- * Inits MySQLDatabase
- * @name initDB
- * @access private
- *
- * @return void
- */
- private function initDB() {
- require_once(PBB_DIR.'lib/system/database/MySQLDatabase.class.php');
- $dbHost = $dbUser = $dbPass = $dbName = '';
- require_once(PBB_DIR.'config.inc.php');
- self::$dbObj = new MySQLDatabase($dbHost, $dbUser, $dbPass, $dbName, false);
- }
- /**
- * Gets MySQLDatabase object
- * @name getDB
- * @access static public
- *
- * @return object
- */
- static public function getDB() {
- return self::$dbObj;
- }
- /**
- * Inits Cache
- * @name initCache
- * @access private
- *
- * @return void
- */
- private function initCache() {
- require_once(PBB_DIR.'lib/system/cache/Cache.class.php');
- self::$cacheObj = new Cache();
- }
- /**
- * Gets Cache object
- * @name getCache
- * @access static public
- *
- * @return object
- */
- static public function getCache() {
- return self::$cacheObj;
- }
- /**
- * Inits Template class
- * @name initTPL
- * @access private
- *
- * @return void
- */
- private function initTPL() {
- require_once(PBB_DIR.'lib/system/template/Template.class.php');
- #$styleID = (!empty(PBB::getStyle()->currentStyleID)) ? PBB::getStyle()->currentStyleID : 1;
- self::$tplObj = new Template(1);
- PBB::getTPL()->addFile('core/style/'.PBB::getTPL()->styleLocation.'/'.PBB::getTPL()->styleLocation, 'stylesheet');
- }
- /**
- * Gets TemplateParser object
- * @name getTPL
- * @access static public
- *
- * @return object
- */
- static public function getTPL() {
- return self::$tplObj;
- }
- /**
- * Handles an exception
- * @name handleException
- * @access static public
- *
- * @param exception $e exception object
- *
- * @return void
- */
- static public function handleException(exception $e) {
- if ($e instanceof PrintableException) {
- $e->show();
- exit;
- }
- }
- /**
- * Handles an error
- * @name handleError
- * @access static public
- *
- * @param int $errno error code
- * @param string $errstr error as string
- * @param string $errfile errorfile
- * @param string $errline errorline
- *
- * @return void
- */
- static public function handleError($errno = 0, $errstr, $errfile, $errline) {
- if ($errno != E_NOTICE) {
- $error = new ErrorHandler($errno, $errstr, $errfile, $errline);
- throw new SystemException($error->errorAsString(), $errno, $this);
- } else {
- //ignore
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement