ManageWP Worker - Version 3.9.18

Version Description

  • New: Pagelines themes added to the list of partners
  • New: Comprehensive website performance scan tool
  • New: You can now bulk edit posts/pages (updating that contact info will become piece of cake)
  • New: Upload and save your premium plugins/themes in your personal repository for quick installation
  • New: Run code snippets now get a repository. Save your snippets and share them with other users
  • New: SEO reports can now be sorted. Export as CSV and PDF reports.
  • New: Manage Blogroll links
  • New: Clean post revisions now has an option to save last x revisions when cleaning
  • New: Bulk delete na posts/pages/links
  • Fix: Amazon S3 backups failing
Download this release

Release Info

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

Code changes from version 3.9.17 to 3.9.18

api.php CHANGED
@@ -38,4 +38,4 @@ if( !function_exists('mmb_function_exists') ) :
38
  }
39
  endif;
40
 
41
- ?>
38
  }
39
  endif;
40
 
41
+ ?>
backup.class.php CHANGED
@@ -65,12 +65,14 @@ class MMB_Backup extends MMB_Core
65
  function __construct()
66
  {
67
  parent::__construct();
68
- $this->site_name = str_replace(array(
69
  "_",
70
- "/"
 
71
  ), array(
72
  "",
73
- "-"
 
74
  ), rtrim($this->remove_http(get_bloginfo('url')), "/"));
75
  $this->statuses = array(
76
  'db_dump' => 1,
@@ -88,6 +90,7 @@ class MMB_Backup extends MMB_Core
88
  function get_backup_settings()
89
  {
90
  $backup_settings = get_option('mwp_backup_tasks');
 
91
  if (!empty($backup_settings))
92
  return $backup_settings;
93
  else
@@ -226,35 +229,34 @@ class MMB_Backup extends MMB_Core
226
  }
227
 
228
  function task_now($task_name){
229
-
230
- $settings = $this->tasks;
231
- if(!array_key_exists($task_name,$settings)){
232
  return array('error' => $task_name." does not exist.");
233
- } else {
234
  $setting = $settings[$task_name];
235
- }
236
 
237
- $this->set_backup_task(array(
238
- 'task_name' => $task_name,
239
- 'args' => $settings[$task_name]['task_args'],
240
- 'time' => time()
241
- ));
242
-
243
- //Run backup
244
- $result = $this->backup($setting['task_args'], $task_name);
245
-
246
- //Check for error
247
- if (is_array($result) && array_key_exists('error', $result)) {
248
- $this->set_backup_task(array(
249
- 'task_name' => $task_name,
250
- 'args' => $settings[$task_name]['task_args'],
251
- 'error' => $result
252
- ));
253
- return $result;
254
- } else {
255
- return $this->get_backup_stats();
256
- }
257
-
258
  }
259
 
260
 
@@ -270,7 +272,9 @@ class MMB_Backup extends MMB_Core
270
 
271
  function backup($args, $task_name = false)
272
  {
273
-
 
 
274
  if (!$args || empty($args))
275
  return false;
276
 
@@ -521,7 +525,7 @@ class MMB_Backup extends MMB_Core
521
  }
522
 
523
  $this->update_status($task_name, $this->statuses['db_dump'], true);
524
- $this->update_status($task_name, $this->statuses['db_zip']);
525
  $disable_comp = $this->tasks[$task_name]['task_args']['disable_comp'];
526
  $comp_level = $disable_comp ? '-0' : '-1';
527
 
@@ -535,6 +539,7 @@ class MMB_Backup extends MMB_Core
535
 
536
 
537
  if (!$result) {
 
538
  define('PCLZIP_TEMPORARY_DIR', MWP_BACKUP_DIR . '/');
539
  require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
540
  $archive = new PclZip($backup_file);
@@ -578,7 +583,7 @@ class MMB_Backup extends MMB_Core
578
  if ($sys == 'WIN')
579
  $exclude_data .= " $data/*.*";
580
  else
581
- $exclude_data .= " $data/*";
582
 
583
 
584
  } else {
@@ -658,7 +663,7 @@ class MMB_Backup extends MMB_Core
658
  ob_get_clean();
659
 
660
  if ($result_f && $result_f != 18) { //Try pclZip
661
-
662
  if (!isset($archive)) {
663
  define('PCLZIP_TEMPORARY_DIR', MWP_BACKUP_DIR . '/');
664
  require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
@@ -760,6 +765,7 @@ class MMB_Backup extends MMB_Core
760
  ob_get_clean();
761
 
762
  if (!$result) { // Fallback to php
 
763
  $result = $this->backup_db_php($file);
764
  return $result;
765
  }
@@ -830,6 +836,7 @@ class MMB_Backup extends MMB_Core
830
 
831
  function restore($args)
832
  {
 
833
  global $wpdb;
834
  if (empty($args)) {
835
  return false;
@@ -944,6 +951,7 @@ class MMB_Backup extends MMB_Core
944
  ob_get_clean();
945
 
946
  if (!$result) { //fallback to pclzip
 
947
  define('PCLZIP_TEMPORARY_DIR', MWP_BACKUP_DIR . '/');
948
  require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
949
  $archive = new PclZip($backup_file);
@@ -1101,6 +1109,7 @@ class MMB_Backup extends MMB_Core
1101
  $result = $this->mmb_exec($command);
1102
  ob_get_clean();
1103
  if (!$result) {
 
1104
  //try php
1105
  $this->restore_db_php($file_name);
1106
  }
@@ -1235,7 +1244,9 @@ class MMB_Backup extends MMB_Core
1235
 
1236
  if ($this->mmb_function_exists('exec')) {
1237
  $log = @exec($command, $output, $return);
1238
-
 
 
1239
  if ($string)
1240
  return $log;
1241
  if ($rawreturn)
@@ -1244,7 +1255,9 @@ class MMB_Backup extends MMB_Core
1244
  return $return ? false : true;
1245
  } elseif ($this->mmb_function_exists('system')) {
1246
  $log = @system($command, $return);
1247
-
 
 
1248
  if ($string)
1249
  return $log;
1250
 
@@ -1254,7 +1267,9 @@ class MMB_Backup extends MMB_Core
1254
  return $return ? false : true;
1255
  } elseif ($this->mmb_function_exists('passthru') && !$string) {
1256
  $log = passthru($command, $return);
1257
-
 
 
1258
  if ($rawreturn)
1259
  return $return;
1260
 
@@ -1398,7 +1413,7 @@ class MMB_Backup extends MMB_Core
1398
  $conn_id = ftp_ssl_connect($ftp_hostname,$port);
1399
  } else {
1400
  return array(
1401
- 'error' => 'Your server doesn\'t support SFTP',
1402
  'partial' => 1
1403
  );
1404
  }
@@ -1413,7 +1428,7 @@ class MMB_Backup extends MMB_Core
1413
  }
1414
  } else {
1415
  return array(
1416
- 'error' => 'Your server doesn\'t support FTP',
1417
  'partial' => 1
1418
  );
1419
  }
@@ -1435,9 +1450,8 @@ class MMB_Backup extends MMB_Core
1435
  $ftp_remote_folder .= '/' . $this->site_name;
1436
  }
1437
  @ftp_mkdir($conn_id, $ftp_remote_folder);
1438
-
1439
  $upload = @ftp_put($conn_id, $ftp_remote_folder . '/' . basename($backup_file), $backup_file, FTP_BINARY);
1440
-
1441
  if ($upload === false) { //Try ascii
1442
  $upload = @ftp_put($conn_id, $ftp_remote_folder . '/' . basename($backup_file), $backup_file, FTP_ASCII);
1443
  }
@@ -1725,10 +1739,11 @@ class MMB_Backup extends MMB_Core
1725
  return $temp;
1726
  }
1727
 
1728
- function schedule_next($type, $schedule)
1729
  {
1730
  $schedule = explode("|", $schedule);
1731
- if (empty($schedule))
 
1732
  return false;
1733
  switch ($type) {
1734
 
@@ -1803,7 +1818,6 @@ class MMB_Backup extends MMB_Core
1803
  $time += $delay_time;
1804
  }
1805
 
1806
-
1807
  return $time;
1808
 
1809
  }
@@ -2031,8 +2045,6 @@ class MMB_Backup extends MMB_Core
2031
  @ini_set('memory_limit', '256M');
2032
  @set_time_limit(600); //ten minutes
2033
 
2034
-
2035
-
2036
  if (!empty($args))
2037
  extract($args);
2038
 
@@ -2181,6 +2193,56 @@ class MMB_Backup extends MMB_Core
2181
  }
2182
  }
2183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2184
  }
2185
 
 
 
 
2186
  ?>
65
  function __construct()
66
  {
67
  parent::__construct();
68
+ $this->site_name = str_replace(array(
69
  "_",
70
+ "/",
71
+ "~"
72
  ), array(
73
  "",
74
+ "-",
75
+ "-"
76
  ), rtrim($this->remove_http(get_bloginfo('url')), "/"));
77
  $this->statuses = array(
78
  'db_dump' => 1,
90
  function get_backup_settings()
91
  {
92
  $backup_settings = get_option('mwp_backup_tasks');
93
+
94
  if (!empty($backup_settings))
95
  return $backup_settings;
96
  else
229
  }
230
 
231
  function task_now($task_name){
232
+
233
+ $settings = $this->tasks;
234
+ if(!array_key_exists($task_name,$settings)){
235
  return array('error' => $task_name." does not exist.");
236
+ } else {
237
  $setting = $settings[$task_name];
238
+ }
239
 
240
+ $this->set_backup_task(array(
241
+ 'task_name' => $task_name,
242
+ 'args' => $settings[$task_name]['task_args'],
243
+ 'time' => time()
244
+ ));
245
+
246
+ //Run backup
247
+ $result = $this->backup($setting['task_args'], $task_name);
248
+
249
+ //Check for error
250
+ if (is_array($result) && array_key_exists('error', $result)) {
251
+ $this->set_backup_task(array(
252
+ 'task_name' => $task_name,
253
+ 'args' => $settings[$task_name]['task_args'],
254
+ 'error' => $result
255
+ ));
256
+ return $result;
257
+ } else {
258
+ return $this->get_backup_stats();
259
+ }
 
260
  }
261
 
262
 
272
 
273
  function backup($args, $task_name = false)
274
  {
275
+
276
+ $this->_log($this->tasks);
277
+
278
  if (!$args || empty($args))
279
  return false;
280
 
525
  }
526
 
527
  $this->update_status($task_name, $this->statuses['db_dump'], true);
528
+ $this->update_status($task_name, $this->statuses['db_zip']);
529
  $disable_comp = $this->tasks[$task_name]['task_args']['disable_comp'];
530
  $comp_level = $disable_comp ? '-0' : '-1';
531
 
539
 
540
 
541
  if (!$result) {
542
+ $this->_log("DB zip fallback to pclZip");
543
  define('PCLZIP_TEMPORARY_DIR', MWP_BACKUP_DIR . '/');
544
  require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
545
  $archive = new PclZip($backup_file);
583
  if ($sys == 'WIN')
584
  $exclude_data .= " $data/*.*";
585
  else
586
+ $exclude_data .= " '$data/*'";
587
 
588
 
589
  } else {
663
  ob_get_clean();
664
 
665
  if ($result_f && $result_f != 18) { //Try pclZip
666
+ $this->_log("Files zip fallback to pclZip");
667
  if (!isset($archive)) {
668
  define('PCLZIP_TEMPORARY_DIR', MWP_BACKUP_DIR . '/');
669
  require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
765
  ob_get_clean();
766
 
767
  if (!$result) { // Fallback to php
768
+ $this->_log("DB dump fallback to php");
769
  $result = $this->backup_db_php($file);
770
  return $result;
771
  }
836
 
837
  function restore($args)
838
  {
839
+ $this->_log($args);
840
  global $wpdb;
841
  if (empty($args)) {
842
  return false;
951
  ob_get_clean();
952
 
953
  if (!$result) { //fallback to pclzip
954
+ $this->_log("Files uznip fallback to pclZip");
955
  define('PCLZIP_TEMPORARY_DIR', MWP_BACKUP_DIR . '/');
956
  require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
957
  $archive = new PclZip($backup_file);
1109
  $result = $this->mmb_exec($command);
1110
  ob_get_clean();
1111
  if (!$result) {
1112
+ $this->_log('DB restore fallback to PHP');
1113
  //try php
1114
  $this->restore_db_php($file_name);
1115
  }
1244
 
1245
  if ($this->mmb_function_exists('exec')) {
1246
  $log = @exec($command, $output, $return);
1247
+ $this->_log("Type: exec");
1248
+ $this->_log("Command: ".$command);
1249
+ $this->_log("Return: ".$return);
1250
  if ($string)
1251
  return $log;
1252
  if ($rawreturn)
1255
  return $return ? false : true;
1256
  } elseif ($this->mmb_function_exists('system')) {
1257
  $log = @system($command, $return);
1258
+ $this->_log("Type: system");
1259
+ $this->_log("Command: ".$command);
1260
+ $this->_log("Return: ".$return);
1261
  if ($string)
1262
  return $log;
1263
 
1267
  return $return ? false : true;
1268
  } elseif ($this->mmb_function_exists('passthru') && !$string) {
1269
  $log = passthru($command, $return);
1270
+ $this->_log("Type: passthru");
1271
+ $this->_log("Command: ".$command);
1272
+ $this->_log("Return: ".$return);
1273
  if ($rawreturn)
1274
  return $return;
1275
 
1413
  $conn_id = ftp_ssl_connect($ftp_hostname,$port);
1414
  } else {
1415
  return array(
1416
+ 'error' => 'FTPS disabled: Please enable ftp_ssl_connect in PHP',
1417
  'partial' => 1
1418
  );
1419
  }
1428
  }
1429
  } else {
1430
  return array(
1431
+ 'error' => 'FTP disabled: Please enable ftp_connect in PHP',
1432
  'partial' => 1
1433
  );
1434
  }
1450
  $ftp_remote_folder .= '/' . $this->site_name;
1451
  }
1452
  @ftp_mkdir($conn_id, $ftp_remote_folder);
1453
+
1454
  $upload = @ftp_put($conn_id, $ftp_remote_folder . '/' . basename($backup_file), $backup_file, FTP_BINARY);
 
1455
  if ($upload === false) { //Try ascii
1456
  $upload = @ftp_put($conn_id, $ftp_remote_folder . '/' . basename($backup_file), $backup_file, FTP_ASCII);
1457
  }
1739
  return $temp;
1740
  }
1741
 
1742
+ function schedule_next($type, $schedule)
1743
  {
1744
  $schedule = explode("|", $schedule);
1745
+
1746
+ if (empty($schedule))
1747
  return false;
1748
  switch ($type) {
1749
 
1818
  $time += $delay_time;
1819
  }
1820
 
 
1821
  return $time;
1822
 
1823
  }
2045
  @ini_set('memory_limit', '256M');
2046
  @set_time_limit(600); //ten minutes
2047
 
 
 
2048
  if (!empty($args))
2049
  extract($args);
2050
 
2193
  }
2194
  }
2195
 
2196
+ public static function readd_tasks( $params = array() ){
2197
+ global $mmb_core;
2198
+
2199
+ if( empty($params) || !isset($params['backups']) )
2200
+ return $params;
2201
+
2202
+ $before = array();
2203
+ $tasks = $params['backups'];
2204
+ if( !empty($tasks) ){
2205
+ $mmb_backup = new MMB_Backup();
2206
+
2207
+ if( function_exists( 'wp_next_scheduled' ) ){
2208
+ if ( !wp_next_scheduled('mwp_backup_tasks') ) {
2209
+ wp_schedule_event( time(), 'tenminutes', 'mwp_backup_tasks' );
2210
+ }
2211
+ }
2212
+
2213
+ foreach( $tasks as $task ){
2214
+ $before[$task['task_name']] = array();
2215
+
2216
+ if(isset($task['secure'])){
2217
+ if($decrypted = $mmb_core->_secure_data($task['secure'])){
2218
+ $decrypted = maybe_unserialize($decrypted);
2219
+ if(is_array($decrypted)){
2220
+ foreach($decrypted as $key => $val){
2221
+ if(!is_numeric($key))
2222
+ $task[$key] = $val;
2223
+ }
2224
+ unset($task['secure']);
2225
+ } else
2226
+ $task['secure'] = $decrypted;
2227
+ }
2228
+
2229
+ }
2230
+ if (isset($task['account_info']) && is_array($task['account_info'])) { //only if sends from master first time(secure data)
2231
+ $task['args']['account_info'] = $task['account_info'];
2232
+ }
2233
+
2234
+ $before[$task['task_name']]['task_args'] = $task['args'];
2235
+ $before[$task['task_name']]['task_args']['next'] = $mmb_backup->schedule_next($task['args']['type'], $task['args']['schedule']);
2236
+ }
2237
+ }
2238
+ update_option('mwp_backup_tasks', $before);
2239
+
2240
+ unset($params['backups']);
2241
+ return $params;
2242
+ }
2243
  }
2244
 
2245
+ if( function_exists('add_filter') ){
2246
+ add_filter( 'mwp_website_add', 'MMB_Backup::readd_tasks' );
2247
+ }
2248
  ?>
core.class.php CHANGED
@@ -37,25 +37,16 @@ class MMB_Core extends MMB_Helper
37
 
38
  function __construct()
39
  {
40
- global $mmb_plugin_dir, $wpmu_version, $blog_id, $_mmb_plugin_actions, $_mmb_item_filter;
41
 
42
  $_mmb_plugin_actions = array();
 
 
 
43
  $this->name = 'Manage Multiple Blogs';
44
- $this->slug = 'manage-multiple-blogs';
45
  $this->action_call = null;
46
  $this->action_params = null;
47
 
48
-
49
- $this->settings = get_option($this->slug);
50
- if (!$this->settings) {
51
- $this->settings = array(
52
- 'blogs' => array(),
53
- 'current_blog' => array(
54
- 'type' => null
55
- )
56
- );
57
- $this->save_options();
58
- }
59
  if ( function_exists('is_multisite') ) {
60
  if ( is_multisite() ) {
61
  $this->mmb_multisite = $blog_id;
@@ -109,7 +100,10 @@ class MMB_Core extends MMB_Helper
109
  'change_post_status' => 'mmb_change_post_status',
110
  'get_comment_stats' => 'mmb_comment_stats_get',
111
  'install_addon' => 'mmb_install_addon',
 
112
  'add_link' => 'mmb_add_link',
 
 
113
  'add_user' => 'mmb_add_user',
114
  'email_backup' => 'mmb_email_backup',
115
  'check_backup_compat' => 'mmb_check_backup_compat',
@@ -124,6 +118,7 @@ class MMB_Core extends MMB_Helper
124
  'edit_users' => 'mmb_edit_users',
125
  'get_posts' => 'mmb_get_posts',
126
  'delete_post' => 'mmb_delete_post',
 
127
  'edit_posts' => 'mmb_edit_posts',
128
  'get_pages' => 'mmb_get_pages',
129
  'delete_page' => 'mmb_delete_page',
@@ -431,13 +426,11 @@ class MMB_Core extends MMB_Helper
431
  * Saves the (modified) options into the database
432
  *
433
  */
434
- function save_options()
435
- {
436
- if (get_option($this->slug)) {
437
- update_option($this->slug, $this->settings);
438
- } else {
439
- add_option($this->slug, $this->settings);
440
- }
441
  }
442
 
443
  /**
@@ -461,6 +454,11 @@ class MMB_Core extends MMB_Helper
461
  delete_blog_option($blog_id, '_worker_public_key');
462
  delete_blog_option($blog_id, '_action_message_id');
463
  delete_blog_option($blog_id, 'mwp_maintenace_mode');
 
 
 
 
 
464
  }
465
  }
466
  } else {
@@ -479,13 +477,14 @@ class MMB_Core extends MMB_Helper
479
  }
480
 
481
  //Delete options
482
- delete_option('mwp_maintenace_mode');
483
  delete_option('mwp_backup_tasks');
484
- wp_clear_scheduled_hook('mwp_backup_tasks');
485
  delete_option('mwp_notifications');
486
- wp_clear_scheduled_hook('mwp_notifications');
487
  delete_option('mwp_worker_brand');
488
  delete_option('mwp_pageview_alerts');
 
 
 
489
  }
490
 
491
 
@@ -520,7 +519,7 @@ class MMB_Core extends MMB_Helper
520
 
521
  if (!$this->is_server_writable()) {
522
  return array(
523
- 'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide#ftp">add FTP details for automatic upgrades.</a></a>'
524
  );
525
  }
526
 
37
 
38
  function __construct()
39
  {
40
+ global $mmb_plugin_dir, $wpmu_version, $blog_id, $_mmb_plugin_actions, $_mmb_item_filter, $_mmb_options;
41
 
42
  $_mmb_plugin_actions = array();
43
+ $_mmb_options = get_option('wrksettings');
44
+ $_mmb_options = !empty($_mmb_options) ? $_mmb_options : array();
45
+
46
  $this->name = 'Manage Multiple Blogs';
 
47
  $this->action_call = null;
48
  $this->action_params = null;
49
 
 
 
 
 
 
 
 
 
 
 
 
50
  if ( function_exists('is_multisite') ) {
51
  if ( is_multisite() ) {
52
  $this->mmb_multisite = $blog_id;
100
  'change_post_status' => 'mmb_change_post_status',
101
  'get_comment_stats' => 'mmb_comment_stats_get',
102
  'install_addon' => 'mmb_install_addon',
103
+ 'get_links' => 'mmb_get_links',
104
  'add_link' => 'mmb_add_link',
105
+ 'delete_link' => 'mmb_delete_link',
106
+ 'delete_links' => 'mmb_delete_links',
107
  'add_user' => 'mmb_add_user',
108
  'email_backup' => 'mmb_email_backup',
109
  'check_backup_compat' => 'mmb_check_backup_compat',
118
  'edit_users' => 'mmb_edit_users',
119
  'get_posts' => 'mmb_get_posts',
120
  'delete_post' => 'mmb_delete_post',
121
+ 'delete_posts' => 'mmb_delete_posts',
122
  'edit_posts' => 'mmb_edit_posts',
123
  'get_pages' => 'mmb_get_pages',
124
  'delete_page' => 'mmb_delete_page',
426
  * Saves the (modified) options into the database
427
  *
428
  */
429
+ function save_options( $options = array() ){
430
+ global $_mmb_options;
431
+
432
+ $_mmb_options = array_merge( $_mmb_options, $options );
433
+ update_option('wrksettings', $options);
 
 
434
  }
435
 
436
  /**
454
  delete_blog_option($blog_id, '_worker_public_key');
455
  delete_blog_option($blog_id, '_action_message_id');
456
  delete_blog_option($blog_id, 'mwp_maintenace_mode');
457
+ delete_blog_option($blog_id, 'mwp_backup_tasks');
458
+ delete_blog_option($blog_id, 'mwp_notifications');
459
+ delete_blog_option($blog_id, 'mwp_worker_brand');
460
+ delete_blog_option($blog_id, 'mwp_pageview_alerts');
461
+ delete_blog_option($blog_id, 'mwp_pageview_alerts');
462
  }
463
  }
464
  } else {
477
  }
478
 
479
  //Delete options
480
+ delete_option('mwp_maintenace_mode');
481
  delete_option('mwp_backup_tasks');
 
482
  delete_option('mwp_notifications');
 
483
  delete_option('mwp_worker_brand');
484
  delete_option('mwp_pageview_alerts');
485
+ wp_clear_scheduled_hook('mwp_backup_tasks');
486
+ wp_clear_scheduled_hook('mwp_notifications');
487
+ wp_clear_scheduled_hook('mwp_datasend');
488
  }
489
 
490
 
519
 
520
  if (!$this->is_server_writable()) {
521
  return array(
522
+ 'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide/faq/my-pluginsthemes-fail-to-update-or-i-receive-a-yellow-ftp-warning">add FTP details for automatic upgrades.</a>'
523
  );
524
  }
525
 
helper.class.php CHANGED
@@ -10,6 +10,8 @@
10
  * www.prelovac.com
11
  **************************************************************/
12
 
 
 
13
  class MMB_Helper
14
  {
15
  /**
@@ -18,7 +20,8 @@ class MMB_Helper
18
  * @param mixed $mixed
19
  */
20
  function _log($mixed)
21
- {
 
22
  if (is_array($mixed)) {
23
  $mixed = print_r($mixed, 1);
24
  } else if (is_object($mixed)) {
@@ -30,6 +33,7 @@ class MMB_Helper
30
  $handle = fopen(dirname(__FILE__) . '/log', 'a');
31
  fwrite($handle, $mixed . PHP_EOL);
32
  fclose($handle);
 
33
  }
34
 
35
  function _escape(&$array)
@@ -339,7 +343,7 @@ class MMB_Helper
339
 
340
  $current_message = $this->get_worker_message_id();
341
 
342
- if ((int) $current_message > (int) $message_id)
343
  return array(
344
  'error' => 'Invalid message recieved. Deactivate and activate the ManageWP Worker plugin on this site, then remove the website from your ManageWP account and add it again.'
345
  );
@@ -381,6 +385,18 @@ class MMB_Helper
381
  );
382
  }
383
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  function _secure_data($data = false){
385
  if($data == false)
386
  return false;
@@ -390,15 +406,17 @@ class MMB_Helper
390
  return false;
391
 
392
  $secure = '';
393
- if( function_exists('openssl_public_decrypt') && !$this->get_random_signature()){
394
  if(is_array($data) && !empty($data)){
395
  foreach($data as $input){
396
  openssl_public_decrypt($input, $decrypted, $pl_key);
397
  $secure .= $decrypted;
398
  }
399
- } else {
400
- openssl_public_decrypt($input, $decrypted, $pl_key);
401
  $secure = $decrypted;
 
 
402
  }
403
  return $secure;
404
  }
@@ -406,6 +424,34 @@ class MMB_Helper
406
 
407
  }
408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  function check_if_user_exists($username = false)
410
  {
411
  global $wpdb;
10
  * www.prelovac.com
11
  **************************************************************/
12
 
13
+ define('MWP_SHOW_LOG', false);
14
+
15
  class MMB_Helper
16
  {
17
  /**
20
  * @param mixed $mixed
21
  */
22
  function _log($mixed)
23
+ {
24
+ if(defined('MWP_SHOW_LOG') && MWP_SHOW_LOG == true){
25
  if (is_array($mixed)) {
26
  $mixed = print_r($mixed, 1);
27
  } else if (is_object($mixed)) {
33
  $handle = fopen(dirname(__FILE__) . '/log', 'a');
34
  fwrite($handle, $mixed . PHP_EOL);
35
  fclose($handle);
36
+ }
37
  }
38
 
39
  function _escape(&$array)
343
 
344
  $current_message = $this->get_worker_message_id();
345
 
346
+ if ((int) $current_message >= (int) $message_id)
347
  return array(
348
  'error' => 'Invalid message recieved. Deactivate and activate the ManageWP Worker plugin on this site, then remove the website from your ManageWP account and add it again.'
349
  );
385
  );
386
  }
387
 
388
+ function get_secure_hash(){
389
+
390
+ $pl_key = $this->get_master_public_key();
391
+ if ( empty($pl_key) )
392
+ $pl_key = $this->get_random_signature();
393
+
394
+ if( !empty($pl_key) )
395
+ return md5(base64_encode($pl_key));
396
+
397
+ return false;
398
+ }
399
+
400
  function _secure_data($data = false){
401
  if($data == false)
402
  return false;
406
  return false;
407
 
408
  $secure = '';
409
+ if( function_exists('openssl_public_decrypt') && !$this->get_random_signature() ){
410
  if(is_array($data) && !empty($data)){
411
  foreach($data as $input){
412
  openssl_public_decrypt($input, $decrypted, $pl_key);
413
  $secure .= $decrypted;
414
  }
415
+ } else if ( is_string( $data ) ) {
416
+ openssl_public_decrypt($data, $decrypted, $pl_key);
417
  $secure = $decrypted;
418
+ } else {
419
+ $secure = $data;
420
  }
421
  return $secure;
422
  }
424
 
425
  }
426
 
427
+ function encrypt_data( $data = false, $single = false ){
428
+ if( empty($data) )
429
+ return $data;
430
+
431
+ $pl_key = $this->get_master_public_key();
432
+ if ( !$pl_key )
433
+ return false;
434
+
435
+ $data = serialize( $data );
436
+ $crypted = '';
437
+ if( function_exists('openssl_public_encrypt') && !$this->get_random_signature() ){
438
+ $length = strlen( $data );
439
+ if( $length > 100 ){
440
+ for($i = 0; $i <= $length + 100; $i = $i+100){
441
+ $input = substr($data, $i, 100);
442
+ openssl_public_encrypt($input, $crypt, $pl_key);
443
+ $crypted .= base64_encode($crypt).'::';
444
+ }
445
+ } else
446
+ openssl_public_encrypt($input, $crypted, $pl_key);
447
+ } else {
448
+ $crypted = base64_encode($data);
449
+ }
450
+
451
+ return $crypted;
452
+
453
+ }
454
+
455
  function check_if_user_exists($username = false)
456
  {
457
  global $wpdb;
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. Visit <a href="http://managewp.com">ManageWP.com</a> to sign up.
6
  Author: Prelovac Media
7
- Version: 3.9.17
8
  Author URI: http://www.prelovac.com
9
  */
10
 
@@ -20,10 +20,10 @@ Author URI: http://www.prelovac.com
20
  **************************************************************/
21
 
22
  if(!defined('MMB_WORKER_VERSION'))
23
- define('MMB_WORKER_VERSION', '3.9.17');
24
 
25
  if ( !defined('MMB_XFRAME_COOKIE')){
26
- $siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl');
27
  define('MMB_XFRAME_COOKIE', $xframe = 'wordpress_'.md5($siteurl).'_xframe');
28
  }
29
  global $wpdb, $mmb_plugin_dir, $mmb_plugin_url, $wp_version, $mmb_filters, $_mmb_item_filter;
@@ -51,20 +51,76 @@ require_once("$mmb_plugin_dir/plugins/cleanup/cleanup.php");
51
 
52
  require_once("$mmb_plugin_dir/widget.class.php");
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  if( !function_exists ( 'mmb_parse_request' )) {
55
- function mmb_parse_request()
56
- {
57
 
58
  if (!isset($HTTP_RAW_POST_DATA)) {
59
  $HTTP_RAW_POST_DATA = file_get_contents('php://input');
60
  }
61
  ob_start();
62
 
63
- global $current_user, $mmb_core, $new_actions, $wp_db_version, $wpmu_version, $_wp_using_ext_object_cache;
64
  $data = base64_decode($HTTP_RAW_POST_DATA);
65
- if ($data)
66
- $num = @extract(unserialize($data));
67
-
 
68
  if (isset($action)) {
69
  $_wp_using_ext_object_cache = false;
70
  @set_time_limit(600);
@@ -114,6 +170,10 @@ if( !function_exists ( 'mmb_parse_request' )) {
114
  }
115
  }
116
 
 
 
 
 
117
  if( !$mmb_core->register_action_params( $action, $params ) ){
118
  global $_mmb_plugin_actions;
119
  $_mmb_plugin_actions[$action] = $params;
@@ -176,13 +236,19 @@ if( !function_exists ( 'mmb_add_site' )) {
176
  update_option('mwp_worker_brand',$brand);
177
  }
178
 
 
 
 
179
  mmb_response($mmb_core->stats_instance->get_initial_stats(), true);
180
  } else if ($verify == 0) {
181
- mmb_response('Invalid message signature. Please contact us if you see this message often.', false);
 
 
182
  } else {
183
  mmb_response('Command not successful. Please try again.', false);
184
  }
185
- } else {
 
186
  if (!get_option('_worker_nossl_key')) {
187
  srand();
188
 
@@ -203,7 +269,7 @@ if( !function_exists ( 'mmb_add_site' )) {
203
  mmb_response($mmb_core->stats_instance->get_initial_stats(), true);
204
  } else
205
  mmb_response('Please deactivate & activate ManageWP Worker plugin on your site, then re-add the site to your dashboard.', false);
206
- }
207
  } else {
208
  mmb_response('Please deactivate & activate ManageWP Worker plugin on your site and re-add the site to your dashboard.', false);
209
  }
@@ -272,6 +338,64 @@ if( !function_exists ( 'mmb_pre_init_stats' )) {
272
  }
273
  }
274
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  //post
276
  if( !function_exists ( 'mmb_post_create' )) {
277
  function mmb_post_create($params)
@@ -566,6 +690,21 @@ if( !function_exists ( 'mmb_do_upgrade' )) {
566
 
567
  }
568
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
569
  if( !function_exists ( 'mmb_add_link' )) {
570
  function mmb_add_link($params)
571
  {
@@ -582,6 +721,36 @@ if( !function_exists ( 'mmb_add_link' )) {
582
  }
583
  }
584
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
585
  if( !function_exists ( 'mmb_add_user' )) {
586
  function mmb_add_user($params)
587
  {
@@ -652,6 +821,21 @@ if( !function_exists ('mmb_delete_post')) {
652
  }
653
  }
654
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
655
  if( !function_exists ('mmb_edit_posts')) {
656
  function mmb_edit_posts($params)
657
  {
@@ -740,7 +924,7 @@ if( !function_exists ( 'mmb_set_alerts' )) {
740
 
741
  }
742
 
743
- if(!function_exists('mmb_more_reccurences')){
744
  //Backup Tasks
745
  add_filter('cron_schedules', 'mmb_more_reccurences');
746
  function mmb_more_reccurences($schedules) {
@@ -748,6 +932,7 @@ if(!function_exists('mmb_more_reccurences')){
748
  $schedules['minutely'] = array('interval' => 60, 'display' => 'Once in a minute');
749
  $schedules['fiveminutes'] = array('interval' => 300, 'display' => 'Once every five minutes');
750
  $schedules['tenminutes'] = array('interval' => 600, 'display' => 'Once every ten minutes');
 
751
 
752
  return $schedules;
753
  }
@@ -765,12 +950,16 @@ if( !function_exists('mwp_check_backup_tasks') ){
765
  }
766
  }
767
 
768
- if (!wp_next_scheduled('mwp_notifications')) {
769
- wp_schedule_event( time(), 'twicedaily', 'mwp_notifications' );
770
- }
771
- add_action('mwp_notifications', 'mwp_check_notifications');
772
-
773
 
 
 
 
 
 
774
 
775
  if( !function_exists('mwp_check_notifications') ){
776
  function mwp_check_notifications() {
4
  Plugin URI: http://managewp.com/
5
  Description: Manage all your blogs from one dashboard. Visit <a href="http://managewp.com">ManageWP.com</a> to sign up.
6
  Author: Prelovac Media
7
+ Version: 3.9.18
8
  Author URI: http://www.prelovac.com
9
  */
10
 
20
  **************************************************************/
21
 
22
  if(!defined('MMB_WORKER_VERSION'))
23
+ define('MMB_WORKER_VERSION', '3.9.18');
24
 
25
  if ( !defined('MMB_XFRAME_COOKIE')){
26
+ $siteurl = function_exists( 'get_site_option' ) ? get_site_option( 'siteurl' ) : get_option( 'siteurl' );
27
  define('MMB_XFRAME_COOKIE', $xframe = 'wordpress_'.md5($siteurl).'_xframe');
28
  }
29
  global $wpdb, $mmb_plugin_dir, $mmb_plugin_url, $wp_version, $mmb_filters, $_mmb_item_filter;
51
 
52
  require_once("$mmb_plugin_dir/widget.class.php");
53
 
54
+ if(!function_exists( 'json_decode' ) && !function_exists( 'json_encode' )){
55
+ global $mmb_plugin_dir;
56
+ require_once ($mmb_plugin_dir.'/lib/json/JSON.php' );
57
+
58
+ function json_decode($json_object, $assoc = false) {
59
+ $json = $assoc == true ? new Services_JSON(SERVICES_JSON_LOOSE_TYPE) : new Services_JSON();
60
+ return $json->decode($json_object);
61
+ }
62
+
63
+ function json_encode($object_data) {
64
+ $json = new Services_JSON();
65
+ return $json->encode($object_data);
66
+ }
67
+ }
68
+
69
+ if( !function_exists ( 'mmb_parse_data' )) {
70
+ function mmb_parse_data( $data = array() ){
71
+ if( empty($data) )
72
+ return $data;
73
+
74
+ $data = (array) $data;
75
+ if( isset($data['params']) )
76
+ $data['params'] = mmb_filter_params( $data['params'] );
77
+
78
+ $postkeys = array('action', 'params', 'id', 'signature', 'setting' );
79
+
80
+ if( !empty($data) ){
81
+ foreach($data as $key => $items){
82
+ if( !in_array($key, $postkeys) )
83
+ unset($data[$key]);
84
+ }
85
+ }
86
+ return $data;
87
+ }
88
+ }
89
+
90
+ if( !function_exists ( 'mmb_filter_params' )) {
91
+ function mmb_filter_params( $array = array() ){
92
+
93
+ $filter = array( 'current_user', 'wpdb' );
94
+ $return = array();
95
+ foreach ($array as $key => $val) {
96
+ if( !is_int($key) && in_array($key, $filter) )
97
+ continue;
98
+
99
+ if( is_array( $val ) ) {
100
+ $return[$key] = mmb_filter_params( $val );
101
+ } else {
102
+ $return[$key] = $val;
103
+ }
104
+ }
105
+
106
+ return $return;
107
+ }
108
+ }
109
+
110
  if( !function_exists ( 'mmb_parse_request' )) {
111
+ function mmb_parse_request(){
 
112
 
113
  if (!isset($HTTP_RAW_POST_DATA)) {
114
  $HTTP_RAW_POST_DATA = file_get_contents('php://input');
115
  }
116
  ob_start();
117
 
118
+ global $current_user, $mmb_core, $new_actions, $wp_db_version, $wpmu_version, $_wp_using_ext_object_cache, $_mmb_options;
119
  $data = base64_decode($HTTP_RAW_POST_DATA);
120
+ if ($data){
121
+ $data = mmb_parse_data( unserialize( $data ) );
122
+ $num = @extract( $data );
123
+ }
124
  if (isset($action)) {
125
  $_wp_using_ext_object_cache = false;
126
  @set_time_limit(600);
170
  }
171
  }
172
 
173
+ if( isset($data['setting']) ){
174
+ $mmb_core->save_options( $data['setting'] );
175
+ }
176
+
177
  if( !$mmb_core->register_action_params( $action, $params ) ){
178
  global $_mmb_plugin_actions;
179
  $_mmb_plugin_actions[$action] = $params;
236
  update_option('mwp_worker_brand',$brand);
237
  }
238
 
239
+ if( isset( $add_settigns ) && !empty( $add_settigns ) )
240
+ apply_filters( 'mwp_website_add', $add_settigns );
241
+
242
  mmb_response($mmb_core->stats_instance->get_initial_stats(), true);
243
  } else if ($verify == 0) {
244
+
245
+ //mmb_response('Site could not be added. OpenSSL verification error: "'.openssl_error_string().'". Contact your hosting support to check the OpenSSL configuration.', false);
246
+
247
  } else {
248
  mmb_response('Command not successful. Please try again.', false);
249
  }
250
+ }
251
+
252
  if (!get_option('_worker_nossl_key')) {
253
  srand();
254
 
269
  mmb_response($mmb_core->stats_instance->get_initial_stats(), true);
270
  } else
271
  mmb_response('Please deactivate & activate ManageWP Worker plugin on your site, then re-add the site to your dashboard.', false);
272
+
273
  } else {
274
  mmb_response('Please deactivate & activate ManageWP Worker plugin on your site and re-add the site to your dashboard.', false);
275
  }
338
  }
339
  }
340
 
341
+ if( !function_exists ( 'mwp_datasend' )) {
342
+ function mwp_datasend( $params = array() )
343
+ {
344
+ global $mmb_core, $_mmb_item_filter, $_mmb_options;
345
+ if( isset($_mmb_options['datacron']) ){
346
+
347
+ $_mmb_remoteurl = get_option('home');
348
+ $_mmb_remoteown = isset($_mmb_options['dataown']) && !empty($_mmb_options['dataown']) ? $_mmb_options['dataown'] : false;
349
+
350
+ if( empty($_mmb_remoteown) )
351
+ return;
352
+
353
+ $_mmb_item_filter['pre_init_stats'] = array( 'core_update', 'hit_counter', 'comments', 'backups', 'posts', 'drafts', 'scheduled' );
354
+ $_mmb_item_filter['get'] = array( 'updates', 'errors' );
355
+ $mmb_core->get_stats_instance();
356
+
357
+ $filter = array(
358
+ 'refresh' => '',
359
+ 'item_filter' => array(
360
+ 'get_stats' => array(
361
+ array('updates', array('plugins' => true, 'themes' => true, 'premium' => true )),
362
+ array('core_update', array('core' => true )),
363
+ array('posts', array('numberposts' => 5 )),
364
+ array('drafts', array('numberposts' => 5 )),
365
+ array('scheduled', array('numberposts' => 5 )),
366
+ array('hit_counter'),
367
+ array('comments', array('numberposts' => 5 )),
368
+ array('backups'),
369
+ 'plugins' => array('cleanup' => array(
370
+ 'overhead' => array(),
371
+ 'revisions' => array( 'num_to_keep' => 'r_5'),
372
+ 'spam' => array(),
373
+ )
374
+ ),
375
+ ),
376
+ )
377
+ );
378
+
379
+ $pre_init_data = $mmb_core->stats_instance->pre_init_stats($filter);
380
+ $init_data = $mmb_core->stats_instance->get($filter);
381
+
382
+ $data = array_merge($init_data, $pre_init_data);
383
+ $hash = $mmb_core->get_secure_hash();
384
+
385
+ $datasend['datasend'] = $mmb_core->encrypt_data($data);
386
+ $datasend['sitehome'] = base64_encode($_mmb_remoteown.'[]'.$_mmb_remoteurl);
387
+ $datasend['sitehash'] = md5($hash.$_mmb_remoteown.$_mmb_remoteurl);
388
+
389
+ if ( !class_exists('WP_Http') )
390
+ include_once(ABSPATH . WPINC . '/class-http.php');
391
+
392
+ $remote = array();
393
+ $remote['body'] = $datasend;
394
+ $result = wp_remote_post($_mmb_options['datacron'], $remote);
395
+ }
396
+ }
397
+ }
398
+
399
  //post
400
  if( !function_exists ( 'mmb_post_create' )) {
401
  function mmb_post_create($params)
690
 
691
  }
692
  }
693
+
694
+ if( !function_exists ('mmb_get_links')) {
695
+ function mmb_get_links($params)
696
+ {
697
+ global $mmb_core;
698
+ $mmb_core->get_link_instance();
699
+ $return = $mmb_core->link_instance->get_links($params);
700
+ if (is_array($return) && array_key_exists('error', $return))
701
+ mmb_response($return['error'], false);
702
+ else {
703
+ mmb_response($return, true);
704
+ }
705
+ }
706
+ }
707
+
708
  if( !function_exists ( 'mmb_add_link' )) {
709
  function mmb_add_link($params)
710
  {
721
  }
722
  }
723
 
724
+ if( !function_exists ('mmb_delete_link')) {
725
+ function mmb_delete_link($params)
726
+ {
727
+ global $mmb_core;
728
+ $mmb_core->get_link_instance();
729
+
730
+ $return = $mmb_core->link_instance->delete_link($params);
731
+ if (is_array($return) && array_key_exists('error', $return))
732
+ mmb_response($return['error'], false);
733
+ else {
734
+ mmb_response($return, true);
735
+ }
736
+ }
737
+ }
738
+
739
+ if( !function_exists ('mmb_delete_links')) {
740
+ function mmb_delete_links($params)
741
+ {
742
+ global $mmb_core;
743
+ $mmb_core->get_link_instance();
744
+
745
+ $return = $mmb_core->link_instance->delete_links($params);
746
+ if (is_array($return) && array_key_exists('error', $return))
747
+ mmb_response($return['error'], false);
748
+ else {
749
+ mmb_response($return, true);
750
+ }
751
+ }
752
+ }
753
+
754
  if( !function_exists ( 'mmb_add_user' )) {
755
  function mmb_add_user($params)
756
  {
821
  }
822
  }
823
 
824
+ if( !function_exists ('mmb_delete_posts')) {
825
+ function mmb_delete_posts($params)
826
+ {
827
+ global $mmb_core;
828
+ $mmb_core->get_post_instance();
829
+
830
+ $return = $mmb_core->post_instance->delete_posts($params);
831
+ if (is_array($return) && array_key_exists('error', $return))
832
+ mmb_response($return['error'], false);
833
+ else {
834
+ mmb_response($return, true);
835
+ }
836
+ }
837
+ }
838
+
839
  if( !function_exists ('mmb_edit_posts')) {
840
  function mmb_edit_posts($params)
841
  {
924
 
925
  }
926
 
927
+ if( !function_exists('mmb_more_reccurences') ){
928
  //Backup Tasks
929
  add_filter('cron_schedules', 'mmb_more_reccurences');
930
  function mmb_more_reccurences($schedules) {
932
  $schedules['minutely'] = array('interval' => 60, 'display' => 'Once in a minute');
933
  $schedules['fiveminutes'] = array('interval' => 300, 'display' => 'Once every five minutes');
934
  $schedules['tenminutes'] = array('interval' => 600, 'display' => 'Once every ten minutes');
935
+ $schedules['sixhours'] = array('interval' => 21600, 'display' => 'Every six hours');
936
 
937
  return $schedules;
938
  }
950
  }
951
  }
952
 
953
+ // if (!wp_next_scheduled('mwp_notifications')) {
954
+ // wp_schedule_event( time(), 'twicedaily', 'mwp_notifications' );
955
+ // }
956
+ // add_action('mwp_notifications', 'mwp_check_notifications');
 
957
 
958
+
959
+ if (!wp_next_scheduled('mwp_datasend')) {
960
+ wp_schedule_event( time(), 'sixhours', 'mwp_datasend' );
961
+ }
962
+ add_action('mwp_datasend', 'mwp_datasend');
963
 
964
  if( !function_exists('mwp_check_notifications') ){
965
  function mwp_check_notifications() {
installer.class.php CHANGED
@@ -127,7 +127,7 @@ class MMB_Installer extends MMB_Core
127
 
128
  if (!$this->is_server_writable()) {
129
  return array(
130
- 'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide#ftp">add FTP details</a></a>'
131
  );
132
  }
133
 
@@ -693,12 +693,14 @@ class MMB_Installer extends MMB_Core
693
  if (in_array($path, $activated_plugins)) {
694
  $plugins['active'][$br_a]['path'] = $path;
695
  $plugins['active'][$br_a]['name'] = strip_tags($plugin['Name']);
 
696
  $br_a++;
697
  }
698
 
699
  if (!in_array($path, $activated_plugins)) {
700
  $plugins['inactive'][$br_i]['path'] = $path;
701
  $plugins['inactive'][$br_i]['name'] = strip_tags($plugin['Name']);
 
702
  $br_i++;
703
  }
704
 
@@ -748,6 +750,7 @@ class MMB_Installer extends MMB_Core
748
  if ($current_theme == $theme_name) {
749
  $themes['active'][$br_a]['path'] = $theme['Template'];
750
  $themes['active'][$br_a]['name'] = strip_tags($theme['Name']);
 
751
  $themes['active'][$br_a]['stylesheet'] = $theme['Stylesheet'];
752
  $br_a++;
753
  }
@@ -755,6 +758,7 @@ class MMB_Installer extends MMB_Core
755
  if ($current_theme != $theme_name) {
756
  $themes['inactive'][$br_i]['path'] = $theme['Template'];
757
  $themes['inactive'][$br_i]['name'] = strip_tags($theme['Name']);
 
758
  $themes['inactive'][$br_i]['stylesheet'] = $theme['Stylesheet'];
759
  $br_i++;
760
  }
127
 
128
  if (!$this->is_server_writable()) {
129
  return array(
130
+ 'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide/faq/my-pluginsthemes-fail-to-update-or-i-receive-a-yellow-ftp-warning">add FTP details</a>'
131
  );
132
  }
133
 
693
  if (in_array($path, $activated_plugins)) {
694
  $plugins['active'][$br_a]['path'] = $path;
695
  $plugins['active'][$br_a]['name'] = strip_tags($plugin['Name']);
696
+ $plugins['active'][$br_a]['version'] = $plugin['Version'];
697
  $br_a++;
698
  }
699
 
700
  if (!in_array($path, $activated_plugins)) {
701
  $plugins['inactive'][$br_i]['path'] = $path;
702
  $plugins['inactive'][$br_i]['name'] = strip_tags($plugin['Name']);
703
+ $plugins['inactive'][$br_i]['version'] = $plugin['Version'];
704
  $br_i++;
705
  }
706
 
750
  if ($current_theme == $theme_name) {
751
  $themes['active'][$br_a]['path'] = $theme['Template'];
752
  $themes['active'][$br_a]['name'] = strip_tags($theme['Name']);
753
+ $themes['active'][$br_a]['version'] = $theme['Version'];
754
  $themes['active'][$br_a]['stylesheet'] = $theme['Stylesheet'];
755
  $br_a++;
756
  }
758
  if ($current_theme != $theme_name) {
759
  $themes['inactive'][$br_i]['path'] = $theme['Template'];
760
  $themes['inactive'][$br_i]['name'] = strip_tags($theme['Name']);
761
+ $themes['inactive'][$br_i]['version'] = $theme['Version'];
762
  $themes['inactive'][$br_i]['stylesheet'] = $theme['Stylesheet'];
763
  $br_i++;
764
  }
lib/dropbox.oauth.php CHANGED
@@ -1131,3 +1131,4 @@ class DropboxException extends Exception
1131
  }
1132
 
1133
  ?>
 
1131
  }
1132
 
1133
  ?>
1134
+
lib/json/JSON.php ADDED
@@ -0,0 +1,806 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
+
4
+ /**
5
+ * Converts to and from JSON format.
6
+ *
7
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
8
+ * format. It is easy for humans to read and write. It is easy for machines
9
+ * to parse and generate. It is based on a subset of the JavaScript
10
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
11
+ * This feature can also be found in Python. JSON is a text format that is
12
+ * completely language independent but uses conventions that are familiar
13
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
14
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
15
+ * ideal data-interchange language.
16
+ *
17
+ * This package provides a simple encoder and decoder for JSON notation. It
18
+ * is intended for use with client-side Javascript applications that make
19
+ * use of HTTPRequest to perform server communication functions - data can
20
+ * be encoded into JSON notation for use in a client-side javascript, or
21
+ * decoded from incoming Javascript requests. JSON format is native to
22
+ * Javascript, and can be directly eval()'ed with no further parsing
23
+ * overhead
24
+ *
25
+ * All strings should be in ASCII or UTF-8 format!
26
+ *
27
+ * LICENSE: Redistribution and use in source and binary forms, with or
28
+ * without modification, are permitted provided that the following
29
+ * conditions are met: Redistributions of source code must retain the
30
+ * above copyright notice, this list of conditions and the following
31
+ * disclaimer. Redistributions in binary form must reproduce the above
32
+ * copyright notice, this list of conditions and the following disclaimer
33
+ * in the documentation and/or other materials provided with the
34
+ * distribution.
35
+ *
36
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
37
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
39
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
40
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
41
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
42
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
45
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
46
+ * DAMAGE.
47
+ *
48
+ * @category
49
+ * @package Services_JSON
50
+ * @author Michal Migurski <mike-json@teczno.com>
51
+ * @author Matt Knapp <mdknapp[at]gmail[dot]com>
52
+ * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
53
+ * @copyright 2005 Michal Migurski
54
+ * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
55
+ * @license http://www.opensource.org/licenses/bsd-license.php
56
+ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
57
+ */
58
+
59
+ /**
60
+ * Marker constant for Services_JSON::decode(), used to flag stack state
61
+ */
62
+ define('SERVICES_JSON_SLICE', 1);
63
+
64
+ /**
65
+ * Marker constant for Services_JSON::decode(), used to flag stack state
66
+ */
67
+ define('SERVICES_JSON_IN_STR', 2);
68
+
69
+ /**
70
+ * Marker constant for Services_JSON::decode(), used to flag stack state
71
+ */
72
+ define('SERVICES_JSON_IN_ARR', 3);
73
+
74
+ /**
75
+ * Marker constant for Services_JSON::decode(), used to flag stack state
76
+ */
77
+ define('SERVICES_JSON_IN_OBJ', 4);
78
+
79
+ /**
80
+ * Marker constant for Services_JSON::decode(), used to flag stack state
81
+ */
82
+ define('SERVICES_JSON_IN_CMT', 5);
83
+
84
+ /**
85
+ * Behavior switch for Services_JSON::decode()
86
+ */
87
+ define('SERVICES_JSON_LOOSE_TYPE', 16);
88
+
89
+ /**
90
+ * Behavior switch for Services_JSON::decode()
91
+ */
92
+ define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
93
+
94
+ /**
95
+ * Converts to and from JSON format.
96
+ *
97
+ * Brief example of use:
98
+ *
99
+ * <code>
100
+ * // create a new instance of Services_JSON
101
+ * $json = new Services_JSON();
102
+ *
103
+ * // convert a complexe value to JSON notation, and send it to the browser
104
+ * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
105
+ * $output = $json->encode($value);
106
+ *
107
+ * print($output);
108
+ * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
109
+ *
110
+ * // accept incoming POST data, assumed to be in JSON notation
111
+ * $input = file_get_contents('php://input', 1000000);
112
+ * $value = $json->decode($input);
113
+ * </code>
114
+ */
115
+ class Services_JSON
116
+ {
117
+ /**
118
+ * constructs a new JSON instance
119
+ *
120
+ * @param int $use object behavior flags; combine with boolean-OR
121
+ *
122
+ * possible values:
123
+ * - SERVICES_JSON_LOOSE_TYPE: loose typing.
124
+ * "{...}" syntax creates associative arrays
125
+ * instead of objects in decode().
126
+ * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
127
+ * Values which can't be encoded (e.g. resources)
128
+ * appear as NULL instead of throwing errors.
129
+ * By default, a deeply-nested resource will
130
+ * bubble up with an error, so all return values
131
+ * from encode() should be checked with isError()
132
+ */
133
+ function Services_JSON($use = 0)
134
+ {
135
+ $this->use = $use;
136
+ }
137
+
138
+ /**
139
+ * convert a string from one UTF-16 char to one UTF-8 char
140
+ *
141
+ * Normally should be handled by mb_convert_encoding, but
142
+ * provides a slower PHP-only method for installations
143
+ * that lack the multibye string extension.
144
+ *
145
+ * @param string $utf16 UTF-16 character
146
+ * @return string UTF-8 character
147
+ * @access private
148
+ */
149
+ function utf162utf8($utf16)
150
+ {
151
+ // oh please oh please oh please oh please oh please
152
+ if(function_exists('mb_convert_encoding')) {
153
+ return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
154
+ }
155
+
156
+ $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
157
+
158
+ switch(true) {
159
+ case ((0x7F & $bytes) == $bytes):
160
+ // this case should never be reached, because we are in ASCII range
161
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
162
+ return chr(0x7F & $bytes);
163
+
164
+ case (0x07FF & $bytes) == $bytes:
165
+ // return a 2-byte UTF-8 character
166
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
167
+ return chr(0xC0 | (($bytes >> 6) & 0x1F))
168
+ . chr(0x80 | ($bytes & 0x3F));
169
+
170
+ case (0xFFFF & $bytes) == $bytes:
171
+ // return a 3-byte UTF-8 character
172
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
173
+ return chr(0xE0 | (($bytes >> 12) & 0x0F))
174
+ . chr(0x80 | (($bytes >> 6) & 0x3F))
175
+ . chr(0x80 | ($bytes & 0x3F));
176
+ }
177
+
178
+ // ignoring UTF-32 for now, sorry
179
+ return '';
180
+ }
181
+
182
+ /**
183
+ * convert a string from one UTF-8 char to one UTF-16 char
184
+ *
185
+ * Normally should be handled by mb_convert_encoding, but
186
+ * provides a slower PHP-only method for installations
187
+ * that lack the multibye string extension.
188
+ *
189
+ * @param string $utf8 UTF-8 character
190
+ * @return string UTF-16 character
191
+ * @access private
192
+ */
193
+ function utf82utf16($utf8)
194
+ {
195
+ // oh please oh please oh please oh please oh please
196
+ if(function_exists('mb_convert_encoding')) {
197
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
198
+ }
199
+
200
+ switch(strlen($utf8)) {
201
+ case 1:
202
+ // this case should never be reached, because we are in ASCII range
203
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
204
+ return $utf8;
205
+
206
+ case 2:
207
+ // return a UTF-16 character from a 2-byte UTF-8 char
208
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
209
+ return chr(0x07 & (ord($utf8{0}) >> 2))
210
+ . chr((0xC0 & (ord($utf8{0}) << 6))
211
+ | (0x3F & ord($utf8{1})));
212
+
213
+ case 3:
214
+ // return a UTF-16 character from a 3-byte UTF-8 char
215
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
216
+ return chr((0xF0 & (ord($utf8{0}) << 4))
217
+ | (0x0F & (ord($utf8{1}) >> 2)))
218
+ . chr((0xC0 & (ord($utf8{1}) << 6))
219
+ | (0x7F & ord($utf8{2})));
220
+ }
221
+
222
+ // ignoring UTF-32 for now, sorry
223
+ return '';
224
+ }
225
+
226
+ /**
227
+ * encodes an arbitrary variable into JSON format
228
+ *
229
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
230
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
231
+ * if var is a strng, note that encode() always expects it
232
+ * to be in ASCII or UTF-8 format!
233
+ *
234
+ * @return mixed JSON string representation of input var or an error if a problem occurs
235
+ * @access public
236
+ */
237
+ function encode($var)
238
+ {
239
+ switch (gettype($var)) {
240
+ case 'boolean':
241
+ return $var ? 'true' : 'false';
242
+
243
+ case 'NULL':
244
+ return 'null';
245
+
246
+ case 'integer':
247
+ return (int) $var;
248
+
249
+ case 'double':
250
+ case 'float':
251
+ return (float) $var;
252
+
253
+ case 'string':
254
+ // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
255
+ $ascii = '';
256
+ $strlen_var = strlen($var);
257
+
258
+ /*
259
+ * Iterate over every character in the string,
260
+ * escaping with a slash or encoding to UTF-8 where necessary
261
+ */
262
+ for ($c = 0; $c < $strlen_var; ++$c) {
263
+
264
+ $ord_var_c = ord($var{$c});
265
+
266
+ switch (true) {
267
+ case $ord_var_c == 0x08:
268
+ $ascii .= '\b';
269
+ break;
270
+ case $ord_var_c == 0x09:
271
+ $ascii .= '\t';
272
+ break;
273
+ case $ord_var_c == 0x0A:
274
+ $ascii .= '\n';
275
+ break;
276
+ case $ord_var_c == 0x0C:
277
+ $ascii .= '\f';
278
+ break;
279
+ case $ord_var_c == 0x0D:
280
+ $ascii .= '\r';
281
+ break;
282
+
283
+ case $ord_var_c == 0x22:
284
+ case $ord_var_c == 0x2F:
285
+ case $ord_var_c == 0x5C:
286
+ // double quote, slash, slosh
287
+ $ascii .= '\\'.$var{$c};
288
+ break;
289
+
290
+ case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
291
+ // characters U-00000000 - U-0000007F (same as ASCII)
292
+ $ascii .= $var{$c};
293
+ break;
294
+
295
+ case (($ord_var_c & 0xE0) == 0xC0):
296
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
297
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
298
+ $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
299
+ $c += 1;
300
+ $utf16 = $this->utf82utf16($char);
301
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
302
+ break;
303
+
304
+ case (($ord_var_c & 0xF0) == 0xE0):
305
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
306
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
307
+ $char = pack('C*', $ord_var_c,
308
+ ord($var{$c + 1}),
309
+ ord($var{$c + 2}));
310
+ $c += 2;
311
+ $utf16 = $this->utf82utf16($char);
312
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
313
+ break;
314
+
315
+ case (($ord_var_c & 0xF8) == 0xF0):
316
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
317
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
318
+ $char = pack('C*', $ord_var_c,
319
+ ord($var{$c + 1}),
320
+ ord($var{$c + 2}),
321
+ ord($var{$c + 3}));
322
+ $c += 3;
323
+ $utf16 = $this->utf82utf16($char);
324
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
325
+ break;
326
+
327
+ case (($ord_var_c & 0xFC) == 0xF8):
328
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
329
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
330
+ $char = pack('C*', $ord_var_c,
331
+ ord($var{$c + 1}),
332
+ ord($var{$c + 2}),
333
+ ord($var{$c + 3}),
334
+ ord($var{$c + 4}));
335
+ $c += 4;
336
+ $utf16 = $this->utf82utf16($char);
337
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
338
+ break;
339
+
340
+ case (($ord_var_c & 0xFE) == 0xFC):
341
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
342
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
343
+ $char = pack('C*', $ord_var_c,
344
+ ord($var{$c + 1}),
345
+ ord($var{$c + 2}),
346
+ ord($var{$c + 3}),
347
+ ord($var{$c + 4}),
348
+ ord($var{$c + 5}));
349
+ $c += 5;
350
+ $utf16 = $this->utf82utf16($char);
351
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
352
+ break;
353
+ }
354
+ }
355
+
356
+ return '"'.$ascii.'"';
357
+
358
+ case 'array':
359
+ /*
360
+ * As per JSON spec if any array key is not an integer
361
+ * we must treat the the whole array as an object. We
362
+ * also try to catch a sparsely populated associative
363
+ * array with numeric keys here because some JS engines
364
+ * will create an array with empty indexes up to
365
+ * max_index which can cause memory issues and because
366
+ * the keys, which may be relevant, will be remapped
367
+ * otherwise.
368
+ *
369
+ * As per the ECMA and JSON specification an object may
370
+ * have any string as a property. Unfortunately due to
371
+ * a hole in the ECMA specification if the key is a
372
+ * ECMA reserved word or starts with a digit the
373
+ * parameter is only accessible using ECMAScript's
374
+ * bracket notation.
375
+ */
376
+
377
+ // treat as a JSON object
378
+ if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
379
+ $properties = array_map(array($this, 'name_value'),
380
+ array_keys($var),
381
+ array_values($var));
382
+
383
+ foreach($properties as $property) {
384
+ if(Services_JSON::isError($property)) {
385
+ return $property;
386
+ }
387
+ }
388
+
389
+ return '{' . join(',', $properties) . '}';
390
+ }
391
+
392
+ // treat it like a regular array
393
+ $elements = array_map(array($this, 'encode'), $var);
394
+
395
+ foreach($elements as $element) {
396
+ if(Services_JSON::isError($element)) {
397
+ return $element;
398
+ }
399
+ }
400
+
401
+ return '[' . join(',', $elements) . ']';
402
+
403
+ case 'object':
404
+ $vars = get_object_vars($var);
405
+
406
+ $properties = array_map(array($this, 'name_value'),
407
+ array_keys($vars),
408
+ array_values($vars));
409
+
410
+ foreach($properties as $property) {
411
+ if(Services_JSON::isError($property)) {
412
+ return $property;
413
+ }
414
+ }
415
+
416
+ return '{' . join(',', $properties) . '}';
417
+
418
+ default:
419
+ return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
420
+ ? 'null'
421
+ : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
422
+ }
423
+ }
424
+
425
+ /**
426
+ * array-walking function for use in generating JSON-formatted name-value pairs
427
+ *
428
+ * @param string $name name of key to use
429
+ * @param mixed $value reference to an array element to be encoded
430
+ *
431
+ * @return string JSON-formatted name-value pair, like '"name":value'
432
+ * @access private
433
+ */
434
+ function name_value($name, $value)
435
+ {
436
+ $encoded_value = $this->encode($value);
437
+
438
+ if(Services_JSON::isError($encoded_value)) {
439
+ return $encoded_value;
440
+ }
441
+
442
+ return $this->encode(strval($name)) . ':' . $encoded_value;
443
+ }
444
+
445
+ /**
446
+ * reduce a string by removing leading and trailing comments and whitespace
447
+ *
448
+ * @param $str string string value to strip of comments and whitespace
449
+ *
450
+ * @return string string value stripped of comments and whitespace
451
+ * @access private
452
+ */
453
+ function reduce_string($str)
454
+ {
455
+ $str = preg_replace(array(
456
+
457
+ // eliminate single line comments in '// ...' form
458
+ '#^\s*//(.+)$#m',
459
+
460
+ // eliminate multi-line comments in '/* ... */' form, at start of string
461
+ '#^\s*/\*(.+)\*/#Us',
462
+
463
+ // eliminate multi-line comments in '/* ... */' form, at end of string
464
+ '#/\*(.+)\*/\s*$#Us'
465
+
466
+ ), '', $str);
467
+
468
+ // eliminate extraneous space
469
+ return trim($str);
470
+ }
471
+
472
+ /**
473
+ * decodes a JSON string into appropriate variable
474
+ *
475
+ * @param string $str JSON-formatted string
476
+ *
477
+ * @return mixed number, boolean, string, array, or object
478
+ * corresponding to given JSON input string.
479
+ * See argument 1 to Services_JSON() above for object-output behavior.
480
+ * Note that decode() always returns strings
481
+ * in ASCII or UTF-8 format!
482
+ * @access public
483
+ */
484
+ function decode($str)
485
+ {
486
+ $str = $this->reduce_string($str);
487
+
488
+ switch (strtolower($str)) {
489
+ case 'true':
490
+ return true;
491
+
492
+ case 'false':
493
+ return false;
494
+
495
+ case 'null':
496
+ return null;
497
+
498
+ default:
499
+ $m = array();
500
+
501
+ if (is_numeric($str)) {
502
+ // Lookie-loo, it's a number
503
+
504
+ // This would work on its own, but I'm trying to be
505
+ // good about returning integers where appropriate:
506
+ // return (float)$str;
507
+
508
+ // Return float or int, as appropriate
509
+ return ((float)$str == (integer)$str)
510
+ ? (integer)$str
511
+ : (float)$str;
512
+
513
+ } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
514
+ // STRINGS RETURNED IN UTF-8 FORMAT
515
+ $delim = substr($str, 0, 1);
516
+ $chrs = substr($str, 1, -1);
517
+ $utf8 = '';
518
+ $strlen_chrs = strlen($chrs);
519
+
520
+ for ($c = 0; $c < $strlen_chrs; ++$c) {
521
+
522
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
523
+ $ord_chrs_c = ord($chrs{$c});
524
+
525
+ switch (true) {
526
+ case $substr_chrs_c_2 == '\b':
527
+ $utf8 .= chr(0x08);
528
+ ++$c;
529
+ break;
530
+ case $substr_chrs_c_2 == '\t':
531
+ $utf8 .= chr(0x09);
532
+ ++$c;
533
+ break;
534
+ case $substr_chrs_c_2 == '\n':
535
+ $utf8 .= chr(0x0A);
536
+ ++$c;
537
+ break;
538
+ case $substr_chrs_c_2 == '\f':
539
+ $utf8 .= chr(0x0C);
540
+ ++$c;
541
+ break;
542
+ case $substr_chrs_c_2 == '\r':
543
+ $utf8 .= chr(0x0D);
544
+ ++$c;
545
+ break;
546
+
547
+ case $substr_chrs_c_2 == '\\"':
548
+ case $substr_chrs_c_2 == '\\\'':
549
+ case $substr_chrs_c_2 == '\\\\':
550
+ case $substr_chrs_c_2 == '\\/':
551
+ if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
552
+ ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
553
+ $utf8 .= $chrs{++$c};
554
+ }
555
+ break;
556
+
557
+ case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
558
+ // single, escaped unicode character
559
+ $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
560
+ . chr(hexdec(substr($chrs, ($c + 4), 2)));
561
+ $utf8 .= $this->utf162utf8($utf16);
562
+ $c += 5;
563
+ break;
564
+
565
+ case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
566
+ $utf8 .= $chrs{$c};
567
+ break;
568
+
569
+ case ($ord_chrs_c & 0xE0) == 0xC0:
570
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
571
+ //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
572
+ $utf8 .= substr($chrs, $c, 2);
573
+ ++$c;
574
+ break;
575
+
576
+ case ($ord_chrs_c & 0xF0) == 0xE0:
577
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
578
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
579
+ $utf8 .= substr($chrs, $c, 3);
580
+ $c += 2;
581
+ break;
582
+
583
+ case ($ord_chrs_c & 0xF8) == 0xF0:
584
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
585
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
586
+ $utf8 .= substr($chrs, $c, 4);
587
+ $c += 3;
588
+ break;
589
+
590
+ case ($ord_chrs_c & 0xFC) == 0xF8:
591
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
592
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
593
+ $utf8 .= substr($chrs, $c, 5);
594
+ $c += 4;
595
+ break;
596
+
597
+ case ($ord_chrs_c & 0xFE) == 0xFC:
598
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
599
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
600
+ $utf8 .= substr($chrs, $c, 6);
601
+ $c += 5;
602
+ break;
603
+
604
+ }
605
+
606
+ }
607
+
608
+ return $utf8;
609
+
610
+ } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
611
+ // array, or object notation
612
+
613
+ if ($str{0} == '[') {
614
+ $stk = array(SERVICES_JSON_IN_ARR);
615
+ $arr = array();
616
+ } else {
617
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
618
+ $stk = array(SERVICES_JSON_IN_OBJ);
619
+ $obj = array();
620
+ } else {
621
+ $stk = array(SERVICES_JSON_IN_OBJ);
622
+ $obj = new stdClass();
623
+ }
624
+ }
625
+
626
+ array_push($stk, array('what' => SERVICES_JSON_SLICE,
627
+ 'where' => 0,
628
+ 'delim' => false));
629
+
630
+ $chrs = substr($str, 1, -1);
631
+ $chrs = $this->reduce_string($chrs);
632
+
633
+ if ($chrs == '') {
634
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
635
+ return $arr;
636
+
637
+ } else {
638
+ return $obj;
639
+
640
+ }
641
+ }
642
+
643
+ //print("\nparsing {$chrs}\n");
644
+
645
+ $strlen_chrs = strlen($chrs);
646
+
647
+ for ($c = 0; $c <= $strlen_chrs; ++$c) {
648
+
649
+ $top = end($stk);
650
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
651
+
652
+ if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
653
+ // found a comma that is not inside a string, array, etc.,
654
+ // OR we've reached the end of the character list
655
+ $slice = substr($chrs, $top['where'], ($c - $top['where']));
656
+ array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
657
+ //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
658
+
659
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
660
+ // we are in an array, so just push an element onto the stack
661
+ array_push($arr, $this->decode($slice));
662
+
663
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
664
+ // we are in an object, so figure
665
+ // out the property name and set an
666
+ // element in an associative array,
667
+ // for now
668
+ $parts = array();
669
+
670
+ if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
671
+ // "name":value pair
672
+ $key = $this->decode($parts[1]);
673
+ $val = $this->decode($parts[2]);
674
+
675
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
676
+ $obj[$key] = $val;
677
+ } else {
678
+ $obj->$key = $val;
679
+ }
680
+ } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
681
+ // name:value pair, where name is unquoted
682
+ $key = $parts[1];
683
+ $val = $this->decode($parts[2]);
684
+
685
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
686
+ $obj[$key] = $val;
687
+ } else {
688
+ $obj->$key = $val;
689
+ }
690
+ }
691
+
692
+ }
693
+
694
+ } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
695
+ // found a quote, and we are not inside a string
696
+ array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
697
+ //print("Found start of string at {$c}\n");
698
+
699
+ } elseif (($chrs{$c} == $top['delim']) &&
700
+ ($top['what'] == SERVICES_JSON_IN_STR) &&
701
+ ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
702
+ // found a quote, we're in a string, and it's not escaped
703
+ // we know that it's not escaped becase there is _not_ an
704
+ // odd number of backslashes at the end of the string so far
705
+ array_pop($stk);
706
+ //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
707
+
708
+ } elseif (($chrs{$c} == '[') &&
709
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
710
+ // found a left-bracket, and we are in an array, object, or slice
711
+ array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
712
+ //print("Found start of array at {$c}\n");
713
+
714
+ } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
715
+ // found a right-bracket, and we're in an array
716
+ array_pop($stk);
717
+ //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
718
+
719
+ } elseif (($chrs{$c} == '{') &&
720
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
721
+ // found a left-brace, and we are in an array, object, or slice
722
+ array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
723
+ //print("Found start of object at {$c}\n");
724
+
725
+ } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
726
+ // found a right-brace, and we're in an object
727
+ array_pop($stk);
728
+ //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
729
+
730
+ } elseif (($substr_chrs_c_2 == '/*') &&
731
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
732
+ // found a comment start, and we are in an array, object, or slice
733
+ array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
734
+ $c++;
735
+ //print("Found start of comment at {$c}\n");
736
+
737
+ } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
738
+ // found a comment end, and we're in one now
739
+ array_pop($stk);
740
+ $c++;
741
+
742
+ for ($i = $top['where']; $i <= $c; ++$i)
743
+ $chrs = substr_replace($chrs, ' ', $i, 1);
744
+
745
+ //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
746
+
747
+ }
748
+
749
+ }
750
+
751
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
752
+ return $arr;
753
+
754
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
755
+ return $obj;
756
+
757
+ }
758
+
759
+ }
760
+ }
761
+ }
762
+
763
+ /**
764
+ * @todo Ultimately, this should just call PEAR::isError()
765
+ */
766
+ function isError($data, $code = null)
767
+ {
768
+ if (class_exists('pear')) {
769
+ return PEAR::isError($data, $code);
770
+ } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
771
+ is_subclass_of($data, 'services_json_error'))) {
772
+ return true;
773
+ }
774
+
775
+ return false;
776
+ }
777
+ }
778
+
779
+ if (class_exists('PEAR_Error')) {
780
+
781
+ class Services_JSON_Error extends PEAR_Error
782
+ {
783
+ function Services_JSON_Error($message = 'unknown error', $code = null,
784
+ $mode = null, $options = null, $userinfo = null)
785
+ {
786
+ parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
787
+ }
788
+ }
789
+
790
+ } else {
791
+
792
+ /**
793
+ * @todo Ultimately, this class shall be descended from PEAR_Error
794
+ */
795
+ class Services_JSON_Error
796
+ {
797
+ function Services_JSON_Error($message = 'unknown error', $code = null,
798
+ $mode = null, $options = null, $userinfo = null)
799
+ {
800
+
801
+ }
802
+ }
803
+
804
+ }
805
+
806
+ ?>
lib/json/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Redistribution and use in source and binary forms, with or without
2
+ modification, are permitted provided that the following conditions are
3
+ met:
4
+
5
+ Redistributions of source code must retain the above copyright notice,
6
+ this list of conditions and the following disclaimer.
7
+
8
+ Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+
12
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15
+ NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
16
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
lib/s3.php CHANGED
@@ -1964,3 +1964,4 @@ class mwpS3Exception extends Exception {
1964
  $this->line = $line;
1965
  }
