function __construct() { shitbugs("<b>baseModel:</b> Creating new instance"); $this->registry = baseRegistry::getInstance(); $this->dbHandle = mysql_connect(DB_HOST, DB_USER, DB_PASSWD); mysql_select_db(DB_NAME); // Get names for sections, etc if (empty($this->registry->section_byname)) { shitbugs("Loading Sections!"); $result = $this->dbSelect('SELECT * FROM sections'); while ($section = mysql_fetch_assoc($result)) { $section_byname[$section['name']] = $section; $section_byid[$section['section_id']] = $section; } $this->registry->section_byname = $section_byname; $this->registry->section_byid = $section_byid; $post['section_id'] = "2"; baseView::makelink('section', $post['section_id'], $this->registry->section_byid[$post['section_id']]['name']); } if (empty($this->registry->category_byname)) { shitbugs("Loading Categories!"); $result = $this->dbSelect('SELECT * FROM categories'); while ($category = mysql_fetch_assoc($result)) { $category_byname[$category['name']] = $category; $category_byid[$category['category_id']] = $category; } $this->registry->category_byname = $category_byname; $this->registry->category_byid = $category_byid; $post['section_id'] = "2"; baseView::makelink('section', $post['section_id'], $this->registry->section_byid[$post['section_id']]['name']); } }
public static function getInstance() { if (!isset(self::$instance)) { shitbugs("<b>baseRegistry:</b> Creating new instance"); self::$instance = new self(); } else { shitbugs("<b>baseRegistry:</b> Returning existing instance"); } return self::$instance; }
function __construct() { shitbugs("<b>baseView:</b> Creating new instance"); $this->registry = baseRegistry::getInstance(); }
<?php /* * I haven't the slightest f*****g idea what I'm doing * but I'm doing it anyway. */ ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); require_once 'config.php'; require_once 'inc/baseRegistry.php'; require_once 'inc/baseController.php'; require_once 'inc/baseModel.php'; require_once 'inc/baseView.php'; session_start(); $registry = baseRegistry::getInstance(); $registry->testValue = "<i>F**k me with a watermellon!</i>"; $registry->queryCount = 0; function shitbugs($message) { if (DEBUG) { echo 'Shit happened: ' . $message . '<br />'; } } function __autoload($class) { $file = MODULE_PATH . str_replace('_', '/', $class) . '.php'; if (is_readable($file)) { require_once $file; } else { shitbugs("I'd love to run {$file} for you, however, it does not exist!"); exit;
function __construct() { $this->registry = baseRegistry::getInstance(); }