WordPress Backup and Migrate Plugin – Backup Guard - Version 1.6.11

Version Description

  • Improvement of some functions: functions are sanitized, escaped and validated
Download this release

Release Info

Developer BackupGuard
Plugin Icon 128x128 WordPress Backup and Migrate Plugin – Backup Guard
Version 1.6.11
Comparing to
See all releases

Code changes from version 1.6.10 to 1.6.11

Files changed (59) hide show
  1. README.txt +4 -1
  2. backup.php +2 -2
  3. public/ajax/cancelBackup.php +8 -8
  4. public/ajax/cancelDownload.php +3 -3
  5. public/ajax/checkBackupCreation.php +35 -33
  6. public/ajax/checkFreeMigration.php +11 -10
  7. public/ajax/checkPHPVersionCompatibility.php +25 -26
  8. public/ajax/checkRestoreCreation.php +34 -33
  9. public/ajax/chooseProfile.php +16 -17
  10. public/ajax/createCloudUser.php +24 -25
  11. public/ajax/curlChecker.php +10 -12
  12. public/ajax/deleteBackup.php +11 -10
  13. public/ajax/dismissDiscountNotice.php +2 -2
  14. public/ajax/downloadBackup.php +17 -20
  15. public/ajax/getAction.php +20 -22
  16. public/ajax/getBackupContent.php +53 -54
  17. public/ajax/getRunningActions.php +10 -8
  18. public/ajax/hideNotice.php +12 -11
  19. public/ajax/importBackup.php +22 -24
  20. public/ajax/isBgUserExists.php +20 -20
  21. public/ajax/isFeatureAvailable.php +3 -2
  22. public/ajax/manualBackup.php +29 -31
  23. public/ajax/modalBackupGuardDetails.php +92 -67
  24. public/ajax/modalImport.php +144 -144
  25. public/ajax/modalManualBackup.php +181 -167
  26. public/ajax/modalManualRestore.php +76 -69
  27. public/ajax/modalPrivacy.php +12 -12
  28. public/ajax/modalReview.php +9 -6
  29. public/ajax/modalTerms.php +19 -13
  30. public/ajax/resetStatus.php +19 -20
  31. public/ajax/restore.php +19 -18
  32. public/ajax/reviewBannerActions.php +26 -26
  33. public/ajax/schedule.php +139 -139
  34. public/ajax/sendUsageStatus.php +2 -2
  35. public/ajax/setReviewPopupState.php +7 -7
  36. public/ajax/setUserInfoVerificationPopupState.php +12 -13
  37. public/ajax/settings.php +154 -154
  38. public/ajax/storeSubscriberInfo.php +19 -19
  39. public/ajax/storeSurveyResult.php +25 -26
  40. public/backups.php +4 -5
  41. public/boot.php +4 -4
  42. public/cloud.php +280 -250
  43. public/dashboardWidget.php +112 -116
  44. public/include/footer-new.php +1 -1
  45. public/include/footer.php +4 -4
  46. public/include/functions.php +368 -368
  47. public/include/header-new.php +5 -2
  48. public/include/header.php +16 -16
  49. public/include/sidebar.php +130 -124
  50. public/pagesContent.php +30 -30
  51. public/proFeatures.php +110 -107
  52. public/restore_wordpress.php +299 -299
  53. public/schedule.php +89 -183
  54. public/security.php +10 -10
  55. public/services.php +69 -64
  56. public/settings.php +54 -53
  57. public/support.php +9 -8
  58. public/systemInfo.php +96 -95
  59. public/videoTutorials.php +13 -10
README.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://backup-guard.com/products/backup-wordpress
6
  Tags: backup, wordpress backup plugin, backup plugin, database backup, migrate, back up
7
  Requires at least: 5.3
8
  Tested up to: 6.0
9
- Stable tag: 1.6.10
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -168,6 +168,9 @@ When you are facing an issue of any kind with any of our products, the first thi
168
 
169
  == Changelog ==
170
 
 
 
 
171
  = 1.6.10 =
172
  * Bug fixed related to exclude paths
173
 
6
  Tags: backup, wordpress backup plugin, backup plugin, database backup, migrate, back up
7
  Requires at least: 5.3
8
  Tested up to: 6.0
9
+ Stable tag: 1.6.11
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
168
 
169
  == Changelog ==
170
 
171
+ = 1.6.11 =
172
+ * Improvement of some functions: functions are sanitized, escaped and validated
173
+
174
  = 1.6.10 =
175
  * Bug fixed related to exclude paths
176
 
backup.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Backup
5
  * Plugin URI: https://backup-guard.com/products/backup-wordpress
6
  * Description: Backup Guard is the most complete site backup and restore plugin. We offer the easiest way to backup, restore or migrate your site. You can backup your files, database or both.
7
- * Version: 1.6.10
8
  * Author: BackupGuard
9
  * Author URI: https://backup-guard.com/products/backup-wordpress
10
  * License: GPL-2.0+
@@ -16,7 +16,7 @@ if (function_exists('activate_backup_guard')) {
16
  }
17
 
18
  if (!defined('SG_BACKUP_GUARD_VERSION')) {
19
- define('SG_BACKUP_GUARD_VERSION', '1.6.10');
20
  }
21
 
22
  if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
4
  * Plugin Name: Backup
5
  * Plugin URI: https://backup-guard.com/products/backup-wordpress
6
  * Description: Backup Guard is the most complete site backup and restore plugin. We offer the easiest way to backup, restore or migrate your site. You can backup your files, database or both.
7
+ * Version: 1.6.11
8
  * Author: BackupGuard
9
  * Author URI: https://backup-guard.com/products/backup-wordpress
10
  * License: GPL-2.0+
16
  }
17
 
18
  if (!defined('SG_BACKUP_GUARD_VERSION')) {
19
+ define('SG_BACKUP_GUARD_VERSION', '1.6.11');
20
  }
21
 
22
  if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
public/ajax/cancelBackup.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- require_once(SG_BACKUP_PATH.'SGBackup.php');
4
 
5
- if(backupGuardIsAjax() && isset($_POST['actionId']))
6
- {
7
- $actionId = (int)$_POST['actionId'];
8
- SGBackup::cancelAction($actionId);
9
- die('{"success":1}');
10
- }
 
 
1
  <?php
 
 
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_BACKUP_PATH . 'SGBackup.php');
5
+
6
+ if (backupGuardIsAjax() && isset($_POST['actionId'])) {
7
+ $actionId = (int)$_POST['actionId'];
8
+ SGBackup::cancelAction($actionId);
9
+ die('{"success":1}');
10
+ }
public/ajax/cancelDownload.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
- if(backupGuardIsAjax() && isset($_POST['name']))
3
- {
4
- @unlink(SG_BACKUP_DIRECTORY.$_POST['name']);
5
  die('{"success":1}');
6
  }
1
  <?php
2
+
3
+ if (backupGuardIsAjax() && isset($_POST['name'])) {
4
+ @unlink(SG_BACKUP_DIRECTORY . sanitize_text_field($_POST['name']));
5
  die('{"success":1}');
6
  }
public/ajax/checkBackupCreation.php CHANGED
@@ -1,34 +1,36 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- require_once(SG_BACKUP_PATH.'SGBackup.php');
4
- if (backupGuardIsAjax()) {
5
- $timeout = 10; //in sec
6
- while ($timeout != 0) {
7
- sleep(1);
8
- $timeout--;
9
-
10
- $created = SGConfig::get('SG_RUNNING_ACTION', true);
11
- if ($created) {
12
- die((1));
13
- }
14
-
15
- $runningActions = SGBackup::getRunningActions();
16
-
17
- if (empty($runningActions)) {
18
- die('{"status":1}');
19
- }
20
- }
21
-
22
- $runningActions = SGBackup::getRunningActions();
23
- if (!empty($runningActions)) {
24
- // when there are multiple uncompleted actions
25
- if ($runningActions && count($runningActions) == 1 && $runningActions[0]['progress'] == 0) {
26
- SGBackup::cleanRunningActions($runningActions);
27
- die(json_encode(array(
28
- 'status' => 'cleaned'
29
- )));
30
- }
31
- }
32
-
33
- die('{"status":1}');
34
- }
 
 
1
  <?php
2
+
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_BACKUP_PATH . 'SGBackup.php');
5
+
6
+ if (backupGuardIsAjax()) {
7
+ $timeout = 10; //in sec
8
+ while ($timeout != 0) {
9
+ sleep(1);
10
+ $timeout--;
11
+
12
+ $created = SGConfig::get('SG_RUNNING_ACTION', true);
13
+ if ($created) {
14
+ die((1));
15
+ }
16
+
17
+ $runningActions = SGBackup::getRunningActions();
18
+
19
+ if (empty($runningActions)) {
20
+ die('{"status":1}');
21
+ }
22
+ }
23
+
24
+ $runningActions = SGBackup::getRunningActions();
25
+ if (!empty($runningActions)) {
26
+ // when there are multiple uncompleted actions
27
+ if ($runningActions && count($runningActions) == 1 && $runningActions[0]['progress'] == 0) {
28
+ SGBackup::cleanRunningActions($runningActions);
29
+ die(json_encode(array(
30
+ 'status' => 'cleaned'
31
+ )));
32
+ }
33
+ }
34
+
35
+ die('{"status":1}');
36
+ }
public/ajax/checkFreeMigration.php CHANGED
@@ -1,14 +1,16 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- require_once(SG_LIB_PATH.'SGArchive.php');
 
 
4
  $pluginCapabilities = backupGuardGetCapabilities();
5
 
6
  if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE) {
7
- return '';
8
  }
9
- $backupName = $_POST['bname'];
10
 
11
- $path = SG_BACKUP_DIRECTORY.$backupName.'/'.$backupName.'.sgbp';
12
 
13
  $sgArchive = new SGArchive($path, 'r');
14
  $headers = $sgArchive->getArchiveHeaders();
@@ -17,9 +19,8 @@ $siteUrl = $headers['siteUrl'];
17
  $dbPrefix = $headers['dbPrefix'];
18
 
19
  if ($siteUrl != SG_SITE_URL) {
20
- printf("The source url (%s) doesn’t match the current url (%s). This is considered as migration and it is not available in the free plugin. <a href='%s' target='_blank'>Upgrade now</a>", $siteUrl, SG_SITE_URL, BG_UPGRADE_URL);
21
- }
22
- else if ($dbPrefix != SG_ENV_DB_PREFIX) {
23
- printf("The source db prefix (%s) doesn’t match the current db prefix (%s). This is considered as migration and it is not available in the free plugin.
24
  You can change the current db prefix manually or upgrade to one of our PRO versions. <a href='%s' target='_blank'>Upgrade now</a>", $dbPrefix, SG_ENV_DB_PREFIX, BG_UPGRADE_URL);
25
- }
1
  <?php
2
+
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_LIB_PATH . 'SGArchive.php');
5
+
6
  $pluginCapabilities = backupGuardGetCapabilities();
7
 
8
  if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE) {
9
+ return '';
10
  }
11
+ $backupName = sanitize_text_field($_POST['bname']);
12
 
13
+ $path = SG_BACKUP_DIRECTORY . $backupName . '/' . $backupName . '.sgbp';
14
 
15
  $sgArchive = new SGArchive($path, 'r');
16
  $headers = $sgArchive->getArchiveHeaders();
19
  $dbPrefix = $headers['dbPrefix'];
20
 
21
  if ($siteUrl != SG_SITE_URL) {
22
+ printf("The source url (%s) doesn’t match the current url (%s). This is considered as migration and it is not available in the free plugin. <a href='%s' target='_blank'>Upgrade now</a>", $siteUrl, SG_SITE_URL, BG_UPGRADE_URL);
23
+ } else if ($dbPrefix != SG_ENV_DB_PREFIX) {
24
+ printf("The source db prefix (%s) doesn’t match the current db prefix (%s). This is considered as migration and it is not available in the free plugin.
 
25
  You can change the current db prefix manually or upgrade to one of our PRO versions. <a href='%s' target='_blank'>Upgrade now</a>", $dbPrefix, SG_ENV_DB_PREFIX, BG_UPGRADE_URL);
26
+ }
public/ajax/checkPHPVersionCompatibility.php CHANGED
@@ -1,34 +1,33 @@
1
  <?php
2
 
3
- require_once(dirname(__FILE__).'/../boot.php');
4
- require_once(SG_LIB_PATH.'SGArchive.php');
5
 
6
- if(backupGuardIsAjax() && count($_POST)) {
7
- try {
8
- $name = $_POST['bname'];
9
- $name = backupGuardRemoveSlashes($name);
10
- $path = SG_BACKUP_DIRECTORY.$name.'/'.$name.'.sgbp';
11
 
12
- $sgArchive = new SGArchive($path, 'r');
13
- $headers = $sgArchive->getArchiveHeaders();
14
 
15
- if (isset($headers['phpVersion'])) {
16
- $oldPHPVersion = $headers['phpVersion'];
17
- $currentVersion = phpversion();
18
 
19
- // Drop the last digits of version (e.g. 5.3.3 will be 5) by explicit casting from string to int. This will check the migrations like php 5.x.x -> 7.x.x
20
- if ((int)$oldPHPVersion != (int)$currentVersion) {
21
- die(json_encode(array(
22
- 'warning' => 'Warning: The backup has been captured for php '.$oldPHPVersion.' whereas your server is running php '.$currentVersion.'. If you’re sure the website is compatible with php '.$currentVersion.', please confirm to start the restoration.'
23
- )));
24
- }
25
- }
26
 
27
- die(json_encode(array()));
28
- }
29
- catch(Exception $e) {
30
- die(json_encode(array(
31
- 'error' => $e->getMessage()
32
- )));
33
- }
34
  }
1
  <?php
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_LIB_PATH . 'SGArchive.php');
5
 
6
+ if (backupGuardIsAjax() && count($_POST)) {
7
+ try {
8
+ $name = sanitize_text_field($_POST['bname']);
9
+ $name = backupGuardRemoveSlashes($name);
10
+ $path = SG_BACKUP_DIRECTORY . $name . '/' . $name . '.sgbp';
11
 
12
+ $sgArchive = new SGArchive($path, 'r');
13
+ $headers = $sgArchive->getArchiveHeaders();
14
 
15
+ if (isset($headers['phpVersion'])) {
16
+ $oldPHPVersion = $headers['phpVersion'];
17
+ $currentVersion = phpversion();
18
 
19
+ // Drop the last digits of version (e.g. 5.3.3 will be 5) by explicit casting from string to int. This will check the migrations like php 5.x.x -> 7.x.x
20
+ if ((int)$oldPHPVersion != (int)$currentVersion) {
21
+ die(json_encode(array(
22
+ 'warning' => 'Warning: The backup has been captured for php ' . $oldPHPVersion . ' whereas your server is running php ' . $currentVersion . '. If you’re sure the website is compatible with php ' . $currentVersion . ', please confirm to start the restoration.'
23
+ )));
24
+ }
25
+ }
26
 
27
+ die(json_encode(array()));
28
+ } catch (Exception $e) {
29
+ die(json_encode(array(
30
+ 'error' => $e->getMessage()
31
+ )));
32
+ }
 
33
  }
public/ajax/checkRestoreCreation.php CHANGED
@@ -1,41 +1,42 @@
1
  <?php
2
 
3
- require_once(dirname(__FILE__).'/../boot.php');
4
- require_once(SG_BACKUP_PATH.'SGBackup.php');
 
5
  $runningActions = array();
6
 
7
  if (backupGuardIsAjax()) {
8
- $timeout = 10; //in sec
9
- while ($timeout != 0) {
10
- sleep(1);
11
- $timeout--;
12
- $created = SGConfig::get('SG_RUNNING_ACTION', true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
- if ($created) {
15
- $runningActions = SGBackup::getRunningActions();
16
- // when there are multiple uncompleted actions
17
- if ($runningActions && count($runningActions) == 1 && $runningActions[0]['progress'] == 0) {
18
- $actionId = $runningActions[0]['id'];
19
- die(json_encode(array(
20
- 'status' => 0,
21
- 'external_enabled' => SGExternalRestore::isEnabled()?1:0,
22
- 'external_url' => SGExternalRestore::getInstance()->getDestinationFileUrl()
23
- )));
24
- }
25
- }
26
-
27
- $runningActions = SGBackup::getRunningActions();
28
-
29
- if (empty($runningActions)) {
30
- break;
31
- }
32
- }
33
- if (!empty($runningActions)) {
34
- SGBackup::cleanRunningActions($runningActions);
35
- die(json_encode(array(
36
- 'status' => 'cleaned'
37
- )));
38
- }
39
 
40
- die('{"status":1}');
41
  }
1
  <?php
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_BACKUP_PATH . 'SGBackup.php');
5
+
6
  $runningActions = array();
7
 
8
  if (backupGuardIsAjax()) {
9
+ $timeout = 10; //in sec
10
+ while ($timeout != 0) {
11
+ sleep(1);
12
+ $timeout--;
13
+ $created = SGConfig::get('SG_RUNNING_ACTION', true);
14
+
15
+ if ($created) {
16
+ $runningActions = SGBackup::getRunningActions();
17
+ // when there are multiple uncompleted actions
18
+ if ($runningActions && count($runningActions) == 1 && $runningActions[0]['progress'] == 0) {
19
+ $actionId = $runningActions[0]['id'];
20
+ die(json_encode(array(
21
+ 'status' => 0,
22
+ 'external_enabled' => SGExternalRestore::isEnabled() ? 1 : 0,
23
+ 'external_url' => SGExternalRestore::getInstance()->getDestinationFileUrl()
24
+ )));
25
+ }
26
+ }
27
+
28
+ $runningActions = SGBackup::getRunningActions();
29
 
30
+ if (empty($runningActions)) {
31
+ break;
32
+ }
33
+ }
34
+ if (!empty($runningActions)) {
35
+ SGBackup::cleanRunningActions($runningActions);
36
+ die(json_encode(array(
37
+ 'status' => 'cleaned'
38
+ )));
39
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
+ die('{"status":1}');
42
  }
public/ajax/chooseProfile.php CHANGED
@@ -1,22 +1,21 @@
1
  <?php
2
 
3
- require_once(dirname(__FILE__).'/../boot.php');
4
- require_once(SG_STORAGE_PATH.'BackupGuardStorage.php');
5
 
6
- if(backupGuardIsAjax() && count($_POST)) {
7
- $_POST = backupGuardRemoveSlashes($_POST);
8
- $_POST = backupGuardSanitizeTextField($_POST);
9
 
10
- if (isset($_POST['profileId']) && $_POST['profileId']) {
11
- $profileId = $_POST['profileId'];
12
- }
13
- else {
14
- $profileName = @$_POST['profileName'];
15
- $bgStorage = new BackupGuard\Storage();
16
- $profileId = $bgStorage->createProfile($profileName);
17
- }
18
 
19
- SGConfig::set('BACKUP_GUARD_PROFILE_ID', $profileId);
20
- SGConfig::set('BACKUP_GUARD_CREATE_MASTER', 1);
21
- die('{"success":"success"}');
22
- }
1
  <?php
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_STORAGE_PATH . 'BackupGuardStorage.php');
5
 
6
+ if (backupGuardIsAjax() && count($_POST)) {
7
+ $_POST = backupGuardRemoveSlashes($_POST);
8
+ $_POST = backupGuardSanitizeTextField($_POST);
9
 
10
+ if (isset($_POST['profileId']) && $_POST['profileId']) {
11
+ $profileId = intval($_POST['profileId']);
12
+ } else {
13
+ $profileName = sanitize_text_field($_POST['profileName']);
14
+ $bgStorage = new BackupGuard\Storage();
15
+ $profileId = $bgStorage->createProfile($profileName);
16
+ }
 
17
 
18
+ SGConfig::set('BACKUP_GUARD_PROFILE_ID', $profileId);
19
+ SGConfig::set('BACKUP_GUARD_CREATE_MASTER', 1);
20
+ die('{"success":"success"}');
21
+ }
public/ajax/createCloudUser.php CHANGED
@@ -1,31 +1,30 @@
1
  <?php
2
 
3
- require_once(dirname(__FILE__).'/../boot.php');
4
- require_once(SG_LIB_PATH.'BackupGuard/Client.php');
5
- require_once(SG_LIB_PATH.'SGAuthClient.php');
6
 
7
- if(backupGuardIsAjax() && count($_POST)) {
8
- $_POST = backupGuardRemoveSlashes($_POST);
9
- $_POST = backupGuardSanitizeTextField($_POST);
10
 
11
- $email = $_POST['email'];
12
- $firstname = $_POST['firstname'];
13
- $lastname = $_POST['lastname'];
14
 
15
- $client = new BackupGuard\Client();
16
- try {
17
- $user = $client->createCloudUser($email, $firstname, $lastname);
18
- if ($user) {
19
- $email = $user['email'];
20
- $password = $user['password'];
21
-
22
- $auth = SGAuthClient::getInstance();
23
- $auth->createUploadAccessToken($email, $password);
24
- }
25
- }
26
- catch (Exception $exp) {
27
- die('{"error":"error"}');
28
- }
29
 
30
- die('{"success":"success"}');
31
- }
 
 
 
 
 
 
 
1
  <?php
2
 
3
+ require_once dirname(__FILE__) . '/../boot.php';
4
+ require_once SG_LIB_PATH . 'BackupGuard/Client.php';
5
+ require_once SG_LIB_PATH . 'SGAuthClient.php';
6
 
7
+ if (backupGuardIsAjax() && count($_POST)) {
8
+ $_POST = backupGuardRemoveSlashes($_POST);
9
+ $_POST = backupGuardSanitizeTextField($_POST);
10
 
11
+ $email = sanitize_email($_POST['email']);
12
+ $firstname = sanitize_text_field($_POST['firstname']);
13
+ $lastname = sanitize_text_field($_POST['lastname']);
14
 
15
+ $client = new BackupGuard\Client();
16
+ try {
17
+ $user = $client->createCloudUser($email, $firstname, $lastname);
18
+ if ($user) {
19
+ $email = $user['email'];
20
+ $password = $user['password'];
 
 
 
 
 
 
 
 
21
 
22
+ $auth = SGAuthClient::getInstance();
23
+ $auth->createUploadAccessToken($email, $password);
24
+ }
25
+ } catch (Exception $exp) {
26
+ die('{"error":"error"}');
27
+ }
28
+
29
+ die('{"success":"success"}');
30
+ }
public/ajax/curlChecker.php CHANGED
@@ -1,14 +1,12 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- if(backupGuardIsAjax())
4
- {
5
- try
6
- {
7
- SGBoot::checkRequirement('curl');
8
- die('{"success":1}');
9
- }
10
- catch(SGException $exception)
11
- {
12
- die('{"error":"'.$exception->getMessage().'"}');
13
- }
14
  }
 
1
  <?php
2
+
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+
5
+ if (backupGuardIsAjax()) {
6
+ try {
7
+ SGBoot::checkRequirement('curl');
8
+ die('{"success":1}');
9
+ } catch (SGException $exception) {
10
+ die('{"error":"' . $exception->getMessage() . '"}');
 
 
 
11
  }
12
+ }
public/ajax/deleteBackup.php CHANGED
@@ -1,12 +1,13 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- require_once(SG_BACKUP_PATH.'SGBackup.php');
4
- if(isset($_POST['backupName']))
5
- {
6
- $backupName = backupGuardSanitizeTextField($_POST['backupName']);
7
- $backupName = backupGuardRemoveSlashes($backupName);
8
- for ($i=0; $i < count($backupName) ; $i++) {
9
- SGBackup::deleteBackup($backupName[$i]);
10
- }
11
  }
12
- die('{"success":1}');
 
1
  <?php
2
+
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_BACKUP_PATH . 'SGBackup.php');
5
+
6
+ if (isset($_POST['backupName'])) {
7
+ $backupName = backupGuardSanitizeTextField($_POST['backupName']);
8
+ $backupName = backupGuardRemoveSlashes($backupName);
9
+ for ($i = 0; $i < count($backupName); $i++) {
10
+ SGBackup::deleteBackup($backupName[$i]);
11
  }
12
+ }
13
+ die('{"success":1}');
public/ajax/dismissDiscountNotice.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
 
3
- require_once(dirname(__FILE__).'/../boot.php');
4
 
5
- SGConfig::set('SG_HIDE_CHRISTMAS_NOTICE', 1);
1
  <?php
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
 
5
+ SGConfig::set('SG_HIDE_DISCOUNT_NOTICE', 1);
public/ajax/downloadBackup.php CHANGED
@@ -1,23 +1,20 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- require_once(SG_BACKUP_PATH.'SGBackup.php');
4
- if(count($_GET))
5
- {
6
- $response = array();
7
- $downloadType = (int)$_GET['downloadType'];
8
- if($downloadType == SG_BACKUP_DOWNLOAD_TYPE_BACKUP_LOG ||
9
- $downloadType == SG_BACKUP_DOWNLOAD_TYPE_RESTORE_LOG ||
10
- $downloadType == SG_BACKUP_DOWNLOAD_TYPE_SGBP)
11
- {
12
- $backupName = $_GET['backupName'];
13
- $backupName = backupGuardRemoveSlashes($backupName);
14
- try
15
- {
16
- SGBackup::download($backupName, $downloadType);
17
- }
18
- catch (SGException $exception)
19
- {
20
- die($exception->getMessage());
21
- }
22
  }
23
  }
 
1
  <?php
2
+
3
+ require_once dirname(__FILE__) . '/../boot.php';
4
+ require_once SG_BACKUP_PATH . 'SGBackup.php';
5
+
6
+ if (count($_GET)) {
7
+ $response = array();
8
+ $downloadType = (int)$_GET['downloadType'];
9
+
10
+ if ($downloadType == SG_BACKUP_DOWNLOAD_TYPE_BACKUP_LOG || $downloadType == SG_BACKUP_DOWNLOAD_TYPE_RESTORE_LOG || $downloadType == SG_BACKUP_DOWNLOAD_TYPE_SGBP) {
11
+ $backupName = $_GET['backupName'];
12
+ $backupName = backupGuardRemoveSlashes($backupName);
13
+
14
+ try {
15
+ SGBackup::download($backupName, $downloadType);
16
+ } catch (SGException $exception) {
17
+ die($exception->getMessage());
 
 
 
 
18
  }
19
  }
20
+ }
public/ajax/getAction.php CHANGED
@@ -1,26 +1,24 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- require_once(SG_BACKUP_PATH.'SGBackup.php');
4
 
5
- if(backupGuardIsAjax() && count($_POST))
6
- {
7
- @session_write_close();
8
 
9
- $actionId = (int)$_POST['actionId'];
10
- $currentAction = SGBackup::getAction($actionId);
11
 
12
- if($currentAction)
13
- {
14
- if($currentAction['status'] == SG_ACTION_STATUS_IN_PROGRESS_FILES || $currentAction['status'] == SG_ACTION_STATUS_IN_PROGRESS_DB)
15
- {
16
- if (!SGPing::ping()) {
17
- $backup = new SGBackup;
18
- $backup->handleExecutionTimeout($actionId);
19
- $currentAction = SGBackup::getAction($actionId);
20
- }
21
- die(json_encode($currentAction));
22
- }
23
- die('0');
24
- }
25
- die('0');
26
- }
 
1
  <?php
 
 
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_BACKUP_PATH . 'SGBackup.php');
 
5
 
6
+ if (backupGuardIsAjax() && count($_POST)) {
7
+ @session_write_close();
8
 
9
+ $actionId = (int)$_POST['actionId'];
10
+ $currentAction = SGBackup::getAction($actionId);
11
+
12
+ if ($currentAction) {
13
+ if ($currentAction['status'] == SG_ACTION_STATUS_IN_PROGRESS_FILES || $currentAction['status'] == SG_ACTION_STATUS_IN_PROGRESS_DB) {
14
+ if (!SGPing::ping()) {
15
+ $backup = new SGBackup();
16
+ $backup->handleExecutionTimeout($actionId);
17
+ $currentAction = SGBackup::getAction($actionId);
18
+ }
19
+ die(json_encode($currentAction));
20
+ }
21
+ die('0');
22
+ }
23
+ die('0');
24
+ }
public/ajax/getBackupContent.php CHANGED
@@ -1,56 +1,55 @@
1
  <?php
 
2
  header('Content-Type: application/json');
3
- require_once(dirname(__FILE__).'/../boot.php');
4
- require_once(SG_LIB_PATH.'SGArchive.php');
5
- require_once(SG_BACKUP_PATH.'SGBackupFiles.php');
6
- $backupName = $_GET['backupName'];
7
- $path = isset($_GET["path"])? $_GET["path"] : "wp-content/";
8
- $parent = $path;
9
- $data = array();
10
-
11
- $disabled = !SGBoot::isFeatureAvailable('SLECTIVE_RESTORE');
12
-
13
- if ($path == "#") {
14
-
15
- $parentNode = array();
16
- $parentNode["id"] = "/";
17
- $parentNode["parent"] = "#";
18
- $parentNode["text"] = "/";
19
- $parentNode["type"] = "none";
20
- $parentNode["children"] = true;
21
- $parentNode["state"] = array ("selected"=>true);
22
- array_push($data,$parentNode);
23
-
24
- }
25
- else {
26
- if ($path == "/") {
27
- $path = "";
28
- }
29
- else {
30
- $path .= '/';
31
- }
32
-
33
- $backupPath = SG_BACKUP_DIRECTORY.$backupName;
34
- $backupPath= $backupPath.'/'.$backupName.'.sgbp';
35
- $backupFiles = new SGBackupFiles();
36
- $archive = new SGArchive($backupPath,'r');
37
- $archive->setDelegate($backupFiles);
38
- $headers = $archive->getArchiveHeaders();
39
- $filesList = $archive->getFilesList();
40
- $tree = $archive->getTreefromList($filesList, $path);
41
-
42
-
43
- foreach ($tree as $node) {
44
- $el = array();
45
- $el["id"] = $path.$node->name;
46
- $el["parent"] = $parent;
47
- $el["text"] = $node->name;
48
- $el["type"] = $node->type;
49
- if ($node->type == "folder") {
50
- $el["children"] = true;
51
- }
52
- array_push($data, $el);
53
- }
54
- }
55
-
56
- echo json_encode($data);
1
  <?php
2
+
3
  header('Content-Type: application/json');
4
+
5
+ require_once(dirname(__FILE__) . '/../boot.php');
6
+ require_once(SG_LIB_PATH . 'SGArchive.php');
7
+ require_once(SG_BACKUP_PATH . 'SGBackupFiles.php');
8
+
9
+ $backupName = $_GET['backupName'];
10
+ $path = isset($_GET["path"]) ? $_GET["path"] : "wp-content/";
11
+ $parent = $path;
12
+ $data = array();
13
+
14
+ $disabled = !SGBoot::isFeatureAvailable('SLECTIVE_RESTORE');
15
+
16
+ if ($path == "#") {
17
+ $parentNode = array();
18
+ $parentNode["id"] = "/";
19
+ $parentNode["parent"] = "#";
20
+ $parentNode["text"] = "/";
21
+ $parentNode["type"] = "none";
22
+ $parentNode["children"] = true;
23
+ $parentNode["state"] = array("selected" => true);
24
+ array_push($data, $parentNode);
25
+ } else {
26
+ if ($path == "/") {
27
+ $path = "";
28
+ } else {
29
+ $path .= '/';
30
+ }
31
+
32
+ $backupPath = SG_BACKUP_DIRECTORY . $backupName;
33
+ $backupPath = $backupPath . '/' . $backupName . '.sgbp';
34
+ $backupFiles = new SGBackupFiles();
35
+ $archive = new SGArchive($backupPath, 'r');
36
+ $archive->setDelegate($backupFiles);
37
+ $headers = $archive->getArchiveHeaders();
38
+ $filesList = $archive->getFilesList();
39
+ $tree = $archive->getTreefromList($filesList, $path);
40
+
41
+
42
+ foreach ($tree as $node) {
43
+ $el = array();
44
+ $el["id"] = $path . $node->name;
45
+ $el["parent"] = $parent;
46
+ $el["text"] = $node->name;
47
+ $el["type"] = $node->type;
48
+ if ($node->type == "folder") {
49
+ $el["children"] = true;
50
+ }
51
+ array_push($data, $el);
52
+ }
53
+ }
54
+
55
+ echo json_encode($data);
 
 
public/ajax/getRunningActions.php CHANGED
@@ -1,10 +1,12 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- require_once(SG_BACKUP_PATH.'SGBackup.php');
4
- if(backupGuardIsAjax()) {
5
- $runningAction = backupGuardGetRunningActions();
6
- if($runningAction) {
7
- die(json_encode($runningAction));
8
- }
9
- die('0');
10
  }
 
 
1
  <?php
2
+
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_BACKUP_PATH . 'SGBackup.php');
5
+
6
+ if (backupGuardIsAjax()) {
7
+ $runningAction = backupGuardGetRunningActions();
8
+ if ($runningAction) {
9
+ die(json_encode($runningAction));
10
  }
11
+ die('0');
12
+ }
public/ajax/hideNotice.php CHANGED
@@ -1,16 +1,17 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
 
4
- if(backupGuardIsAjax() && count($_POST)) {
5
- if ($_POST['notice'] == SG_NOTICE_EXECUTION_TIMEOUT) {
6
- SGConfig::set('SG_EXCEPTION_TIMEOUT_ERROR', '0');
7
- }
8
 
9
- if ($_POST['notice'] == SG_NOTICE_MIGRATION_ERROR) {
10
- SGConfig::set('SG_BACKUP_SHOW_MIGRATION_ERROR', '0');
11
- }
 
12
 
13
- if ($_POST['notice'] == SG_NOTICE_NOT_WRITABLE_ERROR) {
14
- SGConfig::set('SG_BACKUP_SHOW_NOT_WRITABLE_ERROR', '0');
15
- }
 
 
 
 
16
  }
1
  <?php
 
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
 
 
 
4
 
5
+ if (backupGuardIsAjax() && count($_POST)) {
6
+ if ($_POST['notice'] == SG_NOTICE_EXECUTION_TIMEOUT) {
7
+ SGConfig::set('SG_EXCEPTION_TIMEOUT_ERROR', '0');
8
+ }
9
 
10
+ if ($_POST['notice'] == SG_NOTICE_MIGRATION_ERROR) {
11
+ SGConfig::set('SG_BACKUP_SHOW_MIGRATION_ERROR', '0');
12
+ }
13
+
14
+ if ($_POST['notice'] == SG_NOTICE_NOT_WRITABLE_ERROR) {
15
+ SGConfig::set('SG_BACKUP_SHOW_NOT_WRITABLE_ERROR', '0');
16
+ }
17
  }
public/ajax/importBackup.php CHANGED
@@ -1,24 +1,22 @@
1
- <?php
2
-
3
- require_once(dirname(__FILE__).'/../boot.php');
4
- require_once(SG_BACKUP_PATH.'SGBackup.php');
5
- require_once(SG_LIB_PATH.'SGUploadHandler.php');
6
-
7
- $error = array();
8
- $success = array('success'=>1);
9
-
10
- try {
11
-
12
- if (!current_user_can('administrator')) {
13
- die();
14
- }
15
-
16
- $sgUploadHandler = new BackupGuard\Upload\Handler($_FILES);
17
- }
18
- catch (SGException $exception) {
19
- array_push($error, $exception->getMessage());
20
- die(json_encode($error));
21
- }
22
-
23
- echo json_encode($success);
24
- die();
1
+ <?php
2
+
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_BACKUP_PATH . 'SGBackup.php');
5
+ require_once(SG_LIB_PATH . 'SGUploadHandler.php');
6
+
7
+ $error = array();
8
+ $success = array('success' => 1);
9
+
10
+ try {
11
+ if (!current_user_can('administrator')) {
12
+ die();
13
+ }
14
+
15
+ $sgUploadHandler = new BackupGuard\Upload\Handler($_FILES);
16
+ } catch (SGException $exception) {
17
+ array_push($error, $exception->getMessage());
18
+ die(json_encode($error));
19
+ }
20
+
21
+ echo json_encode($success);
22
+ die();
 
 
public/ajax/isBgUserExists.php CHANGED
@@ -1,27 +1,27 @@
1
  <?php
2
 
3
- require_once(dirname(__FILE__).'/../boot.php');
4
- require_once(SG_LIB_PATH.'BackupGuard/Client.php');
5
 
6
- if(backupGuardIsAjax() && count($_POST)) {
7
- $_POST = backupGuardRemoveSlashes($_POST);
8
- $_POST = backupGuardSanitizeTextField($_POST);
9
- $messages = array();
10
 
11
- $email = $_POST['email'];
12
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
13
- $messages['validationError'] = 'error';
14
- $messages['message'] = 'Invalid email';
15
- echo json_encode($messages);
16
- die();
17
- }
18
 
19
- $client = new BackupGuard\Client();
20
- $found = $client->checkEmailExists($email);
21
 
22
- if (!$found) {
23
- die('{"user":"notFound"}');
24
- }
25
 
26
- die('{"success":"success"}');
27
- }
1
  <?php
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_LIB_PATH . 'BackupGuard/Client.php');
5
 
6
+ if (backupGuardIsAjax() && count($_POST)) {
7
+ $_POST = backupGuardRemoveSlashes($_POST);
8
+ $_POST = backupGuardSanitizeTextField($_POST);
9
+ $messages = array();
10
 
11
+ $email = $_POST['email'];
12
+ if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
13
+ $messages['validationError'] = 'error';
14
+ $messages['message'] = 'Invalid email';
15
+ echo json_encode($messages);
16
+ die();
17
+ }
18
 
19
+ $client = new BackupGuard\Client();
20
+ $found = $client->checkEmailExists($email);
21
 
22
+ if (!$found) {
23
+ die('{"user":"notFound"}');
24
+ }
25
 
26
+ die('{"success":"success"}');
27
+ }
public/ajax/isFeatureAvailable.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
 
3
 
4
  $sgFeature = $_POST['sgFeature'];
5
  if (!SGBoot::isFeatureAvailable($sgFeature)) {
6
- die('{"error":'._backupGuardT("This feature is not available in your package.", true).'"}');
7
  }
8
 
9
  die('{"success":1}');
1
  <?php
2
+
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
 
5
  $sgFeature = $_POST['sgFeature'];
6
  if (!SGBoot::isFeatureAvailable($sgFeature)) {
7
+ die('{"error":' . _backupGuardT("This feature is not available in your package.", true) . '"}');
8
  }
9
 
10
  die('{"success":1}');
public/ajax/manualBackup.php CHANGED
@@ -4,35 +4,33 @@ require_once(dirname(__FILE__) . '/../boot.php');
4
  require_once(SG_BACKUP_PATH . 'SGBackup.php');
5
 
6
  try {
7
- $state = false;
8
- $success = array('success' => 1);
9
-
10
- if (backupGuardIsAjax() && count($_POST)) {
11
-
12
- $allActions = SGBackup::getRunningActions();
13
- if (count($allActions)) { // abort any other backup if there is an active action
14
- die(json_encode(array(
15
- "error" => _backupGuardT("There is an active backup running. Please try later", true)
16
- )));
17
- }
18
-
19
- $options = $_POST;
20
- $error = array();
21
- SGConfig::set("SG_BACKUP_TYPE", (int)$options['backup-type']);
22
-
23
- $options = backupGuardGetBackupOptions($options);
24
-
25
- $sgBackup = new SGBackup();
26
- $sgBackup->backup($options, $state);
27
-
28
- die(json_encode($success));
29
- }
30
-
31
- die(json_encode(array(
32
- "error" => "Direct call"
33
- )));
34
- }
35
- catch (SGException $exception) {
36
- array_push($error, $exception->getMessage());
37
- die(json_encode($error));
38
  }
