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éer une image ISO à chaud du système";
|
|
|
18 |
$l_execute = "Exécuter";
|
|
|
19 |
$l_warning = "(attention, la création de l'image ISO du systè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ème";
|
688 |
richard |
24 |
$l_empty = "vide";
|
354 |
richard |
25 |
}
|
|
|
26 |
else {
|
|
|
27 |
$l_backups = "Backups";
|
|
|
28 |
$l_user_db_save = "Save the users database";
|
|
|
29 |
$l_system_iso = "Create a system iso image";
|
|
|
30 |
$l_execute = "Execute";
|
|
|
31 |
$l_warning = "(warning, the creation of the system iso image takes few minutes)";
|
|
|
32 |
$l_backup_files = "Archive backup files";
|
|
|
33 |
$l_firewall_log = "Firewall log files";
|
|
|
34 |
$l_users_db_files = "Users database";
|
|
|
35 |
$l_iso_files = "System ISO images";
|
688 |
richard |
36 |
$l_empty = "empty";
|
354 |
richard |
37 |
}
|
|
|
38 |
function taille_fichier($fichier)
|
|
|
39 |
{
|
|
|
40 |
$taille_fichier = filesize($fichier);
|
|
|
41 |
if ($taille_fichier >= 1073741824){
|
|
|
42 |
$taille_fichier = round($taille_fichier / 1073741824 * 100) / 100 . " Go";}
|
|
|
43 |
elseif ($taille_fichier >= 1048576){
|
|
|
44 |
$taille_fichier = round($taille_fichier / 1048576 * 100) / 100 . " Mo";}
|
|
|
45 |
elseif ($taille_fichier >= 1024){
|
|
|
46 |
$taille_fichier = round($taille_fichier / 1024 * 100) / 100 . " Ko";}
|
|
|
47 |
else {$taille_fichier = $taille_fichier . " o";}
|
|
|
48 |
return $taille_fichier;
|
|
|
49 |
}
|
|
|
50 |
?>
|
|
|
51 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
52 |
<tr><th><? echo $l_backups;?></th></tr>
|
|
|
53 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
54 |
</TABLE>
|
|
|
55 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
56 |
<tr><td valign="middle" align="left">
|
|
|
57 |
<FORM action="sauvegarde.php" method=POST><b>
|
|
|
58 |
<select name='choix'></b>
|
|
|
59 |
<option value="sauvegarde_DB"><?echo "$l_user_db_save";?>
|
|
|
60 |
<option value="image_ISO"><?echo "$l_system_iso";?>
|
|
|
61 |
</select>
|
|
|
62 |
<input type=submit value="<?echo "$l_execute";?>">
|
|
|
63 |
</FORM>
|
|
|
64 |
<?echo "$l_warning";?>
|
|
|
65 |
</td></tr>
|
|
|
66 |
</TABLE>
|
|
|
67 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
68 |
<tr><th><?echo "$l_backup_files";?></th></tr>
|
|
|
69 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
70 |
</TABLE>
|
|
|
71 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
72 |
<TR align="center">
|
|
|
73 |
<TD><b><?echo "$l_firewall_log";?></b></TD>
|
|
|
74 |
<TD><b><?echo "$l_users_db_files";?></b></TD>
|
|
|
75 |
<TD><b><?echo "$l_iso_files";?></b></TD>
|
|
|
76 |
</TR><TR align="center">
|
|
|
77 |
<?
|
|
|
78 |
if (isset($_POST['choix'])){
|
|
|
79 |
switch ($_POST['choix']){
|
|
|
80 |
case 'sauvegarde_DB' :
|
386 |
franck |
81 |
exec ("sudo /usr/local/sbin/alcasar-mysql.sh --dump");
|
354 |
richard |
82 |
break;
|
|
|
83 |
case 'archivage_logs' :
|
|
|
84 |
exec ("sudo /usr/local/bin/alcasar-log-export.sh -30");
|
|
|
85 |
break;
|
|
|
86 |
case 'image_ISO' :
|
|
|
87 |
exec ("sudo /usr/local/bin/alcasar-mondo.sh");
|
|
|
88 |
break;
|
|
|
89 |
}
|
|
|
90 |
}
|
|
|
91 |
$dir[0]="logs/firewall";
|
|
|
92 |
$dir[1]="base";
|
|
|
93 |
$dir[2]="ISO";
|
|
|
94 |
$j=0;
|
|
|
95 |
$nb=count($dir);
|
|
|
96 |
while ($j != $nb)
|
|
|
97 |
{
|
|
|
98 |
echo "<TD>";
|
|
|
99 |
$rep = opendir("/var/Save/".$dir[$j]);
|
|
|
100 |
$i=0; unset ($liste_f);
|
|
|
101 |
while ( $file = readdir($rep) )
|
|
|
102 |
{
|
|
|
103 |
if ($file != '.' && $file != '..')
|
|
|
104 |
{
|
|
|
105 |
$liste_f[$i] = $file;
|
|
|
106 |
$i++;
|
|
|
107 |
}
|
|
|
108 |
}
|
|
|
109 |
closedir($rep);
|
|
|
110 |
if ($i == 0)
|
|
|
111 |
{
|
688 |
richard |
112 |
echo "$l_empty";
|
354 |
richard |
113 |
}
|
|
|
114 |
else
|
|
|
115 |
{
|
|
|
116 |
sort($liste_f);
|
|
|
117 |
while ( $i > 0)
|
|
|
118 |
{
|
|
|
119 |
$i--;
|
|
|
120 |
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>";
|
|
|
121 |
}
|
|
|
122 |
}
|
|
|
123 |
echo "</TD>";
|
|
|
124 |
$j++;
|
|
|
125 |
}
|
|
|
126 |
?>
|
|
|
127 |
</tr>
|
|
|
128 |
</TABLE>
|
|
|
129 |
</BODY>
|
|
|
130 |
</HTML>
|