diff --git a/index.php b/index.php index c848935..a718cc6 100644 --- a/index.php +++ b/index.php @@ -4,7 +4,7 @@ * Define constant for the current version */ -define('CURRENT_VERSION', 'v1.1.1'); +define('CURRENT_VERSION', 'v1.1.2'); /******************************************************************************/ @@ -23,7 +23,6 @@ 'palevioletred', 'peru', 'purple', 'rebeccapurple', 'red', 'seagreen', 'sienna', 'slategray', 'steelblue', 'teal', 'tomato' ]; -$current_dir = getcwd(); $green = '#28a745'; $latest_version = get_latest_release( $api_url, @@ -34,7 +33,7 @@ $random_color = $colors[array_rand($colors)]; $red = '#dc3545'; $release_url = 'https://github.com/dynamiccookies/Simple-Backup-Utility/releases/tag/$latest_version'; -$sibling_folders = get_sibling_folders($current_dir); +$sibling_folders = get_sibling_folders(__DIR__); $version_message = compare_versions( CURRENT_VERSION, $latest_version, @@ -119,7 +118,7 @@ function delete_backup_folder($delete_folder) { } $files = array_diff(scandir($delete_folder), array('.', '..')); foreach ($files as $file) { - $path = $folder . '/' . $file; + $path = $delete_folder . '/' . $file; is_dir($path) ? delete_backup_folder($path) : unlink($path); } @@ -317,7 +316,7 @@ function show_message($message_text) { } elseif (isset($_POST['delete'])) { // Construct the path to the folder and attempt to delete it - if (delete_backup_folder($current_dir . '/' . $_POST['delete'])) { + if (delete_backup_folder(__DIR__ . '/' . $_POST['delete'])) { // Set success message if deletion is successful $message_color = $green; @@ -365,6 +364,8 @@ function show_message($message_text) { } } +// Set $backup_folders after folder backup or delete +$backup_folders = get_backup_folders(__DIR__); /******************************************************************************/ ?> @@ -415,7 +416,7 @@ function show_message($message_text) { gap: 10px; margin-bottom: 20px; } - button.backup, .message { + button.backup { box-shadow: 0 8px 8px 1px rgba(0, 0, 0, .2); font-weight: bold; } @@ -432,6 +433,37 @@ function show_message($message_text) { button:hover { background-color: #0056b3; } + .checkbox-columns { + display: flex; + gap: 20px; + text-align: left; + margin: 25px 25px 15px 25px; + } + .checkbox-column label { + display: block; + white-space: nowrap; + margin-bottom: 5px; + } + .divider { + border-top: 1px solid #fff; + margin: 20px 0; + } + .version-info { + position: fixed; + bottom: 0; + right: 0; + margin: 10px; + font-size: small; + } + .version-info a { + color: yellow; + font-weight: bold; + } + + .message { background-color: ; color: #fff; @@ -439,7 +471,19 @@ function show_message($message_text) { border-radius: 5px; margin-bottom: 10px; transition: opacity 2s ease-out; + box-shadow: 0 8px 8px 1px rgba(0, 0, 0, .2); + font-weight: bold; + } + .fade-out { + opacity: 0; } + + table { width: 100%; border-collapse: collapse; @@ -468,24 +512,6 @@ function show_message($message_text) { table th:nth-child(4), table td:nth-child(4) { width: 10%; } - .checkbox-columns { - display: flex; - gap: 20px; - text-align: left; - margin: 25px 25px 15px 25px; - } - .checkbox-column label { - display: block; - white-space: nowrap; - margin-bottom: 5px; - } - .divider { - border-top: 1px solid #fff; - margin: 20px 0; - } - .fade-out { - opacity: 0; - } .inline-form { display: inline; } @@ -499,17 +525,8 @@ function show_message($message_text) { .trash-icon:hover { color: #c82333; } - .version-info { - position: fixed; - bottom: 0; - right: 0; - margin: 10px; - font-size: small; - } - .version-info a { - color: yellow; - font-weight: bold; - } + + @@ -603,11 +630,7 @@ function convertToLocalTime(isoDate) {
- No Backups Found'; } else {