WordPress Backup and Migrate Plugin – Backup Guard - Version 1.2.5

Version Description

  • Admin side improvement
  • Bug fixed related to restore
  • Schedule backup improvement
Download this release

Release Info

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

Code changes from version 1.2.0 to 1.2.5

Files changed (58) hide show
  1. BackupGuard.php +27 -2
  2. README.txt +29 -3
  3. backup.php +3 -2
  4. com/config/config.php +6 -0
  5. com/core/SGBoot.php +27 -0
  6. com/core/backup/SGBackup.php +24 -5
  7. com/core/backup/SGBackupDatabase.php +4 -2
  8. com/core/functions.php +37 -5
  9. com/core/notice/SGNoticeHandler.php +7 -1
  10. com/core/schedule/SGScheduleAdapterWordpress.php +1 -1
  11. com/lib/Request/SGRequestAdapterWordpress.php +22 -19
  12. com/lib/SGAuthClient.php +3 -0
  13. com/lib/SGReviewManager.php +387 -0
  14. public/ajax/checkPHPVersionCompatibility.php +1 -0
  15. public/ajax/deleteBackup.php +1 -0
  16. public/ajax/downloadBackup.php +1 -0
  17. public/ajax/modalImport.php +13 -15
  18. public/ajax/modalManualBackup.php +3 -3
  19. public/ajax/modalManualRestore.php +5 -3
  20. public/ajax/reviewBannerActions.php +32 -0
  21. public/ajax/settings.php +7 -0
  22. public/backups.php +15 -6
  23. public/cloud.php +1 -1
  24. public/css/bgstyle.less.css +182 -66
  25. public/css/bootstrap-switch.min.css +1 -1
  26. public/css/deactivationSurvey.css +6 -0
  27. public/css/popupTheme.css +3333 -0
  28. public/css/styles.css +68 -16
  29. public/img/FAQ.png +0 -0
  30. public/img/TW.png +0 -0
  31. public/img/banerLogo.png +0 -0
  32. public/img/contact-us.png +0 -0
  33. public/img/discount.png +0 -0
  34. public/img/fb.png +0 -0
  35. public/img/full-demo.png +0 -0
  36. public/img/logo-horizontal.png +0 -0
  37. public/img/notice-section-bg.png +0 -0
  38. public/img/reviewBannerLogo.png +0 -0
  39. public/img/section-1-bg.png +0 -0
  40. public/img/sgBackupVerticalLogo.png +0 -0
  41. public/img/sglogo.png +0 -0
  42. public/img/user-manual.png +0 -0
  43. public/img/youtube.png +0 -0
  44. public/include/functions.php +1 -1
  45. public/include/sidebar.php +6 -1
  46. public/include/uninstallSurveyPopup.php +1 -1
  47. public/js/deactivationSurvey.js +1 -0
  48. public/js/jquery.rateyo.js +1 -1
  49. public/js/main.js +2 -1
  50. public/js/popup.js +1518 -0
  51. public/js/sgbackup.js +4 -0
  52. public/js/sgschedule.js +7 -0
  53. public/js/sgsettings.js +1 -1
  54. public/restore_wordpress.php +10 -3
  55. public/schedule.php +1 -1
  56. public/settings.php +15 -4
  57. public/templates/notices/banner.php +1 -3
  58. public/templates/notices/timeout_free_error.php +13 -0
