public function __construct() { parent::__construct(); if (is_array(MY\Resource\Config::database())) { $this->auth = $this->phpauth(); $this->acl = $this->simpleacl(); } $this->view = $this->plates(); }
private function install($engine) { if ($engine == 'install') { return true; } $url = 'http' . (isset($_SERVER["HTTPS"]) && strtolower($_SERVER['HTTPS']) == 'on' ? 's://' : '://') . $_SERVER['HTTP_HOST']; if (!file_exists(INSTALL_PATH) || !is_dir(INSTALL_PATH)) { return false; } else { if (is_array(Config::database())) { return header('Location: ' . $url . '/install/index.php/exist-database', true, 302); } } switch ($engine) { case 'backend': $url .= $_SERVER['REQUEST_URI']; $split = explode('/', $url); $split = array_values(array_filter($split)); $split[0] .= '/'; $toUrl = $split; $getIndexFromValue = array_search(ADMIN_DIR, $split); for ($i = $getIndexFromValue; $i < count($split); $i++) { unset($toUrl[$i]); } $toUrl = implode('/', $toUrl); $toUrl .= '/' . __FUNCTION__; break; case 'frontend': $url .= $_SERVER['SCRIPT_NAME']; $toUrl = str_replace('index.php', __FUNCTION__, $url); break; default: $toUrl = 'http://www.hezqi.com/'; } return header('Location: ' . $toUrl, true, 302); }
public static function getInstance($type = 'default') { return new static(Resource\Config::database()[$type], false); }