public function __construct() { $this->_cs = cs::getInstance(); $this->_template =& $this->_cs->smarty; $this->_session =& $this->_cs->session; $this->_view = false; }
public function __construct() { $this->_cs = cs::getInstance(); $this->_db =& $this->_cs->db; if (Config::get('useSession') !== false) { $this->_session =& $this->_cs->session; } }
<?php error_reporting(E_ALL ^ E_NOTICE); ini_set('display_errors', 1); define('DS', DIRECTORY_SEPARATOR); define('ROOT_PATH', dirname(dirname(__FILE__))); define('CORNERSTONE_PATH', ROOT_PATH . '/cornerstone'); define('APP_PATH', ROOT_PATH); define('STORAGE_PATH', APP_PATH . '/storage/'); define('LIBRARY_PATH', APP_PATH . '/libraries/'); define('HELPER_PATH', APP_PATH . '/helpers/'); define('CONFIG_FILE', APP_PATH . '/config.php'); define('ROUTES_FILE', APP_PATH . '/routes.php'); define('BOOTSTRAP_FILE', APP_PATH . '/bootstrap.php'); define('CONTROLLER_PATH', APP_PATH . '/pages/'); define('ERROR_PATH', CONTROLLER_PATH . '/errors/'); $path = str_replace('webRoot/index.php', '', $_SERVER['SCRIPT_NAME']); require CORNERSTONE_PATH . '/cs.php'; $cs = cs::getInstance(); $cs->dispatch();
/** * Returns the difference between the current timestamp, and the begining of code execution * as defined by the '$cs->startTime' property. * * @static executionTime * @return float Execution time in seconds, rounded to 2 decimal places. */ public static function executionTime() { $cs = cs::getInstance(); $now = microtime(true); return round($now - $cs->startTime, 2); }
/** * Queries database and returns the resulting data. Used for any queries that fetch data * * @param string $query The parameterized query to execute * @param array $params Array of parameters to fill query with * * @return boolean|array The resulting data, or false on error */ public function get($query, $params = array()) { try { $statement = $this->_connection->prepare($query); if (!is_array($params)) { $params = array($params); } $statement->execute($params); return $statement->fetchAll(PDO::FETCH_BOTH); } catch (PDOException $e) { $cs = cs::getInstance(); throw new Exception($e->getMessage()); return false; } }