Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2930 → Rev 2931

/web/acc/admin/services.php
155,19 → 155,18
if (($action == "start")||($action == "stop")||($action == "restart")){
if ($service != "wifi4eu") { exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus); }
if ($service == "wifi4eu"){
if ($action == "stop"){
file_put_contents(CONF_FILE, str_replace('WIFI4EU=on', 'WIFI4EU=off', file_get_contents(CONF_FILE)));
// exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -off");
if ($action == "stop"){ // see POST fonction (below) to start this service
exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -off");
}
}
if ($service == "sshd"){
if ($action == "start"){
exec("sudo /usr/bin/systemctl enable ".escapeshellarg($service)); // in order to keep that conf for SSH at next reboot
file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE)));
//exec("sudo /usr/bin/systemctl enable ".escapeshellarg($service));
file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE))); // in order to keep that conf for SSH at next reboot
exec("sudo /usr/local/bin/alcasar-iptables.sh");
}
if ($action == "stop"){
exec("sudo /usr/bin/systemctl disable ".escapeshellarg($service)); // in order to keep that conf for SSH at next reboot
//exec("sudo /usr/bin/systemctl disable ".escapeshellarg($service));
file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE)));
exec("sudo /usr/local/bin/alcasar-iptables.sh");
}
207,9 → 206,9
// WIFI4EU
//-------------------------------
if (isset($_POST['wifi4eu'])){
file_put_contents(CONF_FILE, str_replace('WIFI4EU=off', 'WIFI4EU=on', file_get_contents(CONF_FILE)));
// file_put_contents(CONF_FILE, preg_replace('^WIFI4EU_CODE=*', 'WIFI4EU_code=$_POST[\'wifi4eu\']', file_get_contents(CONF_FILE)));
// exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on");
//file_put_contents(CONF_FILE, preg_replace('/^WIFI4EU_CODE=*/', 'WIFI4EU_CODE='.$_POST['wifi4eu'], file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, preg_replace('/^WIFI4EU_CODE=.*/', 'WIFI4EU_CODE=REXY', file_get_contents(CONF_FILE)));
exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on");
}
//-------------------------------
// Actions on system