/** * createDB * * @access private * @return reference */ private static function &createDB() { if (is_null(self::$dbDriver)) { $dsn = null; $class = 'Framework_DB'; $file = null; if (isset(Framework::$site->config->dbClass)) { $class = 'Framework_DB_' . (string) Framework::$site->config->dbClass; $file = 'Framework/DB/' . Framework::$site->config->dbClass . '.php'; } if (isset(Framework::$site->config->dsn)) { $dsn = (string) Framework::$site->config->dsn; } else { $class = 'Framework_DB_None'; } if (!is_null($file)) { if (!(include_once $file)) { return PEAR::raiseError('Could not load class file: ' . $file); } } self::$dbDriver = new $class(); } if (is_null(Framework::$db)) { self::$dbDriver->start($dsn); } return Framework::$db; }
/** * __construct * * @access public * @return void */ public function __construct() { parent::__construct(); if (!is_null($this->db)) { $this->user = Framework_User::singleton(); } $this->session = Framework_Session::singleton(); }
/** * __construct * * @author Joe Stump <*****@*****.**> * @access public * @return void */ public function __construct($userID = null) { parent::__construct(); if (is_null($userID)) { $session = Framework_Session::singleton(); $userID = $session->{Framework::$site->config->user->userField}; if (is_null($userID)) { $userID = (string) Framework::$site->config->user->defaultUser; } else { $userID = $session->{(string) Framework::$site->config->user->userField}; } } $sql = "SELECT *\n FROM " . Framework::$site->config->user->userTable . "\n WHERE " . Framework::$site->config->user->userField . "='" . $userID . "'"; $result = $this->db->getRow($sql); if (!PEAR::isError($result) && is_array($result)) { $this->data = $result; } else { throw new Framework_Exception('Could not look up userID'); } }
/** * __construct * * @author Joe Stump <*****@*****.**> * @access public * @return void */ public function __construct($userID = null) { parent::__construct(); $this->getUserData($userID); }
/** * __construct * * @access public * @return void */ public function __construct() { parent::__construct(); $this->user = Framework_User::singleton(); $this->session = Framework_Session::singleton(); }