Subversion Repositories ALCASAR

Rev

Rev 721 | Rev 865 | 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";
806 richard 16
 $l_create_user_db_backup = "Sauvegarder la base des usagers";
17
 $l_create_system_backup = "Créer une archive système";
354 richard 18
 $l_execute = "Ex&eacute;cuter";
19
 $l_backup_files = "Fichiers disponibles pour archivage";
20
 $l_firewall_log = "Journaux du parefeu (Firewall)";
806 richard 21
 $l_users_db_backups = "Base des usagers";
22
 $l_system_backup = "Archive système";
688 richard 23
 $l_empty = "vide";
354 richard 24
}
25
else {
26
 $l_backups = "Backups";
806 richard 27
 $l_create_user_db_backup = "Save the users database";
28
 $l_create_system_backup = "Create a system backup";
354 richard 29
 $l_execute = "Execute";
30
 $l_backup_files = "Archive backup files";
31
 $l_firewall_log = "Firewall log files";
806 richard 32
 $l_users_db_backups = "Users database";
33
 $l_system_backup = "system backup";
688 richard 34
 $l_empty = "empty";
354 richard 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>
806 richard 57
			<option value="user_DB_backup"><?echo "$l_create_user_db_backup";?>
58
			<option value="system_backup"><?echo "$l_create_system_backup";?>
354 richard 59
		</select>
60
		<input type=submit value="<?echo "$l_execute";?>">
61
	</FORM>
62
	</td></tr>
63
</TABLE>
64
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
65
	<tr><th><?echo "$l_backup_files";?></th></tr>
66
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
67
</TABLE>
68
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
69
	<TR align="center">
70
	<TD><b><?echo "$l_firewall_log";?></b></TD>
806 richard 71
	<TD><b><?echo "$l_users_db_backups";?></b></TD>
72
	<TD><b><?echo "$l_system_backup";?></b></TD>
354 richard 73
	</TR><TR align="center">
74
<?
75
if (isset($_POST['choix'])){
76
	switch ($_POST['choix']){
806 richard 77
		case 'user_DB_backup' :
386 franck 78
			exec ("sudo /usr/local/sbin/alcasar-mysql.sh --dump");
354 richard 79
		break;
80
		case 'archivage_logs' :
721 franck 81
			exec ("sudo /usr/local/bin/alcasar-log-export.sh");
354 richard 82
		break;
806 richard 83
		case 'system_backup' :
84
			exec ("sudo /usr/local/bin/alcasar-conf.sh --create");
354 richard 85
		break;
86
	}
87
}
88
$dir[0]="logs/firewall";
89
$dir[1]="base";
806 richard 90
$dir[2]="system_backup";
354 richard 91
$j=0;
92
$nb=count($dir);
93
while ($j != $nb)
94
{
95
	echo "<TD>";
96
	$rep = opendir("/var/Save/".$dir[$j]);
97
	$i=0; unset ($liste_f);
98
	while ( $file = readdir($rep) )
99
	{
100
		if ($file != '.' && $file != '..')
101
		{
102
			$liste_f[$i] = $file;
103
			$i++;
104
		}
105
	}
106
	closedir($rep);
107
	if ($i == 0)
108
	{
688 richard 109
		echo "$l_empty";
354 richard 110
	}
111
	else
112
	{
113
		sort($liste_f);
114
		while ( $i > 0)
115
		{
116
			$i--;
117
			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>";
118
		}
119
	}
120
	echo "</TD>";
121
	$j++;
122
}
123
?>
124
	</tr>
125
</TABLE>
126
</BODY>
127
</HTML>