BackupGuard.php CHANGED
@@ -82,7 +82,7 @@ else {
82
 
83
  function backup_guard_admin_menu()
84
  {
85
- add_menu_page('Backups', 'BackupGuard', 'manage_options', 'backup_guard_backups', 'backup_guard_backups_page', 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCA0NjIuOSA1MDEuNCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNDYyLjkgNTAxLjQiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGZpbGw9IiNhMGE1YWEiIGQ9Ik00MjYuOSwxOTkuNmgtMTk4bDAuNCwzNEgyNDZoMTYyLjdjLTAuNSwzLjMtMS4xLDYuNi0xLjcsOS45Yy02LjEsMzMtMTUuMyw2Mi4yLTI3LjcsODcuNkg3OS40Yy0xMi4zLTI1LjQtMjEuNi01NC42LTI3LjctODcuNkMzOS4zLDE3Ni4xLDQ0LDExMS41LDQ3LjIsODMuN0M2Ny43LDkwLjUsODguMyw5NCwxMDguNiw5NGM2MC43LDAsMTAzLjMtMzAuMiwxMjAuOC00NS4xQzI0Ni43LDYzLjgsMjg5LjQsOTQsMzUwLjEsOTRoMGMyMC4zLDAsNDAuOS0zLjUsNjEuNC0xMC4zYzEuNiwxMy45LDMuNSwzNy4xLDMuNiw2NS4xaDIzLjdjMC00Ny40LTUuNS04MS4xLTUuOC04My4zbC0yLjQtMTQuNmwtMTMuNyw1LjZjLTIyLjQsOS4yLTQ0LjgsMTMuOC02Ni43LDEzLjhjMCwwLDAsMCwwLDBjLTY4LjMsMC0xMTEuNy00NS4zLTExMi4xLTQ1LjdsLTguNi05LjJsLTguNyw5LjJjLTAuNCwwLjUtNDMuOCw0NS43LTExMi4xLDQ1LjdjLTIxLjksMC00NC40LTQuNi02Ni43LTEzLjhsLTEzLjctNS42bC0yLjQsMTQuNmMtMC42LDMuNi0xNC40LDg4LjcsMi42LDE4MS42QzM4LjUsMzAyLjQsNTcuNSwzNDguOCw4NC44LDM4NWMzNC42LDQ1LjgsODIuNCw3NS4zLDE0Mi4xLDg3LjdsMi40LDAuNWwyLjQtMC41YzU5LjctMTIuMywxMDcuNS00MS44LDE0Mi4xLTg3LjdjMjcuNC0zNi4zLDQ2LjQtODIuNyw1Ni41LTEzNy45YzMtMTYuMiw1LTMyLjIsNi4zLTQ3LjVMNDI2LjksMTk5LjZMNDI2LjksMTk5LjZ6Ii8+PC9zdmc+', 74);
86
 
87
  add_submenu_page('backup_guard_backups', _backupGuardT('Backups', true), _backupGuardT('Backups', true), 'manage_options', 'backup_guard_backups', 'backup_guard_backups_page');
88
  add_submenu_page('backup_guard_backups', _backupGuardT('Cloud', true), _backupGuardT('Cloud', true), 'manage_options', 'backup_guard_cloud', 'backup_guard_cloud_page');
@@ -293,6 +293,8 @@ function enqueue_backup_guard_scripts($hook)
293
  wp_enqueue_script('backup-guard-rateyo-js', plugin_dir_url(__FILE__).'public/js/jquery.rateyo.js');
294
 
295
  wp_enqueue_script('backup-guard-main-js', plugin_dir_url(__FILE__).'public/js/main.js', array('jquery'), '1.0.0', true);
 
 
296
 
297
  // Localize the script with new data
298
  wp_localize_script('backup-guard-main-js', 'BG_MAIN_STRINGS', array(
@@ -432,9 +434,25 @@ function backup_guard_register_ajax_callbacks()
432
  add_action('wp_ajax_backup_guard_setUserInfoVerificationPopupState', 'backup_guard_set_user_info_verification_popup_state');
433
  add_action('wp_ajax_backup_guard_storeSubscriberInfo', 'backup_guard_store_subscriber_info');
434
  add_action('wp_ajax_backup_guard_storeSurveyResult', 'backup_guard_store_survey_result');
 
 
435
  }
436
  }
437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
  function backup_guard_store_survey_result()
439
  {
440
  check_ajax_referer('backupGuardAjaxNonce', 'token');
@@ -494,7 +512,6 @@ function backup_guard_awake()
494
 
495
  function backup_guard_awake_nopriv()
496
  {
497
- check_ajax_referer('backupGuardAjaxNonce', 'token');
498
  $token = @$_GET['token'];
499
  $method = @$_GET['method'];
500
 
@@ -945,4 +962,12 @@ function backup_guard_discount_notice()
945
  }
946
  </style>
947
  <?php
 
 
 
 
 
 
 
 
948
  }
82
 
83
  function backup_guard_admin_menu()
84
  {
85
+ add_menu_page('Backups', 'BackupGuard', 'manage_options', 'backup_guard_backups', 'backup_guard_backups_page', 'data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MzAuMzQgNjYzLjAzIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkFydGJvYXJkIDI8L3RpdGxlPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTUzMC4xMSwxODUuNzljLTcxLjktOC44Mi0xMzcuNzMtNDAtMTkwLTg2LjU3djkyLjY1YTI4MC41OSwyODAuNTksMCwwLDAsMTE2LjUyLDUyYy05LjE0LDg5LjQzLTUyLDE2OS41NS0xMTYuNTIsMjI4Ljg3djkwLjRDNDU5Ljg0LDQ3Ny4xMyw1MzAuNiwzMzMuNDIsNTMwLjExLDE4NS43OVoiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xNzQuMjksMjQ0YTI4MC40NiwyODAuNDYsMCwwLDAsMTE1Ljc3LTUxLjExVjEwMGMtNTIuNDQsNDYuMjgtMTE3LjYyLDc3LTE4OS44Myw4NS4xNUM5OS41NCwzMzMsMTcwLjIyLDQ3Ni44MiwyOTAuMDYsNTYzVjQ3Mi4wOUMyMjYsNDEyLjg2LDE4My40MiwzMzMuMDYsMTc0LjI5LDI0NFoiLz48L3N2Zz4=', 74);
86
 
87
  add_submenu_page('backup_guard_backups', _backupGuardT('Backups', true), _backupGuardT('Backups', true), 'manage_options', 'backup_guard_backups', 'backup_guard_backups_page');
88
  add_submenu_page('backup_guard_backups', _backupGuardT('Cloud', true), _backupGuardT('Cloud', true), 'manage_options', 'backup_guard_cloud', 'backup_guard_cloud_page');
293
  wp_enqueue_script('backup-guard-rateyo-js', plugin_dir_url(__FILE__).'public/js/jquery.rateyo.js');
294
 
295
  wp_enqueue_script('backup-guard-main-js', plugin_dir_url(__FILE__).'public/js/main.js', array('jquery'), '1.0.0', true);
296
+ wp_enqueue_script('backup-popup.js', plugin_dir_url(__FILE__).'public/js/popup.js', array('jquery'), '1.0.0', true);
297
+ wp_enqueue_style('popupTheme.css', plugin_dir_url(__FILE__).'public/css/popupTheme.css');
298
 
299
  // Localize the script with new data
300
  wp_localize_script('backup-guard-main-js', 'BG_MAIN_STRINGS', array(
434
  add_action('wp_ajax_backup_guard_setUserInfoVerificationPopupState', 'backup_guard_set_user_info_verification_popup_state');
435
  add_action('wp_ajax_backup_guard_storeSubscriberInfo', 'backup_guard_store_subscriber_info');
436
  add_action('wp_ajax_backup_guard_storeSurveyResult', 'backup_guard_store_survey_result');
437
+ add_action('wp_ajax_backup_guard_reviewDontShow', 'backup_guard_review_dont_show');
438
+ add_action('wp_ajax_backup_guard_review_later', 'backup_guard_review_later');
439
  }
440
  }
441
 
442
+ function backup_guard_review_dont_show()
443
+ {
444
+ check_ajax_referer('backupGuardAjaxNonce', 'token');
445
+ SGConfig::set('closeReviewBanner', 1);
446
+ wp_die();
447
+ }
448
+
449
+ function backup_guard_review_later()
450
+ {
451
+ check_ajax_referer('backupGuardAjaxNonce', 'token');
452
+ require_once(SG_PUBLIC_AJAX_PATH.'reviewBannerActions.php');
453
+ wp_die();
454
+ }
455
+
456
  function backup_guard_store_survey_result()
457
  {
458
  check_ajax_referer('backupGuardAjaxNonce', 'token');
512
 
513
  function backup_guard_awake_nopriv()
514
  {
 
515
  $token = @$_GET['token'];
516
  $method = @$_GET['method'];
517
 
962
  }
963
  </style>
964
  <?php
965
+ }
966
+
967
+ add_action('admin_notices', 'backup_guard_review_banner');
968
+ function backup_guard_review_banner()
969
+ {
970
+ require_once(SG_LIB_PATH.'SGReviewManager.php');
971
+ $reviewManager = new SGReviewManager();
972
+ $reviewManager->renderContent();
973
  }
README.txt CHANGED
@@ -5,8 +5,8 @@ Author: Backup Guard
5
  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: 3.8
8
- Tested up to: 5.3
9
- Stable tag: 1.2.0
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -157,6 +157,32 @@ When you are facing an issue of any kind with any of our products, the first thi
157
  6. Site backup customization
158
 
159
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  = 1.2.0 =
161
  * Security improvements
162
  * Amazon S3 bug fixed
@@ -531,4 +557,4 @@ When you are facing an issue of any kind with any of our products, the first thi
531
  * Minor backup related bug fixes
532
 
533
  = 1.0 =
534
- * Initial backup plugin was commit
5
  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: 3.8
8
+ Tested up to: 5.4
9
+ Stable tag: 1.2.5
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
157
  6. Site backup customization
158
 
159
  == Changelog ==
160
+ = 1.2.5 =
161
+ * Admin side improvement
162
+ * Bug fixed related to restore
163
+ * Schedule backup improvement
164
+
165
+ = 1.2.4 =
166
+ * Bug fixed related to restore
167
+ * Bug fixed related to plugin deactivation
168
+ * Login issue fixed
169
+
170
+ = 1.2.3 =
171
+ * Backup import modal improvement
172
+ * Schedule improvement
173
+ * Delete backup improvement
174
+ * Bug fixes
175
+
176
+ = 1.2.2 =
177
+ * Admin side redesign
178
+ * Download via PHP settings
179
+ * Bug fixes
180
+
181
+ = 1.2.1 =
182
+ * Schedule bug fixed
183
+ * Settings save bug fixed
184
+ * Bug fixed related to CSS design conflict.
185
+
186
  = 1.2.0 =
187
  * Security improvements
188
  * Amazon S3 bug fixed
557
  * Minor backup related bug fixes
558
 
559
  = 1.0 =
560
+ * Initial backup plugin was commit
backup.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
 
2
  /**
3
  * Plugin Name: Backup
4
  * Plugin URI: https://backup-guard.com/products/backup-wordpress
5
  * 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.
6
- * Version: 1.2.0
7
  * Author: BackupGuard
8
  * Author URI: https://backup-guard.com/products/backup-wordpress
9
  * License: GPL-2.0+
@@ -15,7 +16,7 @@ if (function_exists('activate_backup_guard')) {
15
  }
16
 
17
  if (!defined('SG_BACKUP_GUARD_VERSION')) {
18
- define('SG_BACKUP_GUARD_VERSION', '1.2.0');
19
  }
20
 
21
  if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
1
  <?php
2
+
3
  /**
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.2.5
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.2.5');
20
  }
21
 
22
  if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
com/config/config.php CHANGED
@@ -161,6 +161,10 @@ define('SG_BACKUP_DOWNLOAD_TYPE_SGBP', 1);
161
  define('SG_BACKUP_DOWNLOAD_TYPE_BACKUP_LOG', 2);
162
  define('SG_BACKUP_DOWNLOAD_TYPE_RESTORE_LOG', 3);
163
 
 
 
 
 
164
  //The following constants can be modified at run-time
165
  define('SG_ACTION_BACKUP_FILES_AVAILABLE', 1);
166
  define('SG_ACTION_BACKUP_DATABASE_AVAILABLE', 1);
@@ -177,6 +181,8 @@ define('SG_SSH_KEY_FILE_FOLDER_NAME', 'sshKeyFolder/');
177
  define('SG_MIGRATION_SERVICE_URL', 'https://backup-guard.com/services/migrate-wordpress');
178
  define('BACKUP_GUARD_PRIVACY_POLICY_URL', "https://backup-guard.com/privacy");
179
  define('BACKUP_GUARD_TERMS_OF_SERVICE_URL', 'https://backup-guard.com/terms');
 
 
180
 
181
  define('SG_RESTORE_MODE_FULL', 'full');
182
  define('SG_RESTORE_MODE_FILES', 'files');
161
  define('SG_BACKUP_DOWNLOAD_TYPE_BACKUP_LOG', 2);
162
  define('SG_BACKUP_DOWNLOAD_TYPE_RESTORE_LOG', 3);
163
 
164
+ define('SG_BACKUP_REVIEW_BACKUP_COUNT', 3);
165
+ define('SG_BACKUP_REVIEW_RESTORE_COUNT', 1);
166
+ define('SG_BACKUP_REVIEW_PERIOD', 30);
167
+
168
  //The following constants can be modified at run-time
169
  define('SG_ACTION_BACKUP_FILES_AVAILABLE', 1);
170
  define('SG_ACTION_BACKUP_DATABASE_AVAILABLE', 1);
181
  define('SG_MIGRATION_SERVICE_URL', 'https://backup-guard.com/services/migrate-wordpress');
182
  define('BACKUP_GUARD_PRIVACY_POLICY_URL', "https://backup-guard.com/privacy");
183
  define('BACKUP_GUARD_TERMS_OF_SERVICE_URL', 'https://backup-guard.com/terms');
184
+ define('BACKUP_GUARD_WORDPRESS_SUPPORT_URL', 'https://wordpress.org/support/plugin/backup/');
185
+ define('BACKUP_GUARD_WORDPRESS_REVIEW_URL', 'https://wordpress.org/support/plugin/backup/reviews/?filter=5');
186
 
187
  define('SG_RESTORE_MODE_FULL', 'full');
188
  define('SG_RESTORE_MODE_FILES', 'files');
com/core/SGBoot.php CHANGED
@@ -173,12 +173,39 @@ class SGBoot
173
  if (!self::installActionTable($sgdb)) {
174
  throw new SGExceptionDatabaseError('Could not install action table');
175
  }
 
 
176
  }
177
  catch (SGException $exception) {
178
  die($exception);
179
  }
180
  }
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  private static function cleanupSchedules()
183
  {
184
  $schedules = SGBackupSchedule::getAllSchedules();
173
  if (!self::installActionTable($sgdb)) {
174
  throw new SGExceptionDatabaseError('Could not install action table');
175
  }
176
+
177
+ self::installReviewSettings();
178
  }
179
  catch (SGException $exception) {
180
  die($exception);
181
  }
182
  }
183
 
184
+ private static function installReviewSettings()
185
+ {
186
+ $usageDays = SGConfig::get('usageDays');
187
+ if (!$usageDays) {
188
+ SGConfig::set('usageDays', 0);
189
+
190
+ $timeDate = new \DateTime('now');
191
+ $installTime = strtotime($timeDate->format('Y-m-d H:i:s'));
192
+ SGConfig::set('installDate', $installTime);
193
+ $timeDate->modify('+'.SG_BACKUP_REVIEW_PERIOD.' day');
194
+
195
+ $timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
196
+ SGConfig::set('openNextTime', $timeNow);
197
+ }
198
+ $backupCountReview = SGConfig::get('backupReviewCount');
199
+ if (!$backupCountReview) {
200
+ SGConfig::set('backupReviewCount', SG_BACKUP_REVIEW_BACKUP_COUNT);
201
+ }
202
+
203
+ $restoreReviewCount = SGConfig::get('restoreReviewCount');
204
+ if (!$restoreReviewCount) {
205
+ SGConfig::set('restoreReviewCount', SG_BACKUP_REVIEW_RESTORE_COUNT);
206
+ }
207
+ }
208
+
209
  private static function cleanupSchedules()
210
  {
211
  $schedules = SGBackupSchedule::getAllSchedules();
com/core/backup/SGBackup.php CHANGED
@@ -518,6 +518,7 @@ class SGBackup implements SGIBackupDelegate
518
  @unlink(SG_BACKUP_DIRECTORY.SG_STATE_FILE_NAME);
519
  @unlink(SG_BACKUP_DIRECTORY.SG_RELOADER_STATE_FILE_NAME);
520
  @unlink(SG_PING_FILE_PATH);
 
521
  }
522
 
523
  private function cleanUp()
@@ -531,7 +532,7 @@ class SGBackup implements SGIBackupDelegate
531
  private function getBackupFileName()
532
  {
533
  if (SGConfig::get("SG_CUSTOM_BACKUP_NAME")) {
534
- return SGConfig::get("SG_CUSTOM_BACKUP_NAME");
535
  }
536
 
537
  $sgBackupPrefix = SG_BACKUP_FILE_NAME_DEFAULT_PREFIX;
@@ -553,7 +554,7 @@ class SGBackup implements SGIBackupDelegate
553
  }
554
 
555
  //create backup folder
556
- if (!@mkdir($backupPath))
557
  {
558
  throw new SGExceptionMethodNotAllowed('Cannot create folder: '.$backupPath);
559
  }
@@ -731,6 +732,7 @@ class SGBackup implements SGIBackupDelegate
731
  if($restoreFiles != NULL) {
732
  $this->restoreFiles = $restoreFiles;
733
  }
 
734
  $this->prepareForRestore($backupName);
735
 
736
  if ($this->state && ($this->state->getAction() == SG_STATE_ACTION_RESTORING_DATABASE || $this->state->getAction() == SG_STATE_ACTION_MIGRATING_DATABASE)) {
@@ -1358,20 +1360,37 @@ class SGBackup implements SGIBackupDelegate
1358
  public static function download($filename, $type)
1359
  {
1360
  $backupDirectory = SG_BACKUP_DIRECTORY.$filename.'/';
 
 
1361
 
1362
  switch ($type)
1363
  {
1364
  case SG_BACKUP_DOWNLOAD_TYPE_SGBP:
1365
  $filename .= '.sgbp';
1366
- backupGuardDownloadFileSymlink($backupDirectory, $filename);
 
 
 
 
 
1367
  break;
1368
  case SG_BACKUP_DOWNLOAD_TYPE_BACKUP_LOG:
1369
  $filename .= '_backup.log';
1370
- backupGuardDownloadFile($backupDirectory.$filename, 'text/plain');
 
 
 
 
 
1371
  break;
1372
  case SG_BACKUP_DOWNLOAD_TYPE_RESTORE_LOG:
1373
  $filename .= '_restore.log';
1374
- backupGuardDownloadFile($backupDirectory.$filename, 'text/plain');
 
 
 
 
 
1375
  break;
1376
  }
1377
 
518
  @unlink(SG_BACKUP_DIRECTORY.SG_STATE_FILE_NAME);
519
  @unlink(SG_BACKUP_DIRECTORY.SG_RELOADER_STATE_FILE_NAME);
520
  @unlink(SG_PING_FILE_PATH);
521
+ SGConfig::set("SG_CUSTOM_BACKUP_NAME", '');
522
  }
523
 
524
  private function cleanUp()
532
  private function getBackupFileName()
533
  {
534
  if (SGConfig::get("SG_CUSTOM_BACKUP_NAME")) {
535
+ return backupGuardRemoveSlashes(SGConfig::get("SG_CUSTOM_BACKUP_NAME"));
536
  }
537
 
538
  $sgBackupPrefix = SG_BACKUP_FILE_NAME_DEFAULT_PREFIX;
554
  }
555
 
556
  //create backup folder
557
+ if (!file_exists($backupPath) && !@mkdir($backupPath))
558
  {
559
  throw new SGExceptionMethodNotAllowed('Cannot create folder: '.$backupPath);
560
  }
732
  if($restoreFiles != NULL) {
733
  $this->restoreFiles = $restoreFiles;
734
  }
735
+ $backupName = backupGuardRemoveSlashes($backupName);
736
  $this->prepareForRestore($backupName);
737
 
738
  if ($this->state && ($this->state->getAction() == SG_STATE_ACTION_RESTORING_DATABASE || $this->state->getAction() == SG_STATE_ACTION_MIGRATING_DATABASE)) {
1360
  public static function download($filename, $type)
1361
  {
1362
  $backupDirectory = SG_BACKUP_DIRECTORY.$filename.'/';
1363
+ $backupName = $filename;
1364
+ $downloadViaPhp = SGConfig::get('SG_DOWNLOAD_VIA_PHP');
1365
 
1366
  switch ($type)
1367
  {
1368
  case SG_BACKUP_DOWNLOAD_TYPE_SGBP:
1369
  $filename .= '.sgbp';
1370
+ if ($downloadViaPhp) {
1371
+ backupGuardDownloadViaPhp($backupName, $filename);
1372
+ }
1373
+ else {
1374
+ backupGuardDownloadFileSymlink($backupDirectory, $filename);
1375
+ }
1376
  break;
1377
  case SG_BACKUP_DOWNLOAD_TYPE_BACKUP_LOG:
1378
  $filename .= '_backup.log';
1379
+ if ($downloadViaPhp) {
1380
+ backupGuardDownloadViaPhp($backupName, $filename);
1381
+ }
1382
+ else {
1383
+ backupGuardDownloadFile($backupDirectory.$filename, 'text/plain');
1384
+ }
1385
  break;
1386
  case SG_BACKUP_DOWNLOAD_TYPE_RESTORE_LOG:
1387
  $filename .= '_restore.log';
1388
+ if ($downloadViaPhp) {
1389
+ backupGuardDownloadViaPhp($backupName, $filename);
1390
+ }
1391
+ else {
1392
+ backupGuardDownloadFile($backupDirectory.$filename, 'text/plain');
1393
+ }
1394
  break;
1395
  }
1396
 
com/core/backup/SGBackupDatabase.php CHANGED
@@ -331,7 +331,7 @@ class SGBackupDatabase implements SGIMysqldumpDelegate
331
 
332
  private function replaceInvalidCharacters($str)
333
  {
334
- return preg_replace('/\x00/', '', $str);;
335
  }
336
 
337
  private function getDatabaseHeaders()
@@ -363,6 +363,8 @@ class SGBackupDatabase implements SGIMysqldumpDelegate
363
  $this->currentRowCount = $sgDBState->getProgressCursor();
364
  $this->nextProgressUpdate = $sgDBState->getProgress();
365
  $this->warningsFound = $sgDBState->getWarningsFound();
 
 
366
  }
367
 
368
  while (($row = @fgets($fileHandle)) !== false) {
@@ -379,7 +381,7 @@ class SGBackupDatabase implements SGIMysqldumpDelegate
379
  }
380
 
381
  if ($trimmedRow && substr($trimmedRow, -9) == "/*SGEnd*/") {
382
- $queries = explode("/*SGEnd*/".PHP_EOL, $this->getDatabaseHeaders().$importQuery);
383
  foreach ($queries as $query) {
384
  if (!$query) {
385
  continue;
331
 
332
  private function replaceInvalidCharacters($str)
333
  {
334
+ return $str;//preg_replace('/\x00/', '', $str);;
335
  }
336
 
337
  private function getDatabaseHeaders()
363
  $this->currentRowCount = $sgDBState->getProgressCursor();
364
  $this->nextProgressUpdate = $sgDBState->getProgress();
365
  $this->warningsFound = $sgDBState->getWarningsFound();
366
+
367
+ $importQuery = $this->getDatabaseHeaders();
368
  }
369
 
370
  while (($row = @fgets($fileHandle)) !== false) {
381
  }
382
 
383
  if ($trimmedRow && substr($trimmedRow, -9) == "/*SGEnd*/") {
384
+ $queries = explode("/*SGEnd*/".PHP_EOL, $importQuery);
385
  foreach ($queries as $query) {
386
  if (!$query) {
387
  continue;
com/core/functions.php CHANGED
@@ -455,9 +455,30 @@ function backupGuardDownloadFile($file, $type = 'application/octet-stream')
455
  exit;
456
  }
457
 
458
- function backupGuardDownloadFileSymlink($safedir, $filename)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  {
460
- $safedir = backupGuardRemoveSlashes($safedir);
461
  $filename = backupGuardRemoveSlashes($filename);
462
 
463
  $downloaddir = SG_SYMLINK_PATH;
@@ -472,8 +493,8 @@ function backupGuardDownloadFileSymlink($safedir, $filename)
472
  $string = '';
473
 
474
  for ($i = 1; $i <= rand(4,12); $i++) {
475
- $q = rand(1,24);
476
- $string = $string.$letters[$q];
477
  }
478
 
479
  $handle = opendir($downloaddir);
@@ -489,8 +510,19 @@ function backupGuardDownloadFileSymlink($safedir, $filename)
489
  }
490
 
491
  closedir($handle);
492
-
493
  mkdir($downloaddir . $string, 0777);
 
 
 
 
 
 
 
 
 
 
 
 
494
  $res = @symlink($safedir . $filename, $downloaddir . $string . "/" . $filename);
495
  if ($res) {
496
  header('Content-Description: File Transfer');
455
  exit;
456
  }
457
 
458
+ function backupGuardDownloadViaPhp($backupName, $fileName)
459
+ {
460
+ $str = backupGuardMakeSymlinkFolder($fileName);
461
+ @copy(SG_BACKUP_DIRECTORY.$backupName.'/'.$fileName, SG_SYMLINK_PATH.$str.'/'.$fileName);
462
+
463
+ if (file_exists(SG_SYMLINK_PATH.$str.'/'.$fileName)) {
464
+ $remoteGet = wp_remote_get(SG_SYMLINK_URL.$str.'/'.$fileName);
465
+ if (!is_wp_error($remoteGet)) {
466
+ $content = wp_remote_retrieve_body($remoteGet);
467
+ header('Pragma: public');
468
+ header('Expires: 0');
469
+ header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
470
+ header('Cache-Control: private', false);
471
+ header('Content-Type: application/octet-stream');
472
+ header('Content-Disposition: attachment; filename='.$fileName.';');
473
+ header('Content-Transfer-Encoding: binary');
474
+ echo $content;
475
+ exit;
476
+ }
477
+ }
478
+ }
479
+
480
+ function backupGuardMakeSymlinkFolder($filename)
481
  {
 
482
  $filename = backupGuardRemoveSlashes($filename);
483
 
484
  $downloaddir = SG_SYMLINK_PATH;
493
  $string = '';
494
 
495
  for ($i = 1; $i <= rand(4,12); $i++) {
496
+ $q = rand(1,24);
497
+ $string = $string.$letters[$q];
498
  }
499
 
500
  $handle = opendir($downloaddir);
510
  }
511
 
512
  closedir($handle);
 
513
  mkdir($downloaddir . $string, 0777);
514
+
515
+ return $string;
516
+ }
517
+
518
+ function backupGuardDownloadFileSymlink($safedir, $filename)
519
+ {
520
+ $downloaddir = SG_SYMLINK_PATH;
521
+ $downloadURL = SG_SYMLINK_URL;
522
+
523
+ $safedir = backupGuardRemoveSlashes($safedir);
524
+ $string = backupGuardMakeSymlinkFolder($filename);
525
+
526
  $res = @symlink($safedir . $filename, $downloaddir . $string . "/" . $filename);
527
  if ($res) {
528
  header('Content-Description: File Transfer');
com/core/notice/SGNoticeHandler.php CHANGED
@@ -12,8 +12,14 @@ class SGNoticeHandler
12
 
13
  private function checkTimeoutError()
14
  {
 
15
  if (SGConfig::get('SG_EXCEPTION_TIMEOUT_ERROR')) {
16
- SGNotice::getInstance()->addNoticeFromTemplate('timeout_error', SG_NOTICE_ERROR, true);
 
 
 
 
 
17
  }
18
  }
19
 
12
 
13
  private function checkTimeoutError()
14
  {
15
+ $pluginCapabilities = backupGuardGetCapabilities();
16
  if (SGConfig::get('SG_EXCEPTION_TIMEOUT_ERROR')) {
17
+ if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE) {
18
+ SGNotice::getInstance()->addNoticeFromTemplate('timeout_error', SG_NOTICE_ERROR, true);
19
+ }
20
+ else {
21
+ SGNotice::getInstance()->addNoticeFromTemplate('timeout_free_error', SG_NOTICE_ERROR, true);
22
+ }
23
  }
24
  }
25
 
com/core/schedule/SGScheduleAdapterWordpress.php CHANGED
@@ -119,6 +119,6 @@ class SGScheduleAdapterWordpress implements SGIScheduleAdapter
119
 
120
  public static function isCronAvailable()
121
  {
122
- return defined('DISABLE_WP_CRON')?DISABLE_WP_CRON:true;
123
  }
124
  }
119
 
120
  public static function isCronAvailable()
121
  {
122
+ return defined('DISABLE_WP_CRON')?!DISABLE_WP_CRON:true;
123
  }
124
  }
com/lib/Request/SGRequestAdapterWordpress.php CHANGED
@@ -49,6 +49,21 @@ class SGRequestAdapterWordpress implements SGIRequestAdapter
49
  $this->params = $params;
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  public function sendPostRequest()
53
  {
54
  $body = null;
@@ -58,12 +73,8 @@ class SGRequestAdapterWordpress implements SGIRequestAdapter
58
  $body = $this->params;
59
  }
60
 
61
- $args = array(
62
- 'headers' => $this->headers,
63
- 'sslverify' => false,
64
- 'body' => $body,
65
- 'stream' => $this->stream
66
- );
67
 
68
  $response = wp_remote_post($this->url, $args);
69
  if ($this->stream && !($response instanceof WP_Error)) {
@@ -91,11 +102,7 @@ class SGRequestAdapterWordpress implements SGIRequestAdapter
91
 
92
  public function sendGetRequest()
93
  {
94
- $args = array(
95
- 'headers' => $this->headers,
96
- 'sslverify' => false,
97
- 'stream' => $this->stream
98
- );
99
 
100
  if (count($this->params)) {
101
  $this->url = rtrim($this->url, '/').'/';
@@ -141,14 +148,10 @@ class SGRequestAdapterWordpress implements SGIRequestAdapter
141
  $body = $this->params;
142
  }
143
 
144
- $args = array(
145
- 'headers' => $this->headers,
146
- 'sslverify' => false,
147
- 'method' => $type,
148
- 'body' => $body,
149
- 'stream' => $this->stream
150
- );
151
-
152
  $response = wp_remote_request($this->url, $args);
153
  if ($this->stream && !($response instanceof WP_Error)) {
154
  $this->body = file_get_contents($response['filename']);
49
  $this->params = $params;
50
  }
51
 
52
+ public function getRequestArgs()
53
+ {
54
+ $args = array(
55
+ 'headers' => $this->headers,
56
+ 'sslverify' => false,
57
+ 'stream' => $this->stream
58
+ );
59
+
60
+ if (!function_exists("curl_init")) {
61
+ $args['sslverify'] = true;
62
+ }
63
+
64
+ return $args;
65
+ }
66
+
67
  public function sendPostRequest()
68
  {
69
  $body = null;
73
  $body = $this->params;
74
  }
75
 
76
+ $args = $this->getRequestArgs();
77
+ $args['body'] = $body;
 
 
 
 
78
 
79
  $response = wp_remote_post($this->url, $args);
80
  if ($this->stream && !($response instanceof WP_Error)) {
102
 
103
  public function sendGetRequest()
104
  {
105
+ $args = $this->getRequestArgs();
 
 
 
 
106
 
107
  if (count($this->params)) {
108
  $this->url = rtrim($this->url, '/').'/';
148
  $body = $this->params;
149
  }
150
 
151
+ $args = $this->getRequestArgs();
152
+ $args['body'] = $body;
153
+ $args['method'] = $type;
154
+
 
 
 
 
155
  $response = wp_remote_request($this->url, $args);
156
  if ($this->stream && !($response instanceof WP_Error)) {
157
  $this->body = file_get_contents($response['filename']);
com/lib/SGAuthClient.php CHANGED
@@ -109,6 +109,9 @@ class SGAuthClient
109
 
110
  public function isAnyLicenseAvailable($products)
111
  {
 
 
 
112
  foreach ($products as $product) {
113
  if (!$product['licenses']) {
114
  return true;
109
 
110
  public function isAnyLicenseAvailable($products)
111
  {
112
+ if (empty($products) || $products == -1) {
113
+ return false;
114
+ }
115
  foreach ($products as $product) {
116
  if (!$product['licenses']) {
117
  return true;
com/lib/SGReviewManager.php ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SGReviewManager
4
+ {
5
+ public function renderContent()
6
+ {
7
+ $dontShowAgain = SGConfig::get('closeReviewBanner');
8
+ if ($dontShowAgain) {
9
+ return '';
10
+ }
11
+ // review with backup Count
12
+ $allowReviewCount = $this->isAllowToShowReviewByCount();
13
+ if ($allowReviewCount) {
14
+ // show review
15
+ $key = 'backupCount';
16
+ $backupCountReview = $this->getBackupCounts();
17
+ $customContent = 'Yay! We see that you have made '.$backupCountReview.' backups.';
18
+ echo $this->reviewContentMessage($customContent, $key);
19
+ return '';
20
+ }
21
+ // review after successfully restore
22
+ $isSuccessFullRestore = $this->isSuccessFullRestore();
23
+ if ($isSuccessFullRestore) {
24
+ // after successfully restore
25
+ $key = 'restoreCount';
26
+ $restoreReviewCount = $this->getBackupRestoreCounts();
27
+ $customContent = 'Yay! Congrats, you have restored your website for the '.$restoreReviewCount.' st time!';
28
+ echo $this->reviewContentMessage($customContent, $key);
29
+ return '';
30
+ }
31
+
32
+ // review after X days
33
+ $isAllowDaysReview = $this->isAllowDaysReview();
34
+ if ($isAllowDaysReview) {
35
+ $key = 'dayCount';
36
+ $usageDays = $this->getBackupUsageDays();
37
+ $customContent = 'Yay! You are a part of the BG team for over '.$usageDays.' days now! Hope you enjoy our service!';
38
+ echo $this->reviewContentMessage($customContent, $key);
39
+ return '';
40
+ }
41
+
42
+ return '';
43
+ }
44
+
45
+ public static function getBackupUsageDays()
46
+ {
47
+ $installDate = SGConfig::get('installDate');
48
+
49
+ $timeDate = new \DateTime('now');
50
+ $timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
51
+ $diff = $timeNow-$installDate;
52
+ $days = floor($diff/(60*60*24));
53
+
54
+ return $days;
55
+ }
56
+
57
+ public function reviewContentMessage($customContent, $type)
58
+ {
59
+ ob_start();
60
+ ?>
61
+ <style>
62
+ .sg-backup-buttons-wrapper .press{
63
+ box-sizing:border-box;
64
+ cursor:pointer;
65
+ display:inline-block;
66
+ margin:0;
67
+ padding:0.5em 0.75em;
68
+ text-decoration:none;
69
+ transition:background 0.15s linear
70
+ width: 148px;
71
+ height: 50px;
72
+ }
73
+ .sg-backup-buttons-wrapper .press-grey {
74
+ border:2px solid #FFFFFF;
75
+ color: #FFF;
76
+ }
77
+ .sg-backup-buttons-wrapper .press-lightblue {
78
+ background-color:#ffffff;
79
+ border:2px solid #FFFFFF;
80
+ color: rgba(0,29,182,1);
81
+ margin: 0 20px;
82
+ }
83
+ .sg-backup-buttons-wrapper .press-lightblue:hover {
84
+ background-color: rgba(0, 0, 0, 0);
85
+ color: #FFFFFF;
86
+ }
87
+ .sg-backup-buttons-wrapper {
88
+ text-align: center;
89
+ }
90
+ .sg-backup-review-wrapper {
91
+ position: relative;
92
+ text-align: center;
93
+ background-color: #001DB6;
94
+ height: 185px;
95
+ box-sizing: border-box;
96
+ background-image: url(<?php echo SG_IMAGE_URL.'reviewBg.png' ?>);
97
+ margin-top: 45px;
98
+ margin-right: 20px;
99
+ }
100
+ .sgpb-popup-dialog-main-div-wrapper .sg-backup-review-wrapper {
101
+ margin-top: 0px;
102
+ margin-right: 0px ;
103
+ }
104
+ .sgpb-popup-dialog-main-div-wrapper .banner-x {
105
+ display: none !important;
106
+ }
107
+ .sg-backup-review-wrapper p {
108
+ color: #FFFFFF;
109
+ }
110
+ .sg-backup-review-h1 {
111
+ font-size: 22px;
112
+ font-weight: normal;
113
+ line-height: 1.384;
114
+ }
115
+ .sg-backup-review-h2 {
116
+ font-size: 23px;
117
+ font-weight: bold;
118
+ color: #FFFFFF;
119
+ margin: 10px 0;
120
+ margin-top: 30px;
121
+ }
122
+ :root {
123
+ --main-bg-color: #1ac6ff;
124
+ }
125
+ .sg-backup-review-strong {
126
+ color: var(--main-bg-color);
127
+ }
128
+ .sg-backup-review-mt20 {
129
+ margin-top: 10px;
130
+ color: #FFFFFF !important;
131
+ margin-bottom: 20px;
132
+ }
133
+ .sg-backup-wow {
134
+ font-size: 35px;
135
+ color: #FFFFFF;
136
+ margin: 15px 0;
137
+ padding-top: 16px;
138
+ }
139
+ .sg-backup-review-button {
140
+ font-size: 15px !important;
141
+ font-weight: bold;
142
+ border-radius: 8px !important;
143
+ width: 120px !important;
144
+ height: 40px !important;
145
+ }
146
+ .sg-backup-button-1, .sg-backup-backup-button-2 {
147
+ background-color: rgba(0, 0, 0, 0) !important;
148
+ color: #ffffff !important;
149
+ }
150
+ .sg-backup-button-1:hover, .sg-backup-backup-button-2:hover {
151
+ background-color: #FFFFFF !important;
152
+ color: #001DB6 !important;
153
+ border: 2px solid #FFFFFF;
154
+ }
155
+ .sg-backup-custom-content {
156
+ color: #FFFFFF;
157
+ font-size: 20px;
158
+ margin: 14px 0;
159
+ }
160
+ .sg-backup-img-wrapper,
161
+ .sg-backup-review-description-wrapper {
162
+ display: inline-block;
163
+ }
164
+ .sg-backup-img-wrapper {
165
+ width: 256px;
166
+ float: left;
167
+ background-color: #FFFFFF;
168
+ height: 100%;
169
+ }
170
+ .sg-backup-review-description-wrapper {
171
+ max-width: 100%;
172
+ vertical-align: top;
173
+ }
174
+ .sgpb-popup-dialog-main-div-wrapper .sg-backup-review-description {
175
+ padding: 0 30px;
176
+ }
177
+ .banner-x {
178
+ position: absolute;
179
+ right: 14px;
180
+ top: 5px;
181
+ display: inline !important;
182
+ cursor: pointer;
183
+ width: auto !important;
184
+ height: auto !important;
185
+ }
186
+ .banner-x:hover {
187
+ background-color: #071cb6 !important;
188
+ color: #ffffff !important;
189
+ border: none !important;
190
+ }
191
+ @media (max-width: 1350px) {
192
+ .sg-backup-wow {
193
+ font-size: 27px;
194
+ }
195
+ .sgpb-popup-dialog-main-div-wrapper .sg-backup-review-description {
196
+ padding: 0 5px;
197
+ }
198
+ }
199
+
200
+ </style>
201
+ <div id="sg-backup-review-wrapper" class="sg-backup-review-wrapper">
202
+ <span class="banner-x sg-backup-review-button sg-backup-backup-button-2 sg-backup-show-popup-period" data-message-type="<?php echo $type; ?>">x</span>
203
+ <div class="sg-backup-img-wrapper">
204
+ <img src="<?php echo SG_IMAGE_URL; ?>sgBackupVerticalLogo.png" width="200px" height="181px">
205
+ </div>
206
+ <div class="sg-backup-review-description-wrapper">
207
+ <div class="sg-backup-review-description">
208
+ <!-- <h2 class="sg-backup-custom-content"></h2>-->
209
+ <h2 class="sg-backup-review-h2"><?php echo $customContent; ?></h2>
210
+ <p class="sg-backup-review-mt20"><?php _e('Have your input in the development of our plugin, and we’ll get better and happier. Leave your 5-star positive review and help <br> us go further to the perfection!'); ?></p>
211
+ </div>
212
+ <div class="sg-backup-buttons-wrapper">
213
+ <button class="press press-grey sg-backup-review-button sg-backup-button-1 sg-already-did-review"><?php _e('I already did'); ?></button>
214
+ <button class="press press-lightblue sg-backup-review-button sg-backup-button-3 sg-backup-you-worth-it"><?php _e('You worth it!'); ?></button>
215
+ <button class="press press-grey sg-backup-review-button sg-backup-backup-button-2 sg-backup-show-popup-period" data-message-type="<?php echo $type; ?>"><?php _e('Maybe later'); ?></button>
216
+ </div>
217
+ </div>
218
+ </div>
219
+ <script type="text/javascript">
220
+ var closeBackupGuardReviewPopup = function ()
221
+ {
222
+ if (window.backupGuardReviewPopup) {
223
+ window.backupGuardReviewPopup.close();
224
+ }
225
+ };
226
+ var sgBackupDontShowAgain = function() {
227
+ closeBackupGuardReviewPopup();
228
+ jQuery('.sg-backup-review-wrapper').remove();
229
+ var data = {
230
+ action: 'backup_guard_reviewDontShow',
231
+ token: BG_BACKUP_STRINGS.nonce
232
+ };
233
+ jQuery.post(ajaxurl, data, function () {
234
+ });
235
+ };
236
+ var backupGuardReviewBannerButtons = function() {
237
+ jQuery('.sg-backup-button-3').bind('click', function () {
238
+ sgBackupDontShowAgain();
239
+ window.open("<?php echo BACKUP_GUARD_WORDPRESS_REVIEW_URL; ?>")
240
+ });
241
+ jQuery('.sg-backup-button-1').bind('click', function () {
242
+ sgBackupDontShowAgain();
243
+ });
244
+ jQuery('.sg-backup-backup-button-2').bind('click', function () {
245
+ closeBackupGuardReviewPopup();
246
+ jQuery('.sg-backup-review-wrapper').remove();
247
+ var type = jQuery(this).data('message-type');
248
+
249
+ var data = {
250
+ action: 'backup_guard_review_later',
251
+ type: type,
252
+ token: BG_BACKUP_STRINGS.nonce
253
+ };
254
+ jQuery.post(ajaxurl, data, function () {
255
+ });
256
+ });
257
+ }
258
+ backupGuardReviewBannerButtons();
259
+
260
+ jQuery(window).bind('sgpbDidOpen', function() {
261
+ backupGuardReviewBannerButtons();
262
+ });
263
+ </script>
264
+ <?php
265
+ $content = ob_get_contents();
266
+ ob_end_clean();
267
+
268
+ return $content;
269
+ }
270
+
271
+ private function isAllowDaysReview()
272
+ {
273
+ $shouldOpen = false;
274
+ $periodNextTime = SGConfig::get('openNextTime');
275
+
276
+ $dontShowAgain = SGConfig::get('closeReviewBanner');
277
+ // When period next time does not exits it means the user is old
278
+ if (!$periodNextTime) {
279
+ $usageDays = $this->getBackupTableCreationDate();
280
+ SGConfig::set('usageDays', $usageDays);
281
+ // For old users
282
+ if (defined('SG_BACKUP_REVIEW_PERIOD') && $usageDays > SG_BACKUP_REVIEW_PERIOD && !$dontShowAgain) {
283
+ return true;
284
+ }
285
+
286
+ $remainingDays = SG_BACKUP_REVIEW_PERIOD - $usageDays;
287
+
288
+ $popupTimeZone = 'America/New_York';
289
+ $timeDate = new \DateTime('now', new DateTimeZone($popupTimeZone));
290
+ $timeDate->modify('+'.$remainingDays.' day');
291
+
292
+ $timeNow = strtotime($timeDate->format('Y-m-d H:i:s'));
293
+ SGConfig::set('openNextTime', $timeNow);
294
+
295
+ return false;
296
+ }
297
+
298
+ $currentData = new \DateTime('now');
299
+ $timeNow = $currentData->format('Y-m-d H:i:s');
300
+ $timeNow = strtotime($timeNow);
301
+
302
+ if ($periodNextTime < $timeNow) {
303
+ $shouldOpen = true;
304
+ }
305
+
306
+ return $shouldOpen;
307
+ }
308
+
309
+ private function getBackupTableCreationDate()
310
+ {
311
+ $sgdb = SGDatabase::getInstance();
312
+
313
+ $results = $sgdb->query('SELECT table_name, create_time FROM information_schema.tables WHERE table_schema="%s" AND table_name="%s"', array(DB_NAME, SG_ACTION_TABLE_NAME));
314
+
315
+ if (empty($results) || empty($results[0]['create_time'])) {
316
+ return 0;
317
+ }
318
+
319
+ $createTime = $results[0]['create_time'];
320
+ $createTime = strtotime($createTime);
321
+ SGConfig::set('installDate', $createTime);
322
+ $diff = time() - $createTime;
323
+ $days = floor($diff/(60*60*24));
324
+
325
+ return $days;
326
+ }
327
+
328
+ public static function getBackupCounts()
329
+ {
330
+ $sgdb = SGDatabase::getInstance();
331
+ $result = $sgdb->query('SELECT count(id) as countBackups FROM '.SG_ACTION_TABLE_NAME.' WHERE type='.SG_ACTION_TYPE_BACKUP.' AND status='.SG_ACTION_STATUS_FINISHED);
332
+
333
+ if (empty($result[0]['countBackups'])) {
334
+ return 0;
335
+ }
336
+
337
+ return (int)$result[0]['countBackups'];;
338
+ }
339
+
340
+ private function isAllowToShowReviewByCount()
341
+ {
342
+ $status = false;
343
+
344
+ $backupsCount = SGReviewManager::getBackupCounts();
345
+
346
+ if (empty($backupsCount)) {
347
+ return $status;
348
+ }
349
+
350
+ $backupCountReview = SGConfig::get('backupReviewCount');
351
+ if (empty($backupCountReview)) {
352
+ $backupCountReview = SG_BACKUP_REVIEW_BACKUP_COUNT;
353
+ }
354
+
355
+ return ($backupsCount >= $backupCountReview);
356
+ }
357
+
358
+ public static function getBackupRestoreCounts()
359
+ {
360
+ $sgdb = SGDatabase::getInstance();
361
+ $result = $sgdb->query('SELECT count(id) as countRestores FROM '.SG_ACTION_TABLE_NAME.' WHERE type='.SG_ACTION_TYPE_RESTORE.' AND status='.SG_ACTION_STATUS_FINISHED);
362
+
363
+ if (empty($result[0]['countRestores'])) {
364
+ return 0;
365
+ }
366
+
367
+ return (int)$result[0]['countRestores'];
368
+ }
369
+
370
+ private function isSuccessFullRestore()
371
+ {
372
+ $status = false;
373
+
374
+ $countRestores = SGReviewManager::getBackupRestoreCounts();
375
+
376
+ if (empty($countRestores)) {
377
+ return $status;
378
+ }
379
+
380
+ $restoreReviewCount = SGConfig::get('restoreReviewCount');
381
+ if (empty($restoreReviewCount)) {
382
+ $restoreReviewCount = SG_BACKUP_REVIEW_RESTORE_COUNT;
383
+ }
384
+
385
+ return ($countRestores >= $restoreReviewCount);
386
+ }
387
+ }
public/ajax/checkPHPVersionCompatibility.php CHANGED
@@ -6,6 +6,7 @@ require_once(SG_LIB_PATH.'SGArchive.php');
6
  if(backupGuardIsAjax() && count($_POST)) {
7
  try {
8
  $name = $_POST['bname'];
 
9
  $path = SG_BACKUP_DIRECTORY.$name.'/'.$name.'.sgbp';
10
 
11
  $sgArchive = new SGArchive($path, 'r');
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');
public/ajax/deleteBackup.php CHANGED
@@ -4,6 +4,7 @@
4
  if(isset($_POST['backupName']))
5
  {
6
  $backupName = backupGuardSanitizeTextField($_POST['backupName']);
 
7
  for ($i=0; $i < count($backupName) ; $i++) {
8
  SGBackup::deleteBackup($backupName[$i]);
9
  }
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
  }
public/ajax/downloadBackup.php CHANGED
@@ -10,6 +10,7 @@
10
  $downloadType == SG_BACKUP_DOWNLOAD_TYPE_SGBP)
11
  {
12
  $backupName = $_GET['backupName'];
 
13
  try
14
  {
15
  SGBackup::download($backupName, $downloadType);
10
  $downloadType == SG_BACKUP_DOWNLOAD_TYPE_SGBP)
11
  {
12
  $backupName = $_GET['backupName'];
13
+ $backupName = backupGuardRemoveSlashes($backupName);
14
  try
15
  {
16
  SGBackup::download($backupName, $downloadType);
public/ajax/modalImport.php CHANGED
@@ -57,18 +57,16 @@
57
  </div>
58
  </div>
59
  <div class="col-md-12" id="modal-import-2">
60
- <div class="form-group">
61
- <label class="col-md-2 control-label sg-upload-label" for="textinput"><?php _backupGuardT('SGBP file')?></label>
62
- <div class="col-md-10">
63
- <div class="input-group">
64
- <span class="input-group-btn">
65
- <span class="btn btn-primary btn-file">
66
- <?php _backupGuardT('Browse')?>&hellip; <input class="sg-backup-upload-input" type="file" name="files[]" data-url="<?php echo admin_url('admin-ajax.php')."?action=backup_guard_importBackup" ?>" data-max-file-size="<?php echo backupGuardConvertToBytes($maxUploadSize.'B'); ?>">
67
- </span>
68
  </span>
69
- <input type="text" id="sg-import-file-name" class="form-control" readonly>
70
- </div>
71
- <br/>
72
  </div>
73
  </div>
74
  </div>
@@ -91,10 +89,10 @@
91
  <div class="clearfix"></div>
92
  </div>
93
  <div class="modal-footer">
94
- <button type="button" class="pull-left btn btn-default" id="switch-modal-import-pages-back" onclick="sgBackup.previousPage()"><?php _backupGuardT('Back')?></button>
95
- <button type="button" class="btn btn-default" id="sg-close-modal-import" data-dismiss="modal"><?php _backupGuardT("Close")?></button>
96
- <button type="button" class="btn btn-primary" id="switch-modal-import-pages-next" data-remote="importBackup" onclick="sgBackup.nextPage()"><?php _backupGuardT('Next')?></button>
97
- <button type="button" data-remote="importBackup" id="uploadSgbpFile" class="btn btn-primary"><?php _backupGuardT('Import')?></button>
98
  </div>
99
  </div>
100
  </div>
57
  </div>
58
  </div>
59
  <div class="col-md-12" id="modal-import-2">
60
+ <div class="form-group import-modal-popup-content">
61
+ <div class="col-md-9">
62
+ <input type="text" id="sg-import-file-name" class="form-control sg-backup-input" placeholder="<?php _backupGuardT('SGBP file')?>" readonly>
63
+ </div>
64
+ <div class="col-lg-3">
65
+ <span class="input-group-btn">
66
+ <span class="btn btn-primary btn-file backup-browse-btn">
67
+ <?php _backupGuardT('Browse')?>&hellip; <input class="sg-backup-upload-input" type="file" name="files[]" data-url="<?php echo admin_url('admin-ajax.php')."?action=backup_guard_importBackup" ?>" data-max-file-size="<?php echo backupGuardConvertToBytes($maxUploadSize.'B'); ?>">
68
  </span>
69
+ </span>
 
 
70
  </div>
71
  </div>
72
  </div>
89
  <div class="clearfix"></div>
90
  </div>
91
  <div class="modal-footer">
92
+ <button type="button" class="pull-left btn btn-primary" id="switch-modal-import-pages-back" onclick="sgBackup.previousPage()"><?php _backupGuardT('Back')?></button>
93
+ <span class="modal-close-button" id="sg-close-modal-import" data-dismiss="modal"><?php _backupGuardT("Close")?></span>
94
+ <button type="button" class="btn btn-success" id="switch-modal-import-pages-next" data-remote="importBackup" onclick="sgBackup.nextPage()"><?php _backupGuardT('Next')?></button>
95
+ <button type="button" data-remote="importBackup" id="uploadSgbpFile" class="btn btn-success"><?php _backupGuardT('Import')?></button>
96
  </div>
97
  </div>
98
  </div>
public/ajax/modalManualBackup.php CHANGED
@@ -24,7 +24,7 @@
24
  <!-- Multiple Radios -->
25
  <div class="form-group">
26
  <div class="col-md-12">
27
- <input type="text" name="sg-custom-backup-name" id="sg-custom-backup-name" placeholder="Custom backup name (optional)">
28
  </div>
29
  <div class="col-md-12">
30
  <div class="radio">
@@ -130,8 +130,8 @@
130
  </div>
131
  <div class="modal-footer">
132
  <input type="text" name="backup-type" value="<?php echo $backupType?>" hidden>
133
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
134
- <button type="button" onclick="sgBackup.manualBackup()" class="btn btn-primary"><?php _backupGuardT('Backup')?></button>
135
  </div>
136
  </form>
137
  </div>
24
  <!-- Multiple Radios -->
25
  <div class="form-group">
26
  <div class="col-md-12">
27
+ <input type="text" name="sg-custom-backup-name" id="sg-custom-backup-name" class="sg-backup-input" placeholder="Custom backup name (optional)">
28
  </div>
29
  <div class="col-md-12">
30
  <div class="radio">
130
  </div>
131
  <div class="modal-footer">
132
  <input type="text" name="backup-type" value="<?php echo $backupType?>" hidden>
133
+ <span class="modal-close-button" data-dismiss="modal">Close</span>
134
+ <button type="button" onclick="sgBackup.manualBackup()" class="btn btn-success"><?php _backupGuardT('Backup')?></button>
135
  </div>
136
  </form>
137
  </div>
public/ajax/modalManualRestore.php CHANGED
@@ -2,8 +2,10 @@
2
  require_once(dirname(__FILE__).'/../boot.php');
3
  require_once(SG_LIB_PATH.'SGArchive.php');
4
  $backupName = $_GET['param'];
 
5
  $backupPath = SG_BACKUP_DIRECTORY.$backupName;
6
  $backupPath= $backupPath.'/'.$backupName.'.sgbp';
 
7
  $archive = new SGArchive($backupPath,'r');
8
  $headers = $archive->getArchiveHeaders();
9
  if($headers["selectivRestoreable"]){
@@ -45,8 +47,8 @@
45
  </div>
46
  </div>
47
  <div class="modal-footer">
48
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
49
- <button type="button" onclick="sgBackup.startRestore('<?php echo $backupName ?>')" class="btn btn-primary"><?php _backupGuardT('Restore')?></button>
50
  </div>
51
  </form>
52
  </div>
@@ -62,7 +64,7 @@
62
  </div>
63
  <div class="modal-footer">
64
  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
65
- <button type="button" onclick="sgBackup.startRestore('<?php echo $backupName ?>')" class="btn btn-primary"><?php _backupGuardT('Restore')?></button>
66
  </div>
67
  </div>
68
  </div>
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"]){
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>
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>
public/ajax/reviewBannerActions.php ADDED
@@ -0,0 +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
+ }
public/ajax/settings.php CHANGED
@@ -52,6 +52,13 @@ if (backupGuardIsAjax() && count($_POST)) {
52
  SGConfig::set('SG_DISABLE_ADS', '0');
53
  }
54
 
 
 
 
 
 
 
 
55
  if (isset($_POST['sg-background-reload-method'])) {
56
  SGConfig::set('SG_BACKGROUND_RELOAD_METHOD', (int)$_POST['sg-background-reload-method']);
57
  }
52
  SGConfig::set('SG_DISABLE_ADS', '0');
53
  }
54
 
55
+ if (isset($_POST['sg-download-via-php'])) {
56
+ SGConfig::set('SG_DOWNLOAD_VIA_PHP', '1');
57
+ }
58
+ else {
59
+ SGConfig::set('SG_DOWNLOAD_VIA_PHP', '0');
60
+ }
61
+
62
  if (isset($_POST['sg-background-reload-method'])) {
63
  SGConfig::set('SG_BACKGROUND_RELOAD_METHOD', (int)$_POST['sg-background-reload-method']);
64
  }
public/backups.php CHANGED
@@ -6,10 +6,11 @@ require_once(SG_PUBLIC_INCLUDE_PATH.'sidebar.php');
6
  $backups = SGBackup::getAllBackups();
7
  $pluginCapabilities = backupGuardGetCapabilities();
8
  $downloadUrl = admin_url('admin-post.php?action=backup_guard_downloadBackup&');
 
 
9
  ?>
10
  <?php if(SGConfig::get('SG_REVIEW_POPUP_STATE') == SG_SHOW_REVIEW_POPUP): ?>
11
  <!-- Review Box -->
12
- <a href="javascript:void(0)" id="sg-review" class="hidden" data-toggle="modal" data-modal-name="manual-review" data-remote="modalReview"></a>
13
  <script type="text/javascript">sgShowReview = 1;</script>
14
  <?php endif; ?>
15
  <?php if(!SGConfig::get('SG_HIDE_VERIFICATION_POPUP_STATE') && ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_FREE)): ?>
@@ -87,8 +88,16 @@ $downloadUrl = admin_url('admin-post.php?action=backup_guard_downloadBackup&');
87
  <?php _backupGuardT('Migrate')?>
88
  </a>
89
 
90
- <a href="javascript:void(0)" id="sg-import" class="pull-right btn btn-primary" data-toggle="modal" data-modal-name="import" data-remote="modalImport"><i class="glyphicon glyphicon-open"></i> <?php _backupGuardT('Import')?></a>
 
 
 
 
91
 
 
 
 
 
92
  <div class="clearfix"></div><br/>
93
  <table class="table table-striped paginated sg-backup-table">
94
  <thead>
@@ -141,7 +150,7 @@ $downloadUrl = admin_url('admin-post.php?action=backup_guard_downloadBackup&');
141
  <a class="btn btn-danger btn-xs sg-cancel-backup" sg-data-backup-id="<?php echo $backup['id']?>" href="javascript:void(0)" title="<?php _backupGuardT('Stop')?>">&nbsp;<i class="glyphicon glyphicon-stop" aria-hidden="true"></i>&nbsp;</a>
142
  <?php endif; ?>
143
  <?php else: ?>
144
- <a href="javascript:void(0)" data-sgbackup-name="<?php echo $backup['name'];?>" data-remote="deleteBackup" class="btn btn-danger btn-xs sg-remove-backup" title="<?php _backupGuardT('Delete')?>">&nbsp;<i class="glyphicon glyphicon-remove" aria-hidden="true"></i>&nbsp;</a>
145
  <div class="btn-group">
146
  <a href="javascript:void(0)" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown" aria-expanded="false" title="<?php _backupGuardT('Download')?>">
147
  &nbsp;<i class="glyphicon glyphicon-download-alt" aria-hidden="true"></i>&nbsp;
@@ -150,14 +159,14 @@ $downloadUrl = admin_url('admin-post.php?action=backup_guard_downloadBackup&');
150
  <ul class="dropdown-menu">
151
  <?php if($backup['files']):?>
152
  <li>
153
- <a href="<?php echo $downloadUrl.'backupName='.@$backup['name'].'&downloadType='.SG_BACKUP_DOWNLOAD_TYPE_SGBP ?>">
154
  <i class="glyphicon glyphicon-hdd" aria-hidden="true"></i> <?php _backupGuardT('Backup')?>
155
  </a>
156
  </li>
157
  <?php endif;?>
158
  <?php if($backup['backup_log']):?>
159
  <li>
160
- <a href="<?php echo $downloadUrl.'backupName='.@$backup['name'].'&downloadType='.SG_BACKUP_DOWNLOAD_TYPE_BACKUP_LOG ?>">
161
  <i class="glyphicon glyphicon-list-alt" aria-hidden="true"></i> <?php _backupGuardT('Backup log')?>
162
  </a>
163
  </li>
@@ -172,7 +181,7 @@ $downloadUrl = admin_url('admin-post.php?action=backup_guard_downloadBackup&');
172
  </ul>
173
  </div>
174
  <?php if(file_exists(SG_BACKUP_DIRECTORY.$backup['name'].'/'.$backup['name'].'.sgbp')):?>
175
- <a href="javascript:void(0)" title="<?php _backupGuardT('Restore')?>" class="btn btn-success btn-xs sg-restore-button" data-toggle="modal" data-modal-name="manual-restore" data-remote="modalManualRestore" data-sgbp-params="<?php echo $backup['name']?>">
176
  &nbsp;<i class="glyphicon glyphicon-repeat" aria-hidden="true"></i>&nbsp;
177
  </a>
178
  <?php endif;?>
6
  $backups = SGBackup::getAllBackups();
7
  $pluginCapabilities = backupGuardGetCapabilities();
8
  $downloadUrl = admin_url('admin-post.php?action=backup_guard_downloadBackup&');
9
+
10
+ $pluginCapabilities = backupGuardGetCapabilities();
11
  ?>
12
  <?php if(SGConfig::get('SG_REVIEW_POPUP_STATE') == SG_SHOW_REVIEW_POPUP): ?>
13
  <!-- Review Box -->
 
14
  <script type="text/javascript">sgShowReview = 1;</script>
15
  <?php endif; ?>
16
  <?php if(!SGConfig::get('SG_HIDE_VERIFICATION_POPUP_STATE') && ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_FREE)): ?>
88
  <?php _backupGuardT('Migrate')?>
89
  </a>
90
 
91
+ <a href="javascript:void(0)" id="sg-import" class="btn btn-primary sg-margin-left-20" data-toggle="modal" data-modal-name="import" data-remote="modalImport"><i class="glyphicon glyphicon-open"></i> <?php _backupGuardT('Import')?></a>
92
+ <?php if ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_FREE): ?>
93
+ <a href="<?php echo BACKUP_GUARD_WORDPRESS_SUPPORT_URL; ?>" target="_blank">
94
+ <button type="button" id="sg-report-problem-button" class="sg-button-red pull-right">
95
+ <i class="glyphicon glyphicon-alert"></i>
96
 
97
+ <?php _backupGuardT('Report issue')?>
98
+ </button>
99
+ </a>
100
+ <?php endif; ?>
101
  <div class="clearfix"></div><br/>
102
  <table class="table table-striped paginated sg-backup-table">
103
  <thead>
150
  <a class="btn btn-danger btn-xs sg-cancel-backup" sg-data-backup-id="<?php echo $backup['id']?>" href="javascript:void(0)" title="<?php _backupGuardT('Stop')?>">&nbsp;<i class="glyphicon glyphicon-stop" aria-hidden="true"></i>&nbsp;</a>
151
  <?php endif; ?>
152
  <?php else: ?>
153
+ <a href="javascript:void(0)" data-sgbackup-name="<?php echo htmlspecialchars($backup['name']);?>" data-remote="deleteBackup" class="btn btn-danger btn-xs sg-remove-backup" title="<?php _backupGuardT('Delete')?>">&nbsp;<i class="glyphicon glyphicon-remove" aria-hidden="true"></i>&nbsp;</a>
154
  <div class="btn-group">
155
  <a href="javascript:void(0)" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown" aria-expanded="false" title="<?php _backupGuardT('Download')?>">
156
  &nbsp;<i class="glyphicon glyphicon-download-alt" aria-hidden="true"></i>&nbsp;
159
  <ul class="dropdown-menu">
160
  <?php if($backup['files']):?>
161
  <li>
162
+ <a href="<?php echo $downloadUrl.'backupName='.htmlspecialchars(@$backup['name']).'&downloadType='.SG_BACKUP_DOWNLOAD_TYPE_SGBP ?>">
163
  <i class="glyphicon glyphicon-hdd" aria-hidden="true"></i> <?php _backupGuardT('Backup')?>
164
  </a>
165
  </li>
166
  <?php endif;?>
167
  <?php if($backup['backup_log']):?>
168
  <li>
169
+ <a href="<?php echo $downloadUrl.'backupName='.htmlspecialchars(@$backup['name']).'&downloadType='.SG_BACKUP_DOWNLOAD_TYPE_BACKUP_LOG ?>">
170
  <i class="glyphicon glyphicon-list-alt" aria-hidden="true"></i> <?php _backupGuardT('Backup log')?>
171
  </a>
172
  </li>
181
  </ul>
182
  </div>
183
  <?php if(file_exists(SG_BACKUP_DIRECTORY.$backup['name'].'/'.$backup['name'].'.sgbp')):?>
184
+ <a href="javascript:void(0)" title="<?php _backupGuardT('Restore')?>" class="btn btn-success btn-xs sg-restore-button" data-toggle="modal" data-modal-name="manual-restore" data-remote="modalManualRestore" data-sgbp-params="<?php echo htmlspecialchars($backup['name']) ?>">
185
  &nbsp;<i class="glyphicon glyphicon-repeat" aria-hidden="true"></i>&nbsp;
186
  </a>
187
  <?php endif;?>
public/cloud.php CHANGED
@@ -29,7 +29,7 @@ $oneDriveInfo = SGConfig::get('SG_ONE_DRIVE_CONNECTION_STRING');
29
  </label>
30
 
31
  <div class="col-md-7 pull-right text-right">
32
- <input id="cloudFolder" name="cloudFolder" type="text" class="form-control input-md" value="<?php echo esc_html(SGConfig::get('SG_STORAGE_BACKUPS_FOLDER_NAME'))?>">
33
  <button type="button" id="sg-save-cloud-folder" class="btn btn-success pull-right"><?php _backupGuardT('Save');?></button>
34
  </div>
35
  </div>
29
  </label>
30
 
31
  <div class="col-md-7 pull-right text-right">
32
+ <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'))?>">
33
  <button type="button" id="sg-save-cloud-folder" class="btn btn-success pull-right"><?php _backupGuardT('Save');?></button>
34
  </div>
35
  </div>
public/css/bgstyle.less.css CHANGED
@@ -1,9 +1,17 @@
1
  #sg-custom-backup-name {
2
  width: 100%;
 
 
 
 
 
 
 
 
3
  }
4
 
5
  .backup-guard-label-success {
6
- color: green;
7
  }
8
 
9
  .backup-guard-label-warning {
@@ -60,7 +68,7 @@
60
  margin-top: 10px;
61
  width: calc(100% - 20px) !important;
62
  height: 185px;
63
- background-color: #333;
64
  color: #FFFFFF;
65
  font-size: 12px;
66
  min-width: 650px;
@@ -91,12 +99,13 @@
91
 
92
  .sg-banner-social-button {
93
  display: inline-block;
94
- width: 32px;
95
- height: 32px;
96
  border: none;
97
  border-radius: 50%;
98
  cursor: pointer;
99
  margin-right: 3px;
 
100
  }
101
 
102
  #sg-banner p {
@@ -110,6 +119,7 @@
110
  text-decoration: none;
111
  color: #FFFFFF;
112
  cursor: pointer;
 
113
  }
114
 
115
  #sg-banner ul {
@@ -125,7 +135,7 @@
125
  #sg-right-column ul {
126
  float: right;
127
  padding-right: 16px;
128
- padding-top: 10px;
129
  }
130
 
131
  #sg-right-column li {
@@ -141,51 +151,40 @@
141
  }
142
 
143
  .sg-img-class {
144
- margin-right: 10px;
145
  vertical-align: middle;
146
  }
147
 
148
  #sg-logo {
149
  display: inline-block;
150
  width: 140px;
151
- height: 30px;
152
- background-size: 140px 30px;
 
153
  background-repeat: no-repeat;
154
- background-image: url("../img/logo-horizontal.png");
155
  }
156
 
157
- #sg-facebook {
158
- background: url('../img/fb.png') no-repeat;
159
  }
160
 
161
- #sg-facebook:hover {
162
- background-color: #3C5A96;
163
  }
164
 
165
  #sg-twitter {
166
  background: url("../img/TW.png") no-repeat;
167
  }
168
 
169
- #sg-twitter:hover {
170
- background-color: #2AA3EF;
171
- }
172
-
173
  #sg-google-plus {
174
  background: url("../img/G+.png") no-repeat;
175
  }
176
 
177
- #sg-google-plus:hover {
178
- background-color: #D9453D;
179
- }
180
-
181
  #sg-youtube {
182
  background: url("../img/youtube.png") no-repeat;
183
  }
184
 
185
- #sg-youtube:hover {
186
- background-color: #E32424;
187
- }
188
-
189
  .sg-star-class {
190
  cursor:pointer;
191
  margin-right: 3px;
@@ -196,18 +195,21 @@
196
  }
197
 
198
  #sg-buy-now {
199
- background-color: #951b17;
200
  border: none;
201
- color: #fff;
202
  font-size: 18px;
203
  vertical-align: middle;
204
  cursor: pointer;
205
  display: inline-block;
206
  padding: 6px 15px;
 
207
  }
208
 
209
  #sg-buy-now:hover {
210
- background-color: #2f8912;
 
 
211
  }
212
 
213
  #sg-buy-now-text {
@@ -233,6 +235,7 @@
233
  .sg-banner-rate-us-in {
234
  display: inline-block;
235
  height: 30px;
 
236
  }
237
 
238
  /* Bounce In */
@@ -1502,13 +1505,13 @@
1502
  line-height: inherit;
1503
  }
1504
  .sg-wrapper-less a {
1505
- color: #2780e3;
1506
  text-decoration: none;
1507
  }
1508
  .sg-wrapper-less a:hover,
1509
  .sg-wrapper-less a:focus {
1510
  color: #165ba8;
1511
- text-decoration: underline;
1512
  }
1513
  .sg-wrapper-less a:focus {
1514
  outline: thin dotted;
@@ -2988,7 +2991,7 @@
2988
  margin-bottom: 21px;
2989
  font-size: 22.5px;
2990
  line-height: inherit;
2991
- color: #333333;
2992
  border: 0;
2993
  border-bottom: 1px solid #e5e5e5;
2994
  }
@@ -3137,6 +3140,17 @@
3137
  margin-left: -20px;
3138
  margin-top: 4px \9;
3139
  }
 
 
 
 
 
 
 
 
 
 
 
