Subversion Repositories ALCASAR

Rev

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

Rev 644 Rev 654
Line 75... Line 75...
75
/********************************************************************
75
/********************************************************************
76
*	CONSTANTES AVEC CHEMINS DES FICHIERS DE CONFIGURATION			*
76
*	CONSTANTES AVEC CHEMINS DES FICHIERS DE CONFIGURATION			*
77
*********************************************************************/
77
*********************************************************************/
78
 
78
 
79
define ("ALCASAR_CHILLI", "/etc/chilli.conf");
79
define ("ALCASAR_CHILLI", "/etc/chilli.conf");
80
define ("ALCASAR_ETH0", "/etc/sysconfig/network-scripts/ifcfg-eth0");
-
 
81
define ("ALCASAR_ETH1", "/etc/sysconfig/network-scripts/ifcfg-eth1");
-
 
82
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
80
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
83
/********************************************************************
81
/********************************************************************
84
*				TEST DES FICHIERS DE CONFIGURATION					*
82
*				TEST DES FICHIERS DE CONFIGURATION					*
85
*********************************************************************/
83
*********************************************************************/
86
 
84
 
87
//Test de présence et des droits en lecture des fichiers de configuration.
85
//Test de présence et des droits en lecture des fichiers de configuration.
88
if (!file_exists(ALCASAR_CHILLI)){
86
if (!file_exists(ALCASAR_CHILLI)){
89
	exit("Fichier de configuration ".ALCASAR_CHILLI." non présent");
87
	exit("Fichier de configuration ".ALCASAR_CHILLI." non présent");
90
}
88
}
91
if (!file_exists(ALCASAR_ETH0)){
89
if (!file_exists(CONF_FILE)){
92
	exit("Fichier de configuration ".ALCASAR_ETH0." non présent");
90
	exit("Fichier de configuration ".CONF_FILE." non présent");
93
}
91
}
94
if (!file_exists(ALCASAR_ETH1)){
92
if (!is_readable(ALCASAR_CHILLI)){
95
	exit("Fichier de configuration ".ALCASAR_ETH1." non présent");
93
	exit("Vous n'avez pas les droits de lecture sur le fichier ".ALCASAR_CHILLI);
96
}
94
}
97
if (!is_readable(ALCASAR_ETH0)){
95
if (!is_readable(CONF_FILE)){
98
	exit("Vous n'avez pas les droits de lecture sur le fichier ".ALCASAR_ETH0);
-
 
99
}
-
 
100
if (!is_readable(ALCASAR_ETH1)){
-
 
101
	exit("Vous n'avez pas les droits de lecture sur le fichier ".ALCASAR_ETH1);
96
	exit("Vous n'avez pas les droits de lecture sur le fichier ".CONF_FILE);
102
}
97
}
103
 
98
 
104
//fonction pour faire une action (start,stop,restart) sur un service
99
//fonction pour faire une action (start,stop,restart) sur un service
105
function serviceExec($service, $action){
100
function serviceExec($service, $action){
106
	if (($action == "start")||($action == "stop")||($action == "restart")){
101
	if (($action == "start")||($action == "stop")||($action == "restart")){
Line 198... Line 193...
198
	exit("Erreur d'ouverture du fichier ".ALCASAR_CHILLI);
193
	exit("Erreur d'ouverture du fichier ".ALCASAR_CHILLI);
199
}
194
}
200
fclose($ouvre);
195
fclose($ouvre);
201
 
196
 
202
/********************************************************************
197
/********************************************************************
203
*			Lecture du fichier ALCASAR_ETH0							*
198
*			Lecture du fichier CONF_FILE							*
204
*********************************************************************/
-
 
205
$ouvre=fopen(ALCASAR_ETH0,"r");
-
 
206
if ($ouvre){
-
 
207
	while (!feof ($ouvre))
-
 
208
	{
-
 
209
		$tampon = fgets($ouvre, 4096);
-
 
210
		if (strpos($tampon,"=")!==false){
-
 
211
			$tmp = explode("=",$tampon);
-
 
212
			$eth0[$tmp[0]] = $tmp[1];
-
 
213
		}
-
 
214
	}
-
 
215
}else{
-
 
216
	exit("Erreur d'ouverture du fichier ".ALCASAR_ETH0);
-
 
217
}
-
 
218
fclose($ouvre);
-
 
219
 
-
 
220
/********************************************************************
-
 
221
*			Lecture du fichier ALCASAR_ETH1							*
-
 
222
*********************************************************************/
199
*********************************************************************/
223
$ouvre=fopen(ALCASAR_ETH1,"r");
200
$ouvre=fopen(CONF_FILE,"r");
224
if ($ouvre){
201
if ($ouvre){
225
	while (!feof ($ouvre))
202
	while (!feof ($ouvre))
226
	{
203
	{
227
		$tampon = fgets($ouvre, 4096);
204
		$tampon = fgets($ouvre, 4096);
228
		if (strpos($tampon,"=")!==false){
205
		if (strpos($tampon,"=")!==false){
229
			$tmp = explode("=",$tampon);
206
			$tmp = explode("=",$tampon);
230
			$eth1[$tmp[0]] = $tmp[1];
207
			$conf[$tmp[0]] = $tmp[1];
231
		}
208
		}
232
	}
209
	}
233
}else{
210
}else{
234
	exit("Erreur d'ouverture du fichier ".ALCASAR_ETH1);
211
	exit("Erreur d'ouverture du fichier ".ALCASAR_ETH1);
235
}
212
}
Line 265... Line 242...
265
		echo " <img src='/images/state_error.gif'> $l_disable";
242
		echo " <img src='/images/state_error.gif'> $l_disable";
266
		$IP_PUB = "-.-.-.-";}
243
		$IP_PUB = "-.-.-.-";}
