Fixed bug in set_company_pref()
[fa-stable.git] / admin / backups.php
index 8f17158ff6dcc7e529f52da83fca1f76747e1be7..2193486ba9210d22bf8f5dc0add07e2e5874fa1b 100644 (file)
@@ -133,6 +133,7 @@ if (get_post('creat')) {
 if (get_post('restore')) {
        if (db_import($backup_path, $conn))
                display_notification(_("Restore backup completed."));
+       refresh_sys_prefs(); // re-read system setup
 }
 
 if (get_post('deldump')) {
@@ -148,9 +149,9 @@ if (get_post('deldump')) {
 if (get_post('upload'))
 {
        $tmpname = $_FILES['uploadfile']['tmp_name'];
-       $fname = clean_file_name($_FILES['uploadfile']['name']);
+       $fname = trim(basename($_FILES['uploadfile']['name']));
 
-       if (!preg_match("/.sql(.zip|.gz)?$/", $fname))
+       if (!preg_match("/\.sql(\.zip|\.gz)?$/", $fname))
                display_error(_("You can only upload *.sql backup files"));
        elseif (is_uploaded_file($tmpname)) {
                rename($tmpname, BACKUP_PATH . $fname);