cancelBackup.php
3 years ago
cancelDownload.php
3 years ago
checkBackupCreation.php
3 years ago
checkFreeMigration.php
3 years ago
checkPHPVersionCompatibility.php
3 years ago
checkRestoreCreation.php
3 years ago
chooseProfile.php
3 years ago
cloudDropbox.php
3 years ago
curlChecker.php
3 years ago
deleteBackup.php
3 years ago
downloadBackup.php
3 years ago
getAction.php
3 years ago
getBackupContent.php
3 years ago
getRunningActions.php
3 years ago
hideNotice.php
3 years ago
importBackup.php
3 years ago
isBgUserExists.php
3 years ago
isFeatureAvailable.php
3 years ago
manualBackup.php
3 years ago
modalImport.php
3 years ago
modalManualBackup.php
3 years ago
modalManualRestore.php
3 years ago
modalPrivacy.php
3 years ago
modalReview.php
3 years ago
modalTerms.php
3 years ago
resetStatus.php
3 years ago
restore.php
3 years ago
reviewBannerActions.php
3 years ago
schedule.php
3 years ago
setReviewPopupState.php
3 years ago
settings.php
3 years ago
settings.php
155 lines
| 1 | <?php |
| 2 | |
| 3 | require_once dirname(__FILE__) . '/../boot.php'; |
| 4 | require_once SG_BACKUP_PATH . 'SGBackupSchedule.php'; |
| 5 | |
| 6 | $error = array(); |
| 7 | $success = array('success' => 1); |
| 8 | |
| 9 | if (backupGuardIsAjax() && isset($_POST['cancel'])) { |
| 10 | SGConfig::set('SG_NOTIFICATIONS_ENABLED', '0'); |
| 11 | SGConfig::set('SG_NOTIFICATIONS_EMAIL_ADDRESS', ''); |
| 12 | |
| 13 | die(json_encode($success)); |
| 14 | } |
| 15 | |
| 16 | if (backupGuardIsAjax() && count($_POST)) { |
| 17 | $_POST = backupGuardRemoveSlashes($_POST); |
| 18 | $_POST = backupGuardSanitizeTextField($_POST); |
| 19 | |
| 20 | $amountOfBackupsToKeep = (int)@$_POST['amount-of-backups-to-keep']; |
| 21 | if ($amountOfBackupsToKeep <= 0) { |
| 22 | $amountOfBackupsToKeep = SG_NUMBER_OF_BACKUPS_TO_KEEP; |
| 23 | } |
| 24 | SGConfig::set('SG_AMOUNT_OF_BACKUPS_TO_KEEP', $amountOfBackupsToKeep); |
| 25 | |
| 26 | SGConfig::set('SG_NOTIFICATIONS_ENABLED', '0'); |
| 27 | $emails = ''; |
| 28 | if (isset($_POST['sgIsEmailNotification'])) { |
| 29 | $emails = @$_POST['sgUserEmail']; |
| 30 | $emailsArray = explode(',', $emails); |
| 31 | |
| 32 | if (empty($emails)) { |
| 33 | array_push($error, _backupGuardT('Email is required.', true)); |
| 34 | } |
| 35 | |
| 36 | foreach ($emailsArray as $email) { |
| 37 | $email = sanitize_email(trim($email)); |
| 38 | if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
| 39 | array_push($error, _backupGuardT('Invalid email address.', true)); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | SGConfig::set('SG_NOTIFICATIONS_ENABLED', '1'); |
| 44 | } |
| 45 | $ajaxInterval = (int)$_POST['ajaxInterval']; |
| 46 | |
| 47 | if (count($error)) { |
| 48 | die(json_decode($error)); |
| 49 | } |
| 50 | |
| 51 | if (isset($_POST['sg-hide-ads'])) { |
| 52 | SGConfig::set('SG_DISABLE_ADS', '1'); |
| 53 | } else { |
| 54 | SGConfig::set('SG_DISABLE_ADS', '0'); |
| 55 | } |
| 56 | |
| 57 | if (isset($_POST['sg-download-mode'])) { |
| 58 | SGConfig::set('SG_DOWNLOAD_MODE', (int)$_POST['sg-download-mode']); |
| 59 | } |
| 60 | |
| 61 | if (isset($_POST['sg-timezone'])) { |
| 62 | $currentTimezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE; |
| 63 | SGConfig::set('SG_TIMEZONE', sanitize_text_field($_POST['sg-timezone'])); |
| 64 | |
| 65 | if ($currentTimezone != $_POST['sg-timezone']) { |
| 66 | modifyCronJobsByTimezone(); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | if (isset($_POST['sg-background-reload-method'])) { |
| 71 | SGConfig::set('SG_BACKGROUND_RELOAD_METHOD', (int)$_POST['sg-background-reload-method']); |
| 72 | } else { |
| 73 | SGConfig::set('SG_BACKGROUND_RELOAD_METHOD', SG_RELOAD_METHOD_CURL); |
| 74 | } |
| 75 | |
| 76 | if (isset($_POST['delete-backup-after-upload'])) { |
| 77 | SGConfig::set('SG_DELETE_BACKUP_AFTER_UPLOAD', '1'); |
| 78 | } else { |
| 79 | SGConfig::set('SG_DELETE_BACKUP_AFTER_UPLOAD', '0'); |
| 80 | } |
| 81 | |
| 82 | if (isset($_POST['delete-backup-from-cloud'])) { |
| 83 | SGConfig::set('SG_DELETE_BACKUP_FROM_CLOUD', '1'); |
| 84 | } else { |
| 85 | SGConfig::set('SG_DELETE_BACKUP_FROM_CLOUD', '0'); |
| 86 | } |
| 87 | |
| 88 | if (isset($_POST['alert-before-update'])) { |
| 89 | SGConfig::set('SG_ALERT_BEFORE_UPDATE', '1'); |
| 90 | } else { |
| 91 | SGConfig::set('SG_ALERT_BEFORE_UPDATE', '0'); |
| 92 | } |
| 93 | |
| 94 | if (isset($_POST['show-statistics-widget'])) { |
| 95 | SGConfig::set('SG_SHOW_STATISTICS_WIDGET', '1'); |
| 96 | } else { |
| 97 | SGConfig::set('SG_SHOW_STATISTICS_WIDGET', '0'); |
| 98 | } |
| 99 | |
| 100 | if (isset($_POST['ftp-passive-mode'])) { |
| 101 | SGConfig::set('SG_FTP_PASSIVE_MODE', '1'); |
| 102 | } else { |
| 103 | SGConfig::set('SG_FTP_PASSIVE_MODE', '0'); |
| 104 | } |
| 105 | |
| 106 | if (isset($_POST['sg-number-of-rows-to-backup'])) { |
| 107 | SGConfig::set('SG_BACKUP_DATABASE_INSERT_LIMIT', (int)$_POST['sg-number-of-rows-to-backup']); |
| 108 | } else { |
| 109 | SGConfig::set('SG_BACKUP_DATABASE_INSERT_LIMIT', SG_BACKUP_DATABASE_INSERT_LIMIT); |
| 110 | } |
| 111 | |
| 112 | $backupFileName = SG_BACKUP_FILE_NAME_DEFAULT_PREFIX; |
| 113 | if (isset($_POST['backup-file-name'])) { |
| 114 | $backupFileName = sanitize_text_field($_POST['backup-file-name']); |
| 115 | } |
| 116 | |
| 117 | $isReloadingsEnabled = 0; |
| 118 | if (isset($_POST['backup-with-reloadings'])) { |
| 119 | $isReloadingsEnabled = 1; |
| 120 | } |
| 121 | |
| 122 | if (isset($_POST['sg-paths-to-exclude'])) { |
| 123 | SGConfig::set('SG_PATHS_TO_EXCLUDE', sanitize_text_field($_POST['sg-paths-to-exclude'])); |
| 124 | } else { |
| 125 | SGConfig::set('SG_PATHS_TO_EXCLUDE', ''); |
| 126 | } |
| 127 | |
| 128 | if (isset($_POST['sg-tables-to-exclude'])) { |
| 129 | SGConfig::set('SG_TABLES_TO_EXCLUDE', sanitize_text_field($_POST['sg-tables-to-exclude'])); |
| 130 | } else { |
| 131 | SGConfig::set('SG_TABLES_TO_EXCLUDE', ''); |
| 132 | } |
| 133 | |
| 134 | if (isset($_POST['sg-upload-cloud-chunk-size'])) { |
| 135 | SGConfig::set('SG_BACKUP_CLOUD_UPLOAD_CHUNK_SIZE', intval($_POST['sg-upload-cloud-chunk-size'])); |
| 136 | } else { |
| 137 | SGConfig::set('SG_BACKUP_CLOUD_UPLOAD_CHUNK_SIZE', ''); |
| 138 | } |
| 139 | |
| 140 | SGConfig::set('SG_BACKUP_WITH_RELOADINGS', $isReloadingsEnabled); |
| 141 | SGConfig::set('SG_BACKUP_FILE_NAME_PREFIX', $backupFileName); |
| 142 | SGConfig::set('SG_AJAX_REQUEST_FREQUENCY', $ajaxInterval); |
| 143 | SGConfig::set('SG_NOTIFICATIONS_EMAIL_ADDRESS', $emails); |
| 144 | die(json_encode($success)); |
| 145 | } |
| 146 | |
| 147 | if (backupGuardIsAjax() && $_SERVER['REQUEST_METHOD'] === 'GET') { |
| 148 | if ($_GET["type"] == "updateSetting") { |
| 149 | //disable alert-before-update from updates page |
| 150 | if (isset($_GET["alert-before-update"])) { |
| 151 | SGConfig::set('SG_ALERT_BEFORE_UPDATE', $_GET["alert-before-update"]); |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 |