4
  require_once(SG_BACKUP_PATH . 'SGBackup.php');
5
 
6
  try {
7
+ $state = false;
8
+ $success = array('success' => 1);
9
+
10
+ if (backupGuardIsAjax() && count($_POST)) {
11
+ $allActions = SGBackup::getRunningActions();
12
+ if (count($allActions)) { // abort any other backup if there is an active action
13
+ die(json_encode(array(
14
+ "error" => _backupGuardT("There is an active backup running. Please try later", true)
15
+ )));
16
+ }
17
+
18
+ $options = $_POST;
19
+ $error = array();
20
+ SGConfig::set("SG_BACKUP_TYPE", (int)$options['backup-type']);
21
+
22
+ $options = backupGuardGetBackupOptions($options);
23
+
24
+ $sgBackup = new SGBackup();
25
+ $sgBackup->backup($options, $state);
26
+
27
+ die(json_encode($success));
28
+ }
29
+
30
+ die(json_encode(array(
31
+ "error" => "Direct call"
32
+ )));
33
+ } catch (SGException $exception) {
34
+ array_push($error, $exception->getMessage());
35
+ die(json_encode($error));
 
 
36
  }
public/ajax/modalBackupGuardDetails.php CHANGED
@@ -1,87 +1,112 @@
1
  <?php
2
- global $current_user;
 
3
  $websiteName = get_bloginfo();
4
  ?>
5
-
6
  <div class="modal-dialog">
7
- <div class="modal-content">
8
- <div class="modal-header">
9
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
10
- <h4 class="modal-title"><?php _backupGuardT('BackupGuard')?></h4>
11
- </div>
12
- <form class="form-horizontal" id="backupGuardDetailsModal" data-sgform="ajax">
13
- <div class="modal-body sg-modal-body">
14
  <div class="hide sgbg-connection-message bg-invalid-login">
15
  Invalid login info. Please try again.
16
  </div>
17
  <div class="hide sgbg-connection-message bg-email-confirmation">
18
- We've sent you a confirmation e-mail. Please activate your account to get started. If you didn't receive it, please <a href="<?php echo SG_BACKUP_SUPPORT_URL; ?>" target="_blank">contact us</a>.
 
19
  </div>
20
  <div class="sgbg-connection-message bg-welcome-message">
21
- Please enter your BackupGuard e-mail address. If you don't have an account yet, we will create it for you.
 
22
  </div>
23
  <div class="hide sgbg-connection-message bg-loggin-form-message">
24
- Account found. Please enter your password to continue. <a href="<?php echo SG_FORGOT_PASSWORD_URL; ?>" target="_blank">Forgot your password?</a>
 
25
  </div>
26
  <div class="hide sgbg-connection-message bg-register-form-message">
27
- No account was found with the provided e-mail address. Please enter your full name to create a new account.
 
28
  </div>
29
  <div class="hide sgbg-connection-message bg-create-form-message">
30
  Now we need to setup your website's profile. Please enter a new profile name for your website.
31
  </div>
32
- <div class="col-md-12">
33
- <div id="bg-email-container" class="form-group">
34
- <label class="col-md-3 control-label" for="email"><?php _backupGuardT('Email')?></label>
35
- <div class="col-md-8">
36
- <input id="email" name="email" type="text" class="form-control input-md sg-backup-input sg-backup-input-email" placeholder="<?php _backupGuardT('Email')?>" autocomplete="off">
37
- </div>
38
- </div>
39
- <div id="bg-firstname-container" class="form-group hidden">
40
- <label class="col-md-3 control-label" for="firstname"><?php _backupGuardT('First Name')?></label>
41
- <div class="col-md-8">
42
- <input id="firstname" name="firstname" type="text" class="form-control input-md sg-backup-input" placeholder="<?php _backupGuardT('First Name')?>" value="<?php echo $current_user->user_firstname?>" autocomplete="off">
43
- </div>
44
- </div>
45
- <div id="bg-lastname-container" class="form-group hidden">
46
- <label class="col-md-3 control-label" for="lastname"><?php _backupGuardT('Last Name')?></label>
47
- <div class="col-md-8">
48
- <input id="lastname" name="lastname" type="text" class="form-control input-md sg-backup-input" placeholder="<?php _backupGuardT('Last Name')?>" value="<?php echo $current_user->user_lastname?>" autocomplete="off">
49
- </div>
50
- </div>
 
 
 
 
 
 
 
 
 
51
 
52
- <div id="bg-password-container" class="form-group hidden">
53
- <label class="col-md-3 control-label" for="password"><?php _backupGuardT('Password')?></label>
54
- <div class="col-md-8">
55
- <input id="password" name="password" type="password" class="form-control input-md sg-backup-input" placeholder="<?php _backupGuardT('Password')?>" autocomplete="off">
56
- </div>
57
- </div>
58
- <div id="bg-profiles-container" class="form-group hidden">
59
- <div class="row bg-select-profile hidden">
60
- <label class="col-md-3 control-label" for="password"><?php _backupGuardT('Profiles')?></label>
61
- <div class="col-md-8">
62
- <select id="bg-profiles" name="bg-profiles" class="form-control input-md">
63
- <option value="0"><?php _backupGuardT('Create New')?></option>
64
- </select>
65
- </div>
66
- </div>
67
- <br>
68
- <div id="bg-profile-name-container" class="row">
69
- <label class="col-md-3 control-label" for="bg-profile-name"><?php _backupGuardT('Profile name')?></label>
70
- <div class="col-md-8">
71
- <input id="bg-profile-name" name="bg-profile-name" type="text" class="form-control input-md sg-backup-input" placeholder="<?php _backupGuardT('Profile name')?>" value="<?php echo esc_attr($websiteName); ?>">
72
- </div>
73
- </div>
74
- </div>
75
- </div>
76
- <div class="clearfix"></div>
77
- </div>
78
- <div class="modal-footer">
79
- <span id="bg-close-button" class="modal-close-button" data-dismiss="modal"><?php _backupGuardT('Close')?></span>
80
- <button id="bg-connect-account" type="button" class="btn btn-success" onclick="sgBackup.backupGuardConnect()"><?php _backupGuardT('Connect')?></button>
81
- <button id="bg-login" type="button" class="btn btn-success hidden" onclick="sgBackup.backupGuardLogin()"><?php _backupGuardT('Login')?></button>
82
- <button id="bg-create-account" type="button" class="btn btn-success hidden" onclick="sgBackup.createCloudUser()"><?php _backupGuardT('Create Account')?></button>
83
- <button id="bg-choose-profile" type="button" class="btn btn-success hidden" onclick="sgBackup.chooseProfile()"><?php _backupGuardT('Choose')?></button>
84
- </div>
85
- </form>
86
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
87
  </div>
1
  <?php
2
+
3
+ global $current_user; // phpcs:ignore
4
  $websiteName = get_bloginfo();
5
  ?>
 
6
  <div class="modal-dialog">
7
+ <div class="modal-content">
8
+ <div class="modal-header">
9
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
10
+ <h4 class="modal-title"><?php _backupGuardT('BackupGuard') ?></h4>
11
+ </div>
12
+ <form class="form-horizontal" id="backupGuardDetailsModal" data-sgform="ajax">
13
+ <div class="modal-body sg-modal-body">
14
  <div class="hide sgbg-connection-message bg-invalid-login">
15
  Invalid login info. Please try again.
16
  </div>
17
  <div class="hide sgbg-connection-message bg-email-confirmation">
18
+ We've sent you a confirmation e-mail. Please activate your account to get started. If you didn't
19
+ receive it, please <a href="<?php echo SG_BACKUP_SUPPORT_URL; ?>" target="_blank">contact us</a>.
20
  </div>
21
  <div class="sgbg-connection-message bg-welcome-message">
22
+ Please enter your BackupGuard e-mail address. If you don't have an account yet, we will create it
23
+ for you.
24
  </div>
25
  <div class="hide sgbg-connection-message bg-loggin-form-message">
26
+ Account found. Please enter your password to continue. <a
27
+ href="<?php echo SG_FORGOT_PASSWORD_URL; ?>" target="_blank">Forgot your password?</a>
28
  </div>
29
  <div class="hide sgbg-connection-message bg-register-form-message">
30
+ No account was found with the provided e-mail address. Please enter your full name to create a new
31
+ account.
32
  </div>
33
  <div class="hide sgbg-connection-message bg-create-form-message">
34
  Now we need to setup your website's profile. Please enter a new profile name for your website.
35
  </div>
36
+ <div class="col-md-12">
37
+ <div id="bg-email-container" class="form-group">
38
+ <label class="col-md-3 control-label" for="email"><?php _backupGuardT('Email') ?></label>
39
+ <div class="col-md-8">
40
+ <input id="email" name="email" type="text"
41
+ class="form-control input-md sg-backup-input sg-backup-input-email"
42
+ placeholder="<?php _backupGuardT('Email') ?>" autocomplete="off">
43
+ </div>
44
+ </div>
45
+ <div id="bg-firstname-container" class="form-group hidden">
46
+ <label class="col-md-3 control-label"
47
+ for="firstname"><?php _backupGuardT('First Name') ?></label>
48
+ <div class="col-md-8">
49
+ <input id="firstname" name="firstname" type="text"
50
+ class="form-control input-md sg-backup-input"
51
+ placeholder="<?php _backupGuardT('First Name') ?>"
52
+ value="<?php echo $current_user->user_firstname; // phpcs:ignore ?>" autocomplete="off">
53
+ </div>
54
+ </div>
55
+ <div id="bg-lastname-container" class="form-group hidden">
56
+ <label class="col-md-3 control-label" for="lastname"><?php _backupGuardT('Last Name') ?></label>
57
+ <div class="col-md-8">
58
+ <input id="lastname" name="lastname" type="text"
59
+ class="form-control input-md sg-backup-input"
60
+ placeholder="<?php _backupGuardT('Last Name') ?>"
61
+ value="<?php echo $current_user->user_lastname; // phpcs:ignore ?>" autocomplete="off">
62
+ </div>
63
+ </div>
64
 
65
+ <div id="bg-password-container" class="form-group hidden">
66
+ <label class="col-md-3 control-label" for="password"><?php _backupGuardT('Password') ?></label>
67
+ <div class="col-md-8">
68
+ <input id="password" name="password" type="password"
69
+ class="form-control input-md sg-backup-input"
70
+ placeholder="<?php _backupGuardT('Password') ?>" autocomplete="off">
71
+ </div>
72
+ </div>
73
+ <div id="bg-profiles-container" class="form-group hidden">
74
+ <div class="row bg-select-profile hidden">
75
+ <label class="col-md-3 control-label"
76
+ for="password"><?php _backupGuardT('Profiles') ?></label>
77
+ <div class="col-md-8">
78
+ <select id="bg-profiles" name="bg-profiles" class="form-control input-md">
79
+ <option value="0"><?php _backupGuardT('Create New') ?></option>
80
+ </select>
81
+ </div>
82
+ </div>
83
+ <br>
84
+ <div id="bg-profile-name-container" class="row">
85
+ <label class="col-md-3 control-label"
86
+ for="bg-profile-name"><?php _backupGuardT('Profile name') ?></label>
87
+ <div class="col-md-8">
88
+ <input id="bg-profile-name" name="bg-profile-name" type="text"
89
+ class="form-control input-md sg-backup-input"
90
+ placeholder="<?php _backupGuardT('Profile name') ?>"
91
+ value="<?php echo esc_attr($websiteName); ?>">
92
+ </div>
93
+ </div>
94
+ </div>
95
+ </div>
96
+ <div class="clearfix"></div>
97
+ </div>
98
+ <div class="modal-footer">
99
+ <span id="bg-close-button" class="modal-close-button"
100
+ data-dismiss="modal"><?php _backupGuardT('Close') ?></span>
101
+ <button id="bg-connect-account" type="button" class="btn btn-success"
102
+ onclick="sgBackup.backupGuardConnect()"><?php _backupGuardT('Connect') ?></button>
103
+ <button id="bg-login" type="button" class="btn btn-success hidden"
104
+ onclick="sgBackup.backupGuardLogin()"><?php _backupGuardT('Login') ?></button>
105
+ <button id="bg-create-account" type="button" class="btn btn-success hidden"
106
+ onclick="sgBackup.createCloudUser()"><?php _backupGuardT('Create Account') ?></button>
107
+ <button id="bg-choose-profile" type="button" class="btn btn-success hidden"
108
+ onclick="sgBackup.chooseProfile()"><?php _backupGuardT('Choose') ?></button>
109
+ </div>
110
+ </form>
111
+ </div>
112
  </div>
public/ajax/modalImport.php CHANGED
@@ -1,144 +1,144 @@
1
- <?php
2
-
3
- require_once dirname(__FILE__) . '/../boot.php';
4
- $backupDirectory = SGConfig::get('SG_BACKUP_DIRECTORY');
5
- $maxUploadSize = ini_get('upload_max_filesize');
6
- $dropbox = SGConfig::get('SG_DROPBOX_ACCESS_TOKEN');
7
- $gdrive = SGConfig::get('SG_GOOGLE_DRIVE_REFRESH_TOKEN');
8
- $ftp = SGConfig::get('SG_STORAGE_FTP_CONNECTED');
9
- $amazon = SGConfig::get('SG_AMAZON_KEY');
10
- $oneDrive = SGConfig::get('SG_ONE_DRIVE_REFRESH_TOKEN');
11
- $pCloud = SGConfig::get('SG_P_CLOUD_ACCESS_TOKEN');
12
- $box = SGConfig::get('SG_BOX_REFRESH_TOKEN');
13
- $backupGuard = SGConfig::get('SG_BACKUPGUARD_UPLOAD_ACCESS_TOKEN');
14
- ?>
15
- <div class="modal-dialog">
16
- <div class="modal-content">
17
- <div class="modal-header">
18
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
19
- <h4 class="modal-title"><?php _backupGuardT('Import from') ?></h4>
20
- </div>
21
- <div class="modal-body sg-modal-body" id="sg-modal-inport-from">
22
- <div class="col-md-12" id="modal-import-1">
23
- <div class="form-group">
24
- <table class="table table-striped paginated sg-backup-table">
25
- <tbody>
26
- <tr>
27
- <td class="file-select-radio"><input name="storage-radio" type="radio" value="local-pc"
28
- checked></td>
29
- <td></td>
30
- <td><?php _backupGuardT('Local PC') ?></td>
31
- </tr>
32
- <?php if (SGBoot::isFeatureAvailable('DOWNLOAD_FROM_CLOUD')) : ?>
33
- <?php if (SGBoot::isFeatureAvailable('BACKUP_GUARD') && SG_SHOW_BACKUPGUARD_CLOUD) : ?>
34
- <tr>
35
- <td class="file-select-radio"><input name="storage-radio" type="radio"
36
- value="<?php echo SG_STORAGE_BACKUP_GUARD ?>" <?php echo empty($backupGuard) ? 'disabled="disabled"' : '' ?>>
37
- </td>
38
- <td><span class="btn-xs sg-status-icon sg-status-36 active">&nbsp;</span></td>
39
- <td><?php echo 'BackupGuard' ?></td>
40
- </tr>
41
- <?php endif; ?>
42
- <tr>
43
- <td class="file-select-radio"><input name="storage-radio" type="radio"
44
- value="<?php echo SG_STORAGE_FTP ?>" <?php echo empty($ftp) ? 'disabled="disabled"' : '' ?>>
45
- </td>
46
- <td><span class="btn-xs sg-status-icon sg-status-31 active">&nbsp;</span></td>
47
- <td><?php echo 'FTP' ?></td>
48
- </tr>
49
- <tr>
50
- <td class="file-select-radio"><input name="storage-radio" type="radio"
51
- value="<?php echo SG_STORAGE_DROPBOX ?>" <?php echo empty($dropbox) ? 'disabled="disabled"' : '' ?>>
52
- </td>
53
- <td><span class="btn-xs sg-status-icon sg-status-32 active">&nbsp;</span></td>
54
- <td><?php echo 'Dropbox' ?></td>
55
- </tr>
56
- <tr>
57
- <td class="file-select-radio"><input name="storage-radio" type="radio"
58
- value="<?php echo SG_STORAGE_GOOGLE_DRIVE ?>" <?php echo empty($gdrive) ? 'disabled="disabled"' : '' ?>>
59
- </td>
60
- <td><span class="btn-xs sg-status-icon sg-status-33 active">&nbsp;</span></td>
61
- <td><?php echo 'Google Drive' ?></td>
62
- </tr>
63
- <tr>
64
- <td class="file-select-radio"><input name="storage-radio" type="radio"
65
- value="<?php echo SG_STORAGE_AMAZON ?>" <?php echo empty($amazon) ? 'disabled="disabled"' : '' ?>>
66
- </td>
67
- <td><span class="btn-xs sg-status-icon sg-status-34 active">&nbsp;</span></td>
68
- <td><?php echo (backupGuardIsAccountGold() ? 'Amazon ' : '') . 'S3' ?></td>
69
- </tr>
70
- <tr>
71
- <td class="file-select-radio"><input name="storage-radio" type="radio"
72
- value="<?php echo SG_STORAGE_ONE_DRIVE ?>" <?php echo empty($oneDrive) ? 'disabled="disabled"' : '' ?>>
73
- </td>
74
- <td><span class="btn-xs sg-status-icon sg-status-35 active">&nbsp;</span></td>
75
- <td><?php echo 'One Drive' ?></td>
76
- </tr>
77
- <tr>
78
- <td class="file-select-radio"><input name="storage-radio" type="radio"
79
- value="<?php echo SG_STORAGE_P_CLOUD ?>" <?php echo empty($pCloud) ? 'disabled="disabled"' : '' ?>>
80
- </td>
81
- <td><span class="btn-xs sg-status-icon sg-status-37 active">&nbsp;</span></td>
82
- <td><?php echo 'pCloud' ?></td>
83
- </tr>
84
- <tr>
85
- <td class="file-select-radio"><input name="storage-radio" type="radio"
86
- value="<?php echo SG_STORAGE_BOX ?>" <?php echo empty($box) ? 'disabled="disabled"' : '' ?>>
87
- </td>
88
- <td><span class="btn-xs sg-status-icon sg-status-38 active">&nbsp;</span></td>
89
- <td><?php echo 'box.com' ?></td>
90
- </tr>
91
- <?php endif; ?>
92
- </tbody>
93
- </table>
94
- </div>
95
- </div>
96
- <div class="col-md-12" id="modal-import-2">
97
- <div class="form-group import-modal-popup-content">
98
- <div class="col-md-9">
99
- <input type="text" id="sg-import-file-name" class="form-control sg-backup-input"
100
- placeholder="<?php _backupGuardT('SGBP file') ?>" readonly>
101
- </div>
102
- <div class="col-lg-3">
103
- <span class="input-group-btn">
104
- <span class="btn btn-primary btn-file backup-browse-btn">
105
- <?php _backupGuardT('Browse') ?>&hellip; <input class="sg-backup-upload-input"
106
- type="file" name="files[]"
107
- data-url="<?php echo admin_url('admin-ajax.php') . "?action=backup_guard_importBackup&token=" . wp_create_nonce('backupGuardAjaxNonce') ?>"
108
- data-max-file-size="<?php echo backupGuardConvertToBytes($maxUploadSize . 'B'); ?>"
109
- accept=".sgbp">
110
- </span>
111
- </span>
112
- </div>
113
- </div>
114
- </div>
115
- <?php if (SGBoot::isFeatureAvailable('DOWNLOAD_FROM_CLOUD')) : ?>
116
- <div class="col-md-12" id="modal-import-3">
117
- <table class="table table-striped paginated sg-backup-table" id="sg-archive-list-table">
118
- <thead>
119
- <tr>
120
- <th></th>
121
- <th><?php _backupGuardT('Filename') ?></th>
122
- <th><?php _backupGuardT('Size') ?></th>
123
- <th><?php _backupGuardT('Date') ?></th>
124
- </tr>
125
- </thead>
126
- <tbody>
127
- </tbody>
128
- </table>
129
- </div>
130
- <?php endif; ?>
131
- <div class="clearfix"></div>
132
- </div>
133
- <div class="modal-footer">
134
- <button type="button" class="pull-left btn btn-primary" id="switch-modal-import-pages-back"
135
- onclick="sgBackup.previousPage()"><?php _backupGuardT('Back') ?></button>
136
- <span class="modal-close-button" id="sg-close-modal-import"
137
- data-dismiss="modal"><?php _backupGuardT("Close") ?></span>
138
- <button type="button" class="btn btn-success" id="switch-modal-import-pages-next" data-remote="importBackup"
139
- onclick="sgBackup.nextPage()"><?php _backupGuardT('Next') ?></button>
140
- <button type="button" data-remote="importBackup" id="uploadSgbpFile"
141
- class="btn btn-success"><?php _backupGuardT('Import') ?></button>
142
- </div>
143
- </div>
144
- </div>
1
+ <?php
2
+
3
+ require_once dirname(__FILE__) . '/../boot.php';
4
+ $backupDirectory = SGConfig::get('SG_BACKUP_DIRECTORY');
5
+ $maxUploadSize = ini_get('upload_max_filesize');
6
+ $dropbox = SGConfig::get('SG_DROPBOX_ACCESS_TOKEN');
7
+ $gdrive = SGConfig::get('SG_GOOGLE_DRIVE_REFRESH_TOKEN');
8
+ $ftp = SGConfig::get('SG_STORAGE_FTP_CONNECTED');
9
+ $amazon = SGConfig::get('SG_AMAZON_KEY');
10
+ $oneDrive = SGConfig::get('SG_ONE_DRIVE_REFRESH_TOKEN');
11
+ $pCloud = SGConfig::get('SG_P_CLOUD_ACCESS_TOKEN');
12
+ $box = SGConfig::get('SG_BOX_REFRESH_TOKEN');
13
+ $backupGuard = SGConfig::get('SG_BACKUPGUARD_UPLOAD_ACCESS_TOKEN');
14
+ ?>
15
+ <div class="modal-dialog">
16
+ <div class="modal-content">
17
+ <div class="modal-header">
18
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
19
+ <h4 class="modal-title"><?php _backupGuardT('Import from') ?></h4>
20
+ </div>
21
+ <div class="modal-body sg-modal-body" id="sg-modal-inport-from">
22
+ <div class="col-md-12" id="modal-import-1">
23
+ <div class="form-group">
24
+ <table class="table table-striped paginated sg-backup-table">
25
+ <tbody>
26
+ <tr>
27
+ <td class="file-select-radio"><input name="storage-radio" type="radio" value="local-pc"
28
+ checked></td>
29
+ <td></td>
30
+ <td><?php _backupGuardT('Local PC') ?></td>
31
+ </tr>
32
+ <?php if (SGBoot::isFeatureAvailable('DOWNLOAD_FROM_CLOUD')) : ?>
33
+ <?php if (SGBoot::isFeatureAvailable('BACKUP_GUARD') && SG_SHOW_BACKUPGUARD_CLOUD) : ?>
34
+ <tr>
35
+ <td class="file-select-radio"><input name="storage-radio" type="radio"
36
+ value="<?php echo SG_STORAGE_BACKUP_GUARD ?>" <?php echo empty($backupGuard) ? 'disabled="disabled"' : '' ?>>
37
+ </td>
38
+ <td><span class="btn-xs sg-status-icon sg-status-36 active">&nbsp;</span></td>
39
+ <td><?php echo 'BackupGuard' ?></td>
40
+ </tr>
41
+ <?php endif; ?>
42
+ <tr>
43
+ <td class="file-select-radio"><input name="storage-radio" type="radio"
44
+ value="<?php echo SG_STORAGE_FTP ?>" <?php echo empty($ftp) ? 'disabled="disabled"' : '' ?>>
45
+ </td>
46
+ <td><span class="btn-xs sg-status-icon sg-status-31 active">&nbsp;</span></td>
47
+ <td><?php echo 'FTP' ?></td>
48
+ </tr>
49
+ <tr>
50
+ <td class="file-select-radio"><input name="storage-radio" type="radio"
51
+ value="<?php echo SG_STORAGE_DROPBOX ?>" <?php echo empty($dropbox) ? 'disabled="disabled"' : '' ?>>
52
+ </td>
53
+ <td><span class="btn-xs sg-status-icon sg-status-32 active">&nbsp;</span></td>
54
+ <td><?php echo 'Dropbox' ?></td>
55
+ </tr>
56
+ <tr>
57
+ <td class="file-select-radio"><input name="storage-radio" type="radio"
58
+ value="<?php echo SG_STORAGE_GOOGLE_DRIVE ?>" <?php echo empty($gdrive) ? 'disabled="disabled"' : '' ?>>
59
+ </td>
60
+ <td><span class="btn-xs sg-status-icon sg-status-33 active">&nbsp;</span></td>
61
+ <td><?php echo 'Google Drive' ?></td>
62
+ </tr>
63
+ <tr>
64
+ <td class="file-select-radio"><input name="storage-radio" type="radio"
65
+ value="<?php echo SG_STORAGE_AMAZON ?>" <?php echo empty($amazon) ? 'disabled="disabled"' : '' ?>>
66
+ </td>
67
+ <td><span class="btn-xs sg-status-icon sg-status-34 active">&nbsp;</span></td>
68
+ <td><?php echo (backupGuardIsAccountGold() ? 'Amazon ' : '') . 'S3' ?></td>
69
+ </tr>
70
+ <tr>
71
+ <td class="file-select-radio"><input name="storage-radio" type="radio"
72
+ value="<?php echo SG_STORAGE_ONE_DRIVE ?>" <?php echo empty($oneDrive) ? 'disabled="disabled"' : '' ?>>
73
+ </td>
74
+ <td><span class="btn-xs sg-status-icon sg-status-35 active">&nbsp;</span></td>
75
+ <td><?php echo 'One Drive' ?></td>
76
+ </tr>
77
+ <tr>
78
+ <td class="file-select-radio"><input name="storage-radio" type="radio"
79
+ value="<?php echo SG_STORAGE_P_CLOUD ?>" <?php echo empty($pCloud) ? 'disabled="disabled"' : '' ?>>
80
+ </td>
81
+ <td><span class="btn-xs sg-status-icon sg-status-37 active">&nbsp;</span></td>
82
+ <td><?php echo 'pCloud' ?></td>
83
+ </tr>
84
+ <tr>
85
+ <td class="file-select-radio"><input name="storage-radio" type="radio"
86
+ value="<?php echo SG_STORAGE_BOX ?>" <?php echo empty($box) ? 'disabled="disabled"' : '' ?>>
87
+ </td>
88
+ <td><span class="btn-xs sg-status-icon sg-status-38 active">&nbsp;</span></td>
89
+ <td><?php echo 'box.com' ?></td>
90
+ </tr>
91
+ <?php endif; ?>
92
+ </tbody>
93
+ </table>
94
+ </div>
95
+ </div>
96
+ <div class="col-md-12" id="modal-import-2">
97
+ <div class="form-group import-modal-popup-content">
98
+ <div class="col-md-9">
99
+ <input type="text" id="sg-import-file-name" class="form-control sg-backup-input"
100
+ placeholder="<?php _backupGuardT('SGBP file') ?>" readonly>
101
+ </div>
102
+ <div class="col-lg-3">
103
+ <span class="input-group-btn">
104
+ <span class="btn btn-primary btn-file backup-browse-btn">
105
+ <?php _backupGuardT('Browse') ?>&hellip; <input class="sg-backup-upload-input"
106
+ type="file" name="files[]"
107
+ data-url="<?php echo admin_url('admin-ajax.php') . "?action=backup_guard_importBackup&token=" . wp_create_nonce('backupGuardAjaxNonce') ?>"
108
+ data-max-file-size="<?php echo backupGuardConvertToBytes($maxUploadSize . 'B'); ?>"
109
+ accept=".sgbp">
110
+ </span>
111
+ </span>
112
+ </div>
113
+ </div>
114
+ </div>
115
+ <?php if (SGBoot::isFeatureAvailable('DOWNLOAD_FROM_CLOUD')) : ?>
116
+ <div class="col-md-12" id="modal-import-3">
117
+ <table class="table table-striped paginated sg-backup-table" id="sg-archive-list-table">
118
+ <thead>
119
+ <tr>
120
+ <th></th>
121
+ <th><?php _backupGuardT('Filename') ?></th>
122
+ <th><?php _backupGuardT('Size') ?></th>
123
+ <th><?php _backupGuardT('Date') ?></th>
124
+ </tr>
125
+ </thead>
126
+ <tbody>
127
+ </tbody>
128
+ </table>
129
+ </div>
130
+ <?php endif; ?>
131
+ <div class="clearfix"></div>
132
+ </div>
133
+ <div class="modal-footer">
134
+ <button type="button" class="pull-left btn btn-primary" id="switch-modal-import-pages-back"
135
+ onclick="sgBackup.previousPage()"><?php _backupGuardT('Back') ?></button>
136
+ <span class="modal-close-button" id="sg-close-modal-import"
137
+ data-dismiss="modal"><?php _backupGuardT("Close") ?></span>
138
+ <button type="button" class="btn btn-success" id="switch-modal-import-pages-next" data-remote="importBackup"
139
+ onclick="sgBackup.nextPage()"><?php _backupGuardT('Next') ?></button>
140
+ <button type="button" data-remote="importBackup" id="uploadSgbpFile"
141
+ class="btn btn-success"><?php _backupGuardT('Import') ?></button>
142
+ </div>
143
+ </div>
144
+ </div>
public/ajax/modalManualBackup.php CHANGED
@@ -1,167 +1,181 @@
1
- <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
-
4
- $directories = SG_BACKUP_FILE_PATHS;
5
- $directories = explode(',', $directories);
6
- $dropbox = SGConfig::get('SG_DROPBOX_ACCESS_TOKEN');
7
- $gdrive = SGConfig::get('SG_GOOGLE_DRIVE_REFRESH_TOKEN');
8
- $ftp = SGConfig::get('SG_STORAGE_FTP_CONNECTED');
9
- $amazon = SGConfig::get('SG_AMAZON_KEY');
10
- $oneDrive = SGConfig::get('SG_ONE_DRIVE_REFRESH_TOKEN');
11
- $pCloud = SGConfig::get('SG_P_CLOUD_ACCESS_TOKEN');
12
- $box = SGConfig::get('SG_BOX_REFRESH_TOKEN');
13
- $backupGuard = SGConfig::get('SG_BACKUPGUARD_UPLOAD_ACCESS_TOKEN');
14
-
15
- $backupType = (int)@$_GET['backupType'];
16
- $infoIconHtml = '<span class="dashicons dashicons-editor-help sgbg-info-icon"></span>';
17
- ?>
18
- <div class="modal-dialog">
19
- <div class="modal-content">
20
- <div class="modal-header">
21
- <div id="sg-modal-manual-backup-header">
22
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
23
- <h4 class="modal-title"><?php ($backupType == SG_BACKUP_METHOD_MIGRATE)?_backupGuardT("Prepare migration package"):_backupGuardT("Manual Backup") ?></h4>
24
- </div>
25
- </div>
26
- <form class="form-horizontal" method="post" id="manualBackup">
27
- <div class="modal-body sg-modal-body">
28
- <!-- Multiple Radios -->
29
- <div class="form-group">
30
- <div class="col-md-12">
31
- <input type="text" name="sg-custom-backup-name" id="sg-custom-backup-name" class="sg-backup-input" placeholder="Custom backup name (optional)">
32
- </div>
33
- <div class="col-md-12">
34
- <div class="radio">
35
- <label for="full-backup-radio">
36
- <input type="radio" name="backupType" id="full-backup-radio" value="1" checked="checked">
37
- <?php _backupGuardT('Full backup'); ?>
38
- </label>
39
- </div>
40
- <div class="radio">
41
- <label for="custom-backup-radio">
42
- <input type="radio" name="backupType" id="custom-backup-radio" value="2">
43
- <?php _backupGuardT('Custom backup'); ?>
44
- </label>
45
- </div>
46
- <div class="col-md-12 sg-custom-backup">
47
- <?php backupGuardGetBackupTablesHTML(); ?>
48
- <div class="checkbox sg-no-padding-top">
49
- <label for="custom-backupfiles-chbx">
50
- <input type="checkbox" class="sg-custom-option" name="backupFiles" id="custom-backupfiles-chbx">
51
- <span class="sg-checkbox-label-text"><?php _backupGuardT('Backup files'); ?></span>
52
- </label>
53
- <!--Files-->
54
- <div class="col-md-12 sg-checkbox sg-custom-backup-files">
55
- <?php foreach ($directories as $directory): ?>
56
- <div class="checkbox">
57
- <label for="<?php echo 'sgbg'.$directory?>">
58
- <input type="checkbox" name="directory[]" id="<?php echo 'sgbg'.$directory;?>" value="<?php echo $directory;?>">
59
- <span class="sg-checkbox-label-text"><?php echo basename($directory);?></span>
60
- </label>
61
- </div>
62
- <?php endforeach;?>
63
- </div>
64
- </div>
65
- </div>
66
- <div class="clearfix"></div>
67
- <?php if(SGBoot::isFeatureAvailable('STORAGE')): ?>
68
- <!--Cloud-->
69
- <div class="checkbox sg-no-padding-top">
70
- <label for="custom-backupcloud-chbx">
71
- <input type="checkbox" name="backupCloud" id="custom-backupcloud-chbx">
72
- <span class="sg-checkbox-label-text"><?php _backupGuardT('Upload to cloud'); ?></span>
73
- </label>
74
- <!--Storages-->
75
- <div class="col-md-12 sg-checkbox sg-custom-backup-cloud">
76
- <?php if(SGBoot::isFeatureAvailable('BACKUP_GUARD') && SG_SHOW_BACKUPGUARD_CLOUD): ?>
77
- <div class="checkbox">
78
- <label for="cloud-backup-guard" <?php echo empty($backupGuard)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('BackupGuard is not active.',true).'"':''?>>
79
- <input type="checkbox" name="backupStorages[]" id="cloud-backup-guard" value="<?php echo SG_STORAGE_BACKUP_GUARD ?>" <?php echo empty($backupGuard)?'disabled="disabled"':''?>>
80
- <span class="sg-checkbox-label-text"><?php echo 'BackupGuard' ?></span>
81
- </label>
82
- </div>
83
- <?php endif; ?>
84
- <?php if(SGBoot::isFeatureAvailable('FTP')): ?>
85
- <div class="checkbox">
86
- <label for="cloud-ftp" <?php echo empty($ftp)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('FTP is not active.',true).'"':''?>>
87
- <input type="checkbox" name="backupStorages[]" id="cloud-ftp" value="<?php echo SG_STORAGE_FTP ?>" <?php echo empty($ftp)?'disabled="disabled"':''?>>
88
- <span class="sg-checkbox-label-text"><?php echo 'FTP' ?></span>
89
- </label>
90
- </div>
91
- <?php endif; ?>
92
- <?php if(SGBoot::isFeatureAvailable('DROPBOX')): ?>
93
- <div class="checkbox">
94
- <label for="cloud-dropbox" <?php echo empty($dropbox)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('Dropbox is not active.',true).'"':''?>>
95
- <input type="checkbox" name="backupStorages[]" id="cloud-dropbox" value="<?php echo SG_STORAGE_DROPBOX ?>"
96
- <?php echo empty($dropbox)?'disabled="disabled"':''?>>
97
- <span class="sg-checkbox-label-text"><?php echo 'Dropbox' ?></span>
98
- </label>
99
- </div>
100
- <?php endif; ?>
101
- <?php if(SGBoot::isFeatureAvailable('GOOGLE_DRIVE')): ?>
102
- <div class="checkbox">
103
- <label for="cloud-gdrive" <?php echo empty($gdrive)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('Google Drive is not active.',true).'"':''?>>
104
- <input type="checkbox" name="backupStorages[]" id="cloud-gdrive" value="<?php echo SG_STORAGE_GOOGLE_DRIVE?>"
105
- <?php echo empty($gdrive)?'disabled="disabled"':''?>>
106
- <span class="sg-checkbox-label-text"><?php echo 'Google Drive' ?></span>
107
- </label>
108
- </div>
109
- <?php endif; ?>
110
- <?php if(SGBoot::isFeatureAvailable('AMAZON')): ?>
111
- <div class="checkbox">
112
- <label for="cloud-amazon" <?php echo empty($amazon)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT((backupGuardIsAccountGold()? 'Amazon ':'').'S3 is not active.',true).'"':''?>>
113
- <input type="checkbox" name="backupStorages[]" id="cloud-amazon" value="<?php echo SG_STORAGE_AMAZON?>"
114
- <?php echo empty($amazon)?'disabled="disabled"':''?>>
115
- <span class="sg-checkbox-label-text"><?php echo (backupGuardIsAccountGold()? 'Amazon ':'').'S3' ?></span>
116
- </label>
117
- </div>
118
- <?php endif; ?>
119
- <?php if(SGBoot::isFeatureAvailable('ONE_DRIVE')): ?>
120
- <div class="checkbox">
121
- <label for="cloud-one-drive" <?php echo empty($oneDrive)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('One Drive is not active.', true).'"':''?>>
122
- <input type="checkbox" name="backupStorages[]" id="cloud-one-drive" value="<?php echo SG_STORAGE_ONE_DRIVE?>" <?php echo empty($oneDrive)?'disabled="disabled"':''?>>
123
- <span class="sg-checkbox-label-text"><?php echo 'One Drive' ?></span>
124
- </label>
125
- </div>
126
- <?php endif;?>
127
- <?php if(SGBoot::isFeatureAvailable('P_CLOUD')): ?>
128
- <div class="checkbox">
129
- <label for="cloud-p-cloud" <?php echo empty($pCloud)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('pCloud is not active.', true).'"':''?>>
130
- <input type="checkbox" name="backupStorages[]" id="cloud-p-cloud" value="<?php echo SG_STORAGE_P_CLOUD?>" <?php echo empty($pCloud)?'disabled="disabled"':''?>>
131
- <span class="sg-checkbox-label-text"><?php echo 'pCloud' ?></span>
132
- </label>
133
- </div>
134
- <?php endif;?>
135
- <?php if(SGBoot::isFeatureAvailable('BOX')): ?>
136
- <div class="checkbox">
137
- <label for="cloud-box" <?php echo empty($box)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('box.com is not active.', true).'"':''?>>
138
- <input type="checkbox" name="backupStorages[]" id="cloud-box" value="<?php echo SG_STORAGE_BOX?>" <?php echo empty($box)?'disabled="disabled"':''?>>
139
- <span class="sg-checkbox-label-text"><?php echo 'box.com' ?></span>
140
- </label>
141
- </div>
142
- <?php endif;?>
143
- </div>
144
- <div class="clearfix"></div>
145
- </div>
146
- <?php endif; ?>
147
- <!-- Background mode -->
148
- <?php if(SGBoot::isFeatureAvailable('BACKGROUND_MODE')): ?>
149
- <div class="checkbox">
150
- <label for="sg-background-chbx">
151
- <input type="checkbox" name="backgroundMode" id="sg-background-chbx">
152
- <span class="sg-checkbox-label-text"><?php _backupGuardT('Background mode'); ?></span><?php echo $infoIconHtml; ?>
153
- <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable background mode to avoid CPU overload')?></span>
154
- </label>
155
- </div>
156
- <?php endif; ?>
157
- </div>
158
- </div>
159
- </div>
160
- <div class="modal-footer">
161
- <input type="text" name="backup-type" value="<?php echo $backupType?>" hidden>
162
- <span class="modal-close-button" data-dismiss="modal">Close</span>
163
- <button type="button" onclick="sgBackup.manualBackup()" class="btn btn-success"><?php _backupGuardT('Backup')?></button>
164
- </div>
165
- </form>
166
- </div>
167
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once dirname(__FILE__) . '/../boot.php';
3
+
4
+ $directories = SG_BACKUP_FILE_PATHS;
5
+ $directories = explode(',', $directories);
6
+ $dropbox = SGConfig::get('SG_DROPBOX_ACCESS_TOKEN');
7
+ $gdrive = SGConfig::get('SG_GOOGLE_DRIVE_REFRESH_TOKEN');
8
+ $ftp = SGConfig::get('SG_STORAGE_FTP_CONNECTED');
9
+ $amazon = SGConfig::get('SG_AMAZON_KEY');
10
+ $oneDrive = SGConfig::get('SG_ONE_DRIVE_REFRESH_TOKEN');
11
+ $pCloud = SGConfig::get('SG_P_CLOUD_ACCESS_TOKEN');
12
+ $box = SGConfig::get('SG_BOX_REFRESH_TOKEN');
13
+ $backupGuard = SGConfig::get('SG_BACKUPGUARD_UPLOAD_ACCESS_TOKEN');
14
+
15
+ $backupType = (int)@$_GET['backupType'];
16
+ $infoIconHtml = '<span class="dashicons dashicons-editor-help sgbg-info-icon"></span>';
17
+ ?>
18
+ <div class="modal-dialog">
19
+ <div class="modal-content">
20
+ <div class="modal-header">
21
+ <div id="sg-modal-manual-backup-header">
22
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
23
+ <h4 class="modal-title"><?php ($backupType == SG_BACKUP_METHOD_MIGRATE) ? _backupGuardT("Prepare migration package") : _backupGuardT("Manual Backup") ?></h4>
24
+ </div>
25
+ </div>
26
+ <form class="form-horizontal" method="post" id="manualBackup">
27
+ <div class="modal-body sg-modal-body">
28
+ <!-- Multiple Radios -->
29
+ <div class="form-group">
30
+ <div class="col-md-12">
31
+ <input type="text" name="sg-custom-backup-name" id="sg-custom-backup-name"
32
+ class="sg-backup-input" placeholder="Custom backup name (optional)">
33
+ </div>
34
+ <div class="col-md-12">
35
+ <div class="radio">
36
+ <label for="full-backup-radio">
37
+ <input type="radio" name="backupType" id="full-backup-radio" value="1"
38
+ checked="checked">
39
+ <?php _backupGuardT('Full backup'); ?>
40
+ </label>
41
+ </div>
42
+ <div class="radio">
43
+ <label for="custom-backup-radio">
44
+ <input type="radio" name="backupType" id="custom-backup-radio" value="2">
45
+ <?php _backupGuardT('Custom backup'); ?>
46
+ </label>
47
+ </div>
48
+ <div class="col-md-12 sg-custom-backup">
49
+ <?php backupGuardGetBackupTablesHTML(); ?>
50
+ <div class="checkbox sg-no-padding-top">
51
+ <label for="custom-backupfiles-chbx">
52
+ <input type="checkbox" class="sg-custom-option" name="backupFiles"
53
+ id="custom-backupfiles-chbx">
54
+ <span class="sg-checkbox-label-text"><?php _backupGuardT('Backup files'); ?></span>
55
+ </label>
56
+ <!--Files-->
57
+ <div class="col-md-12 sg-checkbox sg-custom-backup-files">
58
+ <?php foreach ($directories as $directory) : ?>
59
+ <div class="checkbox">
60
+ <label for="<?php echo 'sgbg' . $directory ?>">
61
+ <input type="checkbox" name="directory[]"
62
+ id="<?php echo 'sgbg' . $directory; ?>"
63
+ value="<?php echo $directory; ?>">
64
+ <span class="sg-checkbox-label-text"><?php echo basename($directory); ?></span>
65
+ </label>
66
+ </div>
67
+ <?php endforeach; ?>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ <div class="clearfix"></div>
72
+ <?php if (SGBoot::isFeatureAvailable('STORAGE')) : ?>
73
+ <!--Cloud-->
74
+ <div class="checkbox sg-no-padding-top">
75
+ <label for="custom-backupcloud-chbx">
76
+ <input type="checkbox" name="backupCloud" id="custom-backupcloud-chbx">
77
+ <span class="sg-checkbox-label-text"><?php _backupGuardT('Upload to cloud'); ?></span>
78
+ </label>
79
+ <!--Storages-->
80
+ <div class="col-md-12 sg-checkbox sg-custom-backup-cloud">
81
+ <?php if (SGBoot::isFeatureAvailable('BACKUP_GUARD') && SG_SHOW_BACKUPGUARD_CLOUD) : ?>
82
+ <div class="checkbox">
83
+ <label for="cloud-backup-guard" <?php echo empty($backupGuard) ? 'data-toggle="tooltip" data-placement="right" title="' . _backupGuardT('BackupGuard is not active.', true) . '"' : '' ?>>
84
+ <input type="checkbox" name="backupStorages[]" id="cloud-backup-guard"
85
+ value="<?php echo SG_STORAGE_BACKUP_GUARD ?>" <?php echo empty($backupGuard) ? 'disabled="disabled"' : '' ?>>
86
+ <span class="sg-checkbox-label-text"><?php echo 'BackupGuard' ?></span>
87
+ </label>
88
+ </div>
89
+ <?php endif; ?>
90
+ <?php if (SGBoot::isFeatureAvailable('FTP')) : ?>
91
+ <div class="checkbox">
92
+ <label for="cloud-ftp" <?php echo empty($ftp) ? 'data-toggle="tooltip" data-placement="right" title="' . _backupGuardT('FTP is not active.', true) . '"' : '' ?>>
93
+ <input type="checkbox" name="backupStorages[]" id="cloud-ftp"
94
+ value="<?php echo SG_STORAGE_FTP ?>" <?php echo empty($ftp) ? 'disabled="disabled"' : '' ?>>
95
+ <span class="sg-checkbox-label-text"><?php echo 'FTP' ?></span>
96
+ </label>
97
+ </div>
98
+ <?php endif; ?>
99
+ <?php if (SGBoot::isFeatureAvailable('DROPBOX')) : ?>
100
+ <div class="checkbox">
101
+ <label for="cloud-dropbox" <?php echo empty($dropbox) ? 'data-toggle="tooltip" data-placement="right" title="' . _backupGuardT('Dropbox is not active.', true) . '"' : '' ?>>
102
+ <input type="checkbox" name="backupStorages[]" id="cloud-dropbox"
103
+ value="<?php echo SG_STORAGE_DROPBOX ?>"
104
+ <?php echo empty($dropbox) ? 'disabled="disabled"' : '' ?>>
105
+ <span class="sg-checkbox-label-text"><?php echo 'Dropbox' ?></span>
106
+ </label>
107
+ </div>
108
+ <?php endif; ?>
109
+ <?php if (SGBoot::isFeatureAvailable('GOOGLE_DRIVE')) : ?>
110
+ <div class="checkbox">
111
+ <label for="cloud-gdrive" <?php echo empty($gdrive) ? 'data-toggle="tooltip" data-placement="right" title="' . _backupGuardT('Google Drive is not active.', true) . '"' : '' ?>>
112
+ <input type="checkbox" name="backupStorages[]" id="cloud-gdrive"
113
+ value="<?php echo SG_STORAGE_GOOGLE_DRIVE ?>"
114
+ <?php echo empty($gdrive) ? 'disabled="disabled"' : '' ?>>
115
+ <span class="sg-checkbox-label-text"><?php echo 'Google Drive' ?></span>
116
+ </label>
117
+ </div>
118
+ <?php endif; ?>
119
+ <?php if (SGBoot::isFeatureAvailable('AMAZON')) : ?>
120
+ <div class="checkbox">
121
+ <label for="cloud-amazon" <?php echo empty($amazon) ? 'data-toggle="tooltip" data-placement="right" title="' . _backupGuardT((backupGuardIsAccountGold() ? 'Amazon ' : '') . 'S3 is not active.', true) . '"' : '' ?>>
122
+ <input type="checkbox" name="backupStorages[]" id="cloud-amazon"
123
+ value="<?php echo SG_STORAGE_AMAZON ?>"
124
+ <?php echo empty($amazon) ? 'disabled="disabled"' : '' ?>>
125
+ <span class="sg-checkbox-label-text"><?php echo (backupGuardIsAccountGold() ? 'Amazon ' : '') . 'S3' ?></span>
126
+ </label>
127
+ </div>
128
+ <?php endif; ?>
129
+ <?php if (SGBoot::isFeatureAvailable('ONE_DRIVE')) : ?>
130
+ <div class="checkbox">
131
+ <label for="cloud-one-drive" <?php echo empty($oneDrive) ? 'data-toggle="tooltip" data-placement="right" title="' . _backupGuardT('One Drive is not active.', true) . '"' : '' ?>>
132
+ <input type="checkbox" name="backupStorages[]" id="cloud-one-drive"
133
+ value="<?php echo SG_STORAGE_ONE_DRIVE ?>" <?php echo empty($oneDrive) ? 'disabled="disabled"' : '' ?>>
134
+ <span class="sg-checkbox-label-text"><?php echo 'One Drive' ?></span>
135
+ </label>
136
+ </div>
137
+ <?php endif; ?>
138
+ <?php if (SGBoot::isFeatureAvailable('P_CLOUD')) : ?>
139
+ <div class="checkbox">
140
+ <label for="cloud-p-cloud" <?php echo empty($pCloud) ? 'data-toggle="tooltip" data-placement="right" title="' . _backupGuardT('pCloud is not active.', true) . '"' : '' ?>>
141
+ <input type="checkbox" name="backupStorages[]" id="cloud-p-cloud"
142
+ value="<?php echo SG_STORAGE_P_CLOUD ?>" <?php echo empty($pCloud) ? 'disabled="disabled"' : '' ?>>
143
+ <span class="sg-checkbox-label-text"><?php echo 'pCloud' ?></span>
144
+ </label>
145
+ </div>
146
+ <?php endif; ?>
147
+ <?php if (SGBoot::isFeatureAvailable('BOX')) : ?>
148
+ <div class="checkbox">
149
+ <label for="cloud-box" <?php echo empty($box) ? 'data-toggle="tooltip" data-placement="right" title="' . _backupGuardT('box.com is not active.', true) . '"' : '' ?>>
150
+ <input type="checkbox" name="backupStorages[]" id="cloud-box"
151
+ value="<?php echo SG_STORAGE_BOX ?>" <?php echo empty($box) ? 'disabled="disabled"' : '' ?>>
152
+ <span class="sg-checkbox-label-text"><?php echo 'box.com' ?></span>
153
+ </label>
154
+ </div>
155
+ <?php endif; ?>
156
+ </div>
157
+ <div class="clearfix"></div>
158
+ </div>
159
+ <?php endif; ?>
160
+ <!-- Background mode -->
161
+ <?php if (SGBoot::isFeatureAvailable('BACKGROUND_MODE')) : ?>
162
+ <div class="checkbox">
163
+ <label for="sg-background-chbx">
164
+ <input type="checkbox" name="backgroundMode" id="sg-background-chbx">
165
+ <span class="sg-checkbox-label-text"><?php _backupGuardT('Background mode'); ?></span><?php echo $infoIconHtml; ?>
166
+ <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable background mode to avoid CPU overload') ?></span>
167
+ </label>
168
+ </div>
169
+ <?php endif; ?>
170
+ </div>
171
+ </div>
172
+ </div>
173
+ <div class="modal-footer">
174
+ <input type="text" name="backup-type" value="<?php echo $backupType ?>" hidden>
175
+ <span class="modal-close-button" data-dismiss="modal">Close</span>
176
+ <button type="button" onclick="sgBackup.manualBackup()"
177
+ class="btn btn-success"><?php _backupGuardT('Backup') ?></button>
178
+ </div>
179
+ </form>
180
+ </div>
181
+ </div>
public/ajax/modalManualRestore.php CHANGED
@@ -1,74 +1,81 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- require_once(SG_LIB_PATH.'SGArchive.php');
4
- $backupName = $_GET['param'];
5
- $backupName = backupGuardRemoveSlashes($backupName);
6
- $backupPath = SG_BACKUP_DIRECTORY.$backupName;
7
- $backupPath= $backupPath.'/'.$backupName.'.sgbp';
8
 
