/** * @param array $config * @param string $basepath = dirname(__FILE__) * $basepath is the GWF_WWW_PATH without trailing slash * @return GWF3 */ public function __construct($basepath = NULL, array $config = array()) { self::$CONFIG = $config = array_merge(self::$CONFIG, $config); # Set session_name to something we might clean up ourselves from time to time. # We don't use php sessions(yet), but 3rd party might use it, and we can even cleanup. session_name(GWF_SESS_NAME); # Bootstrap if (true === $config['bootstrap']) { GWF_Bootstrap::init(); } # Windows patch // if (GWF_ServerInfo::isWindows()) // { // $basepath = str_replace('\\', '/', $basepath); // } # Important definements... $basepath = $basepath === NULL ? GWF_PATH . 'www' : $basepath; Common::defineConst('GWF_WWW_PATH', $basepath . '/'); Common::defineConst('GWF_PROTECTED_PATH', GWF_WWW_PATH . 'protected/'); Common::defineConst('GWF_CONFIG_PATH', GWF_PROTECTED_PATH . 'config.php'); Common::defineConst('GWF_LOGGING_PATH', GWF_PROTECTED_PATH . 'logs'); # Load config if (true === $config['load_config']) { $this->onLoadConfig(GWF_CONFIG_PATH); } # WebSite is down? if (true === defined('GWF_WORKER_IP')) { if (GWF_WORKER_IP !== (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '')) { die(GWF_SITENAME . ' is down for maintainance.<br/>' . GWF_DOWN_REASON); } else { GWF_Website::addDefaultOutput('<p style="color: #ff0000">Welcome back Admin! GWF_WORKER_IP is activated</p>'); } } # Set valid mo/me $_GET['mo'] = Common::getGetString('mo', GWF_DEFAULT_MODULE); $_GET['me'] = Common::getGetString('me', GWF_DEFAULT_METHOD); # Setting the Design... TODO... self::setDesign(Common::getConst('GWF_DEFAULT_DESIGN', 'default')); # abort script execution on user disconnect? ignore_user_abort($config['ignore_user_abort']); # define GWF_WEB_ROOT self::onDefineWebRoot(); # Init the config? if (true === $config['init']) { $this->init(); } // return $this; }