1966
  }
 
1964
  $this->line = $line;
1965
  }
1966
  }
1967
+
link.class.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*************************************************************
3
  *
4
- * user.class.php
5
  *
6
- * Add Users
7
  *
8
  *
9
  * Copyright (c) 2011 Prelovac Media
@@ -19,7 +19,7 @@ class MMB_Link extends MMB_Core
19
 
20
  function add_link($args)
21
  {
22
- extract($args);
23
 
24
  $params['link_url'] = esc_html($url);
25
  $params['link_url'] = esc_url($params['link_url']);
@@ -37,6 +37,18 @@ class MMB_Link extends MMB_Core
37
  foreach($terms as $term){
38
  if(in_array($term->name,$link_category)){
39
  $params['link_category'][] = $term->term_id;
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
  }
42
  }
@@ -56,6 +68,113 @@ class MMB_Link extends MMB_Core
56
 
57
  return $is_success ? true : array('error' => 'Failed to add link.');
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  }
61
  ?>
1
  <?php
2
  /*************************************************************
3
  *
4
+ * link.class.php
5
  *
6
+ * Manage/Add Links
7
  *
8
  *
9
  * Copyright (c) 2011 Prelovac Media
19
 
20
  function add_link($args)
21
  {
22
+ extract($args);
23
 
24
  $params['link_url'] = esc_html($url);
25
  $params['link_url'] = esc_url($params['link_url']);
37
  foreach($terms as $term){
38
  if(in_array($term->name,$link_category)){
39
  $params['link_category'][] = $term->term_id;
40
+ $link_category = $this->remove_element($link_category, $term->name);
41
+ }
42
+ }
43
+ }
44
+ if(!empty($link_category)){
45
+ foreach($link_category as $linkkey => $linkval){
46
+ if(!empty($linkval)){
47
+ $link = wp_insert_term($linkval,'link_category');
48
+
49
+ if(isset($link['term_id']) && !empty($link['term_id'])){
50
+ $params['link_category'][] = $link['term_id'];
51
+ }
52
  }
53
  }
54
  }
68
 
69
  return $is_success ? true : array('error' => 'Failed to add link.');
70
  }
71
+
72
+ function remove_element($arr, $val){
73
+ foreach ($arr as $key => $value){
74
+ if ($value == $val){
75
+ unset($arr[$key]);
76
+ }
77
+ }
78
+ return $arr = array_values($arr);
79
+ }
80
+
81
+ function get_links($args){
82
+ global $wpdb;
83
+
84
+ $where='';
85
+ $this->_log('MORE BRE');
86
+ extract($args);
87
+
88
+ if(!empty($filter_links))
89
+ {
90
+ $where.=" AND (link_name LIKE '%".mysql_real_escape_string($filter_links)."%' OR link_url LIKE '%".mysql_real_escape_string($filter_links)."%')";
91
+ }
92
+
93
+ $linkcats = $this->getLinkCats();
94
+ $sql_query = "$wpdb->links WHERE 1=1 ".$where;
95
+
96
+ $links_total = $wpdb->get_results("SELECT count(*) as total_links FROM ".$sql_query);
97
+ $total=$links_total[0]->total_links;
98
+
99
+ $query_links = $wpdb->get_results("SELECT link_id, link_url, link_name, link_target, link_visible, link_rating, link_rel FROM ".$sql_query." ORDER BY link_name ASC LIMIT 250");
100
+ $links = array();
101
+ foreach ( $query_links as $link_info )
102
+ {
103
+ $link_cat = $linkcats[$link_info->link_id];
104
+ $cats = array();
105
+ foreach($link_cat as $catkey=>$catval)
106
+ {
107
+ $cats[] = $catval;
108
+ }
109
+
110
+ $links[$link_info->link_id] = array(
111
+ "link_url" => $link_info->link_url,
112
+ "link_name" => $link_info->link_name,
113
+ "link_target" => $link_info->link_target,
114
+ "link_visible" => $link_info->link_visible,
115
+ "link_rating" => $link_info->link_rating,
116
+ "link_rel" => $link_info->link_rel,
117
+ "link_cats" => $cats
118
+ );
119
+ }
120
+
121
+ return array('links' => $links, 'total' => $total);
122
+ }
123
+
124
+ function getLinkCats($taxonomy = 'link_category')
125
+ {
126
+ global $wpdb;
127
+
128
+ $cats = $wpdb->get_results("SELECT l.link_id, $wpdb->terms.name
129
+ FROM $wpdb->links AS l
130
+ INNER JOIN $wpdb->term_relationships ON ( l.link_id = $wpdb->term_relationships.object_id )
131
+ INNER JOIN $wpdb->term_taxonomy ON ( $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id
132
+ AND $wpdb->term_taxonomy.taxonomy = '".$taxonomy."' )
133
+ INNER JOIN $wpdb->terms ON ( $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id )");
134
+
135
+ foreach ( $cats as $post_val )
136
+ {
137
+
138
+ $post_cats[$post_val->link_id][] = $post_val->name;
139
+ }
140
+
141
+ return $post_cats;
142
+ }
143
+
144
+ function delete_link($args){
145
+ global $wpdb;
146
+
147
+ if(!empty($args['link_id']))
148
+ {
149
+ $delete_query = "DELETE FROM $wpdb->links WHERE link_id = ".$args['link_id'];
150
+ $wpdb->get_results($delete_query);
151
+
152
+ return 'Link deleted.';
153
+ }
154
+ else
155
+ {
156
+ return 'No ID...';
157
+ }
158
+ }
159
+
160
+ function delete_links($args){
161
+ global $wpdb;
162
+ extract($args);
163
+
164
+ if($deleteaction=='delete'){
165
+ $delete_query_intro = "DELETE FROM $wpdb->links WHERE link_id = ";
166
+ }
167
+ foreach($args as $key=>$val){
168
+
169
+ if(!empty($val) && is_numeric($val))
170
+ {
171
+ $delete_query = $delete_query_intro.$val;
172
+
173
+ $wpdb->query($delete_query);
174
+ }
175
+ }
176
+ return "Link deleted";
177
+ }
178
 
179
  }
180
  ?>
plugins/cleanup/cleanup.php CHANGED
@@ -15,7 +15,10 @@ add_filter('mmb_stats_filter', 'mmb_get_extended_info');
15
 
16
  function mmb_get_extended_info($stats)
17
  {
18
- $stats['num_revisions'] = mmb_num_revisions();
 
 
 
19
  //$stats['num_revisions'] = 5;
20
  $stats['overhead'] = mmb_handle_overhead(false);
21
  $stats['num_spam_comments'] = mmb_num_spam_comments();
@@ -29,13 +32,16 @@ mmb_add_action('cleanup_delete', 'cleanup_delete_worker');
29
  function cleanup_delete_worker($params = array())
30
  {
31
  global $mmb_core;
32
-
 
 
33
  $params_array = explode('_', $params['actions']);
34
  $return_array = array();
 
35
  foreach ($params_array as $param) {
36
  switch ($param) {
37
  case 'revision':
38
- if (mmb_delete_all_revisions()) {
39
  $return_array['revision'] = 'OK';
40
  } else {
41
  $return_array['revision_error'] = 'Failed, please try again';
@@ -66,12 +72,20 @@ function cleanup_delete_worker($params = array())
66
  mmb_response($return_array, true);
67
  }
68
 
69
- function mmb_num_revisions()
70
  {
71
  global $wpdb;
72
  $sql = "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'revision'";
73
  $num_revisions = $wpdb->get_var($wpdb->prepare($sql));
74
- return $num_revisions;
 
 
 
 
 
 
 
 
75
  }
76
 
77
  function mmb_select_all_revisions()
@@ -82,11 +96,29 @@ function mmb_select_all_revisions()
82
  return $revisions;
83
  }
84
 
85
- function mmb_delete_all_revisions()
86
  {
87
- global $wpdb;
88
- $sql = "DELETE a,b,c FROM $wpdb->posts a LEFT JOIN $wpdb->term_relationships b ON (a.ID = b.object_id) LEFT JOIN $wpdb->postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision'";
89
- $revisions = $wpdb->query($wpdb->prepare($sql));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  return $revisions;
92
  }
@@ -185,5 +217,4 @@ function mmb_get_spam_comments()
185
  $spams = $wpdb->get_results($wpdb->prepare($sql));
186
  return $spams;
187
  }
188
-
189
  ?>
15
 
16
  function mmb_get_extended_info($stats)
17
  {
18
+ global $mmb_core;
19
+ $params = get_option('mmb_stats_filter');
20
+ $filter = isset($params['plugins']['cleanup']) ? $params['plugins']['cleanup'] : array();
21
+ $stats['num_revisions'] = mmb_num_revisions($filter['revisions']);
22
  //$stats['num_revisions'] = 5;
23
  $stats['overhead'] = mmb_handle_overhead(false);
24
  $stats['num_spam_comments'] = mmb_num_spam_comments();
32
  function cleanup_delete_worker($params = array())
33
  {
34
  global $mmb_core;
35
+ $revision_params = get_option('mmb_stats_filter');
36
+ $revision_filter = isset($revision_params['plugins']['cleanup']) ? $revision_params['plugins']['cleanup'] : array();
37
+
38
  $params_array = explode('_', $params['actions']);
39
  $return_array = array();
40
+
41
  foreach ($params_array as $param) {
42
  switch ($param) {
43
  case 'revision':
44
+ if (mmb_delete_all_revisions($revision_filter['revisions'])) {
45
  $return_array['revision'] = 'OK';
46
  } else {
47
  $return_array['revision_error'] = 'Failed, please try again';
72
  mmb_response($return_array, true);
73
  }
74
 
75
+ function mmb_num_revisions($filter)
76
  {
77
  global $wpdb;
78
  $sql = "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'revision'";
79
  $num_revisions = $wpdb->get_var($wpdb->prepare($sql));
80
+ if(isset($filter['num_to_keep']) && !empty($filter['num_to_keep'])){
81
+ $num_rev = str_replace("r_","",$filter['num_to_keep']);
82
+ if($num_revisions < $num_rev){
83
+ return 0;
84
+ }
85
+ return ($num_revisions - $num_rev);
86
+ }else{
87
+ return $num_revisions;
88
+ }
89
  }
90
 
91
  function mmb_select_all_revisions()
96
  return $revisions;
97
  }
98
 
99
+ function mmb_delete_all_revisions($filter)
100
  {
101
+ global $wpdb, $mmb_core;
102
+ $where = '';
103
+ if(isset($filter['num_to_keep']) && !empty($filter['num_to_keep'])){
104
+ $num_rev = str_replace("r_","",$filter['num_to_keep']);
105
+ $select_posts = "SELECT ID FROM $wpdb->posts WHERE post_type = 'revision' ORDER BY post_date DESC LIMIT ".$num_rev;
106
+ $select_posts_res = $wpdb->get_results($select_posts);
107
+ $notin = '';
108
+ $n = 0;
109
+ foreach($select_posts_res as $keep_post){
110
+ $notin.=$keep_post->ID;
111
+ $n++;
112
+ if(count($select_posts_res)>$n){
113
+ $notin.=',';
114
+ }
115
+ }
116
+ $where = " AND a.ID NOT IN (".$notin.")";
117
+ }
118
+
119
+ $sql = "DELETE a,b,c FROM $wpdb->posts a LEFT JOIN $wpdb->term_relationships b ON (a.ID = b.object_id) LEFT JOIN $wpdb->postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision'".$where;
120
+
121
+ $revisions = $wpdb->query($wpdb->prepare($sql));
122
 
123
  return $revisions;
124
  }
217
  $spams = $wpdb->get_results($wpdb->prepare($sql));
218
  return $spams;
219
  }
 
220
  ?>
post.class.php CHANGED
@@ -20,6 +20,9 @@ class MMB_Post extends MMB_Core
20
  function create($args)
21
  {
22
 
 
 
 
23
  /**
24
  * algorithm
25
  * 1. create post using wp_insert_post (insert tags also here itself)
@@ -276,8 +279,50 @@ class MMB_Post extends MMB_Core
276
  if($user && $user->ID){
277
  $post_data['post_author'] = $user->ID;
278
  }
 
279
  remove_filter('content_save_pre', 'wp_filter_post_kses');
280
- $post_id = wp_insert_post($post_data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
  if (count($attachments)) {
283
  foreach ($attachments as $atta_id => $featured_id) {
@@ -486,6 +531,27 @@ class MMB_Post extends MMB_Core
486
  }
487
  }
488
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489
  function get_pages($args){
490
  global $wpdb;
491
 
@@ -589,7 +655,7 @@ FROM $wpdb->posts AS p
589
  INNER JOIN $wpdb->term_relationships ON ( p.ID = $wpdb->term_relationships.object_id )
590
  INNER JOIN $wpdb->term_taxonomy ON ( $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id
591
  AND $wpdb->term_taxonomy.taxonomy = '".$taxonomy."' )
592
- INNER JOIN $wpdb->terms ON ( $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->terms.term_id )");
593
 
594
  foreach ( $cats as $post_val )
595
  {
20
  function create($args)
21
  {
22
 
23
+ $this->_log($args);
24
+ global $wpdb;
25
+
26
  /**
27
  * algorithm
28
  * 1. create post using wp_insert_post (insert tags also here itself)
279
  if($user && $user->ID){
280
  $post_data['post_author'] = $user->ID;
281
  }
282
+ //remove filter which can brake scripts or html
283
  remove_filter('content_save_pre', 'wp_filter_post_kses');
284
+
285
+ //check for edit post
286
+ $post_result = 0;
287
+ if(isset($post_data['mwp_post_edit']) && $post_data['mwp_post_edit']){
288
+
289
+
290
+ if($post_data['mwp_match_by'] == 'title'){
291
+ $match_by = "post_title = '".$post_data['post_title']."'";
292
+ } else {
293
+ $match_by = "post_name = '".$post_data['post_name']."'";
294
+ }
295
+
296
+ $query = "SELECT ID FROM $wpdb->posts WHERE $match_by AND post_status NOT IN('inherit','auto-draft','draft') LIMIT 1";
297
+
298
+ $post_result = $wpdb->get_var($query);
299
+
300
+ }
301
+
302
+
303
+ if($post_result){
304
+ //update existing post
305
+ $post_data['ID'] = $post_result;
306
+ $post_id = wp_update_post($post_data);
307
+
308
+ //check for previous attachments
309
+ $atta_allimages =& get_children('post_type=attachment&post_parent=' . $post_id);
310
+ if (!empty($atta_allimages)) {
311
+ foreach ($atta_allimages as $image) {
312
+ wp_delete_attachment($image->ID);
313
+ }
314
+ }
315
+
316
+ } else {
317
+ if($post_data['mwp_post_edit'] && $post_data['mwp_force_publish']){
318
+ $post_id = wp_insert_post($post_data);
319
+ } elseif($post_data['mwp_post_edit'] && !$post_data['mwp_force_publish']) {
320
+ return array('error' => "Post not found.");
321
+ } else {
322
+ $post_id = wp_insert_post($post_data);
323
+ }
324
+
325
+ }
326
 
327
  if (count($attachments)) {
328
  foreach ($attachments as $atta_id => $featured_id) {
531
  }
532
  }
533
 
534
+ function delete_posts($args){
535
+ global $wpdb;
536
+ extract($args);
537
+ if($deleteaction=='delete'){
538
+ $delete_query_intro = "DELETE FROM $wpdb->posts WHERE ID = ";
539
+ }elseif($deleteaction=='trash'){
540
+ $delete_query_intro = "UPDATE $wpdb->posts SET post_status = 'trash' WHERE ID = ";
541
+ }
542
+ foreach($args as $key=>$val){
543
+
544
+ if(!empty($val) && is_numeric($val))
545
+ {
546
+ $delete_query = $delete_query_intro.$val;
547
+
548
+ $wpdb->query($delete_query);
549
+ }
550
+ }
551
+ return "Post deleted";
552
+
553
+ }
554
+
555
  function get_pages($args){
556
  global $wpdb;
557
 
655
  INNER JOIN $wpdb->term_relationships ON ( p.ID = $wpdb->term_relationships.object_id )
656
  INNER JOIN $wpdb->term_taxonomy ON ( $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id
657
  AND $wpdb->term_taxonomy.taxonomy = '".$taxonomy."' )
658
+ INNER JOIN $wpdb->terms ON ( $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id )");
659
 
660
  foreach ( $cats as $post_val )
661
  {
readme.txt CHANGED
@@ -1,3 +1,4 @@
 
1
  === ManageWP Worker ===
2
  Contributors: freediver
3
  Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
@@ -34,6 +35,259 @@ Check out [ManageWP.com](http://managewp.com/ "Manage Multiple Blogs").
34
 
35
  == Changelog ==
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  = 3.9.17 =
38
  * New: Add your favorite sites to the Favorites bar (just drag&drop them to the small heart on the top)
39
  * New: Entirely new website menu loaded with features and tools
@@ -226,4 +480,5 @@ Make sure you use the latest version of the worker plugin on the site you are tr
226
 
227
  = I have problems installing new plugins or upgrading WordPress through ManageWP =
228
 
 
229
  ManageWP Worker relies on properly set file permissions on your server. See the [user guide](http://managewp.com/user-guide#ftp "ManageWP user guide") for more tips.
1
+ <<<<<<< HEAD
2
  === ManageWP Worker ===
3
  Contributors: freediver
4
  Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
35
 
36
  == Changelog ==
37
 
38
+ = 3.9.18 =
39
+ * New: Pagelines themes added to the list of partners
40
+ * New: Comprehensive website performance scan tool
41
+ * New: You can now bulk edit posts/pages (updating that contact info will become piece of cake)
42
+ * New: Upload and save your premium plugins/themes in your personal repository for quick installation
43
+ * New: Run code snippets now get a repository. Save your snippets and share them with other users
44
+ * New: SEO reports can now be sorted. Export as CSV and PDF reports.
45
+ * New: Manage Blogroll links
46
+ * New: Clean post revisions now has an option to save last x revisions when cleaning
47
+ * New: Bulk delete na posts/pages/links
48
+ * Fix: Amazon S3 backups failing
49
+
50
+ = 3.9.17 =
51
+ * New: Add your favorite sites to the Favorites bar (just drag&drop them to the small heart on the top)
52
+ * New: Entirely new website menu loaded with features and tools
53
+ * New: Manage Posts and Pages across all sites in a more efficient way
54
+ * New: Support for all WPMU.org premium plugin updates
55
+ * New: Complete Dropbox integration through Oauth which allows us to restore/delete Dropbox backups directly
56
+ * New: We have the user guide as PDF now. [Download] (http://managewp.com/files/ManageWP_User_Guide.zip)
57
+
58
+
59
+ = 3.9.16 =
60
+ * New: Option to "Run now" backup tasks
61
+ * New: Traffic alerts functionality
62
+ * New: Support for Genesis premium theme updates
63
+ * Fix: In some circutmsances .htaccess was not correctly zipped in the backup archive
64
+
65
+ = 3.9.15 =
66
+ * New: Full range of SEO Statistics now trackable for your websites (Google Page Rank and Page Speed, Backlinks and 20+ more)
67
+ * New: Google keyword rank tracking with history
68
+ * New: Uptime monitoring (5 min interval with email/SMS notification)
69
+ * New: Insights into server PHP error logs right in your dashboard
70
+ * New: Remote maintenance mode for your websites
71
+ * Fix: A bug when a completed backup was reported as failed
72
+
73
+ = 3.9.14 =
74
+ * Two factor authentication
75
+ * Run code tool
76
+ * Quick access to security check and broken link tools
77
+ * More accurate pageview statistics
78
+ * You can now opt to completely hide the Worker plugin from the list of plugins (part of Worker branding features)
79
+ * We improved the backups for folks running Windows servers
80
+ * Amazon S3 directory name now "ManageWP" by default
81
+ * Read more on ManageWP.com http://managewp.com/update-two-factor-authentication-run-code-tool-sucuri-security-check-more-accurate-pageview-statistics
82
+
83
+ = 3.9.13 =
84
+ * Added bucket location for Amazon S3 backups
85
+ * Better backup feature for larger sites
86
+ * Added Disable compression to further help with larger sites
87
+ * Backing up wp-admin, wp-includes and wp-content by default now, other folders can be included manually
88
+
89
+ = 3.9.12 =
90
+ * Minor bug fixes
91
+ * Backup, clone, favorites functionality improved
92
+
93
+ = 3.9.10 =
94
+ * Supporting updates for more premium plugins/themes
95
+ * Backup notifications (users can now get notices when the backup succeeds or fails)
96
+ * Support for WordPress 3.3
97
+ * Worker Branding (useful for web agencies, add your own Name/Description)
98
+ * Manage Groups screen
99
+ * Specify wp-admin path if your site uses a custom one
100
+ * Amazon S3 backups support for mixed case bucket names
101
+ * Bulk Add Links has additional options
102
+ * Better Multisite support
103
+ * Option to set the number of items for Google Analytics
104
+ * ManageWP backup folder changed to wp-content/managewp/backups
105
+
106
+ = 3.9.9 =
107
+ * New widget on the dashboard - Backup status
108
+ * New screen for managing plugins and themes (activate, deactivate, delete, add to favorites, install) across all sites
109
+ * New screen for managing users (change role or password, delete user) across all sites
110
+ * Option to overwrite old plugins and themes during bulk installation
111
+ * Your website admin now loads faster in ManageWP
112
+ * Added API for premium theme and plugin updates
113
+
114
+ = 3.9.8 =
115
+ * Conversion goals integration
116
+ * Update notifications
117
+ * Enhanced security for your account
118
+ * Better backups
119
+ * Better update interface
120
+ * [Full changelog](http://managewp.com/update-goals-and-adsense-analytics-integration-update-notifications-login-by-ip-better-backups "Full changelog")
121
+
122
+ = 3.9.7 =
123
+ * Fixed problem with cron schedules
124
+
125
+ = 3.9.6 =
126
+ * Improved dashboard performance
127
+ * Fixed bug with W3TC, we hope it is fully comptabile now
128
+ * Improved backup feature
129
+ * Various other fixes and improvements
130
+
131
+ = 3.9.5 =
132
+ * Now supporting scheduled backups to Amazon S3 and Dropbox
133
+ * Revamped cloning procedure
134
+ * You can now have sites in different colors
135
+ * W3 Total Cache comptability improved
136
+
137
+ = 3.9.3 =
138
+ * Included support for WordPress 3.2 partial updates
139
+
140
+ = 3.9.2 =
141
+ * Fixed problem with full backups
142
+ * Fixed problem with wordpress dev version upgrades
143
+
144
+ = 3.9.1 =
145
+ * Support for sub-users (limited access users)
146
+ * Bulk add user
147
+ * 'Select all' feature for bulk posting
148
+ * Featured image support for bulk posting
149
+ * Reload button on the dashboard (on the top of the Right now widget) will now refresh information about available updates
150
+ * Fixed a problem with the import tool
151
+ * Fixed a problem when remote dashboard would not work for some servers
152
+
153
+ = 3.9.0 =
154
+ * New feature: Up to 50% faster dashboard loading
155
+ * New feature: You can now ignore WordPress/plugin/theme updates
156
+ * New feature: Setting 'Show favicon' for websites in the dashboad
157
+ * New feature: Full backups now include WordPress and other folders in the root of the site
158
+ * Fixed: Bug with W3 TotalCache object cache causing weird behaviour in the dashboard
159
+ * Fixed: All groups now show when adding a site
160
+
161
+ = 3.8.8 =
162
+ * New feature: Bulk add links to blogroll
163
+ * New feature: Manual backups to email address
164
+ * New feature: Backup requirements check (under �Manage Backups�)
165
+ * New feature: Popup menu for groups allowing to show dashboard for that group only
166
+ * New feature: Favorite list for plugins and themes for later quick installation to multiple blogs
167
+ * New feature: Invite friends
168
+ * Fixed: problem with backups and write permissions when upload dir was wrongly set
169
+ * Fixed: problem adding sites where WordPress is installed in a folder
170
+ * Fixed: 408 error message problem when adding site
171
+ * Fixed: site time out problems when adding site
172
+ * Fixed: problems with some WP plugins (WP Sentinel)
173
+ * Fixed: problems with upgrade notifications
174
+
175
+ = 3.8.7 =
176
+ * Fixed 408 error when adding sites
177
+ * Added support for IDN domains
178
+ * Fixed bug with WordPress updates
179
+ * Added comment moderation to the dashboard
180
+ * Added quick links for sites (menu appears on hover)
181
+
182
+
183
+ = 3.8.6 =
184
+ * Added seach websites feature
185
+ * Enhanced dashboard actions (spam comments, post revisions, table overhead)
186
+ * Added developer [API] (http://managewp.com/api "ManageWP API")
187
+ * Improved Migrate/Clone site feature
188
+
189
+ = 3.8.4 =
190
+ * Fixed remote dashboard problems for sites with redirects
191
+ * Fixed IE7 issues in the dashboard
192
+
193
+ = 3.8.3 =
194
+ * Fixed problem with capabilities
195
+
196
+ = 3.8.2 =
197
+ * New interface
198
+ * SSL security protocol
199
+ * No passwords required
200
+ * Improved clone/backup
201
+
202
+
203
+ = 3.6.3 =
204
+ * Initial public release
205
+
206
+ == Installation ==
207
+
208
+ 1. Upload the plugin folder to your /wp-content/plugins/ folder
209
+ 2. Go to the Plugins page and activate ManageWP Worker
210
+ 3. Visit [ManageWP.com](http://managewp.com/ "Manage Multiple Blogs"), sign up and add your site
211
+
212
+ Alternately
213
+
214
+ 1. Visit [ManageWP.com](http://managewp.com/ "Manage Multiple Blogs"), sign up and add your site
215
+ 2. ManageWP will warn you the worker plugin is not installed and offer a link for quick installation
216
+
217
+ == Screenshots ==
218
+
219
+ 1. ManageWP dashboard with available upgrades, site statistics and management functions
220
+
221
+
222
+
223
+ == License ==
224
+
225
+ This file is part of ManageWP Worker.
226
+
227
+ ManageWP Worker is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
228
+
229
+ ManageWP Worker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
230
+
231
+ You should have received a copy of the GNU General Public License along with ManageWP Worker. If not, see <http://www.gnu.org/licenses/>.
232
+
233
+
234
+ == Frequently Asked Questions ==
235
+
236
+ = I have problems adding my site =
237
+
238
+ Make sure you use the latest version of the worker plugin on the site you are trying to add. If you do, sometimes deactivating and activating it again will help. If you still have problems, [contact us](http://managewp.com/contact "ManageWP Contact").
239
+
240
+ = I have problems installing new plugins or upgrading WordPress through ManageWP =
241
+
242
+ =======
243
+ === ManageWP Worker ===
244
+ Contributors: freediver
245
+ Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
246
+ Tags: admin, administration, amazon, api, authentication, automatic, dashboard, dropbox, events, integration, manage, multsite, notification, performance, s3, security, seo, stats, tracking, managewp
247
+ Requires at least: 3.0
248
+ Tested up to: 3.3.1
249
+ Stable tag: trunk
250
+
251
+ ManageWP Worker plugin allows you to remotely manage your WordPress sites from one dashboard.
252
+
253
+ == Description ==
254
+
255
+ [ManageWP](http://managewp.com/ "Manage Multiple Blogs") is a revolutionary plugin that helps users manage multiple WordPress blogs from one dashboard.
256
+
257
+ Main features:
258
+
259
+ * Secure and fast solution for managing your WordPress sites
260
+ * One click upgrades for WordPress, plugin and themes across all your sites
261
+ * Schedule automatic backups of your websites (Amazon S3 and Dropbox supported)
262
+ * One click to access WP admin of any site
263
+ * Install WordPress, clone or migrate a website to another domain
264
+ * Bulk install themes and plugins to multiple sites at once
265
+ * Add sub-users (writers, staff..) to your account
266
+ * Bulk publish posts to multiple sites at once
267
+ * SEO Statistics, track your keyword rankings
268
+ * Uptime monitoring
269
+ * Much, much more...
270
+
271
+ Check out the [ManageWP Tour video](http://vimeo.com/22099014).
272
+
273
+ http://vimeo.com/22099014
274
+
275
+ Check out [ManageWP.com](http://managewp.com/ "Manage Multiple Blogs").
276
+
277
+ == Changelog ==
278
+
279
+ = 3.9.18 =
280
+ * New: Pagelines themes added to the list of partners
281
+ * New: Comprehensive website performance scan tool
282
+ * New: You can now bulk edit posts/pages (updating that contact info will become piece of cake)
283
+ * New: Upload and save your premium plugins/themes in your personal repository for quick installation
284
+ * New: Run code snippets now get a repository. Save your snippets and share them with other users
285
+ * New: SEO reports can now be sorted. Export as CSV and PDF reports.
286
+ * New: Manage Blogroll links
287
+ * New: Clean post revisions now has an option to save last x revisions when cleaning
288
+ * New: Bulk delete na posts/pages/links
289
+ * Fix: Amazon S3 backups failing
290
+
291
  = 3.9.17 =
292
  * New: Add your favorite sites to the Favorites bar (just drag&drop them to the small heart on the top)
293
  * New: Entirely new website menu loaded with features and tools
480
 
481
  = I have problems installing new plugins or upgrading WordPress through ManageWP =
482
 
483
+ >>>>>>> c714220db0d07713702e27fab761916ceaa95762
484
  ManageWP Worker relies on properly set file permissions on your server. See the [user guide](http://managewp.com/user-guide#ftp "ManageWP user guide") for more tips.
stats.class.php CHANGED
@@ -387,7 +387,7 @@ class MMB_Stats extends MMB_Core
387
  function get($params)
388
  {
389
  global $wpdb, $mmb_wp_version, $mmb_plugin_dir, $_mmb_item_filter;
390
-
391
  include_once(ABSPATH . 'wp-includes/update.php');
392
  include_once(ABSPATH . '/wp-admin/includes/update.php');
393
 
@@ -413,8 +413,9 @@ class MMB_Stats extends MMB_Core
413
  if ($this->mmb_multisite) {
414
  $stats = $this->get_multisite($stats);
415
  }
416
-
417
- $stats = apply_filters('mmb_stats_filter', $stats);
 
418
  return $stats;
419
  }
420
 
@@ -756,9 +757,24 @@ class MMB_Stats extends MMB_Core
756
  }
757
 
758
  function set_alerts($args){
759
- extract($args);
760
  update_option('mwp_pageview_alerts',array('site_id' => $site_id,'alert' => $alert,'url' => $url));
761
  }
762
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763
  }
764
  ?>
387
  function get($params)
388
  {
389
  global $wpdb, $mmb_wp_version, $mmb_plugin_dir, $_mmb_item_filter;
390
+
391
  include_once(ABSPATH . 'wp-includes/update.php');
392
  include_once(ABSPATH . '/wp-admin/includes/update.php');
393
 
413
  if ($this->mmb_multisite) {
414
  $stats = $this->get_multisite($stats);
415
  }
416
+
417
+ update_option('mmb_stats_filter', $params['item_filter']['get_stats']);
418
+ $stats = apply_filters('mmb_stats_filter', $stats);
419
  return $stats;
420
  }
421
 
757
  }
758
 
759
  function set_alerts($args){
760
+ extract($args);
761
  update_option('mwp_pageview_alerts',array('site_id' => $site_id,'alert' => $alert,'url' => $url));
762
  }
763
 
764
+ public static function readd_alerts( $params = array() ){
765
+ if( empty($params) || !isset($params['alerts']))
766
+ return $params;
767
+
768
+ if( !empty($params['alerts']) ){
769
+ update_option('mwp_pageview_alerts', $params['alerts']);
770
+ unset($params['alerts']);
771
+ }
772
+
773
+ return $params;
774
+ }
775
+ }
776
+
777
+ if( function_exists('add_filter') ){
778
+ add_filter( 'mwp_website_add', 'MMB_Stats::readd_alerts' );
779
  }
780
  ?>
version CHANGED
@@ -1 +1 @@
1
- 3.9.17
1
+ 3.9.18
widget.class.php CHANGED
@@ -48,5 +48,4 @@ if(is_array($mwp_worker_brand)){
48
  if(!$worker_brand){
49
  add_action('widgets_init', create_function('', 'return register_widget("ManageWP_Widget");'));
50
  }
51
-
52
  ?>
48
  if(!$worker_brand){
49
  add_action('widgets_init', create_function('', 'return register_widget("ManageWP_Widget");'));
50
  }
 
51
  ?>