9
- $archive = new SGArchive($backupPath,'r');
10
- $headers = $archive->getArchiveHeaders();
11
- if($headers["selectivRestoreable"]){
12
- ?>
13
- <div class="modal-dialog">
14
- <div class="modal-content">
15
- <div class="modal-header">
16
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
17
- <h4 class="modal-title"><?php _backupGuardT("Manual Restore") ?></h4>
18
- </div>
19
- <form class="form-horizontal" method="post" id="manualBackup">
20
- <div class="modal-body sg-modal-body">
21
- <!-- Multiple Radios -->
22
- <div class="form-group">
23
- <div class="col-md-12">
24
- <div class="radio">
25
- <label for="fullrestore-radio">
26
- <input type="radio" name="restoreType" id="fullrestore-radio" value="<?php echo SG_RESTORE_MODE_FULL ?>" checked="checked">
27
- <?php _backupGuardT('Full restore'); ?>
28
- </label>
29
- </div>
30
- <div class="radio">
31
- <label for="filerestore-radio">
32
- <input type="radio" name="restoreType" id="filerestore-radio" value="<?php echo SG_RESTORE_MODE_FILES ?>">
33
- <?php _backupGuardT('Restore files'); ?>
34
- </label>
35
- </div>
36
- <?php if (SGBoot::isFeatureAvailable('SLECTIVE_RESTORE')): ?>
37
- <?php backupGuardGetFileSelectiveRestore(); ?>
38
- <?php endif; ?>
39
- <div class="radio">
40
- <label for="dbrestore-radio">
41
- <input type="radio" name="restoreType" id="dbrestore-radio" value="<?php echo SG_RESTORE_MODE_DB ?>">
42
- <?php _backupGuardT('Restore DB'); ?>
43
- </label>
44
- </div>
45
 
46
- </div>
47
- </div>
48
- </div>
49
- <div class="modal-footer">
50
- <span class="modal-close-button" data-dismiss="modal">Close</span>
51
- <button type="button" onclick="sgBackup.startRestore('<?php echo addslashes(htmlspecialchars($backupName)) ?>')" class="btn btn-success"><?php _backupGuardT('Restore')?></button>
52
- </div>
53
- </form>
54
- </div>
55
- </div>
56
- <?php
57
- }else{
58
- ?>
59
- <div class="modal-dialog">
60
- <div class="modal-content">
61
- <div class="modal-header">
62
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
63
- <h4 class="modal-title"><?php _backupGuardT("Are you sure?") ?></h4>
64
- </div>
65
- <div class="modal-footer">
66
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
67
- <button type="button" onclick="sgBackup.startRestore('<?php echo htmlspecialchars($backupName) ?>')" class="btn btn-primary"><?php _backupGuardT('Restore')?></button>
68
- </div>
69
- </div>
70
- </div>
71
- <?php
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
 
1
  <?php
 
 
 
 
 
 
2
 
3
+ require_once dirname(__FILE__) . '/../boot.php';
4
+ require_once SG_LIB_PATH . 'SGArchive.php';
5
+ $backupName = sanitize_text_field($_GET['param']);
6
+ $backupName = backupGuardRemoveSlashes($backupName);
7
+ $backupPath = SG_BACKUP_DIRECTORY . $backupName;
8
+ $backupPath = $backupPath . '/' . $backupName . '.sgbp';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ $archive = new SGArchive($backupPath, 'r');
11
+ $headers = $archive->getArchiveHeaders();
12
+ if ($headers["selectivRestoreable"]) {
13
+ ?>
14
+ <div class="modal-dialog">
15
+ <div class="modal-content">
16
+ <div class="modal-header">
17
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
18
+ <h4 class="modal-title"><?php _backupGuardT("Manual Restore") ?></h4>
19
+ </div>
20
+ <form class="form-horizontal" method="post" id="manualBackup">
21
+ <div class="modal-body sg-modal-body">
22
+ <!-- Multiple Radios -->
23
+ <div class="form-group">
24
+ <div class="col-md-12">
25
+ <div class="radio">
26
+ <label for="fullrestore-radio">
27
+ <input type="radio" name="restoreType" id="fullrestore-radio"
28
+ value="<?php echo SG_RESTORE_MODE_FULL ?>" checked="checked">
29
+ <?php _backupGuardT('Full restore'); ?>
30
+ </label>
31
+ </div>
32
+ <div class="radio">
33
+ <label for="filerestore-radio">
34
+ <input type="radio" name="restoreType" id="filerestore-radio"
35
+ value="<?php echo SG_RESTORE_MODE_FILES ?>">
36
+ <?php _backupGuardT('Restore files'); ?>
37
+ </label>
38
+ </div>
39
+ <?php if (SGBoot::isFeatureAvailable('SLECTIVE_RESTORE')) : ?>
40
+ <?php backupGuardGetFileSelectiveRestore(); ?>
41
+ <?php endif; ?>
42
+ <div class="radio">
43
+ <label for="dbrestore-radio">
44
+ <input type="radio" name="restoreType" id="dbrestore-radio"
45
+ value="<?php echo SG_RESTORE_MODE_DB ?>">
46
+ <?php _backupGuardT('Restore DB'); ?>
47
+ </label>
48
+ </div>
49
+
50
+ </div>
51
+ </div>
52
+ </div>
53
+ <div class="modal-footer">
54
+ <span class="modal-close-button" data-dismiss="modal">Close</span>
55
+ <button type="button"
56
+ onclick="sgBackup.startRestore('<?php echo addslashes(htmlspecialchars($backupName)) ?>')"
57
+ class="btn btn-success"><?php _backupGuardT('Restore') ?></button>
58
+ </div>
59
+ </form>
60
+ </div>
61
+ </div>
62
+ <?php
63
+ } else {
64
+ ?>
65
+ <div class="modal-dialog">
66
+ <div class="modal-content">
67
+ <div class="modal-header">
68
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
69
+ <h4 class="modal-title"><?php _backupGuardT("Are you sure?") ?></h4>
70
+ </div>
71
+ <div class="modal-footer">
72
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
73
+ <button type="button" onclick="sgBackup.startRestore('<?php echo htmlspecialchars($backupName) ?>')"
74
+ class="btn btn-primary"><?php _backupGuardT('Restore') ?></button>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ <?php
79
+ }
80
 
81
 
public/ajax/modalPrivacy.php CHANGED
@@ -1,32 +1,32 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
  ?>
4
  <div class="modal-dialog">
5
  <div class="modal-content">
6
  <div class="modal-header">
7
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
8
- <h4 class="modal-title"><?php _backupGuardT('Privacy Policy')?></h4>
9
  </div>
10
  <div class="modal-body sg-modal-body">
11
  <div class="col-md-12">
12
  <div class="form-group sg-justify">
13
- <p><?php _backupGuardT('Your privacy is very important to us. Accordingly, we have developed this Policy in order for you to understand how we collect, use, communicate and disclose and make use of personal information. The following outlines our privacy policy.')?></p>
14
  <ul style="list-style-type: disc;">
15
- <li><?php _backupGuardT('Before or at the time of collecting personal information, we will identify the purposes for which information is being collected.')?></li>
16
- <li><?php _backupGuardT('We will collect and use of personal information solely with the objective of fulfilling those purposes specified by us and for other compatible purposes, unless we obtain the consent of the individual concerned or as required by law.')?></li>
17
- <li><?php _backupGuardT('We will only retain personal information as long as necessary for the fulfillment of those purposes.')?></li>
18
- <li><?php _backupGuardT('We will collect personal information by lawful and fair means and, where appropriate, with the knowledge or consent of the individual concerned.')?></li>
19
- <li><?php _backupGuardT('Personal data should be relevant to the purposes for which it is to be used, and, to the extent necessary for those purposes, should be accurate, complete, and up-to-date.')?></li>
20
- <li><?php _backupGuardT('We will protect personal information by reasonable security safeguards against loss or theft, as well as unauthorized access, disclosure, copying, use or modification.')?></li>
21
- <li><?php _backupGuardT('We will make readily available to customers information about our policies and practices relating to the management of personal information.')?></li>
22
  </ul>
23
- <p><?php _backupGuardT('We are committed to conducting our business in accordance with these principles in order to ensure that the confidentiality of personal information is protected and maintained.')?></p>
24
  </div>
25
  </div>
26
  <div class="clearfix"></div>
27
  </div>
28
  <div class="modal-footer">
29
- <button type="button" data-dismiss="modal" class="btn btn-primary"><?php _backupGuardT('Ok')?></button>
30
  </div>
31
  </div>
32
  </div>
1
  <?php
2
+ require_once(dirname(__FILE__) . '/../boot.php');
3
  ?>
4
  <div class="modal-dialog">
5
  <div class="modal-content">
6
  <div class="modal-header">
7
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
8
+ <h4 class="modal-title"><?php _backupGuardT('Privacy Policy') ?></h4>
9
  </div>
10
  <div class="modal-body sg-modal-body">
11
  <div class="col-md-12">
12
  <div class="form-group sg-justify">
13
+ <p><?php _backupGuardT('Your privacy is very important to us. Accordingly, we have developed this Policy in order for you to understand how we collect, use, communicate and disclose and make use of personal information. The following outlines our privacy policy.') ?></p>
14
  <ul style="list-style-type: disc;">
15
+ <li><?php _backupGuardT('Before or at the time of collecting personal information, we will identify the purposes for which information is being collected.') ?></li>
16
+ <li><?php _backupGuardT('We will collect and use of personal information solely with the objective of fulfilling those purposes specified by us and for other compatible purposes, unless we obtain the consent of the individual concerned or as required by law.') ?></li>
17
+ <li><?php _backupGuardT('We will only retain personal information as long as necessary for the fulfillment of those purposes.') ?></li>
18
+ <li><?php _backupGuardT('We will collect personal information by lawful and fair means and, where appropriate, with the knowledge or consent of the individual concerned.') ?></li>
19
+ <li><?php _backupGuardT('Personal data should be relevant to the purposes for which it is to be used, and, to the extent necessary for those purposes, should be accurate, complete, and up-to-date.') ?></li>
20
+ <li><?php _backupGuardT('We will protect personal information by reasonable security safeguards against loss or theft, as well as unauthorized access, disclosure, copying, use or modification.') ?></li>
21
+ <li><?php _backupGuardT('We will make readily available to customers information about our policies and practices relating to the management of personal information.') ?></li>
22
  </ul>
23
+ <p><?php _backupGuardT('We are committed to conducting our business in accordance with these principles in order to ensure that the confidentiality of personal information is protected and maintained.') ?></p>
24
  </div>
25
  </div>
26
  <div class="clearfix"></div>
27
  </div>
28
  <div class="modal-footer">
29
+ <button type="button" data-dismiss="modal" class="btn btn-primary"><?php _backupGuardT('Ok') ?></button>
30
  </div>
31
  </div>
32
  </div>
public/ajax/modalReview.php CHANGED
@@ -1,16 +1,16 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
  ?>
4
  <div class="modal-dialog">
5
  <div class="modal-content">
6
  <div class="modal-header">
7
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
8
- <h4 class="modal-title"><?php _backupGuardT('Leave a Review')?></h4>
9
  </div>
10
  <div class="modal-body sg-modal-body">
11
  <div class="col-md-12">
12
  <div class="sg-justify">
13
- <p><?php _backupGuardT('If you have some time and appreciated our product, please leave us a review by clicking on the "Leave a review" button below.')?></p>
14
  <p class="text-center sg-no-margin-bottom">
15
  <i class="glyphicon glyphicon-star sg-star"></i>
16
  <i class="glyphicon glyphicon-star sg-star"></i>
@@ -23,9 +23,12 @@ require_once(dirname(__FILE__).'/../boot.php');
23
  <div class="clearfix"></div>
24
  </div>
25
  <div class="modal-footer">
26
- <button type="button" data-dismiss="modal" id="sgDontAskAgain" class="btn sg-btn-grey"><?php _backupGuardT('Don\'t ask again')?></button>
27
- <button type="button" data-dismiss="modal" id="sgAskLater" class="btn sg-btn-grey"><?php _backupGuardT('Ask me later')?></button>
28
- <button type="button" data-dismiss="modal" id="sgLeaveReview" class="btn btn-success" data-review-url="<?php echo SG_BACKUP_GUARD_REVIEW_URL; ?>"><?php _backupGuardT('Leave a review')?></button>
 
 
 
29
  </div>
30
  </div>
31
  </div>
1
  <?php
2
+ require_once(dirname(__FILE__) . '/../boot.php');
3
  ?>
4
  <div class="modal-dialog">
5
  <div class="modal-content">
6
  <div class="modal-header">
7
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
8
+ <h4 class="modal-title"><?php _backupGuardT('Leave a Review') ?></h4>
9
  </div>
10
  <div class="modal-body sg-modal-body">
11
  <div class="col-md-12">
12
  <div class="sg-justify">
13
+ <p><?php _backupGuardT('If you have some time and appreciated our product, please leave us a review by clicking on the "Leave a review" button below.') ?></p>
14
  <p class="text-center sg-no-margin-bottom">
15
  <i class="glyphicon glyphicon-star sg-star"></i>
16
  <i class="glyphicon glyphicon-star sg-star"></i>
23
  <div class="clearfix"></div>
24
  </div>
25
  <div class="modal-footer">
26
+ <button type="button" data-dismiss="modal" id="sgDontAskAgain"
27
+ class="btn sg-btn-grey"><?php _backupGuardT('Don\'t ask again') ?></button>
28
+ <button type="button" data-dismiss="modal" id="sgAskLater"
29
+ class="btn sg-btn-grey"><?php _backupGuardT('Ask me later') ?></button>
30
+ <button type="button" data-dismiss="modal" id="sgLeaveReview" class="btn btn-success"
31
+ data-review-url="<?php echo SG_BACKUP_GUARD_REVIEW_URL; ?>"><?php _backupGuardT('Leave a review') ?></button>
32
  </div>
33
  </div>
34
  </div>
public/ajax/modalTerms.php CHANGED
@@ -1,31 +1,37 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
  ?>
4
  <div class="modal-dialog">
5
  <div class="modal-content">
6
  <div class="modal-header">
7
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
8
- <h4 class="modal-title"><?php _backupGuardT('Terms & Conditions')?></h4>
9
  </div>
10
  <div class="modal-body sg-modal-body">
11
  <div class="col-md-12">
12
  <div class="form-group sg-justify">
13
- <p>1. <?php _backupGuardT('Terms')?></p>
14
- <p><?php _backupGuardT('By using this software, you are agreeing to be bound by these software Terms and Conditions of Use, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using this software. The materials contained in this software are protected by applicable copyright and trade mark law.')?></p><br/>
15
- <p>2. <?php _backupGuardT('Disclaimer')?></p>
16
- <p><?php _backupGuardT("The materials on BackupGuard's are provided")?> &quot;<?php _backupGuardT('as is')?>&quot;. <?php _backupGuardT('BackupGuard makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties, including without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. Further, BackupGuard does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its Software.')?></p><br/>
17
- <p>3. <?php _backupGuardT('Limitations')?></p>
18
- <p><?php _backupGuardT("In no event shall BackupGuard or its suppliers be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption,) arising out of the use or inability to use the materials on BackupGuard's software, even if BackupGuard or a BackupGuard authorized representative has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you.")?></p><br/>
19
- <p>4. <?php _backupGuardT('Revisions and Errata')?></p>
20
- <p><?php _backupGuardT("The materials appearing on BackupGuard's software could include technical, typographical, or photographic errors. BackupGuard does not warrant that any of the materials on its software are accurate, complete, or current. BackupGuard may make changes to the materials contained on its software at any time without notice. BackupGuard does not, however, make any commitment to update the materials.")?></p><br/>
21
- <p>5. <?php _backupGuardT('Terms of Use Modifications')?></p>
22
- <p><?php _backupGuardT('BackupGuard may revise these terms of use for its software at any time without notice. By using this software you are agreeing to be bound by the then current version of these Terms and Conditions of Use.')?></p>
 
 
 
 
 
 
23
  </div>
24
  </div>
25
  <div class="clearfix"></div>
26
  </div>
27
  <div class="modal-footer">
28
- <button type="button" data-dismiss="modal" class="btn btn-primary"><?php _backupGuardT('Ok')?></button>
29
  </div>
30
  </div>
31
  </div>
1
  <?php
2
+ require_once(dirname(__FILE__) . '/../boot.php');
3
  ?>
4
  <div class="modal-dialog">
5
  <div class="modal-content">
6
  <div class="modal-header">
7
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
8
+ <h4 class="modal-title"><?php _backupGuardT('Terms & Conditions') ?></h4>
9
  </div>
10
  <div class="modal-body sg-modal-body">
11
  <div class="col-md-12">
12
  <div class="form-group sg-justify">
13
+ <p>1. <?php _backupGuardT('Terms') ?></p>
14
+ <p><?php _backupGuardT('By using this software, you are agreeing to be bound by these software Terms and Conditions of Use, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using this software. The materials contained in this software are protected by applicable copyright and trade mark law.') ?></p>
15
+ <br/>
16
+ <p>2. <?php _backupGuardT('Disclaimer') ?></p>
17
+ <p><?php _backupGuardT("The materials on BackupGuard's are provided") ?>
18
+ &quot;<?php _backupGuardT('as is') ?>
19
+ &quot;. <?php _backupGuardT('BackupGuard makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties, including without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. Further, BackupGuard does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its Software.') ?></p>
20
+ <br/>
21
+ <p>3. <?php _backupGuardT('Limitations') ?></p>
22
+ <p><?php _backupGuardT("In no event shall BackupGuard or its suppliers be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption,) arising out of the use or inability to use the materials on BackupGuard's software, even if BackupGuard or a BackupGuard authorized representative has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you.") ?></p>
23
+ <br/>
24
+ <p>4. <?php _backupGuardT('Revisions and Errata') ?></p>
25
+ <p><?php _backupGuardT("The materials appearing on BackupGuard's software could include technical, typographical, or photographic errors. BackupGuard does not warrant that any of the materials on its software are accurate, complete, or current. BackupGuard may make changes to the materials contained on its software at any time without notice. BackupGuard does not, however, make any commitment to update the materials.") ?></p>
26
+ <br/>
27
+ <p>5. <?php _backupGuardT('Terms of Use Modifications') ?></p>
28
+ <p><?php _backupGuardT('BackupGuard may revise these terms of use for its software at any time without notice. By using this software you are agreeing to be bound by the then current version of these Terms and Conditions of Use.') ?></p>
29
  </div>
30
  </div>
31
  <div class="clearfix"></div>
32
  </div>
33
  <div class="modal-footer">
34
+ <button type="button" data-dismiss="modal" class="btn btn-primary"><?php _backupGuardT('Ok') ?></button>
35
  </div>
36
  </div>
37
  </div>
public/ajax/resetStatus.php CHANGED
@@ -1,25 +1,24 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- require_once(SG_BACKUP_PATH.'SGBackup.php');
4
 
5
- if(backupGuardIsAjax() && count($_POST)) {
6
- $error = array();
7
- try {
8
 
9
- if (isset($_POST['backupName']) && $_POST['backupName']) {
10
- if (file_exists(SG_BACKUP_DIRECTORY.$_POST['backupName'])) {
11
- throw new SGExceptionForbidden($_POST['backupName']." backup already exists");
12
- }
13
- }
 
 
 
14
 
15
- @unlink(SG_BACKUP_DIRECTORY.'sg_backup.state');
16
- SGConfig::set('SG_RUNNING_ACTION', 0, true);
17
- $key = md5(microtime(true));
18
- SGConfig::set('SG_BACKUP_CURRENT_KEY', $key, true);
19
- die('{"success":1}');
20
- }
21
- catch(SGException $exception) {
22
- array_push($error, $exception->getMessage());
23
- die(json_encode($error));
24
- }
25
  }
1
  <?php
 
 
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_BACKUP_PATH . 'SGBackup.php');
 
5
 
6
+ if (backupGuardIsAjax() && count($_POST)) {
7
+ $error = array();
8
+ try {
9
+ if (isset($_POST['backupName']) && $_POST['backupName']) {
10
+ if (file_exists(SG_BACKUP_DIRECTORY . $_POST['backupName'])) {
11
+ throw new SGExceptionForbidden($_POST['backupName'] . " backup already exists");
12
+ }
13
+ }
14
 
15
+ @unlink(SG_BACKUP_DIRECTORY . 'sg_backup.state');
16
+ SGConfig::set('SG_RUNNING_ACTION', 0, true);
17
+ $key = md5(microtime(true));
18
+ SGConfig::set('SG_BACKUP_CURRENT_KEY', $key, true);
19
+ die('{"success":1}');
20
+ } catch (SGException $exception) {
21
+ array_push($error, $exception->getMessage());
22
+ die(json_encode($error));
23
+ }
 
24
  }
public/ajax/restore.php CHANGED
@@ -1,23 +1,24 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- require_once(SG_BACKUP_PATH.'SGBackup.php');
4
- if(backupGuardIsAjax() && count($_POST)) {
5
- $error = array();
6
- try {
7
- //Getting Backup Name
8
- $backupName = $_POST['bname'];
9
- $restoreMode = isset($_POST['type'])? $_POST['type'] : SG_RESTORE_MODE_FULL; //if type is not set that means it is an old backup and no selective restore is available. only full
10
 
11
- if (!SGBoot::isFeatureAvailable('SLECTIVE_RESTORE')) {
12
- $restoreMode = SG_RESTORE_MODE_FULL;
13
- }
14
 
15
- $restoreFiles = isset($_POST['paths']) ? $_POST['paths'] : array();
16
- $backup = new SGBackup();
17
- $backup->restore($backupName, $restoreMode, $restoreFiles);
18
- }
19
- catch(SGException $exception) {
20
- array_push($error, $exception->getMessage());
21
- die(json_encode($error));
 
 
22
  }
 
 
 
 
 
 
 
23
  }
 
1
  <?php
 
 
 
 
 
 
 
 
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_BACKUP_PATH . 'SGBackup.php');
 
5
 
6
+ if (backupGuardIsAjax() && count($_POST)) {
7
+ $error = array();
8
+ try {
9
+ //Getting Backup Name
10
+ $backupName = sanitize_textarea_field($_POST['bname']);
11
+ $restoreMode = isset($_POST['type']) ? $_POST['type'] : SG_RESTORE_MODE_FULL; //if type is not set that means it is an old backup and no selective restore is available. only full
12
+
13
+ if (!SGBoot::isFeatureAvailable('SLECTIVE_RESTORE')) {
14
+ $restoreMode = SG_RESTORE_MODE_FULL;
15
  }
16
+
17
+ $restoreFiles = isset($_POST['paths']) ? $_POST['paths'] : array();
18
+ $backup = new SGBackup();
19
+ $backup->restore($backupName, $restoreMode, $restoreFiles);
20
+ } catch (SGException $exception) {
21
+ array_push($error, $exception->getMessage());
22
+ die(json_encode($error));
23
  }
24
+ }
public/ajax/reviewBannerActions.php CHANGED
@@ -1,32 +1,32 @@
1
  <?php
2
- require_once(SG_LIB_PATH.'SGReviewManager.php');
 
3
  $type = $_POST['type'];
 
4
  if ($type == 'dayCount') {
5
- $timeDate = new \DateTime('now');
6
- $installTime = strtotime($timeDate->format('Y-m-d H:i:s'));
7
- SGConfig::set('installDate', $installTime);
8
- $timeDate->modify('+'.SG_BACKUP_REVIEW_PERIOD.' day');
9
 
10
- $timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
11
- SGConfig::set('openNextTime', $timeNow);
12
 
13
- $usageDays = SGConfig::get('usageDays');
14
- $usageDays += SG_BACKUP_REVIEW_PERIOD;
15
- SGConfig::set('usageDays', $usageDays);
16
- }
17
- else if ($type == 'backupCount') {
18
- $backupCountReview = SGConfig::get('backupReviewCount');
19
- if (empty($backupCountReview)) {
20
- $backupCountReview = SGReviewManager::getBackupCounts();
21
- }
22
- $backupCountReview += SG_BACKUP_REVIEW_BACKUP_COUNT;
23
- SGConfig::set('backupReviewCount', $backupCountReview);
 
 
 
 
 
 
24
  }
25
- else if ($type == 'restoreCount') {
26
- $restoreReviewCount = SGConfig::get('restoreReviewCount');
27
- if (empty($restoreReviewCount)) {
28
- $restoreReviewCount = SGReviewManager::getBackupRestoreCounts();
29
- }
30
- $restoreReviewCount += SG_BACKUP_REVIEW_RESTORE_COUNT;
31
- SGConfig::set('restoreReviewCount', $restoreReviewCount);
32
- }
1
  <?php
2
+
3
+ require_once(SG_LIB_PATH . 'SGReviewManager.php');
4
  $type = $_POST['type'];
5
+
6
  if ($type == 'dayCount') {
7
+ $timeDate = new \DateTime('now');
8
+ $installTime = strtotime($timeDate->format('Y-m-d H:i:s'));
9
+ SGConfig::set('installDate', $installTime);
10
+ $timeDate->modify('+' . SG_BACKUP_REVIEW_PERIOD . ' day');
11
 
12
+ $timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
13
+ SGConfig::set('openNextTime', $timeNow);
14
 
15
+ $usageDays = SGConfig::get('usageDays');
16
+ $usageDays += SG_BACKUP_REVIEW_PERIOD;
17
+ SGConfig::set('usageDays', $usageDays);
18
+ } else if ($type == 'backupCount') {
19
+ $backupCountReview = SGConfig::get('backupReviewCount');
20
+ if (empty($backupCountReview)) {
21
+ $backupCountReview = SGReviewManager::getBackupCounts();
22
+ }
23
+ $backupCountReview += SG_BACKUP_REVIEW_BACKUP_COUNT;
24
+ SGConfig::set('backupReviewCount', $backupCountReview);
25
+ } else if ($type == 'restoreCount') {
26
+ $restoreReviewCount = SGConfig::get('restoreReviewCount');
27
+ if (empty($restoreReviewCount)) {
28
+ $restoreReviewCount = SGReviewManager::getBackupRestoreCounts();
29
+ }
30
+ $restoreReviewCount += SG_BACKUP_REVIEW_RESTORE_COUNT;
31
+ SGConfig::set('restoreReviewCount', $restoreReviewCount);
32
  }
 
 
 
 
 
 
 
 
