Subversion Repositories ALCASAR

Rev

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

Rev 1827 Rev 1848
Line 14... Line 14...
14
if (!file_exists($file)){
14
if (!file_exists($file)){
15
	exit("Requested file ".$file." isn't present");}
15
	exit("Requested file ".$file." isn't present");}
16
if (!is_readable($file)){
16
if (!is_readable($file)){
17
	exit("Can't read the file ".$file);}
17
	exit("Can't read the file ".$file);}
18
}
18
}
19
 
-
 
20
 
-
 
21
# Choice of language
19
# Choice of language
22
$Language = 'en';
20
$Language = 'en';
23
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
21
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
24
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
22
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
25
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
23
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
Line 169... Line 167...
169
	}
167
	}
170
}
168
}
171
/***********************************
169
/***********************************
172
* 	Update ALCASAR_CONF_FILE   *
170
* 	Update ALCASAR_CONF_FILE   *
173
***********************************/
171
***********************************/
174
 
-
 
175
/*******************************************
172
/*******************************************
176
*	Read ALCASAR_CONF_FILE Before     *
173
*	Read ALCASAR_CONF_FILE Before     *
177
********************************************/
174
********************************************/
178
$ouvre=fopen(CONF_FILE,"r");
175
$ouvre=fopen(CONF_FILE,"r");
179
if ($ouvre){
176
if ($ouvre){
Line 186... Line 183...
186
		}
183
		}
187
	}
184
	}
188
	fclose($ouvre);
185
	fclose($ouvre);
189
}
186
}
190
	
187
	
191
		
-
 
192
if(isset($_POST['dns1']) && preg_match($reg_ip,$_POST['dns1']))
188
if(isset($_POST['dns1']) && preg_match($reg_ip,$_POST['dns1']))
193
{
189
{
194
	file_put_contents(CONF_FILE, str_replace('DNS1='.$conf['DNS1'],'DNS1='.$_POST['dns1']."\n",file_get_contents(CONF_FILE)));
190
	file_put_contents(CONF_FILE, str_replace('DNS1='.$conf['DNS1'],'DNS1='.$_POST['dns1']."\n",file_get_contents(CONF_FILE)));
195
	$network_modification=1;
191
	$network_modification=1;
196
}
192
}
Line 218... Line 214...
218
	$network_modification=1;
214
	$network_modification=1;
219
}
215
}
220
if($network_modification)
216
if($network_modification)
221
{
217
{
222
	exec("sudo /usr/local/bin/alcasar-conf.sh -apply");
218
	exec("sudo /usr/local/bin/alcasar-conf.sh -apply");
223
	
-
 
224
}
219
}
225
 
220
 
226
 
-
 
227
 
-
 
228
 
-
 
229
/*******************************************
221
/*******************************************
230
*	Read ALCASAR_CONF_FILE Updated     *
222
*	Read ALCASAR_CONF_FILE Updated     *
231
********************************************/
223
********************************************/
232
$ouvre=fopen(CONF_FILE,"r");
224
$ouvre=fopen(CONF_FILE,"r");
233
if ($ouvre){
225
if ($ouvre){
Line 239... Line 231...
239
			$conf[$tmp[0]] = $tmp[1];
231
			$conf[$tmp[0]] = $tmp[1];
240
		}
232
		}
241
	}
233
	}
242
	fclose($ouvre);
234
	fclose($ouvre);
243
}
235
}
244
 
-
 
245
/************************
-
 
246
*	TO DO		*
-
 
247
*************************/
-
 
248
//modification de la conf réseau  --> V3.0
-
 
249
 
-
 
250
?>
236
?>
251
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
237
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
252
<html><!-- written by steweb57 & rexy -->
238
<html><!-- written by steweb57 & rexy -->
253
<head>
239
<head>
254
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
240
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Line 266... Line 252...
266
		return false;
252
		return false;
267
	}
253
	}
268
}
254
}
269
</script>
255
</script>
270
</head>
256
</head>
271
 
-
 
272
 
-
 
