Republishing of FIC2014 challenges

This commit is contained in:
nemunaire 2021-10-06 11:33:24 +02:00
commit c54f929846
24 changed files with 329 additions and 117 deletions

View file

@ -3,6 +3,10 @@
{if isset($ex)}
<h2>{$theme->name} <small>{$ex->id}</small></h2>
<form role="form" method="post" action="/{$SALT_ADMIN}/ex/{$theme->id}-{$theme->name}/{$ex->id}">
<div class="form-group">
<label for="title">Titre</label>
<input type="text" class="form-control" value="{$ex->title|escape}" name="title" id="title">
</div>
<div class="form-group">
<label for="desc">Description</label>
<textarea class="form-control" name="desc" id="desc">{$ex->statement|escape}</textarea>
@ -85,7 +89,7 @@
<p>
<ul>
{foreach from=$theme->get_exercices_ordered() item=ex}
<li><a href="/{$SALT_ADMIN}/ex/{$theme->id}-{$theme->name}/{$ex->id}">{$ex->get_name()}</a></li>
<li><a href="/{$SALT_ADMIN}/ex/{$theme->id}-{$theme->name}/{$ex->id}">{$ex->get_title()}</a></li>
{/foreach}
</ul>
</p>

View file

@ -4,7 +4,7 @@
{if $theme->get_exercices_ordered()}
{foreach from=$theme->get_exercices_ordered() item=e}
<exercice id="{$e->id}" level="{$e->level}"{if $e->require} depends="{$e->require}"{/if}>
<title>{$e->get_name()}</title>
<title>{$e->get_title()}</title>
<points>{$e->points}</points>
<statement>{$e->statement}</statement>
{if $e->keys}

View file

@ -1,29 +1,55 @@
{extends file="admin/layout.tpl"}
{block name=content}
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Certificat racine</h3>
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Certificat racine</h3>
</div>
<div class="panel-body">
{if isset($cert_CA)}
<ul>
{foreach from=$cert_CA.subject key=k item=crt}
<li><strong>[{$k}] :</strong> {$crt}</li>
{/foreach}
</ul>
<a href="/{$SALT_ADMIN}/certificate/deleteca" class="btn btn-danger"
onclick="return confirm('Êtes-vous sûr de vouloir supprimer ce certificat ?')">Supprimer</a>
{elseif empty($cert_writable)}
<div class="alert alert-danger"><span class="glyphicon glyphicon-warning-sign"></span> Répertoire non accessible en écriture.</div>
<a href="/{$SALT_ADMIN}/certificate/newca" class="btn btn-primary" disabled="disabled">Nouveau</a>
{else}
Pas de certificat
<a href="/{$SALT_ADMIN}/certificate/newca" class="btn btn-primary">Nouveau</a>
{/if}
</div>
</div>
</div>
<div class="panel-body">
{if isset($cert)}
<ul>
<li><strong>[C] :</strong> {$cert['subject']['C']}</li>
<li><strong>[ST] :</strong> {$cert['subject']['ST']}</li>
<li><strong>[O] :</strong> {$cert['subject']['O']}</li>
<li><strong>[OU] :</strong> {$cert['subject']['OU']}</li>
<li><strong>[CN] :</strong> {$cert['subject']['CN']}</li>
<li><strong>[emailAddress] :</strong> {$cert['subject']['emailAddress']}</li>
</ul>
<!--<a href="/{$SALT_ADMIN}/certificate/deleteca" class="btn btn-danger"
onclick="return confirm('Êtes-vous sûr de vouloir supprimer ce certificat ?')">Supprimer</a>-->
{elseif isset($cert_writable) && ! $cert_writable}
<div class="alert alert-danger"><span class="glyphicon glyphicon-warning-sign"></span> Répertoire non accessible en écriture.</div>
<!--<a href="/{$SALT_ADMIN}/certificate/newca" class="btn btn-primary" disabled="disabled">Nouveau</a>-->
{else}
Pas de certificat
<!--<a href="/{$SALT_ADMIN}/certificate/newca" class="btn btn-primary">Nouveau</a>-->
{/if}
<div class="col-md-6">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Certificat serveur</h3>
</div>
<div class="panel-body">
{if isset($cert_srv)}
<ul>
{foreach from=$cert_srv.subject key=k item=crt}
<li><strong>[{$k}] :</strong> {$crt}</li>
{/foreach}
</ul>
<a href="/{$SALT_ADMIN}/certificate/revokesrv" class="btn btn-danger"
onclick="return confirm('Êtes-vous sûr de vouloir supprimer ce certificat ?')">Supprimer</a>
{elseif empty($cert_writable)}
<div class="alert alert-danger"><span class="glyphicon glyphicon-warning-sign"></span> Répertoire non accessible en écriture.</div>
<a href="/{$SALT_ADMIN}/certificate/newsrv" class="btn btn-primary" disabled="disabled">Nouveau</a>
{else}
Pas de certificat
<a href="/{$SALT_ADMIN}/certificate/newsrv" class="btn btn-primary">Nouveau</a>
{/if}
</div>
</div>
</div>
</div>
@ -36,7 +62,7 @@
<div class="form-group">
<label class="sr-only" for="time">Temps :</label>
<div class="input-group">
<input type="input" class="form-control" id="time" name="time" value="240">
<input type="input" class="form-control" id="time" name="time" value="{$DEF_TIME|default:240}">
<span class="input-group-addon">minutes</span>
</div>
</div>
@ -47,4 +73,90 @@
</form>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Génération</h3>
</div>
<div class="panel-body container">
<div class="col-xs-4">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>File d'attente</th>
</tr>
</thead>
<tbody id="genst">
<tr>
<td>Pending...</td>
</tr>
</tbody>
</table>
</div>
<pre class="col-xs-4" id="logs"></pre>
<div class="col-xs-4">
<a href="/{$SALT_ADMIN}/generation/full" onclick="call_gen('full'); return false" class="btn btn-default">Complet</a>
<a href="/{$SALT_ADMIN}/generation/home" onclick="call_gen('home'); return false" class="btn btn-default">Accueil</a>
<a href="/{$SALT_ADMIN}/generation/errors" onclick="call_gen('errors'); return false" class="btn btn-danger">Pages d'erreurs</a><br><br>
<a href="/{$SALT_ADMIN}/generation/sync" onclick="call_gen('sync'); return false" class="btn btn-info">Synchro légère</a>
<a href="/{$SALT_ADMIN}/generation/clear" onclick="call_gen('clear'); return false" class="btn btn-warning">Vider la file d'attente</a><br><br>
<a href="/{$SALT_ADMIN}/generation/freeze" onclick="call_gen('freeze'); return false" class="btn btn-danger">Freeze</a>
<a href="/{$SALT_ADMIN}/generation/unfreeze" onclick="call_gen('unfreeze'); return false" class="btn btn-success">Unfreeze</a><br><br>
<form method="post" action="/{$SALT_ADMIN}/generation/team" onsubmit="call_gen('team'); return false" role="form" class="form-inline">
<div class="form-group">
<input type="input" class="form-control" id="regenteam" name="team" placeholder="Team to regen">
<button type="submit" class="btn btn-primary">Regénérer</button>
</div>
</form><br>
<form method="post" action="/{$SALT_ADMIN}/generation/custom" onsubmit="call_gen('custom'); return false" role="form" class="form-inline">
<div class="form-group">
<input type="input" class="form-control" id="cmds" name="cmds" placeholder="Custom commands, : separated">
<button type="submit" class="btn btn-warning">Envoyer</button>
</div>
</form>
</div>
</div>
</div>
{/block}
{block name=end2}
<script type="text/javascript">
function call_gen(which) {
if (which == "team") datas = { 'team': $('#regenteam').val() }
else if (which == "custom") datas = { 'cmds': $('#cmds').val() }
else datas = { }
$.ajax({
type: 'POST',
data: datas,
url: './generation/' + which,
success: function(data){
$('#logs').html($(data).find('logs').text());
},
error: function() {
$('#logs').html('Oops! an error occurs during command execution');
}
});
}
function refresh_state() {
$.ajax({
type: 'GET',
url: './generation',
success: function(data){
$('#genst').empty();
$(data).find('item').each(function(i){
if (i == 0 && $(this).text() == "empty!")
color = "warning";
else if (i == 0)
color = "success";
else
color = "";
$('#genst').append('<tr><td class="' + color + '">' + $(this).text() + '</td></tr>') })
},
error: function() {
$('#genst').html('<tr><td class="danger">Oops! an error occurs during status refresh</td></tr>');
}
});
};
setInterval(refresh_state, 1000);
</script>
{/block}