3140
  .sg-wrapper-less .radio + .radio,
3141
  .sg-wrapper-less .checkbox + .checkbox {
3142
  margin-top: -5px;
@@ -3577,9 +3591,11 @@
3577
  background-color: #ffffff;
3578
  }
3579
  .sg-wrapper-less .btn-primary {
3580
- color: #ffffff;
3581
- background-color: #2780e3;
3582
- border-color: #2780e3;
 
 
3583
  }
3584
  .sg-wrapper-less .btn-primary:hover,
3585
  .sg-wrapper-less .btn-primary:focus,
@@ -3588,8 +3604,8 @@
3588
  .sg-wrapper-less .btn-primary.active,
3589
  .sg-wrapper-less .open > .dropdown-toggle.btn-primary {
3590
  color: #ffffff;
3591
- background-color: #1967be;
3592
- border-color: #1862b5;
3593
  }
3594
  .sg-wrapper-less .btn-primary:active,
3595
  .sg-wrapper-less .btn-primary.active,
@@ -3614,17 +3630,19 @@
3614
  .sg-wrapper-less .btn-primary.disabled.active,
3615
  .sg-wrapper-less .btn-primary[disabled].active,
3616
  .sg-wrapper-less fieldset[disabled] .btn-primary.active {
3617
- background-color: #2780e3;
3618
- border-color: #2780e3;
 
3619
  }
