Subversion Repositories ALCASAR

Rev

Rev 386 | Rev 688 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
354 richard 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy -->
3
<HEAD>
4
<TITLE>Sauvegarde</TITLE>
5
<link rel="stylesheet" href="/css/style.css" type="text/css">
6
</HEAD>
7
<body>
8
<?
9
# choice of language
10
$Language = "en";
11
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
12
 $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
13
 $Language = strtolower(substr(chop($Langue[0]),0,2));}
14
if ($Language == 'fr'){
15
 $l_backups = "Sauvegarde";
16
 $l_user_db_save = "Sauvegarder la base des usagers";
17
 $l_system_iso = "Cr&eacute;er une image ISO &agrave; chaud du syst&egrave;me";
18
 $l_execute = "Ex&eacute;cuter";
19
 $l_warning = "(attention, la cr&eacute;ation de l'image ISO du syst&egrave;me dure plusieurs dizaines de minutes)";
20
 $l_backup_files = "Fichiers disponibles pour archivage";
21
 $l_firewall_log = "Journaux du parefeu (Firewall)";
22
 $l_users_db_files = "Base des usagers";
23
 $l_iso_files = "images ISO du syst&egrave;me";
24
}
25
else {
26
 $l_backups = "Backups";
27
 $l_user_db_save = "Save the users database";
28
 $l_system_iso = "Create a system iso image";
29
 $l_execute = "Execute";
30
 $l_warning = "(warning, the creation of the system iso image takes few minutes)";
31
 $l_backup_files = "Archive backup files";
32
 $l_firewall_log = "Firewall log files";
33
 $l_users_db_files = "Users database";
34
 $l_iso_files = "System ISO images";
35
}
36
function taille_fichier($fichier)
37
{
38
	$taille_fichier = filesize($fichier);
39
	if ($taille_fichier >= 1073741824){
40
		$taille_fichier = round($taille_fichier / 1073741824 * 100) / 100 . " Go";}
41
	elseif ($taille_fichier >= 1048576){
42
		$taille_fichier = round($taille_fichier / 1048576 * 100) / 100 . " Mo";}
43
	elseif ($taille_fichier >= 1024){
44
		$taille_fichier = round($taille_fichier / 1024 * 100) / 100 . " Ko";}
45
	else {$taille_fichier = $taille_fichier . " o";} 
46
	return $taille_fichier;
47
}
48
?>
49
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
50
	<tr><th><? echo $l_backups;?></th></tr>
51
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
52
</TABLE>
53
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
54
	<tr><td valign="middle" align="left">
55
	<FORM action="sauvegarde.php" method=POST><b>
56
		<select name='choix'></b>
57
			<option value="sauvegarde_DB"><?echo "$l_user_db_save";?>
58
			<option value="image_ISO"><?echo "$l_system_iso";?>
59
		</select>
60
		<input type=submit value="<?echo "$l_execute";?>">
61
	</FORM>
62
	<?echo "$l_warning";?>
63
	</td></tr>
64
</TABLE>
65
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
66
	<tr><th><?echo "$l_backup_files";?></th></tr>
67
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
68
</TABLE>
69
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
70
	<TR align="center">
71
	<TD><b><?echo "$l_firewall_log";?></b></TD>
72
	<TD><b><?echo "$l_users_db_files";?></b></TD>
73
	<TD><b><?echo "$l_iso_files";?></b></TD>
74
	</TR><TR align="center">
75
<?
76
if (isset($_POST['choix'])){
77
	switch ($_POST['choix']){
78
		case 'sauvegarde_DB' :
386 franck 79
			exec ("sudo /usr/local/sbin/alcasar-mysql.sh --dump");
354 richard 80
		break;
81
		case 'archivage_logs' :
82
			exec ("sudo /usr/local/bin/alcasar-log-export.sh -30");
83
		break;
84
		case 'image_ISO' :
85
			exec ("sudo /usr/local/bin/alcasar-mondo.sh");
86
		break;
87
	}
88
}
89
$dir[0]="logs/firewall";
90
$dir[1]="base";
91
$dir[2]="ISO";
92
$j=0;
93
$nb=count($dir);
94
while ($j != $nb)
95
{
96
	echo "<TD>";
97
	$rep = opendir("/var/Save/".$dir[$j]);
98
	$i=0; unset ($liste_f);
99
	while ( $file = readdir($rep) )
100
	{
101
		if ($file != '.' && $file != '..')
102
		{
103
			$liste_f[$i] = $file;
104
			$i++;
105
		}
106
	}
107
	closedir($rep);
108
	if ($i == 0)
109
	{
110
		echo "vide";
111
	}
112
	else
113
	{
114
		sort($liste_f);
115
		while ( $i > 0)
116
		{
117
			$i--;
118
			echo "<a href=\"/save/$dir[$j]/$liste_f[$i]\">$liste_f[$i]</A> (";echo taille_fichier("/var/Save/".$dir[$j]."/".$liste_f[$i]);echo ")<BR>";
119
		}
120
	}
121
	echo "</TD>";
122
	$j++;
123
}
124
?>
125
	</tr>
126
</TABLE>
127
</BODY>
128
</HTML>