View file

@ -11,8 +11,12 @@
<button type="submit" class="btn btn-primary">Importer</button>
</form>
{if isset($pass)}
<h2>Pass</h2>
<pre>{$pass|escape}</pre>
{/if}
{if isset($output)}
<h2>Output</h2>
<pre>{$output}</pre>
<pre>{$output|escape}</pre>
{/if}
{/block}

View file

@ -9,13 +9,14 @@
{/block}
{block name=end}
<script src="/js/countdown.js"></script>
<script src="{$SALT_CDN}/js/countdown.js"></script>
<script type="text/javascript">
{if isset($END)}
var end_challenge = new Date({$END * 1000});
{/if}
update_end();
</script>
{block name=end2}{/block}
{/block}
{block name=body}
@ -39,7 +40,7 @@
{link href_prefix="/{$SALT_ADMIN}/" href="ex/{$t->get_id()}-{$t->get_name()}" class="dropdown-toggle" data-toggle="dropdown" label="{$t->get_name()} <b class=\"caret\"></b>"}
<ul class="dropdown-menu">
{foreach from=$t->get_exercices_ordered() item=e}
<li>{link href_prefix="/{$SALT_ADMIN}/" href="ex/{$t->get_id()}-{$t->get_name()}/{$e->get_id()}" label="{$e->get_name()}"}</li>
<li>{link href_prefix="/{$SALT_ADMIN}/" href="ex/{$t->get_id()}-{$t->get_name()}/{$e->get_id()}" label="{$e->get_title(true)}"}</li>
{/foreach}
</ul>
</li>

View file

@ -22,7 +22,7 @@
<td><a href="/{$SALT_ADMIN}/ex/{$t->id}-{$t->name}">{$t->name}</a></td>
<td><ul>
{foreach from=$t->get_exercices_ordered() item=e}
<li><a href="/{$SALT_ADMIN}/ex/{$t->id}-{$t->name}/{$e->id}">{$e->get_name()}</a></li>
<li><a href="/{$SALT_ADMIN}/ex/{$t->id}-{$t->name}/{$e->id}">{$e->get_title()}</a></li>
{/foreach}
</ul></td>
<td>

View file

@ -23,7 +23,7 @@
<span class="glyphicon glyphicon-trash"></span></a>
<a href="/{$SALT_ADMIN}/certificate/get?name={$t->team_name}">
<span class="glyphicon glyphicon-floppy-save"></span></a>
{if not $t->revoked}
{if not $t->revoked && is_file("{$MISC_DIR}/PKI/pkcs/{$t->team_name}.p12")}
<a href="/{$SALT_ADMIN}/certificate/revoke?name={$t->team_name}"
onclick="return confirm('Êtes-vous sûr de vouloir révoquer ce certificat ?')">
<span class="glyphicon glyphicon-remove"></span></a>