3620
  .sg-wrapper-less .btn-primary .badge {
3621
  color: #2780e3;
3622
  background-color: #ffffff;
3623
  }
3624
  .sg-wrapper-less .btn-success {
3625
- color: #ffffff;
3626
- background-color: #3fb618;
3627
- border-color: #3fb618;
 
3628
  }
3629
  .sg-wrapper-less .btn-success:hover,
3630
  .sg-wrapper-less .btn-success:focus,
@@ -3632,9 +3650,11 @@
3632
  .sg-wrapper-less .btn-success:active,
3633
  .sg-wrapper-less .btn-success.active,
3634
  .sg-wrapper-less .open > .dropdown-toggle.btn-success {
3635
- color: #ffffff;
3636
- background-color: #2f8912;
3637
- border-color: #2c8011;
 
 
3638
  }
3639
  .sg-wrapper-less .btn-success:active,
3640
  .sg-wrapper-less .btn-success.active,
@@ -3659,8 +3679,8 @@
3659
  .sg-wrapper-less .btn-success.disabled.active,
3660
  .sg-wrapper-less .btn-success[disabled].active,
3661
  .sg-wrapper-less fieldset[disabled] .btn-success.active {
3662
- background-color: #3fb618;
3663
- border-color: #3fb618;
3664
  }
