Subversion Repositories ALCASAR

Rev

Rev 1358 | Rev 1570 | 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";
865 richard 16
 $l_create_user_db_backup = "Sauvegarder la base active des usagers";
1358 richard 17
 $l_traceability_backup = "Créer le fichier actif des traces";
354 richard 18
 $l_execute = "Ex&eacute;cuter";
19
 $l_backup_files = "Fichiers disponibles pour archivage";
1222 richard 20
 $l_firewall_log = "Journaux de traçabilité";
806 richard 21
 $l_users_db_backups = "Base des usagers";
688 richard 22
 $l_empty = "vide";
354 richard 23
}
24
else {
25
 $l_backups = "Backups";
865 richard 26
 $l_create_user_db_backup = "Save the active users database";
1358 richard 27
 $l_traceability_backup = "Create the active traceability file";
354 richard 28
 $l_execute = "Execute";
29
 $l_backup_files = "Archive backup files";
1222 richard 30
 $l_firewall_log = "Traceability log files";
806 richard 31
 $l_users_db_backups = "Users database";
688 richard 32
 $l_empty = "empty";
354 richard 33
}
34
function taille_fichier($fichier)
35
{
36
	$taille_fichier = filesize($fichier);
37
	if ($taille_fichier >= 1073741824){
38
		$taille_fichier = round($taille_fichier / 1073741824 * 100) / 100 . " Go";}
39
	elseif ($taille_fichier >= 1048576){
40
		$taille_fichier = round($taille_fichier / 1048576 * 100) / 100 . " Mo";}
41
	elseif ($taille_fichier >= 1024){
42
		$taille_fichier = round($taille_fichier / 1024 * 100) / 100 . " Ko";}
43
	else {$taille_fichier = $taille_fichier . " o";} 
44
	return $taille_fichier;
45
}
46
?>
47
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
48
	<tr><th><? echo $l_backups;?></th></tr>
49
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
50
</TABLE>
51
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
52
	<tr><td valign="middle" align="left">
53
	<FORM action="sauvegarde.php" method=POST><b>
54
		<select name='choix'></b>
1358 richard 55
			<option value="traceability_backup"><?echo "$l_traceability_backup";?>
806 richard 56
			<option value="user_DB_backup"><?echo "$l_create_user_db_backup";?>
354 richard 57
		</select>
58
		<input type=submit value="<?echo "$l_execute";?>">
59
	</FORM>
60
	</td></tr>
61
</TABLE>
62
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
63
	<tr><th><?echo "$l_backup_files";?></th></tr>
64
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
65
</TABLE>
66
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
67
	<TR align="center">
68
	<TD><b><?echo "$l_firewall_log";?></b></TD>
806 richard 69
	<TD><b><?echo "$l_users_db_backups";?></b></TD>
354 richard 70
	</TR><TR align="center">
71
<?
72
if (isset($_POST['choix'])){
73
	switch ($_POST['choix']){
806 richard 74
		case 'user_DB_backup' :
386 franck 75
			exec ("sudo /usr/local/sbin/alcasar-mysql.sh --dump");
354 richard 76
		break;
1358 richard 77
		case 'traceability_backup' :
1303 richard 78
			exec ("sudo /usr/local/bin/alcasar-archive.sh --live");
354 richard 79
		break;
80
	}
81
}
1254 richard 82
$dir[0]="archive";
354 richard 83
$dir[1]="base";
84
$j=0;
85
$nb=count($dir);
86
while ($j != $nb)
87
{
865 richard 88
	echo "<TD valign='top'>";
354 richard 89
	$rep = opendir("/var/Save/".$dir[$j]);
90
	$i=0; unset ($liste_f);
91
	while ( $file = readdir($rep) )
92
	{
93
		if ($file != '.' && $file != '..')
94
		{
95
			$liste_f[$i] = $file;
96
			$i++;
97
		}
98
	}
99
	closedir($rep);
100
	if ($i == 0)
101
	{
688 richard 102
		echo "$l_empty";
354 richard 103
	}
104
	else
105
	{
106
		sort($liste_f);
107
		while ( $i > 0)
108
		{
109
			$i--;
110
			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>";
111
		}
112
	}
113
	echo "</TD>";
114
	$j++;
115
}
116
?>
117
	</tr>
118
</TABLE>
119
</BODY>
120
</HTML>