Subversion Repositories ALCASAR

Rev

Rev 1303 | Rev 1564 | 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";
1245 richard 18
 $l_create_system_backup = "Créer un fichier de configuration";
354 richard 19
 $l_execute = "Ex&eacute;cuter";
20
 $l_backup_files = "Fichiers disponibles pour archivage";
1222 richard 21
 $l_firewall_log = "Journaux de traçabilité";
806 richard 22
 $l_users_db_backups = "Base des usagers";
1245 richard 23
 $l_system_backup = "Fichiers de configuration";
688 richard 24
 $l_empty = "vide";
354 richard 25
}
26
else {
27
 $l_backups = "Backups";
865 richard 28
 $l_create_user_db_backup = "Save the active users database";
1358 richard 29
 $l_traceability_backup = "Create the active traceability file";
1277 richard 30
 $l_create_system_backup = "Create the configuration file";
354 richard 31
 $l_execute = "Execute";
32
 $l_backup_files = "Archive backup files";
1222 richard 33
 $l_firewall_log = "Traceability log files";
806 richard 34
 $l_users_db_backups = "Users database";
1245 richard 35
 $l_system_backup = "Configuration files";
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>
1358 richard 59
			<option value="traceability_backup"><?echo "$l_traceability_backup";?>
806 richard 60
			<option value="user_DB_backup"><?echo "$l_create_user_db_backup";?>
61
			<option value="system_backup"><?echo "$l_create_system_backup";?>
354 richard 62
		</select>
63
		<input type=submit value="<?echo "$l_execute";?>">
64
	</FORM>
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>
806 richard 74
	<TD><b><?echo "$l_users_db_backups";?></b></TD>
75
	<TD><b><?echo "$l_system_backup";?></b></TD>
354 richard 76
	</TR><TR align="center">
77
<?
78
if (isset($_POST['choix'])){
79
	switch ($_POST['choix']){
806 richard 80
		case 'user_DB_backup' :
386 franck 81
			exec ("sudo /usr/local/sbin/alcasar-mysql.sh --dump");
354 richard 82
		break;
1358 richard 83
		case 'traceability_backup' :
1303 richard 84
			exec ("sudo /usr/local/bin/alcasar-archive.sh --live");
354 richard 85
		break;
806 richard 86
		case 'system_backup' :
87
			exec ("sudo /usr/local/bin/alcasar-conf.sh --create");
354 richard 88
		break;
89
	}
90
}
1254 richard 91
$dir[0]="archive";
354 richard 92
$dir[1]="base";
806 richard 93
$dir[2]="system_backup";
354 richard 94
$j=0;
95
$nb=count($dir);
96
while ($j != $nb)
97
{
865 richard 98
	echo "<TD valign='top'>";
354 richard 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>