3665
  .sg-wrapper-less .btn-success .badge {
3666
  color: #3fb618;
@@ -3758,8 +3778,9 @@
3758
  }
3759
  .sg-wrapper-less .btn-danger {
3760
  color: #ffffff;
3761
- background-color: #ff0039;
3762
- border-color: #ff0039;
 
3763
  }
3764
  .sg-wrapper-less .btn-danger:hover,
3765
  .sg-wrapper-less .btn-danger:focus,
@@ -3767,9 +3788,9 @@
3767
  .sg-wrapper-less .btn-danger:active,
3768
  .sg-wrapper-less .btn-danger.active,
3769
  .sg-wrapper-less .open > .dropdown-toggle.btn-danger {
3770
- color: #ffffff;
3771
- background-color: #cc002e;
3772
- border-color: #c2002b;
3773
  }
3774
  .sg-wrapper-less .btn-danger:active,
3775
  .sg-wrapper-less .btn-danger.active,
@@ -3964,7 +3985,7 @@
3964
  .sg-wrapper-less .dropdown-menu > li > a:focus {
3965
  text-decoration: none;
3966
  color: #ffffff;
3967
- background-color: #2780e3;
3968
  }
3969
  .sg-wrapper-less .dropdown-menu > .active > a,
3970
  .sg-wrapper-less .dropdown-menu > .active > a:hover,