267
	?></legend>
244
	?></legend>
268
	<table>
245
	<table>
269
		<tr><td><?php echo $l_ip_public." : </td><td>".$IP_PUB;?></td></tr>
246
		<tr><td><?php echo $l_ip_public." : </td><td>".$IP_PUB;?></td></tr>
270
		<tr><td><?php echo $l_ip_dns1." : </td><td>".$eth0["DNS1"];?></td></tr>
247
		<tr><td><?php echo $l_ip_dns1." : </td><td>".$conf["DNS1"];?></td></tr>
271
		<tr><td><?php echo $l_ip_dns2." : </td><td>".$eth0["DNS2"];?></td></tr>
248
		<tr><td><?php echo $l_ip_dns2." : </td><td>".$conf["DNS2"];?></td></tr>
272
	</table>
249
	</table>
273
	</fieldset>
250
	</fieldset>
274
	</td><td>
251
	</td><td>
275
	<fieldset>
252
	<fieldset>
276
	<legend><?php echo $l_eth0_legend; ?></legend>
253
	<legend><?php echo $l_eth0_legend; ?></legend>
277
	<table>
254
	<table>
278
		<tr><td><?php echo $l_ip_adr." : </td><td>".$eth0["IPADDR"];?></td></tr>
255
		<tr><td><?php echo $l_ip_adr." : </td><td>".$conf["PUBLIC_IP"];?></td></tr>
279
		<tr><td><?php echo $l_ip_mask." : </td><td>".$eth0["NETMASK"];?></td></tr>
-
 
280
		<tr><td><?php echo $l_ip_router." : </td><td>".$eth0["GATEWAY"];?></td></tr>
256
		<tr><td><?php echo $l_ip_router." : </td><td>".$conf["GW"];?></td></tr>
281
	</table>
257
	</table>
282
	</fieldset>
258
	</fieldset>
283
	</td><td>
259
	</td><td>
284
	<fieldset>
260
	<fieldset>
285
	<legend><?php echo $l_eth1_legend; ?></legend>
261
	<legend><?php echo $l_eth1_legend; ?></legend>
286
	<table>
262
	<table>
287
		<tr><td><?php echo $l_ip_adr." : </td><td>".$eth1["IPADDR"];?></td></tr>
263
		<tr><td><?php echo $l_ip_adr." : </td><td>".$conf["PRIVATE_IP"];?></td></tr>
288
		<tr><td><?php echo $l_ip_mask." : </td><td>".$eth1["NETMASK"];?></td></tr>
-
 
289
	</table>
264
	</table>
290
	</fieldset>
265
	</fieldset>
291
	</td></tr>
266
	</td></tr>
292
</table>
267
</table>
293
<table width="100%" border="0" cellspacing="0" cellpadding="0">
268
<table width="100%" border="0" cellspacing="0" cellpadding="0">