| 1 |
<?php |
| 2 |
require_once(dirname(__FILE__).'/boot.php'); |
| 3 |
require_once(SG_PUBLIC_INCLUDE_PATH . '/header.php'); |
| 4 |
$isNotificationEnabled = SGConfig::get('SG_NOTIFICATIONS_ENABLED'); |
| 5 |
$userEmail = SGConfig::get('SG_NOTIFICATIONS_EMAIL_ADDRESS'); |
| 6 |
$isDeleteBackupAfterUploadEnabled = SGConfig::get('SG_DELETE_BACKUP_AFTER_UPLOAD'); |
| 7 |
$isDeleteBackupFromCloudEnabled = SGConfig::get('SG_DELETE_BACKUP_FROM_CLOUD'); |
| 8 |
$isDisabelAdsEnabled = SGConfig::get('SG_DISABLE_ADS'); |
| 9 |
$isDownloadViaPhp = SGConfig::get('SG_DOWNLOAD_VIA_PHP'); |
| 10 |
$isAlertBeforeUpdateEnabled = SGConfig::get('SG_ALERT_BEFORE_UPDATE'); |
| 11 |
$isShowStatisticsWidgetEnabled = SGConfig::get('SG_SHOW_STATISTICS_WIDGET'); |
| 12 |
$isReloadingsEnabled = SGConfig::get('SG_BACKUP_WITH_RELOADINGS'); |
| 13 |
$intervalSelectElement = array( |
| 14 |
'1000'=>'1 second', |
| 15 |
'2000'=>'2 seconds', |
| 16 |
'3000'=>'3 seconds', |
| 17 |
'5000'=>'5 seconds', |
| 18 |
'7000'=>'7 seconds', |
| 19 |
'10000'=>'10 seconds'); |
| 20 |
$selectedInterval = (int)SGConfig::get('SG_AJAX_REQUEST_FREQUENCY')?(int)SGConfig::get('SG_AJAX_REQUEST_FREQUENCY'):SG_AJAX_DEFAULT_REQUEST_FREQUENCY; |
| 21 |
|
| 22 |
$backupFileNamePrefix = SGConfig::get('SG_BACKUP_FILE_NAME_PREFIX')?SGConfig::get('SG_BACKUP_FILE_NAME_PREFIX'):SG_BACKUP_FILE_NAME_DEFAULT_PREFIX; |
| 23 |
$backupFileNamePrefix = esc_html($backupFileNamePrefix); |
| 24 |
|
| 25 |
$infoIconHtml = '<span class="dashicons dashicons-editor-help sgbg-info-icon"></span>'; |
| 26 |
$sgBackgroundReloadMethod = SGConfig::get('SG_BACKGROUND_RELOAD_METHOD'); |
| 27 |
$ftpPassiveMode = SGConfig::get('SG_FTP_PASSIVE_MODE'); |
| 28 |
$contentClassName = getBackupPageContentClassName('settings'); |
| 29 |
$savedCloudUploadChunkSize = getCloudUploadChunkSize(); |
| 30 |
?> |
| 31 |
<div id="sg-backup-page-content-settings" class="sg-backup-page-content <?php echo $contentClassName; ?>"> |
| 32 |
<div class="row sg-settings-container"> |
| 33 |
<div class="col-md-12"> |
| 34 |
<form class="form-horizontal" method="post" data-sgform="ajax" data-type="sgsettings"> |
| 35 |
<fieldset> |
| 36 |
<div><h1 class="sg-backup-page-title"><?php _backupGuardT('General settings')?></h1></div> |
| 37 |
<?php if (SGBoot::isFeatureAvailable('NOTIFICATIONS')): ?> |
| 38 |
<div class="form-group"> |
| 39 |
<label class="col-md-4 sg-control-label"> |
| 40 |
<?php _backupGuardT('Email notifications'); ?><?php echo $infoIconHtml; ?> |
| 41 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable notifications to receive status updates about your backup/restore processes.');?></span> |
| 42 |
<?php if(!empty($userEmail)): ?> |
| 43 |
<br/><span class="text-muted sg-user-email sg-helper-block"><?php echo esc_html($userEmail); ?></span> |
| 44 |
<?php endif?> |
| 45 |
</label> |
| 46 |
<div class="col-md-3 text-left"> |
| 47 |
<label class="sg-switch-container"> |
| 48 |
<input type="checkbox" name="sgIsEmailNotification" class="sg-switch sg-email-switch" sgFeatureName="NOTIFICATIONS" <?php echo $isNotificationEnabled?'checked="checked"':''?> data-remote="settings"> |
| 49 |
</label> |
| 50 |
</div> |
| 51 |
</div> |
| 52 |
<div class="sg-general-settings"> |
| 53 |
<div class="form-group"> |
| 54 |
<label class="col-md-4 sg-control-label" for="sg-email"><?php _backupGuardT('Enter email')?></label> |
| 55 |
<div class="col-md-5"> |
| 56 |
<input id="sg-email" name="sgUserEmail" type="text" placeholder="<?php _backupGuardT('You can enter multiple emails, just separate them with comma')?>" class="form-control input-md sg-backup-input" value="<?php echo @$userEmail?>"> |
| 57 |
</div> |
| 58 |
</div> |
| 59 |
</div> |
| 60 |
<?php endif; ?> |
| 61 |
<div class="form-group"> |
| 62 |
<label class="col-md-4 sg-control-label"> |
| 63 |
<?php _backupGuardT('Reloads enabled'); ?><?php echo $infoIconHtml; ?> |
| 64 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable chunked backup/restore. Recommended to avoid execution timeout errors.')?></span> |
| 65 |
</label> |
| 66 |
<div class="col-md-3 text-left"> |
| 67 |
<label class="sg-switch-container"> |
| 68 |
<input type="checkbox" name="backup-with-reloadings" class="sg-switch" <?php echo $isReloadingsEnabled?'checked="checked"':''?>> |
| 69 |
</label> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
<?php if (SGBoot::isFeatureAvailable('DELETE_LOCAL_BACKUP_AFTER_UPLOAD')): ?> |
| 73 |
<div class="form-group"> |
| 74 |
<label class="col-md-4 sg-control-label"> |
| 75 |
<?php _backupGuardT('Delete local backup after upload'); ?><?php echo $infoIconHtml; ?> |
| 76 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Delete your local copy of backup once it is successfully uploaded to the connected cloud.')?></span> |
| 77 |
</label> |
| 78 |
<div class="col-md-3 text-left"> |
| 79 |
<label class="sg-switch-container"> |
| 80 |
<input type="checkbox" name="delete-backup-after-upload" sgFeatureName="DELETE_LOCAL_BACKUP_AFTER_UPLOAD" class="sg-switch" <?php echo $isDeleteBackupAfterUploadEnabled?'checked="checked"':''?>> |
| 81 |
</label> |
| 82 |
</div> |
| 83 |
</div> |
| 84 |
<?php endif; ?> |
| 85 |
<?php if (SGBoot::isFeatureAvailable('ALERT_BEFORE_UPDATE')): ?> |
| 86 |
<div class="form-group"> |
| 87 |
<label class="col-md-4 sg-control-label"> |
| 88 |
<?php _backupGuardT('Alert before update'); ?><?php echo $infoIconHtml; ?> |
| 89 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Receive an alert to backup you website prior to updateing installed plugins.')?></span> |
| 90 |
</label> |
| 91 |
<div class="col-md-3 text-left"> |
| 92 |
<label class="sg-switch-container"> |
| 93 |
<input type="checkbox" name="alert-before-update" sgFeatureName="ALERT_BEFORE_UPDATE" class="sg-switch" <?php echo $isAlertBeforeUpdateEnabled?'checked="checked"':''?>> |
| 94 |
</label> |
| 95 |
</div> |
| 96 |
</div> |
| 97 |
<?php endif; ?> |
| 98 |
<?php if (SGBoot::isFeatureAvailable('BACKUP_DELETION_WILL_ALSO_DELETE_FROM_CLOUD')): ?> |
| 99 |
<div class="form-group"> |
| 100 |
<label class="col-md-4 sg-control-label"> |
| 101 |
<?php _backupGuardT('Backup deletion will also delete from cloud'); ?><?php echo $infoIconHtml; ?> |
| 102 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Deleting your local copy of backup will automatically remove it from the connected cloud as well.')?></span> |
| 103 |
</label> |
| 104 |
<div class="col-md-3 text-left"> |
| 105 |
<label class="sg-switch-container"> |
| 106 |
<input type="checkbox" name="delete-backup-from-cloud" sgFeatureName="BACKUP_DELETION_WILL_ALSO_DELETE_FROM_CLOUD" class="sg-switch" <?php echo $isDeleteBackupFromCloudEnabled?'checked="checked"':''?>> |
| 107 |
</label> |
| 108 |
</div> |
| 109 |
</div> |
| 110 |
<?php endif; ?> |
| 111 |
<div class="form-group"> |
| 112 |
<label class="col-md-4 sg-control-label"> |
| 113 |
<?php _backupGuardT('Show statistics'); ?><?php echo $infoIconHtml; ?> |
| 114 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Backup statistics available in the dashboard.')?></span> |
| 115 |
</label> |
| 116 |
<div class="col-md-3 text-left"> |
| 117 |
<label class="sg-switch-container"> |
| 118 |
<input type="checkbox" name="show-statistics-widget" class="sg-switch" <?php echo $isShowStatisticsWidgetEnabled?'checked="checked"':''?>> |
| 119 |
</label> |
| 120 |
</div> |
| 121 |
</div> |
| 122 |
<?php if (SGBoot::isFeatureAvailable('FTP')): ?> |
| 123 |
<div class="form-group"> |
| 124 |
<label class="col-md-4 sg-control-label"> |
| 125 |
<?php _backupGuardT('FTP passive mode'); ?> |
| 126 |
</label> |
| 127 |
<div class="col-md-3 text-left"> |
| 128 |
<label class="sg-switch-container"> |
| 129 |
<input type="checkbox" name="ftp-passive-mode" sgFeatureName="FTP" class="sg-switch" <?php echo $ftpPassiveMode?'checked="checked"':''?>> |
| 130 |
</label> |
| 131 |
</div> |
| 132 |
</div> |
| 133 |
<?php endif; ?> |
| 134 |
<?php if (SGBoot::isFeatureAvailable('MULTI_SCHEDULE')): ?> |
| 135 |
<div class="form-group"> |
| 136 |
<label class="col-md-4 sg-control-label"> |
| 137 |
<?php _backupGuardT('Disable ads'); ?><?php echo $infoIconHtml; ?> |
| 138 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Disable advertisements inside the plugin (e.g. banners)')?></span> |
| 139 |
</label> |
| 140 |
<div class="col-md-3 text-left"> |
| 141 |
<label class="sg-switch-container"> |
| 142 |
<input type="checkbox" name="sg-hide-ads" sgFeatureName="HIDE_ADS" class="sg-switch" <?php echo $isDisabelAdsEnabled?'checked="checked"':''?>> |
| 143 |
</label> |
| 144 |
</div> |
| 145 |
</div> |
| 146 |
<?php endif; ?> |
| 147 |
<div class="form-group"> |
| 148 |
<label class="col-md-4 sg-control-label"> |
| 149 |
<?php _backupGuardT('Download via PHP'); ?><?php echo $infoIconHtml; ?> |
| 150 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Download backup archive or log via PHP')?></span> |
| 151 |
</label> |
| 152 |
<div class="col-md-3 text-left"> |
| 153 |
<label class="sg-switch-container"> |
| 154 |
<input type="checkbox" name="sg-download-via-php" sgFeatureName="DOWNLOAD_VIA_PHP" class="sg-switch" <?php echo $isDownloadViaPhp?'checked="checked"':''?>> |
| 155 |
</label> |
| 156 |
</div> |
| 157 |
</div> |
| 158 |
<div class="form-group"> |
| 159 |
<label class="col-md-4 sg-control-label"> |
| 160 |
<?php _backupGuardT('Send usage data'); ?><?php echo $infoIconHtml; ?> |
| 161 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Allow us to receive usage data in order to improve plugin functionality')?></span> |
| 162 |
</label> |
| 163 |
<div class="col-md-3 text-left"> |
| 164 |
<label class="sg-switch-container"> |
| 165 |
<input type="checkbox" name="backup-send-usage-data-status" class="sg-switch backup-send-usage-data-status" <?php echo $allowDataCollection?'checked="checked"':''?>> |
| 166 |
</label> |
| 167 |
</div> |
| 168 |
</div> |
| 169 |
|
| 170 |
<div class="form-group"> |
| 171 |
<label class="col-md-4 sg-control-label" for='sg-paths-to-exclude'> |
| 172 |
<?php _backupGuardT("Exclude paths (separated by commas)")?> |
| 173 |
</label> |
| 174 |
<div class="col-md-5 text-left"> |
| 175 |
<input class="form-control sg-backup-input" id='sg-paths-to-exclude' name='sg-paths-to-exclude' type="text" value="<?php echo SGConfig::get('SG_PATHS_TO_EXCLUDE')?SGConfig::get('SG_PATHS_TO_EXCLUDE'):''?>" placeholder="e.g. wp-content/cache, wp-content/w3tc-cache"> |
| 176 |
</div> |
| 177 |
</div> |
| 178 |
|
| 179 |
<div class="form-group"> |
| 180 |
<label class="col-md-4 sg-control-label" for='sg-tables-to-exclude'> |
| 181 |
<?php _backupGuardT("Tables to exclude (separated by commas)")?> |
| 182 |
</label> |
| 183 |
<div class="col-md-5 text-left"> |
| 184 |
<input class="form-control sg-backup-input" id='sg-tables-to-exclude' name='sg-tables-to-exclude' type="text" value="<?php echo SGConfig::get('SG_TABLES_TO_EXCLUDE')?SGConfig::get('SG_TABLES_TO_EXCLUDE'):''?>" placeholder="e.g. wp_comments, wp_commentmeta"> |
| 185 |
</div> |
| 186 |
</div> |
| 187 |
|
| 188 |
<?php if (SGBoot::isFeatureAvailable('NUMBER_OF_BACKUPS_TO_KEEP')): ?> |
| 189 |
<div class="form-group"> |
| 190 |
<label class="col-md-4 sg-control-label" for='amount-of-backups-to-keep'> |
| 191 |
<?php _backupGuardT("Backup retention")?><?php echo $infoIconHtml; ?> |
| 192 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose number of backups to keep on the website. Each additional backup will replace the oldest backup file')?></span> |
| 193 |
</label> |
| 194 |
<div class="col-md-5 text-left"> |
| 195 |
<input class="form-control sg-backup-input" id='amount-of-backups-to-keep' name='amount-of-backups-to-keep' type="text" value="<?php echo (int)SGConfig::get('SG_AMOUNT_OF_BACKUPS_TO_KEEP')?(int)SGConfig::get('SG_AMOUNT_OF_BACKUPS_TO_KEEP'):SG_NUMBER_OF_BACKUPS_TO_KEEP?>" <?php echo (!SGBoot::isFeatureAvailable('NUMBER_OF_BACKUPS_TO_KEEP'))? 'disabled' : '' ?>> |
| 196 |
</div> |
| 197 |
</div> |
| 198 |
<?php endif; ?> |
| 199 |
<div class="form-group"> |
| 200 |
<label class="col-md-4 sg-control-label" for='sg-number-of-rows-to-backup'> |
| 201 |
<?php _backupGuardT("Number of rows to backup at once")?><?php echo $infoIconHtml; ?> |
| 202 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose the number of row during the Databases backup in order not to overload your RAM.')?></span> |
| 203 |
</label> |
| 204 |
<div class="col-md-5 text-left"> |
| 205 |
<input class="form-control sg-backup-input" id='sg-number-of-rows-to-backup' name='sg-number-of-rows-to-backup' type="text" value="<?php echo (int)SGConfig::get('SG_BACKUP_DATABASE_INSERT_LIMIT')?(int)SGConfig::get('SG_BACKUP_DATABASE_INSERT_LIMIT'):SG_BACKUP_DATABASE_INSERT_LIMIT?>"> |
| 206 |
</div> |
| 207 |
</div> |
| 208 |
<div class="form-group"> |
| 209 |
<label class="col-md-4 sg-control-label" for='sg-number-of-rows-to-backup'> |
| 210 |
<?php _backupGuardT("Upload to cloud chunk size")?><?php echo $infoIconHtml; ?> |
| 211 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Change the size of the chunk upload during backup to cloud(s).')?></span> |
| 212 |
</label> |
| 213 |
<div class="col-md-5 text-left"> |
| 214 |
<select class="form-control" id='sg-upload-cloud-chunk-szie' name='sg-upload-cloud-chunk-size'> |
| 215 |
<option value="4" <?php echo $savedCloudUploadChunkSize == 4 ? "selected" : "" ?> >4MB</option> |
| 216 |
<option value="8" <?php echo $savedCloudUploadChunkSize == 8 ? "selected" : "" ?> >8MB</option> |
| 217 |
<option value="16" <?php echo $savedCloudUploadChunkSize == 16 ? "selected" : "" ?> >16MB</option> |
| 218 |
<option value="32" <?php echo $savedCloudUploadChunkSize == 32 ? "selected" : "" ?> >32MB</option> |
| 219 |
</select> |
| 220 |
</div> |
| 221 |
</div> |
| 222 |
|
| 223 |
<div class="form-group"> |
| 224 |
<label class="col-md-4 sg-control-label" for='sg-background-reload-method'> |
| 225 |
<?php _backupGuardT("Reload method")?><?php echo $infoIconHtml; ?> |
| 226 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose the right PHP Library for reloads')?></span> |
| 227 |
</label> |
| 228 |
<div class="col-md-5 text-left"> |
| 229 |
<select class="form-control" id='sg-background-reload-method' name='sg-background-reload-method'> |
| 230 |
<option value="<?php echo SG_RELOAD_METHOD_CURL ?>" <?php echo $sgBackgroundReloadMethod == SG_RELOAD_METHOD_CURL ? "selected" : "" ?> >Curl</option> |
| 231 |
<option value="<?php echo SG_RELOAD_METHOD_STREAM ?>" <?php echo $sgBackgroundReloadMethod == SG_RELOAD_METHOD_STREAM ? "selected" : "" ?> >Stream</option> |
| 232 |
<option value="<?php echo SG_RELOAD_METHOD_SOCKET ?>" <?php echo $sgBackgroundReloadMethod == SG_RELOAD_METHOD_SOCKET ? "selected" : "" ?> >Socket</option> |
| 233 |
</select> |
| 234 |
</div> |
| 235 |
</div> |
| 236 |
<?php if (SGBoot::isFeatureAvailable('CUSTOM_BACKUP_NAME')): ?> |
| 237 |
<div class="form-group"> |
| 238 |
<label class="col-md-4 sg-control-label"> |
| 239 |
<?php _backupGuardT('Backup file name')?><?php echo $infoIconHtml; ?> |
| 240 |
<span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Name your backups or leave to the default prefixes')?></span> |
| 241 |
</label> |
| 242 |
<div class="col-md-5 text-left"> |
| 243 |
<input id="backup-file-name" name="backup-file-name" type="text" class="form-control input-md sg-backup-input" value="<?php echo $backupFileNamePrefix?>" <?php echo (!SGBoot::isFeatureAvailable('CUSTOM_BACKUP_NAME'))? 'disabled' : '' ?>> |
| 244 |
</div> |
| 245 |
</div> |
| 246 |
<?php endif; ?> |
| 247 |
|
| 248 |
<div class="form-group"> |
| 249 |
<label class="col-md-4 sg-control-label" for="sg-email"> |
| 250 |
<?php _backupGuardT('Request frequency')?> |
| 251 |
</label> |
| 252 |
<div class="col-md-5"> |
| 253 |
<?php echo selectElement($intervalSelectElement, array('id'=>'sg-ajax-interval', 'name'=>'ajaxInterval', 'class'=>'form-control'), '', $selectedInterval);?> |
| 254 |
</div> |
| 255 |
</div> |
| 256 |
<div class="form-group"> |
| 257 |
<label class="col-md-4"><?php _backupGuardT('Backup destination path'); ?></label> |
| 258 |
<div class="col-md-6"> |
| 259 |
<span><?php echo str_replace(realpath(SG_APP_ROOT_DIRECTORY).'/', "" ,realpath(SG_BACKUP_DIRECTORY)); ?></span> |
| 260 |
</div> |
| 261 |
</div> |
| 262 |
<div class="form-group"> |
| 263 |
<label class="col-md-4 control-label" for="button1id"></label> |
| 264 |
<div class="col-md-5 text-right"> |
| 265 |
<button type="button" id="sg-save-settings" class="btn btn-success" onclick="sgBackup.sgsettings();"><?php _backupGuardT('Save')?></button> |
| 266 |
</div> |
| 267 |
</div> |
| 268 |
</fieldset> |
| 269 |
</form> |
| 270 |
</div> |
| 271 |
</div> |
| 272 |
</div> |