@@ -4211,6 +4232,10 @@
4211
  clip: rect(0, 0, 0, 0);
4212
  pointer-events: none;
4213
  }
 
 
 
 
4214
  .sg-wrapper-less .input-group {
4215
  position: relative;
4216
  display: table;
@@ -6210,6 +6235,12 @@
6210
  .sg-wrapper-less .modal-open {
6211
  overflow: hidden;
6212
  }
 
 
 
 
 
 
6213
  .sg-wrapper-less .modal {
6214
  display: none;
6215
  overflow: hidden;
@@ -6221,6 +6252,10 @@
6221
  z-index: 1050;
6222
  -webkit-overflow-scrolling: touch;
6223
  outline: 0;
 
 
 
 
6224
  }
6225
  .sg-wrapper-less .modal.fade .modal-dialog {
6226
  -webkit-transform: translate(0, -25%);
@@ -6277,7 +6312,6 @@
6277
  }
6278
  .sg-wrapper-less .modal-header {
6279
  padding: 20px;
6280
- border-bottom: 1px solid #e5e5e5;
6281
  min-height: 16.42857143px;
6282
  }
6283
  .sg-wrapper-less .modal-header .close {
@@ -6286,6 +6320,8 @@
6286
  .sg-wrapper-less .modal-title {
6287
  margin: 0;
6288
  line-height: 1.42857143;
 
 
6289
  }
6290
  .sg-wrapper-less .modal-body {
6291
  position: relative;
@@ -6294,7 +6330,7 @@
6294
  .sg-wrapper-less .modal-footer {
6295
  padding: 20px;
6296
  text-align: right;
6297
- border-top: 1px solid #e5e5e5;
6298
  }
6299
  .sg-wrapper-less .modal-footer .btn + .btn {
6300
  margin-left: 5px;
@@ -7084,7 +7120,7 @@
7084
  }
7085
  .sg-wrapper-less .text-success,
7086
  .sg-wrapper-less .text-success:hover {
7087
- color: #3fb618;
7088
  }
7089
  .sg-wrapper-less .text-danger,
7090
  .sg-wrapper-less .text-danger:hover {
@@ -7246,9 +7282,9 @@
7246
  display: block;
7247
  }
7248
  .sg-wrapper-less select {
7249
- background: #ffffff url("../img/sgselect.png") no-repeat !important;
7250
  background-size: 24px 20px;
7251
- background-position: right center !important;
7252
  color: #888;
7253
  outline: none;
7254
  display: inline-block;
@@ -7260,20 +7296,25 @@
7260
  .sg-wrapper-less #sg-wrapper {
7261
  width: 100%;
7262
  min-width: 650px;
7263
- border: 1px #5c5c5c solid;
7264
- background-color: #333333;
7265
  }
7266
  .sg-wrapper-less #sg-sidebar-wrapper {
7267
  width: 210px;
7268
  float: left;
7269
  }
 
 
 
 
 
7270
  .sg-wrapper-less #sg-content-wrapper {
7271
  position: relative;
7272
  float: left;
7273
  width: calc(100% - 210px);
7274
  /*Same as sidebar*/
7275
  border-left: 1px #333333 solid;
7276
- min-height: 675px;
7277
  background-color: #ffffff;
7278
  }
7279
  .sg-wrapper-less .container-fluid {
@@ -7283,7 +7324,7 @@
7283
  .sg-wrapper-less .metro .sidebar {
7284
  margin: 0;
7285
  padding: 0;
7286
- background-color: #3D3D3D;
7287
  width: 100%;
7288
  /*height: 100%;*/
7289
  }
@@ -7295,7 +7336,7 @@
7295
  .sg-wrapper-less .metro .sidebar > ul li {
7296
  display: block;
7297
  border: 0;
7298
- border-bottom: 1px #5c5c5c solid;
7299
  position: relative;
7300
  }
7301
  .sg-wrapper-less .metro .sidebar > ul li.title {
@@ -7321,10 +7362,10 @@
7321
  padding: 10px 20px;
7322
  text-decoration: none;
7323
  color: #eeeeee;
7324
- background-color: #3D3D3D;
7325
  }
7326
  .sg-wrapper-less .metro .sidebar > ul li a:hover {
7327
- background-color: #262626;
7328
  color: #ffffff;
7329
  }
7330
  .sg-wrapper-less .metro .sidebar > ul li a.dropdown-toggle:after {
@@ -7354,8 +7395,8 @@
7354
  color: #555555;
7355
  }
7356
  .sg-wrapper-less .metro .sidebar > ul li.active a {
7357
- background-color: #9a1616;
7358
- color: #ffffff;
7359
  }
7360
  .sg-wrapper-less .metro .sidebar > ul ul {
7361
  margin: 0;
@@ -7891,3 +7932,78 @@
7891
  .form-group-custom {
7892
  display: none;
7893
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  #sg-custom-backup-name {
2
  width: 100%;
3
+ border-radius: 0;
4
+ }
5
+
6
+ .sg-backup-input {
7
+ border: none !important;
8
+ box-shadow: none !important;
9
+ border-bottom: 2px solid #000000 !important;
10
+ padding-left: 0 !important;
11
  }
12
 
13
  .backup-guard-label-success {
14
+ color: #0021C8;
15
  }
16
 
17
  .backup-guard-label-warning {
68
  margin-top: 10px;
69
  width: calc(100% - 20px) !important;
70
  height: 185px;
71
+ background-color: #0021C8;
72
  color: #FFFFFF;
73
  font-size: 12px;
74
  min-width: 650px;
99
 
100
  .sg-banner-social-button {
101
  display: inline-block;
102
+ width: 44px;
103
+ height: 44px;
104
  border: none;
105
  border-radius: 50%;
106
  cursor: pointer;
107
  margin-right: 3px;
108
+ background-size: contain !important;
109
  }
110
 
111
  #sg-banner p {
119
  text-decoration: none;
120
  color: #FFFFFF;
121
  cursor: pointer;
122
+ font-weight: bold;
123
  }
124
 
125
  #sg-banner ul {
135
  #sg-right-column ul {
136
  float: right;
137
  padding-right: 16px;
138
+ padding-top: 2px;
139
  }
140
 
141
  #sg-right-column li {
151
  }
152
 
153
  .sg-img-class {
154
+ margin-right: 3px;
155
  vertical-align: middle;
156
  }
157
 
158
  #sg-logo {
159
  display: inline-block;
160
  width: 140px;
161
+ height: 70px;
162
+ background-size: contain;
163
+ background-position: center;
164
  background-repeat: no-repeat;
165
+ background-image: url("../img/banerLogo.png");
166
  }