public/ajax/schedule.php CHANGED
@@ -1,139 +1,139 @@
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() && count($_POST)) {
10
- $_POST = backupGuardRemoveSlashes($_POST);
11
-
12
- if (isset($_POST['remove'])) {
13
- if (isset($_POST['id'])) {
14
- SGBackupSchedule::remove((int) $_POST['id']);
15
- } else {
16
- SGBackupSchedule::remove();
17
- }
18
-
19
- die(json_encode($success));
20
- }
21
-
22
- //Check if cron available
23
- if (!SGSchedule::isCronAvailable()) {
24
- array_push($error, _backupGuardT('Cron is not available on your hosting.', true));
25
- die(json_encode($error));
26
- }
27
-
28
- $options = $_POST;
29
- $cronOptions = array(
30
- 'SG_BACKUP_IN_BACKGROUND_MODE' => 0,
31
- 'SG_BACKUP_UPLOAD_TO_STORAGES' => '',
32
- 'SG_ACTION_BACKUP_DATABASE_AVAILABLE' => 0,
33
- 'SG_ACTION_BACKUP_FILES_AVAILABLE' => '',
34
- 'SG_BACKUP_FILE_PATHS_EXCLUDE' => '',
35
- 'SG_BACKUP_FILE_PATHS' => '',
36
- );
37
-
38
- $cronLabel = '';
39
- //Check if schedule name is not empaty
40
- if (isset($options['sg-schedule-label'])) {
41
- $label = trim($options['sg-schedule-label']);
42
- $label = backupGuardSanitizeTextField($label);
43
- if (empty($label)) {
44
- array_push($error, _backupGuardT('Label field is required.', true));
45
- die(json_encode($error));
46
- } else {
47
- $cronLabel = $label;
48
- }
49
- } else {
50
- array_push($error, _backupGuardT('Label field is required.', true));
51
- die(json_encode($error));
52
- }
53
-
54
- //If background mode
55
- $isBackgroundMode = isset($options['backgroundMode']) ? 1 : 0;
56
- $cronOptions['SG_BACKUP_IN_BACKGROUND_MODE'] = $isBackgroundMode;
57
-
58
- //If cloud backup
59
- if (isset($options['backupCloud']) && count($options['backupStorages'])) {
60
- $clouds = backupGuardSanitizeTextField($options['backupStorages']);
61
- $cronOptions['SG_BACKUP_UPLOAD_TO_STORAGES'] = implode(',', $clouds);
62
- }
63
-
64
- $cronOptions['SG_BACKUP_TYPE'] = $options['backupType'];
65
- if ($options['backupType'] == SG_BACKUP_TYPE_FULL) {
66
- $cronOptions['SG_BACKUP_FILE_PATHS_EXCLUDE'] = SG_BACKUP_FILE_PATHS_EXCLUDE;
67
- $cronOptions['SG_BACKUP_FILE_PATHS'] = 'wp-content';
68
- $cronOptions['SG_ACTION_BACKUP_DATABASE_AVAILABLE'] = 1;
69
- $cronOptions['SG_ACTION_BACKUP_FILES_AVAILABLE'] = 1;
70
- } else if ($options['backupType'] == SG_BACKUP_TYPE_CUSTOM) {
71
- //If database backup
72
- $isDatabaseBackup = isset($options['backupDatabase']) ? 1 : 0;
73
- $cronOptions['SG_ACTION_BACKUP_DATABASE_AVAILABLE'] = $isDatabaseBackup;
74
-
75
- //If db backup
76
- if (isset($options['backupDBType'])) {
77
- $tablesToBackup = implode(',', $options['table']);
78
- $backupOptions['SG_BACKUP_TABLES_TO_BACKUP'] = $tablesToBackup;
79
- }
80
- //If files backup
81
- if (isset($options['backupFiles']) && count($options['directory'])) {
82
- $backupFiles = explode(',', SG_BACKUP_FILE_PATHS);
83
- $options['directory'] = backupGuardSanitizeTextField($options['directory']);
84
- $filesToExclude = @array_diff($backupFiles, $options['directory']);
85
-
86
- if (in_array('wp-content', $options['directory'])) {
87
- $options['directory'] = array('wp-content');
88
- } else {
89
- $filesToExclude = array_diff($filesToExclude, array('wp-content'));
90
- }
91
-
92
- $filesToExclude = implode(',', $filesToExclude);
93
- if (strlen($filesToExclude)) {
94
- $filesToExclude = ',' . $filesToExclude;
95
- }
96
-
97
- $cronOptions['SG_BACKUP_FILE_PATHS_EXCLUDE'] = SG_BACKUP_FILE_PATHS_EXCLUDE . $filesToExclude;
98
- $cronOptions['SG_ACTION_BACKUP_FILES_AVAILABLE'] = 1;
99
- $cronOptions['SG_BACKUP_FILE_PATHS'] = implode(',', $options['directory']);
100
- } else {
101
- $cronOptions['SG_ACTION_BACKUP_FILES_AVAILABLE'] = 0;
102
- $cronOptions['SG_BACKUP_FILE_PATHS'] = 0;
103
- }
104
- } else {
105
- array_push($error, _backupGuardT('Invalid backup type', true));
106
- die(json_encode($error));
107
- }
108
-
109
- $scheduleIntervalDay = '';
110
- $scheduleIntervalMonth = '';
111
- if ($options['scheduleInterval'] == BG_SCHEDULE_INTERVAL_WEEKLY && isset($options['sg-schedule-day-of-week'])) {
112
- $scheduleIntervalDay = (int) $options['sg-schedule-day-of-week'];
113
- } else if ($options['scheduleInterval'] == BG_SCHEDULE_INTERVAL_MONTHLY && isset($options['sg-schedule-day-of-month'])) {
114
- $scheduleIntervalDay = (int) $options['sg-schedule-day-of-month'];
115
- } else if ($options['scheduleInterval'] == BG_SCHEDULE_INTERVAL_YEARLY && isset($options['sg-schedule-day-of-month']) && isset($options['sg-schedule-month-of-year'])) {
116
- $scheduleIntervalDay = (int) $options['sg-schedule-day-of-month'];
117
- $scheduleIntervalMonth = (int) $options['sg-schedule-month-of-year'];
118
- }
119
-
120
- try {
121
- $cronTab = array(
122
- 'monthOfInterval' => $scheduleIntervalMonth,
123
- 'dayOfInterval' => $scheduleIntervalDay,
124
- 'intervalHour' => isset($options['scheduleHour']) ? $options['scheduleHour'] : '',
125
- 'interval' => $options['scheduleInterval']
126
- );
127
-
128
- if (isset($options['sg-schedule-id'])) {
129
- SGBackupSchedule::remove($options['sg-schedule-id']);
130
- }
131
-
132
- SGBackupSchedule::create($cronTab, $cronOptions, $cronLabel);
133
-
134
- die(json_encode($success));
135
- } catch (SGException $exception) {
136
- array_push($error, $exception->getMessage());
137
- die(json_encode($error));
138
- }
139
- }
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() && count($_POST)) {
10
+ $_POST = backupGuardRemoveSlashes($_POST);
11
+
12
+ if (isset($_POST['remove'])) {
13
+ if (isset($_POST['id'])) {
14
+ SGBackupSchedule::remove((int)$_POST['id']);
15
+ } else {
16
+ SGBackupSchedule::remove();
17
+ }
18
+
19
+ die(json_encode($success));
20
+ }
21
+
22
+ //Check if cron available
23
+ if (!SGSchedule::isCronAvailable()) {
24
+ array_push($error, _backupGuardT('Cron is not available on your hosting.', true));
25
+ die(json_encode($error));
26
+ }
27
+
28
+ $options = $_POST;
29
+ $cronOptions = array(
30
+ 'SG_BACKUP_IN_BACKGROUND_MODE' => 0,
31
+ 'SG_BACKUP_UPLOAD_TO_STORAGES' => '',
32
+ 'SG_ACTION_BACKUP_DATABASE_AVAILABLE' => 0,
33
+ 'SG_ACTION_BACKUP_FILES_AVAILABLE' => '',
34
+ 'SG_BACKUP_FILE_PATHS_EXCLUDE' => '',
35
+ 'SG_BACKUP_FILE_PATHS' => '',
36
+ );
37
+
38
+ $cronLabel = '';
39
+ //Check if schedule name is not empaty
40
+ if (isset($options['sg-schedule-label'])) {
41
+ $label = trim($options['sg-schedule-label']);
42
+ $label = backupGuardSanitizeTextField($label);
43
+ if (empty($label)) {
44
+ array_push($error, _backupGuardT('Label field is required.', true));
45
+ die(json_encode($error));
46
+ } else {
47
+ $cronLabel = $label;
48
+ }
49
+ } else {
50
+ array_push($error, _backupGuardT('Label field is required.', true));
51
+ die(json_encode($error));
52
+ }
53
+
54
+ //If background mode
55
+ $isBackgroundMode = isset($options['backgroundMode']) ? 1 : 0;
56
+ $cronOptions['SG_BACKUP_IN_BACKGROUND_MODE'] = $isBackgroundMode;
57
+
58
+ //If cloud backup
59
+ if (isset($options['backupCloud']) && count($options['backupStorages'])) {
60
+ $clouds = backupGuardSanitizeTextField($options['backupStorages']);
61
+ $cronOptions['SG_BACKUP_UPLOAD_TO_STORAGES'] = implode(',', $clouds);
62
+ }
63
+
64
+ $cronOptions['SG_BACKUP_TYPE'] = $options['backupType'];
65
+ if ($options['backupType'] == SG_BACKUP_TYPE_FULL) {
66
+ $cronOptions['SG_BACKUP_FILE_PATHS_EXCLUDE'] = SG_BACKUP_FILE_PATHS_EXCLUDE;
67
+ $cronOptions['SG_BACKUP_FILE_PATHS'] = 'wp-content';
68
+ $cronOptions['SG_ACTION_BACKUP_DATABASE_AVAILABLE'] = 1;
69
+ $cronOptions['SG_ACTION_BACKUP_FILES_AVAILABLE'] = 1;
70
+ } else if ($options['backupType'] == SG_BACKUP_TYPE_CUSTOM) {
71
+ //If database backup
72
+ $isDatabaseBackup = isset($options['backupDatabase']) ? 1 : 0;
73
+ $cronOptions['SG_ACTION_BACKUP_DATABASE_AVAILABLE'] = $isDatabaseBackup;
74
+
75
+ //If db backup
76
+ if (isset($options['backupDBType'])) {
77
+ $tablesToBackup = implode(',', $options['table']);
78
+ $backupOptions['SG_BACKUP_TABLES_TO_BACKUP'] = $tablesToBackup;
79
+ }
80
+ //If files backup
81
+ if (isset($options['backupFiles']) && count($options['directory'])) {
82
+ $backupFiles = explode(',', SG_BACKUP_FILE_PATHS);
83
+ $options['directory'] = backupGuardSanitizeTextField($options['directory']);
84
+ $filesToExclude = @array_diff($backupFiles, $options['directory']);
85
+
86
+ if (in_array('wp-content', $options['directory'])) {
87
+ $options['directory'] = array('wp-content');
88
+ } else {
89
+ $filesToExclude = array_diff($filesToExclude, array('wp-content'));
90
+ }
91
+
92
+ $filesToExclude = implode(',', $filesToExclude);
93
+ if (strlen($filesToExclude)) {
94
+ $filesToExclude = ',' . $filesToExclude;
95
+ }
96
+
97
+ $cronOptions['SG_BACKUP_FILE_PATHS_EXCLUDE'] = SG_BACKUP_FILE_PATHS_EXCLUDE . $filesToExclude;
98
+ $cronOptions['SG_ACTION_BACKUP_FILES_AVAILABLE'] = 1;
99
+ $cronOptions['SG_BACKUP_FILE_PATHS'] = implode(',', $options['directory']);
100
+ } else {
101
+ $cronOptions['SG_ACTION_BACKUP_FILES_AVAILABLE'] = 0;
102
+ $cronOptions['SG_BACKUP_FILE_PATHS'] = 0;
103
+ }
104
+ } else {
105
+ array_push($error, _backupGuardT('Invalid backup type', true));
106
+ die(json_encode($error));
107
+ }
108
+
109
+ $scheduleIntervalDay = '';
110
+ $scheduleIntervalMonth = '';
111
+ if ($options['scheduleInterval'] == BG_SCHEDULE_INTERVAL_WEEKLY && isset($options['sg-schedule-day-of-week'])) {
112
+ $scheduleIntervalDay = (int)$options['sg-schedule-day-of-week'];
113
+ } else if ($options['scheduleInterval'] == BG_SCHEDULE_INTERVAL_MONTHLY && isset($options['sg-schedule-day-of-month'])) {
114
+ $scheduleIntervalDay = (int)$options['sg-schedule-day-of-month'];
115
+ } else if ($options['scheduleInterval'] == BG_SCHEDULE_INTERVAL_YEARLY && isset($options['sg-schedule-day-of-month']) && isset($options['sg-schedule-month-of-year'])) {
116
+ $scheduleIntervalDay = (int)$options['sg-schedule-day-of-month'];
117
+ $scheduleIntervalMonth = (int)$options['sg-schedule-month-of-year'];
118
+ }
119
+
120
+ try {
121
+ $cronTab = array(
122
+ 'monthOfInterval' => $scheduleIntervalMonth,
123
+ 'dayOfInterval' => $scheduleIntervalDay,
124
+ 'intervalHour' => isset($options['scheduleHour']) ? $options['scheduleHour'] : '',
125
+ 'interval' => $options['scheduleInterval']
126
+ );
127
+
128
+ if (isset($options['sg-schedule-id'])) {
129
+ SGBackupSchedule::remove($options['sg-schedule-id']);
130
+ }
131
+
132
+ SGBackupSchedule::create($cronTab, $cronOptions, $cronLabel);
133
+
134
+ die(json_encode($success));
135
+ } catch (SGException $exception) {
136
+ array_push($error, $exception->getMessage());
137
+ die(json_encode($error));
138
+ }
139
+ }
public/ajax/sendUsageStatus.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
 
4
- if(backupGuardIsAjax() && count($_POST)) {
5
 
 
6
  $usageStatus = $_POST['currentStatus'] == "true" ? 1 : 0;
7
  SGConfig::set('SG_BACKUP_SEND_USAGE_STATUS', $usageStatus);
8
  }
1
  <?php
 
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
 
5
+ if (backupGuardIsAjax() && count($_POST)) {
6
  $usageStatus = $_POST['currentStatus'] == "true" ? 1 : 0;
7
  SGConfig::set('SG_BACKUP_SEND_USAGE_STATUS', $usageStatus);
8
  }
public/ajax/setReviewPopupState.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
- require_once(dirname(__FILE__).'/../boot.php');
3
- if(backupGuardIsAjax() && count($_POST))
4
- {
5
- $state = (int)$_POST['reviewState'];
6
- SGConfig::set('SG_REVIEW_POPUP_STATE', $state);
7
- die('0');
8
- }
1
  <?php
2
+
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ if (backupGuardIsAjax() && count($_POST)) {
5
+ $state = (int)$_POST['reviewState'];
6
+ SGConfig::set('SG_REVIEW_POPUP_STATE', $state);
7
+ die('0');
8
+ }
public/ajax/setUserInfoVerificationPopupState.php CHANGED
@@ -1,19 +1,18 @@
1
  <?php
2
 
3
- require_once(dirname(__FILE__).'/../boot.php');
4
- require_once(SG_LIB_PATH.'BackupGuard/Client.php');
5
 
6
- if(backupGuardIsAjax() && count($_POST)) {
 
 
 
 
 
7
 
8
- $url = 'none';
9
- $firstName = 'none';
10
- $lastName = 'none';
11
- $email = 'none';
12
- $priority = 'none';
13
 
14
- $client = new BackupGuard\Client();
15
- $id = $client->storeSubscriberInfo($url, $firstName, $lastName, $email, $priority);
16
-
17
- SGConfig::set('SG_HIDE_VERIFICATION_POPUP_STATE', 1);
18
- die('0');
19
  }
1
  <?php
2
 
3
+ require_once dirname(__FILE__) . '/../boot.php';
4
+ require_once SG_LIB_PATH . 'BackupGuard/Client.php';
5
 
6
+ if (backupGuardIsAjax() && count($_POST)) {
7
+ $url = 'none';
8
+ $firstName = 'none';
9
+ $lastName = 'none';
10
+ $email = 'none';
11
+ $priority = 'none';
12
 
13
+ $client = new BackupGuard\Client();
14
+ $id = $client->storeSubscriberInfo($url, $firstName, $lastName, $email, $priority);
 
 
 
15
 
16
+ SGConfig::set('SG_HIDE_VERIFICATION_POPUP_STATE', 1);
17
+ die('0');
 
 
 
18
  }
public/ajax/settings.php CHANGED
@@ -1,154 +1,154 @@
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 = 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', $_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_';
113
- if (isset($_POST['backup-file-name'])) {
114
- $backupFileName = $_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', $_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', $_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', $_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
- }
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_';
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
+ }
public/ajax/storeSubscriberInfo.php CHANGED
@@ -1,27 +1,27 @@
1
  <?php
2
 
3
- require_once(dirname(__FILE__).'/../boot.php');
4
- require_once(SG_LIB_PATH.'BackupGuard/Client.php');
5
- require_once(dirname(__FILE__).'/sendUsageStatus.php');
6
 
7
- if(backupGuardIsAjax() && count($_POST)) {
8
- $_POST = backupGuardRemoveSlashes($_POST);
9
- $_POST = backupGuardSanitizeTextField($_POST);
10
 
11
- $error = '';
12
- $firstName = $_POST['fname'];
13
- $lastName = $_POST['lname'];
14
- $email = $_POST['email'];
15
- $priority = $_POST['priority'];
16
- $url = site_url();
17
 
18
- $client = new BackupGuard\Client();
19
- $id = $client->storeSubscriberInfo($url, $firstName, $lastName, $email, $priority);
20
 
21
- if ($id) {
22
- SGConfig::set('SG_HIDE_VERIFICATION_POPUP_STATE', 1);
23
- die('0');
24
- }
25
 
26
- die('"'.$error.'"');
27
  }
1
  <?php
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_LIB_PATH . 'BackupGuard/Client.php');
5
+ require_once(dirname(__FILE__) . '/sendUsageStatus.php');
6
 
7
+ if (backupGuardIsAjax() && count($_POST)) {
8
+ $_POST = backupGuardRemoveSlashes($_POST);
9
+ $_POST = backupGuardSanitizeTextField($_POST);
10
 
11
+ $error = '';
12
+ $firstName = $_POST['fname'];
13
+ $lastName = $_POST['lname'];
14
+ $email = $_POST['email'];
15
+ $priority = $_POST['priority'];
16
+ $url = site_url();
17
 
18
+ $client = new BackupGuard\Client();
19
+ $id = $client->storeSubscriberInfo($url, $firstName, $lastName, $email, $priority);
20
 
21
+ if ($id) {
22
+ SGConfig::set('SG_HIDE_VERIFICATION_POPUP_STATE', 1);
23
+ die('0');
24
+ }
25
 
26
+ die('"' . $error . '"');
27
  }
public/ajax/storeSurveyResult.php CHANGED
@@ -1,35 +1,34 @@
1
  <?php
2
 
3
- require_once(dirname(__FILE__).'/../boot.php');
4
- require_once(SG_LIB_PATH.'BackupGuard/Client.php');
5
 
6
- if(backupGuardIsAjax() && count($_POST)) {
7
- $_POST = backupGuardRemoveSlashes($_POST);
8
- $_POST = backupGuardSanitizeTextField($_POST);
9
 
10
- $error = '';
11
 
12
- if (isset($_POST['skip'])) {
13
- $firstname = 'skip';
14
- $lastname = 'skip';
15
- $email = 'skip';
16
- $response = 'skip';
17
- $url = site_url();
18
- }
19
- else {
20
- $firstname = $_POST['firstname'];
21
- $lastname = $_POST['lastname'];
22
- $email = $_POST['email'];
23
- $response = $_POST['response'];
24
- $url = site_url();
25
- }
26
 
27
- $client = new BackupGuard\Client();
28
- $id = $client->storeSurveyResult($url, $firstname, $lastname, $email, $response);
29
 
30
- if ($id) {
31
- die('{"success":"success"}');
32
- }
33
 
34
- die('"'.$error.'"');
35
  }
1
  <?php
2
 
3
+ require_once(dirname(__FILE__) . '/../boot.php');
4
+ require_once(SG_LIB_PATH . 'BackupGuard/Client.php');
5
 
6
+ if (backupGuardIsAjax() && count($_POST)) {
7
+ $_POST = backupGuardRemoveSlashes($_POST);
8
+ $_POST = backupGuardSanitizeTextField($_POST);
9
 
10
+ $error = '';
11
 
12
+ if (isset($_POST['skip'])) {
13
+ $firstname = 'skip';
14
+ $lastname = 'skip';
15
+ $email = 'skip';
16
+ $response = 'skip';
17
+ $url = site_url();
18
+ } else {
19
+ $firstname = $_POST['firstname'];
20
+ $lastname = $_POST['lastname'];
21
+ $email = $_POST['email'];
22
+ $response = $_POST['response'];
23
+ $url = site_url();
24
+ }
 
25
 
26
+ $client = new BackupGuard\Client();
27
+ $id = $client->storeSurveyResult($url, $firstname, $lastname, $email, $response);
28
 
29
+ if ($id) {
30
+ die('{"success":"success"}');
31
+ }
32
 
33
+ die('"' . $error . '"');
34
  }
public/backups.php CHANGED
@@ -4,7 +4,6 @@ $backups = SGBackup::getAllBackups();
4
  $downloadUrl = admin_url('admin-post.php?action=backup_guard_downloadBackup&');
5
  $contentClassName = getBackupPageContentClassName('backups');
6
  $allowDataCollection = SGConfig::get('SG_BACKUP_SEND_USAGE_STATUS');
7
-
8
  ?>
9
  <div id="sg-backup-page-content-backups" class="sg-backup-page-content <?php echo $contentClassName; ?>">
10
  <?php if (SGConfig::get('SG_REVIEW_POPUP_STATE') == SG_SHOW_REVIEW_POPUP) : ?>
@@ -180,7 +179,7 @@ This will provide us with an opportunity to make the experience so much better f
180
  <td><input type="checkbox" autocomplete="off"
181
  value="<?php echo esc_attr($backup['name']) ?>" <?php echo $backup['active'] ? 'disabled' : '' ?>>
182
  </td>
183
- <td><?php echo $backup['name'] ?></td>
184
  <td><?php echo !$backup['active'] ? $backup['size'] : '' ?></td>
185
  <td><?php echo backupGuardConvertDateTimezone($backup['date'], true) ?></td>
186
  <td id="sg-status-tabe-data-<?php echo $backup['id'] ?>" <?php echo $backup['active'] ? 'data-toggle="tooltip" data-placement="top" data-original-title="" data-container="#sg-wrapper"' : '' ?>>
@@ -201,11 +200,11 @@ This will provide us with an opportunity to make the experience so much better f
201
  <span class="btn-xs text-warning" data-toggle="tooltip" data-placement="top"
202
  data-original-title="
203
  <?php if ($backup['type'] == SG_ACTION_TYPE_BACKUP) :
204
- echo _backupGuardT('Warnings found during backup', true);
205
  elseif ($backup['type'] == SG_ACTION_TYPE_RESTORE) :
206
- echo _backupGuardT('Warnings found during restore', true);
207
  else :
208
- echo _backupGuardT('Warnings found during upload', true);
209
  endif; ?>
210
  " data-container="#sg-wrapper"><?php _backupGuardT('Warning') ?></span>
211
  <?php elseif ($backup['status'] == SG_ACTION_STATUS_ERROR) : ?>
4
  $downloadUrl = admin_url('admin-post.php?action=backup_guard_downloadBackup&');
5
  $contentClassName = getBackupPageContentClassName('backups');
6
  $allowDataCollection = SGConfig::get('SG_BACKUP_SEND_USAGE_STATUS');
 
7
  ?>
8
  <div id="sg-backup-page-content-backups" class="sg-backup-page-content <?php echo $contentClassName; ?>">
9
  <?php if (SGConfig::get('SG_REVIEW_POPUP_STATE') == SG_SHOW_REVIEW_POPUP) : ?>
179
  <td><input type="checkbox" autocomplete="off"
180
  value="<?php echo esc_attr($backup['name']) ?>" <?php echo $backup['active'] ? 'disabled' : '' ?>>
181
  </td>
182
+ <td><?php echo esc_html($backup['name']) ?></td>
183
  <td><?php echo !$backup['active'] ? $backup['size'] : '' ?></td>
184
  <td><?php echo backupGuardConvertDateTimezone($backup['date'], true) ?></td>
185
  <td id="sg-status-tabe-data-<?php echo $backup['id'] ?>" <?php echo $backup['active'] ? 'data-toggle="tooltip" data-placement="top" data-original-title="" data-container="#sg-wrapper"' : '' ?>>
200
  <span class="btn-xs text-warning" data-toggle="tooltip" data-placement="top"
201
  data-original-title="
202
  <?php if ($backup['type'] == SG_ACTION_TYPE_BACKUP) :
203
+ echo _backupGuardT('Warnings found during backup', true);
204
  elseif ($backup['type'] == SG_ACTION_TYPE_RESTORE) :
205
+ echo _backupGuardT('Warnings found during restore', true);
206
  else :
207
+ echo _backupGuardT('Warnings found during upload', true);
208
  endif; ?>
209
  " data-container="#sg-wrapper"><?php _backupGuardT('Warning') ?></span>
210
  <?php elseif ($backup['status'] == SG_ACTION_STATUS_ERROR) : ?>
public/boot.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
- require_once(dirname(__FILE__) . '/../com/boot.php');
3
- require_once(dirname(__FILE__) . '/config/config.wordpress.php');
4
- require_once(SG_PUBLIC_INCLUDE_PATH.'functions.php');
1
+ <?php
2
+ require_once(dirname(__FILE__) . '/../com/boot.php');
3
+ require_once(dirname(__FILE__) . '/config/config.wordpress.php');
4
+ require_once(SG_PUBLIC_INCLUDE_PATH.'functions.php');
public/cloud.php CHANGED
@@ -1,250 +1,280 @@
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 = 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
- }
34
- else if ((25 <= $availableSpaceInpercents) && ($availableSpaceInpercents < 50)) {
35
- $usedSpaceTextColor = "black";
36
- }
37
- else if ((50 <= $availableSpaceInpercents) && ($availableSpaceInpercents <= 75)) {
38
- $usedSpaceTextColor = "orange";
39
- }
40
- else if ($availableSpaceInpercents >= 75) {
41
- $usedSpaceTextColor = "red";
42
- }
43
-
44
- $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>';
45
- }
46
- ?>
47
- <div id="sg-backup-page-content-cloud" class="sg-backup-page-content <?php echo $contentClassName; ?>">
48
- <div class="row sg-cloud-container">
49
- <div class="col-md-12">
50
- <form class="form-horizontal">
51
- <fieldset>
52
- <div><h1 class="sg-backup-page-title"><?php _backupGuardT('Cloud settings')?></h1></div>
53
- <?php if (SGBoot::isFeatureAvailable('SUBDIRECTORIES')): ?>
54
- <div class="form-group form-inline">
55
- <label class="col-md-5 sg-control-label">
56
- <?php _backupGuardT('Destination folder')?>
57
- </label>
58
- <div class="col-md-3">
59
- <input id="cloudFolder" name="cloudFolder" type="text" class="form-control input-md sg-backup-input" value="<?php echo esc_html(SGConfig::get('SG_STORAGE_BACKUPS_FOLDER_NAME'))?>">
60
- <button type="button" id="sg-save-cloud-folder" 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 $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')?>" data-off-text="<?php _backupGuardT('OFF')?>" data-storage="BACKUP_GUARD" data-remote="bgLogin" class="sg-switch" <?php echo !empty($backupGuardCloudAccount)?'checked="checked"':''?>>
81
- <a id="backup-guard-details" href="javascript:void(0)" class="hide" data-toggle="modal" data-modal-name="backup-guard-details" data-remote="modalBackupGuardDetails"></a>
82
- </label>
83
- </div>
84
- </div>
85
- <?php endif; ?>
86
- <!-- Dropbox -->
87
- <?php if (SGBoot::isFeatureAvailable('DROPBOX')): ?>
88
- <div class="form-group">
89
- <label class="col-md-5 sg-control-label">
90
- <div class="sg-cloud-icon-wrapper">
91
- <span class="sg-cloud-icon sg-cloud-dropbox"></span>
92
- </div>
93
- <div class="sg-cloud-label-wrapper">
94
- <span><?php echo 'Dropbox' ?></span>
95
- <?php if(!empty($dropboxUsername)): ?>
96
- <br/>
97
- <span class="text-muted sg-dropbox-user sg-helper-block"><?php echo $dropboxUsername;?></span>
98
- <?php endif;?>
99
- </div>
100
- </label>
101
- <div class="col-md-3">
102
- <label class="sg-switch-container">
103
- <input data-on-text="<?php _backupGuardT('ON')?>" data-off-text="<?php _backupGuardT('OFF')?>" data-storage="DROPBOX" data-remote="cloudDropbox" type="checkbox" class="sg-switch" <?php echo !empty($dropbox)?'checked="checked"':''?>>
104
- </label>
105
- </div>
106
- </div>
107
- <?php endif; ?>
108
- <!-- Google Drive -->
109
- <?php if (SGBoot::isFeatureAvailable('GOOGLE_DRIVE')): ?>
110
- <div class="form-group">
111
- <label class="col-md-5 sg-control-label">
112
- <div class="sg-cloud-icon-wrapper">
113
- <span class="sg-cloud-icon sg-cloud-google-drive"></span>
114
- </div>
115
- <div class="sg-cloud-label-wrapper">
116
- <?php echo 'Google Drive' ?>
117
- <?php if(!empty($gdriveUsername)): ?>
118
- <br/>
119
- <span class="text-muted sg-gdrive-user sg-helper-block"><?php echo $gdriveUsername;?></span>
120
- <?php endif;?>
121
- </div>
122
- </label>
123
- <div class="col-md-3">
124
- <label class="sg-switch-container">
125
- <input data-on-text="<?php _backupGuardT('ON')?>" data-off-text="<?php _backupGuardT('OFF')?>" data-storage="GOOGLE_DRIVE" data-remote="cloudGdrive" type="checkbox" class="sg-switch" <?php echo !empty($gdrive)?'checked="checked"':''?>>
126
- </label>
127
- </div>
128
- </div>
129
- <?php endif; ?>
130
- <!-- FTP -->
131
- <?php if (SGBoot::isFeatureAvailable('FTP')): ?>
132
- <div class="form-group">
133
- <label class="col-md-5 sg-control-label sg-user-info">
134
- <div class="sg-cloud-icon-wrapper">
135
- <span class="sg-cloud-icon sg-cloud-ftp"></span>
136
- </div>
137
- <div class="sg-cloud-label-wrapper">
138
- <?php echo 'FTP / SFTP' ?>
139
- <?php if(!empty($ftpUsername)): ?>
140
- <br/>
141
- <span class="text-muted sg-ftp-user sg-helper-block"><?php echo $ftpUsername;?></span>
142
- <?php endif;?>
143
- </div>
144
- </label>
145
- <div class="col-md-3">
146
- <label class="sg-switch-container">
147
- <input type="checkbox" data-on-text="<?php _backupGuardT('ON')?>" data-off-text="<?php _backupGuardT('OFF')?>" data-storage="FTP" data-remote="cloudFtp" class="sg-switch" <?php echo !empty($ftp)?'checked="checked"':''?>>
148
- <a id="ftp-settings" href="javascript:void(0)" class="hide" data-toggle="modal" data-modal-name="ftp-settings" data-remote="modalFtpSettings"><?php echo 'FTP '._backupGuardT('Settings', true) ?></a>
149
- </label>
150
- </div>
151
- </div>
152
- <?php endif; ?>
153
- <!-- Amazon S3 -->
154
- <?php if (SGBoot::isFeatureAvailable('AMAZON')): ?>
155
- <div class="form-group">
156
- <label class="col-md-5 sg-control-label">
157
- <div class="sg-cloud-icon-wrapper">
158
- <span class="sg-cloud-icon sg-cloud-amazon"></span>
159
- </div>
160
- <div class="sg-cloud-label-wrapper">
161
- <?php echo (backupGuardIsAccountGold()? 'Amazon ':'').'S3'?>
162
- <?php if (!empty($amazonInfo)):?>
163
- <br/>
164
- <span class="text-muted sg-amazonr-user sg-helper-block"><?php echo $amazonInfo;?></span>
165
- <?php endif;?>
166
- </div>
167
- </label>
168
- <div class="col-md-3">
169
- <label class="sg-switch-container">
170
- <input type="checkbox" data-on-text="<?php _backupGuardT('ON')?>" data-off-text="<?php _backupGuardT('OFF')?>" data-storage="AMAZON" data-remote="cloudAmazon" class="sg-switch" <?php echo !empty($amazon)?'checked="checked"':''?>>
171
- <a id="amazon-settings" href="javascript:void(0)" class="hide" data-toggle="modal" data-modal-name="amazon-settings" data-remote="modalAmazonSettings"><?php echo 'Amazon'._backupGuardT('Settings', true)?></a>
172
- </label>
173
- </div>
174
- </div>
175
- <?php endif; ?>
176
- <!-- One Drive -->
177
- <?php if (SGBoot::isFeatureAvailable('ONE_DRIVE')): ?>
178
- <div class="form-group">
179
- <label class="col-md-5 sg-control-label">
180
- <div class="sg-cloud-icon-wrapper">
181
- <span class="sg-cloud-icon sg-cloud-one-drive"></span>
182
- </div>
183
- <div class="sg-cloud-label-wrapper">
184
- <?php echo 'One Drive' ?>
185
- <?php if(!empty($oneDriveInfo)): ?>
186
- <br/>
187
- <span class="text-muted sg-gdrive-user sg-helper-block"><?php echo $oneDriveInfo;?></span>
188
- <?php endif;?>
189
- </div>
190
- </label>
191
- <div class="col-md-3">
192
- <label class="sg-switch-container">
193
- <input data-on-text="<?php _backupGuardT('ON')?>" data-off-text="<?php _backupGuardT('OFF')?>" data-storage="ONE_DRIVE" data-remote="cloudOneDrive" type="checkbox" class="sg-switch" <?php echo !empty($oneDrive)?'checked="checked"':''?>>
194
- </label>
195
- </div>
196
- </div>
197
- <?php endif; ?>
198
-
199
- <!-- PCloud -->
200
- <?php if ( SGBoot::isFeatureAvailable( 'P_CLOUD' ) ): ?>
201
- <div class="form-group">
202
- <label class="col-md-5 sg-control-label">
203
- <div class="sg-cloud-icon-wrapper">
204
- <span class="sg-cloud-icon sg-cloud-pcloud"></span>
205
- </div>
206
- <div class="sg-cloud-label-wrapper">
207
- <?php echo 'pCloud' ?>
208
- <?php if ( ! empty( $pCloudInfo ) ): ?>
209
- <br/>
210
- <span class="text-muted sg-gdrive-user sg-helper-block"><?php echo json_decode( $pCloudInfo, true )['email']; ?></span>
211
- <?php endif; ?>
212
- </div>
213
- </label>
214
- <div class="col-md-3">
215
- <label class="sg-switch-container">
216
- <input data-on-text="<?php _backupGuardT('ON')?>" data-off-text="<?php _backupGuardT('OFF')?>" data-storage="P_CLOUD" data-remote="cloudPCloud" type="checkbox" class="sg-switch" <?php echo !empty($pCloud)?'checked="checked"':''?>>
217
- </label>
218
- </div>
219
- </div>
220
- <?php endif; ?>
221
-
222
- <!-- Box -->
223
- <?php if ( SGBoot::isFeatureAvailable( 'BOX' ) ): ?>
224
- <div class="form-group">
225
- <label class="col-md-5 sg-control-label">
226
- <div class="sg-cloud-icon-wrapper">
227
- <span class="sg-cloud-icon sg-cloud-box"></span>
228
- </div>
229
- <div class="sg-cloud-label-wrapper">
230
- <?php echo 'box.com' ?>
231
- <?php if ( ! empty( $boxInfo ) ): ?>
232
- <br/>
233
- <span class="text-muted sg-gdrive-user sg-helper-block"><?php echo json_decode( $boxInfo, true )['login']; ?></span>
234
- <?php endif; ?>
235
- </div>
236
- </label>
237
- <div class="col-md-3">
238
- <label class="sg-switch-container">
239
- <input data-on-text="<?php _backupGuardT('ON')?>" data-off-text="<?php _backupGuardT('OFF')?>" data-storage="BOX" data-remote="cloudBox" type="checkbox" class="sg-switch" <?php echo !empty($box)?'checked="checked"':''?>>
240
- </label>
241
- </div>
242
- </div>
243
- <?php endif; ?>
244
-
245
-
246
- </fieldset>
247
- </form>
248
- </div>
249
- </div>
250
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
public/dashboardWidget.php CHANGED
@@ -1,116 +1,112 @@
1
- <?php
2
- require_once(SG_BACKUP_PATH.'SGBackup.php');
3
- // Function that outputs the contents of the dashboard widget
4
- function backup_guard_dashboard_widget_function( $post, $callback_args ) {
5
-
6
- $banner = backupGuardGetBanner(SG_ENV_WORDPRESS,"dashboard-widget");
7
-
8
- $backups = SGBackup::getAllBackups();
9
- $allBackupsCount = count($backups);
10
- $successBackups = 0;
11
- $faildBackups = 0;
12
- $inprogress = 0;
13
- $warningBackups = 0;
14
- $canceledBackups = 0;
15
-
16
- for($i = 0; $i < $allBackupsCount; $i++){
17
- if (empty($backups[$i])) {
18
- continue;
19
- }
20
- switch ($backups[$i]['status']){
21
- case SG_ACTION_STATUS_IN_PROGRESS_DB:
22
- case SG_ACTION_STATUS_IN_PROGRESS_FILES:
23
- $inprogress++;
24
- break;
25
- case SG_ACTION_STATUS_FINISHED_WARNINGS:
26
- $warningBackups++;
27
- break;
28
- case SG_ACTION_STATUS_CANCELLED:
29
- $canceledBackups++;
30
- break;
31
- case SG_ACTION_STATUS_ERROR:
32
- $faildBackups++;
33
- break;
34
- default:
35
- $successBackups++;
36
- }
37
- }
38
- if(strpos(SG_PRODUCT_IDENTIFIER,"silver") !== false || strpos(SG_PRODUCT_IDENTIFIER,"gold") !== false) {
39
- $sgb = new SGBackup();
40
- $scheduleParams = $sgb->getScheduleParamsById(SG_SCHEDULER_DEFAULT_ID);
41
- $scheduleParams = backupGuardParseBackupOptions($scheduleParams);
42
- $schedulesCount = strlen($scheduleParams['label'])? 1 : 0;
43
-
44
- }else if(strpos(SG_PRODUCT_IDENTIFIER,"free") === false) { // platinum
45
- require_once(SG_BACKUP_PATH.'SGBackupSchedule.php');
46
- $allSchedules = SGBackupSchedule::getAllSchedules();
47
- $schedulesCount = count($allSchedules);
48
- }
49
-
50
-
51
- ?>
52
- <div style="width: 100%; font-size: 12px; "><?php echo $banner ?></div>
53
- <div id="canvas-holder" style="width:100%">
54
- <canvas id="chart-area"></canvas>
55
- </div>
56
- <script>
57
- function backupGuardLoadChart() {
58
- var config = {
59
- type: 'pie',
60
- data: {
61
- datasets: [{
62
- data: [
63
- <?php echo $successBackups ?>,
64
- <?php echo $faildBackups ?>,
65
- <?php echo $warningBackups ?>,
66
- <?php echo $canceledBackups ?>,
67
- <?php echo $inprogress ?>
68
-
69
-
70
- ],
71
- backgroundColor: [
72
- "#2b8b3a",
73
- "#f96868",
74
- "#ffb848",
75
- "#7C858E",
76
- "#64aed9"
77
-
78
- ],
79
- label: 'Dataset 1'
80
- }],
81
- labels: [
82
- "Success (<?php echo $successBackups ?>)",
83
- "Failed (<?php echo $faildBackups ?>)",
84
- "Warning (<?php echo $warningBackups ?>)",
85
- "Canceled (<?php echo $canceledBackups ?>)",
86
- "In progress (<?php echo $inprogress ?>)",
87
- ]
88
- },
89
- options: {
90
- responsive: true,
91
- legend: {
92
- labels: {
93
- // This more specific font property overrides the global property
94
- fontFamily: "'Source Sans Pro', 'Calibri', 'Candara', 'Arial', 'sans-serif'"
95
- }
96
- }
97
- }
98
- };
99
- <?php
100
- if(isset($schedulesCount)) {
101
- ?>
102
- config.data.datasets[0].data.push(<?php echo $schedulesCount ?>);
103
- config.data.datasets[0].backgroundColor.push("#cecece");
104
- config.data.labels.push("Schedules (<?php echo $schedulesCount ?>)");
105
- <?php
106
- }
107
-
108
- ?>
109
- var ctx = document.getElementById("chart-area").getContext("2d");
110
- window.backupGuardPieChart = new Chart(ctx, config);
111
- }
112
- backupGuardLoadChart();
113
- </script>
114
- <?php
115
- }
116
-
1
+ <?php
2
+ require_once SG_BACKUP_PATH . 'SGBackup.php';
3
+ // Function that outputs the contents of the dashboard widget
4
+ function backup_guard_dashboard_widget_function($post, $callback_args) // phpcs:ignore
5
+ {
6
+
7
+ $banner = backupGuardGetBanner(SG_ENV_WORDPRESS, "dashboard-widget");
8
+
9
+ $backups = SGBackup::getAllBackups();
10
+ $allBackupsCount = count($backups);
11
+ $successBackups = 0;
12
+ $faildBackups = 0;
13
+ $inprogress = 0;
14
+ $warningBackups = 0;
15
+ $canceledBackups = 0;
16
+
17
+ for ($i = 0; $i < $allBackupsCount; $i++) {
18
+ if (empty($backups[$i])) {
19
+ continue;
20
+ }
21
+ switch ($backups[$i]['status']) {
22
+ case SG_ACTION_STATUS_IN_PROGRESS_DB:
23
+ case SG_ACTION_STATUS_IN_PROGRESS_FILES:
24
+ $inprogress++;
25
+ break;
26
+ case SG_ACTION_STATUS_FINISHED_WARNINGS:
27
+ $warningBackups++;
28
+ break;
29
+ case SG_ACTION_STATUS_CANCELLED:
30
+ $canceledBackups++;
31
+ break;
32
+ case SG_ACTION_STATUS_ERROR:
33
+ $faildBackups++;
34
+ break;
35
+ default:
36
+ $successBackups++;
37
+ }
38
+ }
39
+ if (strpos(SG_PRODUCT_IDENTIFIER, "silver") !== false || strpos(SG_PRODUCT_IDENTIFIER, "gold") !== false) {
40
+ $sgb = new SGBackup();
41
+ $scheduleParams = $sgb->getScheduleParamsById(SG_SCHEDULER_DEFAULT_ID);
42
+ $scheduleParams = backupGuardParseBackupOptions($scheduleParams);
43
+ $schedulesCount = strlen($scheduleParams['label']) ? 1 : 0;
44
+ } else if (strpos(SG_PRODUCT_IDENTIFIER, "free") === false) { // platinum
45
+ include_once SG_BACKUP_PATH . 'SGBackupSchedule.php';
46
+ $allSchedules = SGBackupSchedule::getAllSchedules();
47
+ $schedulesCount = count($allSchedules);
48
+ }
49
+ ?>
50
+ <div style="width: 100%; font-size: 12px; "><?php echo $banner ?></div>
51
+ <div id="canvas-holder" style="width:100%">
52
+ <canvas id="chart-area"></canvas>
53
+ </div>
54
+ <script>
55
+ function backupGuardLoadChart() {
56
+ var config = {
57
+ type: 'pie',
58
+ data: {
59
+ datasets: [{
60
+ data: [
61
+ <?php echo $successBackups ?>,
62
+ <?php echo $faildBackups ?>,
63
+ <?php echo $warningBackups ?>,
64
+ <?php echo $canceledBackups ?>,
65
+ <?php echo $inprogress ?>
66
+
67
+
68
+ ],
69
+ backgroundColor: [
70
+ "#2b8b3a",
71
+ "#f96868",
72
+ "#ffb848",
73
+ "#7C858E",
74
+ "#64aed9"
75
+
76
+ ],
77
+ label: 'Dataset 1'
78
+ }],
79
+ labels: [
80
+ "Success (<?php echo $successBackups ?>)",
81
+ "Failed (<?php echo $faildBackups ?>)",
82
+ "Warning (<?php echo $warningBackups ?>)",
83
+ "Canceled (<?php echo $canceledBackups ?>)",
84
+ "In progress (<?php echo $inprogress ?>)",
85
+ ]
86
+ },
87
+ options: {
88
+ responsive: true,
89
+ legend: {
90
+ labels: {
91
+ // This more specific font property overrides the global property
92
+ fontFamily: "'Source Sans Pro', 'Calibri', 'Candara', 'Arial', 'sans-serif'"
93
+ }
94
+ }
95
+ }
96
+ };
97
+ <?php
98
+ if (isset($schedulesCount)) {
99
+ ?>
100
+ config.data.datasets[0].data.push(<?php echo $schedulesCount ?>);
101
+ config.data.datasets[0].backgroundColor.push("#cecece");
102
+ config.data.labels.push("Schedules (<?php echo $schedulesCount ?>)");
103
+ <?php }
104
+ ?>
105
+ var ctx = document.getElementById("chart-area").getContext("2d");
106
+ window.backupGuardPieChart = new Chart(ctx, config);
107
+ }
108
+
109
+ backupGuardLoadChart();
110
+ </script>
111
+ <?php
112
+ }
 
 
 
 
public/include/footer-new.php CHANGED
@@ -1,2 +1,2 @@
1
- </div>
2
  </div>
