public function editCategoryNotVisibleTime(AcceptanceTester $I)
 {
     $I->logInAsAnAdmin();
     $I->amOnEditCategory(CI_EDITABLE_CATEGORY_ID);
     $title = time() . 'title';
     $I->fillField('title', $title);
     $I->checkOption('#exposed');
     $from = date_time(time() - 10000);
     $until = date_time(time() - 100);
     $I->fillField('available_from', $from);
     $I->fillField('available_until', $until);
     $I->click('Save changes');
     $I->waitForText('Edit category');
     $I->seeCheckboxIsChecked('#exposed');
     $I->seeInField('available_from', $from);
     $I->seeInField('available_until', $until);
     $I->amOnPage('/challenges');
     $I->see($title);
     $I->amOnPage('/challenges?category=' . to_permalink($title));
     $I->see('Category unavailable');
     $I->see('This category is not available. It is open from ' . $from);
     $I->see('until ' . $until);
     $I->amOnAdminHome();
     $I->see($title);
 }
Exemple #2
0
 public function submitCorrect(AcceptanceTester $I)
 {
     $I->logInAsANormalUser();
     $I->amOnPage('/challenges?category=' . to_permalink(CI_DEFAULT_CATEGORY_TITLE));
     $I->see(CI_DEFAULT_CHALLENGE_TITLE);
     $I->see(CI_DEFAULT_CHALLENGE_DESCRIPTION);
     $flag_field = '#flag-input-' . CI_DEFAULT_CHALLENGE_ID;
     $I->fillField($flag_field, CI_DEFAULT_CHALLENGE_FLAG);
     $I->click('#flag-submit-' . CI_DEFAULT_CHALLENGE_ID);
     $I->seeInCurrentUrl('status=correct');
     $I->dontSeeElement($flag_field);
 }
Exemple #3
0
 public function test_permalink()
 {
     $string = ' This Is A permalink!!  &&?? ## alright!';
     $expected = 'this-is-a-permalink-alright';
     $this->assertEquals(to_permalink($string), $expected);
 }
Exemple #4
0
        $current_category = $categories[0];
    }
}
if (empty($current_category)) {
    message_generic('Challenges', 'Your CTF is looking a bit empty! Start by adding a category using the management console.');
}
// write out our categories menu
echo '<div id="categories-menu">
<ul id="categories-menu">';
foreach ($categories as $cat) {
    if ($time < $cat['available_from'] || $time > $cat['available_until']) {
        echo '<li class="disabled">
        <a data-container="body" data-toggle="tooltip" data-placement="top" class="has-tooltip" title="Available in ' . time_remaining($cat['available_from']) . '.">', htmlspecialchars($cat['title']), '</a>
        </li>';
    } else {
        echo '<li ', $current_category['id'] == $cat['id'] ? ' class="active"' : '', '><a href="', CONFIG_SITE_URL, 'challenges?category=', htmlspecialchars(to_permalink($cat['title'])), '">', htmlspecialchars($cat['title']), '</a></li>';
    }
}
echo '</ul>
</div>';
// check that the category is actually available for display
if ($time < $current_category['available_from'] || $time > $current_category['available_until']) {
    message_generic('Category unavailable', 'This category is not available. It is open from ' . date_time($current_category['available_from']) . ' (' . time_remaining($current_category['available_from']) . ' from now) until ' . date_time($current_category['available_until']) . ' (' . time_remaining($current_category['available_until']) . ' from now)', false);
}
// write out the category description, if one exists
if ($current_category['description']) {
    echo '<div id="category-description">', $bbc->parse($current_category['description']), '</div>';
}
// get all the challenges for the selected category
$challenges = db_query_fetch_all('
    SELECT