diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php index 38f52871..40859d5c 100644 --- a/bl-kernel/functions.php +++ b/bl-kernel/functions.php @@ -872,4 +872,18 @@ function transformImage($file, $imageDir, $thumbnailDir=false) { } return $image; -} \ No newline at end of file +} + +function downloadRestrictedFile($file) { + if (is_file($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(0); + } +} diff --git a/bl-plugins/backup/plugin.php b/bl-plugins/backup/plugin.php index a7964a1a..0d6f7064 100644 --- a/bl-plugins/backup/plugin.php +++ b/bl-plugins/backup/plugin.php @@ -36,8 +36,13 @@ class pluginBackup extends Plugin { public function adminSidebar() { - $backups = $this->backupList(); - return 'Backups '.count($backups).''; + global $login; + if ($login->role() === 'admin') { + $backups = $this->backupList(); + return 'Backups '.count($backups).''; + } else { + return ''; + } } public function form() @@ -66,7 +71,7 @@ class pluginBackup extends Plugin { $html .= '