MainWP Child - Version 3.5.1

Version Description

  • 11-14-18 =
  • Fixed: an issue with detecting the Wordfence status info
  • Fixed: an issue with loading UpdraftPlus existing backups
  • Fixed: the File Uploader extension issue with renaming special files
  • Fixed: an issue with syncing BackupBuddy data
  • Fixed: an issue with logging BackWPup backups
  • Fixed: an issue with detecting premium plugin updates
  • Added: new options for the MainWP Staging Extension
  • Added: multiple security enhancements
  • Added: support for the upcoming 3rd party extension
  • Updated: improved updating process
Download this release

Release Info

Developer mainwp
Plugin Icon 128x128 MainWP Child
Version 3.5.1
Comparing to
See all releases

Code changes from version 3.5 to 3.5.1

class/class-mainwp-child-back-up-buddy.php CHANGED
@@ -23,10 +23,6 @@ class MainWP_Child_Back_Up_Buddy {
23
  return;
24
  }
25
 
26
- if ( get_option( 'mainwp_backupbuddy_ext_enabled' ) !== 'Y' ) {
27
- return;
28
- }
29
-
30
  add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
31
 
32
  add_action( 'wp_ajax_mainwp_backupbuddy_download_archive', array( $this, 'download_archive' ) );
@@ -195,9 +191,6 @@ class MainWP_Child_Back_Up_Buddy {
195
  MainWP_Helper::write( array( 'error' => __( 'Please install the BackupBuddy plugin on the child site.', $this->plugin_translate ) ) );
196
  }
197
 
198
- if (get_option( 'mainwp_backupbuddy_ext_enabled' ) !== 'Y')
199
- MainWP_Helper::update_option( 'mainwp_backupbuddy_ext_enabled', 'Y' );
200
-
201
  if ( ! class_exists( 'backupbuddy_core' ) ) {
202
  require_once( pb_backupbuddy::plugin_path() . '/classes/core.php' );
203
  }
@@ -757,7 +750,7 @@ class MainWP_Child_Back_Up_Buddy {
757
  $data['media_root'] = backupbuddy_core::get_media_root();
758
  $data['additional_tables'] = $this->pb_additional_tables();
759
  $data['abspath'] = ABSPATH;
760
-
761
  $getOverview = backupbuddy_api::getOverview();
762
  $data['editsSinceLastBackup'] = $getOverview['editsSinceLastBackup'] ;
763
 
23
  return;
24
  }
25
 
 
 
 
 
26
  add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
27
 
28
  add_action( 'wp_ajax_mainwp_backupbuddy_download_archive', array( $this, 'download_archive' ) );
191
  MainWP_Helper::write( array( 'error' => __( 'Please install the BackupBuddy plugin on the child site.', $this->plugin_translate ) ) );
192
  }
193
 
 
 
 
194
  if ( ! class_exists( 'backupbuddy_core' ) ) {
195
  require_once( pb_backupbuddy::plugin_path() . '/classes/core.php' );
196
  }
750
  $data['media_root'] = backupbuddy_core::get_media_root();
751
  $data['additional_tables'] = $this->pb_additional_tables();
752
  $data['abspath'] = ABSPATH;
753
+
754
  $getOverview = backupbuddy_api::getOverview();
755
  $data['editsSinceLastBackup'] = $getOverview['editsSinceLastBackup'] ;
756
 
