Subversion Repositories ALCASAR

Rev

Rev 2138 | Rev 2817 | 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";
1570 richard 16
 $l_create_user_db_backup = "Créer le fichier de la base actuelle des usagers";
17
 $l_traceability_backup = "Créer le fichier de traces de la semaine en cours";
2138 richard 18
 $l_execute = "Exécuter";
354 richard 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";
2142 richard 22
 $l_weekly_report = "Rapports d'activité hebdomadaire";
688 richard 23
 $l_empty = "vide";
354 richard 24
}
25
else {
26
 $l_backups = "Backups";
1570 richard 27
 $l_create_user_db_backup = "Create the current users database file";
28
 $l_traceability_backup = "Create the traceability file of the current week";
354 richard 29
 $l_execute = "Execute";
30
 $l_backup_files = "Archive backup files";
1222 richard 31
 $l_firewall_log = "Traceability log files";
806 richard 32
 $l_users_db_backups = "Users database";
2142 richard 33
 $l_weekly_report = "Weekly activity reports";
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">
2138 richard 55
	<FORM action="sauvegarde.php" method=POST>
56
		<select name='choix'>
1358 richard 57
			<option value="traceability_backup"><?echo "$l_traceability_backup";?>
806 richard 58
			<option value="user_DB_backup"><?echo "$l_create_user_db_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>
2138 richard 72
	<TD><b><?echo "$l_weekly_report";?></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' :
1827 raphael.pi 78
			exec ("sudo /usr/local/bin/alcasar-mysql.sh --dump");
354 richard 79
		break;
1358 richard 80
		case 'traceability_backup' :
1303 richard 81
			exec ("sudo /usr/local/bin/alcasar-archive.sh --live");
354 richard 82
		break;
83
	}
84
}
1254 richard 85
$dir[0]="archive";
354 richard 86
$dir[1]="base";
2138 richard 87
$dir[2]="activity_report";
354 richard 88
$j=0;
89
$nb=count($dir);
90
while ($j != $nb)
91
{
865 richard 92
	echo "<TD valign='top'>";
354 richard 93
	$rep = opendir("/var/Save/".$dir[$j]);
94
	$i=0; unset ($liste_f);
95
	while ( $file = readdir($rep) )
96
	{
97
		if ($file != '.' && $file != '..')
98
		{
99
			$liste_f[$i] = $file;
100
			$i++;
101
		}
102
	}
103
	closedir($rep);
104
	if ($i == 0)
105
	{
688 richard 106
		echo "$l_empty";
354 richard 107
	}
108
	else
109
	{
110
		sort($liste_f);
111
		while ( $i > 0)
112
		{
113
			$i--;
114
			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>";
115
		}
116
	}
2138 richard 117
	echo "</TD>\n";
354 richard 118
	$j++;
119
}
120
?>
121
	</tr>
122
</TABLE>
123
</BODY>
124
</HTML>