Ejemplo n.º 1
0
function print_attachments($files)
{
    echo '<div class="challenge-files">';
    foreach ($files as $file) {
        echo '
        <p>
            <span class="glyphicon glyphicon-paperclip"></span>
            <span class="challenge-attachment">
            <a class="has-tooltip" data-toggle="tooltip" data-placement="right" title="', bytes_to_pretty_size($file['size']), '" href="download?id=', htmlspecialchars($file['id']), '">', htmlspecialchars($file['title']), '</a>
            </span>
        <p>
        ';
    }
    echo '</p></div> <!-- / challenge-files -->';
}
Ejemplo n.º 2
0
function print_attachments($files)
{
    echo '<div class="challenge-files">';
    foreach ($files as $file) {
        echo '
        <p>
            <div>
            <span class="glyphicon glyphicon-floppy-save"></span>
            <span class="challenge-attachment">
            <a class="has-tooltip" data-toggle="tooltip" data-placement="right" title="', bytes_to_pretty_size($file['size']), '" href="download?id=', htmlspecialchars($file['id']), '">', htmlspecialchars($file['title']), '</a>
            ', $file['md5'] ? '<span class="has-tooltip" data-toggle="tooltip" data-placement="right" title="MD5 file hash"><pre class="inline-pre">' . $file['md5'] . '</pre></span>' : '', '
            </span>
            </div>
        <p>
        ';
    }
    echo '</p></div> <!-- / challenge-files -->';
}
Ejemplo n.º 3
0
    form_end();
    echo '
          </td>
      </tr>
  ';
}
echo '
      </tbody>
   </table>
';
form_start(CONFIG_SITE_ADMIN_RELPATH . 'actions/edit_challenge', '', 'multipart/form-data');
form_file('file');
form_hidden('action', 'upload_file');
form_hidden('id', $_GET['id']);
form_button_submit('Upload file');
echo 'Max file size: ', bytes_to_pretty_size(max_file_upload_size());
form_end();
section_subhead('Hints');
echo '
<table id="hints" class="table table-striped table-hover">
<thead>
  <tr>
    <th>Added</th>
    <th>Hint</th>
    <th>Manage</th>
  </tr>
</thead>
<tbody>
';
$hints = db_select_all('hints', array('id', 'added', 'body'), array('challenge' => $_GET['id']));
foreach ($hints as $hint) {
Ejemplo n.º 4
0
        <div class="challenge-description">
            ', $bbc->parse($challenge['description']), '
        </div> <!-- / challenge-description -->';
    }
    // 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']));
        if (count($files)) {
            echo '

            <div class="challenge-files">
                <h6>Provided files</h6>
                <ul>
            ';
            foreach ($files as $file) {
                echo '      <li><a href="download?id=', htmlspecialchars($file['id']), '">', htmlspecialchars($file['title']), '</a> (', bytes_to_pretty_size($file['size']), ')</li>';
            }
            echo '
                </ul>
            </div> <!-- / challenge-files -->';
        }
        cache_end('files_' . $challenge['id']);
    }
    // only show the hints and flag submission form if we're
    // not already correct and if the challenge hasn't expired
    if (!$challenge['correct'] && $time < $challenge['available_until']) {
        // write out hints
        if (cache_start('hints_challenge_' . $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);