public final function __construct($stuff = null) { $this->config = Config::Instance(); $connect = $this->db ? true : false; $this->db = Db::Instance(); if ($connect) { $this->db = $this->db->connect(); } $sessioncfg = $this->config->get('session'); if ($this->session) { $this->session = new \Sighhat\Session\Named($sessioncfg['name']); } if (method_exists($this, 'init')) { $this->init($stuff); } }
public function getAuthData() { $db = \Sighhat\Db\Base::Instance()->getCurrentAdapter(); $prep = $db->prepare(' SELECT ' . $this->sIdentityColumn . ' FROM ' . $this->sAuthTable . ' WHERE ' . $this->sIdentityColumn . ' = :identity AND ' . $this->sCredentialColoumn . ' = :credentials '); $prep->execute(array(':identity' => $this->sIdentity, ':credentials' => hash('md5', $this->sCredentials))); if (!($user = $prep->fetch(\PDO::FETCH_ASSOC))) { $this->aAuthData = false; } else { $this->aAuthData = $user; } return $this->aAuthData; }
<?php include LIB_PATH . 'Sighhat/Includes.php'; include 'Includes.php'; use Sighhat\Cache\Base as Cache, Sighhat\Error, Sighhat\Config, Sighhat\Session\Base as Session, Sighhat\Cache\Container\Cache as DICache, Sighhat\Session\Container\Base as DISession, Sighhat\Db\Base as Db, Sighhat\Db\Container\Db as DIDb; error_reporting(E_ALL | E_STRICT); function exception_error_handler($errno, $errstr, $errfile, $errline) { ob_clean(); Error::handle(new Exception($errstr)); } //set_error_handler("exception_error_handler"); define('CSS_VERSION', 1); define('JS_VERSION', 1); define('DEV_ENV', 'development'); define('PROD_ENV', 'production'); define('STAGE_ENV', 'stage'); define('CLI', false); define('ERROR_LOG', true); //define('ENV', DEV_ENV);// Dev/Prod switch, pref in apache vhost tbh Config::Instance(include 'Config.php'); Session::Start(new DISession()); Cache::Instance(new DICache()); Db::Instance(new DIDb());