Subversion Repositories ALCASAR

Rev

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