This is just a diff for testing people... ;-)
Changelog in short:
- Added tables
- Cleaned up the code a bit, some if-queries were unnessecary (if ($cgiparams{'ACTION'} eq...)
- Deleted unused lang strings (downloadiso, downloadaddon, logs)
- Separated the ISO files from the IPF files for better overview.
- Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org --- html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl";
my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ###############################################
-if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file);
&deliver_file($file); exit(0); -} elsif ($cgiparams{'ACTION'} eq "downloadiso") { - my $file = &sanitise_file($cgiparams{'FILE'}); - exit(1) unless defined($file); - - &deliver_file($file); - exit(0); -} elsif ($cgiparams{'ACTION'} eq "downloadaddon") { - my $file = &sanitise_file($cgiparams{'FILE'}); - exit(1) unless defined($file); - - &deliver_file($file); - exit(0); -} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ###################################################
-if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" )
system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; }
-&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'});
print <<END <form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################
-&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'});
print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'> + +<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr> + END ; foreach (@backups){ @@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>"; + +print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> + </form></td>"; + +print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> + </form></td></tr>"; } + +print <<END +</table> +END +; +&Header::closebox(); + +&Header::openbox('100%', 'center', $Lang::tr{'backups iso'}); + +print <<END +<table width='95%' cellspacing='0' border='1'> + +<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr> + +END +; + foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_); @@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>"; + +print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> + </form></td>"; + +print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> + </form></td></tr>"; } print <<END </table> @@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; }
-print "<table width='95%' cellspacing='0'>"; +print <<END + +<table width='95%' cellspacing='0' border='1'> + +<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +; + foreach (@addonincluds){ chomp($_); delete $addons{$_}; @@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024;
if ( -e $Datei ){ if ($Size < 1) { - $Size = sprintf("%.2f", $Size); - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; - } else { - $Size = sprintf("%2d", $Size); - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; + $Size = sprintf("%.2f", $Size); +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + </tr>
- } + } else { + $Size = sprintf("%2d", $Size); +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + </tr> + }
print <<END - <td align='right' width='5'> + + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> </form> </td> END ; } -else{ - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>"; + +else { + + print "<tr> + <td align='center'>$_</td> + <td align='center'> - </td> + <td align='center' width='50%'> - </td> + <td align='center' colspan='2'> - </td>"; } + print <<END <td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='addonbackup' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' /> <input type='hidden' name='ADDON' value='$_' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </form> - </td></tr> + </td> +</tr> END ; + } + foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; + +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + print <<END - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> </form> </td> - <td align='right' width='5'></td></tr> + </tr> END ; } @@ -322,9 +402,31 @@ print "</table>";
print <<END <table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr> + </table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',
Hi,
On 26.05.2021 17:39, Matthias Fischer wrote:
This is just a diff for testing people... ;-)
For clarification: It looks as if I will not have very much time during the next days to get a grip on rewriting this with alternate rows. And I agree to Michael - rows would fit in with the rest of the layout. ;-)
@Adolf and ALL: If you have any hints, please feel free to participate. :-)
Best, Matthias
Changelog in short:
Added tables
Cleaned up the code a bit, some if-queries were unnessecary (if
($cgiparams{'ACTION'} eq...)
Deleted unused lang strings (downloadiso, downloadaddon, logs)
Separated the ISO files from the IPF files for better overview.
Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl";
my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ###############################################
-if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file);
&deliver_file($file); exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadiso") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadaddon") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ###################################################
-if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" )
system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; }
-&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'});
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################
-&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'});
print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
END ; foreach (@backups){ @@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>";
}
+print <<END +</table> +END +; +&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'backups iso'});
+print <<END +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
+END +;
foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_); @@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>";
} print <<END
</table> @@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; }
-print "<table width='95%' cellspacing='0'>"; +print <<END
+<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +;
foreach (@addonincluds){ chomp($_); delete $addons{$_}; @@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024;
if ( -e $Datei ){ if ($Size < 1) {
$Size = sprintf("%.2f", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
- } else {
$Size = sprintf("%2d", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
$Size = sprintf("%.2f", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
- }
- } else {
$Size = sprintf("%2d", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
- }
print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form> </td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" />
</form> </td>
END ; } -else{
- print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>";
+else {
- print "<tr>
<td align='center'>$_</td>
<td align='center'> - </td>
<td align='center' width='50%'> - </td>
<td align='center' colspan='2'> - </td>";
}
print <<END
<td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='addonbackup' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' /> <input type='hidden' name='ADDON' value='$_' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </form> - </td></tr> + </td> +</tr> END ; + } + foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; + +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + print <<END - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" /> </form> </td> - <td align='right' width='5'></td></tr> + </tr> END ; } @@ -322,9 +402,31 @@ print "</table>";
print <<END
<table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr> + </table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',
Hi Matthias,
Sorry for slowness in coming back on the testing but I had to deal with some other things.
I had a go at testing out the patch.
First I separated the patch into individual diffs and then applied them individually on a Core Update 156 VM in my testbed. When I selected the backup menu page then I got the Internal Server Error message and in /var/log/httpd/error_log I got the following message:-
Can't use an undefined value as a symbol reference at /srv/web/ipfire/cgi-bin/backup.cgi line 85.
I then tried the same thing with a Core Update 157 VM and got the same message.
Line 85 in backup.cgi is not one of the lines modified by the diff and is the line highlighted by ** at the start of the line in the following excerpt.
--------------------------
elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename my @temp = split(/\/,$cgiparams{'UPLOAD'}); my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/".$temp[$#temp]; ** binmode $upload; while ( <$upload> ) { print UPLOADFILE; } close UPLOADFILE; system("/usr/local/bin/backupctrl restoreaddon ".$temp[$#temp]." >/dev/null 2>> }
--------------------------
I then used the combined patch diff on a Core Update 157 build branch, did a clean build and then installed the generated iso into a VM. This time I was able to get the backup page to show. Not sure what was wrong with trying it on a existing VM.
I then created a backup and I got the following truncated page:-
If I selected the backup page again I could see the whole page with tables and showing the created backup. I tried this several times, also with logs and with iso and I got the same effect. There is no message in the error_log file with the above truncated page display.
Looking at the titles for each table the use of capitals for the IPF and ISO seems a bit to "loud". How about changing it to lower case and making it .ipf and .iso - then referring to the file types being saved.
I still have to have a go at the coding to change the tables into alternate row colours. Will come back separately with how I get on with that.
Regards,
Adolf.
On 28/05/2021 17:41, Matthias Fischer wrote:
Hi,
On 26.05.2021 17:39, Matthias Fischer wrote:
This is just a diff for testing people... ;-)
For clarification: It looks as if I will not have very much time during the next days to get a grip on rewriting this with alternate rows. And I agree to Michael
- rows would fit in with the rest of the layout. ;-)
@Adolf and ALL: If you have any hints, please feel free to participate. :-)
Best, Matthias
Changelog in short:
Added tables
Cleaned up the code a bit, some if-queries were unnessecary (if
($cgiparams{'ACTION'} eq...)
Deleted unused lang strings (downloadiso, downloadaddon, logs)
Separated the ISO files from the IPF files for better overview.
Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl";
my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ###############################################
-if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file);
&deliver_file($file); exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadiso") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadaddon") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ###################################################
-if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" )
system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; }
-&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'});
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################
-&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'});
print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
- END ; foreach (@backups){
@@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>"; }
+print <<END +</table> +END +; +&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'backups iso'});
+print <<END +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
+END +;
- foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_);
@@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>"; } print <<END </table>
@@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; }
-print "<table width='95%' cellspacing='0'>"; +print <<END
+<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +;
- foreach (@addonincluds){ chomp($_); delete $addons{$_};
@@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024;
if ( -e $Datei ){ if ($Size < 1) {
$Size = sprintf("%.2f", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
- } else {
$Size = sprintf("%2d", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
$Size = sprintf("%.2f", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
- }
- } else {
$Size = sprintf("%2d", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
}
print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form> </td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" />
</form> </td> END ; }
-else{
- print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>";
+else {
- print "<tr>
<td align='center'>$_</td>
<td align='center'> - </td>
<td align='center' width='50%'> - </td>
<td align='center' colspan='2'> - </td>"; }
- print <<END
<td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='addonbackup' />
<input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' />
<input type='hidden' name='ADDON' value='$_' />
<input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' />
<input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' />
</form>
</td></tr>
</td>
+</tr> END ;
- }
- foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size);
-print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
- print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form> </td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" />
</form> </td>
<td align='right' width='5'></td></tr>
</tr> END ; }
@@ -322,9 +402,31 @@ print "</table>";
print <<END
<table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr> + </table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',
Hi everyone,
On 16/06/2021 15:16, Adolf Belka wrote:
Hi Matthias,
Sorry for slowness in coming back on the testing but I had to deal with some other things.
I had a go at testing out the patch.
First I separated the patch into individual diffs and then applied them individually on a Core Update 156 VM in my testbed. When I selected the backup menu page then I got the Internal Server Error message and in /var/log/httpd/error_log I got the following message:-
Can't use an undefined value as a symbol reference at /srv/web/ipfire/cgi-bin/backup.cgi line 85.
I then tried the same thing with a Core Update 157 VM and got the same message.
Line 85 in backup.cgi is not one of the lines modified by the diff and is the line highlighted by ** at the start of the line in the following excerpt.
elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename my @temp = split(/\/,$cgiparams{'UPLOAD'}); my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/".$temp[$#temp]; ** binmode $upload; while ( <$upload> ) { print UPLOADFILE; } close UPLOADFILE; system("/usr/local/bin/backupctrl restoreaddon ".$temp[$#temp]." >/dev/null 2>> }
I then used the combined patch diff on a Core Update 157 build branch, did a clean build and then installed the generated iso into a VM. This time I was able to get the backup page to show. Not sure what was wrong with trying it on a existing VM.
I then created a backup and I got the following truncated page:-
I placed an image here but I have realised I can not include an image in mails to the development list as it is text only. Where can I place an image so everyone can see it?
If I selected the backup page again I could see the whole page with tables and showing the created backup. I tried this several times, also with logs and with iso and I got the same effect. There is no message in the error_log file with the above truncated page display.
Looking at the titles for each table the use of capitals for the IPF and ISO seems a bit to "loud". How about changing it to lower case and making it .ipf and .iso - then referring to the file types being saved.
I still have to have a go at the coding to change the tables into alternate row colours. Will come back separately with how I get on with that.
Regards,
Adolf.
On 28/05/2021 17:41, Matthias Fischer wrote:
Hi,
On 26.05.2021 17:39, Matthias Fischer wrote:
This is just a diff for testing people... ;-)
For clarification: It looks as if I will not have very much time during the next days to get a grip on rewriting this with alternate rows. And I agree to Michael
- rows would fit in with the rest of the layout. ;-)
@Adolf and ALL: If you have any hints, please feel free to participate. :-)
Best, Matthias
Changelog in short:
Added tables
Cleaned up the code a bit, some if-queries were unnessecary (if
($cgiparams{'ACTION'} eq...)
Deleted unused lang strings (downloadiso, downloadaddon, logs)
Separated the ISO files from the IPF files for better overview.
Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl"; my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ############################################### -if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); &deliver_file($file); exit(0); -} elsif ($cgiparams{'ACTION'} eq "downloadiso") { - my $file = &sanitise_file($cgiparams{'FILE'}); - exit(1) unless defined($file);
- &deliver_file($file); - exit(0); -} elsif ($cgiparams{'ACTION'} eq "downloadaddon") { - my $file = &sanitise_file($cgiparams{'FILE'}); - exit(1) unless defined($file);
- &deliver_file($file); - exit(0); -} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ################################################### -if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" ) system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; } -&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'}); print <<END <form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################ -&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'}); print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
END ; foreach (@backups){ @@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> + </form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> + </form></td></tr>"; }
+print <<END +</table> +END +; +&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'backups iso'});
+print <<END +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
+END +;
foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_); @@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> + </form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> + </form></td></tr>"; } print <<END </table> @@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; } -print "<table width='95%' cellspacing='0'>"; +print <<END
+<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +;
foreach (@addonincluds){ chomp($_); delete $addons{$_}; @@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024; if ( -e $Datei ){ if ($Size < 1) { - $Size = sprintf("%.2f", $Size); - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; - } else { - $Size = sprintf("%2d", $Size); - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; + $Size = sprintf("%.2f", $Size); +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + </tr> - } + } else { + $Size = sprintf("%2d", $Size); +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + </tr> + } print <<END - <td align='right' width='5'>
+ <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> </form> </td> END ; } -else{ - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>";
+else {
+ print "<tr> + <td align='center'>$_</td> + <td align='center'> - </td> + <td align='center' width='50%'> - </td> + <td align='center' colspan='2'> - </td>"; }
print <<END <td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='addonbackup' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' /> <input type='hidden' name='ADDON' value='$_' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </form> - </td></tr> + </td> +</tr> END ;
}
foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>";
print <<END - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> </form> </td> - <td align='right' width='5'></td></tr> + </tr> END ; } @@ -322,9 +402,31 @@ print "</table>"; print <<END <table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr>
+<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr>
+<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr>
</table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',
Hi Adolf,
On 16.06.2021 15:20, Adolf Belka wrote:
I then created a backup and I got the following truncated page:-
I placed an image here but I have realised I can not include an image in mails to the development list as it is text only. Where can I place an image so everyone can see it? ...
I do this as an attachment.
HTH, Matthias
Hi everyone,
Now attached is the image showing the page displayed after I have clicked on do a backup. Selecting the backup page on the menu again shows the full page again with the newly created backup listed.
Regards,
Adolf.
On 16/06/2021 15:20, Adolf Belka wrote:
Hi everyone,
On 16/06/2021 15:16, Adolf Belka wrote:
Hi Matthias,
Sorry for slowness in coming back on the testing but I had to deal with some other things.
I had a go at testing out the patch.
First I separated the patch into individual diffs and then applied them individually on a Core Update 156 VM in my testbed. When I selected the backup menu page then I got the Internal Server Error message and in /var/log/httpd/error_log I got the following message:-
Can't use an undefined value as a symbol reference at /srv/web/ipfire/cgi-bin/backup.cgi line 85.
I then tried the same thing with a Core Update 157 VM and got the same message.
Line 85 in backup.cgi is not one of the lines modified by the diff and is the line highlighted by ** at the start of the line in the following excerpt.
elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename my @temp = split(/\/,$cgiparams{'UPLOAD'}); my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/".$temp[$#temp]; ** binmode $upload; while ( <$upload> ) { print UPLOADFILE; } close UPLOADFILE; system("/usr/local/bin/backupctrl restoreaddon ".$temp[$#temp]." >/dev/null 2>> }
I then used the combined patch diff on a Core Update 157 build branch, did a clean build and then installed the generated iso into a VM. This time I was able to get the backup page to show. Not sure what was wrong with trying it on a existing VM.
I then created a backup and I got the following truncated page:-
I placed an image here but I have realised I can not include an image in mails to the development list as it is text only. Where can I place an image so everyone can see it?
If I selected the backup page again I could see the whole page with tables and showing the created backup. I tried this several times, also with logs and with iso and I got the same effect. There is no message in the error_log file with the above truncated page display.
Looking at the titles for each table the use of capitals for the IPF and ISO seems a bit to "loud". How about changing it to lower case and making it .ipf and .iso - then referring to the file types being saved.
I still have to have a go at the coding to change the tables into alternate row colours. Will come back separately with how I get on with that.
Regards,
Adolf.
On 28/05/2021 17:41, Matthias Fischer wrote:
Hi,
On 26.05.2021 17:39, Matthias Fischer wrote:
This is just a diff for testing people... ;-)
For clarification: It looks as if I will not have very much time during the next days to get a grip on rewriting this with alternate rows. And I agree to Michael
- rows would fit in with the rest of the layout. ;-)
@Adolf and ALL: If you have any hints, please feel free to participate. :-)
Best, Matthias
Changelog in short:
Added tables
Cleaned up the code a bit, some if-queries were unnessecary (if
($cgiparams{'ACTION'} eq...)
Deleted unused lang strings (downloadiso, downloadaddon, logs)
Separated the ISO files from the IPF files for better overview.
Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl"; my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ############################################### -if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); &deliver_file($file); exit(0); -} elsif ($cgiparams{'ACTION'} eq "downloadiso") { - my $file = &sanitise_file($cgiparams{'FILE'}); - exit(1) unless defined($file);
- &deliver_file($file); - exit(0); -} elsif ($cgiparams{'ACTION'} eq "downloadaddon") { - my $file = &sanitise_file($cgiparams{'FILE'}); - exit(1) unless defined($file);
- &deliver_file($file); - exit(0); -} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ################################################### -if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" ) system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; } -&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'}); print <<END <form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################ -&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'}); print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
END ; foreach (@backups){ @@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> + </form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> + </form></td></tr>"; }
+print <<END +</table> +END +; +&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'backups iso'});
+print <<END +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
+END +;
foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_); @@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> + </form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> + </form></td></tr>"; } print <<END </table> @@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; } -print "<table width='95%' cellspacing='0'>"; +print <<END
+<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +;
foreach (@addonincluds){ chomp($_); delete $addons{$_}; @@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024; if ( -e $Datei ){ if ($Size < 1) { - $Size = sprintf("%.2f", $Size); - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; - } else { - $Size = sprintf("%2d", $Size); - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; + $Size = sprintf("%.2f", $Size); +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + </tr> - } + } else { + $Size = sprintf("%2d", $Size); +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + </tr> + } print <<END - <td align='right' width='5'>
+ <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> </form> </td> END ; } -else{ - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>";
+else {
+ print "<tr> + <td align='center'>$_</td> + <td align='center'> - </td> + <td align='center' width='50%'> - </td> + <td align='center' colspan='2'> - </td>"; }
print <<END <td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='addonbackup' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' /> <input type='hidden' name='ADDON' value='$_' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </form> - </td></tr> + </td> +</tr> END ;
}
foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>";
print <<END - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> </form> </td> - <td align='right' width='5'></td></tr> + </tr> END ; } @@ -322,9 +402,31 @@ print "</table>"; print <<END <table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr>
+<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr>
+<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr>
</table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',
Hi,
On 16.06.2021 19:25, Adolf Belka wrote:
Hi everyone,
Now attached is the image showing the page displayed after I have clicked on do a backup. Selecting the backup page on the menu again shows the full page again with the newly created backup listed.
Same here - but if I wait some seconds, the whole page comes back.
How long did you wait before you clicked the backup page on the menu entry again?
Here, it takes about 5 seconds and the page shows up again without doing anything.
Best, Matthias
Regards,
Adolf.
On 16/06/2021 15:20, Adolf Belka wrote:
Hi everyone,
On 16/06/2021 15:16, Adolf Belka wrote:
Hi Matthias,
Sorry for slowness in coming back on the testing but I had to deal with some other things.
I had a go at testing out the patch.
First I separated the patch into individual diffs and then applied them individually on a Core Update 156 VM in my testbed. When I selected the backup menu page then I got the Internal Server Error message and in /var/log/httpd/error_log I got the following message:-
Can't use an undefined value as a symbol reference at /srv/web/ipfire/cgi-bin/backup.cgi line 85.
I then tried the same thing with a Core Update 157 VM and got the same message.
Line 85 in backup.cgi is not one of the lines modified by the diff and is the line highlighted by ** at the start of the line in the following excerpt.
elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename my @temp = split(/\/,$cgiparams{'UPLOAD'}); my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/".$temp[$#temp]; ** binmode $upload; while ( <$upload> ) { print UPLOADFILE; } close UPLOADFILE; system("/usr/local/bin/backupctrl restoreaddon ".$temp[$#temp]." >/dev/null 2>> }
I then used the combined patch diff on a Core Update 157 build branch, did a clean build and then installed the generated iso into a VM. This time I was able to get the backup page to show. Not sure what was wrong with trying it on a existing VM.
I then created a backup and I got the following truncated page:-
I placed an image here but I have realised I can not include an image in mails to the development list as it is text only. Where can I place an image so everyone can see it?
If I selected the backup page again I could see the whole page with tables and showing the created backup. I tried this several times, also with logs and with iso and I got the same effect. There is no message in the error_log file with the above truncated page display.
Looking at the titles for each table the use of capitals for the IPF and ISO seems a bit to "loud". How about changing it to lower case and making it .ipf and .iso - then referring to the file types being saved.
I still have to have a go at the coding to change the tables into alternate row colours. Will come back separately with how I get on with that.
Regards,
Adolf.
On 28/05/2021 17:41, Matthias Fischer wrote:
Hi,
On 26.05.2021 17:39, Matthias Fischer wrote:
This is just a diff for testing people... ;-)
For clarification: It looks as if I will not have very much time during the next days to get a grip on rewriting this with alternate rows. And I agree to Michael
- rows would fit in with the rest of the layout. ;-)
@Adolf and ALL: If you have any hints, please feel free to participate. :-)
Best, Matthias
Changelog in short:
Added tables
Cleaned up the code a bit, some if-queries were unnessecary (if
($cgiparams{'ACTION'} eq...)
Deleted unused lang strings (downloadiso, downloadaddon, logs)
Separated the ISO files from the IPF files for better overview.
Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl"; my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ############################################### -if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); &deliver_file($file); exit(0); -} elsif ($cgiparams{'ACTION'} eq "downloadiso") { - my $file = &sanitise_file($cgiparams{'FILE'}); - exit(1) unless defined($file);
- &deliver_file($file); - exit(0); -} elsif ($cgiparams{'ACTION'} eq "downloadaddon") { - my $file = &sanitise_file($cgiparams{'FILE'}); - exit(1) unless defined($file);
- &deliver_file($file); - exit(0); -} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ################################################### -if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" ) system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; } -&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'}); print <<END <form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################ -&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'}); print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
END ; foreach (@backups){ @@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> + </form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> + </form></td></tr>"; }
+print <<END +</table> +END +; +&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'backups iso'});
+print <<END +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
+END +;
foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_); @@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> + </form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> + </form></td></tr>"; } print <<END </table> @@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; } -print "<table width='95%' cellspacing='0'>"; +print <<END
+<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +;
foreach (@addonincluds){ chomp($_); delete $addons{$_}; @@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024; if ( -e $Datei ){ if ($Size < 1) { - $Size = sprintf("%.2f", $Size); - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; - } else { - $Size = sprintf("%2d", $Size); - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; + $Size = sprintf("%.2f", $Size); +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + </tr> - } + } else { + $Size = sprintf("%2d", $Size); +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + </tr> + } print <<END - <td align='right' width='5'>
+ <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> </form> </td> END ; } -else{ - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>";
+else {
+ print "<tr> + <td align='center'>$_</td> + <td align='center'> - </td> + <td align='center' width='50%'> - </td> + <td align='center' colspan='2'> - </td>"; }
print <<END <td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='addonbackup' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' /> <input type='hidden' name='ADDON' value='$_' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </form> - </td></tr> + </td> +</tr> END ;
}
foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>";
print <<END - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> </form> </td> - <td align='right' width='5'></td></tr> + </tr> END ; } @@ -322,9 +402,31 @@ print "</table>"; print <<END <table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr>
+<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr>
+<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr>
</table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',
Hi Matthias,
On 16/06/2021 19:51, Matthias Fischer wrote:
Hi,
On 16.06.2021 19:25, Adolf Belka wrote:
Hi everyone,
Now attached is the image showing the page displayed after I have clicked on do a backup. Selecting the backup page on the menu again shows the full page again with the newly created backup listed.
Same here - but if I wait some seconds, the whole page comes back.
How long did you wait before you clicked the backup page on the menu entry again?
I thought I had waited longer than 5 seconds. I tried again on my VM and started a timer. After 1 minute the same page was still showing. So it doesn't come back for me. Only when I press the menu page do I get the screen back. And there is no error message in the error_log file. I will check if there is anything in the messages log and let you know if I find anything.
Regards, Adolf.
Here, it takes about 5 seconds and the page shows up again without doing anything.
Best, Matthias
Regards,
Adolf.
On 16/06/2021 15:20, Adolf Belka wrote:
Hi everyone,
On 16/06/2021 15:16, Adolf Belka wrote:
Hi Matthias,
Sorry for slowness in coming back on the testing but I had to deal with some other things.
I had a go at testing out the patch.
First I separated the patch into individual diffs and then applied them individually on a Core Update 156 VM in my testbed. When I selected the backup menu page then I got the Internal Server Error message and in /var/log/httpd/error_log I got the following message:-
Can't use an undefined value as a symbol reference at /srv/web/ipfire/cgi-bin/backup.cgi line 85.
I then tried the same thing with a Core Update 157 VM and got the same message.
Line 85 in backup.cgi is not one of the lines modified by the diff and is the line highlighted by ** at the start of the line in the following excerpt.
elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename my @temp = split(/\/,$cgiparams{'UPLOAD'}); my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/".$temp[$#temp]; ** binmode $upload; while ( <$upload> ) { print UPLOADFILE; } close UPLOADFILE; system("/usr/local/bin/backupctrl restoreaddon ".$temp[$#temp]." >/dev/null 2>> }
I then used the combined patch diff on a Core Update 157 build branch, did a clean build and then installed the generated iso into a VM. This time I was able to get the backup page to show. Not sure what was wrong with trying it on a existing VM.
I then created a backup and I got the following truncated page:-
I placed an image here but I have realised I can not include an image in mails to the development list as it is text only. Where can I place an image so everyone can see it?
If I selected the backup page again I could see the whole page with tables and showing the created backup. I tried this several times, also with logs and with iso and I got the same effect. There is no message in the error_log file with the above truncated page display.
Looking at the titles for each table the use of capitals for the IPF and ISO seems a bit to "loud". How about changing it to lower case and making it .ipf and .iso - then referring to the file types being saved.
I still have to have a go at the coding to change the tables into alternate row colours. Will come back separately with how I get on with that.
Regards,
Adolf.
On 28/05/2021 17:41, Matthias Fischer wrote:
Hi,
On 26.05.2021 17:39, Matthias Fischer wrote:
This is just a diff for testing people... ;-)
For clarification: It looks as if I will not have very much time during the next days to get a grip on rewriting this with alternate rows. And I agree to Michael
- rows would fit in with the rest of the layout. ;-)
@Adolf and ALL: If you have any hints, please feel free to participate. :-)
Best, Matthias
Changelog in short:
Added tables
Cleaned up the code a bit, some if-queries were unnessecary (if
($cgiparams{'ACTION'} eq...)
Deleted unused lang strings (downloadiso, downloadaddon, logs)
Separated the ISO files from the IPF files for better overview.
Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl"; my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ############################################### -if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); &deliver_file($file); exit(0); -} elsif ($cgiparams{'ACTION'} eq "downloadiso") { - my $file = &sanitise_file($cgiparams{'FILE'}); - exit(1) unless defined($file);
- &deliver_file($file); - exit(0); -} elsif ($cgiparams{'ACTION'} eq "downloadaddon") { - my $file = &sanitise_file($cgiparams{'FILE'}); - exit(1) unless defined($file);
- &deliver_file($file); - exit(0); -} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ################################################### -if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" ) system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; } -&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'}); print <<END <form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################ -&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'}); print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
END ; foreach (@backups){ @@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> + </form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> + </form></td></tr>"; }
+print <<END +</table> +END +; +&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'backups iso'});
+print <<END +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
+END +;
foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_); @@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> + </form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> + <input type='hidden' name='FILE' value='$_' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> + </form></td></tr>"; } print <<END </table> @@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; } -print "<table width='95%' cellspacing='0'>"; +print <<END
+<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +;
foreach (@addonincluds){ chomp($_); delete $addons{$_}; @@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024; if ( -e $Datei ){ if ($Size < 1) { - $Size = sprintf("%.2f", $Size); - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; - } else { - $Size = sprintf("%2d", $Size); - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>"; + $Size = sprintf("%.2f", $Size); +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + </tr> - } + } else { + $Size = sprintf("%2d", $Size); +print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>"; + </tr> + } print <<END - <td align='right' width='5'>
+ <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> </form> </td> END ; } -else{ - print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>";
+else {
+ print "<tr> + <td align='center'>$_</td> + <td align='center'> - </td> + <td align='center' width='50%'> - </td> + <td align='center' colspan='2'> - </td>"; }
print <<END <td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='addonbackup' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' /> <input type='hidden' name='ADDON' value='$_' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </form> - </td></tr> + </td> +</tr> END ;
}
foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+print "<tr> + <td align='center'>$_</td> + <td align='center'>".localtime($Info[9])."</td> + <td align='center'>$Size KB</td>";
print <<END - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='downloadaddon' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /> + <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form> </td> - <td align='right' width='5'> + <td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'> - <input type='hidden' name='ACTION' value='delete' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' /> - <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /> + <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" /> </form> </td> - <td align='right' width='5'></td></tr> + </tr> END ; } @@ -322,9 +402,31 @@ print "</table>"; print <<END <table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr>
+<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr>
+<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr>
</table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',
On 16.06.2021 15:16, Adolf Belka wrote:
Hi Matthias,
Sorry for slowness in coming back on the testing but I had to deal with some other things.
I had a go at testing out the patch.
First I separated the patch into individual diffs and then applied them individually on a Core Update 156 VM in my testbed. When I selected the backup menu page then I got the Internal Server Error message and in /var/log/httpd/error_log I got the following message:-
Can't use an undefined value as a symbol reference at /srv/web/ipfire/cgi-bin/backup.cgi line 85.
I fear I know what that means...
I then tried the same thing with a Core Update 157 VM and got the same message.
Yep . You're missing one or more translation strings, thats all.
Furing testing Jon and me had *exactly* the same problem. Doe is OK, but not the translations.
Make sure you've got the following translation strings in de.pl and en.pl:
de.pl: 'restoreaddon' => 'Wiederherstellen (Addon)', 'addonbackup' => 'Sichern', 'delete file' => 'Möchten Sie diese Datei wirklich löschen?', 'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'backup config' => 'Konfiguration', 'backups data' => 'IPF-Dateien', 'backups iso' => 'ISO-Dateien',
en.pl: 'restoreaddon' => 'Restore (Addon)', 'addonbackup' => 'Backup', 'delete file' => 'Do you really want to delete this file?', 'delete item' => 'Do you really want to delete this item?', 'backup config' => 'Configuration', 'backups data' => 'IPF-Files', 'backups iso' => 'ISO-Files',
Line 85 in backup.cgi is not one of the lines modified by the diff and is the line highlighted by ** at the start of the line in the following excerpt.
Yep I needed a day to find this...
elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename my @temp = split(/\/,$cgiparams{'UPLOAD'}); my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/".$temp[$#temp]; ** binmode $upload; while ( <$upload> ) { print UPLOADFILE; } close UPLOADFILE; system("/usr/local/bin/backupctrl restoreaddon ".$temp[$#temp]." >/dev/null 2>> }
I then used the combined patch diff on a Core Update 157 build branch, did a clean build and then installed the generated iso into a VM. This time I was able to get the backup page to show. Not sure what was wrong with trying it on a existing VM.
Missing translation strings. For sure.
I'll check my patches - I hope I didn't miss a string.
Best, Matthias
I then created a backup and I got the following truncated page:-
If I selected the backup page again I could see the whole page with tables and showing the created backup. I tried this several times, also with logs and with iso and I got the same effect. There is no message in the error_log file with the above truncated page display.
Looking at the titles for each table the use of capitals for the IPF and ISO seems a bit to "loud". How about changing it to lower case and making it .ipf and .iso - then referring to the file types being saved.
I still have to have a go at the coding to change the tables into alternate row colours. Will come back separately with how I get on with that.
Regards,
Adolf.
On 28/05/2021 17:41, Matthias Fischer wrote:
Hi,
On 26.05.2021 17:39, Matthias Fischer wrote:
This is just a diff for testing people... ;-)
For clarification: It looks as if I will not have very much time during the next days to get a grip on rewriting this with alternate rows. And I agree to Michael
- rows would fit in with the rest of the layout. ;-)
@Adolf and ALL: If you have any hints, please feel free to participate. :-)
Best, Matthias
Changelog in short:
Added tables
Cleaned up the code a bit, some if-queries were unnessecary (if
($cgiparams{'ACTION'} eq...)
Deleted unused lang strings (downloadiso, downloadaddon, logs)
Separated the ISO files from the IPF files for better overview.
Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl";
my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ###############################################
-if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file);
&deliver_file($file); exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadiso") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadaddon") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ###################################################
-if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" )
system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; }
-&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'});
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################
-&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'});
print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
- END ; foreach (@backups){
@@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>"; }
+print <<END +</table> +END +; +&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'backups iso'});
+print <<END +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
+END +;
- foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_);
@@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>"; } print <<END </table>
@@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; }
-print "<table width='95%' cellspacing='0'>"; +print <<END
+<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +;
- foreach (@addonincluds){ chomp($_); delete $addons{$_};
@@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024;
if ( -e $Datei ){ if ($Size < 1) {
$Size = sprintf("%.2f", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
- } else {
$Size = sprintf("%2d", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
$Size = sprintf("%.2f", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
- }
- } else {
$Size = sprintf("%2d", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
}
print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form> </td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" />
</form> </td> END ; }
-else{
- print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>";
+else {
- print "<tr>
<td align='center'>$_</td>
<td align='center'> - </td>
<td align='center' width='50%'> - </td>
<td align='center' colspan='2'> - </td>"; }
- print <<END
<td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='addonbackup' />
<input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' />
<input type='hidden' name='ADDON' value='$_' />
<input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' />
<input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' />
</form>
</td></tr>
</td>
+</tr> END ;
- }
- foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size);
-print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
- print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form> </td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" />
</form> </td>
<td align='right' width='5'></td></tr>
</tr> END ; }
@@ -322,9 +402,31 @@ print "</table>";
print <<END
<table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr> + </table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',
Hi,
On 16.06.2021 17:34, Matthias Fischer wrote:
Can't use an undefined value as a symbol reference at /srv/web/ipfire/cgi-bin/backup.cgi line 85.
I fear I know what that means...
I then tried the same thing with a Core Update 157 VM and got the same message.
Yep . You're missing one or more translation strings, thats all.
Furing testing Jon and me had *exactly* the same problem. Doe is OK, but not the translations.
Sorry, this sentence above couldn't live or die... ;-)
I meant that the GUI-CODE is ok, but NOT the translations.
Make sure you've got the following translation strings in de.pl and en.pl: ...
I hope this is not too much, but because it just came my way again:
I'm still wondering if this code could be "activated" (*one* line):
... sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();} ...
This subroutine exists in 'backup.cgi', but is never used. And I don't know how to implement it the best way.
Perhaps "someone" - ;-) - has an idea!?
Regards, Matthias
Hi Matthias,
On 16/06/2021 17:34, Matthias Fischer wrote:
On 16.06.2021 15:16, Adolf Belka wrote:
Hi Matthias,
Sorry for slowness in coming back on the testing but I had to deal with some other things.
I had a go at testing out the patch.
First I separated the patch into individual diffs and then applied them individually on a Core Update 156 VM in my testbed. When I selected the backup menu page then I got the Internal Server Error message and in /var/log/httpd/error_log I got the following message:-
Can't use an undefined value as a symbol reference at /srv/web/ipfire/cgi-bin/backup.cgi line 85.
I fear I know what that means...
I then tried the same thing with a Core Update 157 VM and got the same message.
Yep . You're missing one or more translation strings, thats all.
Furing testing Jon and me had *exactly* the same problem. Doe is OK, but not the translations.
Make sure you've got the following translation strings in de.pl and en.pl:
de.pl: 'restoreaddon' => 'Wiederherstellen (Addon)', 'addonbackup' => 'Sichern', 'delete file' => 'Möchten Sie diese Datei wirklich löschen?', 'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'backup config' => 'Konfiguration', 'backups data' => 'IPF-Dateien', 'backups iso' => 'ISO-Dateien',
en.pl: 'restoreaddon' => 'Restore (Addon)', 'addonbackup' => 'Backup', 'delete file' => 'Do you really want to delete this file?', 'delete item' => 'Do you really want to delete this item?', 'backup config' => 'Configuration', 'backups data' => 'IPF-Files', 'backups iso' => 'ISO-Files',
All of those entries are in the individual diffs that I created. I suspect that maybe not all the hunks got correctly applied because the original git patch worked on my build branch. I will check more closely next time I try using the separate diffs.
Thanks, Adolf
Line 85 in backup.cgi is not one of the lines modified by the diff and is the line highlighted by ** at the start of the line in the following excerpt.
Yep I needed a day to find this...
elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename my @temp = split(/\/,$cgiparams{'UPLOAD'}); my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/".$temp[$#temp]; ** binmode $upload; while ( <$upload> ) { print UPLOADFILE; } close UPLOADFILE; system("/usr/local/bin/backupctrl restoreaddon ".$temp[$#temp]." >/dev/null 2>> }
I then used the combined patch diff on a Core Update 157 build branch, did a clean build and then installed the generated iso into a VM. This time I was able to get the backup page to show. Not sure what was wrong with trying it on a existing VM.
Missing translation strings. For sure.
I'll check my patches - I hope I didn't miss a string.
Best, Matthias
I then created a backup and I got the following truncated page:-
If I selected the backup page again I could see the whole page with tables and showing the created backup. I tried this several times, also with logs and with iso and I got the same effect. There is no message in the error_log file with the above truncated page display.
Looking at the titles for each table the use of capitals for the IPF and ISO seems a bit to "loud". How about changing it to lower case and making it .ipf and .iso - then referring to the file types being saved.
I still have to have a go at the coding to change the tables into alternate row colours. Will come back separately with how I get on with that.
Regards,
Adolf.
On 28/05/2021 17:41, Matthias Fischer wrote:
Hi,
On 26.05.2021 17:39, Matthias Fischer wrote:
This is just a diff for testing people... ;-)
For clarification: It looks as if I will not have very much time during the next days to get a grip on rewriting this with alternate rows. And I agree to Michael
- rows would fit in with the rest of the layout. ;-)
@Adolf and ALL: If you have any hints, please feel free to participate. :-)
Best, Matthias
Changelog in short:
Added tables
Cleaned up the code a bit, some if-queries were unnessecary (if
($cgiparams{'ACTION'} eq...)
Deleted unused lang strings (downloadiso, downloadaddon, logs)
Separated the ISO files from the IPF files for better overview.
Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl";
my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ###############################################
-if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file);
&deliver_file($file); exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadiso") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadaddon") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ###################################################
-if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" )
system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1");
} -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; }
-&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'});
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################
-&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'});
print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
- END ; foreach (@backups){
@@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>"; }
+print <<END +</table> +END +; +&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'backups iso'});
+print <<END +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
+END +;
- foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_);
@@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>"; } print <<END </table>
@@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; }
-print "<table width='95%' cellspacing='0'>"; +print <<END
+<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +;
- foreach (@addonincluds){ chomp($_); delete $addons{$_};
@@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024;
if ( -e $Datei ){ if ($Size < 1) {
$Size = sprintf("%.2f", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
- } else {
$Size = sprintf("%2d", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
$Size = sprintf("%.2f", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
- }
- } else {
$Size = sprintf("%2d", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
}
print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form>
</td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" /> </form>
</td> END ; }
-else{
- print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>";
+else {
- print "<tr>
<td align='center'>$_</td>
<td align='center'> - </td>
<td align='center' width='50%'> - </td>
<td align='center' colspan='2'> - </td>"; }
- print <<END
<td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='addonbackup' />
<input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' /> <input type='hidden' name='ADDON' value='$_' />
<input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' />
<input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </form>
</td></tr>
</td>
+</tr> END ;
- }
- foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size);
-print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
- print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' /> <input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' /> </form>
</td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' /> <input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" /> </form>
</td>
<td align='right' width='5'></td></tr>
</tr> END ; }
@@ -322,9 +402,31 @@ print "</table>";
print <<END
<table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr> + </table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',
Hi Matthias,
On 28/05/2021 17:41, Matthias Fischer wrote:
Hi,
On 26.05.2021 17:39, Matthias Fischer wrote:
This is just a diff for testing people... ;-)
For clarification: It looks as if I will not have very much time during the next days to get a grip on rewriting this with alternate rows. And I agree to Michael
- rows would fit in with the rest of the layout. ;-)
@Adolf and ALL: If you have any hints, please feel free to participate. :-)
I haven't forgotten about this. I have been working on a bug related to the dhcp.cgi page and found that the bgcolor tags were not all working. Turns out that tag has been deprecated and it is even stated that it does not work with HTML5.
So I have been working to convert all those tags on the dhcp.cgi page to CSS using Leo's example from his zoneinfo.cgi work and some reading up about CSS.
I have now got that working successfully on my dhcp.cgi page. Next need to finish the bug part, I know how I want it to work, and when that is done and the bug fix submitted as a patch, then I will use the new CSS approach to also apply to your backup.cgi page to get the colour coded alternate lines.
Regards,
Adolf.
Best, Matthias
Changelog in short:
Added tables
Cleaned up the code a bit, some if-queries were unnessecary (if
($cgiparams{'ACTION'} eq...)
Deleted unused lang strings (downloadiso, downloadaddon, logs)
Separated the ISO files from the IPF files for better overview.
Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl";
my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ###############################################
-if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file);
&deliver_file($file); exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadiso") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadaddon") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ###################################################
-if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" )
system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; }
-&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'});
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################
-&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'});
print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
- END ; foreach (@backups){
@@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>"; }
+print <<END +</table> +END +; +&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'backups iso'});
+print <<END +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
+END +;
- foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_);
@@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>"; } print <<END </table>
@@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; }
-print "<table width='95%' cellspacing='0'>"; +print <<END
+<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +;
- foreach (@addonincluds){ chomp($_); delete $addons{$_};
@@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024;
if ( -e $Datei ){ if ($Size < 1) {
$Size = sprintf("%.2f", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
- } else {
$Size = sprintf("%2d", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
$Size = sprintf("%.2f", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
- }
- } else {
$Size = sprintf("%2d", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
}
print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form> </td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" />
</form> </td> END ; }
-else{
- print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>";
+else {
- print "<tr>
<td align='center'>$_</td>
<td align='center'> - </td>
<td align='center' width='50%'> - </td>
<td align='center' colspan='2'> - </td>"; }
- print <<END
<td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='addonbackup' />
<input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' />
<input type='hidden' name='ADDON' value='$_' />
<input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' />
<input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' />
</form>
</td></tr>
</td>
+</tr> END ;
- }
- foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size);
-print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
- print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form> </td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" />
</form> </td>
<td align='right' width='5'></td></tr>
</tr> END ; }
@@ -322,9 +402,31 @@ print "</table>";
print <<END
<table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr> + </table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',
On 10.07.2021 14:34, Adolf Belka wrote:
Hi Matthias,
Hi Adolf,
On 28/05/2021 17:41, Matthias Fischer wrote:
Hi,
On 26.05.2021 17:39, Matthias Fischer wrote:
This is just a diff for testing people... ;-)
For clarification: It looks as if I will not have very much time during the next days to get a grip on rewriting this with alternate rows. And I agree to Michael
- rows would fit in with the rest of the layout. ;-)
@Adolf and ALL: If you have any hints, please feel free to participate. :-)
I haven't forgotten about this. I have been working on a bug related to the dhcp.cgi page and found that the bgcolor tags were not all working. Turns out that tag has been deprecated and it is even stated that it does not work with HTML5.
Software... ;-)
So I have been working to convert all those tags on the dhcp.cgi page to CSS using Leo's example from his zoneinfo.cgi work and some reading up about CSS.
I have now got that working successfully on my dhcp.cgi page. Next need to finish the bug part, I know how I want it to work, and when that is done and the bug fix submitted as a patch, then I will use the new CSS approach to also apply to your backup.cgi page to get the colour coded alternate lines.
Good news- thanks for the feedback!
It happened as I thought - work once again leaves me almost no time for anything else. Take your time...
Best, Matthias
Regards,
Adolf.
Best, Matthias
Changelog in short:
Added tables
Cleaned up the code a bit, some if-queries were unnessecary (if
($cgiparams{'ACTION'} eq...)
Deleted unused lang strings (downloadiso, downloadaddon, logs)
Separated the ISO files from the IPF files for better overview.
Added query for deleting a backup file (onclick="return confirm...)
ToDo: Change table layout to alternating rows. If "someone" has some hints how to do this, I'll be grateful.
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
html/cgi-bin/backup.cgi | 218 +++++++++++++++++++++++++++++----------- langs/de/cgi-bin/de.pl | 8 +- langs/en/cgi-bin/en.pl | 8 +- langs/es/cgi-bin/es.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - langs/it/cgi-bin/it.pl | 1 - langs/nl/cgi-bin/nl.pl | 1 - langs/pl/cgi-bin/pl.pl | 1 - langs/ru/cgi-bin/ru.pl | 1 - langs/tr/cgi-bin/tr.pl | 1 - 10 files changed, 174 insertions(+), 67 deletions(-)
diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index 683f8add4..04473428c 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -32,7 +32,7 @@ require "${General::swroot}/header.pl";
my %color = (); my %mainsettings = (); -my %cgiparams=(); +my %cgiparams = (); my %checked = (); my $message = ""; my $errormessage = ""; @@ -59,25 +59,13 @@ system("/usr/local/bin/backupctrl makedirs >/dev/null 2>&1 ") unless ( -e '/var/ ############################################################################################################################ ############################################## System calls ohne Http Header ###############################################
-if ($cgiparams{'ACTION'} eq "download") { +if ($cgiparams{'ACTION'} eq "$Lang::tr{'download'}") { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file);
&deliver_file($file); exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadiso") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ($cgiparams{'ACTION'} eq "downloadaddon") {
my $file = &sanitise_file($cgiparams{'FILE'});
exit(1) unless defined($file);
&deliver_file($file);
exit(0);
-} elsif ( $cgiparams{'ACTION'} eq "restore") { +} elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restore'}") { my $upload = $a->param("UPLOAD"); open UPLOADFILE, ">/tmp/restore.ipf"; binmode $upload; @@ -87,7 +75,7 @@ if ($cgiparams{'ACTION'} eq "download") { close UPLOADFILE; system("/usr/local/bin/backupctrl restore >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "restoreaddon" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'restoreaddon'}" ) { chomp($cgiparams{'UPLOAD'}); # we need to fix cause IE7 gives the full path and FF only the filename @@ -112,7 +100,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont ############################################################################################################################ ################################################### Default System calls ###################################################
-if ( $cgiparams{'ACTION'} eq "backup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'backup'}" ) { if ( $cgiparams{'BACKUPLOGS'} eq "include" ) { system("/usr/local/bin/backupctrl include >/dev/null 2>&1"); @@ -122,7 +110,7 @@ if ( $cgiparams{'ACTION'} eq "backup" ) system("/usr/local/bin/backupctrl iso >/dev/null 2>&1"); } } -if ( $cgiparams{'ACTION'} eq "addonbackup" ) +if ( $cgiparams{'ACTION'} eq "$Lang::tr{'addonbackup'}" ) { # Exit if there is any dots or slashes in the addon name exit(1) if ($cgiparams{'ADDON'} =~ /(.|/)/); @@ -132,7 +120,7 @@ if ( $cgiparams{'ACTION'} eq "addonbackup" )
system("/usr/local/bin/backupctrl addonbackup $cgiparams{'ADDON'} >/dev/null 2>&1"); } -elsif ( $cgiparams{'ACTION'} eq "delete" ) +elsif ( $cgiparams{'ACTION'} eq "$Lang::tr{'delete'}" ) { my $file = &sanitise_file($cgiparams{'FILE'}); exit(1) unless defined($file); @@ -157,13 +145,13 @@ if ( -e "/var/tmp/backupiso/" ){ @backupisos = `cd /var/tmp/backupiso/ && ls *.iso 2>/dev/null`; }
-&Header::openbox('100%', 'center', ); +&Header::openbox('100%', 'center', $Lang::tr{'backup config'});
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'> <table width='95%' cellspacing='0'> <tr> - <td align='left' width='40%'>$Lang::tr{'logs'}</td> + <td align='center' width='45%'></td> <td align='left'> <input type='radio' name='BACKUPLOGS' value='include'/> $Lang::tr{'include logfiles'}<br/> <input type='radio' name='BACKUPLOGS' value='exclude' checked='checked'/> $Lang::tr{'exclude logfiles'}<br/> @@ -177,8 +165,8 @@ print <<END </td> </tr> <tr><td align='center' colspan='2'> - <input type='hidden' name='ACTION' value='backup' /> - <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' /> + <input type='hidden' name='ACTION' value='$Lang::tr{'backup'}' /> + <input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' /> </td></tr> </table> </form> @@ -189,10 +177,17 @@ END ############################################################################################################################ ############################################ Backups des Systems downloaden ################################################
-&Header::openbox('100%', 'center', $Lang::tr{'backups'}); +&Header::openbox('100%', 'center', $Lang::tr{'backups data'});
print <<END -<table width='95%' cellspacing='0'> +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
- END ; foreach (@backups){
@@ -202,9 +197,44 @@ my $Datei = "/var/ipfire/backup/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='download' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>"; }
+print <<END +</table> +END +; +&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'backups iso'});
+print <<END +<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='40%'>$Lang::tr{'filename'}</th> +<th>$Lang::tr{'size'}</th> +<th colspan='2'>$Lang::tr{'action'}</th> +</tr>
+END +;
- foreach (@backupisos){ if ( $_ !~ /iso$/){next;} chomp($_);
@@ -212,8 +242,22 @@ my $Datei = "/var/tmp/backupiso/".$_; my @Info = stat($Datei); my $Size = $Info[7] / 1024 / 1024; $Size = sprintf("%0.2f", $Size); -print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size MB</td><td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='downloadiso' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' /></form></td>"; -print "<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='delete' /><input type='hidden' name='FILE' value='$_' /><input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' /></form></td></tr>";
+print "<tr> +<td align='center' width='40%'>$_</td> +<td align='center'>$Size MB</td> +<td width='5'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form></td>";
+print "<td width='5'> +<form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_' />
- <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick="return confirm('$Lang::tr{'delete file'}');" />
</form></td></tr>"; } print <<END </table>
@@ -235,7 +279,19 @@ foreach (@addons){ $addons{$addon}=''; }
-print "<table width='95%' cellspacing='0'>"; +print <<END
+<table width='95%' cellspacing='0' border='1'>
+<tr> +<th width='20%'>$Lang::tr{'name'}</th> +<th width='20%'>$Lang::tr{'date'}</th> +<th>$Lang::tr{'size'}</th> +<th align='center' colspan='3'>$Lang::tr{'action'}</th> +</tr> +END +;
- foreach (@addonincluds){ chomp($_); delete $addons{$_};
@@ -245,69 +301,93 @@ my $Size = $Info[7] / 1024;
if ( -e $Datei ){ if ($Size < 1) {
$Size = sprintf("%.2f", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
- } else {
$Size = sprintf("%2d", $Size);
print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
$Size = sprintf("%.2f", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
- }
- } else {
$Size = sprintf("%2d", $Size);
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
</tr>
}
print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form> </td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" />
</form> </td> END ; }
-else{
- print "<tr><td align='center'>$Lang::tr{'backup from'} $_ </td><td width='5' align='right'></td><td width='5' align='right'></td>";
+else {
- print "<tr>
<td align='center'>$_</td>
<td align='center'> - </td>
<td align='center' width='50%'> - </td>
<td align='center' colspan='2'> - </td>"; }
- print <<END
<td align='right' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='addonbackup' />
<input type='hidden' name='ACTION' value='$Lang::tr{'addonbackup'}' />
<input type='hidden' name='ADDON' value='$_' />
<input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/document-save.png' />
<input type='image' alt='$Lang::tr{'backup'}' title='$Lang::tr{'backup'}' src='/images/floppy.gif' />
</form>
</td></tr>
</td>
+</tr> END ;
- }
- foreach (keys(%addons)){ chomp($_); my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf"; my @Info = stat($Datei); my $Size = $Info[7] / 1024; $Size = sprintf("%2d", $Size);
-print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+print "<tr>
<td align='center'>$_</td>
<td align='center'>".localtime($Info[9])."</td>
<td align='center'>$Size KB</td>";
- print <<END
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='downloadaddon' />
<input type='hidden' name='ACTION' value='$Lang::tr{'download'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/package-x-generic.png' />
<input type='image' alt='$Lang::tr{'download'}' title='$Lang::tr{'download'}' src='/images/go-bottom.png' />
</form> </td>
<td align='right' width='5'>
<td align='center' width='5'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='delete' />
<input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
<input type='hidden' name='FILE' value='$_.ipf' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' onclick=\"return confirm('$Lang::tr{'delete file'}');\" />
</form> </td>
<td align='right' width='5'></td></tr>
</tr> END ; }
@@ -322,9 +402,31 @@ print "</table>";
print <<END
<table width='95%' cellspacing='0'> -<tr><td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td></tr> -<tr><td align='left'>$Lang::tr{'backup'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restore' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> -<tr><td align='left'>$Lang::tr{'backupaddon'}</td><td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'><input type="file" size='50' name="UPLOAD" /><input type='hidden' name='ACTION' value='restoreaddon' /><input type='hidden' name='FILE' /><input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/media-floppy.png' /></form></td></tr> +<tr> + <td align='center' colspan='2'><font color='red'><br />$Lang::tr{'backupwarning'}</font><br /><br /></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backup'}</td> + <td align='left'> + <form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restore'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restore'}' title='$Lang::tr{'restore'}' src='/images/go-top.png' /> + </form></td> +</tr> + +<tr> + <td align='center'>$Lang::tr{'backupaddon'}</td> + <td align='left'><form method='post' enctype='multipart/form-data' action='$ENV{'SCRIPT_NAME'}'> + <input type="file" size='50' name="UPLOAD" /> + <input type='hidden' name='ACTION' value='$Lang::tr{'restoreaddon'}' /> + <input type='hidden' name='FILE' /> + <input type='image' alt='$Lang::tr{'restoreaddon'}' title='$Lang::tr{'restoreaddon'}' src='/images/go-top.png' /> + </form></td> +</tr> + </table> END ; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 95af3155b..37f0cab8a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -158,6 +158,7 @@ 'add-route' => 'Zusätzlich zu propagierende Route', 'added from dhcp lease list' => 'hinzugefügt von der DHCP-Zuordnungsliste', 'addon' => 'Add-Ons', +'addonbackup' => 'Sichern', 'addons' => 'Add-Ons', 'admin user password has been changed' => 'Passwort für Benutzer admin wurde geändert.', 'admin users' => 'Liste der Benutzer mit Super User Rechten', @@ -470,8 +471,11 @@ 'backup sets' => 'Datensicherungssätze', 'backup to floppy' => 'Datensicherung auf Diskette', 'backupaddon' => 'Add-On-Sicherung', +'backup config' => 'Konfiguration', 'backupprofile' => 'Falls die Wiederverbindung scheitert, auf dieses Profil umschalten', 'backups' => 'Sicherungen', +'backups data' => 'IPF-Dateien', +'backups iso' => 'ISO-Dateien', 'backupwarning' => 'Spielen Sie zuerst Ihre Hauptsicherung und anschließend die Sicherung(en) der Addon-Konfiguration(en) ein.<br />Es werden lediglich die gesicherten Konfigurationsdatei(en) der Addons, nicht die installierten Addons wiederhergestellt!<br />Achten Sie außerdem darauf, dass die Sicherungen ihre originalen Dateinamen behalten.', 'bad characters in' => 'Ungültige Zeichen in ', 'bad characters in script field' => 'Nicht erlaubte Zeichen im Skriptnamen', @@ -735,6 +739,8 @@ 'defaultwarning' => 'ACHTUNG - Ihre Einstellungen gehen hiermit verloren und werden durch die Standarteinstellungen ersetzt.', 'delete' => 'Löschen', 'delete cron' => 'Cronjob löschen', +'delete file' => 'Möchten Sie diese Datei wirklich löschen?', +'delete item' => 'Möchten Sie diesen Eintrag wirklich löschen?', 'delete pc' => 'PC löschen', 'delete share' => 'Freigabe löschen', 'delete user' => 'Benutzer löschen', @@ -1600,7 +1606,6 @@ 'logging' => 'Protokollierung', 'logging server' => 'Protokollierungsserver', 'loginlogout' => 'Login/Logout', -'logs' => 'Protokolldateien', 'loosedirectorychecking' => 'Loose directorychecking', 'low' => 'Niedrig', 'ls_dhcpd' => 'DHCP-Server:', @@ -2136,6 +2141,7 @@ 'restart' => 'Neustart', 'restart ovpn server' => 'OpenVPN-Server neu starten', 'restore' => 'Wiederherstellen', +'restoreaddon' => 'Wiederherstellen (Addon)', 'restore defaults' => 'Voreinstellungen wiederherstellen', 'restore hardware settings' => 'Hardwareeinstellungen wiederherstellen', 'restore settings' => 'Einstellungen wiederherstellen', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d86705772..a126b11ef 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -155,6 +155,7 @@ 'add xtaccess' => 'Add External Access', 'add-route' => 'Additional push route', 'added from dhcp lease list' => 'Added from DHCP lease list', +'addonbackup' => 'Backup', 'addons' => 'Addons', 'admin user password has been changed' => 'Admin user password has been changed.', 'admin users' => 'User with superuser rights', @@ -459,6 +460,7 @@ 'backup' => 'Backup', 'backup archive' => 'Backup File (.dat)', 'backup clear archive' => 'Clear Backup File (.gz)', +'backup config' => 'Configuration', 'backup config floppy' => 'Backup Configuration - Floppy Disk', 'backup configuration' => 'Backup Configuration:', 'backup erase key' => 'Erase key', @@ -486,6 +488,8 @@ 'backupaddon' => 'Addon Backup', 'backupprofile' => 'In case reconnection fails, switch to profile', 'backups' => 'backups', +'backups data' => 'IPF-Files', +'backups iso' => 'ISO-Files', 'backupwarning' => 'Import your main backup first and then the backup(s) of the addon configuration(s).<br />Only the backed up addon configuration file(s) will be restored, not the installed addons!<br />Also make sure that the backups keep their original file names.', 'bad characters in' => 'Bad characters in ', 'bad characters in script field' => 'Bad characters in script field', @@ -755,6 +759,8 @@ 'delete pc' => 'Delete workstation', 'delete share' => 'Delete share', 'delete user' => 'Delete user', +'delete file' => 'Do you really want to delete this file?', +'delete item' => 'Do you really want to delete this item?', 'demon login script' => 'Demon login script', 'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!', 'description' => 'Description', @@ -1632,7 +1638,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP Server:', @@ -2172,6 +2177,7 @@ 'restart' => 'Restart', 'restart ovpn server' => 'Restart OpenVPN server', 'restore' => 'Restore', +'restoreaddon' => 'Restore (Addon)', 'restore defaults' => 'Restore defaults', 'restore hardware settings' => 'Restore hardware settings', 'restore settings' => 'Reset Settings', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index c9a7496bc..fa346233f 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -1149,7 +1149,6 @@ 'logging' => 'Conectando', 'logging server' => 'Servidor de conexión', 'loginlogout' => 'Login/Logout', -'logs' => 'registros', 'loosedirectorychecking' => 'Chequeo de loosedirectory', 'low' => 'Bajo', 'ls_dhcpd' => 'Servidor DHCP:', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 301109477..ea5985315 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1633,7 +1633,6 @@ 'logging' => 'Connexion', 'logging server' => 'Serveur de connexion', 'loginlogout' => 'Connexion/Quitter', -'logs' => 'Journaux', 'loosedirectorychecking' => 'Echec de la vérification du répertoire', 'low' => 'Bas', 'ls_dhcpd' => 'Serveur DHCP :', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index e82ecfd35..711b4bd4a 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -1408,7 +1408,6 @@ 'logging' => 'Logging', 'logging server' => 'Logging Server', 'loginlogout' => 'Login/Logout', -'logs' => 'Gestione Log', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Basso', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 55927839e..aea5e81b5 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1390,7 +1390,6 @@ 'logging' => 'Logging', 'logging server' => 'Loggingserver', 'loginlogout' => 'Login/Logout', -'logs' => 'logs', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Laag', 'ls_dhcpd' => 'DHCP Server:', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 147db051c..604a834a7 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -1094,7 +1094,6 @@ 'logging' => 'Logowanie', 'logging server' => 'Serwer logowania', 'loginlogout' => 'Zalogowanie/wylogowanie', -'logs' => 'logi', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Niski', 'ls_dhcpd' => 'Serwer DHCP:', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 0d986135d..26ad6c338 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -1087,7 +1087,6 @@ 'logging' => 'Logging', 'logging server' => 'Сервер Логов', 'loginlogout' => 'Login/Logout', -'logs' => 'Логи', 'loosedirectorychecking' => 'Loosedirectorychecking', 'low' => 'Low', 'ls_dhcpd' => 'DHCP сервер:', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 36c4782d6..233de0995 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -1538,7 +1538,6 @@ 'logging' => 'Günlük', 'logging server' => 'Günlük Sunucusu', 'loginlogout' => 'Giriş/Çıkış', -'logs' => 'Günlükler', 'loosedirectorychecking' => 'Serbest Dizin Denetimi', 'low' => 'Düşük', 'ls_dhcpd' => 'DHCP Sunucusu:',