1
+ </div>
2
  </div>
public/include/footer.php CHANGED
@@ -1,15 +1,15 @@
1
  <!--<div class="sg-footer">
2
  <div class="row">
3
  <div class="col-md-12">
4
- <strong><?php _backupGuardT('Powered by BackupGuard')?></strong>
5
  <p>
6
- <a href="javascript:void(0)" data-toggle="modal" data-modal-name="terms" data-remote="modalTerms"><?php _backupGuardT('Terms & Conditions')?></a> | <a href="#" data-toggle="modal" data-modal-name="privacy" data-remote="modalPrivacy"><?php _backupGuardT('Privacy Policy')?></a>
7
- <strong class="sg-version"><?php _backupGuardT('v.1.0.0')?></strong>
8
  </p>
9
  </div>
10
  </div>
11
  </div>-->
12
- <?php require_once(SG_PUBLIC_INCLUDE_PATH.'modal.php'); ?>
13
  </div>
14
  <div class="clearfix"></div>
15
  </div>
1
  <!--<div class="sg-footer">
2
  <div class="row">
3
  <div class="col-md-12">
4
+ <strong><?php _backupGuardT('Powered by BackupGuard') ?></strong>
5
  <p>
6
+ <a href="javascript:void(0)" data-toggle="modal" data-modal-name="terms" data-remote="modalTerms"><?php _backupGuardT('Terms & Conditions') ?></a> | <a href="#" data-toggle="modal" data-modal-name="privacy" data-remote="modalPrivacy"><?php _backupGuardT('Privacy Policy') ?></a>
7
+ <strong class="sg-version"><?php _backupGuardT('v.1.0.0') ?></strong>
8
  </p>
9
  </div>
10
  </div>
11
  </div>-->
12
+ <?php require_once(SG_PUBLIC_INCLUDE_PATH . 'modal.php'); ?>
13
  </div>
14
  <div class="clearfix"></div>
15
  </div>
