Example #1
0
 // write out hints
 if (cache_start(CONST_CACHE_NAME_CHALLENGE_HINTS . $challenge['id'], CONFIG_CACHE_TIME_HINTS)) {
     $hints = db_select_all('hints', array('body'), array('visible' => 1, 'challenge' => $challenge['id']));
     foreach ($hints as $hint) {
         message_inline_yellow('<strong>Hint!</strong> ' . $bbc->parse($hint['body']), false);
     }
     cache_end(CONST_CACHE_NAME_CHALLENGE_HINTS . $challenge['id']);
 }
 // write out files
 $files = cache_array_get(CONST_CACHE_NAME_FILES . $challenge['id'], CONFIG_CACHE_TIME_FILES);
 if (!is_array($files)) {
     $files = db_select_all('files', array('id', 'title', 'size', 'md5', 'download_key'), array('challenge' => $challenge['id']));
     cache_array_save($files, CONST_CACHE_NAME_FILES . $challenge['id']);
 }
 if (count($files)) {
     print_attachments($files);
 }
 // only show the hints and flag submission form if we're not already correct and if the challenge hasn't expired
 if (!$challenge['correct_submission_added'] && $time < $challenge['available_until']) {
     if ($remaining_submissions) {
         if ($challenge['num_submissions'] && !$challenge['automark'] && $challenge['marked']) {
             message_inline_blue('Your submission is awaiting manual marking.');
         }
         echo '
         <div class="challenge-submit">
             <form method="post" class="form-flag" action="actions/challenges">
                 <textarea name="flag" type="text" class="flag-input form-control" placeholder="Please enter flag for challenge: ', htmlspecialchars($challenge['title']), '"></textarea>
                 <input type="hidden" name="challenge" value="', htmlspecialchars($challenge['id']), '" />
                 <input type="hidden" name="action" value="submit_flag" />';
         form_xsrf_token();
         if (CONFIG_RECAPTCHA_ENABLE_PRIVATE) {
Example #2
0
             }
         }
     }
     cache_end('hints_challenge_' . $challenge['id']);
 }
 if ($remaining_submissions) {
     if ($challenge['num_submissions'] && !$challenge['automark'] && $challenge['marked']) {
         message_inline_blue('Your submission is awaiting manual marking.');
     }
     // write out files
     if (cache_start('files_' . $challenge['id'], CONFIG_CACHE_TIME_FILES)) {
         $files = db_select_all('files', array('id', 'title', 'size'), array('challenge' => $challenge['id']));
         $filesDuplicate = db_select_all('files', array('id', 'title', 'size'), array('challenge' => $challenge['cloneOf']));
         if (count($files) || count($filesDuplicate)) {
             print_attachments($files);
             print_attachments($filesDuplicate);
         }
         cache_end('files_' . $challenge['id']);
     }
     echo '
     <div class="challenge-submit">
         <form method="post" class="form-flag" action="actions/challenges">
             <textarea name="flag" type="text" class="flag-input form-control" placeholder="Please enter flag for challenge: ', htmlspecialchars($challenge['title']), '"></textarea>
             <input type="hidden" name="challenge" value="', htmlspecialchars($challenge['id']), '" />
             <input type="hidden" name="action" value="submit_flag" />';
     form_xsrf_token();
     if (CONFIG_RECAPTCHA_ENABLE_PRIVATE) {
         display_captcha();
     }
     echo '<button class="btn btn-sm btn-primary" type="submit" data-countdown="', max($challenge['latest_submission_added'] + $challenge['min_seconds_between_submissions'], 0), '" data-countdown-done="Submit flag">Submit flag</button>';
     if (should_print_metadata($challenge)) {