Subversion Repositories ALCASAR

Rev

Rev 2142 | Rev 2818 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2817 rexy 1
<!DOCTYPE HTML>
2
<!-- Written by Rexy -->
3
<html>
4
<head>
5
<title>Sauvegarde</title>
6
<link rel="stylesheet" href="/css/acc.css" type="text/css">
7
</head>
354 richard 8
<body>
9
<?
10
# choice of language
11
$Language = "en";
12
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
13
 $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
14
 $Language = strtolower(substr(chop($Langue[0]),0,2));}
15
if ($Language == 'fr'){
16
 $l_backups = "Sauvegarde";
1570 richard 17
 $l_create_user_db_backup = "Créer le fichier de la base actuelle des usagers";
18
 $l_traceability_backup = "Créer le fichier de traces de la semaine en cours";
2138 richard 19
 $l_execute = "Exécuter";
354 richard 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";
2142 richard 23
 $l_weekly_report = "Rapports d'activité hebdomadaire";
688 richard 24
 $l_empty = "vide";
354 richard 25
}
26
else {
27
 $l_backups = "Backups";
1570 richard 28
 $l_create_user_db_backup = "Create the current users database file";
29
 $l_traceability_backup = "Create the traceability file of the current week";
354 richard 30
 $l_execute = "Execute";
31
 $l_backup_files = "Archive backup files";
1222 richard 32
 $l_firewall_log = "Traceability log files";
806 richard 33
 $l_users_db_backups = "Users database";
2142 richard 34
 $l_weekly_report = "Weekly activity reports";
688 richard 35
 $l_empty = "empty";
354 richard 36
}
37
function taille_fichier($fichier)
38
{
39
	$taille_fichier = filesize($fichier);
40
	if ($taille_fichier >= 1073741824){
41
		$taille_fichier = round($taille_fichier / 1073741824 * 100) / 100 . " Go";}
42
	elseif ($taille_fichier >= 1048576){
43
		$taille_fichier = round($taille_fichier / 1048576 * 100) / 100 . " Mo";}
44
	elseif ($taille_fichier >= 1024){
45
		$taille_fichier = round($taille_fichier / 1024 * 100) / 100 . " Ko";}
46
	else {$taille_fichier = $taille_fichier . " o";} 
47
	return $taille_fichier;
48
}
49
?>
2817 rexy 50
<div class="panel">
51
	<div class="panel-header"><?= $l_backups ?></div>
52
	<div class="panel-row">
53
		<div class="panel-cell">
54
			<form action="sauvegarde.php" method=POST>
55
			<select name='choix'>
56
				<option value="traceability_backup"><?= $l_traceability_backup?>
57
				<option value="user_DB_backup"><?= $l_create_user_db_backup?>
58
			</select>
59
			<input type=submit value="<?= $l_execute?>">
60
			</form>
61
		</div>
62
	</div>
63
</div>
64
<div class="panel">
65
	<div class="panel-header"><?= $l_backup_files?></div>
66
	<div class="panel-row">
67
		<div class="panel-cell">
68
		<table width="100%" border=0 cellspacing=0 cellpadding=1>
69
			<tr align="center">
70
				<td><b><?= $l_firewall_log?></b></td>
71
				<td><b><?= $l_users_db_backups?></b></td>
72
				<td><b><?= $l_weekly_report?></b></td>
73
			</tr>
74
			<tr align="center">
354 richard 75
<?
76
if (isset($_POST['choix'])){
77
	switch ($_POST['choix']){
806 richard 78
		case 'user_DB_backup' :
1827 raphael.pi 79
			exec ("sudo /usr/local/bin/alcasar-mysql.sh --dump");
354 richard 80
		break;
1358 richard 81
		case 'traceability_backup' :
1303 richard 82
			exec ("sudo /usr/local/bin/alcasar-archive.sh --live");
354 richard 83
		break;
84
	}
85
}
1254 richard 86
$dir[0]="archive";
354 richard 87
$dir[1]="base";
2138 richard 88
$dir[2]="activity_report";
354 richard 89
$j=0;
90
$nb=count($dir);
91
while ($j != $nb)
92
{
2817 rexy 93
	echo "<td valign='top'>";
354 richard 94
	$rep = opendir("/var/Save/".$dir[$j]);
95
	$i=0; unset ($liste_f);
96
	while ( $file = readdir($rep) )
97
	{
98
		if ($file != '.' && $file != '..')
99
		{
100
			$liste_f[$i] = $file;
101
			$i++;
102
		}
103
	}
104
	closedir($rep);
105
	if ($i == 0)
106
	{
688 richard 107
		echo "$l_empty";
354 richard 108
	}
109
	else
110
	{
111
		sort($liste_f);
112
		while ( $i > 0)
113
		{
114
			$i--;
2817 rexy 115
			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>\n";
354 richard 116
		}
117
	}
2817 rexy 118
	echo "</td>\n";
354 richard 119
	$j++;
120
}
121
?>
2817 rexy 122
			</tr>
123
		</table>
124
		</div>
125
	</div>
126
</div>
127
</body>
128
</html>