Subversion Repositories ALCASAR

Rev

Rev 2829 | Rev 2853 | 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>
2818 rexy 5
	<title>Sauvegarde</title>
6
	<link rel="stylesheet" href="/css/acc.css" type="text/css">
2817 rexy 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";
2825 rexy 19
 $l_create_system_backup = "Créer un fichier de configuration";
2138 richard 20
 $l_execute = "Exécuter";
354 richard 21
 $l_backup_files = "Fichiers disponibles pour archivage";
1222 richard 22
 $l_firewall_log = "Journaux de traçabilité";
806 richard 23
 $l_users_db_backups = "Base des usagers";
2142 richard 24
 $l_weekly_report = "Rapports d'activité hebdomadaire";
688 richard 25
 $l_empty = "vide";
354 richard 26
}
27
else {
28
 $l_backups = "Backups";
1570 richard 29
 $l_create_user_db_backup = "Create the current users database file";
30
 $l_traceability_backup = "Create the traceability file of the current week";
2825 rexy 31
 $l_create_system_backup = "Create the configuration file";
354 richard 32
 $l_execute = "Execute";
33
 $l_backup_files = "Archive backup files";
1222 richard 34
 $l_firewall_log = "Traceability log files";
806 richard 35
 $l_users_db_backups = "Users database";
2142 richard 36
 $l_weekly_report = "Weekly activity reports";
688 richard 37
 $l_empty = "empty";
354 richard 38
}
39
function taille_fichier($fichier)
40
{
41
	$taille_fichier = filesize($fichier);
42
	if ($taille_fichier >= 1073741824){
43
		$taille_fichier = round($taille_fichier / 1073741824 * 100) / 100 . " Go";}
44
	elseif ($taille_fichier >= 1048576){
45
		$taille_fichier = round($taille_fichier / 1048576 * 100) / 100 . " Mo";}
46
	elseif ($taille_fichier >= 1024){
47
		$taille_fichier = round($taille_fichier / 1024 * 100) / 100 . " Ko";}
48
	else {$taille_fichier = $taille_fichier . " o";} 
49
	return $taille_fichier;
50
}
51
?>
2817 rexy 52
<div class="panel">
53
	<div class="panel-header"><?= $l_backups ?></div>
54
	<div class="panel-row">
55
		<div class="panel-cell">
56
			<form action="sauvegarde.php" method=POST>
57
			<select name='choix'>
58
				<option value="traceability_backup"><?= $l_traceability_backup?>
59
				<option value="user_DB_backup"><?= $l_create_user_db_backup?>
2825 rexy 60
				<option value="system_backup"><?= $l_create_system_backup?>
2817 rexy 61
			</select>
62
			<input type=submit value="<?= $l_execute?>">
63
			</form>
64
		</div>
65
	</div>
66
</div>
67
<div class="panel">
68
	<div class="panel-header"><?= $l_backup_files?></div>
69
	<div class="panel-row">
70
		<div class="panel-cell">
71
		<table width="100%" border=0 cellspacing=0 cellpadding=1>
72
			<tr align="center">
73
				<td><b><?= $l_firewall_log?></b></td>
74
				<td><b><?= $l_users_db_backups?></b></td>
75
				<td><b><?= $l_weekly_report?></b></td>
76
			</tr>
77
			<tr align="center">
354 richard 78
<?
79
if (isset($_POST['choix'])){
80
	switch ($_POST['choix']){
806 richard 81
		case 'user_DB_backup' :
1827 raphael.pi 82
			exec ("sudo /usr/local/bin/alcasar-mysql.sh --dump");
354 richard 83
		break;
1358 richard 84
		case 'traceability_backup' :
1303 richard 85
			exec ("sudo /usr/local/bin/alcasar-archive.sh --live");
354 richard 86
		break;
2825 rexy 87
		case 'system_backup' :
88
			exec ("sudo /usr/local/bin/alcasar-conf.sh --create");
2835 rexy 89
			header('Location: alcasar-conf.tar.gz');
2825 rexy 90
		break;
354 richard 91
	}
92
}
1254 richard 93
$dir[0]="archive";
354 richard 94
$dir[1]="base";
2138 richard 95
$dir[2]="activity_report";
354 richard 96
$j=0;
97
$nb=count($dir);
98
while ($j != $nb)
99
{
2817 rexy 100
	echo "<td valign='top'>";
354 richard 101
	$rep = opendir("/var/Save/".$dir[$j]);
102
	$i=0; unset ($liste_f);
103
	while ( $file = readdir($rep) )
104
	{
105
		if ($file != '.' && $file != '..')
106
		{
107
			$liste_f[$i] = $file;
108
			$i++;
109
		}
110
	}
111
	closedir($rep);
112
	if ($i == 0)
113
	{
688 richard 114
		echo "$l_empty";
354 richard 115
	}
116
	else
117
	{
118
		sort($liste_f);
119
		while ( $i > 0)
120
		{
121
			$i--;
2817 rexy 122
			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 123
		}
124
	}
2817 rexy 125
	echo "</td>\n";
354 richard 126
	$j++;
127
}
128
?>
2817 rexy 129
			</tr>
130
		</table>
131
		</div>
132
	</div>
133
</div>
134
</body>
135
</html>