コード例 #1
0
ファイル: gwf3.class.php プロジェクト: sinfocol/gwf3
 /**
  * Load the $_GET['mo'] or GWF_DEFAULT_MODULE and execute it
  * @return GWF3 
  */
 public function onLoadModule()
 {
     # Load the module
     $db = gdo_db();
     if (false === (self::$MODULE = GWF_Module::loadModuleDB($_GET['mo']))) {
         if (false === (self::$MODULE = GWF_Module::loadModuleDB(GWF_DEFAULT_MODULE))) {
             self::logDie('No module found.');
         }
         $_GET['me'] = GWF_DEFAULT_METHOD;
     }
     # Module is enabled?
     if (true === self::$MODULE->isEnabled()) {
         # Execute the method
         self::$MODULE->onInclude();
         self::$MODULE->onLoadLanguage();
         $db = gdo_db();
         $db->transactionStart();
         self::$page = self::$MODULE->execute($_GET['me']);
         if (true === isset($_GET['ajax'])) {
             self::$page = GWF_Website::getDefaultOutput() . self::$page;
         }
     } else {
         # TODO: HTTP Response code (by GWF_Exception(?))
         self::$page = GWF_HTML::err('ERR_MODULE_DISABLED', array(self::$MODULE->display('module_name')));
     }
     return $this;
 }
コード例 #2
0
ファイル: index.php プロジェクト: sinfocol/gwf3
define('GWF_PAGE_TITLE', 'Time to Reset II');
require_once 'challenge/html_head.php';
# output start of website
require_once GWF_CORE_PATH . 'module/WeChall/solutionbox.php';
# Get the challenge
if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) {
    $chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 7, 'challenge/time_to_reset2/index.php', false);
}
require_once 'challenge/time_to_reset2/TTR2_Form.include';
require_once 'challenge/time_to_reset2/TTR2_Tokens.include';
# And display the header
$chall->showHeader();
if (isset($_POST['solve'])) {
    ttr2_submit($chall);
}
echo GWF_Website::getDefaultOutput();
$noother = sprintf('<a href="/profile/noother">noother</a>');
echo GWF_Box::box($chall->lang('info', array($noother, 'reset.php', 'index.php?show=source', 'index.php?highlight=christmas')), $chall->lang('title'));
if (Common::getGetString('highlight') === 'christmas') {
    $source = '[PHP title=reset.php]' . trim(file_get_contents('challenge/time_to_reset2/reset.php')) . '[/PHP]';
    echo GWF_Box::box(GWF_BBCode::decode($source));
}
formSolutionbox($chall);
# Print Challenge Footer
echo $chall->copyrightFooter();
# Print end of website
require_once 'challenge/html_foot.php';
function ttr2_submit(WC_Challenge $chall)
{
    if ('' === ($answer = Common::getPostString('answer', ''))) {
        return;