Subversion Repositories ALCASAR

Rev

Rev 2934 | Rev 2991 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2934 Rev 2935
Line 147... Line 147...
147
	}
147
	}
148
}
148
}
149
fclose($file_conf);
149
fclose($file_conf);
150
$wifi4eu = $conf['WIFI4EU'];
150
$wifi4eu = $conf['WIFI4EU'];
151
$wifi4eu_code = $conf['WIFI4EU_CODE'];
151
$wifi4eu_code = $conf['WIFI4EU_CODE'];
152
 
-
 
153
// Doing an action on a service (start,stop or restart)
152
// Doing an action on a service (start,stop or restart)
154
function serviceExec($service, $action){
153
function serviceExec($service, $action){
155
	if (($action == "start")||($action == "stop")||($action == "restart")){
154
	if (($action == "start")||($action == "stop")||($action == "restart")){
156
		exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus);
155
		exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus);
157
		if ($service == "sshd"){ 
156
		if ($service == "sshd"){ 
Line 189... Line 188...
189
// WIFI4EU
188
// WIFI4EU
190
//-------------------------------
189
//-------------------------------
191
if (isset($_POST['wifi4eu'])){
190
if (isset($_POST['wifi4eu'])){
192
	switch ($_POST['wifi4eu']){
191
	switch ($_POST['wifi4eu']){
193
		case 'on' :
192
		case 'on' :
-
 
193
			$network_code = trim($_POST['wifi4eu_id']);
-
 
194
		        if ($network_code == '') {
-
 
195
				$network_code = '123e4567-e89b-12d3-a456-426655440000'; // WIFI4EU test code
-
 
196
			}
194
			file_put_contents(CONF_FILE, preg_replace('/WIFI4EU_CODE=.*/', 'WIFI4EU_CODE='.trim($_POST['wifi4eu_code']), file_get_contents(CONF_FILE)));
197
			file_put_contents(CONF_FILE, preg_replace('/WIFI4EU_CODE=.*/', 'WIFI4EU_CODE='.$network_code, file_get_contents(CONF_FILE)));
195
			exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on");
198
			exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on");
196
		break;
199
		break;
197
		case 'off' :
200
		case 'off' :
198
			exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -off");
201
			exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -off");
199
		break;
202
		break;
Line 333... Line 336...
333
			<td width="80" align="center">---</td>
336
			<td width="80" align="center">---</td>
334
			<td width="80" align="center"><input type=submit value="<?echo $l_service_stop;?>"><input type=hidden name="wifi4eu" value="off"></td>
337
			<td width="80" align="center"><input type=submit value="<?echo $l_service_stop;?>"><input type=hidden name="wifi4eu" value="off"></td>
335
			<td width="80" align="center">---</td>
338
			<td width="80" align="center">---</td>
336
			<?php } else { ?>
339
			<?php } else { ?>
337
			<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko; ?>"></td>
340
			<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko; ?>"></td>
338
			<td align="center">WIFI4EU</td><td><?php echo $l_wifi4eu_id; ?> : <input type ="text" name="wifi4eu_code" value="<?php echo $wifi4eu_code; ?>" size="40"></td>
341
			<td align="center">WIFI4EU</td><td><?php echo $l_wifi4eu_id; ?> : <input type ="text" name="wifi4eu_id" value="<?php echo $wifi4eu_code; ?>" size="40"></td>
339
			<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"><input type=hidden name="wifi4eu" value="on"></td>
342
			<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"><input type=hidden name="wifi4eu" value="on"></td>
340
			<td width="80" align="center">---</td>
343
			<td width="80" align="center">---</td>
341
			<td width="80" align="center">---</td>
344
			<td width="80" align="center">---</td>
342
			<?php } ?>
345
			<?php } ?>
343
		</tr>
346
		</tr>