Unverified Commit 472c8d94 authored by David Beniamine's avatar David Beniamine
Browse files

Rewrite

parent 6b145a2c
......@@ -186,15 +186,19 @@ if(!isset($action)){
<?php
}else{
$lines = array();
$run=false;
$emptymsg="<p>Not implemented yet</p><p>Cette action n'affiche pas de message.<br />Vous pouvez demander les logs depuis <a href='/wol/'>la page principale<a></p>";
if(!isset($name)){
$name="";
}
echo "<h2> Action demandée : $action $name</h2>";
switch($action){
case "wake" :
$allowedActions = [
'upgradeAll',
'upgradeAllApt',
'getLogAll',
'upgradeApt',
'upgrade',
'getLog',
];
if($action == "wake"){
echo "<div id='result'><p>Démarrage demandé pour la machine $mac, veuillez patienter</p></div>";
?>
<script language="javascript">
......@@ -225,41 +229,25 @@ if(!isset($action)){
sendpost(24);
</script>
<?php
break;
case "upgradeAllApt" :
$run=true;
break;
case "upgradeAll" :
echo "Todo see log";
$run=true;
break;
case "getLogAll" :
$emptymsg="<p>Pas de log globaux disponibles</p>";
$run=true;
break;
case "upgradeAPT" :
$run=true;
break;
case "upgrade" :
$run=true;
break;
case "getLog" :
$emptymsg="<p>Pas de log disponibles pour $name</p>";
$run=true;
break;
}
if($run){
exec("../scripts/actions.sh .".escapeshellarg($action)." "
.escapeshellarg($name), $lines, $code);
echo "<p>Action effectuée, code : $code</p>";
if(!empty($lines)){
echo "<pre>";
foreach($lines as $line){
echo "$line\n";
}else{
if(in_array($action, $allowedActions)){
$lines = array();
exec("../scripts/actions.sh .".escapeshellarg($action)." "
.escapeshellarg($name), $lines, $code);
echo "<p>Action effectuée, code : $code</p>";
if(!empty($lines)){
echo "<pre>";
foreach($lines as $line){
echo "$line\n";
}
echo "</pre>";
}else{
if(preg_match('/^getLog/', $action)){
echo "<p>Pas de log globaux disponibles</p>";
}else{
echo "<p>Not implemented yet</p><p>Cette action n'affiche pas de message.<br />Vous pouvez demander les logs depuis <a href='/wol/'>la page principale<a></p>";
}
}
echo "</pre>";
}else{
echo $emptymsg;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment