ajax
3 years ago
config
4 years ago
cron
6 years ago
css
3 years ago
fonts
5 years ago
img
3 years ago
include
3 years ago
js
3 years ago
templates
3 years ago
backups.php
3 years ago
boot.php
3 years ago
cloud.php
3 years ago
dashboardWidget.php
3 years ago
pagesContent.php
3 years ago
proFeatures.php
3 years ago
restore_wordpress.php
3 years ago
schedule.php
3 years ago
security.php
3 years ago
services.php
3 years ago
settings.php
3 years ago
support.php
3 years ago
systemInfo.php
3 years ago
videoTutorials.php
3 years ago
cloud.php
281 lines
| 1 | <?php |
| 2 | $dropbox = SGConfig::get('SG_DROPBOX_ACCESS_TOKEN'); |
| 3 | $gdrive = SGConfig::get('SG_GOOGLE_DRIVE_REFRESH_TOKEN'); |
| 4 | $ftp = SGConfig::get('SG_STORAGE_FTP_CONNECTED'); |
| 5 | $amazon = SGConfig::get('SG_STORAGE_AMAZON_CONNECTED'); |
| 6 | $oneDrive = SGConfig::get('SG_ONE_DRIVE_REFRESH_TOKEN'); |
| 7 | $pCloud = SGConfig::get('SG_P_CLOUD_ACCESS_TOKEN'); |
| 8 | $box = SGConfig::get('SG_BOX_REFRESH_TOKEN'); |
| 9 | $ftpUsername = SGConfig::get('SG_FTP_CONNECTION_STRING'); |
| 10 | $gdriveUsername = SGConfig::get('SG_GOOGLE_DRIVE_CONNECTION_STRING'); |
| 11 | $dropboxUsername = SGConfig::get('SG_DROPBOX_CONNECTION_STRING'); |
| 12 | $amazonInfo = SGConfig::get('SG_AMAZON_BUCKET'); |
| 13 | |
| 14 | $oneDriveInfo = SGConfig::get('SG_ONE_DRIVE_CONNECTION_STRING'); |
| 15 | $pCloudInfo = SGConfig::get('SG_P_CLOUD_CONNECTION_STRING'); |
| 16 | $boxInfo = SGConfig::get('SG_BOX_CONNECTION_STRING'); |
| 17 | |
| 18 | $contentClassName = esc_attr(getBackupPageContentClassName('cloud')); |
| 19 | |
| 20 | |
| 21 | $backupGuardCloudAccount = SGConfig::get('SG_BACKUPGUARD_CLOUD_ACCOUNT') ? unserialize(SGConfig::get('SG_BACKUPGUARD_CLOUD_ACCOUNT')) : ''; |
| 22 | $backupGuardCloudAccountEmail = SGConfig::get('SG_BACKUPGUARD_CLOUD_ACCOUNT_EMAIL'); |
| 23 | |
| 24 | $backupGuardConnectionString = "<span>" . _backupGuardT('Connect now and get 1 GB storage space for FREE', true) . "</span>"; |
| 25 | |
| 26 | if (!empty($backupGuardCloudAccount)) { |
| 27 | $usedSpace = $backupGuardCloudAccount['usedStorage']; |
| 28 | $storage = $backupGuardCloudAccount['package']['storage']; |
| 29 | $availableSpaceInpercents = $usedSpace * 100 / $storage; |
| 30 | |
| 31 | if ($availableSpaceInpercents < 25) { |
| 32 | $usedSpaceTextColor = "green"; |
| 33 | } else if ((25 <= $availableSpaceInpercents) && ($availableSpaceInpercents < 50)) { |
| 34 | $usedSpaceTextColor = "black"; |
| 35 | } else if ((50 <= $availableSpaceInpercents) && ($availableSpaceInpercents <= 75)) { |
| 36 | $usedSpaceTextColor = "orange"; |
| 37 | } else if ($availableSpaceInpercents >= 75) { |
| 38 | $usedSpaceTextColor = "red"; |
| 39 | } |
| 40 | |
| 41 | $backupGuardConnectionString = $backupGuardCloudAccountEmail . ' | <span style="color: ' . $usedSpaceTextColor . ';">' . convertToReadableSize($usedSpace * BACKUP_GUARD_ONE_MB) . ' / ' . convertToReadableSize($storage * BACKUP_GUARD_ONE_MB) . '</span> | <a target="_blank" href="' . BACKUP_GUARD_CLOUD_UPGRADE_URL . '">Upgrade for more space</a>'; |
| 42 | } |
| 43 | ?> |
| 44 | <div id="sg-backup-page-content-cloud" class="sg-backup-page-content <?php echo $contentClassName; ?>"> |
| 45 | <div class="row sg-cloud-container"> |
| 46 | <div class="col-md-12"> |
| 47 | <form class="form-horizontal"> |
| 48 | <fieldset> |
| 49 | <div><h1 class="sg-backup-page-title"><?php _backupGuardT('Cloud settings') ?></h1></div> |
| 50 | <?php if (SGBoot::isFeatureAvailable('SUBDIRECTORIES')) : ?> |
| 51 | <div class="form-group form-inline"> |
| 52 | <label class="col-md-5 sg-control-label"> |
| 53 | <?php _backupGuardT('Destination folder') ?> |
| 54 | </label> |
| 55 | <div class="col-md-3"> |
| 56 | <input id="cloudFolder" name="cloudFolder" type="text" |
| 57 | class="form-control input-md sg-backup-input" |
| 58 | value="<?php echo esc_html(SGConfig::get('SG_STORAGE_BACKUPS_FOLDER_NAME')) ?>"> |
| 59 | <button type="button" id="sg-save-cloud-folder" |
| 60 | class="btn btn-success pull-right"><?php _backupGuardT('Save'); ?></button> |
| 61 | </div> |
| 62 | </div> |
| 63 | <?php endif; ?> |
| 64 | <!-- BackupGuard --> |
| 65 | <?php if (SGBoot::isFeatureAvailable('BACKUP_GUARD') && SG_SHOW_BACKUPGUARD_CLOUD) : ?> |
| 66 | <div class="form-group"> |
| 67 | <label class="col-md-5 sg-control-label sg-user-info"> |
| 68 | <div class="sg-cloud-icon-wrapper"> |
| 69 | <span class="sg-cloud-icon sg-cloud-backup-guard"></span> |
| 70 | </div> |
| 71 | <div class="sg-cloud-label-with-info"> |
| 72 | <span><?php echo 'BackupGuard' ?></span> |
| 73 | <span class="sg-backupguard-user sg-helper-block"> |
| 74 | <?php echo esc_html($backupGuardConnectionString) ?> |
| 75 | </span> |
| 76 | </div> |
| 77 | </label> |
| 78 | <div class="col-md-3"> |
| 79 | <label class="sg-switch-container"> |
| 80 | <input type="checkbox" data-on-text="<?php _backupGuardT('ON') ?>" |
| 81 | data-off-text="<?php _backupGuardT('OFF') ?>" data-storage="BACKUP_GUARD" |
| 82 | data-remote="bgLogin" |
| 83 | class="sg-switch" <?php echo !empty($backupGuardCloudAccount) ? 'checked="checked"' : '' ?>> |
| 84 | <a id="backup-guard-details" href="javascript:void(0)" class="hide" |
| 85 | data-toggle="modal" data-modal-name="backup-guard-details" |
| 86 | data-remote="modalBackupGuardDetails"></a> |
| 87 | </label> |
| 88 | </div> |
| 89 | </div> |
| 90 | <?php endif; ?> |
| 91 | <!-- Dropbox --> |
| 92 | <?php if (SGBoot::isFeatureAvailable('DROPBOX')) : ?> |
| 93 | <div class="form-group"> |
| 94 | <label class="col-md-5 sg-control-label"> |
| 95 | <div class="sg-cloud-icon-wrapper"> |
| 96 | <span class="sg-cloud-icon sg-cloud-dropbox"></span> |
| 97 | </div> |
| 98 | <div class="sg-cloud-label-wrapper"> |
| 99 | <span><?php echo 'Dropbox' ?></span> |
| 100 | <?php if (!empty($dropboxUsername)) : ?> |
| 101 | <br/> |
| 102 | <span class="text-muted sg-dropbox-user sg-helper-block"><?php echo esc_html($dropboxUsername); ?></span> |
| 103 | <?php endif; ?> |
| 104 | </div> |
| 105 | </label> |
| 106 | <div class="col-md-3"> |
| 107 | <label class="sg-switch-container"> |
| 108 | <input data-on-text="<?php _backupGuardT('ON') ?>" |
| 109 | data-off-text="<?php _backupGuardT('OFF') ?>" data-storage="DROPBOX" |
| 110 | data-remote="cloudDropbox" type="checkbox" |
| 111 | class="sg-switch" <?php echo !empty($dropbox) ? 'checked="checked"' : '' ?>> |
| 112 | </label> |
| 113 | </div> |
| 114 | </div> |
| 115 | <?php endif; ?> |
| 116 | <!-- Google Drive --> |
| 117 | <?php if (SGBoot::isFeatureAvailable('GOOGLE_DRIVE')) : ?> |
| 118 | <div class="form-group"> |
| 119 | <label class="col-md-5 sg-control-label"> |
| 120 | <div class="sg-cloud-icon-wrapper"> |
| 121 | <span class="sg-cloud-icon sg-cloud-google-drive"></span> |
| 122 | </div> |
| 123 | <div class="sg-cloud-label-wrapper"> |
| 124 | <?php echo 'Google Drive' ?> |
| 125 | <?php if (!empty($gdriveUsername)) : ?> |
| 126 | <br/> |
| 127 | <span class="text-muted sg-gdrive-user sg-helper-block"><?php echo esc_html($gdriveUsername); ?></span> |
| 128 | <?php endif; ?> |
| 129 | </div> |
| 130 | </label> |
| 131 | <div class="col-md-3"> |
| 132 | <label class="sg-switch-container"> |
| 133 | <input data-on-text="<?php _backupGuardT('ON') ?>" |
| 134 | data-off-text="<?php _backupGuardT('OFF') ?>" data-storage="GOOGLE_DRIVE" |
| 135 | data-remote="cloudGdrive" type="checkbox" |
| 136 | class="sg-switch" <?php echo !empty($gdrive) ? 'checked="checked"' : '' ?>> |
| 137 | </label> |
| 138 | </div> |
| 139 | </div> |
| 140 | <?php endif; ?> |
| 141 | <!-- FTP --> |
| 142 | <?php if (SGBoot::isFeatureAvailable('FTP')) : ?> |
| 143 | <div class="form-group"> |
| 144 | <label class="col-md-5 sg-control-label sg-user-info"> |
| 145 | <div class="sg-cloud-icon-wrapper"> |
| 146 | <span class="sg-cloud-icon sg-cloud-ftp"></span> |
| 147 | </div> |
| 148 | <div class="sg-cloud-label-wrapper"> |
| 149 | <?php echo 'FTP / SFTP' ?> |
| 150 | <?php if (!empty($ftpUsername)) : ?> |
| 151 | <br/> |
| 152 | <span class="text-muted sg-ftp-user sg-helper-block"><?php echo esc_html($ftpUsername); ?></span> |
| 153 | <?php endif; ?> |
| 154 | </div> |
| 155 | </label> |
| 156 | <div class="col-md-3"> |
| 157 | <label class="sg-switch-container"> |
| 158 | <input type="checkbox" data-on-text="<?php _backupGuardT('ON') ?>" |
| 159 | data-off-text="<?php _backupGuardT('OFF') ?>" data-storage="FTP" |
| 160 | data-remote="cloudFtp" |
| 161 | class="sg-switch" <?php echo !empty($ftp) ? 'checked="checked"' : '' ?>> |
| 162 | <a id="ftp-settings" href="javascript:void(0)" class="hide" data-toggle="modal" |
| 163 | data-modal-name="ftp-settings" |
| 164 | data-remote="modalFtpSettings"><?php echo 'FTP ' . _backupGuardT('Settings', true) ?></a> |
| 165 | </label> |
| 166 | </div> |
| 167 | </div> |
| 168 | <?php endif; ?> |
| 169 | <!-- Amazon S3 --> |
| 170 | <?php if (SGBoot::isFeatureAvailable('AMAZON')) : ?> |
| 171 | <div class="form-group"> |
| 172 | <label class="col-md-5 sg-control-label"> |
| 173 | <div class="sg-cloud-icon-wrapper"> |
| 174 | <span class="sg-cloud-icon sg-cloud-amazon"></span> |
| 175 | </div> |
| 176 | <div class="sg-cloud-label-wrapper"> |
| 177 | <?php echo (backupGuardIsAccountGold() ? 'Amazon ' : '') . 'S3' ?> |
| 178 | <?php if (!empty($amazonInfo)) : ?> |
| 179 | <br/> |
| 180 | <span class="text-muted sg-amazonr-user sg-helper-block"><?php echo esc_html($amazonInfo); ?></span> |
| 181 | <?php endif; ?> |
| 182 | </div> |
| 183 | </label> |
| 184 | <div class="col-md-3"> |
| 185 | <label class="sg-switch-container"> |
| 186 | <input type="checkbox" data-on-text="<?php _backupGuardT('ON') ?>" |
| 187 | data-off-text="<?php _backupGuardT('OFF') ?>" data-storage="AMAZON" |
| 188 | data-remote="cloudAmazon" |
| 189 | class="sg-switch" <?php echo !empty($amazon) ? 'checked="checked"' : '' ?>> |
| 190 | <a id="amazon-settings" href="javascript:void(0)" class="hide" data-toggle="modal" |
| 191 | data-modal-name="amazon-settings" |
| 192 | data-remote="modalAmazonSettings"><?php echo 'Amazon' . _backupGuardT('Settings', true) ?></a> |
| 193 | </label> |
| 194 | </div> |
| 195 | </div> |
| 196 | <?php endif; ?> |
| 197 | <!-- One Drive --> |
| 198 | <?php if (SGBoot::isFeatureAvailable('ONE_DRIVE')) : ?> |
| 199 | <div class="form-group"> |
| 200 | <label class="col-md-5 sg-control-label"> |
| 201 | <div class="sg-cloud-icon-wrapper"> |
| 202 | <span class="sg-cloud-icon sg-cloud-one-drive"></span> |
| 203 | </div> |
| 204 | <div class="sg-cloud-label-wrapper"> |
| 205 | <?php echo 'One Drive' ?> |
| 206 | <?php if (!empty($oneDriveInfo)) : ?> |
| 207 | <br/> |
| 208 | <span class="text-muted sg-gdrive-user sg-helper-block"><?php echo esc_html($oneDriveInfo); ?></span> |
| 209 | <?php endif; ?> |
| 210 | </div> |
| 211 | </label> |
| 212 | <div class="col-md-3"> |
| 213 | <label class="sg-switch-container"> |
| 214 | <input data-on-text="<?php _backupGuardT('ON') ?>" |
| 215 | data-off-text="<?php _backupGuardT('OFF') ?>" data-storage="ONE_DRIVE" |
| 216 | data-remote="cloudOneDrive" type="checkbox" |
| 217 | class="sg-switch" <?php echo !empty($oneDrive) ? 'checked="checked"' : '' ?>> |
| 218 | </label> |
| 219 | </div> |
| 220 | </div> |
| 221 | <?php endif; ?> |
| 222 | |
| 223 | <!-- PCloud --> |
| 224 | <?php if (SGBoot::isFeatureAvailable('P_CLOUD')) : ?> |
| 225 | <div class="form-group"> |
| 226 | <label class="col-md-5 sg-control-label"> |
| 227 | <div class="sg-cloud-icon-wrapper"> |
| 228 | <span class="sg-cloud-icon sg-cloud-pcloud"></span> |
| 229 | </div> |
| 230 | <div class="sg-cloud-label-wrapper"> |
| 231 | <?php echo 'pCloud' ?> |
| 232 | <?php if (!empty($pCloudInfo)) : ?> |
| 233 | <br/> |
| 234 | <span class="text-muted sg-gdrive-user sg-helper-block"><?php echo json_decode($pCloudInfo, true)['email']; ?></span> |
| 235 | <?php endif; ?> |
| 236 | </div> |
| 237 | </label> |
| 238 | <div class="col-md-3"> |
| 239 | <label class="sg-switch-container"> |
| 240 | <input data-on-text="<?php _backupGuardT('ON') ?>" |
| 241 | data-off-text="<?php _backupGuardT('OFF') ?>" data-storage="P_CLOUD" |
| 242 | data-remote="cloudPCloud" type="checkbox" |
| 243 | class="sg-switch" <?php echo !empty($pCloud) ? 'checked="checked"' : '' ?>> |
| 244 | </label> |
| 245 | </div> |
| 246 | </div> |
| 247 | <?php endif; ?> |
| 248 | |
| 249 | <!-- Box --> |
| 250 | <?php if (SGBoot::isFeatureAvailable('BOX')) : ?> |
| 251 | <div class="form-group"> |
| 252 | <label class="col-md-5 sg-control-label"> |
| 253 | <div class="sg-cloud-icon-wrapper"> |
| 254 | <span class="sg-cloud-icon sg-cloud-box"></span> |
| 255 | </div> |
| 256 | <div class="sg-cloud-label-wrapper"> |
| 257 | <?php echo 'box.com' ?> |
| 258 | <?php if (!empty($boxInfo)) : ?> |
| 259 | <br/> |
| 260 | <span class="text-muted sg-gdrive-user sg-helper-block"><?php echo json_decode($boxInfo, true)['login']; ?></span> |
| 261 | <?php endif; ?> |
| 262 | </div> |
| 263 | </label> |
| 264 | <div class="col-md-3"> |
| 265 | <label class="sg-switch-container"> |
| 266 | <input data-on-text="<?php _backupGuardT('ON') ?>" |
| 267 | data-off-text="<?php _backupGuardT('OFF') ?>" data-storage="BOX" |
| 268 | data-remote="cloudBox" type="checkbox" |
| 269 | class="sg-switch" <?php echo !empty($box) ? 'checked="checked"' : '' ?>> |
| 270 | </label> |
| 271 | </div> |
| 272 | </div> |
| 273 | <?php endif; ?> |
| 274 | |
| 275 | |
| 276 | </fieldset> |
| 277 | </form> |
| 278 | </div> |
| 279 | </div> |
| 280 | </div> |
| 281 |