class/class-mainwp-child-back-up-wordpress.php CHANGED
@@ -26,7 +26,7 @@ class MainWP_Child_Back_Up_Wordpress {
26
  if ( version_compare( phpversion(), '5.3', '<' ) ) {
27
  return;
28
  }
29
- if ( get_option( 'mainwp_backupwordpress_ext_enabled' ) !== 'Y' ) return;
30
  if (!$this->is_plugin_installed) return;
31
 
32
  add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
@@ -56,9 +56,6 @@ class MainWP_Child_Back_Up_Wordpress {
56
  MainWP_Helper::write( $information );
57
  }
58
 
59
- if (false === get_option('mainwp_backupwordpress_ext_enabled'))
60
- MainWP_Helper::update_option( 'mainwp_backupwordpress_ext_enabled', 'Y' );
61
-
62
  if ( isset( $_POST['mwp_action'] ) ) {
63
  switch ( $_POST['mwp_action'] ) {
64
  case 'set_showhide':
26
  if ( version_compare( phpversion(), '5.3', '<' ) ) {
27
  return;
28
  }
29
+
30
  if (!$this->is_plugin_installed) return;
31
 
32
  add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
56
  MainWP_Helper::write( $information );
57
  }
58
 
 
 
 
59
  if ( isset( $_POST['mwp_action'] ) ) {
60
  switch ( $_POST['mwp_action'] ) {
61
  case 'set_showhide':
class/class-mainwp-child-back-wp-up.php CHANGED
@@ -110,7 +110,7 @@ class MainWP_Child_Back_WP_Up {
110
  if ( ! isset( $_POST['action'] ) ) {
111
  $information = array( 'error' => __( 'Missing action.', $this->plugin_translate ) );
112
  } else {
113
- MainWP_Helper::update_option( 'mainwp_backwpup_ext_enabled', 'Y' );
114
  switch ( $_POST['action'] ) {
115
  case 'backwpup_update_settings':
116
  $information = $this->update_settings();
@@ -194,9 +194,6 @@ class MainWP_Child_Back_WP_Up {
194
  }
195
 
196
  public function init() {
197
- if ( get_option( 'mainwp_backwpup_ext_enabled' ) !== 'Y' ) {
198
- return;
199
- }
200
 
201
  if (!$this->is_backwpup_installed)
202
  return;
@@ -223,14 +220,44 @@ class MainWP_Child_Back_WP_Up {
223
  return;
224
 
225
  try {
226
- MainWP_Helper::check_classes_exists(array('BackWPup'));
227
- MainWP_Helper::check_methods('BackWPup', array( 'get_registered_destinations', 'get_destination' ));
228
 
 
 
 
229
 
230
- $destinations = BackWPup::get_registered_destinations();
231
- $jobdests = $this->get_destinations_list();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
 
233
- if ( !empty( $jobdests ) ) {
 
 
 
 
234
  $job_types = array(
235
  'DBDUMP' => __('Database backup', 'mainwp-child'),
236
  'FILE' => __('File backup', 'mainwp-child'),
@@ -239,41 +266,36 @@ class MainWP_Child_Back_WP_Up {
239
  'DBCHECK' => __('Check database tables', 'mainwp-child')
240
  );
241
 
242
- foreach ($jobdests as $jobdest) {
243
- list( $jobid, $dest ) = explode( '_', $jobdest );
244
- if ( ! empty( $destinations[ $dest ][ 'class' ] ) ) {
245
-
246
- $job_job_types = BackWPup_Option::get( $jobid, 'type' );
247
 
248
- $backup_type = '';
249
- foreach($job_job_types as $typeid) {
250
- if (isset( $job_types[$typeid] )) {
251
- $backup_type .= ' + ' . $job_types[$typeid];
252
- }
253
- }
254
- if (empty($backup_type))
255
- $backup_type = 'BackWPup';
256
- else {
257
- $backup_type = ltrim($backup_type, ' + ');
 
258
  }
 
259
 
260
- $dest_object = BackWPup::get_destination( $dest );
261
- $items = $dest_object->file_get_list( $jobdest );
262
- //if no items brake
263
- if ( $items ) {
264
- foreach ( $items as $ma ) {
265
- if (isset($ma['time'])) {
266
- $backup_time = $ma[ "time" ];
267
- $message = 'BackWPup backup finished (' . $backup_type . ')';
268
- $destination = "N/A";
269
- if (!empty($backup_time)) {
270
- do_action( 'mainwp_backwpup_backup', $message, $backup_type, $backup_time );
271
- MainWP_Helper::update_lasttime_backup( 'backwpup', $backup_time ); // to support backup before update feature
272
- }
273
- }
274
- }
275
- }
276
  }
 
 
 
 
 
 
 
 
 
277
  }
278
  }
279
  } catch (Exception $ex) {
110
  if ( ! isset( $_POST['action'] ) ) {
111
  $information = array( 'error' => __( 'Missing action.', $this->plugin_translate ) );
112
  } else {
113
+
114
  switch ( $_POST['action'] ) {
115
  case 'backwpup_update_settings':
116
  $information = $this->update_settings();
194
  }
195
 
196
  public function init() {
 
 
 
197
 
198
  if (!$this->is_backwpup_installed)
199
  return;
220
  return;
221
 
222
  try {
 
 
223
 
224
+ MainWP_Helper::check_classes_exists(array('BackWPup_File', 'BackWPup_Job'));
225
+ MainWP_Helper::check_methods('BackWPup_File', array( 'get_absolute_path' ));
226
+ MainWP_Helper::check_methods('BackWPup_Job', array( 'read_logheader' ));
227
 
228
+ $lasttime_logged = MainWP_Helper::get_lasttime_backup('backwpup');
229
+
230
+ $log_folder = get_site_option( 'backwpup_cfg_logfolder' );
231
+ $log_folder = BackWPup_File::get_absolute_path( $log_folder );
232
+ $log_folder = untrailingslashit( $log_folder );
233
+
234
+ //load logs
235
+ $logfiles = array();
236
+ if ( is_readable( $log_folder ) && $dir = opendir( $log_folder ) ) {
237
+ while ( ( $file = readdir( $dir ) ) !== FALSE ) {
238
+ $log_file = $log_folder . '/' . $file;
239
+ if ( is_file( $log_file ) && is_readable( $log_file ) && FALSE !== strpos( $file, 'backwpup_log_' ) && FALSE !== strpos( $file, '.html' ) ) {
240
+ $logfiles[] = $file;
241
+ }
242
+ }
243
+ closedir( $dir );
244
+ }
245
+
246
+ $log_items = array();
247
+ foreach ( $logfiles as $mtime => $logfile ) {
248
+ $meta = BackWPup_Job::read_logheader( $log_folder . '/' . $logfile );
249
+ if (!isset($meta['logtime']) || $meta['logtime'] < $lasttime_logged)
250
+ continue;
251
+
252
+ if (isset($meta['errors']) && !empty($meta['errors'])) {
253
+ continue; // do not logging backups have errors
254
+ }
255
 
256
+ $log_items[$mtime] = $meta;
257
+ $log_items[$mtime]['file'] = $logfile;
258
+ }
259
+
260
+ if ( !empty( $log_items ) ) {
261
  $job_types = array(
262
  'DBDUMP' => __('Database backup', 'mainwp-child'),
263
  'FILE' => __('File backup', 'mainwp-child'),
266
  'DBCHECK' => __('Check database tables', 'mainwp-child')
267
  );
268
 
269
+ $new_lasttime_logged = $lasttime_logged;
 
 
 
 
270
 
271
+ foreach ($log_items as $log) {
272
+ $backup_time = $log[ "logtime" ];
273
+ if ($backup_time < $lasttime_logged) {
274
+ // small than last backup time then skip
275
+ continue;
276
+ }
277
+ $job_job_types = explode('+', $log['type']);
278
+ $backup_type = '';
279
+ foreach($job_job_types as $typeid) {
280
+ if (isset( $job_types[$typeid] )) {
281
+ $backup_type .= ' + ' . $job_types[$typeid];
282
  }
283
+ }
284
 
285
+ if (empty($backup_type)) {
286
+ continue;
287
+ } else {
288
+ $backup_type = ltrim($backup_type, ' + ');
 
 
 
 
 
 
 
 
 
 
 
 
289
  }
290
+ $message = 'BackWPup backup finished (' . $backup_type . ')';
291
+ do_action( 'mainwp_backwpup_backup', $message, $backup_type, $backup_time );
292
+
293
+ if ($new_lasttime_logged < $backup_time)
294
+ $new_lasttime_logged = $backup_time;
295
+ }
296
+
297
+ if ($new_lasttime_logged > $lasttime_logged ) {
298
+ MainWP_Helper::update_lasttime_backup( 'backwpup', $new_lasttime_logged ); // to support backup before update feature
299
  }
300
  }
301
  } catch (Exception $ex) {
class/class-mainwp-child-ithemes-security.php CHANGED
@@ -47,7 +47,7 @@ class MainWP_Child_iThemes_Security {
47
  global $mainwp_itsec_modules_path;
48
 
49
  $mainwp_itsec_modules_path = ITSEC_Core::get_core_dir() . '/modules/';
50
- MainWP_Helper::update_option( 'mainwp_ithemes_ext_enabled', 'Y', 'yes' );
51
 
52
  if ( isset( $_POST['mwp_action'] ) ) {
53
  switch ( $_POST['mwp_action'] ) {
@@ -116,9 +116,8 @@ class MainWP_Child_iThemes_Security {
116
  }
117
 
118
  public function ithemes_init() {
119
- if ( get_option( 'mainwp_ithemes_ext_enabled' ) !== 'Y' ) {
120
  return;
121
- }
122
 
123
  if ( get_option( 'mainwp_ithemes_hide_plugin' ) === 'hide' ) {
124
  add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
47
  global $mainwp_itsec_modules_path;
48
 
49
  $mainwp_itsec_modules_path = ITSEC_Core::get_core_dir() . '/modules/';
50
+
51
 
52
  if ( isset( $_POST['mwp_action'] ) ) {
53
  switch ( $_POST['mwp_action'] ) {
116
  }
117
 
118
  public function ithemes_init() {
119
+ if (!$this->is_plugin_installed)
120
  return;
 
121
 
122
  if ( get_option( 'mainwp_ithemes_hide_plugin' ) === 'hide' ) {
123
  add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
class/class-mainwp-child-pagespeed.php CHANGED
@@ -18,12 +18,12 @@ class MainWP_Child_Pagespeed {
18
  if ( is_plugin_active( 'google-pagespeed-insights/google-pagespeed-insights.php' ) ) {
19
  $this->is_plugin_installed = true;
20
  }
21
-
22
  if (!$this->is_plugin_installed)
23
  return;
24
-
25
  add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
26
-
27
  add_action( 'mainwp_child_deactivation', array( $this, 'child_deactivation' ) );
28
  }
29
 
@@ -34,7 +34,7 @@ class MainWP_Child_Pagespeed {
34
  MainWP_Helper::write( $information );
35
  }
36
  if ( isset( $_POST['mwp_action'] ) ) {
37
- MainWP_Helper::update_option('mainwp_pagespeed_ext_enabled', 'Y', 'yes');
38
  switch ( $_POST['mwp_action'] ) {
39
  case 'save_settings':
40
  $information = $this->save_settings();
@@ -60,13 +60,12 @@ class MainWP_Child_Pagespeed {
60
  }
61
 
62
  public function init() {
63
- if ( get_option( 'mainwp_pagespeed_ext_enabled' ) !== 'Y' ) {
64
- return;
65
- }
66
-
67
  if ( get_option( 'mainwp_pagespeed_hide_plugin' ) === 'hide' ) {
68
  add_filter( 'all_plugins', array( $this, 'hide_plugin' ) );
69
- add_action('admin_menu', array($this, 'hide_menu'), 999);
70
  }
71
  $this->init_cron();
72
  }
@@ -261,14 +260,14 @@ class MainWP_Child_Pagespeed {
261
  return $information;
262
  }
263
 
264
- public function syncOthersData( $information, $data = array() ) {
265
- if ( isset( $data['syncPageSpeedData'] ) && $data['syncPageSpeedData'] ) {
266
  try{
267
  $information['syncPageSpeedData'] = $this->get_sync_data();
268
  } catch(Exception $e) {
269
-
270
  }
271
- }
272
  return $information;
273
  }
274
  // ok
18
  if ( is_plugin_active( 'google-pagespeed-insights/google-pagespeed-insights.php' ) ) {
19
  $this->is_plugin_installed = true;
20
  }
21
+
22
  if (!$this->is_plugin_installed)
23
  return;
24
+
25
  add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
26
+
27
  add_action( 'mainwp_child_deactivation', array( $this, 'child_deactivation' ) );
28
  }
29
 
34
  MainWP_Helper::write( $information );
35
  }
36
  if ( isset( $_POST['mwp_action'] ) ) {
37
+
38
  switch ( $_POST['mwp_action'] ) {
39
  case 'save_settings':
40
  $information = $this->save_settings();
60
  }
61
 
62
  public function init() {
63
+ if (!$this->is_plugin_installed)
64
+ return;
65
+
 
66
  if ( get_option( 'mainwp_pagespeed_hide_plugin' ) === 'hide' ) {
67
  add_filter( 'all_plugins', array( $this, 'hide_plugin' ) );
68
+ add_action('admin_menu', array($this, 'hide_menu'), 999);
69
  }
70
  $this->init_cron();
71
  }
260
  return $information;
261
  }
262
 
263
+ public function syncOthersData( $information, $data = array() ) {
264
+ if ( isset( $data['syncPageSpeedData'] ) && $data['syncPageSpeedData'] ) {
265
  try{
266
  $information['syncPageSpeedData'] = $this->get_sync_data();
267
  } catch(Exception $e) {
268
+
269
  }
270
+ }
271
  return $information;
272
  }
273
  // ok
class/class-mainwp-child-staging.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
 
3
  class MainWP_Child_Staging {
4
-
5
  public static $instance = null;
6
  public $is_plugin_installed = false;
7
-
8
  static function Instance() {
9
  if ( null === MainWP_Child_Staging::$instance ) {
10
  MainWP_Child_Staging::$instance = new MainWP_Child_Staging();
@@ -12,26 +12,26 @@ class MainWP_Child_Staging {
12
  return MainWP_Child_Staging::$instance;
13
  }
14
 
15
- public function __construct() {
16
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
17
  if ( is_plugin_active( 'wp-staging/wp-staging.php' ) && defined('WPSTG_PLUGIN_DIR')) {
18
- $this->is_plugin_installed = true;
19
- }
20
-
21
  if (!$this->is_plugin_installed)
22
- return;
23
-
24
- add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
25
  }
26
 
27
-
28
- public function init() {
29
- if ( get_option( 'mainwp_wp_staging_ext_enabled' ) !== 'Y' )
30
- return;
31
-
32
- if (!$this->is_plugin_installed)
33
- return;
34
-
35
  if ( get_option( 'mainwp_wp_staging_hide_plugin' ) === 'hide' ) {
36
  add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
37
  add_action( 'admin_menu', array( $this, 'remove_menu' ) );
@@ -39,44 +39,44 @@ class MainWP_Child_Staging {
39
  }
40
  }
41
 
42
- public function syncOthersData( $information, $data = array() ) {
43
- if ( isset( $data['syncWPStaging'] ) && $data['syncWPStaging'] ) {
44
  try{
45
  $information['syncWPStaging'] = $this->get_sync_data();
46
  } catch(Exception $e) {
47
  // do not exit
48
  }
49
- }
50
  return $information;
51
  }
52
  // ok
53
- public function get_sync_data() {
54
  return $this->get_overview();
55
  }
56
-
57
  public function action() {
58
  if (!$this->is_plugin_installed) {
59
  MainWP_Helper::write( array('error' => 'Please install WP Staging plugin on child website') );
60
  }
61
-
62
  if (!class_exists( 'WPStaging\WPStaging' )){
63
  require_once WPSTG_PLUGIN_DIR . "apps/Core/WPStaging.php";
64
  }
65
  \WPStaging\WPStaging::getInstance();
66
 
67
- $information = array();
68
  if (get_option( 'mainwp_wp_staging_ext_enabled' ) !== 'Y') {
69
- MainWP_Helper::update_option( 'mainwp_wp_staging_ext_enabled', 'Y', 'yes' );
70
  }
71
-
72
  if ( isset( $_POST['mwp_action'] ) ) {
73
  switch ( $_POST['mwp_action'] ) {
74
  case 'set_showhide':
75
  $information = $this->set_showhide();
76
- break;
77
  case 'save_settings':
78
  $information = $this->save_settings();
79
- break;
80
  case 'get_overview':
81
  $information = $this->get_overview();
82
  break;
@@ -106,7 +106,7 @@ class MainWP_Child_Staging {
106
  break;
107
  case 'clone_finish':
108
  $information = $this->ajaxFinish();
109
- break;
110
  case 'delete_confirmation':
111
  $information = $this->ajaxDeleteConfirmation();
112
  break;
@@ -121,35 +121,37 @@ class MainWP_Child_Staging {
121
  break;
122
  case 'cancel_update':
123
  $information = $this->ajaxCancelUpdate();
124
- break;
125
  }
126
  }
127
  MainWP_Helper::write( $information );
128
- }
129
-
130
  function set_showhide() {
131
  $hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : '';
132
  MainWP_Helper::update_option( 'mainwp_wp_staging_hide_plugin', $hide, 'yes' );
133
  $information['result'] = 'SUCCESS';
134
  return $information;
135
  }
136
-
137
  function save_settings() {
138
- $settings = $_POST['settings'];
139
  $filters = array(
140
  'queryLimit',
141
  'fileLimit',
142
  'batchSize',
143
  'cpuLoad',
144
  'disableAdminLogin',
145
- 'wpSubDirectory',
 
 
146
  'debugMode',
147
  'unInstallOnDelete',
148
  'checkDirectorySize',
149
  'optimizer',
150
- 'loginSlug'
151
  );
152
-
153
  $save_fields = array();
154
  foreach($filters as $field) {
155
  if (isset($settings[$field])) {
@@ -158,15 +160,15 @@ class MainWP_Child_Staging {
158
  }
159
  update_option('wpstg_settings', $save_fields );
160
  return array('result' => 'success');
161
- }
162
-
163
- public function get_overview() {
164
  $return = array(
165
  'availableClones' => get_option( "wpstg_existing_clones_beta", array())
166
  );
167
  return $return;
168
  }
169
-
170
  public function get_scan() {
171
  // Scan
172
  $scan = new WPStaging\Backend\Modules\Jobs\Scan();
@@ -178,12 +180,12 @@ class MainWP_Child_Staging {
178
  $return = array(
179
  'options' => serialize($options),
180
  'directoryListing' => $scan->directoryListing(),
181
- 'prefix' => WPStaging\WPStaging::getTablePrefix()
182
  );
183
  return $return;
184
  }
185
 
186
-
187
  public function ajaxCheckCloneName() {
188
  $cloneName = sanitize_key( $_POST["cloneID"] );
189
  $cloneNameLength = strlen( $cloneName );
@@ -204,23 +206,23 @@ class MainWP_Child_Staging {
204
 
205
  return array("status" => "success");
206
  }
207
-
208
  public function ajaxStartClone() {
209
 
210
  $this->url = ''; // to fix warning
211
  $cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
212
-
213
-
214
  if( !$cloning->save() ) {
215
  return;
216
  }
217
-
218
  ob_start();
219
  require_once WPSTG_PLUGIN_DIR . "apps/Backend/views/clone/ajax/start.php";
220
  $result = ob_get_clean();
221
  return $result;
222
  }
223
-
224
  public function ajaxCloneDatabase() {
225
 
226
  $cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
@@ -232,7 +234,7 @@ class MainWP_Child_Staging {
232
  * Ajax Prepare Directories (get listing of files)
233
  */
234
  public function ajaxPrepareDirectories() {
235
-
236
  $cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
237
 
238
  return $cloning->start();
@@ -265,7 +267,7 @@ class MainWP_Child_Staging {
265
  $this->url = ''; // to fix warning
266
  $return = $cloning->start();
267
  $return->blogInfoName = get_bloginfo("name");
268
-
269
  return $return;
270
  }
271
 
@@ -276,12 +278,12 @@ class MainWP_Child_Staging {
276
 
277
  $delete = new WPStaging\Backend\Modules\Jobs\Delete();
278
  $delete->setData();
279
- $clone = $delete->getClone();
280
  $result = array(
281
  'clone' => $clone,
282
  'deleteTables' => $delete->getTables()
283
- );
284
- return $result;
285
  }
286
 
287
  /**
@@ -300,15 +302,15 @@ class MainWP_Child_Staging {
300
  $cancel = new WPStaging\Backend\Modules\Jobs\Cancel();
301
  return $cancel->start();
302
  }
303
-
304
- public function ajaxCancelUpdate() {
305
  $cancel = new WPStaging\Backend\Modules\Jobs\CancelUpdate();
306
  return $cancel->start();
307
  }
308
 
309
  public function ajaxUpdateProcess() {
310
-
311
- $cloning = new WPStaging\Backend\Modules\Jobs\Updating();
312
 
313
  if( !$cloning->save() ) {
314
  return;
@@ -317,13 +319,13 @@ class MainWP_Child_Staging {
317
  ob_start();
318
  require_once WPSTG_PLUGIN_DIR . "apps/Backend/views/clone/ajax/update.php";
319
  $result = ob_get_clean();
320
- return $result;
321
  }
322
-
323
- public function ajaxCheckFreeSpace() {
324
  return $this->hasFreeDiskSpace();
325
  }
326
-
327
  // from wp-staging plugin
328
  public function hasFreeDiskSpace() {
329
  if( !function_exists( "disk_free_space" ) ) {
@@ -335,15 +337,15 @@ class MainWP_Child_Staging {
335
  'freespace' => false,
336
  'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH))
337
  );
338
- return $data;
339
  }
340
  $data = array(
341
  'freespace' => $this->formatSize($freeSpace),
342
  'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH))
343
  );
344
- return $data;
345
  }
346
-
347
  // from wp-staging plugin
348
  function getDirectorySizeInclSubdirs( $dir ) {
349
  $size = 0;
@@ -352,7 +354,7 @@ class MainWP_Child_Staging {
352
  }
353
  return $size;
354
  }
355
-
356
  // from wp-staging plugin
357
  public function formatSize($bytes, $precision = 2)
358
  {
@@ -369,8 +371,8 @@ class MainWP_Child_Staging {
369
 
370
  return round($pow, $precision) . ' ' . $units[(int) floor($base)];
371
  }
372
-
373
-
374
  public function all_plugins( $plugins ) {
375
  foreach ( $plugins as $key => $value ) {
376
  $plugin_slug = basename( $key, '.php' );
@@ -390,7 +392,7 @@ class MainWP_Child_Staging {
390
  exit();
391
  }
392
  }
393
-
394
  function remove_update_nag( $value ) {
395
  if ( isset( $_POST['mainwpsignature'] ) ) {
396
  return $value;
1
  <?php
2
 
3
  class MainWP_Child_Staging {
4
+
5
  public static $instance = null;
6
  public $is_plugin_installed = false;
7
+
8
  static function Instance() {
9
  if ( null === MainWP_Child_Staging::$instance ) {
10
  MainWP_Child_Staging::$instance = new MainWP_Child_Staging();
12
  return MainWP_Child_Staging::$instance;
13
  }
14
 
15
+ public function __construct() {
16
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
17
  if ( is_plugin_active( 'wp-staging/wp-staging.php' ) && defined('WPSTG_PLUGIN_DIR')) {
18
+ $this->is_plugin_installed = true;
19
+ }
20
+
21
  if (!$this->is_plugin_installed)
22
+ return;
23
+
24
+ add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
25
  }
26
 
27
+
28
+ public function init() {
29
+ if ( get_option( 'mainwp_wp_staging_ext_enabled' ) !== 'Y' )
30
+ return;
31
+
32
+ if (!$this->is_plugin_installed)
33
+ return;
34
+
35
  if ( get_option( 'mainwp_wp_staging_hide_plugin' ) === 'hide' ) {
36
  add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
37
  add_action( 'admin_menu', array( $this, 'remove_menu' ) );
39
  }
40
  }
41
 
42
+ public function syncOthersData( $information, $data = array() ) {
43
+ if ( isset( $data['syncWPStaging'] ) && $data['syncWPStaging'] ) {
44
  try{
45
  $information['syncWPStaging'] = $this->get_sync_data();
46
  } catch(Exception $e) {
47
  // do not exit
48
  }
49
+ }
50
  return $information;
51
  }
52
  // ok
53
+ public function get_sync_data() {
54
  return $this->get_overview();
55
  }
56
+
57
  public function action() {
58
  if (!$this->is_plugin_installed) {
59
  MainWP_Helper::write( array('error' => 'Please install WP Staging plugin on child website') );
60
  }
61
+
62
  if (!class_exists( 'WPStaging\WPStaging' )){
63
  require_once WPSTG_PLUGIN_DIR . "apps/Core/WPStaging.php";
64
  }
65
  \WPStaging\WPStaging::getInstance();
66
 
67
+ $information = array();
68
  if (get_option( 'mainwp_wp_staging_ext_enabled' ) !== 'Y') {
69
+ MainWP_Helper::update_option( 'mainwp_wp_staging_ext_enabled', 'Y', 'yes' );
70
  }
71
+
72
  if ( isset( $_POST['mwp_action'] ) ) {
73
  switch ( $_POST['mwp_action'] ) {
74
  case 'set_showhide':
75
  $information = $this->set_showhide();
76
+ break;
77
  case 'save_settings':
78
  $information = $this->save_settings();
79
+ break;
80
  case 'get_overview':
81
  $information = $this->get_overview();
82
  break;
106
  break;
107
  case 'clone_finish':
108
  $information = $this->ajaxFinish();
109
+ break;
110
  case 'delete_confirmation':
111
  $information = $this->ajaxDeleteConfirmation();
112
  break;
121
  break;
122
  case 'cancel_update':
123
  $information = $this->ajaxCancelUpdate();
124
+ break;
125
  }
126
  }
127
  MainWP_Helper::write( $information );
128
+ }
129
+
130
  function set_showhide() {
131
  $hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : '';
132
  MainWP_Helper::update_option( 'mainwp_wp_staging_hide_plugin', $hide, 'yes' );
133
  $information['result'] = 'SUCCESS';
134
  return $information;
135
  }
136
+
137
  function save_settings() {
138
+ $settings = $_POST['settings'];
139
  $filters = array(
140
  'queryLimit',
141
  'fileLimit',
142
  'batchSize',
143
  'cpuLoad',
144
  'disableAdminLogin',
145
+ 'querySRLimit',
146
+ 'maxFileSize',
147
+ //'wpSubDirectory', // removed
148
  'debugMode',
149
  'unInstallOnDelete',
150
  'checkDirectorySize',
151
  'optimizer',
152
+ //'loginSlug' // removed
153
  );
154
+
155
  $save_fields = array();
156
  foreach($filters as $field) {
157
  if (isset($settings[$field])) {
160
  }
161
  update_option('wpstg_settings', $save_fields );
162
  return array('result' => 'success');
163
+ }
164
+
165
+ public function get_overview() {
166
  $return = array(
167
  'availableClones' => get_option( "wpstg_existing_clones_beta", array())
168
  );
169
  return $return;
170
  }
171
+
172
  public function get_scan() {
173
  // Scan
174
  $scan = new WPStaging\Backend\Modules\Jobs\Scan();
180
  $return = array(
181
  'options' => serialize($options),
182
  'directoryListing' => $scan->directoryListing(),
183
+ 'prefix' => WPStaging\WPStaging::getTablePrefix()
184
  );
185
  return $return;
186
  }
187
 
188
+
189
  public function ajaxCheckCloneName() {
190
  $cloneName = sanitize_key( $_POST["cloneID"] );
191
  $cloneNameLength = strlen( $cloneName );
206
 
207
  return array("status" => "success");
208
  }
209
+
210
  public function ajaxStartClone() {
211
 
212
  $this->url = ''; // to fix warning
213
  $cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
214
+
215
+
216
  if( !$cloning->save() ) {
217
  return;
218
  }
219
+
220
  ob_start();
221
  require_once WPSTG_PLUGIN_DIR . "apps/Backend/views/clone/ajax/start.php";
222
  $result = ob_get_clean();
223
  return $result;
224
  }
225
+
226
  public function ajaxCloneDatabase() {
227
 
228
  $cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
234
  * Ajax Prepare Directories (get listing of files)
235
  */
236
  public function ajaxPrepareDirectories() {
237
+
238
  $cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
239
 
240
  return $cloning->start();
267
  $this->url = ''; // to fix warning
268
  $return = $cloning->start();
269
  $return->blogInfoName = get_bloginfo("name");
270
+
271
  return $return;
272
  }
273
 
278
 
279
  $delete = new WPStaging\Backend\Modules\Jobs\Delete();
280
  $delete->setData();
281
+ $clone = $delete->getClone();
282
  $result = array(
283
  'clone' => $clone,
284
  'deleteTables' => $delete->getTables()
285
+ );
286
+ return $result;
287
  }
288
 
289
  /**
302
  $cancel = new WPStaging\Backend\Modules\Jobs\Cancel();
303
  return $cancel->start();
304
  }
305
+
306
+ public function ajaxCancelUpdate() {
307
  $cancel = new WPStaging\Backend\Modules\Jobs\CancelUpdate();
308
  return $cancel->start();
309
  }
310
 
311
  public function ajaxUpdateProcess() {
312
+
313
+ $cloning = new WPStaging\Backend\Modules\Jobs\Updating();
314
 
315
  if( !$cloning->save() ) {
316
  return;
319
  ob_start();
320
  require_once WPSTG_PLUGIN_DIR . "apps/Backend/views/clone/ajax/update.php";
321
  $result = ob_get_clean();
322
+ return $result;
323
  }
324
+
325
+ public function ajaxCheckFreeSpace() {
326
  return $this->hasFreeDiskSpace();
327
  }
328
+
329
  // from wp-staging plugin
330
  public function hasFreeDiskSpace() {
331
  if( !function_exists( "disk_free_space" ) ) {
337
  'freespace' => false,
338
  'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH))
339
  );
340
+ return $data;
341
  }
342
  $data = array(
343
  'freespace' => $this->formatSize($freeSpace),
344
  'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH))
345
  );
346
+ return $data;
347
  }
348
+
349
  // from wp-staging plugin
350
  function getDirectorySizeInclSubdirs( $dir ) {
351
  $size = 0;
354
  }
355
  return $size;
356
  }
357
+
358
  // from wp-staging plugin
359
  public function formatSize($bytes, $precision = 2)
360
  {
371
 
372
  return round($pow, $precision) . ' ' . $units[(int) floor($base)];
373
  }
374
+
375
+
376
  public function all_plugins( $plugins ) {
377
  foreach ( $plugins as $key => $value ) {
378
  $plugin_slug = basename( $key, '.php' );
392
  exit();
393
  }
394
  }
395
+
396
  function remove_update_nag( $value ) {
397
  if ( isset( $_POST['mainwpsignature'] ) ) {
398
  return $value;
class/class-mainwp-child-timecapsule.php CHANGED
@@ -531,7 +531,7 @@ function get_sibling_files_callback_wptc() {
531
  $detailed = $this->get_activity_log($sub_records);
532
 
533
  if (isset($load_more) && $load_more) {
534
- $detailed .= '<tr><td></td><td><a style="cursor:pointer; position:relative" class="wptc_activity_log_load_more" action_id="'.$action_id.'" limit="'.$to_limit.'">Load more</a></td><td></td></tr>';
535
  }
536
 
537
  return array( 'result' => $detailed);
531
  $detailed = $this->get_activity_log($sub_records);
532
 
533
  if (isset($load_more) && $load_more) {
534
+ $detailed .= '<tr><td></td><td><a style="cursor:pointer; position:relative" class="wptc_activity_log_load_more" action_id="'. esc_attr( $action_id ).'" limit="'. esc_attr( $to_limit ) .'">Load more</a></td><td></td></tr>';
535
  }
536
 
537
  return array( 'result' => $detailed);
class/class-mainwp-child-updraft-plus-backups.php CHANGED
@@ -75,11 +75,6 @@ class MainWP_Child_Updraft_Plus_Backups {
75
  }
76
 
77
  if ( isset( $_POST['mwp_action'] ) ) {
78
-
79
- if ( get_option( 'mainwp_updraftplus_ext_enabled' ) !== 'Y' ) {
80
- MainWP_Helper::update_option( 'mainwp_updraftplus_ext_enabled', 'Y', 'yes' );
81
- }
82
-
83
  try {
84
  switch ( $_POST['mwp_action'] ) {
85
  case 'set_showhide':
@@ -3071,14 +3066,19 @@ class MainWP_Child_Updraft_Plus_Backups {
3071
  $entities = '';
3072
 
3073
  $non = $backup['nonce'];
3074
- $rawbackup = "<h2>$esc_pretty_date ($key)</h2><pre><p>" . esc_attr( print_r( $backup, true ) );
3075
- if ( ! empty( $non ) ) {
3076
- $jd = $updraftplus->jobdata_getarray( $non );
3077
- if ( ! empty( $jd ) && is_array( $jd ) ) {
3078
- $rawbackup .= '</p><p>' . esc_attr( print_r( $jd, true ) );
3079
- }
3080
- }
3081
- $rawbackup .= '</p></pre>';
 
 
 
 
 
3082
 
3083
  $jobdata = $updraftplus->jobdata_getarray( $non );
3084
 
@@ -3908,9 +3908,8 @@ ENDHERE;
3908
  }
3909
 
3910
  public function updraftplus_init() {
3911
- if ( get_option( 'mainwp_updraftplus_ext_enabled' ) !== 'Y' ) {
3912
- return;
3913
- }
3914
 
3915
  if ( get_option( 'mainwp_updraftplus_hide_plugin' ) === 'hide' ) {
3916
  add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
75
  }
76
 
77
  if ( isset( $_POST['mwp_action'] ) ) {
 
 
 
 
 
78
  try {
79
  switch ( $_POST['mwp_action'] ) {
80
  case 'set_showhide':
3066
  $entities = '';
3067
 
3068
  $non = $backup['nonce'];
3069
+
3070
+
3071
+ // $rawbackup = "<h2>$esc_pretty_date ($key)</h2><pre><p>" . esc_attr( print_r( $backup, true ) );
3072
+ // if ( ! empty( $non ) ) {
3073
+ // $jd = $updraftplus->jobdata_getarray( $non );
3074
+ // if ( ! empty( $jd ) && is_array( $jd ) ) {
3075
+ // $rawbackup .= '</p><p>' . esc_attr( print_r( $jd, true ) );
3076
+ // }
3077
+ // }
3078
+ // $rawbackup .= '</p></pre>';
3079
+
3080
+ // to fix
3081
+ $rawbackup = '' ; //$updraftplus_admin->raw_backup_info($backup_history, $key, $non);
3082
 
3083
  $jobdata = $updraftplus->jobdata_getarray( $non );
3084
 
3908
  }
3909
 
3910
  public function updraftplus_init() {
3911
+ if (!$this->is_plugin_installed)
3912
+ return;
 
3913
 
3914
  if ( get_option( 'mainwp_updraftplus_hide_plugin' ) === 'hide' ) {
3915
  add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
class/class-mainwp-child-wordfence.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
 
3
  class MainWP_Child_Wordfence {
4
- public static $instance = null;
5
  public $is_wordfence_installed = false;
6
  public $plugin_translate = 'mainwp-child';
7
-
8
  const OPTIONS_TYPE_GLOBAL = 'global';
9
  const OPTIONS_TYPE_FIREWALL = 'firewall';
10
  const OPTIONS_TYPE_BLOCKING = 'blocking';
@@ -14,7 +14,7 @@ class MainWP_Child_Wordfence {
14
  const OPTIONS_TYPE_COMMENT_SPAM = 'commentspam';
15
  const OPTIONS_TYPE_DIAGNOSTICS = 'diagnostics';
16
  const OPTIONS_TYPE_ALL = 'alloptions';
17
-
18
  public static $options_filter = array(
19
  'alertEmails',
20
  'alertOn_adminLogin',
@@ -33,11 +33,11 @@ class MainWP_Child_Wordfence {
33
  'autoUpdate',
34
  'firewallEnabled',
35
  'howGetIPs',
36
- 'liveTrafficEnabled',
37
  'loginSec_blockAdminReg',
38
  'loginSec_countFailMins',
39
  'loginSec_disableAuthorScan',
40
- 'notification_updatesNeeded',
41
  "notification_securityAlerts",
42
  "notification_promotions",
43
  "notification_blogHighlights",
@@ -66,7 +66,7 @@ class MainWP_Child_Wordfence {
66
  'scansEnabled_dns',
67
  'scansEnabled_fileContents',
68
  'scansEnabled_fileContentsGSB',
69
- 'scan_include_extra',
70
  //'scansEnabled_heartbleed',
71
  'scansEnabled_checkHowGetIPs',
72
  'scansEnabled_highSense',
@@ -151,7 +151,7 @@ class MainWP_Child_Wordfence {
151
  'learningModeGracePeriodEnabled',
152
  'learningModeGracePeriod'
153
  );
154
-
155
  // for separated saving this values
156
  public static $diagnosticParams = array(
157
  //'addCacheComment',
@@ -161,13 +161,13 @@ class MainWP_Child_Wordfence {
161
  //'disableConfigCaching',
162
  'betaThreatDefenseFeed',
163
  );
164
-
165
  public static $firewall_options_filter = array(
166
  'wafStatus',
167
  'learningModeGracePeriodEnabled',
168
  'learningModeGracePeriod'
169
  );
170
-
171
 
172
  static function Instance() {
173
  if ( null === MainWP_Child_Wordfence::$instance ) {
@@ -182,7 +182,7 @@ class MainWP_Child_Wordfence {
182
  add_action( 'mainwp_child_deactivation', array( $this, 'deactivation' ) );
183
 
184
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
185
-
186
  // ok
187
  if ( is_plugin_active( 'wordfence/wordfence.php' ) && file_exists( plugin_dir_path( __FILE__ ) . '../../wordfence/wordfence.php' ) ) {
188
  require_once( plugin_dir_path( __FILE__ ) . '../../wordfence/wordfence.php' );
@@ -214,7 +214,7 @@ class MainWP_Child_Wordfence {
214
  MainWP_Helper::write( $information );
215
  }
216
  if ( isset( $_POST['mwp_action'] ) ) {
217
- MainWP_Helper::update_option('mainwp_wordfence_ext_enabled', "Y", 'yes');
218
  switch ( $_POST['mwp_action'] ) {
219
  case 'start_scan':
220
  $information = $this->start_scan();
@@ -227,25 +227,22 @@ class MainWP_Child_Wordfence {
227
  break;
228
  case 'killScan':
229
  $information = $this->killScan();
230
- break;
231
  case 'set_showhide':
232
  $information = $this->set_showhide();
233
  break;
234
  case 'get_log':
235
  $information = $this->get_log();
236
- break;
237
  case 'update_log':
238
  $information = $this->update_log();
239
  break;
240
- case 'get_summary':
241
- $information = $this->get_summary();
242
- break;
243
  case 'load_issues': // not used in from version 2.0 of WF ext
244
  $information = $this->load_issues();
245
  break;
246
  case 'loadIssues':
247
  $information = $this->ajax_loadIssues_callback();
248
- break;
249
  case 'load_wafData':
250
  $information = $this->load_wafData();
251
  break;
@@ -266,7 +263,7 @@ class MainWP_Child_Wordfence {
266
  break;
267
  case 'bulkOperation': // new
268
  $information = $this->bulkOperation();
269
- break;
270
  case 'delete_file':
271
  $information = $this->delete_file();
272
  break;
@@ -281,10 +278,10 @@ class MainWP_Child_Wordfence {
281
  break;
282
  case 'saveOptions':
283
  $information = $this->saveOptions();
284
- break;
285
  case 'recentTraffic':
286
  $information = $this->recentTraffic();
287
- break;
288
  case 'ticker':
289
  $information = $this->ticker();
290
  break;
@@ -296,10 +293,10 @@ class MainWP_Child_Wordfence {
296
  break;
297
  case 'whois':
298
  $information = $this->whois();
299
- break;
300
- case 'createBlock': // new version blockIP, blockIPUARange
301
  $information = $this->ajax_createBlock_callback();
302
- break;
303
  case 'getBlocks':
304
  $information = $this->ajax_getBlocks_callback();
305
  break;
@@ -308,7 +305,7 @@ class MainWP_Child_Wordfence {
308
  break;
309
  case 'makePermanentBlocks':
310
  $information = $this->ajax_makePermanentBlocks_callback();
311
- break;
312
  case 'unblock_ip':
313
  $information = $this->unblock_ip();
314
  break;
@@ -359,7 +356,7 @@ class MainWP_Child_Wordfence {
359
  break;
360
  case 'update_waf_rules_new':
361
  $information = $this->updateWAFRules_New();
362
- break;
363
  case 'save_debugging_config':
364
  $information = $this->save_debugging_config();
365
  break;
@@ -368,10 +365,10 @@ class MainWP_Child_Wordfence {
368
  break;
369
  case 'white_list_waf':
370
  $information = $this->whitelistWAFParamKey();
371
- break;
372
  case 'hide_file_htaccess':
373
  $information = $this->hideFileHtaccess();
374
- break;
375
  case 'fix_fpd':
376
  $information = $this->fixFPD();
377
  break;
@@ -383,7 +380,7 @@ class MainWP_Child_Wordfence {
383
  break;
384
  case 'misconfigured_howget_ips_choice':
385
  $information = $this->misconfiguredHowGetIPsChoice();
386
- break;
387
  case 'delete_admin_user':
388
  $information = $this->deleteAdminUser();
389
  break;
@@ -401,7 +398,7 @@ class MainWP_Child_Wordfence {
401
  break;
402
  case 'unblock_range':
403
  $information = $this->unblockRange();
404
- break;
405
  case 'block_ip_ua_range':
406
  $information = $this->blockIPUARange();
407
  break;
@@ -419,7 +416,7 @@ class MainWP_Child_Wordfence {
419
  break;
420
  case 'whitelist_bulk_disable':
421
  $information = $this->whitelistBulkDisable();
422
- break;
423
  case 'update_config':
424
  $information = $this->updateConfig();
425
  break;
@@ -429,9 +426,9 @@ class MainWP_Child_Wordfence {
429
  }
430
  }
431
  MainWP_Helper::write( $information );
432
- }
433
-
434
-
435
  public static function getSectionSettings($section) {
436
  $general_opts = array(
437
  'scheduleScan',
@@ -473,9 +470,9 @@ class MainWP_Child_Wordfence {
473
  'email_summary_dashboard_widget_enabled',
474
  'other_noAnonMemberComments',
475
  'other_scanComments',
476
- 'advancedCommentScanning' // paid
477
  );
478
-
479
  $traffic_opts = array(
480
  'liveTrafficEnabled',
481
  'liveTraf_ignorePublishers',
@@ -486,7 +483,7 @@ class MainWP_Child_Wordfence {
486
  'liveTraf_maxRows',
487
  'displayTopLevelLiveTraffic'
488
  );
489
-
490
  $firewall_opts = array(
491
  'disableWAFIPBlocking',
492
  'whitelisted',
@@ -516,10 +513,10 @@ class MainWP_Child_Wordfence {
516
  'loginSec_lockoutMins',
517
  'loginSec_lockInvalidUsers',
518
  'loginSec_breachPasswds_enabled',
519
- 'loginSec_breachPasswds',
520
  'loginSec_userBlacklist',
521
  'loginSec_strongPasswds_enabled',
522
- 'loginSec_strongPasswds',
523
  'loginSec_maskLoginErrors',
524
  'loginSec_blockAdminReg',
525
  'loginSec_disableAuthorScan',
@@ -528,9 +525,9 @@ class MainWP_Child_Wordfence {
528
  'other_WFNet',
529
  'wafStatus',
530
  'learningModeGracePeriodEnabled',
531
- 'learningModeGracePeriod'
532
  );
533
-
534
  $scan_opts = array(
535
  'scansEnabled_checkGSB', //paid
536
  'spamvertizeCheck', //paid
@@ -573,13 +570,13 @@ class MainWP_Child_Wordfence {
573
  'ssl_verify',
574
  'betaThreatDefenseFeed'
575
  );
576
-
577
  $blocking_opts = array(
578
- 'displayTopLevelBlocking',
579
  );
580
-
581
  $options = array();
582
-
583
  switch($section) {
584
  case self::OPTIONS_TYPE_GLOBAL:
585
  $options = $general_opts;
@@ -591,7 +588,7 @@ class MainWP_Child_Wordfence {
591
  $options = $firewall_opts;
592
  break;
593
  case self::OPTIONS_TYPE_SCANNER:
594
- $options = $scan_opts;
595
  break;
596
  case self::OPTIONS_TYPE_DIAGNOSTICS:
597
  $options = $diagnostics_opts;
@@ -602,37 +599,37 @@ class MainWP_Child_Wordfence {
602
  case self::OPTIONS_TYPE_ALL:
603
  $options = array_merge($general_opts, $traffic_opts, $firewall_opts, $scan_opts, $diagnostics_opts, $blocking_opts);
604
  break;
605
- }
606
  return $options;
607
  }
608
-
609
-
610
- private function start_scan() {
611
  $information = wordfence::ajax_scan_callback();
612
- if ( is_array($information) && isset($information['ok']) )
613
  $information['result'] = 'SUCCESS';
614
-
615
  return $information;
616
  }
617
 
618
- private function kill_scan() {
619
  wordfence::status(1, 'info', "Scan kill request received.");
620
  wordfence::status(10, 'info', "SUM_KILLED:A request was received to kill the previous scan.");
621
  wfUtils::clearScanLock(); //Clear the lock now because there may not be a scan running to pick up the kill request and clear the lock
622
  wfScanEngine::requestKill();
623
  return array(
624
  'ok' => 1,
625
- );
626
  }
627
-
628
- private function requestScan() {
629
- return wordfence::ajax_scan_callback();
630
  }
631
 
632
- private function killScan() {
633
- return wordfence::ajax_killScan_callback();
634
  }
635
-
636
  function set_showhide() {
637
  $hide = isset( $_POST['showhide'] ) && ( $_POST['showhide'] === 'hide' ) ? 'hide' : '';
638
  MainWP_Helper::update_option( 'mainwp_wordfence_hide_plugin', $hide, 'yes' );
@@ -642,7 +639,7 @@ class MainWP_Child_Wordfence {
642
  }
643
 
644
  public function wordfence_init() {
645
- if ( get_option( 'mainwp_wordfence_ext_enabled' ) !== 'Y' ) return;
646
  if ( ! $this->is_wordfence_installed ) return;
647
 
648
  add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
@@ -728,7 +725,7 @@ class MainWP_Child_Wordfence {
728
  public function wfc_cron_scan() {
729
  if ( ! class_exists( 'wordfence' ) || ! class_exists( 'wfScanEngine' ) ) {
730
  return;
731
- }
732
  $this->start_scan();
733
  }
734
 
@@ -750,9 +747,9 @@ class MainWP_Child_Wordfence {
750
  public function get_log() {
751
  $information = array();
752
  $wfLog = wordfence::getLog();
753
- if ( $wfLog ) {
754
  $information['events'] = $wfLog->getStatusEvents( 0 );
755
-
756
  if (method_exists($wfLog, 'getSummaryEvents')) {
757
  $information['summary'] = $wfLog->getSummaryEvents();
758
  } else {
@@ -764,22 +761,23 @@ class MainWP_Child_Wordfence {
764
 
765
  return $information;
766
  }
767
-
768
  public function update_log() {
769
  return wordfence::ajax_activityLogUpdate_callback();
770
  }
771
 
 
772
  public function load_issues() {
773
  $offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0;
774
  $limit = isset($_POST['limit']) ? intval($_POST['limit']) : WORDFENCE_SCAN_ISSUES_PER_PAGE;
775
-
776
  $i = new wfIssues();
777
  $iss = $i->getIssues($offset, $limit);
778
  $counts = $i->getIssueCounts();
779
-
780
  return array(
781
  'issuesLists' => $iss,
782
- 'issueCounts' => $counts,
783
  'lastScanCompleted' => wfConfig::get( 'lastScanCompleted' ),
784
  'apiKey' => wfConfig::get( 'apiKey' ),
785
  'isPaid' => wfConfig::get('isPaid'),
@@ -791,37 +789,38 @@ class MainWP_Child_Wordfence {
791
  'wafData' => $this->_getWAFData()
792
  );
793
  }
794
-
795
  public static function ajax_loadIssues_callback(){
796
  $offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0;
797
  $limit = isset($_POST['limit']) ? intval($_POST['limit']) : WORDFENCE_SCAN_ISSUES_PER_PAGE;
798
-
799
  $i = new wfIssues();
800
  $iss = $i->getIssues($offset, $limit);
801
  $counts = $i->getIssueCounts();
802
  $return = array(
803
  'issuesLists' => $iss,
804
  'issueCounts' => $counts,
805
- 'lastScanCompleted' => wfConfig::get('lastScanCompleted'),
806
  'apiKey' => wfConfig::get( 'apiKey' ),
807
  'isPaid' => wfConfig::get('isPaid'),
808
- 'lastscan_timestamp' => MainWP_Child_Wordfence::Instance()->get_lastscan(),
809
  'todayAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(1),
810
  'weekAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(7),
811
- 'monthAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(30),
812
- );
 
813
  return $return;
814
  }
815
-
816
  public function load_wafData() {
817
-
818
- $return = array(
819
  'wafData' => $this->_getWAFData(),
820
- 'ip' => wfUtils::getIP(),
821
  'ajaxWatcherDisabled_front' => (bool)wfConfig::get('ajaxWatcherDisabled_front'),
822
- 'ajaxWatcherDisabled_admin' => (bool)wfConfig::get('ajaxWatcherDisabled_admin')
823
  );
824
-
825
  if (class_exists('wfFirewall')) {
826
  $firewall = new wfFirewall();
827
  $return['isSubDirectoryInstallation'] = $firewall->isSubDirectoryInstallation();
@@ -874,15 +873,15 @@ SQL
874
  }
875
  $wfIssues->updateIssue($issueID, $status);
876
  wfScanEngine::refreshScanNotification($wfIssues);
877
-
878
  $counts = $wfIssues->getIssueCounts();
879
  return array(
880
  'ok' => 1,
881
  'issueCounts' => $counts,
882
  );
883
  }
884
-
885
- function update_issues_status() {
886
  $wfIssues = new wfIssues();
887
  $status = $_POST['status'];
888
  $issueID = $_POST['id'];
@@ -994,8 +993,8 @@ SQL
994
 
995
  function bulkOperation() {
996
  return wordfence::ajax_bulkOperation_callback();
997
- }
998
-
999
  function delete_file() {
1000
  $issueID = $_POST['issueID'];
1001
  $wfIssues = new wfIssues();
@@ -1096,25 +1095,25 @@ SQL
1096
  }
1097
  return $res;
1098
  }
1099
-
1100
- function save_settings_new()
1101
- {
1102
  if (isset($_POST['encrypted']))
1103
- $settings = $this->simple_crypt( 'thisisakey', $_POST['settings'], 'decrypt' ); // to fix pass through sec rules of Dreamhost
1104
  else {
1105
  $settings = maybe_unserialize( base64_decode( $_POST['settings'] ) );
1106
  }
1107
-
1108
  $section = isset($_POST['savingSection']) ? $_POST['savingSection'] : '';
1109
  $saving_opts = self::getSectionSettings($section);
1110
-
1111
  $result = array();
1112
-
1113
  if ( is_array( $settings ) && count( $settings ) > 0 && count($saving_opts) > 0 ) {
1114
-
1115
  $reload = '';
1116
  $opts = $settings;
1117
-
1118
  // if saving then validate data
1119
  if (in_array('liveTraf_ignoreUsers', $saving_opts)) {
1120
  $validUsers = array();
@@ -1142,7 +1141,7 @@ SQL
1142
  }
1143
  }
1144
 
1145
- // if saving then validate data
1146
  if (in_array('other_WFNet', $saving_opts)) {
1147
  if ( ! $opts['other_WFNet'] ) {
1148
  $wfdb = new wfDB();
@@ -1153,15 +1152,15 @@ SQL
1153
  }
1154
 
1155
  $regenerateHtaccess = false;
1156
- // if saving then validate data
1157
  if (in_array('bannedURLs', $saving_opts)) {
1158
  if ( wfConfig::get( 'bannedURLs', false ) !== $opts['bannedURLs'] ) {
1159
  $regenerateHtaccess = true;
1160
  }
1161
- }
1162
- //error_log(print_r($opts, true));
1163
  // $to_fix_boolean_values = array(
1164
- // 'scansEnabled_checkGSB',
1165
  // 'spamvertizeCheck',
1166
  // 'checkSpamIP',
1167
  // 'scansEnabled_checkHowGetIPs',
@@ -1186,29 +1185,29 @@ SQL
1186
  // 'scansEnabled_scanImages',
1187
  // 'scansEnabled_highSense',
1188
  // 'scheduledScansEnabled',
1189
- // 'lowResourceScansEnabled',
1190
  // );
1191
- //
1192
  // save the settings
1193
- foreach ( $opts as $key => $val ) {
1194
  // check saving section fields
1195
  if ( in_array( $key, $saving_opts ) ) {
1196
  if ( 'apiKey' == $key ) { //Don't save API key yet
1197
  continue;
1198
- }
1199
  if (in_array( $key, self::$firewall_options_filter ) ) {
1200
  wfWAF::getInstance()->getStorageEngine()->setConfig($key, $val);
1201
- } else {
1202
- wfConfig::set( $key, $val ); // save it
1203
- }
1204
- }
1205
  }
1206
-
1207
  if ( $regenerateHtaccess && ( wfConfig::get('cacheType') == 'falcon' ) ) {
1208
  wfCache::addHtaccessCode('add');
1209
  }
1210
-
1211
- // if saving then validate data
1212
  if (in_array('autoUpdate', $saving_opts)) {
1213
  if ( '1' === $opts['autoUpdate'] ) {
1214
  wfConfig::enableAutoUpdate();
@@ -1216,8 +1215,8 @@ SQL
1216
  wfConfig::disableAutoUpdate();
1217
  }
1218
  }
1219
-
1220
- // if saving then validate data
1221
  if (in_array('disableCodeExecutionUploads', $saving_opts)) {
1222
  if (isset($opts['disableCodeExecutionUploads'])) {
1223
  try {
@@ -1232,8 +1231,8 @@ SQL
1232
  }
1233
  }
1234
 
1235
- // if saving then validate data
1236
- if (in_array('email_summary_enabled', $saving_opts)) {
1237
  if (isset($opts['email_summary_enabled'])) {
1238
  if ( ! empty( $opts['email_summary_enabled'] ) ) {
1239
  wfConfig::set( 'email_summary_enabled', 1 );
@@ -1246,9 +1245,9 @@ SQL
1246
  }
1247
  }
1248
  }
1249
-
1250
- // if saving then validate data
1251
- if (in_array('scheduleScan', $saving_opts)) {
1252
  $sch = isset( $opts['scheduleScan'] ) ? $opts['scheduleScan'] : '';
1253
  if ( get_option( 'mainwp_child_wordfence_cron_time' ) !== $sch ) {
1254
  update_option( 'mainwp_child_wordfence_cron_time', $sch );
@@ -1258,17 +1257,17 @@ SQL
1258
  }
1259
  }
1260
  }
1261
-
1262
  // Finished saving settings
1263
  /////////////////////
1264
-
1265
-
1266
  $result['cacheType'] = wfConfig::get( 'cacheType' );
1267
  $result['paidKeyMsg'] = false;
1268
-
1269
  // if saving then validate data
1270
- if (in_array('apiKey', $saving_opts)) {
1271
- $apiKey = trim( $_POST['apiKey'] );
1272
  if ( ! $apiKey ) { //Empty API key (after trim above), then try to get one.
1273
  $api = new wfAPI( '', wfUtils::getWPVersion() );
1274
  try {
@@ -1319,26 +1318,26 @@ SQL
1319
  }
1320
  }
1321
  }
1322
-
1323
  $result['ok'] = 1;
1324
  $result['reload'] = $reload;
1325
-
1326
  return $result;
1327
  } else {
1328
  $result['error'] = 'Empty settings';
1329
- }
1330
-
1331
  return $result;
1332
- }
1333
-
1334
-
1335
- public static function recentTraffic(){
1336
- return wordfence::ajax_recentTraffic_callback();
1337
  }
1338
-
1339
  function save_setting() {
1340
  if (isset($_POST['encrypted']))
1341
- $settings = $this->simple_crypt( 'thisisakey', $_POST['settings'], 'decrypt' ); // to fix pass through sec rules of Dreamhost
1342
  else {
1343
  $settings = maybe_unserialize( base64_decode( $_POST['settings'] ) );
1344
  }
@@ -1433,7 +1432,7 @@ SQL
1433
  wp_unschedule_event( $sched, 'mainwp_child_wordfence_cron_scan' );
1434
  }
1435
  }
1436
-
1437
  $result['cacheType'] = wfConfig::get( 'cacheType' );
1438
  $result['paidKeyMsg'] = false;
1439
  $apiKey = trim( $_POST['apiKey'] );
@@ -1488,7 +1487,7 @@ SQL
1488
  }
1489
  $result['ok'] = 1;
1490
  $result['reload'] = $reload;
1491
-
1492
  return $result;
1493
  }
1494
  }
@@ -1558,15 +1557,15 @@ SQL
1558
  $p = $wpdb->base_prefix;
1559
 
1560
  $serverTime = $wfdb->querySingle( 'select unix_timestamp()' );
1561
-
1562
  $jsonData = array(
1563
  'serverTime' => $serverTime,
1564
  'serverMicrotime' => microtime(true),
1565
  'msg' => $wfdb->querySingle( "select msg from $p" . 'wfStatus where level < 3 order by ctime desc limit 1' ),
1566
  );
1567
-
1568
  $events = array();
1569
- $alsoGet = $_POST['alsoGet'];
1570
  if ( preg_match( '/^logList_(404|hit|human|ruser|crawler|gCrawler|loginLogout)$/', $alsoGet, $m ) ) {
1571
  $type = $m[1];
1572
  $newestEventTime = $_POST['otherParams'];
@@ -1587,7 +1586,7 @@ SQL
1587
  if (isset($results['sql'])) {
1588
  $jsonData['sql'] = $results['sql'];
1589
  }
1590
- }
1591
  $jsonData['events'] = $events;
1592
  $jsonData['alsoGet'] = $alsoGet; //send it back so we don't load data if panel has changed
1593
  $jsonData['cacheType'] = wfConfig::get( 'cacheType' );
@@ -1597,116 +1596,116 @@ SQL
1597
  public static function loadLiveTraffic() {
1598
  $wfdb = new wfDB();
1599
  $serverTime = $wfdb->querySingle( 'select unix_timestamp()' );
1600
- $return = wordfence::ajax_loadLiveTraffic_callback();
1601
  $return['serverTime'] = $serverTime;
1602
  $return['serverMicrotime'] = microtime(true);
1603
- return $return;
1604
  }
1605
 
1606
- function whitelistWAFParamKey() {
1607
  $return = wordfence::ajax_whitelistWAFParamKey_callback();
1608
- return $return;
1609
  }
1610
 
1611
- function hideFileHtaccess() {
1612
  $return = wordfence::ajax_hideFileHtaccess_callback();
1613
- return $return;
1614
- }
1615
-
1616
  public static function fixFPD(){
1617
  $return = wordfence::ajax_fixFPD_callback();
1618
- return $return;
1619
  }
1620
-
1621
  public static function disableDirectoryListing() {
1622
  $return = wordfence::ajax_disableDirectoryListing_callback();
1623
- return $return;
1624
- }
1625
-
1626
  public static function deleteDatabaseOption() {
1627
  $return = wordfence::ajax_deleteDatabaseOption_callback();
1628
- return $return;
1629
- }
1630
 
1631
  public static function misconfiguredHowGetIPsChoice() {
1632
  $return = wordfence::ajax_misconfiguredHowGetIPsChoice_callback();
1633
  return $return;
1634
  }
1635
-
1636
  public static function deleteAdminUser() {
1637
  $return = wordfence::ajax_deleteAdminUser_callback();
1638
- return $return;
1639
- }
1640
-
1641
  public static function revokeAdminUser() {
1642
  $return = wordfence::ajax_revokeAdminUser_callback();
1643
- return $return;
1644
  }
1645
 
1646
  public static function clearAllBlocked() {
1647
  $return = wordfence::ajax_clearAllBlocked_callback();
1648
- return $return;
1649
- }
1650
-
1651
  public static function permanentlyBlockAllIPs() {
1652
  $return = wordfence::ajax_permanentlyBlockAllIPs_callback();
1653
- return $return;
1654
- }
1655
-
1656
  public static function unlockOutIP() {
1657
  $return = wordfence::ajax_unlockOutIP_callback();
1658
- return $return;
1659
- }
1660
-
1661
  public static function unblockRange() {
1662
  $return = wordfence::ajax_unblockRange_callback();
1663
- return $return;
1664
- }
1665
-
1666
  public static function blockIPUARange() {
1667
  $return = wordfence::ajax_blockIPUARange_callback();
1668
- return $return;
1669
- }
1670
-
1671
  public static function loadBlockRanges() {
1672
  $return = wordfence::ajax_loadBlockRanges_callback();
1673
- return $return;
1674
  }
1675
-
1676
- public static function saveWAFConfig() {
1677
  $return = wordfence::ajax_saveWAFConfig_callback();
1678
- if (is_array($return) && isset($return['data'])) {
1679
  $return['learningModeGracePeriod'] = wfWAF::getInstance()->getStorageEngine()->getConfig('learningModeGracePeriod');
1680
  }
1681
- return $return;
1682
- }
1683
-
1684
  public static function whitelistBulkDelete() {
1685
  $return = wordfence::ajax_whitelistBulkDelete_callback();
1686
- return $return;
1687
- }
1688
-
1689
- public static function whitelistBulkEnable() {
1690
  $return = wordfence::ajax_whitelistBulkEnable_callback();
1691
- return $return;
1692
  }
1693
-
1694
  public static function whitelistBulkDisable() {
1695
  $return = wordfence::ajax_whitelistBulkDisable_callback();
1696
- return $return;
1697
- }
1698
  public static function updateConfig() {
1699
  $return = wordfence::ajax_updateConfig_callback();
1700
- return $return;
1701
- }
1702
-
1703
  // credit of Wordfence
1704
  private static function _getWAFData($updated = null) {
1705
  // custom
1706
  if(!class_exists('wfWAF'))
1707
  return false;
1708
  // end if custom
1709
-
1710
  $data['learningMode'] = wfWAF::getInstance()->isInLearningMode();
1711
  $data['rules'] = wfWAF::getInstance()->getRules();
1712
  /** @var wfWAFRule $rule */
@@ -1750,14 +1749,14 @@ SQL
1750
  $data['rulesLastUpdated'] = $lastUpdated;
1751
  }
1752
  $data['isPaid'] = (bool) wfConfig::get('isPaid', 0);
1753
-
1754
  if ($updated !== null) {
1755
  $data['updated'] = (bool) $updated;
1756
  }
1757
  return $data;
1758
  }
1759
-
1760
-
1761
  function reverse_lookup() {
1762
  $ips = explode( ',', $_POST['ips'] );
1763
  $res = array();
@@ -1768,27 +1767,27 @@ SQL
1768
  return array( 'ok' => 1, 'ips' => $res );
1769
  }
1770
 
1771
-
1772
- public function saveOptions(){
1773
- if (!empty($_POST['changes']) && ($changes = json_decode(stripslashes($_POST['changes']), true)) !== false) {
1774
- try {
1775
  if (is_array($changes) && isset($changes['whitelistedURLParams']) && isset($changes['whitelistedURLParams']['add'])) {
1776
  $user = wp_get_current_user();
1777
  foreach($changes['whitelistedURLParams']['add'] as $key => &$value) :
1778
  if (isset($value['data'])) {
1779
-
1780
  if(isset($value['data']['userID'])) {
1781
  $value['data']['userID'] = $user->ID;
1782
  }
1783
  if(isset($value['data']['username'])) {
1784
  $value['data']['username'] = $user->user_login;
1785
- }
1786
  }
1787
  endforeach;
1788
  }
1789
-
1790
  $errors = wfConfig::validate($changes);
1791
-
1792
  if ($errors !== true) {
1793
  if (count($errors) == 1) {
1794
  return array(
@@ -1804,12 +1803,12 @@ SQL
1804
  'error' => sprintf(__('Errors occurred while saving the configuration: %s', 'wordfence'), implode(', ', $compoundMessage)),
1805
  );
1806
  }
1807
-
1808
  return array(
1809
  'error' => __('Errors occurred while saving the configuration.', 'wordfence'),
1810
  );
1811
  }
1812
-
1813
  wfConfig::save($changes);
1814
  return array('success' => true);
1815
  }
@@ -1824,41 +1823,41 @@ SQL
1824
  );
1825
  }
1826
  }
1827
-
1828
  return array(
1829
  'error' => __('No configuration changes were provided to save.', 'wordfence'),
1830
- );
1831
  }
1832
-
1833
  public function ajax_getBlocks_callback(){
1834
  $information = wordfence::ajax_getBlocks_callback();
1835
  return $information;
1836
  }
1837
  // credit of Wordfence
1838
  public function ajax_createBlock_callback()
1839
- {
1840
- return wordfence::ajax_createBlock_callback();
1841
- }
1842
-
1843
- public static function ajax_deleteBlocks_callback() {
1844
  $information = wordfence::ajax_deleteBlocks_callback();
1845
  return $information;
1846
  }
1847
-
1848
- public static function ajax_makePermanentBlocks_callback() {
1849
  $information = wordfence::ajax_makePermanentBlocks_callback();
1850
  return $information;
1851
  }
1852
-
1853
  public function ajax_blockIP_callback(){
1854
  return wordfence::ajax_blockIP_callback();
1855
  }
1856
-
1857
  // credit of Wordfence
1858
  public function whois(){
1859
  return wordfence::ajax_whois_callback();
1860
  }
1861
-
1862
  function unblock_ip() {
1863
  if ( isset( $_POST['IP'] ) ) {
1864
  $IP = $_POST['IP'];
@@ -1866,7 +1865,7 @@ SQL
1866
  return array( 'success' => 1 );
1867
  }
1868
  }
1869
-
1870
  public static function saveCountryBlocking(){
1871
  if(! wfConfig::get('isPaid')){
1872
  return array('error' => "Sorry but this feature is only available for paid customers.");
@@ -2042,7 +2041,7 @@ SQL
2042
  }
2043
  return array('ok' => 1);
2044
  }
2045
-
2046
  public static function downloadHtaccess() {
2047
  if ( ! isset( $_GET['_wpnonce'] ) || empty( $_GET['_wpnonce'] ) ) {
2048
  die( '-1' );
@@ -2201,7 +2200,7 @@ SQL
2201
  $return['ok'] = 1;
2202
  return $return;
2203
  }
2204
-
2205
  public function getDiagnostics() {
2206
 
2207
  $diagnostic = new wfDiagnostic;
@@ -2212,15 +2211,15 @@ SQL
2212
  $themes = wp_get_themes();
2213
  $currentTheme = wp_get_theme();
2214
  $cols = 3;
2215
-
2216
  $w = new wfConfig();
2217
-
2218
- $inEmail = false;
2219
- ob_start();
2220
 
2221
  ?>
2222
  <div id="wf-diagnostics">
2223
-
2224
  <form id="wfConfigForm" style="overflow-x: auto;">
2225
  <?php foreach ($diagnostic->getResults() as $title => $tests):
2226
  $key = sanitize_key('wf-diagnostics-' . $title);
@@ -2760,12 +2759,12 @@ SQL
2760
  </div>
2761
  </div>
2762
  </form>
2763
- </div>
2764
  <script type="application/javascript">
2765
- jQuery( document ).ready(function ($) {
2766
  $('.wf-block-header-action-disclosure').each(function() {
2767
  $(this).closest('.wf-block-header').css('cursor', 'pointer');
2768
-
2769
  $(this).closest('.wf-block-header').on('click', function(e) {
2770
  // Let links in the header work.
2771
  if (e.target && e.target.nodeName === 'A' && e.target.href) {
@@ -2796,17 +2795,17 @@ SQL
2796
  });
2797
  }
2798
  });
2799
- });
2800
- });
2801
- </script>
2802
-
2803
 
2804
  <?php
2805
  $html = ob_get_clean();
2806
  return array('ok' => 1, 'html' => $html);
2807
 
2808
  }
2809
-
2810
  public static function updateWAFRules() {
2811
  $event = new wfWAFCronFetchRulesEvent(time() - 2);
2812
  $event->setWaf(wfWAF::getInstance());
@@ -2815,22 +2814,22 @@ SQL
2815
  //return self::_getWAFData();
2816
  return array('ok' => 1, 'isPaid' => $isPaid );
2817
  }
2818
-
2819
  public static function updateWAFRules_New() {
2820
  $event = new wfWAFCronFetchRulesEvent(time() - 2);
2821
  $event->setWaf(wfWAF::getInstance());
2822
  $success = $event->fire();
2823
 
2824
- return self::_getWAFData($success);
2825
  }
2826
-
2827
- public static function save_debugging_config() {
2828
- $settings = $_POST['settings'];
2829
  foreach (self::$diagnosticParams as $param) {
2830
  if (isset($settings[$param])) {
2831
- wfConfig::set( $param, $settings[$param] );
2832
  }
2833
- }
2834
  return array('ok' => 1 );
2835
  }
2836
  }
1
  <?php
2
 
3
  class MainWP_Child_Wordfence {
4
+ public static $instance = null;
5
  public $is_wordfence_installed = false;
6
  public $plugin_translate = 'mainwp-child';
7
+
8
  const OPTIONS_TYPE_GLOBAL = 'global';
9
  const OPTIONS_TYPE_FIREWALL = 'firewall';
10
  const OPTIONS_TYPE_BLOCKING = 'blocking';
14
  const OPTIONS_TYPE_COMMENT_SPAM = 'commentspam';
15
  const OPTIONS_TYPE_DIAGNOSTICS = 'diagnostics';
16
  const OPTIONS_TYPE_ALL = 'alloptions';
17
+
18
  public static $options_filter = array(
19
  'alertEmails',
20
  'alertOn_adminLogin',
33
  'autoUpdate',
34
  'firewallEnabled',
35
  'howGetIPs',
36
+ 'liveTrafficEnabled',
37
  'loginSec_blockAdminReg',
38
  'loginSec_countFailMins',
39
  'loginSec_disableAuthorScan',
40
+ 'notification_updatesNeeded',
41
  "notification_securityAlerts",
42
  "notification_promotions",
43
  "notification_blogHighlights",
66
  'scansEnabled_dns',
67
  'scansEnabled_fileContents',
68
  'scansEnabled_fileContentsGSB',
69
+ 'scan_include_extra',
70
  //'scansEnabled_heartbleed',
71
  'scansEnabled_checkHowGetIPs',
72
  'scansEnabled_highSense',
151
  'learningModeGracePeriodEnabled',
152
  'learningModeGracePeriod'
153
  );
154
+
155
  // for separated saving this values
156
  public static $diagnosticParams = array(
157
  //'addCacheComment',
161
  //'disableConfigCaching',
162
  'betaThreatDefenseFeed',
163
  );
164
+
165
  public static $firewall_options_filter = array(
166
  'wafStatus',
167
  'learningModeGracePeriodEnabled',
168
  'learningModeGracePeriod'
169
  );
170
+
171
 
172
  static function Instance() {
173
  if ( null === MainWP_Child_Wordfence::$instance ) {
182
  add_action( 'mainwp_child_deactivation', array( $this, 'deactivation' ) );
183
 
184
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
185
+
186
  // ok
187
  if ( is_plugin_active( 'wordfence/wordfence.php' ) && file_exists( plugin_dir_path( __FILE__ ) . '../../wordfence/wordfence.php' ) ) {
188
  require_once( plugin_dir_path( __FILE__ ) . '../../wordfence/wordfence.php' );
214
  MainWP_Helper::write( $information );
215
  }
216
  if ( isset( $_POST['mwp_action'] ) ) {
217
+
218
  switch ( $_POST['mwp_action'] ) {
219
  case 'start_scan':
220
  $information = $this->start_scan();
227
  break;
228
  case 'killScan':
229
  $information = $this->killScan();
230
+ break;
231
  case 'set_showhide':
232
  $information = $this->set_showhide();
233
  break;
234
  case 'get_log':
235
  $information = $this->get_log();
236
+ break;
237
  case 'update_log':
238
  $information = $this->update_log();
239
  break;
 
 
 
240
  case 'load_issues': // not used in from version 2.0 of WF ext
241
  $information = $this->load_issues();
242
  break;
243
  case 'loadIssues':
244
  $information = $this->ajax_loadIssues_callback();
245
+ break;
246
  case 'load_wafData':
247
  $information = $this->load_wafData();
248
  break;
263
  break;
264
  case 'bulkOperation': // new
265
  $information = $this->bulkOperation();
266
+ break;
267
  case 'delete_file':
268
  $information = $this->delete_file();
269
  break;
278
  break;
279
  case 'saveOptions':
280
  $information = $this->saveOptions();
281
+ break;
282
  case 'recentTraffic':
283
  $information = $this->recentTraffic();
284
+ break;
285
  case 'ticker':
286
  $information = $this->ticker();
287
  break;
293
  break;
294
  case 'whois':
295
  $information = $this->whois();
296
+ break;
297
+ case 'createBlock': // new version blockIP, blockIPUARange
298
  $information = $this->ajax_createBlock_callback();
299
+ break;
300
  case 'getBlocks':
301
  $information = $this->ajax_getBlocks_callback();
302
  break;
305
  break;
306
  case 'makePermanentBlocks':
307
  $information = $this->ajax_makePermanentBlocks_callback();
308
+ break;
309
  case 'unblock_ip':
310
  $information = $this->unblock_ip();
311
  break;
356
  break;
357
  case 'update_waf_rules_new':
358
  $information = $this->updateWAFRules_New();
359
+ break;
360
  case 'save_debugging_config':
361
  $information = $this->save_debugging_config();
362
  break;
365
  break;
366
  case 'white_list_waf':
367
  $information = $this->whitelistWAFParamKey();
368
+ break;
369
  case 'hide_file_htaccess':
370
  $information = $this->hideFileHtaccess();
371
+ break;
372
  case 'fix_fpd':
373
  $information = $this->fixFPD();
374
  break;
380
  break;
381
  case 'misconfigured_howget_ips_choice':
382
  $information = $this->misconfiguredHowGetIPsChoice();
383
+ break;
384
  case 'delete_admin_user':
385
  $information = $this->deleteAdminUser();
386
  break;
398
  break;
399
  case 'unblock_range':
400
  $information = $this->unblockRange();
401
+ break;
402
  case 'block_ip_ua_range':
403
  $information = $this->blockIPUARange();
404
  break;
416
  break;
417
  case 'whitelist_bulk_disable':
418
  $information = $this->whitelistBulkDisable();
419
+ break;
420
  case 'update_config':
421
  $information = $this->updateConfig();
422
  break;
426
  }
427
  }
428
  MainWP_Helper::write( $information );
429
+ }
430
+
431
+
432
  public static function getSectionSettings($section) {
433
  $general_opts = array(
434
  'scheduleScan',
470
  'email_summary_dashboard_widget_enabled',
471
  'other_noAnonMemberComments',
472
  'other_scanComments',
473
+ 'advancedCommentScanning' // paid
474
  );
475
+
476
  $traffic_opts = array(
477
  'liveTrafficEnabled',
478
  'liveTraf_ignorePublishers',
483
  'liveTraf_maxRows',
484
  'displayTopLevelLiveTraffic'
485
  );
486
+
487
  $firewall_opts = array(
488
  'disableWAFIPBlocking',
489
  'whitelisted',
513
  'loginSec_lockoutMins',
514
  'loginSec_lockInvalidUsers',
515
  'loginSec_breachPasswds_enabled',
516
+ 'loginSec_breachPasswds',
517
  'loginSec_userBlacklist',
518
  'loginSec_strongPasswds_enabled',
519
+ 'loginSec_strongPasswds',
520
  'loginSec_maskLoginErrors',
521
  'loginSec_blockAdminReg',
522
  'loginSec_disableAuthorScan',
525
  'other_WFNet',
526
  'wafStatus',
527
  'learningModeGracePeriodEnabled',
528
+ 'learningModeGracePeriod'
529
  );
530
+
531
  $scan_opts = array(
532
  'scansEnabled_checkGSB', //paid
533
  'spamvertizeCheck', //paid
570
  'ssl_verify',
571
  'betaThreatDefenseFeed'
572
  );
573
+
574
  $blocking_opts = array(
575
+ 'displayTopLevelBlocking',
576
  );
577
+
578
  $options = array();
579
+
580
  switch($section) {
581
  case self::OPTIONS_TYPE_GLOBAL:
582
  $options = $general_opts;
588
  $options = $firewall_opts;
589
  break;
590
  case self::OPTIONS_TYPE_SCANNER:
591
+ $options = $scan_opts;
592
  break;
593
  case self::OPTIONS_TYPE_DIAGNOSTICS:
594
  $options = $diagnostics_opts;
599
  case self::OPTIONS_TYPE_ALL:
600
  $options = array_merge($general_opts, $traffic_opts, $firewall_opts, $scan_opts, $diagnostics_opts, $blocking_opts);
601
  break;
602
+ }
603
  return $options;
604
  }
605
+
606
+
607
+ private function start_scan() {
608
  $information = wordfence::ajax_scan_callback();
609
+ if ( is_array($information) && isset($information['ok']) )
610
  $information['result'] = 'SUCCESS';
611
+
612
  return $information;
613
  }
614
 
615
+ private function kill_scan() {
616
  wordfence::status(1, 'info', "Scan kill request received.");
617
  wordfence::status(10, 'info', "SUM_KILLED:A request was received to kill the previous scan.");
618
  wfUtils::clearScanLock(); //Clear the lock now because there may not be a scan running to pick up the kill request and clear the lock
619
  wfScanEngine::requestKill();
620
  return array(
621
  'ok' => 1,
622
+ );
623
  }
624
+
625
+ private function requestScan() {
626
+ return wordfence::ajax_scan_callback();
627
  }
628
 
629
+ private function killScan() {
630
+ return wordfence::ajax_killScan_callback();
631
  }
632
+
633
  function set_showhide() {
634
  $hide = isset( $_POST['showhide'] ) && ( $_POST['showhide'] === 'hide' ) ? 'hide' : '';
635
  MainWP_Helper::update_option( 'mainwp_wordfence_hide_plugin', $hide, 'yes' );
639
  }
640
 
641
  public function wordfence_init() {
642
+
643
  if ( ! $this->is_wordfence_installed ) return;
644
 
645
  add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
725
  public function wfc_cron_scan() {
726
  if ( ! class_exists( 'wordfence' ) || ! class_exists( 'wfScanEngine' ) ) {
727
  return;
728
+ }
729
  $this->start_scan();
730
  }
731
 
747
  public function get_log() {
748
  $information = array();
749
  $wfLog = wordfence::getLog();
750
+ if ( $wfLog ) {
751
  $information['events'] = $wfLog->getStatusEvents( 0 );
752
+
753
  if (method_exists($wfLog, 'getSummaryEvents')) {
754
  $information['summary'] = $wfLog->getSummaryEvents();
755
  } else {
761
 
762
  return $information;
763
  }
764
+
765
  public function update_log() {
766
  return wordfence::ajax_activityLogUpdate_callback();
767
  }
768
 
769
+ // not used
770
  public function load_issues() {
771
  $offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0;
772
  $limit = isset($_POST['limit']) ? intval($_POST['limit']) : WORDFENCE_SCAN_ISSUES_PER_PAGE;
773
+
774
  $i = new wfIssues();
775
  $iss = $i->getIssues($offset, $limit);
776
  $counts = $i->getIssueCounts();
777
+
778
  return array(
779
  'issuesLists' => $iss,
780
+ 'issueCounts' => $counts,
781
  'lastScanCompleted' => wfConfig::get( 'lastScanCompleted' ),
782
  'apiKey' => wfConfig::get( 'apiKey' ),
783
  'isPaid' => wfConfig::get('isPaid'),
789
  'wafData' => $this->_getWAFData()
790
  );
791
  }
792
+
793
  public static function ajax_loadIssues_callback(){
794
  $offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0;
795
  $limit = isset($_POST['limit']) ? intval($_POST['limit']) : WORDFENCE_SCAN_ISSUES_PER_PAGE;
796
+
797
  $i = new wfIssues();
798
  $iss = $i->getIssues($offset, $limit);
799
  $counts = $i->getIssueCounts();
800
  $return = array(
801
  'issuesLists' => $iss,
802
  'issueCounts' => $counts,
803
+ 'lastScanCompleted' => wfConfig::get('lastScanCompleted'),
804
  'apiKey' => wfConfig::get( 'apiKey' ),
805
  'isPaid' => wfConfig::get('isPaid'),
806
+ 'lastscan_timestamp' => MainWP_Child_Wordfence::Instance()->get_lastscan(),
807
  'todayAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(1),
808
  'weekAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(7),
809
+ 'monthAttBlocked' => MainWP_Child_Wordfence::Instance()->count_attacks_blocked(30),
810
+ 'issueCount' => $i->getIssueCount(),
811
+ );
812
  return $return;
813
  }
814
+
815
  public function load_wafData() {
816
+
817
+ $return = array(
818
  'wafData' => $this->_getWAFData(),
819
+ 'ip' => wfUtils::getIP(),
820
  'ajaxWatcherDisabled_front' => (bool)wfConfig::get('ajaxWatcherDisabled_front'),
821
+ 'ajaxWatcherDisabled_admin' => (bool)wfConfig::get('ajaxWatcherDisabled_admin')
822
  );
823
+
824
  if (class_exists('wfFirewall')) {
825
  $firewall = new wfFirewall();
826
  $return['isSubDirectoryInstallation'] = $firewall->isSubDirectoryInstallation();
873
  }
874
  $wfIssues->updateIssue($issueID, $status);
875
  wfScanEngine::refreshScanNotification($wfIssues);
876
+
877
  $counts = $wfIssues->getIssueCounts();
878
  return array(
879
  'ok' => 1,
880
  'issueCounts' => $counts,
881
  );
882
  }
883
+
884
+ function update_issues_status() {
885
  $wfIssues = new wfIssues();
886
  $status = $_POST['status'];
887
  $issueID = $_POST['id'];
993
 
994
  function bulkOperation() {
995
  return wordfence::ajax_bulkOperation_callback();
996
+ }
997
+
998
  function delete_file() {
999
  $issueID = $_POST['issueID'];
1000
  $wfIssues = new wfIssues();
1095
  }
1096
  return $res;
1097
  }
1098
+
1099
+ function save_settings_new()
1100
+ {
1101
  if (isset($_POST['encrypted']))
1102
+ $settings = $this->simple_crypt( 'thisisakey', $_POST['settings'], 'decrypt' ); // to fix pass through sec rules of Dreamhost
1103
  else {
1104
  $settings = maybe_unserialize( base64_decode( $_POST['settings'] ) );
1105
  }
1106
+
1107
  $section = isset($_POST['savingSection']) ? $_POST['savingSection'] : '';
1108
  $saving_opts = self::getSectionSettings($section);
1109
+
1110
  $result = array();
1111
+
1112
  if ( is_array( $settings ) && count( $settings ) > 0 && count($saving_opts) > 0 ) {
1113
+
1114
  $reload = '';
1115
  $opts = $settings;
1116
+
1117
  // if saving then validate data
1118
  if (in_array('liveTraf_ignoreUsers', $saving_opts)) {
1119
  $validUsers = array();
1141
  }
1142
  }
1143
 
1144
+ // if saving then validate data
1145
  if (in_array('other_WFNet', $saving_opts)) {
1146
  if ( ! $opts['other_WFNet'] ) {
1147
  $wfdb = new wfDB();
1152
  }
1153
 
1154
  $regenerateHtaccess = false;
1155
+ // if saving then validate data
1156
  if (in_array('bannedURLs', $saving_opts)) {
1157
  if ( wfConfig::get( 'bannedURLs', false ) !== $opts['bannedURLs'] ) {
1158
  $regenerateHtaccess = true;
1159
  }
1160
+ }
1161
+ //error_log(print_r($opts, true));
1162
  // $to_fix_boolean_values = array(
1163
+ // 'scansEnabled_checkGSB',
1164
  // 'spamvertizeCheck',
1165
  // 'checkSpamIP',
1166
  // 'scansEnabled_checkHowGetIPs',
1185
  // 'scansEnabled_scanImages',
1186
  // 'scansEnabled_highSense',
1187
  // 'scheduledScansEnabled',
1188
+ // 'lowResourceScansEnabled',
1189
  // );
1190
+ //
1191
  // save the settings
1192
+ foreach ( $opts as $key => $val ) {
1193
  // check saving section fields
1194
  if ( in_array( $key, $saving_opts ) ) {
1195
  if ( 'apiKey' == $key ) { //Don't save API key yet
1196
  continue;
1197
+ }
1198
  if (in_array( $key, self::$firewall_options_filter ) ) {
1199
  wfWAF::getInstance()->getStorageEngine()->setConfig($key, $val);
1200
+ } else {
1201
+ wfConfig::set( $key, $val ); // save it
1202
+ }
1203
+ }
1204
  }
1205
+
1206
  if ( $regenerateHtaccess && ( wfConfig::get('cacheType') == 'falcon' ) ) {
1207
  wfCache::addHtaccessCode('add');
1208
  }
1209
+
1210
+ // if saving then validate data
1211
  if (in_array('autoUpdate', $saving_opts)) {
1212
  if ( '1' === $opts['autoUpdate'] ) {
1213
  wfConfig::enableAutoUpdate();
1215
  wfConfig::disableAutoUpdate();
1216
  }
1217
  }
1218
+
1219
+ // if saving then validate data
1220
  if (in_array('disableCodeExecutionUploads', $saving_opts)) {
1221
  if (isset($opts['disableCodeExecutionUploads'])) {
1222
  try {
1231
  }
1232
  }
1233
 
1234
+ // if saving then validate data
1235
+ if (in_array('email_summary_enabled', $saving_opts)) {
1236
  if (isset($opts['email_summary_enabled'])) {
1237
  if ( ! empty( $opts['email_summary_enabled'] ) ) {
1238
  wfConfig::set( 'email_summary_enabled', 1 );
1245
  }
1246
  }
1247
  }
1248
+
1249
+ // if saving then validate data
1250
+ if (in_array('scheduleScan', $saving_opts)) {
1251
  $sch = isset( $opts['scheduleScan'] ) ? $opts['scheduleScan'] : '';
1252
  if ( get_option( 'mainwp_child_wordfence_cron_time' ) !== $sch ) {
1253
  update_option( 'mainwp_child_wordfence_cron_time', $sch );
1257
  }
1258
  }
1259
  }
1260
+
1261
  // Finished saving settings
1262
  /////////////////////
1263
+
1264
+
1265
  $result['cacheType'] = wfConfig::get( 'cacheType' );
1266
  $result['paidKeyMsg'] = false;
1267
+
1268
  // if saving then validate data
1269
+ if (in_array('apiKey', $saving_opts)) {
1270
+ $apiKey = trim( $_POST['apiKey'] );
1271
  if ( ! $apiKey ) { //Empty API key (after trim above), then try to get one.
1272
  $api = new wfAPI( '', wfUtils::getWPVersion() );
1273
  try {
1318
  }
1319
  }
1320
  }
1321
+
1322
  $result['ok'] = 1;
1323
  $result['reload'] = $reload;
1324
+
1325
  return $result;
1326
  } else {
1327
  $result['error'] = 'Empty settings';
1328
+ }
1329
+
1330
  return $result;
1331
+ }
1332
+
1333
+
1334
+ public static function recentTraffic(){
1335
+ return wordfence::ajax_recentTraffic_callback();
1336
  }
1337
+
1338
  function save_setting() {
1339
  if (isset($_POST['encrypted']))
1340
+ $settings = $this->simple_crypt( 'thisisakey', $_POST['settings'], 'decrypt' ); // to fix pass through sec rules of Dreamhost
1341
  else {
1342
  $settings = maybe_unserialize( base64_decode( $_POST['settings'] ) );
1343
  }
1432
  wp_unschedule_event( $sched, 'mainwp_child_wordfence_cron_scan' );
1433
  }
1434
  }
1435
+
1436
  $result['cacheType'] = wfConfig::get( 'cacheType' );
1437
  $result['paidKeyMsg'] = false;
1438
  $apiKey = trim( $_POST['apiKey'] );
1487
  }
1488
  $result['ok'] = 1;
1489
  $result['reload'] = $reload;
1490
+
1491
  return $result;
1492
  }
1493
  }
1557
  $p = $wpdb->base_prefix;
1558
 
1559
  $serverTime = $wfdb->querySingle( 'select unix_timestamp()' );
1560
+
1561
  $jsonData = array(
1562
  'serverTime' => $serverTime,
1563
  'serverMicrotime' => microtime(true),
1564
  'msg' => $wfdb->querySingle( "select msg from $p" . 'wfStatus where level < 3 order by ctime desc limit 1' ),
1565
  );
1566
+
1567
  $events = array();
1568
+ $alsoGet = $_POST['alsoGet'];
1569
  if ( preg_match( '/^logList_(404|hit|human|ruser|crawler|gCrawler|loginLogout)$/', $alsoGet, $m ) ) {
1570
  $type = $m[1];
1571
  $newestEventTime = $_POST['otherParams'];
1586
  if (isset($results['sql'])) {
1587
  $jsonData['sql'] = $results['sql'];
1588
  }
1589
+ }
1590
  $jsonData['events'] = $events;
1591
  $jsonData['alsoGet'] = $alsoGet; //send it back so we don't load data if panel has changed
1592
  $jsonData['cacheType'] = wfConfig::get( 'cacheType' );
1596
  public static function loadLiveTraffic() {
1597
  $wfdb = new wfDB();
1598
  $serverTime = $wfdb->querySingle( 'select unix_timestamp()' );
1599
+ $return = wordfence::ajax_loadLiveTraffic_callback();
1600
  $return['serverTime'] = $serverTime;
1601
  $return['serverMicrotime'] = microtime(true);
1602
+ return $return;
1603
  }
1604
 
1605
+ function whitelistWAFParamKey() {
1606
  $return = wordfence::ajax_whitelistWAFParamKey_callback();
1607
+ return $return;
1608
  }
1609
 
1610
+ function hideFileHtaccess() {
1611
  $return = wordfence::ajax_hideFileHtaccess_callback();
1612
+ return $return;
1613
+ }
1614
+
1615
  public static function fixFPD(){
1616
  $return = wordfence::ajax_fixFPD_callback();
1617
+ return $return;
1618
  }
1619
+
1620
  public static function disableDirectoryListing() {
1621
  $return = wordfence::ajax_disableDirectoryListing_callback();
1622
+ return $return;
1623
+ }
1624
+
1625
  public static function deleteDatabaseOption() {
1626
  $return = wordfence::ajax_deleteDatabaseOption_callback();
1627
+ return $return;
1628
+ }
1629
 
1630
  public static function misconfiguredHowGetIPsChoice() {
1631
  $return = wordfence::ajax_misconfiguredHowGetIPsChoice_callback();
1632
  return $return;
1633
  }
1634
+
1635
  public static function deleteAdminUser() {
1636
  $return = wordfence::ajax_deleteAdminUser_callback();
1637
+ return $return;
1638
+ }
1639
+
1640
  public static function revokeAdminUser() {
1641
  $return = wordfence::ajax_revokeAdminUser_callback();
1642
+ return $return;
1643
  }
1644
 
1645
  public static function clearAllBlocked() {
1646
  $return = wordfence::ajax_clearAllBlocked_callback();
1647
+ return $return;
1648
+ }
1649
+
1650
  public static function permanentlyBlockAllIPs() {
1651
  $return = wordfence::ajax_permanentlyBlockAllIPs_callback();
1652
+ return $return;
1653
+ }
1654
+
1655
  public static function unlockOutIP() {
1656
  $return = wordfence::ajax_unlockOutIP_callback();
1657
+ return $return;
1658
+ }
1659
+
1660
  public static function unblockRange() {
1661
  $return = wordfence::ajax_unblockRange_callback();
1662
+ return $return;
1663
+ }
1664
+
1665
  public static function blockIPUARange() {
1666
  $return = wordfence::ajax_blockIPUARange_callback();
1667
+ return $return;
1668
+ }
1669
+
1670
  public static function loadBlockRanges() {
1671
  $return = wordfence::ajax_loadBlockRanges_callback();
1672
+ return $return;
1673
  }
1674
+
1675
+ public static function saveWAFConfig() {
1676
  $return = wordfence::ajax_saveWAFConfig_callback();
1677
+ if (is_array($return) && isset($return['data'])) {
1678
  $return['learningModeGracePeriod'] = wfWAF::getInstance()->getStorageEngine()->getConfig('learningModeGracePeriod');
1679
  }
1680
+ return $return;
1681
+ }
1682
+
1683
  public static function whitelistBulkDelete() {
1684
  $return = wordfence::ajax_whitelistBulkDelete_callback();
1685
+ return $return;
1686
+ }
1687
+
1688
+ public static function whitelistBulkEnable() {
1689
  $return = wordfence::ajax_whitelistBulkEnable_callback();
1690
+ return $return;
1691
  }
1692
+
1693
  public static function whitelistBulkDisable() {
1694
  $return = wordfence::ajax_whitelistBulkDisable_callback();
1695
+ return $return;
1696
+ }
1697
  public static function updateConfig() {
1698
  $return = wordfence::ajax_updateConfig_callback();
1699
+ return $return;
1700
+ }
1701
+
1702
  // credit of Wordfence
1703
  private static function _getWAFData($updated = null) {
1704
  // custom
1705
  if(!class_exists('wfWAF'))
1706
  return false;
1707
  // end if custom
1708
+
1709
  $data['learningMode'] = wfWAF::getInstance()->isInLearningMode();
1710
  $data['rules'] = wfWAF::getInstance()->getRules();
1711
  /** @var wfWAFRule $rule */
1749
  $data['rulesLastUpdated'] = $lastUpdated;
1750
  }
1751
  $data['isPaid'] = (bool) wfConfig::get('isPaid', 0);
1752
+
1753
  if ($updated !== null) {
1754
  $data['updated'] = (bool) $updated;
1755
  }
1756
  return $data;
1757
  }
1758
+
1759
+
1760
  function reverse_lookup() {
1761
  $ips = explode( ',', $_POST['ips'] );
1762
  $res = array();
1767
  return array( 'ok' => 1, 'ips' => $res );
1768
  }
1769
 
1770
+
1771
+ public function saveOptions(){
1772
+ if (!empty($_POST['changes']) && ($changes = json_decode(stripslashes($_POST['changes']), true)) !== false) {
1773
+ try {
1774
  if (is_array($changes) && isset($changes['whitelistedURLParams']) && isset($changes['whitelistedURLParams']['add'])) {
1775
  $user = wp_get_current_user();
1776
  foreach($changes['whitelistedURLParams']['add'] as $key => &$value) :
1777
  if (isset($value['data'])) {
1778
+
1779
  if(isset($value['data']['userID'])) {
1780
  $value['data']['userID'] = $user->ID;
1781
  }
1782
  if(isset($value['data']['username'])) {
1783
  $value['data']['username'] = $user->user_login;
1784
+ }
1785
  }
1786
  endforeach;
1787
  }
1788
+
1789
  $errors = wfConfig::validate($changes);
1790
+
1791
  if ($errors !== true) {
1792
  if (count($errors) == 1) {
1793
  return array(
1803
  'error' => sprintf(__('Errors occurred while saving the configuration: %s', 'wordfence'), implode(', ', $compoundMessage)),
1804
  );
1805
  }
1806
+
1807
  return array(
1808
  'error' => __('Errors occurred while saving the configuration.', 'wordfence'),
1809
  );
1810
  }
1811
+
1812
  wfConfig::save($changes);
1813
  return array('success' => true);
1814
  }
1823
  );
1824
  }
1825
  }
1826
+
1827
  return array(
1828
  'error' => __('No configuration changes were provided to save.', 'wordfence'),
1829
+ );
1830
  }
1831
+
1832
  public function ajax_getBlocks_callback(){
1833
  $information = wordfence::ajax_getBlocks_callback();
1834
  return $information;
1835
  }
1836
  // credit of Wordfence
1837
  public function ajax_createBlock_callback()
1838
+ {
1839
+ return wordfence::ajax_createBlock_callback();
1840
+ }
1841
+
1842
+ public static function ajax_deleteBlocks_callback() {
1843
  $information = wordfence::ajax_deleteBlocks_callback();
1844
  return $information;
1845
  }
1846
+
1847
+ public static function ajax_makePermanentBlocks_callback() {
1848
  $information = wordfence::ajax_makePermanentBlocks_callback();
1849
  return $information;
1850
  }
1851
+
1852
  public function ajax_blockIP_callback(){
1853
  return wordfence::ajax_blockIP_callback();
1854
  }
1855
+
1856
  // credit of Wordfence
1857
  public function whois(){
1858
  return wordfence::ajax_whois_callback();
1859
  }
1860
+
1861
  function unblock_ip() {
1862
  if ( isset( $_POST['IP'] ) ) {
1863
  $IP = $_POST['IP'];
1865
  return array( 'success' => 1 );
1866
  }
1867
  }
1868
+
1869
  public static function saveCountryBlocking(){
1870
  if(! wfConfig::get('isPaid')){
1871
  return array('error' => "Sorry but this feature is only available for paid customers.");
2041
  }
2042
  return array('ok' => 1);
2043
  }
2044
+
2045
  public static function downloadHtaccess() {
2046
  if ( ! isset( $_GET['_wpnonce'] ) || empty( $_GET['_wpnonce'] ) ) {
2047
  die( '-1' );
2200
  $return['ok'] = 1;
2201
  return $return;
2202
  }
2203
+
2204
  public function getDiagnostics() {
2205
 
2206
  $diagnostic = new wfDiagnostic;
2211
  $themes = wp_get_themes();
2212
  $currentTheme = wp_get_theme();
2213
  $cols = 3;
2214
+
2215
  $w = new wfConfig();
2216
+
2217
+ $inEmail = false;
2218
+ ob_start();
2219
 
2220
  ?>
2221
  <div id="wf-diagnostics">
2222
+
2223
  <form id="wfConfigForm" style="overflow-x: auto;">
2224
  <?php foreach ($diagnostic->getResults() as $title => $tests):
2225
  $key = sanitize_key('wf-diagnostics-' . $title);
2759
  </div>
2760
  </div>
2761
  </form>
2762
+ </div>
2763
  <script type="application/javascript">
2764
+ jQuery( document ).ready(function ($) {
2765
  $('.wf-block-header-action-disclosure').each(function() {
2766
  $(this).closest('.wf-block-header').css('cursor', 'pointer');
2767
+
2768
  $(this).closest('.wf-block-header').on('click', function(e) {
2769
  // Let links in the header work.
2770
  if (e.target && e.target.nodeName === 'A' && e.target.href) {
2795
  });
2796
  }
2797
  });
2798
+ });
2799
+ });
2800
+ </script>
2801
+
2802
 
2803
  <?php
2804
  $html = ob_get_clean();
2805
  return array('ok' => 1, 'html' => $html);
2806
 
2807
  }
2808
+
2809
  public static function updateWAFRules() {
2810
  $event = new wfWAFCronFetchRulesEvent(time() - 2);
2811
  $event->setWaf(wfWAF::getInstance());
2814
  //return self::_getWAFData();
2815
  return array('ok' => 1, 'isPaid' => $isPaid );
2816
  }
2817
+
2818
  public static function updateWAFRules_New() {
2819
  $event = new wfWAFCronFetchRulesEvent(time() - 2);
2820
  $event->setWaf(wfWAF::getInstance());
2821
  $success = $event->fire();
2822
 
2823
+ return self::_getWAFData($success);
2824
  }
2825
+
2826
+ public static function save_debugging_config() {
2827
+ $settings = $_POST['settings'];
2828
  foreach (self::$diagnosticParams as $param) {
2829
  if (isset($settings[$param])) {
2830
+ wfConfig::set( $param, $settings[$param] );
2831
  }
2832
+ }
2833
  return array('ok' => 1 );
2834
  }
2835
  }
class/class-mainwp-child.php CHANGED
@@ -57,7 +57,11 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
57
  }
58
 
59
  if ( empty( $nonce ) ) {
60
- die( '<mainwp>' . base64_encode( json_encode( array( 'error' => 'You dont send nonce: ' . $action ) ) ) . '</mainwp>' );
 
 
 
 
61
  }
62
 
63
  // To fix verify nonce conflict #1
@@ -523,7 +527,7 @@ class MainWP_Child {
523
  }
524
 
525
  public function pre_current_active_plugins() {
526
- if (isset($_GET['_detect_plugins_updates']) && $_GET['_detect_plugins_updates'] = 'yes') {
527
  // to fix some premium plugins update notification
528
  $current = get_site_transient( 'update_plugins' );
529
  set_site_transient( 'update_plugins', $current );
@@ -852,7 +856,7 @@ class MainWP_Child {
852
  if ( isset( self::$subPages ) && is_array( self::$subPages ) ) {
853
  foreach ( self::$subPages as $subPage ) {
854
  ?>
855
- <a class="nav-tab pos-nav-tab <?php if ( $shownPage == $subPage['slug'] ) { echo 'nav-tab-active'; } ?>" tab-slug="<?php echo $subPage['slug']; ?>" href="options-general.php?page=<?php echo $subPage['page']; ?>"><?php echo $subPage['title']; ?></a>
856
  <?php
857
  }
858
  }
@@ -1854,7 +1858,7 @@ class MainWP_Child {
1854
  add_filter( 'pre_site_transient_update_plugins', $this->filterFunction, 99 );
1855
  }
1856
 
1857
- $plugins = explode( ',', urldecode( $_POST['list'] ) );
1858
 
1859
  // To fix: backupbuddy update
1860
  if ( in_array( 'backupbuddy/backupbuddy.php', $plugins ) ) {
@@ -1888,6 +1892,9 @@ class MainWP_Child {
1888
 
1889
  $information['plugin_updates'] = get_plugin_updates();
1890
 
 
 
 
1891
  $plugins = explode( ',', urldecode( $_POST['list'] ) );
1892
  $premiumPlugins = array();
1893
  $premiumUpdates = get_option( 'mainwp_premium_updates' );
@@ -1953,6 +1960,10 @@ class MainWP_Child {
1953
  MainWP_Helper::error( __( 'Invalid request!', 'mainwp-child' ) );
1954
  }
1955
  }
 
 
 
 
1956
  if ( count( $premiumPlugins ) > 0 ) {
1957
  $mwp_premium_updates = apply_filters( 'mwp_premium_perform_update', array() );
1958
  if ( is_array( $mwp_premium_updates ) && is_array( $premiumPlugins ) ) {
@@ -2168,6 +2179,29 @@ class MainWP_Child {
2168
  MainWP_Helper::write( $information );
2169
  }
2170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2171
  function hookFixOptimizePressThemeUpdate( $transient ) {
2172
  if ( ! defined( 'OP_FUNC' ) ) {
2173
  return $transient;
57
  }
58
 
59
  if ( empty( $nonce ) ) {
60
+ // to help tracing the conflict verify nonce with other plugins
61
+ @ob_start();
62
+ @debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
63
+ $stackTrace = "\n" . @ob_get_clean();
64
+ die( '<mainwp>' . base64_encode( json_encode( array( 'error' => 'You dont send nonce: ' . $action . '<br/>Trace: ' .$stackTrace) ) ) . '</mainwp>' );
65
  }
66
 
67
  // To fix verify nonce conflict #1
527
  }
528
 
529
  public function pre_current_active_plugins() {
530
+ if (isset($_GET['_detect_plugins_updates']) && $_GET['_detect_plugins_updates'] == 'yes') {
531
  // to fix some premium plugins update notification
532
  $current = get_site_transient( 'update_plugins' );
533
  set_site_transient( 'update_plugins', $current );
856
  if ( isset( self::$subPages ) && is_array( self::$subPages ) ) {
857
  foreach ( self::$subPages as $subPage ) {
858
  ?>
859
+ <a class="nav-tab pos-nav-tab <?php if ( $shownPage == $subPage['slug'] ) { echo 'nav-tab-active'; } ?>" tab-slug="<?php echo esc_attr($subPage['slug']); ?>" href="options-general.php?page=<?php echo rawurlencode($subPage['page']); ?>"><?php echo esc_html($subPage['title']); ?></a>
860
  <?php
861
  }
862
  }
1858
  add_filter( 'pre_site_transient_update_plugins', $this->filterFunction, 99 );
1859
  }
1860
 
1861
+ $plugins = explode( ',', urldecode( $_POST['list'] ) );
1862
 
1863
  // To fix: backupbuddy update
1864
  if ( in_array( 'backupbuddy/backupbuddy.php', $plugins ) ) {
1892
 
1893
  $information['plugin_updates'] = get_plugin_updates();
1894
 
1895
+ // to support cached premium plugins update info, hooking in the bulk_upgrade()
1896
+ add_filter( 'pre_site_transient_update_plugins', array( $this, 'set_cached_update_plugins' ) );
1897
+
1898
  $plugins = explode( ',', urldecode( $_POST['list'] ) );
1899
  $premiumPlugins = array();
1900
  $premiumUpdates = get_option( 'mainwp_premium_updates' );
1960
  MainWP_Helper::error( __( 'Invalid request!', 'mainwp-child' ) );
1961
  }
1962
  }
1963
+
1964
+ remove_filter( 'pre_site_transient_update_plugins', array( $this, 'set_cached_update_plugins' ), 10 );
1965
+ delete_site_transient( 'mainwp_update_plugins_cached' ); // to fix cached update info
1966
+
1967
  if ( count( $premiumPlugins ) > 0 ) {
1968
  $mwp_premium_updates = apply_filters( 'mwp_premium_perform_update', array() );
1969
  if ( is_array( $mwp_premium_updates ) && is_array( $premiumPlugins ) ) {
2179
  MainWP_Helper::write( $information );
2180
  }
2181
 
2182
+ public function set_cached_update_plugins( $false = false, $_transient_data = null ) {
2183
+
2184
+ if ( ! is_object( $_transient_data ) ) {
2185
+ $_transient_data = new stdClass;
2186
+ }
2187
+
2188
+ $pre = false;
2189
+ $cached_update_info = get_site_transient( 'mainwp_update_plugins_cached' );
2190
+ if ( is_array($cached_update_info) && count($cached_update_info) > 0 ) {
2191
+ foreach( $cached_update_info as $slug => $plugin_update ) {
2192
+ if ( !isset( $_transient_data->response[ $slug ] ) && isset($plugin_update->update) ) {
2193
+ $_transient_data->response[ $slug ] = $plugin_update->update;
2194
+ $pre = true;
2195
+ }
2196
+ }
2197
+ }
2198
+
2199
+ if ($pre == false)
2200
+ return $false;
2201
+
2202
+ return $_transient_data;
2203
+ }
2204
+
2205
  function hookFixOptimizePressThemeUpdate( $transient ) {
2206
  if ( ! defined( 'OP_FUNC' ) ) {
2207
  return $transient;
class/class-mainwp-client-report.php CHANGED
@@ -746,7 +746,21 @@ class MainWP_Client_Report {
746
  $value = current( $value );
747
  if ( 'author_meta' === $meta_key || 'user_meta' === $meta_key ) {
748
  $value = maybe_unserialize( $value );
749
- $value = $value['display_name'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
750
  }
751
  }
752
  }
746
  $value = current( $value );
747
  if ( 'author_meta' === $meta_key || 'user_meta' === $meta_key ) {
748
  $value = maybe_unserialize( $value );
749
+ $value = $value['display_name'];
750
+
751
+ if ( 'author_meta' === $meta_key && $value == '' && $context == 'comments') {
752
+ $value = __( 'Guest', 'mainwp-child-reports' );
753
+ }
754
+ // to fix empty author value
755
+ if ( empty($value) ) {
756
+ if (isset($value['agent']) && !empty($value['agent'])) {
757
+ $value = $value['agent'];
758
+ }
759
+ }
760
+
761
+ if (!is_string($value)) {
762
+ $value = '';
763
+ }
764
  }
765
  }
766
  }
class/class-mainwp-helper.php CHANGED
@@ -176,7 +176,11 @@ class MainWP_Helper {
176
  }
177
 
178
  static function uploadFile( $file_url, $path, $file_name ) {
179
- $file_name = sanitize_file_name( $file_name );
 
 
 
 
180
  $full_file_name = $path . DIRECTORY_SEPARATOR . $file_name; //Local name
181
 
182
  $response = wp_remote_get( $file_url, array(
@@ -211,7 +215,7 @@ class MainWP_Helper {
211
 
212
  static function createPost( $new_post, $post_custom, $post_category, $post_featured_image, $upload_dir, $post_tags, $others = array() ) {
213
  global $current_user;
214
-
215
  /**
216
  * Hook: `mainwp_before_post_update`
217
  *
@@ -222,7 +226,7 @@ class MainWP_Helper {
222
  * @param string $post_category – Post categories.
223
  * @param string $post_tags – Post tags.
224
  */
225
-
226
  do_action( 'mainwp_before_post_update', $new_post, $post_custom, $post_category, $post_tags );
227
 
228
  // Options fields.
@@ -236,7 +240,7 @@ class MainWP_Helper {
236
  'async_css',
237
  'defer_all_js',
238
  );
239
-
240
  $wprocket_activated = false;
241
  if ( MainWP_Child_WP_Rocket::isActivated() ) {
242
  if ( function_exists( 'get_rocket_option' ) ) {
@@ -308,7 +312,7 @@ class MainWP_Helper {
308
  }
309
  // else {
310
  // $new_post['post_status'] = 'publish';
311
- // }
312
  }
313
 
314
  $wpr_options = isset( $_POST['wpr_options'] ) ? $_POST['wpr_options'] : array();
@@ -534,7 +538,7 @@ class MainWP_Helper {
534
  $not_allowed[] = '_edit_post_status';
535
 
536
  $post_to_only_existing_categories = false;
537
-
538
  if (is_array($post_custom)) {
539
  foreach ( $post_custom as $meta_key => $meta_values ) {
540
  if ( ! in_array( $meta_key, $not_allowed ) ) {
@@ -564,7 +568,7 @@ class MainWP_Helper {
564
  }
565
  }
566
  }
567
-
568
  // yoast seo extension
569
  if ( $seo_ext_activated ) {
570
  $_seo_opengraph_image = isset( $post_custom[ WPSEO_Meta::$meta_prefix . 'opengraph-image' ] ) ? $post_custom[ WPSEO_Meta::$meta_prefix . 'opengraph-image' ] : array();
@@ -622,11 +626,11 @@ class MainWP_Helper {
622
  if (isset($others['featured_image_data'])) {
623
  $_image_data = $others['featured_image_data'];
624
  update_post_meta( $upload['id'], '_wp_attachment_image_alt', $_image_data['alt'] );
625
- wp_update_post( array( 'ID' => $upload['id'],
626
  'post_excerpt' => $_image_data['caption'],
627
  'post_content' => $_image_data['description'],
628
  'post_title' => $_image_data['title']
629
- )
630
  );
631
  }
632
  }
@@ -959,11 +963,11 @@ class MainWP_Helper {
959
  return $str;
960
  }
961
 
962
- public static function return_bytes( $val ) {
963
  $val = trim( $val );
964
  $last = $val[ strlen( $val ) - 1 ];
965
  $val = rtrim($val, $last);
966
- $last = strtolower( $last );
967
  switch ( $last ) {
968
  // The 'G' modifier is available since PHP 5.1.0
969
  case 'g':
@@ -1192,7 +1196,7 @@ class MainWP_Helper {
1192
  public static function getRevisions( $max_revisions ) {
1193
  global $wpdb;
1194
  $sql = " SELECT `post_parent`, COUNT(*) cnt
1195
- FROM $wpdb->posts
1196
  WHERE `post_type` = 'revision'
1197
  GROUP BY `post_parent`
1198
  HAVING COUNT(*) > " . $max_revisions;
@@ -1216,7 +1220,7 @@ class MainWP_Helper {
1216
  FROM $wpdb->posts
1217
  WHERE `post_parent`=" . $results[ $i ]->post_parent . "
1218
  AND `post_type`='revision'
1219
- ORDER BY `post_modified` ASC
1220
  ";
1221
  $results_posts = $wpdb->get_results( $sql_get );
1222
 
@@ -1312,7 +1316,7 @@ class MainWP_Helper {
1312
  */
1313
 
1314
  static function remove_filters_with_method_name( $hook_name = '', $method_name = '', $priority = 0 ) {
1315
-
1316
  global $wp_filter;
1317
  // Take only filters on right hook name and priority
1318
  if ( ! isset( $wp_filter[ $hook_name ][ $priority ] ) || ! is_array( $wp_filter[ $hook_name ][ $priority ] ) ) {
@@ -1324,7 +1328,7 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
1324
  if ( isset( $filter_array['function'] ) && is_array( $filter_array['function'] ) ) {
1325
  // Test if object is a class and method is equal to param !
1326
  if ( is_object( $filter_array['function'][0] ) && get_class( $filter_array['function'][0] ) && $filter_array['function'][1] == $method_name ) {
1327
- // Test for WordPress >= 4.7 WP_Hook class
1328
  if ( is_a( $wp_filter[ $hook_name ], 'WP_Hook' ) ) {
1329
  unset( $wp_filter[ $hook_name ]->callbacks[ $priority ][ $unique_id ] );
1330
  } else {
@@ -1412,160 +1416,160 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
1412
  if ( defined( 'MAINWP_NOSSL' ) ) return !MAINWP_NOSSL;
1413
  return function_exists( 'openssl_verify' );
1414
  }
1415
-
1416
- public static function check_files_exists( $files = array(), $return = false ) {
1417
  $missing = array();
1418
- if (is_array($files)) {
1419
  foreach($files as $name) {
1420
  if (!file_exists( $name )) {
1421
- $missing[] = $name;
1422
- }
1423
- }
1424
  } else {
1425
  if (!file_exists( $files )) {
1426
- $missing[] = $files;
1427
  }
1428
  }
1429
-
1430
  if (!empty($missing)) {
1431
- $message = 'Missing file(s): ' . implode(',', $missing);
1432
  if ($return)
1433
  return $message;
1434
  else
1435
- throw new Exception( $message );
1436
  }
1437
  return true;
1438
  }
1439
-
1440
- public static function check_classes_exists($classes = array(), $return = false) {
1441
  $missing = array();
1442
- if (is_array($classes)) {
1443
  foreach($classes as $name) {
1444
  if (!class_exists( $name )) {
1445
- $missing[] = $name;
1446
  }
1447
- }
1448
  } else {
1449
  if ( !class_exists($classes) )
1450
  $missing[] = $classes;
1451
  }
1452
-
1453
- if ( !empty($missing) ) {
1454
  $message = 'Missing classes: ' . implode(',', $missing);
1455
  if ($return) {
1456
  return $message;
1457
  } else {
1458
- throw new Exception( $message );
1459
  }
1460
- }
1461
  return true;
1462
  }
1463
-
1464
  public static function check_methods($object, $methods = array(), $return = false) {
1465
  $missing = array();
1466
  if (is_array($methods)) {
1467
  $missing = array();
1468
  foreach($methods as $name) {
1469
  if ( !method_exists($object, $name) ) {
1470
- $missing[] = $name;
1471
  }
1472
- }
1473
  } else if (!empty($methods)) {
1474
  if ( !method_exists($object, $methods) )
1475
  $missing[] = $methods;
1476
-
1477
- }
1478
-
1479
  if ( !empty($missing) ) {
1480
  $message = 'Missing method: ' . implode(',', $missing);
1481
  if ($return) {
1482
  return $message;
1483
  } else {
1484
- throw new Exception( $message );
1485
  }
1486
  }
1487
-
1488
  return true;
1489
  }
1490
-
1491
  public static function check_properties($object, $properties = array(), $return = false) {
1492
  $missing = array();
1493
- if (is_array($properties)) {
1494
  foreach($properties as $name) {
1495
  if ( !property_exists($object, $name) ) {
1496
- $missing[] = $name;
1497
  }
1498
- }
1499
  } else if (!empty($properties)) {
1500
  if ( !property_exists($object, $properties) )
1501
  $missing[] = $properties;
1502
-
1503
- }
1504
-
1505
  if ( !empty($missing) ) {
1506
  $message = 'Missing properties: ' . implode(',', $missing);
1507
  if ($return) {
1508
  return $message;
1509
  } else {
1510
- throw new Exception( $message );
1511
  }
1512
  }
1513
-
1514
  return true;
1515
  }
1516
-
1517
  public static function check_functions($funcs = array(), $return = false) {
1518
  $missing = array();
1519
- if (is_array($funcs)) {
1520
  foreach($funcs as $name) {
1521
  if ( !function_exists( $name) ) {
1522
- $missing[] = $name;
1523
  }
1524
- }
1525
  } else if (!empty($funcs)) {
1526
  if ( !function_exists($funcs) )
1527
  $missing[] = $funcs;
1528
-
1529
- }
1530
-
1531
  if ( !empty($missing) ) {
1532
  $message = 'Missing functions: ' . implode(',', $missing);
1533
  if ($return) {
1534
  return $message;
1535
  } else {
1536
- throw new Exception( $message );
1537
  }
1538
  }
1539
-
1540
- return true;
1541
  }
1542
-
1543
-
1544
  /**
1545
  * Handle fatal error for requests from the dashboard
1546
- * mwp_action requests
1547
- * wordpress_seo requests
1548
  * This will do not handle fatal error for sync request from the dashboard
1549
  */
1550
- public static function handle_fatal_error() {
1551
-
1552
  function handle_shutdown() {
1553
  // handle fatal errors and compile errors
1554
  $error = error_get_last();
1555
- if ( isset( $error['type'] ) && isset( $error['message'] ) &&
1556
  ( E_ERROR === $error['type'] || E_COMPILE_ERROR === $error['type'] )
1557
- )
1558
  {
1559
  MainWP_Helper::write( array( 'error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ) );
1560
- }
1561
 
1562
- }
1563
-
1564
- if (isset($_POST['function']) && isset($_POST['mainwpsignature']) &&
1565
- (isset($_POST['mwp_action']) || 'wordpress_seo' == $_POST['function']) // wordpress_seo for Wordpress SEO
1566
  ) {
1567
  register_shutdown_function( 'handle_shutdown' );
1568
- }
1569
- }
1570
-
1571
  }
176
  }
177
 
178
  static function uploadFile( $file_url, $path, $file_name ) {
179
+ // to fix uploader extension rename htaccess file issue
180
+ if ( $file_name != '.htaccess' && $file_name != '.htpasswd' ) {
181
+ $file_name = sanitize_file_name( $file_name );
182
+ }
183
+
184
  $full_file_name = $path . DIRECTORY_SEPARATOR . $file_name; //Local name
185
 
186
  $response = wp_remote_get( $file_url, array(
215
 
216
  static function createPost( $new_post, $post_custom, $post_category, $post_featured_image, $upload_dir, $post_tags, $others = array() ) {
217
  global $current_user;
218
+
219
  /**
220
  * Hook: `mainwp_before_post_update`
221
  *
226
  * @param string $post_category – Post categories.
227
  * @param string $post_tags – Post tags.
228
  */
229
+
230
  do_action( 'mainwp_before_post_update', $new_post, $post_custom, $post_category, $post_tags );
231
 
232
  // Options fields.
240
  'async_css',
241
  'defer_all_js',
242
  );
243
+
244
  $wprocket_activated = false;
245
  if ( MainWP_Child_WP_Rocket::isActivated() ) {
246
  if ( function_exists( 'get_rocket_option' ) ) {
312
  }
313
  // else {
314
  // $new_post['post_status'] = 'publish';
315
+ // }
316
  }
317
 
318
  $wpr_options = isset( $_POST['wpr_options'] ) ? $_POST['wpr_options'] : array();
538
  $not_allowed[] = '_edit_post_status';
539
 
540
  $post_to_only_existing_categories = false;
541
+
542
  if (is_array($post_custom)) {
543
  foreach ( $post_custom as $meta_key => $meta_values ) {
544
  if ( ! in_array( $meta_key, $not_allowed ) ) {
568
  }
569
  }
570
  }
571
+
572
  // yoast seo extension
573
  if ( $seo_ext_activated ) {
574
  $_seo_opengraph_image = isset( $post_custom[ WPSEO_Meta::$meta_prefix . 'opengraph-image' ] ) ? $post_custom[ WPSEO_Meta::$meta_prefix . 'opengraph-image' ] : array();
626
  if (isset($others['featured_image_data'])) {
627
  $_image_data = $others['featured_image_data'];
628
  update_post_meta( $upload['id'], '_wp_attachment_image_alt', $_image_data['alt'] );
629
+ wp_update_post( array( 'ID' => $upload['id'],
630
  'post_excerpt' => $_image_data['caption'],
631
  'post_content' => $_image_data['description'],
632
  'post_title' => $_image_data['title']
633
+ )
634
  );
635
  }
636
  }
963
  return $str;
964
  }
965
 
966
+ public static function return_bytes( $val ) {
967
  $val = trim( $val );
968
  $last = $val[ strlen( $val ) - 1 ];
969
  $val = rtrim($val, $last);
970
+ $last = strtolower( $last );
971
  switch ( $last ) {
972
  // The 'G' modifier is available since PHP 5.1.0
973
  case 'g':
1196
  public static function getRevisions( $max_revisions ) {
1197
  global $wpdb;
1198
  $sql = " SELECT `post_parent`, COUNT(*) cnt
1199
+ FROM $wpdb->posts
1200
  WHERE `post_type` = 'revision'
1201
  GROUP BY `post_parent`
1202
  HAVING COUNT(*) > " . $max_revisions;
1220
  FROM $wpdb->posts
1221
  WHERE `post_parent`=" . $results[ $i ]->post_parent . "
1222
  AND `post_type`='revision'
1223
+ ORDER BY `post_modified` ASC
1224
  ";
1225
  $results_posts = $wpdb->get_results( $sql_get );
1226
 
1316
  */
1317
 
1318
  static function remove_filters_with_method_name( $hook_name = '', $method_name = '', $priority = 0 ) {
1319
+
1320
  global $wp_filter;
1321
  // Take only filters on right hook name and priority
1322
  if ( ! isset( $wp_filter[ $hook_name ][ $priority ] ) || ! is_array( $wp_filter[ $hook_name ][ $priority ] ) ) {
1328
  if ( isset( $filter_array['function'] ) && is_array( $filter_array['function'] ) ) {
1329
  // Test if object is a class and method is equal to param !
1330
  if ( is_object( $filter_array['function'][0] ) && get_class( $filter_array['function'][0] ) && $filter_array['function'][1] == $method_name ) {
1331
+ // Test for WordPress >= 4.7 WP_Hook class
1332
  if ( is_a( $wp_filter[ $hook_name ], 'WP_Hook' ) ) {
1333
  unset( $wp_filter[ $hook_name ]->callbacks[ $priority ][ $unique_id ] );
1334
  } else {
1416
  if ( defined( 'MAINWP_NOSSL' ) ) return !MAINWP_NOSSL;
1417
  return function_exists( 'openssl_verify' );
1418
  }
1419
+
1420
+ public static function check_files_exists( $files = array(), $return = false ) {
1421
  $missing = array();
1422
+ if (is_array($files)) {
1423
  foreach($files as $name) {
1424
  if (!file_exists( $name )) {
1425
+ $missing[] = $name;
1426
+ }
1427
+ }
1428
  } else {
1429
  if (!file_exists( $files )) {
1430
+ $missing[] = $files;
1431
  }
1432
  }
1433
+
1434
  if (!empty($missing)) {
1435
+ $message = 'Missing file(s): ' . implode(',', $missing);
1436
  if ($return)
1437
  return $message;
1438
  else
1439
+ throw new Exception( $message );
1440
  }
1441
  return true;
1442
  }
1443
+
1444
+ public static function check_classes_exists($classes = array(), $return = false) {
1445
  $missing = array();
1446
+ if (is_array($classes)) {
1447
  foreach($classes as $name) {
1448
  if (!class_exists( $name )) {
1449
+ $missing[] = $name;
1450
  }
1451
+ }
1452
  } else {
1453
  if ( !class_exists($classes) )
1454
  $missing[] = $classes;
1455
  }
1456
+
1457
+ if ( !empty($missing) ) {
1458
  $message = 'Missing classes: ' . implode(',', $missing);
1459
  if ($return) {
1460
  return $message;
1461
  } else {
1462
+ throw new Exception( $message );
1463
  }
1464
+ }
1465
  return true;
1466
  }
1467
+
1468
  public static function check_methods($object, $methods = array(), $return = false) {
1469
  $missing = array();
1470
  if (is_array($methods)) {
1471
  $missing = array();
1472
  foreach($methods as $name) {
1473
  if ( !method_exists($object, $name) ) {
1474
+ $missing[] = $name;
1475
  }
1476
+ }
1477
  } else if (!empty($methods)) {
1478
  if ( !method_exists($object, $methods) )
1479
  $missing[] = $methods;
1480
+
1481
+ }
1482
+
1483
  if ( !empty($missing) ) {
1484
  $message = 'Missing method: ' . implode(',', $missing);
1485
  if ($return) {
1486
  return $message;
1487
  } else {
1488
+ throw new Exception( $message );
1489
  }
1490
  }
1491
+
1492
  return true;
1493
  }
1494
+
1495
  public static function check_properties($object, $properties = array(), $return = false) {
1496
  $missing = array();
1497
+ if (is_array($properties)) {
1498
  foreach($properties as $name) {
1499
  if ( !property_exists($object, $name) ) {
1500
+ $missing[] = $name;
1501
  }
1502
+ }
1503
  } else if (!empty($properties)) {
1504
  if ( !property_exists($object, $properties) )
1505
  $missing[] = $properties;
1506
+
1507
+ }
1508
+
1509
  if ( !empty($missing) ) {
1510
  $message = 'Missing properties: ' . implode(',', $missing);
1511
  if ($return) {
1512
  return $message;
1513
  } else {
1514
+ throw new Exception( $message );
1515
  }
1516
  }
1517
+
1518
  return true;
1519
  }
1520
+
1521
  public static function check_functions($funcs = array(), $return = false) {
1522
  $missing = array();
1523
+ if (is_array($funcs)) {
1524
  foreach($funcs as $name) {
1525
  if ( !function_exists( $name) ) {
1526
+ $missing[] = $name;
1527
  }
1528
+ }
1529
  } else if (!empty($funcs)) {
1530
  if ( !function_exists($funcs) )
1531
  $missing[] = $funcs;
1532
+
1533
+ }
1534
+
1535
  if ( !empty($missing) ) {
1536
  $message = 'Missing functions: ' . implode(',', $missing);
1537
  if ($return) {
1538
  return $message;
1539
  } else {
1540
+ throw new Exception( $message );
1541
  }
1542
  }
1543
+
1544
+ return true;
1545
  }
1546
+
1547
+
1548
  /**
1549
  * Handle fatal error for requests from the dashboard
1550
+ * mwp_action requests
1551
+ * wordpress_seo requests
1552
  * This will do not handle fatal error for sync request from the dashboard
1553
  */
1554
+ public static function handle_fatal_error() {
1555
+
1556
  function handle_shutdown() {
1557
  // handle fatal errors and compile errors
1558
  $error = error_get_last();
1559
+ if ( isset( $error['type'] ) && isset( $error['message'] ) &&
1560
  ( E_ERROR === $error['type'] || E_COMPILE_ERROR === $error['type'] )
1561
+ )
1562
  {
1563
  MainWP_Helper::write( array( 'error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ) );
1564
+ }
1565
 
1566
+ }
1567
+
1568
+ if (isset($_POST['function']) && isset($_POST['mainwpsignature']) &&
1569
+ (isset($_POST['mwp_action']) || 'wordpress_seo' == $_POST['function']) // wordpress_seo for Wordpress SEO
1570
  ) {
1571
  register_shutdown_function( 'handle_shutdown' );
1572
+ }
1573
+ }
1574
+
1575
  }
mainwp-child.php CHANGED
@@ -6,7 +6,7 @@
6
  Author: MainWP
7
  Author URI: https://mainwp.com
8
  Text Domain: mainwp-child
9
- Version: 3.5
10
  */
11
  if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
12
  header( 'X-Frame-Options: ALLOWALL' );
6
  Author: MainWP
7
  Author URI: https://mainwp.com
8
  Text Domain: mainwp-child
9
+ Version: 3.5.1
10
  */
11
  if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
12
  header( 'X-Frame-Options: ALLOWALL' );
readme.txt CHANGED
@@ -1,28 +1,28 @@
1
  === MainWP Child ===
2
  Contributors: mainwp
3
- Donate link:
4
  Tags: WordPress management, management, manager, manage, WordPress controller, network, MainWP, updates, admin, administration, multiple, multisite, plugin updates, theme updates, login, remote, backups
5
  Author: mainwp
6
  Author URI: https://mainwp.com
7
  Plugin URI: https://mainwp.com
8
  Requires at least: 3.6
9
- Tested up to: 4.9.8
10
- Stable tag: 3.5
11
  License: GPLv2 or later
12
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
14
- Provides a secure connection between your MainWP Dashboard and your WordPress sites. MainWP allows you to manage WP sites from one central location.
15
 
16
  == Description ==
17
 
18
  This is the Child plugin for the [MainWP Dashboard](https://wordpress.org/plugins/mainwp/)
19
 
20
- The MainWP Child plugin is used to securely manage multiple WordPress websites from your MainWP Dashboard. This plugin is to be installed on every WordPress site you want to control from your Dashboard.
21
 
22
  [MainWP](https://mainwp.com) is a self-hosted WordPress management system that allows you to manage an endless amount of WordPress blogs from one dashboard on your server.
23
 
24
  **Features include:**
25
-
26
  * Connect and control all your WordPress installs even those on different hosts!
27
  * Update all WordPress installs, Plugins and Themes from one location
28
  * Manage and Add all your Posts from one location
@@ -71,13 +71,25 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  = 3.5 - 9-27-18 =
75
  * Fixed: compatibility issues caused by the recent UpdraftPlus update
76
  * Fixed: issues with the WooCommerce Status information
77
  * Fixed: issues with Bulk Settings Manager for specific plugins
78
  * Added: mainwp_child_mu_plugin_enabled hook to allow MainWP Child usage as a must-use plugin
79
  * Added: support for recording WP Time Capsule backups for Client Reports
80
- * Added: mainwp_branding_role_cap_enable_contact_form hook to allow users to show Support Form (Branding extension option) to specific roles
81
  * Added: support to for the new BackUpWordPrress Extension feature
82
  * Added: support for the new MainWP Buddy Extension feature
83
  * Updated: reporting system to determine backup type for BackWPup backups
@@ -93,7 +105,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
93
  * Added: support for the new extension
94
  * Added: conditional checks to prevent possible conflicts with certain plugins 
95
  * Added: support for the new MainWP Branding Extension feature
96
- * Improved: PHP 7.2 compatibility
97
 
98
  = 3.4.7.1 - 5-25-18 =
99
  * Fixed: UpdraftPlus 1.14.10 compatibility issue that caused child sites to disconnect
@@ -106,9 +118,9 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
106
  * Fixed: timezone issue backup timestamp
107
  * Fixed: MainWP Branding Extension conflict that caused issues with hooking WP Admin menu items
108
  * Fixed: MainWP Branding Extension issue with hiding WordPress update nag
109
- * Fixed: MainWP Branding Extension issue with updating WordPress footer content
110
  * Fixed: issues with loading broken links data
111
- * Fixed: multiple PHP 7.2 warnings
112
  * Added: support for the BackBlaze backup remote destination (UpdraftPlus Extension)
113
  * Added: support for recording Live Stash updates for Client Reporting
114
  * Updated: recent Wordfence plugin version compatibility
@@ -252,7 +264,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
252
  * Updated: Number of categories pulled from child sites (from 50 to 300)
253
 
254
  = 3.1.7 - 8-18-16 =
255
- * Fixed: Issues with PHP 7 - The MainWP Child is now PHP 7 friendly! :-)
256
  * Added: Support for an upcoming extension (BacukpBuddy Extension)
257
 
258
  = 3.1.6 - 8-2-16 =
@@ -354,22 +366,22 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
354
  * Fixed: 404 error that occurs in case Links Manger extension is in use when child plugin is hidden
355
  * Fixed: Bug with detecting updates of hidden plugins (UpdraftPlus, BackUpWordPress, WP Rocket)
356
  * Fixed: Bug with overwriting Amazon S3 settings in BackUpWordPress plugin
357
- * Fixed: Bug with empty values for Text Link and Link Source options in Broken Links Checker Extension
358
  * Fixed: Bug with bulk repair action in Wordfence Extension
359
  * Fixed: Bug with incorrect File System Method detection
360
  * Added: Support for an upcoming Extension
361
 
362
  = 2.0.28 - 9-7-15 =
363
- * Fixed: Security Issue (MainWP White Hat Reward Program)
364
  * Fixed: Support for the Stream 3 plugin
365
  * Fixed: Client Reports issue with recording auto saves for Posts and Pages
366
  * Fixed: An issue with detection for Abandoned Plugins & Themes that are not hosted on WP.org
367
 
368
  = 2.0.27 - 9-2-15 =
369
- * Fixed: Security Issue (MainWP White Hat Reward Program)
370
 
371
  = 2.0.26 - 9-1-15 =
372
- * Fixed: Conflict with Stream 3 (Thanks Luke Carbis of Stream)
373
 
374
  = 2.0.25 - 8-31-15 =
375
  * Fixed: Issue with Client Reports extension where comments records were not displayed correctly
@@ -379,7 +391,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
379
  * Fixed: Incorrect last update value for abandoned plugins & themes feature
380
  * Fixed: Branding for Server Information page and Clone page title
381
  * Fixed: Incorrect heatmap data and warnings
382
- * Fixed: Can not add child site because get favicon timeout
383
  * Fixed: Hiding UpdraftPlus, WP Rocket toolbar and their notices when set to hide plugins
384
 
385
  = 2.0.23 - 8-7-15 =
@@ -390,7 +402,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
390
 
391
  = 2.0.22 - 7-22-15 =
392
  * Fixed: Bug where the OptmizePress theme has not been updated properly
393
- * Fixed: Bug where the Client Report extenison recored incorrect time
394
  * Added: Support for the upcomming extension
395
 
396
  = 2.0.21 - 7-9-15 =
@@ -410,7 +422,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
410
  * Added: Support for the new UpdraftPlus Extension options
411
  * Enhancement: Speed up directory listing by using less resources, reducing timeout issues
412
  * Fixed: Plugin/theme upgrade issue when no file system method is specified
413
- * Fixed: X-Frame-Options - ALLOWALL bug
414
  * Fixed: Timeout error for the stats child data function
415
  * Fixed: An error with the Synchronous XMLHttpRequest for tracker.js
416
  * Fixed: Expert settings options for the UpdraftPlus Extension
@@ -426,7 +438,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
426
 
427
  = 2.0.16 - 5-15-15 =
428
  * Fixed: Issue with sites running PHP 5.2 and lower
429
- * Fixed: Sync error on some sites with UpdraftPlus installed
430
  * Fixed: PHP Warning
431
  * Changed: Server page to reflect requested mininum of PHP 5.3
432
 
@@ -447,8 +459,8 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
447
  * Fixed: Security Issue with add_query_arg and remove_query_arg
448
 
449
  = 2.0.12 - 4-16-15 =
450
- * Fixed: Bug for the MainWP iThemes Security Extension
451
- * Fixed: Bug for the MainWP WordFence Extension
452
  * Fixed: Bug where the MainWP Child plugin was breaking cron jobs on child sites
453
 
454
  = 2.0.11 - 4-12-15 =
@@ -499,7 +511,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
499
 
500
  = 2.0.4 - 12-26-14 =
501
  * Fixed: Backups for hosts having issues with "compress.zlib://" stream wrappers from PHP causing corrupt backup archives
502
- * Fixed: "Another backup is running" message displaying incorrectly
503
 
504
  = 2.0.3 - 12-15-14 =
505
  * Fixed: Possible security issue
@@ -528,7 +540,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
528
  * Redesign: CSS updated to match the Dashboard style
529
  * Redesign: MainWP Child Settings page layout updated
530
  * Redesign: MainWP Child Clone/Restore layout updated
531
- * Refactor: Added MainWP Child menu added in the WP Admin Menu
532
  * Refactor: MainWP Child Settings, MainWP Clone/Restore and MainWP Child Server Information pages removed from the WP Settings menu and added to MainWP Child
533
 
534
  = 1.3.3 - 9-21-14 =
@@ -560,7 +572,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
560
  * Removed incorrect "This site may to connect to your dashboard or may have other issues" when there are ssl warnings
561
 
562
  = 1.0 =
563
- * Added: Communication to Dashboard during backups to locate common backup locations
564
  * Added: Communication to Dashboard during backups to locate common cache locations
565
  * Added: Communication to Dashboard during backups to locate non-WordPress folders
566
  * Added: Communication to Dashboard during backups to locate Zip Archives
@@ -580,7 +592,7 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
580
  * Changes for update to Client Reports Extension
581
  * Changes for update to Heat Map Extension
582
  * Changes for update to Maintenance Extension
583
- * Fixed verbiage for restore popup
584
 
585
  = 0.29.10 =
586
  * Fixed: Admin not accessible with invalid upload directory
@@ -626,10 +638,10 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
626
  * Added ability to view Child site error logs on MainWP Dashboard
627
  * Added ability to view Child site Wp-Config on MainWP Dashboard
628
  * Added new Hooks for Branding Extension
629
- * Added tweak for Code Snippet Extension
630
 
631
  = 0.28.4 =
632
- * More Extension Hooks to extend Code Snippet functionality
633
 
634
  = 0.28.3 =
635
  * Fixed some issues with Code Snippets extension
1
  === MainWP Child ===
2
  Contributors: mainwp
3
+ Donate link:
4
  Tags: WordPress management, management, manager, manage, WordPress controller, network, MainWP, updates, admin, administration, multiple, multisite, plugin updates, theme updates, login, remote, backups
5
  Author: mainwp
6
  Author URI: https://mainwp.com
7
  Plugin URI: https://mainwp.com
8
  Requires at least: 3.6
9
+ Tested up to: 5.0
10
+ Stable tag: 3.5.1
11
  License: GPLv2 or later
12
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
14
+ Provides a secure connection between your MainWP Dashboard and your WordPress sites. MainWP allows you to manage WP sites from one central location.
15
 
16
  == Description ==
17
 
18
  This is the Child plugin for the [MainWP Dashboard](https://wordpress.org/plugins/mainwp/)
19
 
20
+ The MainWP Child plugin is used to securely manage multiple WordPress websites from your MainWP Dashboard. This plugin is to be installed on every WordPress site you want to control from your Dashboard.
21
 
22
  [MainWP](https://mainwp.com) is a self-hosted WordPress management system that allows you to manage an endless amount of WordPress blogs from one dashboard on your server.
23
 
24
  **Features include:**
25
+
26
  * Connect and control all your WordPress installs even those on different hosts!
27
  * Update all WordPress installs, Plugins and Themes from one location
28
  * Manage and Add all your Posts from one location
71
 
72
  == Changelog ==
73
 
74
+ = 3.5.1 - 11-14-18 =
75
+ * Fixed: an issue with detecting the Wordfence status info
76
+ * Fixed: an issue with loading UpdraftPlus existing backups
77
+ * Fixed: the File Uploader extension issue with renaming special files
78
+ * Fixed: an issue with syncing BackupBuddy data
79
+ * Fixed: an issue with logging BackWPup backups
80
+ * Fixed: an issue with detecting premium plugin updates
81
+ * Added: new options for the MainWP Staging Extension
82
+ * Added: multiple security enhancements
83
+ * Added: support for the upcoming 3rd party extension
84
+ * Updated: improved updating process
85
+
86
  = 3.5 - 9-27-18 =
87
  * Fixed: compatibility issues caused by the recent UpdraftPlus update
88
  * Fixed: issues with the WooCommerce Status information
89
  * Fixed: issues with Bulk Settings Manager for specific plugins
90
  * Added: mainwp_child_mu_plugin_enabled hook to allow MainWP Child usage as a must-use plugin
91
  * Added: support for recording WP Time Capsule backups for Client Reports
92
+ * Added: mainwp_branding_role_cap_enable_contact_form hook to allow users to show Support Form (Branding extension option) to specific roles
93
  * Added: support to for the new BackUpWordPrress Extension feature
94
  * Added: support for the new MainWP Buddy Extension feature
95
  * Updated: reporting system to determine backup type for BackWPup backups
105
  * Added: support for the new extension
106
  * Added: conditional checks to prevent possible conflicts with certain plugins 
107
  * Added: support for the new MainWP Branding Extension feature
108
+ * Improved: PHP 7.2 compatibility
109
 
110
  = 3.4.7.1 - 5-25-18 =
111
  * Fixed: UpdraftPlus 1.14.10 compatibility issue that caused child sites to disconnect
118
  * Fixed: timezone issue backup timestamp
119
  * Fixed: MainWP Branding Extension conflict that caused issues with hooking WP Admin menu items
120
  * Fixed: MainWP Branding Extension issue with hiding WordPress update nag
121
+ * Fixed: MainWP Branding Extension issue with updating WordPress footer content
122
  * Fixed: issues with loading broken links data
123
+ * Fixed: multiple PHP 7.2 warnings
124
  * Added: support for the BackBlaze backup remote destination (UpdraftPlus Extension)
125
  * Added: support for recording Live Stash updates for Client Reporting
126
  * Updated: recent Wordfence plugin version compatibility
264
  * Updated: Number of categories pulled from child sites (from 50 to 300)
265
 
266
  = 3.1.7 - 8-18-16 =
267
+ * Fixed: Issues with PHP 7 - The MainWP Child is now PHP 7 friendly! :-)
268
  * Added: Support for an upcoming extension (BacukpBuddy Extension)
269
 
270
  = 3.1.6 - 8-2-16 =
366
  * Fixed: 404 error that occurs in case Links Manger extension is in use when child plugin is hidden
367
  * Fixed: Bug with detecting updates of hidden plugins (UpdraftPlus, BackUpWordPress, WP Rocket)
368
  * Fixed: Bug with overwriting Amazon S3 settings in BackUpWordPress plugin
369
+ * Fixed: Bug with empty values for Text Link and Link Source options in Broken Links Checker Extension
370
  * Fixed: Bug with bulk repair action in Wordfence Extension
371
  * Fixed: Bug with incorrect File System Method detection
372
  * Added: Support for an upcoming Extension
373
 
374
  = 2.0.28 - 9-7-15 =
375
+ * Fixed: Security Issue (MainWP White Hat Reward Program)
376
  * Fixed: Support for the Stream 3 plugin
377
  * Fixed: Client Reports issue with recording auto saves for Posts and Pages
378
  * Fixed: An issue with detection for Abandoned Plugins & Themes that are not hosted on WP.org
379
 
380
  = 2.0.27 - 9-2-15 =
381
+ * Fixed: Security Issue (MainWP White Hat Reward Program)
382
 
383
  = 2.0.26 - 9-1-15 =
384
+ * Fixed: Conflict with Stream 3 (Thanks Luke Carbis of Stream)
385
 
386
  = 2.0.25 - 8-31-15 =
387
  * Fixed: Issue with Client Reports extension where comments records were not displayed correctly
391
  * Fixed: Incorrect last update value for abandoned plugins & themes feature
392
  * Fixed: Branding for Server Information page and Clone page title
393
  * Fixed: Incorrect heatmap data and warnings
394
+ * Fixed: Can not add child site because get favicon timeout
395
  * Fixed: Hiding UpdraftPlus, WP Rocket toolbar and their notices when set to hide plugins
396
 
397
  = 2.0.23 - 8-7-15 =
402
 
403
  = 2.0.22 - 7-22-15 =
404
  * Fixed: Bug where the OptmizePress theme has not been updated properly
405
+ * Fixed: Bug where the Client Report extenison recored incorrect time
406
  * Added: Support for the upcomming extension
407
 
408
  = 2.0.21 - 7-9-15 =
422
  * Added: Support for the new UpdraftPlus Extension options
423
  * Enhancement: Speed up directory listing by using less resources, reducing timeout issues
424
  * Fixed: Plugin/theme upgrade issue when no file system method is specified
425
+ * Fixed: X-Frame-Options - ALLOWALL bug
426
  * Fixed: Timeout error for the stats child data function
427
  * Fixed: An error with the Synchronous XMLHttpRequest for tracker.js
428
  * Fixed: Expert settings options for the UpdraftPlus Extension
438
 
439
  = 2.0.16 - 5-15-15 =
440
  * Fixed: Issue with sites running PHP 5.2 and lower
441
+ * Fixed: Sync error on some sites with UpdraftPlus installed
442
  * Fixed: PHP Warning
443
  * Changed: Server page to reflect requested mininum of PHP 5.3
444
 
459
  * Fixed: Security Issue with add_query_arg and remove_query_arg
460
 
461
  = 2.0.12 - 4-16-15 =
462
+ * Fixed: Bug for the MainWP iThemes Security Extension
463
+ * Fixed: Bug for the MainWP WordFence Extension
464
  * Fixed: Bug where the MainWP Child plugin was breaking cron jobs on child sites
465
 
466
  = 2.0.11 - 4-12-15 =
511
 
512
  = 2.0.4 - 12-26-14 =
513
  * Fixed: Backups for hosts having issues with "compress.zlib://" stream wrappers from PHP causing corrupt backup archives
514
+ * Fixed: "Another backup is running" message displaying incorrectly
515
 
516
  = 2.0.3 - 12-15-14 =
517
  * Fixed: Possible security issue
540
  * Redesign: CSS updated to match the Dashboard style
541
  * Redesign: MainWP Child Settings page layout updated
542
  * Redesign: MainWP Child Clone/Restore layout updated
543
+ * Refactor: Added MainWP Child menu added in the WP Admin Menu
544
  * Refactor: MainWP Child Settings, MainWP Clone/Restore and MainWP Child Server Information pages removed from the WP Settings menu and added to MainWP Child
545
 
546
  = 1.3.3 - 9-21-14 =
572
  * Removed incorrect "This site may to connect to your dashboard or may have other issues" when there are ssl warnings
573
 
574
  = 1.0 =
575
+ * Added: Communication to Dashboard during backups to locate common backup locations
576
  * Added: Communication to Dashboard during backups to locate common cache locations
577
  * Added: Communication to Dashboard during backups to locate non-WordPress folders
578
  * Added: Communication to Dashboard during backups to locate Zip Archives
592
  * Changes for update to Client Reports Extension
593
  * Changes for update to Heat Map Extension
594
  * Changes for update to Maintenance Extension
595
+ * Fixed verbiage for restore popup
596
 
597
  = 0.29.10 =
598
  * Fixed: Admin not accessible with invalid upload directory
638
  * Added ability to view Child site error logs on MainWP Dashboard
639
  * Added ability to view Child site Wp-Config on MainWP Dashboard
640
  * Added new Hooks for Branding Extension
641
+ * Added tweak for Code Snippet Extension
642
 
643
  = 0.28.4 =
644
+ * More Extension Hooks to extend Code Snippet functionality
645
 
646
  = 0.28.3 =
647
  * Fixed some issues with Code Snippets extension