public function __construct($basepath = NULL, array $config = array()) { self::init($basepath); self::onDefineWebRoot(); GWF_Language::initEnglish(); GWF_Website::init(false); }
<?php header('Content-Type: text/plain'); chdir('../../../../'); define('GWF_PAGE_TITLE', 'The Travelling Customer'); require_once 'challenge/gwf_include.php'; GWF_Website::init(getcwd()); require_once 'challenge/training/programming/knapsaak/salesman.php'; $wechall = GWF_Module::loadModuleDB('WeChall', true, true); if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) { $chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 4, 'challenge/training/programming/knapsaak/index.php'); } echo salesman_on_submit_answer($chall); //GWF_Session::commit();
/** * Initialize by ConfigOptions * @return GWF3 */ public function init() { $config =& self::$CONFIG; if (true === $config['start_debug']) { GWF_Debug::enableErrorHandler(); GWF_Debug::setMailOnError((GWF_DEBUG_EMAIL & 2) > 0); } if (true === $config['kick_banned_ip']) { $this->onKickBannedIP(); } if (true === defined('GWF_WEBSITE_DOWN')) { $this->setConfig('load_module', false); $this->setConfig('autoload_modules', false); $this->setConfig('no_session', true); } // $db = gdo_db(); if (false === $config['no_session']) { $this->onStartSession($config['blocking']); } if (true === $config['website_init']) { $db = gdo_db(); GWF_Website::init(); } if (true === $config['do_logging']) { $this->onStartLogging($config['no_session']); } if (true === $config['autoload_modules']) { $this->onAutoloadModules(); } if (true === $config['get_user']) { GWF_Template::addMainTvars(array('user' => self::$user = GWF_User::getStaticOrGuest())); } if (true === $config['load_module']) { $this->onLoadModule(); } if (true === defined('GWF_WEBSITE_DOWN')) { die($this->onDisplayPage(GWF_WEBSITE_DOWN)); } return $this; }