273
<body>
257
<body>
274
<table width="100%" border="0" cellspacing="0" cellpadding="0">
258
<table width="100%" border="0" cellspacing="0" cellpadding="0">
275
	<tr><th><?php echo $l_network_title; ?></th></tr>
259
	<tr><th><?php echo $l_network_title; ?></th></tr>
276
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
260
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
277
</table>
261
</table>
Line 279... Line 263...
279
	<tr><td valign="middle" align="left">
263
	<tr><td valign="middle" align="left">
280
	<fieldset>
264
	<fieldset>
281
	<legend><?php echo $l_internet_legend;
265
	<legend><?php echo $l_internet_legend;
282
 	if (InternetTest()){
266
 	if (InternetTest()){
283
		echo " <img src='/images/state_ok.gif'>";
267
		echo " <img src='/images/state_ok.gif'>";
284
		$IP_PUB = exec ("wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1");}
268
		$IP_PUB = exec ("wget http://ipecho.net/plain -O - -o /dev/null");}
285
	else 	{
269
	else 	{
286
		echo " <img src='/images/state_error.gif'>";
270
		echo " <img src='/images/state_error.gif'>";
287
		$IP_PUB = "-.-.-.-";}
271
		$IP_PUB = "-.-.-.-";}
288
	?></legend>
272
	?></legend>
289
	<table>
273
	<table>
290
		<tr><td><?php echo $l_ip_public." : </td><td>".$IP_PUB;?></td></tr>
274
		<tr><td><?php echo $l_ip_public." : ".$IP_PUB;?></td></tr>
291
		<?php
275
		<?php
292
		echo "<form action=".$_SERVER['PHP_SELF']." method='post'>";
276
		echo "<form action=".$_SERVER['PHP_SELF']." method='post'>";
293
		echo "<tr><td>".$l_ip_dns1." <input style='width:120px' type='text' name='dns1' value=".$conf["DNS1"]."/></td></tr>";
277
		echo "<tr><td>".$l_ip_dns1." <input style='width:120px' type='text' name='dns1' value=".$conf["DNS1"]."/></td></tr>";
294
		echo "<tr><td>".$l_ip_dns2." <input style='width:120px' type='text' name='dns2' value=".$conf["DNS2"]."/></td></tr>";
278
		echo "<tr><td>".$l_ip_dns2." <input style='width:120px' type='text' name='dns2' value=".$conf["DNS2"]."/></td></tr>";
295
		?>
279
		?>
Line 320... Line 304...
320
	<?php 
304
	<?php 
321
	echo "<td><input type='submit' value='$l_apply' ></td>"; 	
305
	echo "<td><input type='submit' value='$l_apply' ></td>"; 	
322
	echo "</form>";
306
	echo "</form>";
323
	?>
307
	?>
324
</table>
308
</table>
325
 
-
 
326
<table width="100%" border="0" cellspacing="0" cellpadding="0">
309
<table width="100%" border="0" cellspacing="0" cellpadding="0">
327
	<tr><th><?php echo $l_dhcp_title;?></th></tr>
310
	<tr><th><?php echo $l_dhcp_title;?></th></tr>
328
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
311
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
329
</table>
312
</table>
330
<table width="100%" border=1 cellspacing=0 cellpadding=0>
313
<table width="100%" border=1 cellspacing=0 cellpadding=0>
Line 383... Line 366...
383
	<input type="submit" <?php echo "value=\"".$l_default_cert."\""; if(!file_exists("/etc/pki/tls/certs/alcasar.crt.old") || !file_exists("/etc/pki/tls/private/alcasar.key.old")){ echo " disabled";}?>>
366
	<input type="submit" <?php echo "value=\"".$l_default_cert."\""; if(!file_exists("/etc/pki/tls/certs/alcasar.crt.old") || !file_exists("/etc/pki/tls/private/alcasar.key.old")){ echo " disabled";}?>>
384
	</form>
367
	</form>
385
	</td>
368
	</td>
386
	</tr>
369
	</tr>
387
</table>
370
</table>
388
 
-
 
389
</body>
371
</body>
390
</html>
372
</html>
391
 
373
 
392
<?php
374
<?php
393
if(isset($_POST['default'])){
375
if(isset($_POST['default'])){