Exemplo n.º 1
0
        message_dialog('Congratulations! You got the flag!', 'Correct flag', 'Yay!', 'challenge-attempt correct on-page-load');
    } else {
        if ($_GET['status'] == 'incorrect') {
            message_dialog('Sorry! That wasn\'t correct', 'Incorrect flag', 'Ok', 'challenge-attempt incorrect on-page-load');
        } else {
            if ($_GET['status'] == 'manual') {
                message_inline_blue('<h1>Your submission is awaiting manual marking.</h1>', false);
            }
        }
    }
}
$categories = db_select_all('categories', array('id', 'title', 'description', 'available_from', 'available_until'), array('exposed' => 1), 'title ASC');
// determine which category to display
if (isset($_GET['category'])) {
    validate_id($_GET['category']);
    $current_category = array_search_matching_key($_GET['category'], $categories, 'id');
    if (!$current_category) {
        message_error(lang_get('no_category_for_id'), false);
    }
} else {
    // if no category is selected, display
    // the first available category
    foreach ($categories as $cat) {
        if ($time > $cat['available_from'] && $time < $cat['available_until']) {
            $current_category = $cat;
            break;
        }
    }
    // if no category has been made available
    // we'll just set it to the first one
    // alphabetically and display an error
Exemplo n.º 2
0
        if ($_GET['status'] == 'incorrect') {
            message_dialog('Sorry! That wasn\'t correct', 'Incorrect flag', 'Ok', 'challenge-attempt incorrect on-page-load');
        } else {
            if ($_GET['status'] == 'manual') {
                message_inline_blue('<h1>Your submission is awaiting manual marking.</h1>', false);
            }
        }
    }
}
$categories = db_select_all('categories', array('id', 'title', 'description', 'available_from', 'available_until'), array('exposed' => 1), 'title ASC');
// determine which category to display
if (isset($_GET['category'])) {
    if (is_valid_id($_GET['category'])) {
        $current_category = array_search_matching_key($_GET['category'], $categories, 'id');
    } else {
        $current_category = array_search_matching_key($_GET['category'], $categories, 'title', 'to_permalink');
    }
    if (!$current_category) {
        redirect('challenges');
    }
} else {
    // if no category is selected, display
    // the first available category
    foreach ($categories as $cat) {
        if ($time > $cat['available_from'] && $time < $cat['available_until']) {
            $current_category = $cat;
            break;
        }
    }
    // if no category has been made available
    // we'll just set it to the first one