public/include/functions.php CHANGED
@@ -1,368 +1,368 @@
1
- <?php
2
-
3
- function backupGuardShouldShowDiscountNotice()
4
- {
5
- if (SGConfig::get("SG_HIDE_DISCOUNT_NOTICE")) {
6
- return false;
7
- }
8
-
9
- return true;
10
- }
11
-
12
- function checkDueDateDiscount()
13
- {
14
- $startDate = '2019-11-27';
15
- $endDate = '2019-12-02';
16
-
17
- $timezone = 'Asia/Yerevan';
18
- $timeDate = new DateTime('now', new DateTimeZone($timezone));
19
- $currentTime = strtotime($timeDate->format('Y-m-d H:i:s'));
20
-
21
- $startDate = strtotime($startDate);
22
- $finishDate = strtotime($endDate);
23
-
24
- return ($currentTime > $startDate && $currentTime < $finishDate);
25
- }
26
-
27
- function _backupGuardT($key, $return = false)
28
- {
29
- if (SG_ENV_ADAPTER == SG_ENV_WORDPRESS) {
30
- if ($return) {
31
- return __($key, "backup-guard-pro");
32
- } else {
33
- _e($key, "backup-guard-pro");
34
- }
35
- } else {
36
- if ($return) {
37
- return $key;
38
- } else {
39
- echo $key;
40
- }
41
- }
42
- }
43
-
44
- function backupGuardIsAjax()
45
- {
46
- return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
47
- }
48
-
49
- function selectElement($data, $attributes = array(), $firstOption = '', $selectedKey = '')
50
- {
51
- $attrString = '';
52
- foreach ($attributes as $attributeKey => $attributeValue) {
53
- $attrString .= " " . $attributeKey . '="' . $attributeValue . '"';
54
- }
55
- $select = '<select' . $attrString . '>';
56
- if ($firstOption) {
57
- $select .= '<option value="0">' . $firstOption . '</option>';
58
- }
59
- foreach ($data as $key => $val) {
60
- $selected = $selectedKey == $key ? ' selected="selected"' : '';
61
- $select .= '<option value="' . $key . '"' . $selected . '>' . $val . '</option>';
62
- }
63
- $select .= '</select>';
64
-
65
- return $select;
66
- }
67
-
68
- function backupGuardParseBackupOptions($options)
69
- {
70
-
71
- $scheduleOptions = array(
72
- 'interval' => '',
73
- 'monthOfInterval' => '',
74
- 'dayOfInterval' => '',
75
- 'intervalHour' => '',
76
- 'isBackgroundMode' => false,
77
- 'isDatabaseSelected' => false,
78
- 'isFilesSelected' => false,
79
- 'isCustomBackup' => false,
80
- 'selectedDirectories' => array(),
81
- 'excludeDirectories' => array(),
82
- 'selectedClouds' => array(),
83
- 'label' => ''
84
- );
85
-
86
- if (isset($options['schedule_options'])) {
87
- $scheduleExecutionOptions = json_decode($options['schedule_options'], true);
88
-
89
- $scheduleOptions['interval'] = $scheduleExecutionOptions['interval'];
90
- $scheduleOptions['monthOfInterval'] = $scheduleExecutionOptions['monthOfInterval'];
91
- $scheduleOptions['dayOfInterval'] = $scheduleExecutionOptions['dayOfInterval'];
92
- $scheduleOptions['intervalHour'] = $scheduleExecutionOptions['intervalHour'];
93
- }
94
-
95
- if (isset($options['backup_options'])) {
96
- $backupOptions = json_decode($options['backup_options'], true);
97
-
98
- $scheduleOptions['isBackgroundMode'] = $backupOptions['SG_BACKUP_IN_BACKGROUND_MODE'] ? true : false;
99
- $scheduleOptions['isDatabaseSelected'] = $backupOptions['SG_ACTION_BACKUP_DATABASE_AVAILABLE'] ? true : false;
100
- $scheduleOptions['isFilesSelected'] = $backupOptions['SG_ACTION_BACKUP_FILES_AVAILABLE'] ? true : false;
101
- $backupType = $backupOptions['SG_BACKUP_TYPE'];
102
-
103
- $scheduleOptions['isCustomBackup'] = $backupType == SG_BACKUP_TYPE_FULL ? false : true;
104
-
105
- if ($scheduleOptions['isCustomBackup']) {
106
- $scheduleOptions['selectedDirectories'] = explode(',', $backupOptions['SG_BACKUP_FILE_PATHS']);
107
- if ($scheduleOptions['isFilesSelected']) {
108
- $scheduleOptions['excludeDirectories'] = explode(',', $backupOptions['SG_BACKUP_FILE_PATHS_EXCLUDE']);
109
- }
110
- }
111
-
112
- if (strlen($backupOptions['SG_BACKUP_UPLOAD_TO_STORAGES'])) {
113
- $scheduleOptions['selectedClouds'] = explode(',', $backupOptions['SG_BACKUP_UPLOAD_TO_STORAGES']);
114
- }
115
- }
116
-
117
- if (isset($options['label'])) {
118
- $scheduleOptions['label'] = $options['label'];
119
- }
120
-
121
- return $scheduleOptions;
122
- }
123
-
124
- function backupGuardFilterStatusesByActionType($currentBackup, $currentOptions)
125
- {
126
- $filteredStatuses = array();
127
- if ($currentBackup['type'] == SG_ACTION_TYPE_RESTORE) {
128
- $filteredStatuses[] = SG_ACTION_TYPE_RESTORE . SG_ACTION_STATUS_IN_PROGRESS_FILES;
129
- $filteredStatuses[] = SG_ACTION_TYPE_RESTORE . SG_ACTION_STATUS_IN_PROGRESS_DB;
130
- } else {
131
- $currentOptions = backupGuardActiveOptionToType($currentOptions);
132
- if ($currentOptions['backupDatabase']) {
133
- $filteredStatuses[] = $currentOptions['backupDatabase'];
134
- }
135
- if ($currentOptions['backupFiles']) {
136
- $filteredStatuses[] = $currentOptions['backupFiles'];
137
- }
138
- if ($currentOptions['ftp']) {
139
- $filteredStatuses[] = $currentOptions['ftp'];
140
- }
141
- if ($currentOptions['dropbox']) {
142
- $filteredStatuses[] = $currentOptions['dropbox'];
143
- }
144
- if ($currentOptions['gdrive']) {
145
- $filteredStatuses[] = $currentOptions['gdrive'];
146
- }
147
- if ($currentOptions['amazon']) {
148
- $filteredStatuses[] = $currentOptions['amazon'];
149
- }
150
- if ($currentOptions['oneDrive']) {
151
- $filteredStatuses[] = $currentOptions['oneDrive'];
152
- }
153
- if ($currentOptions['pCloud']) {
154
- $filteredStatuses[] = $currentOptions['pCloud'];
155
- }
156
- if ($currentOptions['box']) {
157
- $filteredStatuses[] = $currentOptions['box'];
158
- }
159
- if ($currentOptions['backupGuard']) {
160
- $filteredStatuses[] = $currentOptions['backupGuard'];
161
- }
162
- }
163
-
164
- return $filteredStatuses;
165
- }
166
-
167
- function backupGuardActiveOptionToType($activeOption)
168
- {
169
- $activeOptions = array();
170
- $activeOption = json_decode($activeOption, true);
171
- $activeOptions['backupDatabase'] = !empty($activeOption['SG_ACTION_BACKUP_DATABASE_AVAILABLE']) ? SG_ACTION_STATUS_IN_PROGRESS_DB : 0;
172
- $activeOptions['backupFiles'] = !empty($activeOption['SG_ACTION_BACKUP_FILES_AVAILABLE']) ? SG_ACTION_STATUS_IN_PROGRESS_FILES : 0;
173
-
174
- $storages = explode(',', @$activeOption['SG_BACKUP_UPLOAD_TO_STORAGES']);
175
- $activeOptions['ftp'] = 0;
176
- $activeOptions['dropbox'] = 0;
177
- $activeOptions['gdrive'] = 0;
178
- $activeOptions['amazon'] = 0;
179
- $activeOptions['oneDrive'] = 0;
180
- $activeOptions['pCloud'] = 0;
181
- $activeOptions['box'] = 0;
182
- $activeOptions['backupGuard'] = 0;
183
- foreach ($storages as $storage) {
184
- switch ($storage) {
185
- case SG_STORAGE_FTP:
186
- $activeOptions['ftp'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_FTP;
187
- break;
188
- case SG_STORAGE_DROPBOX:
189
- $activeOptions['dropbox'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_DROPBOX;
190
- break;
191
- case SG_STORAGE_GOOGLE_DRIVE:
192
- $activeOptions['gdrive'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_GOOGLE_DRIVE;
193
- break;
194
- case SG_STORAGE_AMAZON:
195
- $activeOptions['amazon'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_AMAZON;
196
- break;
197
- case SG_STORAGE_ONE_DRIVE:
198
- $activeOptions['oneDrive'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_ONE_DRIVE;
199
- break;
200
- case SG_STORAGE_P_CLOUD:
201
- $activeOptions['pCloud'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_P_CLOUD;
202
- break;
203
- case SG_STORAGE_BOX:
204
- $activeOptions['box'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_BOX;
205
- break;
206
- case SG_STORAGE_BACKUP_GUARD:
207
- $activeOptions['backupGuard'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_BACKUP_GUARD;
208
- break;
209
- }
210
- }
211
-
212
- return $activeOptions;
213
- }
214
-
215
- function backupGuardConvertToBytes($from)
216
- {
217
- $number = substr($from, 0, -2);
218
- switch (strtoupper(substr($from, -2))) {
219
- case "KB":
220
- return $number * 1024;
221
- case "MB":
222
- return $number * pow(1024, 2);
223
- case "GB":
224
- return $number * pow(1024, 3);
225
- case "TB":
226
- return $number * pow(1024, 4);
227
- case "PB":
228
- return $number * pow(1024, 5);
229
- default:
230
- return $from;
231
- }
232
- }
233
-
234
- function backupGuardGetRunningActions()
235
- {
236
- $runningActions = SGBackup::getRunningActions();
237
- $isAnyActiveActions = count($runningActions);
238
- if ($isAnyActiveActions) {
239
- return $runningActions;
240
- }
241
-
242
- return false;
243
- }
244
-
245
- function backupGuardShouldUpdate()
246
- {
247
- $currentVersion = SG_BACKUP_GUARD_VERSION;
248
- $oldVersion = SGConfig::get('SG_BACKUP_GUARD_VERSION', true);
249
-
250
- if (!$oldVersion) {
251
- return true;
252
- }
253
-
254
- if ($currentVersion !== $oldVersion) {
255
- SGConfig::set('SG_BACKUP_GUARD_VERSION', $currentVersion, true);
256
- SGConfig::set('SG_HIDE_DISCOUNT_NOTICE', '0', true);
257
- SGBoot::didUpdatePluginVersion();
258
-
259
- return SG_FORCE_DB_TABLES_RESET;
260
- }
261
-
262
- if (!checkAllMissedTables()) {
263
- return true;
264
- }
265
-
266
- return false;
267
- }
268
-
269
- function backupGuardGetDatabaseEngine()
270
- {
271
- global $wpdb;
272
- $dbName = $wpdb->dbname;
273
- $engine = 'InnoDB';
274
- $engineCheckSql = "SELECT ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA = '$dbName'";
275
- $result = $wpdb->get_results($engineCheckSql, ARRAY_A);
276
- if (!empty($result)) {
277
- $engineCheckSql = "SHOW TABLE STATUS WHERE Name = '" . $wpdb->prefix . "users' AND Engine = 'MyISAM'";
278
- $result = $wpdb->get_results($engineCheckSql, ARRAY_A);
279
- if (isset($result[0]['Engine']) && $result[0]['Engine'] == 'MyISAM') {
280
- $engine = 'MyISAM';
281
- }
282
- }
283
-
284
- return $engine;
285
- }
286
-
287
- function backupGuardShouldActivateExtension($extension)
288
- {
289
- $extensionAdapter = SGExtension::getInstance();
290
-
291
- if (!$extensionAdapter->isExtensionAvailable($extension) || SGConfig::get($extension) || !$extensionAdapter->isExtensionAlreadyInPluginsFolder($extension) || $extensionAdapter->isExtensionActive($extension)) {
292
- return false;
293
- }
294
-
295
- return true;
296
- }
297
-
298
- function backupGuardShouldInstallExtension($extension)
299
- {
300
- $extensionAdapter = SGExtension::getInstance();
301
-
302
- if (!$extensionAdapter->isExtensionAvailable($extension) || SGConfig::get($extension) || $extensionAdapter->isExtensionAlreadyInPluginsFolder($extension) || $extensionAdapter->isExtensionActive($extension)) {
303
- return false;
304
- }
305
-
306
- return true;
307
- }
308
-
309
- function backupGuardLoggedMessage()
310
- {
311
- $pluginCapabilities = backupGuardGetCapabilities();
312
- if ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_FREE) {
313
- return '';
314
- }
315
-
316
- $user = SGConfig::get('SG_LOGGED_USER');
317
- if (!$user) {
318
- return '';
319
- }
320
-
321
- $user = unserialize($user);
322
- if (!$user || empty($user['firstname'])) {
323
- return '';
324
- }
325
-
326
- $html = '<span class="bg-logged-msg-container">';
327
- $html .= 'Package: ' . backupGuardGetProductName() . ' | Version: ' . SG_BACKUP_GUARD_VERSION;
328
- $html .= ' | Welcome, <b>' . $user['firstname'] . '</b>! ';
329
- $html .= '(<a href="javascript:void(0)" onclick="sgBackup.logout()">Log Out</a>)</span>';
330
-
331
- return $html;
332
- }
333
-
334
- function modifyCronJobsByTimezone()
335
- {
336
- $allSchedules = SGBackupSchedule::getAllSchedules(false);
337
-
338
- foreach ($allSchedules as $schedule) {
339
- $id = $schedule['id'];
340
- $cronTab = json_decode($schedule['schedule_options'], true);
341
- $cronOptions = json_decode($schedule['backup_options'], true);
342
- $cronLabel = $schedule['label'];
343
-
344
- SGBackupSchedule::create($cronTab, $cronOptions, $cronLabel);
345
- SGBackupSchedule::remove($id);
346
- }
347
- }
348
-
349
- if (!function_exists('dd')) {
350
- function dd()
351
- {
352
- $args = func_get_args();
353
-
354
- foreach ($args as $arg) {
355
- ob_start();
356
- print_r($arg);
357
- $output = ob_get_clean();
358
-
359
- // Add formatting
360
- $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);
361
- $output = '<pre style="background: #FFFEEF; color: #000; border: 1px dashed #888; padding: 10px; margin: 10px 0; text-align: left;">' . $output . '</pre>';
362
-
363
- echo $output;
364
- }
365
-
366
- exit;
367
- }
368
- }
1
+ <?php
2
+
3
+ function backupGuardShouldShowDiscountNotice()
4
+ {
5
+ if (SGConfig::get("SG_HIDE_DISCOUNT_NOTICE")) {
6
+ return false;
7
+ }
8
+
9
+ return true;
10
+ }
11
+
12
+ function checkDueDateDiscount()
13
+ {
14
+ $startDate = '2019-11-27';
15
+ $endDate = '2019-12-02';
16
+
17
+ $timezone = 'Asia/Yerevan';
18
+ $timeDate = new DateTime('now', new DateTimeZone($timezone));
19
+ $currentTime = strtotime($timeDate->format('Y-m-d H:i:s'));
20
+
21
+ $startDate = strtotime($startDate);
22
+ $finishDate = strtotime($endDate);
23
+
24
+ return ($currentTime > $startDate && $currentTime < $finishDate);
25
+ }
26
+
27
+ function _backupGuardT($key, $return = false)
28
+ {
29
+ if (SG_ENV_ADAPTER == SG_ENV_WORDPRESS) {
30
+ if ($return) {
31
+ return __($key, "backup-guard-pro");
32
+ } else {
33
+ _e($key, "backup-guard-pro");
34
+ }
35
+ } else {
36
+ if ($return) {
37
+ return $key;
38
+ } else {
39
+ echo $key;
40
+ }
41
+ }
42
+ }
43
+
44
+ function backupGuardIsAjax()
45
+ {
46
+ return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
47
+ }
48
+
49
+ function selectElement($data, $attributes = array(), $firstOption = '', $selectedKey = '')
50
+ {
51
+ $attrString = '';
52
+ foreach ($attributes as $attributeKey => $attributeValue) {
53
+ $attrString .= " " . $attributeKey . '="' . $attributeValue . '"';
54
+ }
55
+ $select = '<select' . $attrString . '>';
56
+ if ($firstOption) {
57
+ $select .= '<option value="0">' . $firstOption . '</option>';
58
+ }
59
+ foreach ($data as $key => $val) {
60
+ $selected = $selectedKey == $key ? ' selected="selected"' : '';
61
+ $select .= '<option value="' . $key . '"' . $selected . '>' . $val . '</option>';
62
+ }
63
+ $select .= '</select>';
64
+
65
+ return $select;
66
+ }
67
+
68
+ function backupGuardParseBackupOptions($options)
69
+ {
70
+
71
+ $scheduleOptions = array(
72
+ 'interval' => '',
73
+ 'monthOfInterval' => '',
74
+ 'dayOfInterval' => '',
75
+ 'intervalHour' => '',
76
+ 'isBackgroundMode' => false,
77
+ 'isDatabaseSelected' => false,
78
+ 'isFilesSelected' => false,
79
+ 'isCustomBackup' => false,
80
+ 'selectedDirectories' => array(),
81
+ 'excludeDirectories' => array(),
82
+ 'selectedClouds' => array(),
83
+ 'label' => ''
84
+ );
85
+
86
+ if (isset($options['schedule_options'])) {
87
+ $scheduleExecutionOptions = json_decode($options['schedule_options'], true);
88
+
89
+ $scheduleOptions['interval'] = $scheduleExecutionOptions['interval'];
90
+ $scheduleOptions['monthOfInterval'] = $scheduleExecutionOptions['monthOfInterval'];
91
+ $scheduleOptions['dayOfInterval'] = $scheduleExecutionOptions['dayOfInterval'];
92
+ $scheduleOptions['intervalHour'] = $scheduleExecutionOptions['intervalHour'];
93
+ }
94
+
95
+ if (isset($options['backup_options'])) {
96
+ $backupOptions = json_decode($options['backup_options'], true);
97
+
98
+ $scheduleOptions['isBackgroundMode'] = $backupOptions['SG_BACKUP_IN_BACKGROUND_MODE'] ? true : false;
99
+ $scheduleOptions['isDatabaseSelected'] = $backupOptions['SG_ACTION_BACKUP_DATABASE_AVAILABLE'] ? true : false;
100
+ $scheduleOptions['isFilesSelected'] = $backupOptions['SG_ACTION_BACKUP_FILES_AVAILABLE'] ? true : false;
101
+ $backupType = $backupOptions['SG_BACKUP_TYPE'];
102
+
103
+ $scheduleOptions['isCustomBackup'] = $backupType == SG_BACKUP_TYPE_FULL ? false : true;
104
+
105
+ if ($scheduleOptions['isCustomBackup']) {
106
+ $scheduleOptions['selectedDirectories'] = explode(',', $backupOptions['SG_BACKUP_FILE_PATHS']);
107
+ if ($scheduleOptions['isFilesSelected']) {
108
+ $scheduleOptions['excludeDirectories'] = explode(',', $backupOptions['SG_BACKUP_FILE_PATHS_EXCLUDE']);
109
+ }
110
+ }
111
+
112
+ if (strlen($backupOptions['SG_BACKUP_UPLOAD_TO_STORAGES'])) {
113
+ $scheduleOptions['selectedClouds'] = explode(',', $backupOptions['SG_BACKUP_UPLOAD_TO_STORAGES']);
114
+ }
115
+ }
116
+
117
+ if (isset($options['label'])) {
118
+ $scheduleOptions['label'] = $options['label'];
119
+ }
120
+
121
+ return $scheduleOptions;
122
+ }
123
+
124
+ function backupGuardFilterStatusesByActionType($currentBackup, $currentOptions)
125
+ {
126
+ $filteredStatuses = array();
127
+ if ($currentBackup['type'] == SG_ACTION_TYPE_RESTORE) {
128
+ $filteredStatuses[] = SG_ACTION_TYPE_RESTORE . SG_ACTION_STATUS_IN_PROGRESS_FILES;
129
+ $filteredStatuses[] = SG_ACTION_TYPE_RESTORE . SG_ACTION_STATUS_IN_PROGRESS_DB;
130
+ } else {
131
+ $currentOptions = backupGuardActiveOptionToType($currentOptions);
132
+ if ($currentOptions['backupDatabase']) {
133
+ $filteredStatuses[] = $currentOptions['backupDatabase'];
134
+ }
135
+ if ($currentOptions['backupFiles']) {
136
+ $filteredStatuses[] = $currentOptions['backupFiles'];
137
+ }
138
+ if ($currentOptions['ftp']) {
139
+ $filteredStatuses[] = $currentOptions['ftp'];
140
+ }
141
+ if ($currentOptions['dropbox']) {
142
+ $filteredStatuses[] = $currentOptions['dropbox'];
143
+ }
144
+ if ($currentOptions['gdrive']) {
145
+ $filteredStatuses[] = $currentOptions['gdrive'];
146
+ }
147
+ if ($currentOptions['amazon']) {
148
+ $filteredStatuses[] = $currentOptions['amazon'];
149
+ }
150
+ if ($currentOptions['oneDrive']) {
151
+ $filteredStatuses[] = $currentOptions['oneDrive'];
152
+ }
153
+ if ($currentOptions['pCloud']) {
154
+ $filteredStatuses[] = $currentOptions['pCloud'];
155
+ }
156
+ if ($currentOptions['box']) {
157
+ $filteredStatuses[] = $currentOptions['box'];
158
+ }
159
+ if ($currentOptions['backupGuard']) {
160
+ $filteredStatuses[] = $currentOptions['backupGuard'];
161
+ }
162
+ }
163
+
164
+ return $filteredStatuses;
165
+ }
166
+
167
+ function backupGuardActiveOptionToType($activeOption)
168
+ {
169
+ $activeOptions = array();
170
+ $activeOption = json_decode($activeOption, true);
171
+ $activeOptions['backupDatabase'] = !empty($activeOption['SG_ACTION_BACKUP_DATABASE_AVAILABLE']) ? SG_ACTION_STATUS_IN_PROGRESS_DB : 0;
172
+ $activeOptions['backupFiles'] = !empty($activeOption['SG_ACTION_BACKUP_FILES_AVAILABLE']) ? SG_ACTION_STATUS_IN_PROGRESS_FILES : 0;
173
+
174
+ $storages = explode(',', @$activeOption['SG_BACKUP_UPLOAD_TO_STORAGES']);
175
+ $activeOptions['ftp'] = 0;
176
+ $activeOptions['dropbox'] = 0;
177
+ $activeOptions['gdrive'] = 0;
178
+ $activeOptions['amazon'] = 0;
179
+ $activeOptions['oneDrive'] = 0;
180
+ $activeOptions['pCloud'] = 0;
181
+ $activeOptions['box'] = 0;
182
+ $activeOptions['backupGuard'] = 0;
183
+ foreach ($storages as $storage) {
184
+ switch ($storage) {
185
+ case SG_STORAGE_FTP:
186
+ $activeOptions['ftp'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_FTP;
187
+ break;
188
+ case SG_STORAGE_DROPBOX:
189
+ $activeOptions['dropbox'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_DROPBOX;
190
+ break;
191
+ case SG_STORAGE_GOOGLE_DRIVE:
192
+ $activeOptions['gdrive'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_GOOGLE_DRIVE;
193
+ break;
194
+ case SG_STORAGE_AMAZON:
195
+ $activeOptions['amazon'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_AMAZON;
196
+ break;
197
+ case SG_STORAGE_ONE_DRIVE:
198
+ $activeOptions['oneDrive'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_ONE_DRIVE;
199
+ break;
200
+ case SG_STORAGE_P_CLOUD:
201
+ $activeOptions['pCloud'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_P_CLOUD;
202
+ break;
203
+ case SG_STORAGE_BOX:
204
+ $activeOptions['box'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_BOX;
205
+ break;
206
+ case SG_STORAGE_BACKUP_GUARD:
207
+ $activeOptions['backupGuard'] = SG_ACTION_TYPE_UPLOAD . SG_STORAGE_BACKUP_GUARD;
208
+ break;
209
+ }
210
+ }
211
+
212
+ return $activeOptions;
213
+ }
214
+
215
+ function backupGuardConvertToBytes($from)
216
+ {
217
+ $number = substr($from, 0, -2);
218
+ switch (strtoupper(substr($from, -2))) {
219
+ case "KB":
220
+ return $number * 1024;
221
+ case "MB":
222
+ return $number * pow(1024, 2);
223
+ case "GB":
224
+ return $number * pow(1024, 3);
225
+ case "TB":
226
+ return $number * pow(1024, 4);
227
+ case "PB":
228
+ return $number * pow(1024, 5);
229
+ default:
230
+ return $from;
231
+ }
232
+ }
233
+
234
+ function backupGuardGetRunningActions()
235
+ {
236
+ $runningActions = SGBackup::getRunningActions();
237
+ $isAnyActiveActions = count($runningActions);
238
+ if ($isAnyActiveActions) {
239
+ return $runningActions;
240
+ }
241
+
242
+ return false;
243
+ }
244
+
245
+ function backupGuardShouldUpdate()
246
+ {
247
+ $currentVersion = SG_BACKUP_GUARD_VERSION;
248
+ $oldVersion = SGConfig::get('SG_BACKUP_GUARD_VERSION', true);
249
+
250
+ if (!$oldVersion) {
251
+ return true;
252
+ }
253
+
254
+ if ($currentVersion !== $oldVersion) {
255
+ SGConfig::set('SG_BACKUP_GUARD_VERSION', $currentVersion, true);
256
+ SGConfig::set('SG_HIDE_DISCOUNT_NOTICE', '0', true);
257
+ SGBoot::didUpdatePluginVersion();
258
+
259
+ return SG_FORCE_DB_TABLES_RESET;
260
+ }
261
+
262
+ if (!checkAllMissedTables()) {
263
+ return true;
264
+ }
265
+
266
+ return false;
267
+ }
268
+
269
+ function backupGuardGetDatabaseEngine()
270
+ {
271
+ global $wpdb;
272
+ $dbName = $wpdb->dbname;
273
+ $engine = 'InnoDB';
274
+ $engineCheckSql = "SELECT ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA = '$dbName'";
275
+ $result = $wpdb->get_results($engineCheckSql, ARRAY_A);
276
+ if (!empty($result)) {
277
+ $engineCheckSql = "SHOW TABLE STATUS WHERE Name = '" . $wpdb->prefix . "users' AND Engine = 'MyISAM'";
278
+ $result = $wpdb->get_results($engineCheckSql, ARRAY_A);
279
+ if (isset($result[0]['Engine']) && $result[0]['Engine'] == 'MyISAM') {
280
+ $engine = 'MyISAM';
281
+ }
282
+ }
283
+
284
+ return $engine;
285
+ }
286
+
287
+ function backupGuardShouldActivateExtension($extension)
288
+ {
289
+ $extensionAdapter = SGExtension::getInstance();
290
+
291
+ if (!$extensionAdapter->isExtensionAvailable($extension) || SGConfig::get($extension) || !$extensionAdapter->isExtensionAlreadyInPluginsFolder($extension) || $extensionAdapter->isExtensionActive($extension)) {
292
+ return false;
293
+ }
294
+
295
+ return true;
296
+ }
297
+
298
+ function backupGuardShouldInstallExtension($extension)
299
+ {
300
+ $extensionAdapter = SGExtension::getInstance();
301
+
302
+ if (!$extensionAdapter->isExtensionAvailable($extension) || SGConfig::get($extension) || $extensionAdapter->isExtensionAlreadyInPluginsFolder($extension) || $extensionAdapter->isExtensionActive($extension)) {
303
+ return false;
304
+ }
305
+
306
+ return true;
307
+ }
308
+
309
+ function backupGuardLoggedMessage()
310
+ {
311
+ $pluginCapabilities = backupGuardGetCapabilities();
312
+ if ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_FREE) {
313
+ return '';
314
+ }
315
+
316
+ $user = SGConfig::get('SG_LOGGED_USER');
317
+ if (!$user) {
318
+ return '';
319
+ }
320
+
321
+ $user = unserialize($user);
322
+ if (!$user || empty($user['firstname'])) {
323
+ return '';
324
+ }
325
+
326
+ $html = '<span class="bg-logged-msg-container">';
327
+ $html .= 'Package: ' . backupGuardGetProductName() . ' | Version: ' . SG_BACKUP_GUARD_VERSION;
328
+ $html .= ' | Welcome, <b>' . $user['firstname'] . '</b>! ';
329
+ $html .= '(<a href="javascript:void(0)" onclick="sgBackup.logout()">Log Out</a>)</span>';
330
+
331
+ return $html;
332
+ }
333
+
334
+ function modifyCronJobsByTimezone()
335
+ {
336
+ $allSchedules = SGBackupSchedule::getAllSchedules(false);
337
+
338
+ foreach ($allSchedules as $schedule) {
339
+ $id = $schedule['id'];
340
+ $cronTab = json_decode($schedule['schedule_options'], true);
341
+ $cronOptions = json_decode($schedule['backup_options'], true);
342
+ $cronLabel = $schedule['label'];
343
+
344
+ SGBackupSchedule::create($cronTab, $cronOptions, $cronLabel);
345
+ SGBackupSchedule::remove($id);
346
+ }
347
+ }
348
+
349
+ if (!function_exists('dd')) {
350
+ function dd()
351
+ {
352
+ $args = func_get_args();
353
+
354
+ foreach ($args as $arg) {
355
+ ob_start();
356
+ print_r($arg);
357
+ $output = ob_get_clean();
358
+
359
+ // Add formatting
360
+ $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);
361
+ $output = '<pre style="background: #FFFEEF; color: #000; border: 1px dashed #888; padding: 10px; margin: 10px 0; text-align: left;">' . $output . '</pre>';
362
+
363
+ echo $output;
364
+ }
365
+
366
+ exit;
367
+ }
368
+ }
public/include/header-new.php CHANGED
@@ -1,4 +1,7 @@
1
- <?php SGNotice::getInstance()->renderAll(); ?>
 
 
 
2
  <div class="sg-spinner"></div>
3
  <div class="bg-container">
4
- <div id="bg-wrapper">
1
+ <?php
2
+
3
+ SGNotice::getInstance()->renderAll();
4
+ ?>
5
  <div class="sg-spinner"></div>
6
  <div class="bg-container">
7
+ <div id="bg-wrapper">
public/include/header.php CHANGED
@@ -1,16 +1,16 @@
1
- <?php
2
-
3
- $isAdsEnabled = SGConfig::get('SG_DISABLE_ADS');
4
- $closeFreeBanner = SGConfig::get('SG_CLOSE_FREE_BANNER');
5
- $pluginCapabilities = backupGuardGetCapabilities();
6
-
7
- if (!$isAdsEnabled && !$closeFreeBanner) {
8
- include_once(SG_NOTICE_TEMPLATES_PATH . 'banner.php');
9
- }
10
-
11
- SGNotice::getInstance()->renderAll();
12
- ?>
13
-
14
- <div class="sg-spinner"></div>
15
- <div class="sg-wrapper-less">
16
- <div id="sg-wrapper">
1
+ <?php
2
+
3
+ $isAdsEnabled = SGConfig::get('SG_DISABLE_ADS');
4
+ $closeFreeBanner = SGConfig::get('SG_CLOSE_FREE_BANNER');
5
+ $pluginCapabilities = backupGuardGetCapabilities();
6
+
7
+ if (!$isAdsEnabled && !$closeFreeBanner) {
8
+ include_once(SG_NOTICE_TEMPLATES_PATH . 'banner.php');
9
+ }
10
+
11
+ SGNotice::getInstance()->renderAll();
12
+ ?>
13
+
14
+ <div class="sg-spinner"></div>
15
+ <div class="sg-wrapper-less">
16
+ <div id="sg-wrapper">
public/include/sidebar.php CHANGED
@@ -1,124 +1,130 @@
1
- <?php
2
- $extensionAdapter = SGExtension::getInstance();
3
- $page = $_GET['page'];
4
-
5
- $isDisabelAdsEnabled = SGConfig::get('SG_DISABLE_ADS');
6
- $showUpgradeButton = SGBoot::isFeatureAvailable('SHOW_UPGRADE_PAGE');
7
- $buttonText = 'Buy now!';
8
- $upgradeText = 'Website migration, Backup to cloud, automation, mail notifications, and more in our PRO package!';
9
- $buttonUrl = SG_BACKUP_SITE_URL;
10
-
11
- $pluginCapabilities = backupGuardGetCapabilities();
12
-
13
- if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE) {
14
- $buttonText = 'Upgrade to ';
15
- $buttonUrl = SG_BACKUP_PRODUCTS_URL;
16
-
17
- $upgradeTo = "";
18
- if ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_GOLD) {
19
- $upgradeTo = 'Platinum';
20
- } elseif ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_SILVER) {
21
- $upgradeTo = 'Gold';
22
- }
23
-
24
- $upgradeText = $buttonText . $upgradeTo . ' by paying only difference between plans.';
25
- $buttonText = $buttonText . $upgradeTo;
26
- }
27
-
28
- $supportUrl = network_admin_url('admin.php?page=backup_guard_support');
29
- $openContent = 1;
30
- if ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_FREE) {
31
- $openContent = 0;
32
- $supportUrl = BACKUP_GUARD_WORDPRESS_SUPPORT_URL;
33
- }
34
- ?>
35
- <div id="sg-sidebar-wrapper" class="metro">
36
- <a class="sg-site-url" href="<?php echo network_admin_url('admin.php?page=backup_guard_backups'); ?>">
37
- <div class="title">
38
- <span class="sg-action-menu-arrow"></span>
39
- </div>
40
- </a>
41
- <nav class="sidebar dark sg-backup-sidebar-nav" id="sg-main-sidebar">
42
- <ul>
43
- <li class="<?php echo strpos($page, 'backups') ? 'active' : ''?>">
44
- <a href="<?php echo network_admin_url('admin.php?page=backup_guard_backups'); ?>" data-page-key="backups">
45
- <span class="glyphicon glyphicon-hdd"></span><?php _backupGuardT('Backups')?>
46
- </a>
47
- <span class="sg-action-menu-arrow"></span>
48
- </li>
49
- <li class="<?php echo strpos($page, 'cloud') ? 'active' : ''?>">
50
- <a href="<?php echo network_admin_url('admin.php?page=backup_guard_cloud'); ?>" data-page-key="cloud">
51
- <span class="glyphicon glyphicon-cloud" aria-hidden="true"></span><?php _backupGuardT('Cloud')?>
52
- </a>
53
- <span class="sg-action-menu-arrow"></span>
54
- </li>
55
- <?php if (SGBoot::isFeatureAvailable('SCHEDULE')) :?>
56
- <li class="<?php echo strpos($page, 'schedule') ? 'active' : ''?>">
57
- <a href="<?php echo network_admin_url('admin.php?page=backup_guard_schedule'); ?>" data-page-key="schedule">
58
- <span class="glyphicon glyphicon-time" aria-hidden="true"></span><?php _backupGuardT('Schedule')?>
59
- </a>
60
- <span class="sg-action-menu-arrow"></span>
61
- </li>
62
- <?php endif;?>
63
- <li class="<?php echo strpos($page, 'settings') ? 'active' : ''?>">
64
- <a href="<?php echo network_admin_url('admin.php?page=backup_guard_settings'); ?>" data-page-key="settings">
65
- <span class="glyphicon glyphicon-cog" aria-hidden="true"></span><?php _backupGuardT('Settings')?>
66
- </a>
67
- <span class="sg-action-menu-arrow"></span>
68
- </li>
69
- <li class="<?php echo strpos($page, 'system_info') ? 'active' : ''?>">
70
- <a href="<?php echo network_admin_url('admin.php?page=backup_guard_system_info'); ?>" data-page-key="system_info">
71
- <span class="glyphicon glyphicon-equalizer" aria-hidden="true"></span><?php _backupGuardT('System Info.')?>
72
- </a>
73
- <span class="sg-action-menu-arrow"></span>
74
- </li>
75
- <!--<li class="<?php /*echo strpos($page, 'services') ? 'active' : ''*/?>">
76
- <a href="<?php /*echo network_admin_url('admin.php?page=backup_guard_services'); */?>" data-page-key="services">
77
- <span class="glyphicon glyphicon-briefcase" aria-hidden="true"></span><?php /*_backupGuardT('Services')*/?>
78
- </a>
79
- <span class="sg-action-menu-arrow"></span>
80
- </li>-->
81
- <li class="<?php echo strpos($page, 'videoTutorials') ? 'active' : ''?>">
82
- <a href="<?php echo $supportUrl; ?>" data-page-key="videoTutorials">
83
- <span class="sg-backup-menu-video" aria-hidden="true"></span><?php _backupGuardT('Video Tutorials')?>
84
- </a>
85
- <span class="sg-action-menu-arrow"></span>
86
- </li>
87
- <li class="<?php echo strpos($page, 'support') ? 'active' : ''?>">
88
- <a href="<?php echo $supportUrl; ?>" data-page-key="support" data-open-content="<?php echo $openContent; ?>">
89
- <span class="glyphicon glyphicon-envelope" aria-hidden="true"></span><?php _backupGuardT('Support')?>
90
- </a>
91
- <span class="sg-action-menu-arrow"></span>
92
- </li>
93
- <?php if (SGBoot::isFeatureAvailable('SHOW_UPGRADE_PAGE')) :?>
94
- <li class="<?php echo strpos($page, 'pro_features') ? 'active' : ''?>">
95
- <a href="<?php echo network_admin_url('admin.php?page=backup_guard_pro_features'); ?>" data-page-key="pro_features">
96
- <span class="glyphicon glyphicon-refresh" aria-hidden="true"></span><?php _backupGuardT('Why upgrade?')?>
97
- </a>
98
- <span class="sg-action-menu-arrow"></span>
99
- </li>
100
- <?php endif; ?>
101
- <!-- Will be added in the future release -->
102
- <!-- <?php if ($extensionAdapter->isExtensionActive(SG_BACKUP_GUARD_SECURITY_EXTENSION)) :?>
103
- <li class="<?php echo strpos($page, 'security') ? 'active' : ''?>">
104
- <a href="<?php echo network_admin_url('admin.php?page=backup_guard_security'); ?>">
105
- <span class="glyphicon glyphicon-lock" aria-hidden="true"></span>Security
106
- <span class="badge badge-info">New</span>
107
- </a>
108
- </li>
109
- <?php endif; ?> -->
110
- </ul>
111
- </nav>
112
- <?php if ($showUpgradeButton && !$isDisabelAdsEnabled) :?>
113
- <div class="sg-alert-pro">
114
- <p class="sg-upgrade-text">
115
- <?php _backupGuardT($upgradeText); ?>
116
- </p>
117
- <p>
118
- <a class="btn btn-success" target="_blank" href="<?php echo $buttonUrl . '?utm_source=plugin&utm_medium=Left_cta&utm_campaign=BuyNow_plugin'; ?>">
119
- <?php _backupGuardT($buttonText); ?>
120
- </a>
121
- </p>
122
- </div>
123
- <?php endif; ?>
124
- </div>
 
 
 
 
 
 
1
+ <?php
2
+ $extensionAdapter = SGExtension::getInstance();
3
+ $page = $_GET['page'];
4
+
5
+ $isDisabelAdsEnabled = SGConfig::get('SG_DISABLE_ADS');
6
+ $showUpgradeButton = SGBoot::isFeatureAvailable('SHOW_UPGRADE_PAGE');
7
+ $buttonText = 'Buy now!';
8
+ $upgradeText = 'Website migration, Backup to cloud, automation, mail notifications, and more in our PRO package!';
9
+ $buttonUrl = SG_BACKUP_SITE_URL;
10
+
11
+ $pluginCapabilities = backupGuardGetCapabilities();
12
+
13
+ if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE) {
14
+ $buttonText = 'Upgrade to ';
15
+ $buttonUrl = SG_BACKUP_PRODUCTS_URL;
16
+
17
+ $upgradeTo = "";
18
+ if ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_GOLD) {
19
+ $upgradeTo = 'Platinum';
20
+ } elseif ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_SILVER) {
21
+ $upgradeTo = 'Gold';
22
+ }
23
+
24
+ $upgradeText = $buttonText . $upgradeTo . ' by paying only difference between plans.';
25
+ $buttonText = $buttonText . $upgradeTo;
26
+ }
27
+
28
+ $supportUrl = network_admin_url('admin.php?page=backup_guard_support');
29
+ $openContent = 1;
30
+ if ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_FREE) {
31
+ $openContent = 0;
32
+ $supportUrl = BACKUP_GUARD_WORDPRESS_SUPPORT_URL;
33
+ }
34
+ ?>
35
+ <div id="sg-sidebar-wrapper" class="metro">
36
+ <a class="sg-site-url" href="<?php echo network_admin_url('admin.php?page=backup_guard_backups'); ?>">
37
+ <div class="title">
38
+ <span class="sg-action-menu-arrow"></span>
39
+ </div>
40
+ </a>
41
+ <nav class="sidebar dark sg-backup-sidebar-nav" id="sg-main-sidebar">
42
+ <ul>
43
+ <li class="<?php echo strpos($page, 'backups') ? 'active' : '' ?>">
44
+ <a href="<?php echo network_admin_url('admin.php?page=backup_guard_backups'); ?>"
45
+ data-page-key="backups">
46
+ <span class="glyphicon glyphicon-hdd"></span><?php _backupGuardT('Backups') ?>
47
+ </a>
48
+ <span class="sg-action-menu-arrow"></span>
49
+ </li>
50
+ <li class="<?php echo strpos($page, 'cloud') ? 'active' : '' ?>">
51
+ <a href="<?php echo network_admin_url('admin.php?page=backup_guard_cloud'); ?>" data-page-key="cloud">
52
+ <span class="glyphicon glyphicon-cloud" aria-hidden="true"></span><?php _backupGuardT('Cloud') ?>
53
+ </a>
54
+ <span class="sg-action-menu-arrow"></span>
55
+ </li>
56
+ <?php if (SGBoot::isFeatureAvailable('SCHEDULE')) : ?>
57
+ <li class="<?php echo strpos($page, 'schedule') ? 'active' : '' ?>">
58
+ <a href="<?php echo network_admin_url('admin.php?page=backup_guard_schedule'); ?>"
59
+ data-page-key="schedule">
60
+ <span class="glyphicon glyphicon-time"
61
+ aria-hidden="true"></span><?php _backupGuardT('Schedule') ?>
62
+ </a>
63
+ <span class="sg-action-menu-arrow"></span>
64
+ </li>
65
+ <?php endif; ?>
66
+ <li class="<?php echo strpos($page, 'settings') ? 'active' : '' ?>">
67
+ <a href="<?php echo network_admin_url('admin.php?page=backup_guard_settings'); ?>"
68
+ data-page-key="settings">
69
+ <span class="glyphicon glyphicon-cog" aria-hidden="true"></span><?php _backupGuardT('Settings') ?>
70
+ </a>
71
+ <span class="sg-action-menu-arrow"></span>
72
+ </li>
73
+ <li class="<?php echo strpos($page, 'system_info') ? 'active' : '' ?>">
74
+ <a href="<?php echo network_admin_url('admin.php?page=backup_guard_system_info'); ?>"
75
+ data-page-key="system_info">
76
+ <span class="glyphicon glyphicon-equalizer"
77
+ aria-hidden="true"></span><?php _backupGuardT('System Info.') ?>
78
+ </a>
79
+ <span class="sg-action-menu-arrow"></span>
80
+ </li>
81
+ <li class="<?php echo strpos($page, 'videoTutorials') ? 'active' : '' ?>">
82
+ <a href="<?php echo esc_url($supportUrl); ?>" data-page-key="videoTutorials">
83
+ <span class="sg-backup-menu-video"
84
+ aria-hidden="true"></span><?php _backupGuardT('Video Tutorials') ?>
85
+ </a>
86
+ <span class="sg-action-menu-arrow"></span>
87
+ </li>
88
+ <li class="<?php echo strpos($page, 'support') ? 'active' : '' ?>">
89
+ <a href="<?php echo esc_url($supportUrl); ?>" data-page-key="support"
90
+ data-open-content="<?php echo esc_attr($openContent); ?>">
91
+ <span class="glyphicon glyphicon-envelope"
92
+ aria-hidden="true"></span><?php _backupGuardT('Support') ?>
93
+ </a>
94
+ <span class="sg-action-menu-arrow"></span>
95
+ </li>
96
+ <?php if (SGBoot::isFeatureAvailable('SHOW_UPGRADE_PAGE')) : ?>
97
+ <li class="<?php echo strpos($page, 'pro_features') ? 'active' : '' ?>">
98
+ <a href="<?php echo network_admin_url('admin.php?page=backup_guard_pro_features'); ?>"
99
+ data-page-key="pro_features">
100
+ <span class="glyphicon glyphicon-refresh"
101
+ aria-hidden="true"></span><?php _backupGuardT('Why upgrade?') ?>
102
+ </a>
103
+ <span class="sg-action-menu-arrow"></span>
104
+ </li>
105
+ <?php endif; ?>
106
+ <!-- Will be added in the future release -->
107
+ <!-- <?php if ($extensionAdapter->isExtensionActive(SG_BACKUP_GUARD_SECURITY_EXTENSION)) : ?>
108
+ <li class="<?php echo strpos($page, 'security') ? 'active' : '' ?>">
109
+ <a href="<?php echo network_admin_url('admin.php?page=backup_guard_security'); ?>">
110
+ <span class="glyphicon glyphicon-lock" aria-hidden="true"></span>Security
111
+ <span class="badge badge-info">New</span>
112
+ </a>
113
+ </li>
114
+ <?php endif; ?> -->
115
+ </ul>
116
+ </nav>
117
+ <?php if ($showUpgradeButton && !$isDisabelAdsEnabled) : ?>
118
+ <div class="sg-alert-pro">
119
+ <p class="sg-upgrade-text">
120
+ <?php _backupGuardT($upgradeText); ?>
121
+ </p>
122
+ <p>
123
+ <a class="btn btn-success" target="_blank"
124
+ href="<?php echo $buttonUrl . '?utm_source=plugin&utm_medium=Left_cta&utm_campaign=BuyNow_plugin'; ?>">
125
+ <?php _backupGuardT($buttonText); ?>
126
+ </a>
127
+ </p>
128
+ </div>
129
+ <?php endif; ?>
130
+ </div>
public/pagesContent.php CHANGED
@@ -1,30 +1,30 @@
1
- <?php
2
- require_once(dirname(__FILE__).'/boot.php');
3
- require_once(SG_BACKUP_PATH.'SGBackup.php');
4
- require_once(SG_PUBLIC_INCLUDE_PATH.'header.php');
5
- require_once(SG_PUBLIC_INCLUDE_PATH.'sidebar.php');
6
- $pluginCapabilities = backupGuardGetCapabilities();
7
- $pluginCapabilities = backupGuardGetCapabilities();
8
- ?>
9
- <div class="sg-top-info"><?php echo backupGuardLoggedMessage(); ?></div>
10
- <div id="sg-content-wrapper">
11
- <div class="container-fluid">
12
- <?php require_once(plugin_dir_path( __FILE__ ).'backups.php'); ?>
13
- <?php require_once(plugin_dir_path(__FILE__).'cloud.php'); ?>
14
- <?php require_once(plugin_dir_path(__FILE__).'schedule.php'); ?>
15
- <?php require_once(plugin_dir_path(__FILE__).'settings.php'); ?>
16
- <?php require_once(plugin_dir_path(__FILE__).'systemInfo.php'); ?>
17
- <?php require_once(plugin_dir_path(__FILE__).'services.php'); ?>
18
- <?php require_once(plugin_dir_path(__FILE__).'videoTutorials.php'); ?>
19
- <?php require_once(plugin_dir_path(__FILE__).'support.php'); ?>
20
- <?php
21
- if (SGBoot::isFeatureAvailable('SHOW_UPGRADE_PAGE')) {
22
- require_once(plugin_dir_path(__FILE__).'proFeatures.php');
23
- }
24
- ?>
25
- </div>
26
- </div>
27
- <div class="clearfix"></div>
28
- <?php
29
- require_once(SG_PUBLIC_INCLUDE_PATH.'/footer.php');
30
- ?>
1
+ <?php
2
+ require_once(dirname(__FILE__) . '/boot.php');
3
+ require_once(SG_BACKUP_PATH . 'SGBackup.php');
4
+ require_once(SG_PUBLIC_INCLUDE_PATH . 'header.php');
5
+ require_once(SG_PUBLIC_INCLUDE_PATH . 'sidebar.php');
6
+ $pluginCapabilities = backupGuardGetCapabilities();
7
+ $pluginCapabilities = backupGuardGetCapabilities();
8
+ ?>
9
+ <div class="sg-top-info"><?php echo backupGuardLoggedMessage(); ?></div>
10
+ <div id="sg-content-wrapper">
11
+ <div class="container-fluid">
12
+ <?php require_once(plugin_dir_path(__FILE__) . 'backups.php'); ?>
13
+ <?php require_once(plugin_dir_path(__FILE__) . 'cloud.php'); ?>
14
+ <?php require_once(plugin_dir_path(__FILE__) . 'schedule.php'); ?>
15
+ <?php require_once(plugin_dir_path(__FILE__) . 'settings.php'); ?>
16
+ <?php require_once(plugin_dir_path(__FILE__) . 'systemInfo.php'); ?>
17
+ <?php require_once(plugin_dir_path(__FILE__) . 'services.php'); ?>
18
+ <?php require_once(plugin_dir_path(__FILE__) . 'videoTutorials.php'); ?>
19
+ <?php require_once(plugin_dir_path(__FILE__) . 'support.php'); ?>
20
+ <?php
21
+ if (SGBoot::isFeatureAvailable('SHOW_UPGRADE_PAGE')) {
22
+ require_once(plugin_dir_path(__FILE__) . 'proFeatures.php');
23
+ }
24
+ ?>
25
+ </div>
26
+ </div>
27
+ <div class="clearfix"></div>
28
+ <?php
29
+ require_once(SG_PUBLIC_INCLUDE_PATH . '/footer.php');
30
+ ?>
public/proFeatures.php CHANGED
@@ -1,107 +1,110 @@
1
- <?php
2
- $contentClassName = getBackupPageContentClassName('pro_features');
3
- $optionsAvailability = array();
4
- $optionsAvailability['Website Backup & Restore'] = array('free' => 1, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
5
- $optionsAvailability['Website Migration'] = array('free' => 0, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
6
- $optionsAvailability['Backup to Dropbox (64-bit OS)'] = array('free' => 1, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
7
- $optionsAvailability['Backup Download & Import'] = array('free' => 1, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
8
- $optionsAvailability['Automatic Backups (single profile)'] = array('free' => 0, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
9
- $optionsAvailability['E-mail Notifications'] = array('free' => 0, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
10
- $optionsAvailability['Backup to SFTP/FTP'] = array('free' => 0, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
11
- /// start Gold
12
- $optionsAvailability['Backup to Google Drive'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
13
- $optionsAvailability['Backup to Amazon S3'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
14
- $optionsAvailability['Backup to OneDrive'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
15
- $optionsAvailability['Backup Retention'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
16
- $optionsAvailability['Restore from all Supported Clouds'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
17
- $optionsAvailability['Delete Local Copy after Upload'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
18
- $optionsAvailability['Customize Backup Name'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
19
- // start Platinum
20
- $optionsAvailability['Multiple Automatic Backups'] = array('free' => 0, 'silver' => 0, 'gold' => 0, 'platinum' => 1);
21
- $optionsAvailability['Multiple Automatic Backups'] = array('free' => 0, 'silver' => 0, 'gold' => 0, 'platinum' => 1);
22
- ?>
23
- <div id="sg-backup-page-content-pro_features" class="sg-backup-page-content <?php echo $contentClassName; ?>">
24
- <div><h1 class="sg-backup-page-title"><?php _backupGuardT('Why upgrade?') ?></h1></div>
25
- <div class="sg-wrap-container sg-pricing-table-wrapper">
26
- <h3 class="sg-backup-guard-plans-title"><?php _backupGuardT('BackupGuard Plans') ?></h3>
27
- <div class="sg-backup-header-row sg-backup-table-row" style="clear: both">
28
- <div class="col-sm-4 sg-pricing-table-header-first-column">
29
- <span class="sg-pricing-table-header-label"></span>
30
- </div>
31
- <div class="col-sm-2">
32
- <span class="sg-pricing-table-header-label"><?php _backupGuardT('Free'); ?></span>
33
- <span class="sg-pricing-table-blue-label"><b><?php _backupGuardT('0'); ?></b> <span
34
- class="sg-backup-pricing-currency">US$</span></span>
35
- </div>
36
- <div class="col-sm-2">
37
- <span class="sg-pricing-table-header-label"><?php _backupGuardT('Silver'); ?></span>
38
- <span class="sg-pricing-table-blue-label"><b><?php _backupGuardT('25'); ?></b> <span
39
- class="sg-backup-pricing-currency">US$</span></span>
40
- </div>
41
- <div class="col-sm-2">
42
- <span class="sg-pricing-table-header-label"><?php _backupGuardT('Gold'); ?></span>
43
- <span class="sg-pricing-table-blue-label"><b><?php _backupGuardT('39'); ?></b> <span
44
- class="sg-backup-pricing-currency">US$</span></span>
45
- </div>
46
- <div class="col-sm-2">
47
- <span class="sg-pricing-table-header-label"><?php _backupGuardT('Platinum'); ?></span>
48
- <span class="sg-pricing-table-blue-label"><b><?php _backupGuardT('99'); ?></b> <span
49
- class="sg-backup-pricing-currency">US$</span></span>
50
- </div>
51
- </div>
52
- <div class="sg-backup-table-row" style="clear: both">
53
- <div class="col-sm-4">
54
- <span class="sg-pricng-table-option"><?php _backupGuardT('Websites Licences ') ?></span>
55
- </div>
56
- <div class="col-sm-2" style="text-align: center">
57
- <span class="sg-backup-plan-excluded"></span>
58
- </div>
59
- <div class="col-sm-2" style="text-align: center">
60
- <span class="sg-pricing-table-includes"><?php _backupGuardT('Up to 2') ?></span>
61
- </div>
62
- <div class="col-sm-2" style="text-align: center">
63
- <span class="sg-pricing-table-includes"><?php _backupGuardT('Up to 5') ?></span>
64
- </div>
65
- <div class="col-sm-2" style="text-align: center">
66
- <span class="sg-pricing-table-includes"><?php _backupGuardT('Unlimited') ?></span>
67
- </div>
68
- </div>
69
- <div class="sg-backup-table-options-wrapper" >
70
- <?php foreach ($optionsAvailability as $label => $availability) :?>
71
- <div class="sg-backup-table-row" style="clear: both">
72
- <div class="col-sm-4 sg-pricing-table-option-wrapper">
73
- <span class="sg-pricing-table-option"><?php _backupGuardT($label); ?></span>
74
- </div>
75
- <div class="col-sm-2">
76
- <?php if ($availability['free'] == 1) : ?>
77
- <span class="sg-backup-plan-included"></span>
78
- <?php else : ?>
79
- <span class="sg-backup-plan-excluded"></span>
80
- <?php endif; ?>
81
- </div>
82
- <div class="col-sm-2">
83
- <?php if ($availability['silver'] == 1) : ?>
84
- <span class="sg-backup-plan-included"></span>
85
- <?php else : ?>
86
- <span class="sg-backup-plan-excluded"></span>
87
- <?php endif; ?>
88
- </div>
89
- <div class="col-sm-2">
90
- <?php if ($availability['gold'] == 1) : ?>
91
- <span class="sg-backup-plan-included"></span>
92
- <?php else : ?>
93
- <span class="sg-backup-plan-excluded"></span>
94
- <?php endif; ?>
95
- </div>
96
- <div class="col-sm-2">
97
- <?php if ($availability['platinum'] == 1) : ?>
98
- <span class="sg-backup-plan-included"></span>
99
- <?php else : ?>
100
- <span class="sg-backup-plan-excluded"></span>
101
- <?php endif; ?>
102
- </div>
103
- </div>
104
- <?php endforeach; ?>
105
- </div>
106
- </div>
107
- </div>
 
 
 
1
+ <?php
2
+ $contentClassName = getBackupPageContentClassName('pro_features');
3
+ $optionsAvailability = array();
4
+ $optionsAvailability['Website Backup & Restore'] = array('free' => 1, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
5
+ $optionsAvailability['Website Migration'] = array('free' => 0, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
6
+ $optionsAvailability['Backup to Dropbox (64-bit OS)'] = array('free' => 1, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
7
+ $optionsAvailability['Backup Download & Import'] = array('free' => 1, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
8
+ $optionsAvailability['Automatic Backups (single profile)'] = array('free' => 0, 'silver' => 1, 'gold' => 1,
9
+ 'platinum' => 1);
10
+ $optionsAvailability['E-mail Notifications'] = array('free' => 0, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
11
+ $optionsAvailability['Backup to SFTP/FTP'] = array('free' => 0, 'silver' => 1, 'gold' => 1, 'platinum' => 1);
12
+ /// start Gold
13
+ $optionsAvailability['Backup to Google Drive'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
14
+ $optionsAvailability['Backup to Amazon S3'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
15
+ $optionsAvailability['Backup to OneDrive'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
16
+ $optionsAvailability['Backup Retention'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
17
+ $optionsAvailability['Restore from all Supported Clouds'] = array('free' => 0, 'silver' => 0, 'gold' => 1,
18
+ 'platinum' => 1);
19
+ $optionsAvailability['Delete Local Copy after Upload'] = array('free' => 0, 'silver' => 0, 'gold' => 1,
20
+ 'platinum' => 1);
21
+ $optionsAvailability['Customize Backup Name'] = array('free' => 0, 'silver' => 0, 'gold' => 1, 'platinum' => 1);
22
+ // start Platinum
23
+ $optionsAvailability['Multiple Automatic Backups'] = array('free' => 0, 'silver' => 0, 'gold' => 0, 'platinum' => 1);
24
+ $optionsAvailability['Multiple Automatic Backups'] = array('free' => 0, 'silver' => 0, 'gold' => 0, 'platinum' => 1);
25
+ ?>
26
+ <div id="sg-backup-page-content-pro_features" class="sg-backup-page-content <?php echo $contentClassName; ?>">
27
+ <div><h1 class="sg-backup-page-title"><?php _backupGuardT('Why upgrade?') ?></h1></div>
28
+ <div class="sg-wrap-container sg-pricing-table-wrapper">
29
+ <h3 class="sg-backup-guard-plans-title"><?php _backupGuardT('BackupGuard Plans') ?></h3>
30
+ <div class="sg-backup-header-row sg-backup-table-row" style="clear: both">
31
+ <div class="col-sm-4 sg-pricing-table-header-first-column">
32
+ <span class="sg-pricing-table-header-label"></span>
33
+ </div>
34
+ <div class="col-sm-2">
35
+ <span class="sg-pricing-table-header-label"><?php _backupGuardT('Free'); ?></span>
36
+ <span class="sg-pricing-table-blue-label"><b><?php _backupGuardT('0'); ?></b> <span
37
+ class="sg-backup-pricing-currency">US$</span></span>
38
+ </div>
39
+ <div class="col-sm-2">
40
+ <span class="sg-pricing-table-header-label"><?php _backupGuardT('Silver'); ?></span>
41
+ <span class="sg-pricing-table-blue-label"><b><?php _backupGuardT('25'); ?></b> <span
42
+ class="sg-backup-pricing-currency">US$</span></span>
43
+ </div>
44
+ <div class="col-sm-2">
45
+ <span class="sg-pricing-table-header-label"><?php _backupGuardT('Gold'); ?></span>
46
+ <span class="sg-pricing-table-blue-label"><b><?php _backupGuardT('39'); ?></b> <span
47
+ class="sg-backup-pricing-currency">US$</span></span>
48
+ </div>
49
+ <div class="col-sm-2">
50
+ <span class="sg-pricing-table-header-label"><?php _backupGuardT('Platinum'); ?></span>
51
+ <span class="sg-pricing-table-blue-label"><b><?php _backupGuardT('99'); ?></b> <span
52
+ class="sg-backup-pricing-currency">US$</span></span>
53
+ </div>
54
+ </div>
55
+ <div class="sg-backup-table-row" style="clear: both">
56
+ <div class="col-sm-4">
57
+ <span class="sg-pricng-table-option"><?php _backupGuardT('Websites Licences ') ?></span>
58
+ </div>
59
+ <div class="col-sm-2" style="text-align: center">
60
+ <span class="sg-backup-plan-excluded"></span>
61
+ </div>
62
+ <div class="col-sm-2" style="text-align: center">
63
+ <span class="sg-pricing-table-includes"><?php _backupGuardT('Up to 2') ?></span>
64
+ </div>
65
+ <div class="col-sm-2" style="text-align: center">
66
+ <span class="sg-pricing-table-includes"><?php _backupGuardT('Up to 5') ?></span>
67
+ </div>
68
+ <div class="col-sm-2" style="text-align: center">
69
+ <span class="sg-pricing-table-includes"><?php _backupGuardT('Unlimited') ?></span>
70
+ </div>
71
+ </div>
72
+ <div class="sg-backup-table-options-wrapper">
73
+ <?php foreach ($optionsAvailability as $label => $availability) : ?>
74
+ <div class="sg-backup-table-row" style="clear: both">
75
+ <div class="col-sm-4 sg-pricing-table-option-wrapper">
76
+ <span class="sg-pricing-table-option"><?php _backupGuardT($label); ?></span>
77
+ </div>
78
+ <div class="col-sm-2">
79
+ <?php if ($availability['free'] == 1) : ?>
80
+ <span class="sg-backup-plan-included"></span>
81
+ <?php else : ?>
82
+ <span class="sg-backup-plan-excluded"></span>
83
+ <?php endif; ?>
84
+ </div>
85
+ <div class="col-sm-2">
86
+ <?php if ($availability['silver'] == 1) : ?>
87
+ <span class="sg-backup-plan-included"></span>
88
+ <?php else : ?>
89
+ <span class="sg-backup-plan-excluded"></span>
90
+ <?php endif; ?>
91
+ </div>
92
+ <div class="col-sm-2">
93
+ <?php if ($availability['gold'] == 1) : ?>
94
+ <span class="sg-backup-plan-included"></span>
95
+ <?php else : ?>
96
+ <span class="sg-backup-plan-excluded"></span>
97
+ <?php endif; ?>
98
+ </div>
99
+ <div class="col-sm-2">
100
+ <?php if ($availability['platinum'] == 1) : ?>
101
+ <span class="sg-backup-plan-included"></span>
102
+ <?php else : ?>
103
+ <span class="sg-backup-plan-excluded"></span>
104
+ <?php endif; ?>
105
+ </div>
106
+ </div>
107
+ <?php endforeach; ?>
108
+ </div>
109
+ </div>
110
+ </div>
public/restore_wordpress.php CHANGED
@@ -1,299 +1,299 @@
1
- <?php
2
- #SG_DYNAMIC_DEFINES#
3
-
4
- //validate key
5
- if (@$_GET['k'] != BG_RESTORE_KEY) {
6
- die('Invalid key');
7
- }
8
-
9
- // define('WP_CONTENT_DIR', ABSPATH.'wp-content');
10
- define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
11
- define('SG_APP_ROOT_DIRECTORY', dirname(WP_CONTENT_DIR) . "/");
12
- define('SG_ENV_WORDPRESS', 'Wordpress');
13
- define('SG_ENV_ADAPTER', SG_ENV_WORDPRESS);
14
- define('SG_DB_ADAPTER', SG_ENV_ADAPTER);
15
- define('WP_DEBUG', false);
16
- define('WP_DEBUG_DISPLAY', false);
17
- define('BG_EXTERNAL_RESTORE_RUNNING', true);
18
-
19
- error_reporting(0);
20
- ini_set('display_errors', 0);
21
-
22
- //check if BackupGuard plugin exists
23
- $pluginPath = WP_PLUGIN_DIR . '/' . SG_PLUGIN_NAME . '/com/config/';
24
- if (!file_exists($pluginPath . 'config.php')) {
25
- die('Plugin not found');
26
- }
27
-
28
- $action = @$_GET['action'];
29
-
30
- function maintenanceMode($active = false)
31
- {
32
- if ($active) {
33
- file_put_contents(ABSPATH . '.maintenance', '<?php $upgrading = ' . time() . '; ?>');
34
- } else {
35
- unlink(ABSPATH . '.maintenance');
36
- }
37
- }
38
-
39
- if ($action == 'finalize') { //finalize action needs WordPress functions to work
40
- maintenanceMode(false);
41
-
42
- include_once ABSPATH . 'wp-load.php';
43
- include_once ABSPATH . 'wp-admin/includes/plugin.php';
44
- $action = 'finalize'; //for some reason $action gets reseted to null
45
-
46
- //activate current BackupGuard plugin
47
- //because maybe it was inactive at the time when the backup was made
48
- //for example: the backup was made with the free version, the restore with pro
49
- $proPluginFile = SG_PLUGIN_NAME . '/backup-guard-pro.php';
50
- $freePluginFile = SG_PLUGIN_NAME . '/backup.php';
51
- if (file_exists(WP_PLUGIN_DIR . '/' . $proPluginFile)) {
52
- activate_plugin($proPluginFile);
53
- } else if (file_exists(WP_PLUGIN_DIR . '/' . $freePluginFile)) {
54
- activate_plugin($freePluginFile);
55
- }
56
- } else {
57
- //require anything we need for only wpdb to run
58
- include_once ABSPATH . 'wp-includes/version.php';
59
- include_once ABSPATH . 'wp-includes/formatting.php';
60
- include_once ABSPATH . 'wp-includes/plugin.php';
61
- include_once ABSPATH . 'wp-includes/class-wp-error.php';
62
-
63
- //starting from WordPress 4.7.1 is_wp_error() has been moved to another location
64
- //wpdb needs it, so we create it here
65
- if (!function_exists('is_wp_error')) {
66
- function is_wp_error($thing)
67
- {
68
- return ($thing instanceof WP_Error);
69
- }
70
- }
71
-
72
- include_once ABSPATH . 'wp-includes/wp-db.php';
73
- global $wpdb;
74
- $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
75
- $wpdb->db_connect();
76
-
77
- maintenanceMode(true);
78
- }
79
-
80
- //the mysql version is needed for the charset handler
81
- if (!defined('SG_MYSQL_VERSION')) {
82
- define('SG_MYSQL_VERSION', $wpdb->db_version());
83
- }
84
- $dbCharset = 'utf8';
85
- if (@constant("DB_CHARSET")) {
86
- $dbCharset = DB_CHARSET;
87
- }
88
- if (!defined('SG_DB_CHARSET')) {
89
- define('SG_DB_CHARSET', $dbCharset);
90
- }
91
-
92
- //require BackupGuard plugin
93
- if (file_exists($pluginPath . 'config.wordpress.pro.php')) {
94
- include_once $pluginPath . 'config.wordpress.pro.php';
95
- } else if (file_exists($pluginPath . 'config.wordpress.free.php')) {
96
- include_once $pluginPath . 'config.wordpress.free.php';
97
- }
98
- require_once $pluginPath . 'config.php';
99
- require_once SG_CORE_PATH . 'SGBoot.php';
100
-
101
- //prcoess awake action (restore)
102
- if ($action == 'awake') {
103
- include_once SG_LIB_PATH . 'SGReloader.php';
104
- SGReloader::awake();
105
- die;
106
- }
107
-
108
- //process getAction action (get restore progress)
109
- if ($action == 'getAction') {
110
- include_once SG_BACKUP_PATH . 'SGBackup.php';
111
- $currentAction = SGBackup::getAction(SG_ACTION_ID);
112
- if ($currentAction) {
113
- if (
114
- $currentAction['status'] == SG_ACTION_STATUS_CREATED
115
- || $currentAction['status'] == SG_ACTION_STATUS_IN_PROGRESS_FILES
116
- || $currentAction['status'] == SG_ACTION_STATUS_IN_PROGRESS_DB
117
- ) {
118
- if (!SGPing::ping()) {
119
- maintenanceMode(false);
120
-
121
- $backup = new SGBackup();
122
- $backup->handleExecutionTimeout(SG_ACTION_ID);
123
- $currentAction = SGBackup::getAction(SG_ACTION_ID);
124
- }
125
- die(json_encode($currentAction));
126
- } else if (
127
- $currentAction['status'] == SG_ACTION_STATUS_FINISHED
128
- || $currentAction['status'] == SG_ACTION_STATUS_FINISHED_WARNINGS
129
- ) {
130
- die('1');
131
- }
132
- die('0');
133
- }
134
- die('0');
135
- }
136
-
137
- //finalize restoration
138
- if ($action == 'finalize') {
139
- include_once SG_BACKUP_PATH . 'SGBackup.php';
140
- $backup = new SGBackup();
141
- $backup->finalizeExternalRestore(SG_ACTION_ID);
142
- die;
143
- }
144
- ?>
145
- <!DOCTYPE html>
146
- <html>
147
- <head>
148
- <link rel="stylesheet" type="text/css" href="<?php echo SG_PUBLIC_URL; ?>css/spinner.css">
149
- <link rel="stylesheet" type="text/css" href="<?php echo SG_PUBLIC_URL; ?>css/bgstyle.less.css">
150
- <link rel="stylesheet" type="text/css" href="<?php echo SG_PUBLIC_URL; ?>css/main.css">
151
- <style>
152
- body {
153
- background-color: #fff;
154
- padding: 0;
155
- margin: 0;
156
- }
157
-
158
- .sg-box-center {
159
- width: 400px;
160
- position: absolute;
161
- left: 50%;
162
- margin-left: -200px;
163
- margin-top: 100px;
164
- border: 1px solid #5c5c5c;
165
- }
166
-
167
- .sg-logo {
168
- text-align: center;
169
- padding: 20px 0;
170
- background-color: #0021C8;
171
- }
172
-
173
- .sg-wrapper-less .sg-progress {
174
- height: 4px;
175
- margin: 1px 0 0;
176
- }
177
-
178
- .sg-progress-box p {
179
- margin-top: 10px;
180
- text-align: center;
181
- }
182
-
183
- .restore-warning {
184
- color: #C20000;
185
- }
186
-
187
- .restore-progress-p {
188
- font-size: 21px;
189
- font-weight: bold;
190
- }
191
- </style>
192
- </head>
193
- <body>
194
- <div class="sg-wrapper-less">
195
- <div class="sg-wrapper">
196
- <div class="sg-box-center">
197
- <div class="sg-logo">
198
- <img width="172px" src="<?php echo SG_PUBLIC_URL; ?>img/sglogo.png">
199
- </div>
200
- <div class="sg-progress-box">
201
- <p class="restore-progress-p">Restoring <span id="progressItem">files</span>: <span
202
- id="progressTxt">0%</span></p>
203
- <p class="restore-warning"><small>NOTE: Please don't close your browser until finished.</small></p>
204
- <div class="sg-progress progress">
205
- <div id="progressBar" class="progress-bar" style="width: 0%;"></div>
206
- </div>
207
- </div>
208
- </div>
209
- </div>
210
- </div>
211
- <script>
212
- function bgRunAjax(url, responseHandler, params) {
213
- var req;
214
- if (window.XMLHttpRequest) {
215
- req = new XMLHttpRequest();
216
- } else if (window.ActiveXObject) {
217
- req = new ActiveXObject("Microsoft.XMLHTTP");
218
- }
219
- req.onreadystatechange = function () {
220
- if (req.readyState == 4) {
221
- if (req.status < 400) {
222
- responseHandler(req, params);
223
- }
224
- }
225
- };
226
- req.open("POST", url, true);
227
- req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
228
- req.send(params);
229
- }
230
-
231
- function bgUpdateProgress(progress) {
232
- var progressInPercents = progress + '%';
233
- var progressBar = document.getElementById('progressBar');
234
- progressBar.style.width = progressInPercents;
235
- var progressTxt = document.getElementById('progressTxt');
236
- progressTxt.innerHTML = progressInPercents;
237
- }
238
-
239
- var awakeRunning = false;
240
-
241
- function awake() {
242
- if (awakeRunning) return;
243
- awakeRunning = true;
244
- bgRunAjax("<?php echo BG_RESTORE_URL; ?>&action=awake", function () {
245
- awakeRunning = false;
246
- }, "");
247
- }
248
-
249
- var getActionRunning = false;
250
-
251
- function getAction() {
252
- if (getActionRunning) return;
253
- getActionRunning = true;
254
- bgRunAjax("<?php echo BG_RESTORE_URL; ?>&action=getAction", function (response) {
255
- try {
256
- var response = eval('(' + response.responseText + ')');
257
- if (response === 1) {
258
- clearInterval(getActionTimer);
259
- clearInterval(awakeTimer);
260
- bgRunAjax("<?php echo BG_RESTORE_URL; ?>&action=finalize", function (response) {
261
- bgUpdateProgress(100);
262
- location.href = '<?php echo BG_PLUGIN_URL; ?>';
263
- }, "");
264
- return;
265
- } else if (response === 0) {
266
- clearInterval(getActionTimer);
267
- clearInterval(awakeTimer);
268
- bgUpdateProgress(100);
269
- location.href = '<?php echo BG_PLUGIN_URL; ?>';
270
- return;
271
- } else if (typeof response === 'object') {
272
- bgUpdateProgress(response.progress);
273
- if (response.status ==<?php echo SG_ACTION_STATUS_IN_PROGRESS_FILES; ?>) {
274
- progressItem.innerHTML = 'files';
275
- } else {
276
- progressItem.innerHTML = 'database';
277
- }
278
- }
279
- } catch (e) {
280
- }
281
-
282
- getActionRunning = false;
283
- }, "");
284
- }
285
-
286
- //awake
287
- var awakeTimer = setInterval(function () {
288
- awake();
289
- }, 3000);
290
- awake();
291
-
292
- //get action (for progress)
293
- var getActionTimer = setInterval(function () {
294
- getAction();
295
- }, 4000);
296
- getAction();
297
- </script>
298
- </body>
299
- </html>
1
+ <?php
2
+ #SG_DYNAMIC_DEFINES#
3
+
4
+ //validate key
5
+ if (@$_GET['k'] != BG_RESTORE_KEY) {
6
+ die('Invalid key');
7
+ }
8
+
9
+ // define('WP_CONTENT_DIR', ABSPATH.'wp-content');
10
+ define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
11
+ define('SG_APP_ROOT_DIRECTORY', dirname(WP_CONTENT_DIR) . "/");
12
+ define('SG_ENV_WORDPRESS', 'Wordpress');
13
+ define('SG_ENV_ADAPTER', SG_ENV_WORDPRESS);
14
+ define('SG_DB_ADAPTER', SG_ENV_ADAPTER);
15
+ define('WP_DEBUG', false);
16
+ define('WP_DEBUG_DISPLAY', false);
17
+ define('BG_EXTERNAL_RESTORE_RUNNING', true);
18
+
19
+ error_reporting(0);
20
+ ini_set('display_errors', 0);
21
+
22
+ //check if BackupGuard plugin exists
23
+ $pluginPath = WP_PLUGIN_DIR . '/' . SG_PLUGIN_NAME . '/com/config/';
24
+ if (!file_exists($pluginPath . 'config.php')) {
25
+ die('Plugin not found');
26
+ }
27
+
28
+ $action = @$_GET['action'];
29
+
30
+ function maintenanceMode($active = false)
31
+ {
32
+ if ($active) {
33
+ file_put_contents(ABSPATH . '.maintenance', '<?php $upgrading = ' . time() . '; ?>');
34
+ } else {
35
+ unlink(ABSPATH . '.maintenance');
36
+ }
37
+ }
38
+
39
+ if ($action == 'finalize') { //finalize action needs WordPress functions to work
40
+ maintenanceMode(false);
41
+
42
+ include_once ABSPATH . 'wp-load.php';
43
+ include_once ABSPATH . 'wp-admin/includes/plugin.php';
44
+ $action = 'finalize'; //for some reason $action gets reseted to null
45
+
46
+ //activate current BackupGuard plugin
47
+ //because maybe it was inactive at the time when the backup was made
48
+ //for example: the backup was made with the free version, the restore with pro
49
+ $proPluginFile = SG_PLUGIN_NAME . '/backup-guard-pro.php';
50
+ $freePluginFile = SG_PLUGIN_NAME . '/backup.php';
51
+ if (file_exists(WP_PLUGIN_DIR . '/' . $proPluginFile)) {
52
+ activate_plugin($proPluginFile);
53
+ } else if (file_exists(WP_PLUGIN_DIR . '/' . $freePluginFile)) {
54
+ activate_plugin($freePluginFile);
55
+ }
56
+ } else {
57
+ //require anything we need for only wpdb to run
58
+ include_once ABSPATH . 'wp-includes/version.php';
59
+ include_once ABSPATH . 'wp-includes/formatting.php';
60
+ include_once ABSPATH . 'wp-includes/plugin.php';
61
+ include_once ABSPATH . 'wp-includes/class-wp-error.php';
62
+
63
+ //starting from WordPress 4.7.1 is_wp_error() has been moved to another location
64
+ //wpdb needs it, so we create it here
65
+ if (!function_exists('is_wp_error')) {
66
+ function is_wp_error($thing)
67
+ {
68
+ return ($thing instanceof WP_Error);
69
+ }
70
+ }
71
+
72
+ include_once ABSPATH . 'wp-includes/wp-db.php';
73
+ global $wpdb;
74
+ $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
75
+ $wpdb->db_connect();
76
+
77
+ maintenanceMode(true);
78
+ }
79
+
80
+ //the mysql version is needed for the charset handler
81
+ if (!defined('SG_MYSQL_VERSION')) {
82
+ define('SG_MYSQL_VERSION', $wpdb->db_version());
83
+ }
84
+ $dbCharset = 'utf8';
85
+ if (@constant("DB_CHARSET")) {
86
+ $dbCharset = DB_CHARSET;
87
+ }
88
+ if (!defined('SG_DB_CHARSET')) {
89
+ define('SG_DB_CHARSET', $dbCharset);
90
+ }
91
+
92
+ //require BackupGuard plugin
93
+ if (file_exists($pluginPath . 'config.wordpress.pro.php')) {
94
+ include_once $pluginPath . 'config.wordpress.pro.php';
95
+ } else if (file_exists($pluginPath . 'config.wordpress.free.php')) {
96
+ include_once $pluginPath . 'config.wordpress.free.php';
97
+ }
98
+ require_once $pluginPath . 'config.php';
99
+ require_once SG_CORE_PATH . 'SGBoot.php';
100
+
101
+ //prcoess awake action (restore)
102
+ if ($action == 'awake') {
103
+ include_once SG_LIB_PATH . 'SGReloader.php';
104
+ SGReloader::awake();
105
+ die;
106
+ }
107
+
108
+ //process getAction action (get restore progress)
109
+ if ($action == 'getAction') {
110
+ include_once SG_BACKUP_PATH . 'SGBackup.php';
111
+ $currentAction = SGBackup::getAction(SG_ACTION_ID);
112
+ if ($currentAction) {
113
+ if (
114
+ $currentAction['status'] == SG_ACTION_STATUS_CREATED
115
+ || $currentAction['status'] == SG_ACTION_STATUS_IN_PROGRESS_FILES
116
+ || $currentAction['status'] == SG_ACTION_STATUS_IN_PROGRESS_DB
117
+ ) {
118
+ if (!SGPing::ping()) {
119
+ maintenanceMode(false);
120
+
121
+ $backup = new SGBackup();
122
+ $backup->handleExecutionTimeout(SG_ACTION_ID);
123
+ $currentAction = SGBackup::getAction(SG_ACTION_ID);
124
+ }
125
+ die(json_encode($currentAction));
126
+ } else if (
127
+ $currentAction['status'] == SG_ACTION_STATUS_FINISHED
128
+ || $currentAction['status'] == SG_ACTION_STATUS_FINISHED_WARNINGS
129
+ ) {
130
+ die('1');
131
+ }
132
+ die('0');
133
+ }
134
+ die('0');
135
+ }
136
+
137
+ //finalize restoration
138
+ if ($action == 'finalize') {
139
+ include_once SG_BACKUP_PATH . 'SGBackup.php';
140
+ $backup = new SGBackup();
141
+ $backup->finalizeExternalRestore(SG_ACTION_ID);
142
+ die;
143
+ }
144
+ ?>
145
+ <!DOCTYPE html>
146
+ <html>
147
+ <head>
148
+ <link rel="stylesheet" type="text/css" href="<?php echo SG_PUBLIC_URL; ?>css/spinner.css">
149
+ <link rel="stylesheet" type="text/css" href="<?php echo SG_PUBLIC_URL; ?>css/bgstyle.less.css">
150
+ <link rel="stylesheet" type="text/css" href="<?php echo SG_PUBLIC_URL; ?>css/main.css">
151
+ <style>
152
+ body {
153
+ background-color: #fff;
154
+ padding: 0;
155
+ margin: 0;
156
+ }
157
+
158
+ .sg-box-center {
159
+ width: 400px;
160
+ position: absolute;
161
+ left: 50%;
162
+ margin-left: -200px;
163
+ margin-top: 100px;
164
+ border: 1px solid #5c5c5c;
165
+ }
166
+
167
+ .sg-logo {
168
+ text-align: center;
169
+ padding: 20px 0;
170
+ background-color: #0021C8;
171
+ }
172
+
173
+ .sg-wrapper-less .sg-progress {
174
+ height: 4px;
175
+ margin: 1px 0 0;
176
+ }
177
+
178
+ .sg-progress-box p {
179
+ margin-top: 10px;
180
+ text-align: center;
181
+ }
182
+
183
+ .restore-warning {
184
+ color: #C20000;
185
+ }
186
+
187
+ .restore-progress-p {
188
+ font-size: 21px;
189
+ font-weight: bold;
190
+ }
191
+ </style>
192
+ </head>
193
+ <body>
194
+ <div class="sg-wrapper-less">
195
+ <div class="sg-wrapper">
196
+ <div class="sg-box-center">
197
+ <div class="sg-logo">
198
+ <img width="172px" src="<?php echo SG_PUBLIC_URL; ?>img/sglogo.png">
199
+ </div>
200
+ <div class="sg-progress-box">
201
+ <p class="restore-progress-p">Restoring <span id="progressItem">files</span>: <span
202
+ id="progressTxt">0%</span></p>
203
+ <p class="restore-warning"><small>NOTE: Please don't close your browser until finished.</small></p>
204
+ <div class="sg-progress progress">
205
+ <div id="progressBar" class="progress-bar" style="width: 0%;"></div>
206
+ </div>
207
+ </div>
208
+ </div>
209
+ </div>
210
+ </div>
211
+ <script>
212
+ function bgRunAjax(url, responseHandler, params) {
213
+ var req;
214
+ if (window.XMLHttpRequest) {
215
+ req = new XMLHttpRequest();
216
+ } else if (window.ActiveXObject) {
217
+ req = new ActiveXObject("Microsoft.XMLHTTP");
218
+ }
219
+ req.onreadystatechange = function () {
220
+ if (req.readyState == 4) {
221
+ if (req.status < 400) {
222
+ responseHandler(req, params);
223
+ }
224
+ }
225
+ };
226
+ req.open("POST", url, true);
227
+ req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
228
+ req.send(params);
229
+ }
230
+
231
+ function bgUpdateProgress(progress) {
232
+ var progressInPercents = progress + '%';
233
+ var progressBar = document.getElementById('progressBar');
234
+ progressBar.style.width = progressInPercents;
235
+ var progressTxt = document.getElementById('progressTxt');
236
+ progressTxt.innerHTML = progressInPercents;
237
+ }
238
+
239
+ var awakeRunning = false;
240
+
241
+ function awake() {
242
+ if (awakeRunning) return;
243
+ awakeRunning = true;
244
+ bgRunAjax("<?php echo BG_RESTORE_URL; ?>&action=awake", function () {
245
+ awakeRunning = false;
246
+ }, "");
247
+ }
248
+
249
+ var getActionRunning = false;
250
+
251
+ function getAction() {
252
+ if (getActionRunning) return;
253
+ getActionRunning = true;
254
+ bgRunAjax("<?php echo BG_RESTORE_URL; ?>&action=getAction", function (response) {
255
+ try {
256
+ var response = eval('(' + response.responseText + ')');
257
+ if (response === 1) {
258
+ clearInterval(getActionTimer);
259
+ clearInterval(awakeTimer);
260
+ bgRunAjax("<?php echo BG_RESTORE_URL; ?>&action=finalize", function (response) {
261
+ bgUpdateProgress(100);
262
+ location.href = '<?php echo BG_PLUGIN_URL; ?>';
263
+ }, "");
264
+ return;
265
+ } else if (response === 0) {
266
+ clearInterval(getActionTimer);
267
+ clearInterval(awakeTimer);
268
+ bgUpdateProgress(100);
269
+ location.href = '<?php echo BG_PLUGIN_URL; ?>';
270
+ return;
271
+ } else if (typeof response === 'object') {
272
+ bgUpdateProgress(response.progress);
273
+ if (response.status ==<?php echo SG_ACTION_STATUS_IN_PROGRESS_FILES; ?>) {
274
+ progressItem.innerHTML = 'files';
275
+ } else {
276
+ progressItem.innerHTML = 'database';
277
+ }
278
+ }
279
+ } catch (e) {
280
+ }
281
+
282
+ getActionRunning = false;
283
+ }, "");
284
+ }
285
+
286
+ //awake
287
+ var awakeTimer = setInterval(function () {
288
+ awake();
289
+ }, 3000);
290
+ awake();
291
+
292
+ //get action (for progress)
293
+ var getActionTimer = setInterval(function () {
294
+ getAction();
295
+ }, 4000);
296
+ getAction();
297
+ </script>
298
+ </body>
299
+ </html>
public/schedule.php CHANGED
@@ -1,183 +1,89 @@
1
- <?php
2
- $contentClassName = getBackupPageContentClassName('schedule');
3
- $id = '';
4
- $directories = SG_BACKUP_FILE_PATHS;
5
- $directories = explode(',', $directories);
6
- $dropbox = SGConfig::get('SG_DROPBOX_ACCESS_TOKEN');
7
- $backupGuard = SGConfig::get('SG_BACKUPGUARD_UPLOAD_ACCESS_TOKEN');
8
-
9
- $intervalSelectElement = array(
10
- BG_SCHEDULE_INTERVAL_HOURLY => 'Hour',
11
- BG_SCHEDULE_INTERVAL_DAILY => 'Day',
12
- BG_SCHEDULE_INTERVAL_WEEKLY => 'Week',
13
- BG_SCHEDULE_INTERVAL_MONTHLY => 'Month'
14
- );
15
-
16
- $sgb = new SGBackup();
17
- $scheduleParams = $sgb->getScheduleParamsById(SG_SCHEDULER_DEFAULT_ID);
18
- $scheduleParams = backupGuardParseBackupOptions($scheduleParams);
19
- ?>
20
-
21
- <div id="sg-backup-page-content-schedule" class="sg-backup-page-content <?php echo $contentClassName; ?>">
22
- <div class="row sg-schedule-container">
23
- <div class="col-md-12">
24
- <form class="form-horizontal" method="post" data-sgform="ajax" data-type="schedule">
25
- <fieldset>
26
- <div><h1 class="sg-backup-page-title"><?php _backupGuardT('Schedule settings')?></h1></div>
27
- <?php if (!SGBoot::isFeatureAvailable('MULTI_SCHEDULE')): ?>
28
- <div class="form-group">
29
- <div class="col-md-12 sg-feature-alert-text">
30
- <?php _backupGuardT('*Multiple schedule profiles are available only in')?> <a href="<?php echo SG_BACKUP_SITE_PRICING_URL?>" target="_blank"><?php _backupGuardT('Platinum')?></a> <?php _backupGuardT('version.')?>
31
- </div>
32
- </div>
33
- <?php endif; ?>
34
- <div class="form-group">
35
- <label class="col-md-8 sg-control-label">
36
- <?php _backupGuardT('Scheduled backup')?>
37
- </label>
38
- <div class="col-md-3 pull-right text-right">
39
- <label class="sg-switch-container">
40
- <input type="checkbox" class="sg-switch" <?php echo strlen($scheduleParams['label'])?'checked':''?> data-remote="schedule">
41
- </label>
42
- </div>
43
- </div>
44
- <div class="sg-schedule-settings sg-schedule-settings-<?php echo strlen($scheduleParams['label'])?'opened':'closed'; ?>">
45
- <div class="form-group">
46
- <label class="col-md-4 sg-control-label" for="sg-schedule-label"><?php _backupGuardT('Schedule label')?></label>
47
- <div class="col-md-8">
48
- <input class="form-control sg-backup-input" name="sg-schedule-label" id="sg-schedule-label" value="<?php echo esc_html($scheduleParams['label'])?>">
49
- </div>
50
- </div>
51
- <!-- Schedule interval -->
52
- <div class="form-group">
53
- <label class="col-md-4 sg-control-label" for="sg-schedule-interval"><?php _backupGuardT('Perform backup every')?></label>
54
- <div class="col-md-8">
55
- <?php echo selectElement($intervalSelectElement, array('id'=>'sg-schedule-interval', 'name'=>'scheduleInterval', 'class'=>'form-control'), '', esc_html($scheduleParams['interval']));?>
56
- </div>
57
- </div>
58
- <!-- Schedule options -->
59
- <div class="form-group sg-custom-backup-schedule">
60
- <div class="col-md-8 col-md-offset-4">
61
- <div class="radio sg-no-padding-top">
62
- <label for="fullbackup-radio">
63
- <input type="radio" name="backupType" id="fullbackup-radio" value="1" checked>
64
- <?php _backupGuardT('Full backup'); ?>
65
- </label>
66
- </div>
67
- <div class="radio sg-no-padding-top">
68
- <label for="custombackup-radio">
69
- <input type="radio" name="backupType" id="custombackup-radio" value="2" <?php echo $scheduleParams['isCustomBackup']?'checked':'' ?>>
70
- <?php _backupGuardT('Custom backup'); ?>
71
- </label>
72
- </div>
73
- <div class="col-md-12 sg-custom-backup <?php echo $scheduleParams['isCustomBackup']?'sg-open':'' ?>">
74
- <div class="checkbox">
75
- <label for="custombackupdb-chbx">
76
- <input type="checkbox" name="backupDatabase" class="sg-custom-option" id="custombackupdb-chbx" <?php echo $scheduleParams['isDatabaseSelected']?'checked':'' ?>>
77
- <span class="sg-checkbox-label-text"><?php _backupGuardT('Backup database'); ?></span>
78
- </label>
79
- </div>
80
- <div class="checkbox">
81
- <label for="custombackupfiles-chbx">
82
- <input type="checkbox" name="backupFiles" class="sg-custom-option" id="custombackupfiles-chbx" <?php echo $scheduleParams['isFilesSelected']?'checked':'' ?>>
83
- <span class="sg-checkbox-label-text"><?php _backupGuardT('Backup files'); ?></span>
84
- </label>
85
- <!--Files-->
86
- <div class="col-md-12 sg-checkbox sg-custom-backup-files <?php echo $scheduleParams['isFilesSelected']?'sg-open':'' ?>">
87
- <?php foreach ($directories as $directory): ?>
88
- <div class="checkbox">
89
- <label for="<?php echo 'sg'.$directory?>">
90
- <input type="checkbox" name="directory[]" id="<?php echo 'sg'.$directory;?>" value="<?php echo $directory;?>" <?php if($directory == 'wp-content' && in_array($directory, $scheduleParams['selectedDirectories'])){ echo 'checked=checked'; } elseif ($directory != 'wp-content' && !in_array($directory, $scheduleParams['excludeDirectories'])){ echo 'checked=checked'; } ?> >
91
- <?php echo basename($directory);?>
92
- </label>
93
- </div>
94
- <?php endforeach;?>
95
- </div>
96
- </div>
97
- </div>
98
- <div class="clearfix"></div>
99
- <!--Cloud-->
100
- <?php if(SGBoot::isFeatureAvailable('STORAGE')): ?>
101
- <div class="checkbox">
102
- <label for="custombackupcloud-chbx">
103
- <input type="checkbox" name="backupCloud" id="custombackupcloud-chbx" <?php echo count($scheduleParams['selectedClouds'])?'checked':''?>>
104
- <span class="sg-checkbox-label-text"><?php _backupGuardT('Upload to cloud'); ?></span>
105
- </label>
106
- <!--Storages-->
107
- <div class="col-md-12 sg-checkbox sg-custom-backup-cloud <?php echo count($scheduleParams['selectedClouds'])?'sg-open':'';?>">
108
- <?php if(SGBoot::isFeatureAvailable('BACKUP_GUARD') && SG_SHOW_BACKUPGUARD_CLOUD): ?>
109
- <div class="checkbox">
110
- <label for="cloud-backup-guard" <?php echo empty($backupGuard)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('BackupGuard is not active.',true).'"':''?>>
111
- <input type="checkbox" name="backupStorages[]" id="cloud-backup-guard" value="<?php echo SG_STORAGE_BACKUP_GUARD ?>" <?php echo in_array(SG_STORAGE_BACKUP_GUARD, $scheduleParams['selectedClouds'])?'checked="checked"':''?> <?php echo empty($backupGuard)?'disabled="disabled"':''?>>
112
- <?php echo 'BackupGuard' ?>
113
- </label>
114
- </div>
115
- <?php endif; ?>
116
- <?php if(SGBoot::isFeatureAvailable('FTP')): ?>
117
- <div class="checkbox">
118
- <label for="cloud-ftp" <?php echo empty($ftp)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('FTP is not active.',true).'"':''?>>
119
- <input type="checkbox" name="backupStorages[]" id="cloud-ftp" value="<?php echo SG_STORAGE_FTP ?>" <?php echo in_array(SG_STORAGE_FTP, $scheduleParams['selectedClouds'])?'checked="checked"':''?> <?php echo empty($ftp)?'disabled="disabled"':''?>>
120
- <span class="sg-checkbox-label-text"><?php echo 'FTP' ?></span>
121
- </label>
122
- </div>
123
- <?php endif; ?>
124
- <?php if(SGBoot::isFeatureAvailable('DROPBOX')): ?>
125
- <div class="checkbox">
126
- <label for="cloud-dropbox" <?php echo empty($dropbox)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('Dropbox is not active.',true).'"':''?>>
127
- <input type="checkbox" name="backupStorages[]" id="cloud-dropbox" value="<?php echo SG_STORAGE_DROPBOX ?>" <?php echo in_array(SG_STORAGE_DROPBOX, $scheduleParams['selectedClouds'])?'checked="checked"':''?> <?php echo empty($dropbox)?'disabled="disabled"':''?>>
128
- <span class="sg-checkbox-label-text"><?php echo 'Dropbox' ?></span>
129
- </label>
130
- </div>
131
- <?php endif; ?>
132
- <?php if(SGBoot::isFeatureAvailable('GOOGLE_DRIVE')): ?>
133
- <div class="checkbox">
134
- <label for="cloud-gdrive" <?php echo empty($gdrive)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('Google Drive is not active.',true).'"':''?>>
135
- <input type="checkbox" name="backupStorages[]" id="cloud-gdrive" value="<?php echo SG_STORAGE_GOOGLE_DRIVE?>" <?php echo in_array(SG_STORAGE_GOOGLE_DRIVE, $scheduleParams['selectedClouds'])?'checked="checked"':''?> <?php echo empty($gdrive)?'disabled="disabled"':''?>>
136
- <span class="sg-checkbox-label-text"><?php echo 'Google Drive' ?></span>
137
- </label>
138
- </div>
139
- <?php endif; ?>
140
- <?php if(SGBoot::isFeatureAvailable('AMAZON')): ?>
141
- <div class="checkbox">
142
- <label for="cloud-amazon" <?php echo empty($amazon)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('Amazon S3 Drive is not active.',true).'"':''?>>
143
- <input type="checkbox" name="backupStorages[]" id="cloud-amazon" value="<?php echo SG_STORAGE_AMAZON?>" <?php echo in_array(SG_STORAGE_AMAZON, $scheduleParams['selectedClouds'])?'checked="checked"':''?> <?php echo empty($amazon)?'disabled="disabled"':''?>>
144
- <span class="sg-checkbox-label-text"><?php echo 'Amazon S3' ?></span>
145
- </label>
146
- </div>
147
- <?php endif; ?>
148
- <?php if(SGBoot::isFeatureAvailable('ONE_DRIVE')): ?>
149
- <div class="checkbox">
150
- <label for="cloud-one-drive" <?php echo empty($oneDrive)?'data-toggle="tooltip" data-placement="right" title="'._backupGuardT('One Drive is not active.', true).'"':''?>>
151
- <input type="checkbox" name="backupStorages[]" id="cloud-one-drive" value="<?php echo SG_STORAGE_ONE_DRIVE?>" <?php echo in_array(SG_STORAGE_ONE_DRIVE, $scheduleParams['selectedClouds'])?'checked="checked"':''?> <?php echo empty($oneDrive)?'disabled="disabled"':''?>>
152
- <span class="sg-checkbox-label-text"><?php echo 'One Drive' ?></span>
153
- </label>
154
- </div>
155
- <?php endif;?>
156
- </div>
157
- <div class="clearfix"></div>
158
- </div>
159
- <?php endif; ?>
160
- <!-- Background mode -->
161
- <?php if(SGBoot::isFeatureAvailable('BACKGROUND_MODE')): ?>
162
- <div class="checkbox">
163
- <label for="background-chbx">
164
- <input type="checkbox" name="backgroundMode" id="background-chbx" <?php echo $scheduleParams['isBackgroundMode']?'checked':''?>>
165
- <span class="sg-checkbox-label-text"><?php _backupGuardT('Background mode'); ?></span>
166
- </label>
167
- </div>
168
- <?php endif;?>
169
- </div>
170
- </div>
171
- <!-- Button (Double) -->
172
- <div class="form-group">
173
- <label class="col-md-4 sg-control-label" for="button1id"></label>
174
- <div class="col-md-8">
175
- <button type="button" id="sg-save-schedule" onclick="sgBackup.schedule()" class="btn btn-success pull-right"><?php _backupGuardT('Save');?></button>
176
- </div>
177
- </div>
178
- </div>
179
- </fieldset>
180
- </form>
181
- </div>
182
- </div>
183
- </div>
1
+ <?php
2
+
3
+ require_once(SG_BACKUP_PATH . 'SGBackupSchedule.php');
4
+ $allSchedules = SGBackupSchedule::getAllSchedules();
5
+ $contentClassName = esc_attr(getBackupPageContentClassName('schedule'));
6
+ ?>
7
+ <div id="sg-backup-page-content-schedule" class="sg-backup-page-content <?php echo $contentClassName; ?>">
8
+ <div class="sg-schedule-container">
9
+ <fieldset>
10
+ <div><h1 class="sg-backup-page-title"><?php _backupGuardT('Schedules') ?></h1></div>
11
+ <button class="pull-left btn btn-success sg-backup-action-buttons" data-toggle="modal"
12
+ data-modal-name="create-schedule" data-remote="modalCreateSchedule">
13
+ <span class="sg-backup-cross sg-backup-buttons-content"></span>
14
+ <span class="sg-backup-buttons-text sg-backup-buttons-content"><?php _backupGuardT('Create schedule') ?></span>
15
+ </button>
16
+ <div class="clearfix"></div>
17
+ <br/>
18
+ <table class="table table-striped sg-schedule paginated sg-backup-table">
19
+ <thead>
20
+ <tr>
21
+ <th><?php _backupGuardT('Label') ?></th>
22
+ <th><?php _backupGuardT('Recurrence') ?></th>
23
+ <th><?php _backupGuardT('Execution date') ?></th>
24
+ <th><?php _backupGuardT('Backup options') ?></th>
25
+ <th><?php _backupGuardT('Upload to') ?></th>
26
+ <th><?php _backupGuardT('Status') ?></th>
27
+ <th><?php _backupGuardT('Actions') ?></th>
28
+ </tr>
29
+ </thead>
30
+ <tbody>
31
+ <?php if (empty($allSchedules)) : ?>
32
+ <tr>
33
+ <td colspan="7"><?php _backupGuardT('No schedules found.') ?></td>
34
+ </tr>
35
+ <?php endif; ?>
36
+ <?php foreach ($allSchedules as $schedule) :
37
+ $backupOptions = backupGuardParseBackupOptions($schedule);
38
+ ?>
39
+ <tr>
40
+ <td><?php echo esc_html($schedule['label']) ?></td>
41
+ <td><?php echo esc_html($schedule['recurrence']) ?></td>
42
+ <td><?php echo backupGuardConvertDateTimezone(@date('Y-m-d H:i:s', (int)$schedule['executionDate']), true) ?></td>
43
+ <td>
44
+ <?php
45
+ $showOptions = array();
46
+ if (!$backupOptions['isCustomBackup']) {
47
+ $showOptions[] = 'Full';
48
+ } else {
49
+ if ($backupOptions['isDatabaseSelected']) {
50
+ $showOptions[] = 'DB';
51
+ }
52
+ if ($backupOptions['isFilesSelected']) {
53
+ $selectedDirectories = str_replace('wp-content/', '', $backupOptions['selectedDirectories']);
54
+ if (in_array('wp-content', $selectedDirectories)) {
55
+ $showOptions[] = 'wp-content';
56
+ } else {
57
+ $showOptions = array_merge($showOptions, $selectedDirectories);
58
+ }
59
+ }
60
+ }
61
+ echo implode(', ', $showOptions);
62
+ ?>
63
+ </td>
64
+ <td>
65
+ <?php
66
+ foreach ($backupOptions['selectedClouds'] as $cloud) {
67
+ echo '<span class="btn-xs sg-status-icon sg-status-3' . $cloud . '">&nbsp;</span> ';
68
+ }
69
+ ?>
70
+ </td>
71
+ <td><?php echo (int)$schedule['status'] == SG_SHCEDULE_STATUS_PENDING ? '<span class="sg-schedule-pending">' . _backupGuardT('Pending', true) . '</span>' : '<span class="sg-schedule-inactive">' . _backupGuardT('Inactive', true) . '</span>' ?></td>
72
+ <td>
73
+ <a data-toggle="modal" data-modal-name="create-schedule" data-remote="modalCreateSchedule"
74
+ data-sgbp-params="<?php echo $schedule['id'] ?>"
75
+ class="btn-xs sg-schedule-icon sg-schedule-edit" title="<?php _backupGuardT('Edit') ?>">&nbsp</a>
76
+ <a onclick="sgBackup.removeSchedule(<?php echo $schedule['id'] ?>)"
77
+ class="btn-xs sg-schedule-icon sg-schedule-delete"
78
+ title="<?php _backupGuardT('Delete') ?>">&nbsp&nbsp;</a>
79
+ </td>
80
+ </tr>
81
+ <?php endforeach; ?>
82
+ </tbody>
83
+ </table>
84
+ <div class="text-right sg-schedule">
85
+ <ul class="pagination"></ul>
86
+ </div>
87
+ </fieldset>
88
+ </div>
89
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
public/security.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- require_once(dirname(__FILE__).'/boot.php');
4
- require_once(SG_PUBLIC_INCLUDE_PATH.'header.php');
5
- require_once(SG_PUBLIC_INCLUDE_PATH.'sidebar.php');
6
-
7
- ?>
8
- <div id="sg-content-wrapper">
9
- <?php require_once(SG_PUBLIC_INCLUDE_PATH.'footer.php'); ?>
10
- </div>
1
+ <?php
2
+
3
+ require_once(dirname(__FILE__) . '/boot.php');
4
+ require_once(SG_PUBLIC_INCLUDE_PATH . 'header.php');
5
+ require_once(SG_PUBLIC_INCLUDE_PATH . 'sidebar.php');
6
+
7
+ ?>
8
+ <div id="sg-content-wrapper">
9
+ <?php require_once(SG_PUBLIC_INCLUDE_PATH . 'footer.php'); ?>
10
+ </div>
public/services.php CHANGED
@@ -1,64 +1,69 @@
1
- <?php
2
- require_once(dirname(__FILE__).'/boot.php');
3
- require_once(SG_PUBLIC_INCLUDE_PATH.'header.php');
4
- $contentClassName = getBackupPageContentClassName('services');
5
- ?>
6
- <div id="sg-backup-page-content-services" class="sg-backup-page-content <?php echo $contentClassName; ?>">
7
- <div><h1 class="sg-backup-page-title"><?php _backupGuardT('Special services')?></h1></div>
8
- <div class="sg-service-container">
9
- <div class="plugin-card-top">
10
- <div class="row">
11
- <div class="col-md-3">
12
- <div class="sg-migration-icon"></div>
13
- <!-- <img src="<?php echo SG_PUBLIC_URL."img/wordPress-migration-service-product.png"?>" class="" alt=""> -->
14
- </div>
15
- <div class="col-md-7 sg-migration-info">
16
- <div class="column-name">
17
- <h1>
18
- <a href="<?php echo SG_MIGRATION_SERVICE_URL?>" class="thickbox" target="_blank"><?php _backupGuardT('WordPress'); ?> <b><?php _backupGuardT('Migration Service'); ?></b></a>
19
- </h1>
20
- </div>
21
- <div class="column-description">
22
- <p class="column-description-p"><?php _backupGuardT('Our professionals will migrate all of your files and database and ensure <br> everything is working properly on your new server. With our migration service, you can expect:')?></p>
23
- <div class="row">
24
- <div class="col-md-5">
25
- <p class="sg-migration-features">
26
- <span class="sg-right-arrow sg-services-arrow"></span>
27
- <?php _backupGuardT('Migration of your files')?>
28
- </p>
29
- <p class="sg-migration-features">
30
- <span class="sg-right-arrow sg-services-arrow"></span>
31
- <?php _backupGuardT('Migration of your database')?>
32
- </p>
33
- <p class="sg-migration-features">
34
- <span class="sg-right-arrow sg-services-arrow"></span>
35
- <?php _backupGuardT('Refactoring of all urls')?>
36
- </p>
37
- </div>
38
- <div class="col-md-7">
39
- <p class="sg-migration-features">
40
- <span class="sg-right-arrow sg-services-arrow"></span>
41
- <?php _backupGuardT('Refactoring of all file names and image paths')?>
42
- </p>
43
- <p class="sg-migration-features">
44
- <span class="sg-right-arrow sg-services-arrow"></span>
45
- <?php _backupGuardT('Serialized data refactoring')?>
46
- </p>
47
- </div>
48
- </div>
49
- </div>
50
- </div>
51
- <div class="col-md-2 sg-migration-right-column">
52
- <div class="migration-price-wrapper">
53
- <ul class="sg-migration-price-ul">
54
- <li><p id="sg-migration-service-price">$<b>84.95</b></p></li>
55
- <li>
56
- <a class="btn btn-success" target="_blank" data-slug="" href="<?php echo SG_MIGRATION_SERVICE_URL?>" aria-label="" data-name=""><?php _backupGuardT('Order now')?></a>
57
- </li>
58
- </ul>
59
- </div>
60
- </div>
61
- </div>
62
- </div>
63
- </div>
64
- </div>
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once(dirname(__FILE__) . '/boot.php');
4
+ require_once(SG_PUBLIC_INCLUDE_PATH . 'header.php');
5
+ $contentClassName = esc_attr(getBackupPageContentClassName('services'));
6
+ ?>
7
+ <div id="sg-backup-page-content-services" class="sg-backup-page-content <?php echo $contentClassName; ?>">
8
+ <div><h1 class="sg-backup-page-title"><?php _backupGuardT('Special services') ?></h1></div>
9
+ <div class="sg-service-container">
10
+ <div class="plugin-card-top">
11
+ <div class="row">
12
+ <div class="col-md-3">
13
+ <div class="sg-migration-icon"></div>
14
+ <!-- <img src="<?php echo SG_PUBLIC_URL . "img/wordPress-migration-service-product.png" ?>" class="" alt=""> -->
15
+ </div>
16
+ <div class="col-md-7 sg-migration-info">
17
+ <div class="column-name">
18
+ <h1>
19
+ <a href="<?php echo SG_MIGRATION_SERVICE_URL ?>" class="thickbox"
20
+ target="_blank"><?php _backupGuardT('WordPress'); ?>
21
+ <b><?php _backupGuardT('Migration Service'); ?></b></a>
22
+ </h1>
23
+ </div>
24
+ <div class="column-description">
25
+ <p class="column-description-p"><?php _backupGuardT('Our professionals will migrate all of your files and database and ensure <br> everything is working properly on your new server. With our migration service, you can expect:') ?></p>
26
+ <div class="row">
27
+ <div class="col-md-5">
28
+ <p class="sg-migration-features">
29
+ <span class="sg-right-arrow sg-services-arrow"></span>
30
+ <?php _backupGuardT('Migration of your files') ?>
31
+ </p>
32
+ <p class="sg-migration-features">
33
+ <span class="sg-right-arrow sg-services-arrow"></span>
34
+ <?php _backupGuardT('Migration of your database') ?>
35
+ </p>
36
+ <p class="sg-migration-features">
37
+ <span class="sg-right-arrow sg-services-arrow"></span>
38
+ <?php _backupGuardT('Refactoring of all urls') ?>
39
+ </p>
40
+ </div>
41
+ <div class="col-md-7">
42
+ <p class="sg-migration-features">
43
+ <span class="sg-right-arrow sg-services-arrow"></span>
44
+ <?php _backupGuardT('Refactoring of all file names and image paths') ?>
45
+ </p>
46
+ <p class="sg-migration-features">
47
+ <span class="sg-right-arrow sg-services-arrow"></span>
48
+ <?php _backupGuardT('Serialized data refactoring') ?>
49
+ </p>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ <div class="col-md-2 sg-migration-right-column">
55
+ <div class="migration-price-wrapper">
56
+ <ul class="sg-migration-price-ul">
57
+ <li><p id="sg-migration-service-price">$<b>84.95</b></p></li>
58
+ <li>
59
+ <a class="btn btn-success" target="_blank" data-slug=""
60
+ href="<?php echo SG_MIGRATION_SERVICE_URL ?>" aria-label=""
61
+ data-name=""><?php _backupGuardT('Order now') ?></a>
62
+ </li>
63
+ </ul>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </div>
public/settings.php CHANGED
@@ -12,12 +12,12 @@ $isAlertBeforeUpdateEnabled = SGConfig::get('SG_ALERT_BEFORE_UPDATE');
12
  $isShowStatisticsWidgetEnabled = SGConfig::get('SG_SHOW_STATISTICS_WIDGET');
13
  $isReloadingsEnabled = SGConfig::get('SG_BACKUP_WITH_RELOADINGS');
14
  $intervalSelectElement = array(
15
- '1000' => '1 second',
16
- '2000' => '2 seconds',
17
- '3000' => '3 seconds',
18
- '5000' => '5 seconds',
19
- '7000' => '7 seconds',
20
- '10000' => '10 seconds');
21
  $selectedInterval = (int)SGConfig::get('SG_AJAX_REQUEST_FREQUENCY') ? (int)SGConfig::get('SG_AJAX_REQUEST_FREQUENCY') : SG_AJAX_DEFAULT_REQUEST_FREQUENCY;
22
 
23
  $backupFileNamePrefix = SGConfig::get('SG_BACKUP_FILE_NAME_PREFIX') ? SGConfig::get('SG_BACKUP_FILE_NAME_PREFIX') : SG_BACKUP_FILE_NAME_DEFAULT_PREFIX;
@@ -26,7 +26,7 @@ $backupFileNamePrefix = esc_attr($backupFileNamePrefix);
26
  $infoIconHtml = '<span class="dashicons dashicons-editor-help sgbg-info-icon"></span>';
27
  $sgBackgroundReloadMethod = SGConfig::get('SG_BACKGROUND_RELOAD_METHOD');
28
  $ftpPassiveMode = SGConfig::get('SG_FTP_PASSIVE_MODE');
29
- $contentClassName = getBackupPageContentClassName('settings');
30
  $savedCloudUploadChunkSize = getCloudUploadChunkSize();
31
  $timezones = getAllTimezones();
32
  $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
@@ -39,27 +39,28 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
39
  <div><h1 class="sg-backup-page-title"><?php _backupGuardT('General settings') ?></h1></div>
40
  <div class="form-group">
41
  <label class="col-md-4 sg-control-label" for='sg-timezone'>
42
- <?php _backupGuardT("Timezone") ?>
43
  </label>
44
  <div class="col-md-5 text-left">
45
  <select class="form-control" id='sg-timezone' name='sg-timezone'>
46
- <option value="UTC"<?= $timezone == 'UTC' ? ' selected' : '' ?>>(UTC+00:00) UTC</option>
47
- <?php foreach ($timezones as $region => $timezoneText) : ?>
48
- <option value="<?= $region ?>"<?= $timezone == $region ? ' selected' : '' ?>><?= $timezoneText[0] ?></option>
49
- <?php endforeach; ?>
 
50
  </select>
51
  </div>
52
  </div>
53
 
54
- <?php if (SGBoot::isFeatureAvailable('NOTIFICATIONS')) : ?>
55
  <div class="form-group">
56
  <label class="col-md-4 sg-control-label">
57
- <?php _backupGuardT('Email notifications'); ?><?php echo $infoIconHtml; ?>
58
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable notifications to receive status updates about your backup/restore processes.'); ?></span>
59
- <?php if (!empty($userEmail)) : ?>
60
  <br/><span
61
  class="text-muted sg-user-email sg-helper-block"><?php echo esc_html($userEmail); ?></span>
62
- <?php endif ?>
63
  </label>
64
  <div class="col-md-3 text-left">
65
  <label class="sg-switch-container">
@@ -78,14 +79,14 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
78
  <input id="sg-email" name="sgUserEmail" type="text"
79
  placeholder="<?php _backupGuardT('You can enter multiple emails, just separate them with comma') ?>"
80
  class="form-control input-md sg-backup-input"
81
- value="<?php echo @$userEmail ?>">
82
  </div>
83
  </div>
84
  </div>
85
- <?php endif; ?>
86
  <div class="form-group">
87
  <label class="col-md-4 sg-control-label">
88
- <?php _backupGuardT('Reloads enabled'); ?><?php echo $infoIconHtml; ?>
89
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable chunked backup/restore. Recommended to avoid execution timeout errors.') ?></span>
90
  </label>
91
  <div class="col-md-3 text-left">
@@ -95,10 +96,10 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
95
  </label>
96
  </div>
97
  </div>
98
- <?php if (SGBoot::isFeatureAvailable('DELETE_LOCAL_BACKUP_AFTER_UPLOAD')) : ?>
99
  <div class="form-group">
100
  <label class="col-md-4 sg-control-label">
101
- <?php _backupGuardT('Delete local backup after upload'); ?><?php echo $infoIconHtml; ?>
102
  <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>
103
  </label>
104
  <div class="col-md-3 text-left">
@@ -109,11 +110,11 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
109
  </label>
110
  </div>
111
  </div>
112
- <?php endif; ?>
113
- <?php if (SGBoot::isFeatureAvailable('ALERT_BEFORE_UPDATE')) : ?>
114
  <div class="form-group">
115
  <label class="col-md-4 sg-control-label">
116
- <?php _backupGuardT('Alert before update'); ?><?php echo $infoIconHtml; ?>
117
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Receive an alert to backup you website prior to updating installed plugins.') ?></span>
118
  </label>
119
  <div class="col-md-3 text-left">
@@ -124,11 +125,11 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
124
  </label>
125
  </div>
126
  </div>
127
- <?php endif; ?>
128
- <?php if (SGBoot::isFeatureAvailable('BACKUP_DELETION_WILL_ALSO_DELETE_FROM_CLOUD')) : ?>
129
  <div class="form-group">
130
  <label class="col-md-4 sg-control-label">
131
- <?php _backupGuardT('Backup deletion will also delete from cloud'); ?><?php echo $infoIconHtml; ?>
132
  <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>
133
  </label>
134
  <div class="col-md-3 text-left">
@@ -139,10 +140,10 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
139
  </label>
140
  </div>
141
  </div>
142
- <?php endif; ?>
143
  <div class="form-group">
144
  <label class="col-md-4 sg-control-label">
145
- <?php _backupGuardT('Show statistics'); ?><?php echo $infoIconHtml; ?>
146
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Backup statistics available in the dashboard.') ?></span>
147
  </label>
148
  <div class="col-md-3 text-left">
@@ -152,10 +153,10 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
152
  </label>
153
  </div>
154
  </div>
155
- <?php if (SGBoot::isFeatureAvailable('FTP')) : ?>
156
  <div class="form-group">
157
  <label class="col-md-4 sg-control-label">
158
- <?php _backupGuardT('FTP passive mode'); ?>
159
  </label>
160
  <div class="col-md-3 text-left">
161
  <label class="sg-switch-container">
@@ -164,11 +165,11 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
164
  </label>
165
  </div>
166
  </div>
167
- <?php endif; ?>
168
- <?php if (SGBoot::isFeatureAvailable('MULTI_SCHEDULE')) : ?>
169
  <div class="form-group">
170
  <label class="col-md-4 sg-control-label">
171
- <?php _backupGuardT('Disable ads'); ?><?php echo $infoIconHtml; ?>
172
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Disable advertisements inside the plugin (e.g. banners)') ?></span>
173
  </label>
174
  <div class="col-md-3 text-left">
@@ -178,19 +179,19 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
178
  </label>
179
  </div>
180
  </div>
181
- <?php endif; ?>
182
  <div class="form-group">
183
  <label class="col-md-4 sg-control-label" for='sg-download-mode'>
184
- <?php _backupGuardT("Download mode") ?><?php echo $infoIconHtml; ?>
185
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Select what technique to use for downloading the backup files.') ?></span>
186
  </label>
187
  <div class="col-md-5 text-left">
188
  <select class="form-control" id='sg-download-mode' name='sg-download-mode'>
189
- <?php if (backupGuardCheckOS() !== 'windows') : ?>
190
  <option value="0" <?php echo $isDownloadMode === BACKUP_GUARD_DOWNLOAD_MODE_LINK ? "selected" : "" ?> >
191
  Hard link
192
  </option>
193
- <?php endif; ?>
194
  <option value="1" <?php echo $isDownloadMode == BACKUP_GUARD_DOWNLOAD_MODE_PHP ? "selected" : "" ?> >
195
  Via PHP
196
  </option>
@@ -202,7 +203,7 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
202
  </div>
203
  <div class="form-group">
204
  <label class="col-md-4 sg-control-label">
205
- <?php _backupGuardT('Send usage data'); ?><?php echo $infoIconHtml; ?>
206
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Allow us to receive usage data in order to improve plugin functionality') ?></span>
207
  </label>
208
  <div class="col-md-3 text-left">
@@ -214,7 +215,7 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
214
  </div>
215
  <div class="form-group">
216
  <label class="col-md-4 sg-control-label" for='sg-paths-to-exclude'>
217
- <?php _backupGuardT("Exclude paths (separated by commas)") ?>
218
  </label>
219
  <div class="col-md-5 text-left">
220
  <input class="form-control sg-backup-input" id='sg-paths-to-exclude'
@@ -225,7 +226,7 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
225
  </div>
226
  <div class="form-group">
227
  <label class="col-md-4 sg-control-label" for='sg-tables-to-exclude'>
228
- <?php _backupGuardT("Tables to exclude (separated by commas)") ?>
229
  </label>
230
  <div class="col-md-5 text-left">
231
  <input class="form-control sg-backup-input" id='sg-tables-to-exclude'
@@ -234,10 +235,10 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
234
  placeholder="e.g. wp_comments, wp_commentmeta">
235
  </div>
236
  </div>
237
- <?php if (SGBoot::isFeatureAvailable('NUMBER_OF_BACKUPS_TO_KEEP')) : ?>
238
  <div class="form-group">
239
  <label class="col-md-4 sg-control-label" for='amount-of-backups-to-keep'>
240
- <?php _backupGuardT("Backup retention") ?><?php echo $infoIconHtml; ?>
241
  <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>
242
  </label>
243
  <div class="col-md-5 text-left">
@@ -246,10 +247,10 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
246
  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' : '' ?>>
247
  </div>
248
  </div>
249
- <?php endif; ?>
250
  <div class="form-group">
251
  <label class="col-md-4 sg-control-label" for='sg-number-of-rows-to-backup'>
252
- <?php _backupGuardT("Number of rows to backup at once") ?><?php echo $infoIconHtml; ?>
253
  <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>
254
  </label>
255
  <div class="col-md-5 text-left">
@@ -260,7 +261,7 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
260
  </div>
261
  <div class="form-group">
262
  <label class="col-md-4 sg-control-label" for='sg-number-of-rows-to-backup'>
263
- <?php _backupGuardT("Upload to cloud chunk size") ?><?php echo $infoIconHtml; ?>
264
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Change the size of the chunk upload during backup to cloud(s).') ?></span>
265
  </label>
266
  <div class="col-md-5 text-left">
@@ -281,7 +282,7 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
281
  </div>
282
  <div class="form-group">
283
  <label class="col-md-4 sg-control-label" for='sg-background-reload-method'>
284
- <?php _backupGuardT("Reload method") ?><?php echo $infoIconHtml; ?>
285
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose the right PHP Library for reloads') ?></span>
286
  </label>
287
  <div class="col-md-5 text-left">
@@ -299,10 +300,10 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
299
  </select>
300
  </div>
301
  </div>
302
- <?php if (SGBoot::isFeatureAvailable('CUSTOM_BACKUP_NAME')) : ?>
303
  <div class="form-group">
304
  <label class="col-md-4 sg-control-label">
305
- <?php _backupGuardT('Backup file name') ?><?php echo $infoIconHtml; ?>
306
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Name your backups or leave to the default prefixes') ?></span>
307
  </label>
308
  <div class="col-md-5 text-left">
@@ -311,14 +312,14 @@ $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
311
  value="<?php echo $backupFileNamePrefix ?>" <?php echo (!SGBoot::isFeatureAvailable('CUSTOM_BACKUP_NAME')) ? 'disabled' : '' ?>>
312
  </div>
313
  </div>
314
- <?php endif; ?>
315
  <div class="form-group">
316
  <label class="col-md-4 sg-control-label" for="sg-email">
317
- <?php _backupGuardT('Request frequency') ?>
318
  </label>
319
  <div class="col-md-5">
320
- <?php echo selectElement($intervalSelectElement, array('id' => 'sg-ajax-interval',
321
- 'name' => 'ajaxInterval', 'class' => 'form-control'), '', $selectedInterval); ?>
322
  </div>
323
  </div>
324
  <div class="form-group">
12
  $isShowStatisticsWidgetEnabled = SGConfig::get('SG_SHOW_STATISTICS_WIDGET');
13
  $isReloadingsEnabled = SGConfig::get('SG_BACKUP_WITH_RELOADINGS');
14
  $intervalSelectElement = array(
15
+ '1000' => '1 second',
16
+ '2000' => '2 seconds',
17
+ '3000' => '3 seconds',
18
+ '5000' => '5 seconds',
19
+ '7000' => '7 seconds',
20
+ '10000' => '10 seconds');
21
  $selectedInterval = (int)SGConfig::get('SG_AJAX_REQUEST_FREQUENCY') ? (int)SGConfig::get('SG_AJAX_REQUEST_FREQUENCY') : SG_AJAX_DEFAULT_REQUEST_FREQUENCY;
22
 
23
  $backupFileNamePrefix = SGConfig::get('SG_BACKUP_FILE_NAME_PREFIX') ? SGConfig::get('SG_BACKUP_FILE_NAME_PREFIX') : SG_BACKUP_FILE_NAME_DEFAULT_PREFIX;
26
  $infoIconHtml = '<span class="dashicons dashicons-editor-help sgbg-info-icon"></span>';
27
  $sgBackgroundReloadMethod = SGConfig::get('SG_BACKGROUND_RELOAD_METHOD');
28
  $ftpPassiveMode = SGConfig::get('SG_FTP_PASSIVE_MODE');
29
+ $contentClassName = esc_attr(getBackupPageContentClassName('settings'));
30
  $savedCloudUploadChunkSize = getCloudUploadChunkSize();
31
  $timezones = getAllTimezones();
32
  $timezone = SGConfig::get('SG_TIMEZONE') ?: SG_DEFAULT_TIMEZONE;
39
  <div><h1 class="sg-backup-page-title"><?php _backupGuardT('General settings') ?></h1></div>
40
  <div class="form-group">
41
  <label class="col-md-4 sg-control-label" for='sg-timezone'>
42
+ <?php _backupGuardT("Timezone") ?>
43
  </label>
44
  <div class="col-md-5 text-left">
45
  <select class="form-control" id='sg-timezone' name='sg-timezone'>
46
+ <option value="UTC"<?php echo $timezone == 'UTC' ? ' selected' : '' ?>>(UTC+00:00) UTC
47
+ </option>
48
+ <?php foreach ($timezones as $region => $timezoneText) : ?>
49
+ <option value="<?php echo $region ?>"<?php echo $timezone == $region ? ' selected' : '' ?>><?php echo $timezoneText[0] ?></option>
50
+ <?php endforeach; ?>
51
  </select>
52
  </div>
53
  </div>
54
 
55
+ <?php if (SGBoot::isFeatureAvailable('NOTIFICATIONS')) : ?>
56
  <div class="form-group">
57
  <label class="col-md-4 sg-control-label">
58
+ <?php _backupGuardT('Email notifications'); ?><?php echo $infoIconHtml; ?>
59
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable notifications to receive status updates about your backup/restore processes.'); ?></span>
60
+ <?php if (!empty($userEmail)) : ?>
61
  <br/><span
62
  class="text-muted sg-user-email sg-helper-block"><?php echo esc_html($userEmail); ?></span>
63
+ <?php endif ?>
64
  </label>
65
  <div class="col-md-3 text-left">
66
  <label class="sg-switch-container">
79
  <input id="sg-email" name="sgUserEmail" type="text"
80
  placeholder="<?php _backupGuardT('You can enter multiple emails, just separate them with comma') ?>"
81
  class="form-control input-md sg-backup-input"
82
+ value="<?php echo esc_attr($userEmail) ?>">
83
  </div>
84
  </div>
85
  </div>
86
+ <?php endif; ?>
87
  <div class="form-group">
88
  <label class="col-md-4 sg-control-label">
89
+ <?php _backupGuardT('Reloads enabled'); ?><?php echo $infoIconHtml; ?>
90
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Enable chunked backup/restore. Recommended to avoid execution timeout errors.') ?></span>
91
  </label>
92
  <div class="col-md-3 text-left">
96
  </label>
97
  </div>
98
  </div>
99
+ <?php if (SGBoot::isFeatureAvailable('DELETE_LOCAL_BACKUP_AFTER_UPLOAD')) : ?>
100
  <div class="form-group">
101
  <label class="col-md-4 sg-control-label">
102
+ <?php _backupGuardT('Delete local backup after upload'); ?><?php echo $infoIconHtml; ?>
103
  <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>
104
  </label>
105
  <div class="col-md-3 text-left">
110
  </label>
111
  </div>
112
  </div>
113
+ <?php endif; ?>
114
+ <?php if (SGBoot::isFeatureAvailable('ALERT_BEFORE_UPDATE')) : ?>
115
  <div class="form-group">
116
  <label class="col-md-4 sg-control-label">
117
+ <?php _backupGuardT('Alert before update'); ?><?php echo $infoIconHtml; ?>
118
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Receive an alert to backup you website prior to updating installed plugins.') ?></span>
119
  </label>
120
  <div class="col-md-3 text-left">
125
  </label>
126
  </div>
127
  </div>
128
+ <?php endif; ?>
129
+ <?php if (SGBoot::isFeatureAvailable('BACKUP_DELETION_WILL_ALSO_DELETE_FROM_CLOUD')) : ?>
130
  <div class="form-group">
131
  <label class="col-md-4 sg-control-label">
132
+ <?php _backupGuardT('Backup deletion will also delete from cloud'); ?><?php echo $infoIconHtml; ?>
133
  <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>
134
  </label>
135
  <div class="col-md-3 text-left">
140
  </label>
141
  </div>
142
  </div>
143
+ <?php endif; ?>
144
  <div class="form-group">
145
  <label class="col-md-4 sg-control-label">
146
+ <?php _backupGuardT('Show statistics'); ?><?php echo $infoIconHtml; ?>
147
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Backup statistics available in the dashboard.') ?></span>
148
  </label>
149
  <div class="col-md-3 text-left">
153
  </label>
154
  </div>
155
  </div>
156
+ <?php if (SGBoot::isFeatureAvailable('FTP')) : ?>
157
  <div class="form-group">
158
  <label class="col-md-4 sg-control-label">
159
+ <?php _backupGuardT('FTP passive mode'); ?>
160
  </label>
161
  <div class="col-md-3 text-left">
162
  <label class="sg-switch-container">
165
  </label>
166
  </div>
167
  </div>
168
+ <?php endif; ?>
169
+ <?php if (SGBoot::isFeatureAvailable('MULTI_SCHEDULE')) : ?>
170
  <div class="form-group">
171
  <label class="col-md-4 sg-control-label">
172
+ <?php _backupGuardT('Disable ads'); ?><?php echo $infoIconHtml; ?>
173
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Disable advertisements inside the plugin (e.g. banners)') ?></span>
174
  </label>
175
  <div class="col-md-3 text-left">
179
  </label>
180
  </div>
181
  </div>
182
+ <?php endif; ?>
183
  <div class="form-group">
184
  <label class="col-md-4 sg-control-label" for='sg-download-mode'>
185
+ <?php _backupGuardT("Download mode") ?><?php echo $infoIconHtml; ?>
186
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Select what technique to use for downloading the backup files.') ?></span>
187
  </label>
188
  <div class="col-md-5 text-left">
189
  <select class="form-control" id='sg-download-mode' name='sg-download-mode'>
190
+ <?php if (backupGuardCheckOS() !== 'windows') : ?>
191
  <option value="0" <?php echo $isDownloadMode === BACKUP_GUARD_DOWNLOAD_MODE_LINK ? "selected" : "" ?> >
192
  Hard link
193
  </option>
194
+ <?php endif; ?>
195
  <option value="1" <?php echo $isDownloadMode == BACKUP_GUARD_DOWNLOAD_MODE_PHP ? "selected" : "" ?> >
196
  Via PHP
197
  </option>
203
  </div>
204
  <div class="form-group">
205
  <label class="col-md-4 sg-control-label">
206
+ <?php _backupGuardT('Send usage data'); ?><?php echo $infoIconHtml; ?>
207
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Allow us to receive usage data in order to improve plugin functionality') ?></span>
208
  </label>
209
  <div class="col-md-3 text-left">
215
  </div>
216
  <div class="form-group">
217
  <label class="col-md-4 sg-control-label" for='sg-paths-to-exclude'>
218
+ <?php _backupGuardT("Exclude paths (separated by commas)") ?>
219
  </label>
220
  <div class="col-md-5 text-left">
221
  <input class="form-control sg-backup-input" id='sg-paths-to-exclude'
226
  </div>
227
  <div class="form-group">
228
  <label class="col-md-4 sg-control-label" for='sg-tables-to-exclude'>
229
+ <?php _backupGuardT("Tables to exclude (separated by commas)") ?>
230
  </label>
231
  <div class="col-md-5 text-left">
232
  <input class="form-control sg-backup-input" id='sg-tables-to-exclude'
235
  placeholder="e.g. wp_comments, wp_commentmeta">
236
  </div>
237
  </div>
238
+ <?php if (SGBoot::isFeatureAvailable('NUMBER_OF_BACKUPS_TO_KEEP')) : ?>
239
  <div class="form-group">
240
  <label class="col-md-4 sg-control-label" for='amount-of-backups-to-keep'>
241
+ <?php _backupGuardT("Backup retention") ?><?php echo $infoIconHtml; ?>
242
  <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>
243
  </label>
244
  <div class="col-md-5 text-left">
247
  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' : '' ?>>
248
  </div>
249
  </div>
250
+ <?php endif; ?>
251
  <div class="form-group">
252
  <label class="col-md-4 sg-control-label" for='sg-number-of-rows-to-backup'>
253
+ <?php _backupGuardT("Number of rows to backup at once") ?><?php echo $infoIconHtml; ?>
254
  <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>
255
  </label>
256
  <div class="col-md-5 text-left">
261
  </div>
262
  <div class="form-group">
263
  <label class="col-md-4 sg-control-label" for='sg-number-of-rows-to-backup'>
264
+ <?php _backupGuardT("Upload to cloud chunk size") ?><?php echo $infoIconHtml; ?>
265
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Change the size of the chunk upload during backup to cloud(s).') ?></span>
266
  </label>
267
  <div class="col-md-5 text-left">
282
  </div>
283
  <div class="form-group">
284
  <label class="col-md-4 sg-control-label" for='sg-background-reload-method'>
285
+ <?php _backupGuardT("Reload method") ?><?php echo $infoIconHtml; ?>
286
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Choose the right PHP Library for reloads') ?></span>
287
  </label>
288
  <div class="col-md-5 text-left">
300
  </select>
301
  </div>
302
  </div>
303
+ <?php if (SGBoot::isFeatureAvailable('CUSTOM_BACKUP_NAME')) : ?>
304
  <div class="form-group">
305
  <label class="col-md-4 sg-control-label">
306
+ <?php _backupGuardT('Backup file name') ?><?php echo $infoIconHtml; ?>
307
  <span class="infoSelectRepeat samefontStyle sgbg-info-text"><?php _backupGuardT('Name your backups or leave to the default prefixes') ?></span>
308
  </label>
309
  <div class="col-md-5 text-left">
312
  value="<?php echo $backupFileNamePrefix ?>" <?php echo (!SGBoot::isFeatureAvailable('CUSTOM_BACKUP_NAME')) ? 'disabled' : '' ?>>
313
  </div>
314
  </div>
315
+ <?php endif; ?>
316
  <div class="form-group">
317
  <label class="col-md-4 sg-control-label" for="sg-email">
318
+ <?php _backupGuardT('Request frequency') ?>
319
  </label>
320
  <div class="col-md-5">
321
+ <?php echo selectElement($intervalSelectElement, array('id' => 'sg-ajax-interval',
322
+ 'name' => 'ajaxInterval', 'class' => 'form-control'), '', $selectedInterval); ?>
323
  </div>
324
  </div>
325
  <div class="form-group">
public/support.php CHANGED
@@ -1,8 +1,9 @@
1
- <?php
2
- $contentClassName = getBackupPageContentClassName('support');
3
- ?>
4
- <div id="sg-backup-page-content-support" class="sg-backup-page-content <?php echo $contentClassName; ?>">
5
- <div class="sg-wrap-container">
6
- <iframe id="sg-backup-guard-iframe" src="<?php echo SG_BACKUP_SUPPORT_URL?>"></iframe>
7
- </div>
8
- </div>
 
1
+ <?php
2
+
3
+ $contentClassName = esc_attr(getBackupPageContentClassName('support'));
4
+ ?>
5
+ <div id="sg-backup-page-content-support" class="sg-backup-page-content <?php echo $contentClassName; ?>">
6
+ <div class="sg-wrap-container">
7
+ <iframe id="sg-backup-guard-iframe" src="<?php echo SG_BACKUP_SUPPORT_URL ?>"></iframe>
8
+ </div>
9
+ </div>
public/systemInfo.php CHANGED
@@ -1,95 +1,96 @@
1
- <?php
2
- require_once(SG_SCHEDULE_PATH . 'SGSchedule.php');
3
- $contentClassName = getBackupPageContentClassName('system_info');
4
- ?>
5
- <div id="sg-backup-page-content-system_info" class="sg-backup-page-content <?php echo $contentClassName; ?>">
6
- <div class="row">
7
- <div class="col-md-12">
8
- <form class="form-horizontal" method="post" data-sgform="ajax" data-type="sgsettings">
9
- <fieldset>
10
- <div><h1 class="sg-backup-page-title"><?php _backupGuardT('System information') ?></h1></div>
11
- <div class="form-group">
12
- <label class="col-md-3 sg-control-label sg-user-info"><?php _backupGuardT('Disk free space'); ?></label>
13
- <div class="col-md-3 text-left">
14
- <label class="sg-control-label">
15
- <?php echo backupGuardDiskFreeSize(SG_APP_ROOT_DIRECTORY); ?>
16
- </label>
17
- </div>
18
- </div>
19
- <div class="form-group sg-info-wrapper">
20
- <label class="col-md-3 sg-control-label sg-user-info"><?php _backupGuardT('Memory limit'); ?></label>
21
- <div class="col-md-3 text-left">
22
- <label class="sg-control-label"><?php echo SGBoot::$memoryLimit; ?></label>
23
- </div>
24
- </div>
25
- <div class="form-group sg-info-wrapper">
26
- <label class="col-md-3 sg-control-label sg-user-info">
27
- <?php _backupGuardT('Max execution time'); ?>
28
- </label>
29
- <div class="col-md-3 text-left">
30
- <label class="sg-control-label"><?php echo SGBoot::$executionTimeLimit; ?></label>
31
- </div>
32
- </div>
33
- <div class="form-group sg-info-wrapper">
34
- <label class="col-md-3 sg-control-label sg-user-info">
35
- <?php _backupGuardT('PHP version'); ?>
36
- </label>
37
- <div class="col-md-3 text-left">
38
- <label class="sg-control-label"><?php echo PHP_VERSION; ?></label>
39
- </div>
40
- </div>
41
- <div class="form-group sg-info-wrapper">
42
- <label class="col-md-3 sg-control-label sg-user-info"><?php _backupGuardT('MySQL version'); ?></label>
43
- <div class="col-md-3 text-left">
44
- <label class="sg-control-label"><?php echo SG_MYSQL_VERSION; ?></label>
45
- </div>
46
- </div>
47
- <div class="form-group sg-info-wrapper">
48
- <label class="col-md-3 sg-control-label sg-user-info">
49
- <?php _backupGuardT('Int size'); ?>
50
- </label>
51
- <div class="col-md-3 text-left">
52
- <?php echo '<label class="sg-control-label">' . PHP_INT_SIZE . '</label>'; ?>
53
- <?php
54
- if (PHP_INT_SIZE < 8) {
55
- echo '<label class="sg-control-label backup-guard-label-warning">Notice that archive size cannot be bigger than 2GB. This limitaion is comming from system.</label>';
56
- }
57
- ?>
58
- </div>
59
- </div>
60
- <div class="form-group sg-info-wrapper">
61
- <div class="col-md-3 ">
62
- <label class="sg-control-label sg-user-info"><?php _backupGuardT('Curl version'); ?></label>
63
- </div>
64
- <div class="col-md-8 text-left">
65
- <?php
66
- if (function_exists('curl_version') && function_exists('curl_exec')) {
67
- $cv = curl_version();
68
- echo '<label class="sg-control-label sg-blue-label">' . $cv['version'] . ' / SSL: ' . $cv['ssl_version'] . ' / libz: ' . $cv['libz_version'] . '</label>';
69
- } else {
70
- echo '<label class="sg-control-label backup-guard-label-warning">Curl required for BackupGuard for better functioning.</label>';
71
- }
72
- ?>
73
- </div>
74
- </div>
75
- <div class="form-group sg-info-wrapper">
76
- <div class="col-md-3 ">
77
- <label class="sg-control-label sg-user-info"><?php _backupGuardT('Is cron available'); ?></label>
78
- </div>
79
- <div class="col-md-3 text-left">
80
- <?php
81
- $isCronAvailable = SGSchedule::isCronAvailable(true);
82
- if ($isCronAvailable) {
83
- echo '<label class="sg-control-label">Yes</label>';
84
- } else {
85
- //echo '<label class="sg-control-label backup-guard-label-warning">Please consider enabling WP Cron in order to be able to setup schedules.</label>';
86
- echo '<label class="sg-control-label backup-guard-label-warning">WP cron is disabled on your end. If you don\'t use a custom cron, please, enable the WP cron or else the scheduled (backup) won\'t be successfully implemented.</label>';
87
- }
88
- ?>
89
- </div>
90
- </div>
91
- </fieldset>
92
- </form>
93
- </div>
94
- </div>
95
- </div>
 
1
+ <?php
2
+
3
+ require_once(SG_SCHEDULE_PATH . 'SGSchedule.php');
4
+ $contentClassName = esc_attr(getBackupPageContentClassName('system_info'));
5
+ ?>
6
+ <div id="sg-backup-page-content-system_info" class="sg-backup-page-content <?php echo $contentClassName; ?>">
7
+ <div class="row">
8
+ <div class="col-md-12">
9
+ <form class="form-horizontal" method="post" data-sgform="ajax" data-type="sgsettings">
10
+ <fieldset>
11
+ <div><h1 class="sg-backup-page-title"><?php _backupGuardT('System information') ?></h1></div>
12
+ <div class="form-group">
13
+ <label class="col-md-3 sg-control-label sg-user-info"><?php _backupGuardT('Disk free space'); ?></label>
14
+ <div class="col-md-3 text-left">
15
+ <label class="sg-control-label">
16
+ <?php echo backupGuardDiskFreeSize(SG_APP_ROOT_DIRECTORY); ?>
17
+ </label>
18
+ </div>
19
+ </div>
20
+ <div class="form-group sg-info-wrapper">
21
+ <label class="col-md-3 sg-control-label sg-user-info"><?php _backupGuardT('Memory limit'); ?></label>
22
+ <div class="col-md-3 text-left">
23
+ <label class="sg-control-label"><?php echo SGBoot::$memoryLimit; ?></label>
24
+ </div>
25
+ </div>
26
+ <div class="form-group sg-info-wrapper">
27
+ <label class="col-md-3 sg-control-label sg-user-info">
28
+ <?php _backupGuardT('Max execution time'); ?>
29
+ </label>
30
+ <div class="col-md-3 text-left">
31
+ <label class="sg-control-label"><?php echo SGBoot::$executionTimeLimit; ?></label>
32
+ </div>
33
+ </div>
34
+ <div class="form-group sg-info-wrapper">
35
+ <label class="col-md-3 sg-control-label sg-user-info">
36
+ <?php _backupGuardT('PHP version'); ?>
37
+ </label>
38
+ <div class="col-md-3 text-left">
39
+ <label class="sg-control-label"><?php echo PHP_VERSION; ?></label>
40
+ </div>
41
+ </div>
42
+ <div class="form-group sg-info-wrapper">
43
+ <label class="col-md-3 sg-control-label sg-user-info"><?php _backupGuardT('MySQL version'); ?></label>
44
+ <div class="col-md-3 text-left">
45
+ <label class="sg-control-label"><?php echo SG_MYSQL_VERSION; ?></label>
46
+ </div>
47
+ </div>
48
+ <div class="form-group sg-info-wrapper">
49
+ <label class="col-md-3 sg-control-label sg-user-info">
50
+ <?php _backupGuardT('Int size'); ?>
51
+ </label>
52
+ <div class="col-md-3 text-left">
53
+ <?php echo '<label class="sg-control-label">' . PHP_INT_SIZE . '</label>'; ?>
54
+ <?php
55
+ if (PHP_INT_SIZE < 8) {
56
+ echo '<label class="sg-control-label backup-guard-label-warning">Notice that archive size cannot be bigger than 2GB. This limitaion is comming from system.</label>';
57
+ }
58
+ ?>
59
+ </div>
60
+ </div>
61
+ <div class="form-group sg-info-wrapper">
62
+ <div class="col-md-3 ">
63
+ <label class="sg-control-label sg-user-info"><?php _backupGuardT('Curl version'); ?></label>
64
+ </div>
65
+ <div class="col-md-8 text-left">
66
+ <?php
67
+ if (function_exists('curl_version') && function_exists('curl_exec')) {
68
+ $cv = curl_version();
69
+ echo '<label class="sg-control-label sg-blue-label">' . $cv['version'] . ' / SSL: ' . $cv['ssl_version'] . ' / libz: ' . $cv['libz_version'] . '</label>';
70
+ } else {
71
+ echo '<label class="sg-control-label backup-guard-label-warning">Curl required for BackupGuard for better functioning.</label>';
72
+ }
73
+ ?>
74
+ </div>
75
+ </div>
76
+ <div class="form-group sg-info-wrapper">
77
+ <div class="col-md-3 ">
78
+ <label class="sg-control-label sg-user-info"><?php _backupGuardT('Is cron available'); ?></label>
79
+ </div>
80
+ <div class="col-md-3 text-left">
81
+ <?php
82
+ $isCronAvailable = SGSchedule::isCronAvailable(true);
83
+ if ($isCronAvailable) {
84
+ echo '<label class="sg-control-label">Yes</label>';
85
+ } else {
86
+ //echo '<label class="sg-control-label backup-guard-label-warning">Please consider enabling WP Cron in order to be able to setup schedules.</label>';
87
+ echo '<label class="sg-control-label backup-guard-label-warning">WP cron is disabled on your end. If you don\'t use a custom cron, please, enable the WP cron or else the scheduled (backup) won\'t be successfully implemented.</label>';
88
+ }
89
+ ?>
90
+ </div>
91
+ </div>
92
+ </fieldset>
93
+ </form>
94
+ </div>
95
+ </div>
96
+ </div>
public/videoTutorials.php CHANGED
@@ -1,10 +1,13 @@
1
- <?php
2
- require_once(SG_SCHEDULE_PATH.'SGSchedule.php');
3
- $contentClassName = getBackupPageContentClassName('videoTutorials');
4
- ?>
5
- <div id="sg-backup-page-content-videoTutorials" class="sg-backup-page-content <?php echo $contentClassName; ?>">
6
- <div><h1 class="sg-backup-page-title"><?php _backupGuardT('Video Tutorials')?></h1></div>
7
-
8
- <h2><?php _backupGuardT('BackupGuard WordPress Plugin Walkthrough'); ?></h2>
9
- <iframe width="859" height="483" src="https://www.youtube.com/embed/xn_-FtZNHEw" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
10
- </div>
 
 
 
1
+ <?php
2
+
3
+ require_once SG_SCHEDULE_PATH . 'SGSchedule.php';
4
+ $contentClassName = esc_attr(getBackupPageContentClassName('videoTutorials'));
5
+ ?>
6
+ <div id="sg-backup-page-content-videoTutorials" class="sg-backup-page-content <?php echo $contentClassName; ?>">
7
+ <div><h1 class="sg-backup-page-title"><?php _backupGuardT('Video Tutorials') ?></h1></div>
8
+
9
+ <h2><?php _backupGuardT('BackupGuard WordPress Plugin Walkthrough'); ?></h2>
10
+ <iframe width="859" height="483" src="https://www.youtube.com/embed/xn_-FtZNHEw" frameborder="0"
11
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
12
+ allowfullscreen></iframe>
13
+ </div>