conf = $conf_file; if (!file_exists($this->conf)) { $this->base = $_SERVER['REQUEST_URI']; $t = $this->template(); $t->header('Message Manager'); $t->paragraph( 'Awe shiz, dude, conf.php doesn\'t exist, you '. 'need to go through the '. 'installer.'); $t->footer(); exit(); } session_start(); } // Load Things public function database() { if (!isset($this->database)) { require_once('Database.class.php'); $this->database = new Database($this->conf); } return $this->database; } public function hasher() { if (!isset($this->pw_hasher)) { require_once('PasswordHash.class.php'); $this->pw_hasher = new PasswordHash(8, false); } return $this->pw_hasher; } public function template() { if (!isset($this->template)) { require_once(VIEWPATH.'/Template.class.php'); $this->template = new Template($this->baseUrl(), $this); } return $this->template; } public function pluginManager() { if (!isset($this->pluginManager)) { require_once('PluginManager.class.php'); $this->pluginManager = new PluginManager(); } return $this->pluginManager; } // Utility functions public function shortUrl($longUrl) { $ch = curl_init('http://ur1.ca'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFILEDS, 'longurl='.urlencode($longUrl)); $html = curl_exec(); preg_match('/Your ur1 is: /',$html,$matches); $shortUrl = $matches[1]; curl_close($ch); return $shortUrl; } public function baseUrl() { if (!isset($this->base)) { $this->base = $this->database()->getSysConf('baseurl'); } return $this->base; } }