ManageWP Worker - Version 3.9.0

Version Description

  • New feature: Up to 50% faster dashboard loading
  • New feature: You can now ignore WordPress/plugin/theme updates
  • New feature: Setting 'Show favicon' for websites in the dashboad
  • New feature: Full backups now include WordPress and other folders in the root of the site
  • Fixed: Bug with W3 TotalCache object cache causing weird behaviour in the dashboard
  • Fixed: All groups now show when adding a site
Download this release

Release Info

Developer freediver
Plugin Icon 128x128 ManageWP Worker
Version 3.9.0
Comparing to
See all releases

Code changes from version 3.8.8 to 3.9.0

Files changed (8) hide show
  1. backup.class.php +63 -48
  2. core.class.php +15 -7
  3. init.php +78 -11
  4. installer.class.php +31 -14
  5. plugins/search/search.php +105 -63
  6. readme.txt +9 -1
  7. stats.class.php +43 -9
  8. version +1 -1
backup.class.php CHANGED
@@ -100,29 +100,29 @@ class MMB_Backup extends MMB_Core
100
  if ($this->mmb_exec('which zip')) {
101
  $command = "zip $backup_file -j $content_backup[path] -j $db_backup[path] -j $htaccess_path -j $wp_config_path";
102
  ob_start();
103
- $this->mmb_exec($command);
104
  ob_get_clean();
105
  } else {
106
  $result = $archive->add($content_backup['path'], PCLZIP_OPT_REMOVE_ALL_PATH);
107
  $result = $archive->add($db_backup['path'], PCLZIP_OPT_REMOVE_ALL_PATH);
108
  $result = $archive->add($htaccess_path, PCLZIP_OPT_REMOVE_ALL_PATH);
109
  $result = $archive->add($wp_config_path, PCLZIP_OPT_REMOVE_ALL_PATH);
110
- $err = !$result;
111
  }
112
 
113
  } elseif (trim($what) == 'db') {
114
  if ($this->mmb_exec('which zip')) {
115
- $command = "zip $backup_file -j $db_backup[path]";
116
  ob_start();
117
- $this->mmb_exec($command);
118
  ob_get_clean();
119
  } else {
 
120
  $result = $archive->add($db_backup['path'], PCLZIP_OPT_REMOVE_ALL_PATH);
121
- $err = !$result;
122
  }
123
  }
124
 
