Subversion Repositories ALCASAR

Rev

Rev 2853 | 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";
2853 rexy 26
} else if ($Language == 'es') {
27
 $l_backups = "Copias de Respaldo";
28
 $l_create_user_db_backup = "Crear el archivo de base de datos de usuarios actual";
29
 $l_traceability_backup = "Crear el archivo de trazabilidad de la semana actual";
30
 $l_create_system_backup = "Crear un archivo de configuración";
31
 $l_execute = "Ejecutar";
32
 $l_backup_files = "Archivos de copias de respaldo";
33
 $l_firewall_log = "Archivos de registro de trazabilidad";
34
 $l_users_db_backups = "Base de datos de usuarios";
35
 $l_weekly_report = "Informes semanales de actividad.";
36
 $l_empty = "vacío";
37
} else {
354 richard 38
 $l_backups = "Backups";
1570 richard 39
 $l_create_user_db_backup = "Create the current users database file";
40
 $l_traceability_backup = "Create the traceability file of the current week";
2825 rexy 41
 $l_create_system_backup = "Create the configuration file";
354 richard 42
 $l_execute = "Execute";
43
 $l_backup_files = "Archive backup files";
1222 richard 44
 $l_firewall_log = "Traceability log files";
806 richard 45
 $l_users_db_backups = "Users database";
2142 richard 46
 $l_weekly_report = "Weekly activity reports";
688 richard 47
 $l_empty = "empty";
354 richard 48
}
49
function taille_fichier($fichier)
50
{
51
	$taille_fichier = filesize($fichier);
52
	if ($taille_fichier >= 1073741824){
53
		$taille_fichier = round($taille_fichier / 1073741824 * 100) / 100 . " Go";}
54
	elseif ($taille_fichier >= 1048576){
55
		$taille_fichier = round($taille_fichier / 1048576 * 100) / 100 . " Mo";}
56
	elseif ($taille_fichier >= 1024){
57
		$taille_fichier = round($taille_fichier / 1024 * 100) / 100 . " Ko";}
58
	else {$taille_fichier = $taille_fichier . " o";} 
59
	return $taille_fichier;
60
}
61
?>
2817 rexy 62
<div class="panel">
63
	<div class="panel-header"><?= $l_backups ?></div>
64
	<div class="panel-row">
65
		<div class="panel-cell">
66
			<form action="sauvegarde.php" method=POST>
67
			<select name='choix'>
68
				<option value="traceability_backup"><?= $l_traceability_backup?>
69
				<option value="user_DB_backup"><?= $l_create_user_db_backup?>
2825 rexy 70
				<option value="system_backup"><?= $l_create_system_backup?>
2817 rexy 71
			</select>
72
			<input type=submit value="<?= $l_execute?>">
73
			</form>
74
		</div>
75
	</div>
76
</div>
77
<div class="panel">
78
	<div class="panel-header"><?= $l_backup_files?></div>
79
	<div class="panel-row">
80
		<div class="panel-cell">
81
		<table width="100%" border=0 cellspacing=0 cellpadding=1>
82
			<tr align="center">
83
				<td><b><?= $l_firewall_log?></b></td>
84
				<td><b><?= $l_users_db_backups?></b></td>
85
				<td><b><?= $l_weekly_report?></b></td>
86
			</tr>
87
			<tr align="center">
354 richard 88
<?
89
if (isset($_POST['choix'])){
90
	switch ($_POST['choix']){
806 richard 91
		case 'user_DB_backup' :
1827 raphael.pi 92
			exec ("sudo /usr/local/bin/alcasar-mysql.sh --dump");
354 richard 93
		break;
1358 richard 94
		case 'traceability_backup' :
1303 richard 95
			exec ("sudo /usr/local/bin/alcasar-archive.sh --live");
354 richard 96
		break;
2825 rexy 97
		case 'system_backup' :
98
			exec ("sudo /usr/local/bin/alcasar-conf.sh --create");
2835 rexy 99
			header('Location: alcasar-conf.tar.gz');
2825 rexy 100
		break;
354 richard 101
	}
102
}
1254 richard 103
$dir[0]="archive";
354 richard 104
$dir[1]="base";
2138 richard 105
$dir[2]="activity_report";
354 richard 106
$j=0;
107
$nb=count($dir);
108
while ($j != $nb)
109
{
2817 rexy 110
	echo "<td valign='top'>";
354 richard 111
	$rep = opendir("/var/Save/".$dir[$j]);
112
	$i=0; unset ($liste_f);
113
	while ( $file = readdir($rep) )
114
	{
115
		if ($file != '.' && $file != '..')
116
		{
117
			$liste_f[$i] = $file;
118
			$i++;
119
		}
120
	}
121
	closedir($rep);
122
	if ($i == 0)
123
	{
688 richard 124
		echo "$l_empty";
354 richard 125
	}
126
	else
127
	{
128
		sort($liste_f);
129
		while ( $i > 0)
130
		{
131
			$i--;
2887 rexy 132
			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 133
		}
134
	}
2817 rexy 135
	echo "</td>\n";
354 richard 136
	$j++;
137
}
138
?>
2817 rexy 139
			</tr>
140
		</table>
141
		</div>
142
	</div>
143
</div>
144
</body>
145
</html>