167
 
168
+ .sg-logo-li {
169
+ height: 70px !important;
170
  }
171
 
172
+ #sg-facebook {
173
+ background: url('../img/fb.png') no-repeat;
174
  }
175
 
176
  #sg-twitter {
177
  background: url("../img/TW.png") no-repeat;
178
  }
179
 
 
 
 
 
180
  #sg-google-plus {
181
  background: url("../img/G+.png") no-repeat;
182
  }
183
 
 
 
 
 
184
  #sg-youtube {
185
  background: url("../img/youtube.png") no-repeat;
186
  }
187
 
 
 
 
 
188
  .sg-star-class {
189
  cursor:pointer;
190
  margin-right: 3px;
195
  }
196
 
197
  #sg-buy-now {
198
+ background-color: #ffffff;
199
  border: none;
200
+ color: #0021C8 !important;
201
  font-size: 18px;
202
  vertical-align: middle;
203
  cursor: pointer;
204
  display: inline-block;
205
  padding: 6px 15px;
206
+ border-radius: 8px;
207
  }
208
 
209
  #sg-buy-now:hover {
210
+ background-color: #0021C8;
211
+ border: 1px solid #ffffff !important;
212
+ color: #ffffff !important;
213
  }
214
 
215
  #sg-buy-now-text {