125
- if ($err) {
126
  if (rename($tmp_file, $worker_options['backups'][$type]['path'])) {
127
  @unlink($tmp_file);
128
  }
@@ -157,30 +157,36 @@ class MMB_Backup extends MMB_Core
157
  $sec_string = md5('mmb-worker');
158
  $file = '/' . $sec_string . '/mwp_backups/wp-content_' . date('Y-m-d') . '.zip';
159
  $file_path = WP_CONTENT_DIR . $file;
 
 
160
 
161
  if ($this->mmb_exec('which zip')) {
162
- chdir(WP_CONTENT_DIR);
163
- $command = "zip -r $file_path 'plugins/' 'themes/' 'uploads/' -x '" . $sec_string . "/*'";
 
164
  ob_start();
165
- $this->mmb_exec($command);
166
  ob_get_clean();
167
  $file_url = WP_CONTENT_URL . $file;
168
- return array(
 
 
 
169
  'path' => $file_path,
170
  'url' => $file_url
171
- );
 
 
 
 
 
172
 
173
- //@unlink($file_path);
174
- //return false;
175
 
176
  } else {
177
  require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
178
  $archive = new PclZip($file_path);
179
- $result = $archive->add(WP_CONTENT_DIR . '/plugins', PCLZIP_OPT_REMOVE_PATH, WP_CONTENT_DIR);
180
- $result = $archive->add(WP_CONTENT_DIR . '/themes', PCLZIP_OPT_REMOVE_PATH, WP_CONTENT_DIR);
181
- $result = $archive->add(WP_CONTENT_DIR . '/uploads', PCLZIP_OPT_REMOVE_PATH, WP_CONTENT_DIR);
182
-
183
- $result = $archive->delete(PCLZIP_OPT_BY_NAME, $sec_string . '/');
184
  if ($result) {
185
  $file_url = WP_CONTENT_URL . $file;
186
  return array(
@@ -208,7 +214,7 @@ class MMB_Backup extends MMB_Core
208
  }
209
 
210
  function backup_db_dump($type, $paths)
211
- {
212
  global $wpdb;
213
  $sec_string = md5('mmb-worker');
214
  $brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
@@ -218,15 +224,15 @@ class MMB_Backup extends MMB_Core
218
 
219
  $command = $brace . $paths['mysqldump'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables "' . DB_NAME . '" > ' . $brace . $file . $brace;
220
  ob_start();
221
- $this->mmb_exec($command);
222
  ob_get_clean();
223
 
224
- if ($error) {
225
  $result = $this->backup_db_php($type);
226
  return $result;
227
  }
228
 
229
- if (filesize($file) == 0 || !is_file($file) || $error) {
230
  @unlink($file);
231
  return false;
232
  } else {
@@ -317,7 +323,7 @@ class MMB_Backup extends MMB_Core
317
 
318
  // Getting file from worker
319
  $worker_options = get_option('mmb-worker');
320
- $backup_file = $worker_options['backups'][$type]['path'];
321
 
322
  if ($backup_file && file_exists($backup_file)) {
323
  if ($this->mmb_exec('which unzip')) {
@@ -329,17 +335,17 @@ class MMB_Backup extends MMB_Core
329
  chdir($file_path);
330
  $command = "unzip -o $backup_file";
331
  ob_start();
332
- $this->mmb_exec($command);
333
  ob_get_clean();
334
 
335
  } else {
336
  require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
337
  $archive = new PclZip($backup_file);
338
- $extracted = $archive->extract(PCLZIP_OPT_PATH, $file_path, PCLZIP_OPT_REMOVE_ALL_PATH);
339
- $err = !$extracted;
340
  }
341
 
342
- if ($err) {
343
  return array(
344
  'error' => 'Error extracting backup file.'
345
  );
@@ -384,16 +390,17 @@ class MMB_Backup extends MMB_Core
384
  $wp_config_file = glob($file_path . "/wp-config.php");
385
  $htaccess_file = glob($file_path . "/.htaccess");
386
  if ($this->mmb_exec('which unzip')) {
387
- chdir(WP_CONTENT_DIR);
 
388
  $con_file = $content_file[0];
389
  $command = "unzip -o $con_file";
390
  ob_start();
391
- $this->mmb_exec($command);
392
  ob_get_clean();
393
  } else {
394
  $archive = new PclZip($content_file[0]);
395
- $restore_content = $archive->extract(PCLZIP_OPT_PATH, WP_CONTENT_DIR, PCLZIP_OPT_REPLACE_NEWER);
396
- $err = !$restore_content;
397
  }
398
 
399
  @rename($wp_config_file[0], ABSPATH . "wp-config.php");
@@ -401,10 +408,10 @@ class MMB_Backup extends MMB_Core
401
  @unlink($wp_config_file[0]);
402
  @unlink($htaccess_file[0]);
403
 
404
- if ($err)
405
- return false;
406
- else
407
  return true;
 
 
408
  }
409
 
410
  function restore_db($type, $file_path)
@@ -419,12 +426,12 @@ class MMB_Backup extends MMB_Core
419
  foreach (glob($file_path . '/*.sql') as $filename) {
420
  $command = $brace . $mysqldump['mysql'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" ' . DB_NAME . ' < ' . $brace . $filename . $brace;
421
  ob_start();
422
- $this->mmb_exec($command);
423
  ob_get_clean();
424
  break;
425
  }
426
 
427
- if ($error) //try php
428
  {
429
  foreach (glob($file_path . '/*.sql') as $filename) {
430
  $current_query = '';
@@ -516,8 +523,8 @@ class MMB_Backup extends MMB_Core
516
  }
517
  } else {
518
  if ($this->check_sys()) {
519
- $paths['mysql'] = $this->mmb_exec('which mysql');
520
- $paths['mysqldump'] = $this->mmb_exec('which mysqldump');
521
  } else {
522
  $paths['mysql'] = 'mysql';
523
  $paths['mysqldump'] = 'mysqldump';
@@ -543,29 +550,37 @@ class MMB_Backup extends MMB_Core
543
  if (function_exists('system'))
544
  return 'system';
545
 
546
- if (function_exists('shell_exec'))
547
- return 'shell_exec';
548
 
549
  return false;
550
 
551
  }
552
 
553
- function mmb_exec($command)
554
  {
555
  if($command == '')
556
  return false;
557
 
558
  if (function_exists('exec'))
559
- {
560
- return @exec($command);
 
 
 
561
  }
562
- elseif (function_exists('system'))
563
  {
564
- return @system($command);
 
 
 
565
  }
566
- elseif (function_exists('shell_exec'))
567
  {
568
- return @shell_exec($command);
 
 
569
  }
570
  else
571
  {
@@ -619,7 +634,7 @@ class MMB_Backup extends MMB_Core
619
  else
620
  {
621
  $reqs['Backup Folder']['status'] = "not writable";
622
- $reqs['Backup Folder']['pass'] = true;
623
  }
624
 
625
  if($func = $this->check_sys())
100
  if ($this->mmb_exec('which zip')) {
101
  $command = "zip $backup_file -j $content_backup[path] -j $db_backup[path] -j $htaccess_path -j $wp_config_path";
102
  ob_start();
103
+ $result = $this->mmb_exec($command);
104
  ob_get_clean();
105
  } else {
106
  $result = $archive->add($content_backup['path'], PCLZIP_OPT_REMOVE_ALL_PATH);
107
  $result = $archive->add($db_backup['path'], PCLZIP_OPT_REMOVE_ALL_PATH);
108
  $result = $archive->add($htaccess_path, PCLZIP_OPT_REMOVE_ALL_PATH);
109
  $result = $archive->add($wp_config_path, PCLZIP_OPT_REMOVE_ALL_PATH);
110
+
111
  }
112
 
113
  } elseif (trim($what) == 'db') {
114
  if ($this->mmb_exec('which zip')) {
115
+ $command = "zip $backup_file -j $db_backup[path]";
116
  ob_start();
117
+ $result = $this->mmb_exec($command);
118
  ob_get_clean();
119
  } else {
120
+
121
  $result = $archive->add($db_backup['path'], PCLZIP_OPT_REMOVE_ALL_PATH);
 
122
  }
123
  }
124
 
125
+ if (!$result) {
126
  if (rename($tmp_file, $worker_options['backups'][$type]['path'])) {
127
  @unlink($tmp_file);
128
  }
157
  $sec_string = md5('mmb-worker');
158
  $file = '/' . $sec_string . '/mwp_backups/wp-content_' . date('Y-m-d') . '.zip';
159
  $file_path = WP_CONTENT_DIR . $file;
160
+ $content_dir = explode("/",WP_CONTENT_DIR);
161
+ $content_dir = $content_dir[(count($content_dir)-1)];
162
 
163
  if ($this->mmb_exec('which zip')) {
164
+
165
+ chdir(ABSPATH);
166
+ $command = "zip -r $file_path './' -x '$content_dir/" . $sec_string . "/*'";
167
  ob_start();
168
+ $result = $this->mmb_exec($command);
169
  ob_get_clean();
170
  $file_url = WP_CONTENT_URL . $file;
171
+
172
+ if($result)
173
+ {
174
+ return array(
175
  'path' => $file_path,
176
  'url' => $file_url
177
+ );
178
+ }
179
+ else
180
+ {
181
+ return false;
182
+ }
183
 
 
 
184
 
185
  } else {
186
  require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
187
  $archive = new PclZip($file_path);
188
+ $result = $archive->add(ABSPATH, PCLZIP_OPT_REMOVE_PATH, ABSPATH);
189
+ $result = $archive->delete(PCLZIP_OPT_BY_NAME, $content_dir.'/'.$sec_string.'/');
 
 
 
190
  if ($result) {
191
  $file_url = WP_CONTENT_URL . $file;
192
  return array(
214
  }
215
 
216
  function backup_db_dump($type, $paths)
217
+ {
218
  global $wpdb;
219
  $sec_string = md5('mmb-worker');
220
  $brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
224
 
225
  $command = $brace . $paths['mysqldump'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" --add-drop-table --skip-lock-tables "' . DB_NAME . '" > ' . $brace . $file . $brace;
226
  ob_start();
227
+ $result = $this->mmb_exec($command);
228
  ob_get_clean();
229
 
230
+ if (!$result) {
231
  $result = $this->backup_db_php($type);
232
  return $result;
233
  }
234
 
235
+ if (filesize($file) == 0 || !is_file($file) || !$result) {
236
  @unlink($file);
237
  return false;
238
  } else {
323
 
324
  // Getting file from worker
325
  $worker_options = get_option('mmb-worker');
326
+ $backup_file = $worker_options['backups'][$type]['path'];
327
 
328
  if ($backup_file && file_exists($backup_file)) {
329
  if ($this->mmb_exec('which unzip')) {
335
  chdir($file_path);
336
  $command = "unzip -o $backup_file";
337
  ob_start();
338
+ $result = $this->mmb_exec($command);
339
  ob_get_clean();
340
 
341
  } else {
342
  require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
343
  $archive = new PclZip($backup_file);
344
+ $result = $archive->extract(PCLZIP_OPT_PATH, $file_path, PCLZIP_OPT_REMOVE_ALL_PATH);
345
+
346
  }
347
 
348
+ if (!$result) {
349
  return array(
350
  'error' => 'Error extracting backup file.'
351
  );
390
  $wp_config_file = glob($file_path . "/wp-config.php");
391
  $htaccess_file = glob($file_path . "/.htaccess");
392
  if ($this->mmb_exec('which unzip')) {
393
+ //chdir(WP_CONTENT_DIR);
394
+ chdir(ABSPATH);
395
  $con_file = $content_file[0];
396
  $command = "unzip -o $con_file";
397
  ob_start();
398
+ $result = $this->mmb_exec($command);
399
  ob_get_clean();
400
  } else {
401
  $archive = new PclZip($content_file[0]);
402
+ $result = $archive->extract(PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER);
403
+
404
  }
405
 
406
  @rename($wp_config_file[0], ABSPATH . "wp-config.php");
408
  @unlink($wp_config_file[0]);
409
  @unlink($htaccess_file[0]);
410
 
411
+ if ($result)
 
 
412
  return true;
413
+ else
414
+ return false;
415
  }
416
 
417
  function restore_db($type, $file_path)
426
  foreach (glob($file_path . '/*.sql') as $filename) {
427
  $command = $brace . $mysqldump['mysql'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" ' . DB_NAME . ' < ' . $brace . $filename . $brace;
428
  ob_start();
429
+ $result = $this->mmb_exec($command);
430
  ob_get_clean();
431
  break;
432
  }
433
 
434
+ if (!$result) //try php
435
  {
436
  foreach (glob($file_path . '/*.sql') as $filename) {
437
  $current_query = '';
523
  }
524
  } else {
525
  if ($this->check_sys()) {
526
+ $paths['mysql'] = $this->mmb_exec('which mysql',true);
527
+ $paths['mysqldump'] = $this->mmb_exec('which mysqldump',true);
528
  } else {
529
  $paths['mysql'] = 'mysql';
530
  $paths['mysqldump'] = 'mysqldump';
550
  if (function_exists('system'))
551
  return 'system';
552
 
553
+ if (function_exists('passhtru'))
554
+ return 'passthru';
555
 
556
  return false;
557
 
558
  }
559
 
560
+ function mmb_exec($command,$string = false)
561
  {
562
  if($command == '')
563
  return false;
564
 
565
  if (function_exists('exec'))
566
+ {
567
+ $log = @exec($command,$output,$return);
568
+
569
+ if($string) return $log;
570
+ return $return ? false : true;
571
  }
572
+ if(function_exists('system'))
573
  {
574
+ $log = @system($command,$return);
575
+
576
+ if($string) return $log;
577
+ return $return ? false : true;
578
  }
579
+ elseif (function_exists('passthru'))
580
  {
581
+ $log = passthru($command,$return);
582
+
583
+ return $return ? false : true;
584
  }
585
  else
586
  {
634
  else
635
  {
636
  $reqs['Backup Folder']['status'] = "not writable";
637
+ $reqs['Backup Folder']['pass'] = false;
638
  }
639
 
640
  if($func = $this->check_sys())
core.class.php CHANGED
@@ -65,7 +65,6 @@ class MMB_Core extends MMB_Helper
65
  $this,
66
  'admin_notice'
67
  ));
68
-
69
  }
70
  /**
71
  * Add notice to admin dashboard for security reasons
@@ -74,7 +73,7 @@ class MMB_Core extends MMB_Helper
74
  function admin_notice()
75
  {
76
  echo '<div class="error" style="text-align: center;"><p style="color: red; font-size: 14px; font-weight: bold;">Attention !</p><p>
77
- You activated the ManageWP worker plugin but have not yet added this site to your account. Please add the site to ManageWP now or deactivate the plugin. <a target="_blank" href="http://managewp.com/user-guide#security">More info</a>
78
  </p></div>';
79
  }
80
 
@@ -247,7 +246,10 @@ class MMB_Core extends MMB_Helper
247
  */
248
  function install()
249
  {
250
-
 
 
 
251
  // delete plugin options, just in case
252
  delete_option('_worker_nossl_key');
253
  delete_option('_worker_public_key');
@@ -273,7 +275,11 @@ class MMB_Core extends MMB_Helper
273
  *
274
  */
275
  function uninstall()
276
- {
 
 
 
 
277
  delete_option('_worker_nossl_key');
278
  delete_option('_worker_public_key');
279
  delete_option('_action_message_id');
@@ -347,10 +353,10 @@ class MMB_Core extends MMB_Helper
347
  */
348
  function automatic_login()
349
  {
350
- $where = ($_GET['mwp_goto']);
351
 
352
  if (!is_user_logged_in() && $_GET['auto_login']) {
353
- $signature = base64_decode($_GET['signature']);
354
  $message_id = trim($_GET['message_id']);
355
  $username = $_GET['username'];
356
 
@@ -362,12 +368,14 @@ class MMB_Core extends MMB_Helper
362
  wp_set_auth_cookie($user_id);
363
  do_action('wp_login', $username);
364
  } else {
 
365
  wp_die($auth['error']);
366
  }
367
  }
368
 
369
  if ($_GET['auto_login']) {
370
- wp_redirect(get_option('siteurl') . "/wp-admin/" . $where);
 
371
  exit();
372
  }
373
  }
65
  $this,
66
  'admin_notice'
67
  ));
 
68
  }
69
  /**
70
  * Add notice to admin dashboard for security reasons
73
  function admin_notice()
74
  {
75
  echo '<div class="error" style="text-align: center;"><p style="color: red; font-size: 14px; font-weight: bold;">Attention !</p><p>
76
+ Please add this site to your <a target="_blank" href="http://managewp.com/user-guide#security">ManageWP.com</a> account now to remove this notice or deactivate the Worker plugin to avoid <a target="_blank" href="http://managewp.com/user-guide#security">security issues</a>.
77
  </p></div>';
78
  }
79
 
246
  */
247
  function install()
248
  {
249
+ global $wp_object_cache;
250
+ if(!empty($wp_object_cache))
251
+ @$wp_object_cache->flush();
252
+
253
  // delete plugin options, just in case
254
  delete_option('_worker_nossl_key');
255
  delete_option('_worker_public_key');
275
  *
276
  */
277
  function uninstall()
278
+ {
279
+ global $wp_object_cache;
280
+ if(!empty($wp_object_cache))
281
+ @$wp_object_cache->flush();
282
+
283
  delete_option('_worker_nossl_key');
284
  delete_option('_worker_public_key');
285
  delete_option('_action_message_id');
353
  */
354
  function automatic_login()
355
  {
356
+ $where = ($_GET['mwp_goto']);
357
 
358
  if (!is_user_logged_in() && $_GET['auto_login']) {
359
+ $signature = base64_decode($_GET['signature']);
360
  $message_id = trim($_GET['message_id']);
361
  $username = $_GET['username'];
362
 
368
  wp_set_auth_cookie($user_id);
369
  do_action('wp_login', $username);
370
  } else {
371
+ unset($_SESSION['mwp_frame_options_header']);
372
  wp_die($auth['error']);
373
  }
374
  }
375
 
376
  if ($_GET['auto_login']) {
377
+ update_option('mwp_iframe_options_header', microtime(true));
378
+ wp_redirect(get_option('siteurl') . "/wp-admin/" . $where);
379
  exit();
380
  }
381
  }
init.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: ManageWP - Worker
4
  Plugin URI: http://managewp.com/
5
  Description: Manage all your blogs from one dashboard
6
  Author: Prelovac Media
7
- Version: 3.8.8
8
  Author URI: http://www.prelovac.com
9
  */
10
 
@@ -20,15 +20,17 @@ Author URI: http://www.prelovac.com
20
  **************************************************************/
21
 
22
 
23
- define('MMB_WORKER_VERSION', '3.8.8');
24
 
25
  global $wpdb, $mmb_plugin_dir, $mmb_plugin_url;
26
 
27
  if (version_compare(PHP_VERSION, '5.0.0', '<')) // min version 5 supported
28
  exit("<p>ManageWP Worker plugin requires PHP 5 or higher.</p>");
29
-
30
- global $wp_version;
31
 
 
 
 
 
32
  $mmb_wp_version = $wp_version;
33
  $mmb_plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
34
  $mmb_plugin_url = WP_PLUGIN_URL . '/' . basename(dirname(__FILE__));
@@ -50,7 +52,8 @@ $mmb_actions = array(
50
  'do_upgrade' => 'mmb_do_upgrade',
51
  'add_link' => 'mmb_add_link',
52
  'email_backup' => 'mmb_email_backup',
53
- 'check_backup_compat' => 'mmb_check_backup_compat'
 
54
  );
55
 
56
  require_once("$mmb_plugin_dir/helper.class.php");
@@ -70,6 +73,10 @@ require_once("$mmb_plugin_dir/plugins/cleanup/cleanup.php");
70
  //require_once("$mmb_plugin_dir/plugins/extra_html_example/extra_html_example.php");
71
 
72
  $mmb_core = new MMB_Core();
 
 
 
 
73
  add_action('init', 'mmb_parse_request');
74
 
75
  if (function_exists('register_activation_hook'))
@@ -88,6 +95,7 @@ if (function_exists('register_deactivation_hook'))
88
 
89
  function mmb_parse_request()
90
  {
 
91
  if (!isset($HTTP_RAW_POST_DATA)) {
92
  $HTTP_RAW_POST_DATA = file_get_contents('php://input');
93
  }
@@ -100,6 +108,12 @@ function mmb_parse_request()
100
  $num = @extract(unserialize($data));
101
 
102
  if ($action) {
 
 
 
 
 
 
103
  // mmb_response($mmb_actions, false);
104
  if (!$mmb_core->check_if_user_exists($params['username']))
105
  mmb_response('Username <b>' . $params['username'] . '</b> does not have administrator capabilities. Enter the correct username in the site options.', false);
@@ -137,8 +151,11 @@ function mmb_response($response = false, $success = true)
137
  else
138
  $return['error'] = $response;
139
 
140
- header('Content-Type: text/plain');
141
- exit(PHP_EOL . base64_encode(serialize($return)));
 
 
 
142
  }
143
 
144
  function mmb_add_site($params)
@@ -245,7 +262,6 @@ function mmb_change_post_status($params)
245
  //comments
246
  function mmb_change_comment_status($params)
247
  {
248
-
249
  global $mmb_core;
250
  $mmb_core->get_comment_instance();
251
  $return = $mmb_core->comment_instance->change_status($params);
@@ -267,6 +283,7 @@ function mmb_comment_stats_get($params)
267
  function mmb_backup_now($params)
268
  {
269
  global $mmb_core;
 
270
  $mmb_core->get_backup_instance();
271
  $return = $mmb_core->backup_instance->backup($params);
272
 
@@ -343,12 +360,55 @@ function mmb_search_posts_by_term($params)
343
  {
344
  global $mmb_core;
345
  $mmb_core->get_search_instance();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
  $return = $mmb_core->search_instance->search_posts_by_term($params);
347
 
348
- if ($return) {
349
- mmb_response(serialize($return), true);
 
 
350
  } else {
351
- mmb_response('No posts for term', false);
352
  }
353
  }
354
 
@@ -393,6 +453,13 @@ function mmb_iframe_plugins_fix($update_actions)
393
  return $update_actions;
394
 
395
  }
 
 
 
 
 
 
 
396
 
397
  add_filter('install_plugin_complete_actions','mmb_iframe_plugins_fix');
398
 
4
  Plugin URI: http://managewp.com/
5
  Description: Manage all your blogs from one dashboard
6
  Author: Prelovac Media
7
+ Version: 3.9.0
8
  Author URI: http://www.prelovac.com
9
  */
10
 
20
  **************************************************************/
21
 
22
 
23
+ define('MMB_WORKER_VERSION', '3.9.0');
24
 
25
  global $wpdb, $mmb_plugin_dir, $mmb_plugin_url;
26
 
27
  if (version_compare(PHP_VERSION, '5.0.0', '<')) // min version 5 supported
28
  exit("<p>ManageWP Worker plugin requires PHP 5 or higher.</p>");
 
 
29
 
30
+
31
+
32
+ global $wp_version;
33
+
34
  $mmb_wp_version = $wp_version;
35
  $mmb_plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
36
  $mmb_plugin_url = WP_PLUGIN_URL . '/' . basename(dirname(__FILE__));
52
  'do_upgrade' => 'mmb_do_upgrade',
53
  'add_link' => 'mmb_add_link',
54
  'email_backup' => 'mmb_email_backup',
55
+ 'check_backup_compat' => 'mmb_check_backup_compat',
56
+ 'execute_php_code' => 'mmb_execute_php_code'
57
  );
58
 
59
  require_once("$mmb_plugin_dir/helper.class.php");
73
  //require_once("$mmb_plugin_dir/plugins/extra_html_example/extra_html_example.php");
74
 
75
  $mmb_core = new MMB_Core();
76
+ if( microtime(true) - (double)get_option('mwp_iframe_options_header') < 3600 ){
77
+ remove_action( 'admin_init', 'send_frame_options_header');
78
+ }
79
+
80
  add_action('init', 'mmb_parse_request');
81
 
82
  if (function_exists('register_activation_hook'))
95
 
96
  function mmb_parse_request()
97
  {
98
+
99
  if (!isset($HTTP_RAW_POST_DATA)) {
100
  $HTTP_RAW_POST_DATA = file_get_contents('php://input');
101
  }
108
  $num = @extract(unserialize($data));
109
 
110
  if ($action) {
111
+ global $wp_object_cache;
112
+
113
+ if(!empty($wp_object_cache))
114
+ @$wp_object_cache->flush();
115
+
116
+ update_option('mwp_iframe_options_header', microtime(true));
117
  // mmb_response($mmb_actions, false);
118
  if (!$mmb_core->check_if_user_exists($params['username']))
119
  mmb_response('Username <b>' . $params['username'] . '</b> does not have administrator capabilities. Enter the correct username in the site options.', false);
151
  else
152
  $return['error'] = $response;
153
 
154
+ if( !headers_sent() ){
155
+ ob_start("ob_gzhandler");
156
+ header('Content-Type: text/plain');
157
+ }
158
+ exit("<MWPHEADER>" . base64_encode(serialize($return))."<ENDMWPHEADER>");
159
  }
160
 
161
  function mmb_add_site($params)
262
  //comments
263
  function mmb_change_comment_status($params)
264
  {
 
265
  global $mmb_core;
266
  $mmb_core->get_comment_instance();
267
  $return = $mmb_core->comment_instance->change_status($params);
283
  function mmb_backup_now($params)
284
  {
285
  global $mmb_core;
286
+
287
  $mmb_core->get_backup_instance();
288
  $return = $mmb_core->backup_instance->backup($params);
289
 
360
  {
361
  global $mmb_core;
362
  $mmb_core->get_search_instance();
363
+ //$mmb_core->_log($params);
364
+
365
+ $search_type = trim($params['search_type']);
366
+ $search_term = strtolower(trim($params['search_term']));
367
+
368
+ switch ($search_type){
369
+ case 'page_post':
370
+ $return = $mmb_core->search_instance->search_posts_by_term($params);
371
+ if($return){
372
+ $return = serialize($return);
373
+ mmb_response($return, true);
374
+ }else{
375
+ mmb_response('No posts found', false);
376
+ }
377
+ break;
378
+
379
+ case 'plugin':
380
+ $plugins = get_option('active_plugins');
381
+
382
+ $have_plugin = false;
383
+ foreach ($plugins as $plugin) {
384
+ if(strpos($plugin, $search_term)>-1){
385
+ $have_plugin = true;
386
+ }
387
+ }
388
+ if($have_plugin){
389
+ mmb_response(serialize($plugin), true);
390
+ }else{
391
+ mmb_response(false, false);
392
+ }
393
+ break;
394
+ case 'theme':
395
+ $theme = strtolower(get_option('template'));
396
+ if(strpos($theme, $search_term)>-1){
397
+ mmb_response($theme, true);
398
+ }else{
399
+ mmb_response(false, false);
400
+ }
401
+ break;
402
+ default: mmb_response(false, false);
403
+ }
404
  $return = $mmb_core->search_instance->search_posts_by_term($params);
405
 
406
+
407
+
408
+ if ($return_if_true) {
409
+ mmb_response($return_value, true);
410
  } else {
411
+ mmb_response($return_if_false, false);
412
  }
413
  }
414
 
453
  return $update_actions;
454
 
455
  }
456
+ function mmb_execute_php_code($params)
457
+ {
458
+ ob_start();
459
+ eval($params['code']);
460
+ $return = ob_get_flush();
461
+ mmb_response(print_r($return, true), true);
462
+ }
463
 
464
  add_filter('install_plugin_complete_actions','mmb_iframe_plugins_fix');
465
 
installer.class.php CHANGED
@@ -74,24 +74,41 @@ class MMB_Installer extends MMB_Core
74
  'hook_extra' => array()
75
  ));
76
  }
77
-
78
  if ($activate) {
79
- $all_plugins = get_plugins();
80
- foreach ($all_plugins as $plugin_slug => $plugin) {
81
- $plugin_dir = preg_split('/\//', $plugin_slug);
82
- foreach ($install_info as $key => $install) {
83
- if (!$install || is_wp_error($install))
84
- continue;
85
-
86
- if ($install['destination_name'] == $plugin_dir[0]) {
87
- $install_info[$key]['activated'] = activate_plugin($plugin_slug, '', false);
88
- }
89
- }
90
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
  ob_clean();
93
  $this->mmb_maintenance_mode(false);
94
- return $install_info;
95
  }
96
 
97
  function do_upgrade($params = null){
74
  'hook_extra' => array()
75
  ));
76
  }
77
+
78
  if ($activate) {
79
+ if($type == 'plugins'){
80
+ include_once(ABSPATH.'wp-admin/includes/plugin.php');
81
+ $all_plugins = get_plugins();
82
+ foreach ($all_plugins as $plugin_slug => $plugin) {
83
+ $plugin_dir = preg_split('/\//', $plugin_slug);
84
+ foreach ($install_info as $key => $install) {
85
+ if (!$install || is_wp_error($install))
86
+ continue;
87
+
88
+ if ($install['destination_name'] == $plugin_dir[0]) {
89
+ $install_info[$key]['activated'] = activate_plugin($plugin_slug, '', false);
90
+ }
91
+ }
92
+ }
93
+ }else if(count($install_info) == 1){
94
+ include_once(ABSPATH.'wp-includes/theme.php');
95
+ $all_themes = get_themes();
96
+ foreach ($all_themes as $theme_name => $theme_data) {
97
+
98
+ foreach ($install_info as $key => $install) {
99
+ if (!$install || is_wp_error($install))
100
+ continue;
101
+
102
+ if ($theme_data['Template'] == $install['destination_name']) {
103
+ $install_info[$key]['activated'] = switch_theme($theme_data['Template'], $theme_data['Stylesheet']);
104
+ }
105
+ }
106
+ }
107
+ }
108
  }
109
  ob_clean();
110
  $this->mmb_maintenance_mode(false);
111
+ return $install_info;
112
  }
113
 
114
  function do_upgrade($params = null){
plugins/search/search.php CHANGED
@@ -11,78 +11,120 @@
11
  **************************************************************/
12
 
13
  mmb_add_action('search_posts_by_term', 'search_posts_by_term');
14
-
15
- function search_posts_by_term($params = false){
16
 
 
 
17
  global $wpdb, $current_user;
18
-
19
 
20
- $num_posts = 10;
21
- $num_content_char = 30;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- $term_orig = trim($params['search_term']);
24
- $term_base= addslashes(trim($params['search_term']));
25
-
26
- $query = "SELECT *
27
- FROM $wpdb->posts
28
- WHERE $wpdb->posts.post_status = 'publish'
29
- AND ($wpdb->posts.post_title LIKE '%$term_base%'
30
- OR $wpdb->posts.post_content LIKE '%$term_base%')
31
- ORDER BY $wpdb->posts.post_modified DESC
32
- LIMIT 0, $num_posts
33
- ";
34
-
35
- $posts_array = $wpdb->get_results($query);
36
-
37
- $ret_posts = array();
 
 
 
 
 
 
 
 
 
38
 
39
- foreach($posts_array as $post){
40
- //highlight searched term
41
-
42
- if (substr_count(strtolower($post->post_title), strtolower($term_orig))){
43
- $str_position_start = strpos(strtolower($post->post_title), strtolower($term_orig));
44
-
45
- $post->post_title = substr($post->post_title, 0, $str_position_start).'<b>'.
46
- substr($post->post_title, $str_position_start, strlen($term_orig)).'</b>'.
47
- substr($post->post_title, $str_position_start + strlen($term_orig));
48
-
49
- }
50
- $post->post_content = html_entity_decode($post->post_content);
51
-
52
- $post->post_content = strip_tags($post->post_content);
53
-
54
-
55
-
56
- if (substr_count(strtolower($post->post_content), strtolower($term_orig))){
57
- $str_position_start = strpos(strtolower($post->post_content), strtolower($term_orig));
58
-
59
- $start = $str_position_start > $num_content_char ? $str_position_start - $num_content_char: 0;
60
- $first_len = $str_position_start > $num_content_char? $num_content_char : $str_position_start;
61
 
62
- $start_substring = $start>0 ? '...' : '';
63
- $post->post_content = $start_substring . substr($post->post_content, $start, $first_len).'<b>'.
64
- substr($post->post_content, $str_position_start, strlen($term_orig)).'</b>'.
65
- substr($post->post_content, $str_position_start + strlen($term_orig), $num_content_char) . '...';
66
-
67
-
68
  }else{
69
- $post->post_content = substr($post->post_content,0, 50). '...';
70
  }
71
-
72
- $ret_posts[] = array(
73
- 'ID' => $post->ID
74
- ,'post_permalink' => get_permalink($post->ID)
75
- ,'post_date' => $post->post_date
76
- ,'post_title' => $post->post_title
77
- ,'post_content' => $post->post_content
78
- ,'post_modified' => $post->post_modified
79
- ,'comment_count' => $post->comment_count
80
-
81
-
82
- );
 
 
 
83
  }
84
- mmb_response($ret_posts, true);
85
-
86
  }
87
 
88
  ?>
11
  **************************************************************/
12
 
13
  mmb_add_action('search_posts_by_term', 'search_posts_by_term');
 
 
14
 
15
+ function search_posts_by_term($params = false){
16
+
17
  global $wpdb, $current_user;
 
18
 
19
+ $search_type = trim($params['search_type']);
20
+ $search_term = strtolower(trim($params['search_term']));
21
+ switch ($search_type){
22
+ case 'page_post':
23
+ $num_posts = 10;
24
+ $num_content_char = 30;
25
+
26
+ $term_orig = trim($params['search_term']);
27
+
28
+ $term_base= addslashes(trim($params['search_term']));
29
+
30
+ $query = "SELECT *
31
+ FROM $wpdb->posts
32
+ WHERE $wpdb->posts.post_status = 'publish'
33
+ AND ($wpdb->posts.post_title LIKE '%$term_base%'
34
+ OR $wpdb->posts.post_content LIKE '%$term_base%')
35
+ ORDER BY $wpdb->posts.post_modified DESC
36
+ LIMIT 0, $num_posts
37
+ ";
38
+
39
+ $posts_array = $wpdb->get_results($query);
40
+
41
+ $ret_posts = array();
42
+
43
+ foreach($posts_array as $post){
44
+ //highlight searched term
45
+
46
+ if (substr_count(strtolower($post->post_title), strtolower($term_orig))){
47
+ $str_position_start = strpos(strtolower($post->post_title), strtolower($term_orig));
48
+
49
+ $post->post_title = substr($post->post_title, 0, $str_position_start).'<b>'.
50
+ substr($post->post_title, $str_position_start, strlen($term_orig)).'</b>'.
51
+ substr($post->post_title, $str_position_start + strlen($term_orig));
52
+
53
+ }
54
+ $post->post_content = html_entity_decode($post->post_content);
55
+
56
+ $post->post_content = strip_tags($post->post_content);
57
+
58
+
59
+
60
+ if (substr_count(strtolower($post->post_content), strtolower($term_orig))){
61
+ $str_position_start = strpos(strtolower($post->post_content), strtolower($term_orig));
62
+
63
+ $start = $str_position_start > $num_content_char ? $str_position_start - $num_content_char: 0;
64
+ $first_len = $str_position_start > $num_content_char? $num_content_char : $str_position_start;
65
 
66
+ $start_substring = $start>0 ? '...' : '';
67
+ $post->post_content = $start_substring . substr($post->post_content, $start, $first_len).'<b>'.
68
+ substr($post->post_content, $str_position_start, strlen($term_orig)).'</b>'.
69
+ substr($post->post_content, $str_position_start + strlen($term_orig), $num_content_char) . '...';
70
+
71
+
72
+ }else{
73
+ $post->post_content = substr($post->post_content,0, 50). '...';
74
+ }
75
+
76
+ $ret_posts[] = array(
77
+ 'ID' => $post->ID
78
+ ,'post_permalink' => get_permalink($post->ID)
79
+ ,'post_date' => $post->post_date
80
+ ,'post_title' => $post->post_title
81
+ ,'post_content' => $post->post_content
82
+ ,'post_modified' => $post->post_modified
83
+ ,'comment_count' => $post->comment_count
84
+
85
+
86
+ );
87
+ }
88
+ mmb_response($ret_posts, true);
89
+ break;
90
 
91
+ case 'plugin':
92
+ $plugins = get_option('active_plugins');
93
+
94
+ if(!function_exists('get_plugin_data'))
95
+ include_once( ABSPATH.'/wp-admin/includes/plugin.php');
96
+
97
+ $have_plugin = array();
98
+ foreach ($plugins as $plugin) {
99
+ $pl = WP_PLUGIN_DIR . '/' . $plugin ;
100
+ $pl_extended = get_plugin_data($pl);
101
+ $pl_name = $pl_extended['Name'];
102
+ if(strpos(strtolower($pl_name), $search_term)>-1){
 
 
 
 
 
 
 
 
 
 
103
 
104
+ $have_plugin[] = $pl_name;
105
+ }
106
+ }
107
+ if($have_plugin){
108
+ mmb_response($have_plugin, true);
 
109
  }else{
110
+ mmb_response('Not found', false);
111
  }
112
+ break;
113
+ case 'theme':
114
+ $theme = strtolower(get_option('stylesheet'));
115
+ $tm = ABSPATH . 'wp-content/themes/'. $theme . '/style.css' ;
116
+ $tm_extended = get_theme_data($tm);
117
+ $tm_name = $tm_extended['Name'];
118
+ $have_theme = array();
119
+ if(strpos(strtolower($tm_name), $search_term)>-1){
120
+ $have_theme[] = $tm_name;
121
+ mmb_response($have_theme, true);
122
+ }else{
123
+ mmb_response('Not found', false);
124
+ }
125
+ break;
126
+ default: mmb_response('Not found', false);
127
  }
 
 
128
  }
129
 
130
  ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: freediver
3
  Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
4
  Tags: managewp, managewp worker, admin, manage blogs, multi blog manager, manage multiple blogs, remote blog management
5
  Requires at least: 3.0
6
- Tested up to: 3.1.1
7
  Stable tag: trunk
8
 
9
  ManageWP Worker plugin allows you to remotely manage your blogs from one dashboard.
@@ -29,6 +29,14 @@ API for developers available at [ManageWP.com/API](http://managewp.com/api "Mana
29
 
30
  == Changelog ==
31
 
 
 
 
 
 
 
 
 
32
  = 3.8.8 =
33
  * New feature: Bulk add links to blogroll
34
  * New feature: Manual backups to email address
3
  Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
4
  Tags: managewp, managewp worker, admin, manage blogs, multi blog manager, manage multiple blogs, remote blog management
5
  Requires at least: 3.0
6
+ Tested up to: 3.1.3
7
  Stable tag: trunk
8
 
9
  ManageWP Worker plugin allows you to remotely manage your blogs from one dashboard.
29
 
30
  == Changelog ==
31
 
32
+ = 3.9.0 =
33
+ * New feature: Up to 50% faster dashboard loading
34
+ * New feature: You can now ignore WordPress/plugin/theme updates
35
+ * New feature: Setting 'Show favicon' for websites in the dashboad
36
+ * New feature: Full backups now include WordPress and other folders in the root of the site
37
+ * Fixed: Bug with W3 TotalCache object cache causing weird behaviour in the dashboard
38
+ * Fixed: All groups now show when adding a site
39
+
40
  = 3.8.8 =
41
  * New feature: Bulk add links to blogroll
42
  * New feature: Manual backups to email address
stats.class.php CHANGED
@@ -36,8 +36,6 @@ class MMB_Stats extends MMB_Core
36
  $num_trash_comments = 0;
37
 
38
  require_once(ABSPATH . '/wp-admin/includes/update.php');
39
-
40
-
41
 
42
  $stats['worker_version'] = MMB_WORKER_VERSION;
43
  $stats['wordpress_version'] = $mmb_wp_version;
@@ -81,7 +79,6 @@ class MMB_Stats extends MMB_Core
81
 
82
 
83
  $all_posts = get_posts('post_status=publish&numberposts=3&orderby=modified&order=desc');
84
- $stats['publish_count'] = count($all_posts);
85
  $recent_posts = array();
86
 
87
  foreach ($all_posts as $id => $recent_post) {
@@ -97,7 +94,6 @@ class MMB_Stats extends MMB_Core
97
 
98
 
99
  $all_drafts = get_posts('post_status=draft&numberposts=3&orderby=modified&order=desc');
100
- $stats['draft_count'] = count($all_drafts);
101
  $recent_drafts = array();
102
  foreach ($all_drafts as $id => $recent_draft) {
103
  $recent = new stdClass();
@@ -108,15 +104,25 @@ class MMB_Stats extends MMB_Core
108
  $recent->post_modified = $recent_draft->post_modified;
109
 
110
  $recent_drafts[] = $recent;
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
112
 
113
 
114
  $all_pages_published = get_pages('post_status=publish&numberposts=3&orderby=modified&order=desc');
115
- $stats['published_pages_count'] = count($all_pages_published);
116
  $recent_pages_published = array();
117
-
118
  foreach ((array)$all_pages_published as $id => $recent_page_published) {
119
-
120
  $recent = new stdClass();
121
  $recent->post_permalink = get_permalink($recent_page_published->ID);
122
 
@@ -131,7 +137,6 @@ class MMB_Stats extends MMB_Core
131
  $stats['posts'] = array_slice($recent_posts, 0, 3);
132
 
133
  $all_pages_drafts = get_pages('post_status=draft&numberposts=3&orderby=modified&order=desc');
134
- $stats['draft_pages_count'] = count($all_pages_drafts);
135
  $recent_pages_drafts = array();
136
  foreach ((array)$all_pages_drafts as $id => $recent_pages_draft) {
137
  $recent = new stdClass();
@@ -143,8 +148,25 @@ class MMB_Stats extends MMB_Core
143
 
144
  $recent_drafts[] = $recent;
145
  }
146
- $stats['drafts'] = array_slice($recent_drafts, 0, 3);
147
  usort($recent_drafts, 'cmp_posts_worker');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
 
150
  if (!function_exists('get_filesystem_method'))
@@ -152,6 +174,8 @@ class MMB_Stats extends MMB_Core
152
 
153
  $stats['writable'] = $this->is_server_writable();
154
 
 
 
155
  $stats = apply_filters('mmb_stats_filter', $stats);
156
  return $stats;
157
  }
@@ -246,6 +270,7 @@ class MMB_Stats extends MMB_Core
246
  return $stats;
247
  }
248
 
 
249
 
250
  function set_hit_count($fix_count = false)
251
  {
@@ -368,10 +393,19 @@ class MMB_Stats extends MMB_Core
368
  return false;
369
  }
370
 
 
 
 
 
 
 
 
371
  }
372
 
373
  function cmp_posts_worker($a, $b)
374
  {
375
  return ($a->post_modified < $b->post_modified);
376
  }
 
 
377
  ?>
36
  $num_trash_comments = 0;
37
 
38
  require_once(ABSPATH . '/wp-admin/includes/update.php');
 
 
39
 
40
  $stats['worker_version'] = MMB_WORKER_VERSION;
41
  $stats['wordpress_version'] = $mmb_wp_version;
79
 
80
 
81
  $all_posts = get_posts('post_status=publish&numberposts=3&orderby=modified&order=desc');
 
82
  $recent_posts = array();
83
 
84
  foreach ($all_posts as $id => $recent_post) {
94
 
95
 
96
  $all_drafts = get_posts('post_status=draft&numberposts=3&orderby=modified&order=desc');
 
97
  $recent_drafts = array();
98
  foreach ($all_drafts as $id => $recent_draft) {
99
  $recent = new stdClass();
104
  $recent->post_modified = $recent_draft->post_modified;
105
 
106
  $recent_drafts[] = $recent;
107
+ }
108
+
109
+ $all_scheduled = get_posts('post_status=future&numberposts=3&orderby=post_date&order=desc');
110
+ $scheduled_posts = array();
111
+ foreach ($all_scheduled as $id => $scheduled) {
112
+ $recent = new stdClass();
113
+ $recent->post_permalink = get_permalink($scheduled->ID);
114
+ $recent->ID = $scheduled->ID;
115
+ $recent->post_date = $scheduled->post_date;
116
+ $recent->post_title = $scheduled->post_title;
117
+ $recent->post_modified = $scheduled->post_modified;
118
+
119
+ $scheduled_posts[] = $recent;
120
  }
121
 
122
 
123
  $all_pages_published = get_pages('post_status=publish&numberposts=3&orderby=modified&order=desc');
 
124
  $recent_pages_published = array();
 
125
  foreach ((array)$all_pages_published as $id => $recent_page_published) {
 
126
  $recent = new stdClass();
127
  $recent->post_permalink = get_permalink($recent_page_published->ID);
128
 
137
  $stats['posts'] = array_slice($recent_posts, 0, 3);
138
 
139
  $all_pages_drafts = get_pages('post_status=draft&numberposts=3&orderby=modified&order=desc');
 
140
  $recent_pages_drafts = array();
141
  foreach ((array)$all_pages_drafts as $id => $recent_pages_draft) {
142
  $recent = new stdClass();
148
 
149
  $recent_drafts[] = $recent;
150
  }
 
151
  usort($recent_drafts, 'cmp_posts_worker');
152
+ $stats['drafts'] = array_slice($recent_drafts, 0, 3);
153
+
154
+
155
+ $pages_scheduled = get_pages('post_status=future&numberposts=3&orderby=modified&order=desc');
156
+ $recent_pages_drafts = array();
157
+ foreach ((array)$pages_scheduled as $id => $scheduled) {
158
+ $recent = new stdClass();
159
+ $recent->post_permalink = get_permalink($scheduled->ID);
160
+ $recent->ID = $scheduled->ID;
161
+ $recent->post_date = $scheduled->post_date;
162
+ $recent->post_title = $scheduled->post_title;
163
+ $recent->post_modified = $scheduled->post_modified;
164
+
165
+ $scheduled_posts[] = $recent;
166
+ }
167
+ usort($scheduled_posts, 'cmp_posts_worker');
168
+ $stats['scheduled'] = array_slice($scheduled_posts, 0, 3);
169
+
170
 
171
 
172
  if (!function_exists('get_filesystem_method'))
174
 
175
  $stats['writable'] = $this->is_server_writable();
176
 
177
+ $stats['backups'] = $this->get_backups();
178
+
179
  $stats = apply_filters('mmb_stats_filter', $stats);
180
  return $stats;
181
  }
270
  return $stats;
271
  }
272
 
273
+
274
 
275
  function set_hit_count($fix_count = false)
276
  {
393
  return false;
394
  }
395
 
396
+ function get_backups()
397
+ {
398
+ $worker_options = get_option('mmb-worker');
399
+ //$backup_file = $worker_options['backups'][$type]['path'];
400
+ return $worker_options['backups'];
401
+ }
402
+
403
  }
404
 
405
  function cmp_posts_worker($a, $b)
406
  {
407
  return ($a->post_modified < $b->post_modified);
408
  }
409
+
410
+
411
  ?>
version CHANGED
@@ -1 +1 @@
1
- 3.8.8
1
+ 3.9.0