first commit
This commit is contained in:
66
autoload/admin/controls/class.Backups.php
Normal file
66
autoload/admin/controls/class.Backups.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace admin\controls;
|
||||
|
||||
class Backups
|
||||
{
|
||||
public static function download_restore_file()
|
||||
{
|
||||
$file = '../restore.php';
|
||||
if ( file_exists( $file ) )
|
||||
{
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="'.basename($file).'"');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize( $file ) );
|
||||
readfile( $file );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public static function view_list()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'backups_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
return \admin\view\Backups::backups_list(
|
||||
\admin\factory\Backups::backups_list()
|
||||
);
|
||||
}
|
||||
|
||||
public static function backup_save()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'backups_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = 'Podczas tworzenia kopi zapasowej wystąpił błąd. Proszę spróbować ponownie.';
|
||||
if ( \admin\factory\Backups::backup_save() )
|
||||
\S::alert( 'Kopia zapasowa został utworzona.' );
|
||||
|
||||
header( 'Location: /admin/backups/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function backup_delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ( !\admin\factory\Users::check_privileges( 'backups_administration', $user['id'] ) )
|
||||
return \S::alert( 'Nie masz uprawnień' );
|
||||
|
||||
$response = 'Podczas usuwania kopi zapasowej wystąpił błąd. Proszę spróbować ponownie.';
|
||||
if ( \admin\factory\Backups::backup_delete( \S::get( 'name' ) ) )
|
||||
\S::alert( 'Kopia zapasowa został usunięta.' );
|
||||
|
||||
header( 'Location: /admin/backups/view_list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user