235
  .sg-banner-rate-us-in {
236
  display: inline-block;
237
  height: 30px;
238
+ color:rgba(255,255,255, 0.8) !important;
239
  }
240
 
241
  /* Bounce In */
1505
  line-height: inherit;
1506
  }
1507
  .sg-wrapper-less a {
1508
+ color: #0021C8;
1509
  text-decoration: none;
1510
  }
1511
  .sg-wrapper-less a:hover,
1512
  .sg-wrapper-less a:focus {
1513
  color: #165ba8;
1514
+ text-decoration: none;
1515
  }
1516
  .sg-wrapper-less a:focus {
1517
  outline: thin dotted;
2991
  margin-bottom: 21px;
2992
  font-size: 22.5px;
2993
  line-height: inherit;
2994
+ color: #000000;
2995
  border: 0;
2996
  border-bottom: 1px solid #e5e5e5;
2997
  }
3140
  margin-left: -20px;
3141
  margin-top: 4px \9;
3142
  }
3143
+ .sg-wrapper-less input[type=radio]:checked,
3144
+ .sg-wrapper-less .radio input[type="radio"],
3145
+ .sg-wrapper-less .checkbox input[type="checkbox"] {
3146
+ background-color: #efefef;
3147
+ }
3148
+ .sg-wrapper-less input[type=radio]:checked:before {
3149
+ background-color: #0021C8;
3150
+ }
3151
+ .sg-wrapper-less .checkbox input[type="checkbox"]:checked {
3152
+ background-color: #072dc3;
3153
+ }
3154
  .sg-wrapper-less .radio + .radio,
3155
  .sg-wrapper-less .checkbox + .checkbox {
3156
  margin-top: -5px;
3591
  background-color: #ffffff;
3592
  }
3593
  .sg-wrapper-less .btn-primary {
3594
+ color: #0021C8;
3595
+ background-color: #ffffff;
3596
+ border-color: #0021C8;
3597
+ border-radius: 8px;
3598
+ font-weight: bold;
3599
  }
3600
  .sg-wrapper-less .btn-primary:hover,