ManageWP Worker - Version 3.9.12

Version Description

  • Minor bug fixes
  • Backup, clone, favorites functionality improved
Download this release

Release Info

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

Code changes from version 3.9.11 to 3.9.12

Files changed (6) hide show
  1. backup.class.php +44 -18
  2. core.class.php +31 -12
  3. helper.class.php +0 -4
  4. init.php +2 -2
  5. readme.txt +2 -1
  6. version +1 -1
backup.class.php CHANGED
@@ -598,7 +598,7 @@ class MMB_Backup extends MMB_Core
598
 
599
  function restore($args)
600
  {
601
-
602
  global $wpdb;
603
  if (empty($args)) {
604
  return false;
@@ -668,7 +668,7 @@ class MMB_Backup extends MMB_Core
668
  $home = rtrim(get_option('home'),"/");
669
  $site_url = get_option('site_url');
670
 
671
- if(trim($clone_from_url)){
672
  $clone_options = array();
673
  $clone_options['_worker_nossl_key'] = get_option('_worker_nossl_key');
674
  $clone_options['_worker_public_key'] = get_option('_worker_public_key');
@@ -724,7 +724,6 @@ class MMB_Backup extends MMB_Core
724
  $new_table_prefix = trim($this->get_table_prefix());
725
  //Retrieve old wp_config
726
  @unlink(ABSPATH . 'wp-config.php');
727
-
728
  //Replace table prefix
729
  $lines = file(ABSPATH . 'mwp-temp-wp-config.php');
730
 
@@ -748,27 +747,56 @@ class MMB_Backup extends MMB_Core
748
  //Replace content urls
749
  $query = "UPDATE " . $new_table_prefix . "posts SET post_content = REPLACE (post_content, '$old','$home') WHERE post_content REGEXP 'src=\"(.*)$old(.*)\"' OR post_content REGEXP 'href=\"(.*)$old(.*)\"'";
750
  $wpdb->query($wpdb->prepare($query));
751
- if($new_user && $new_password){
752
- $new_password = wp_hash_password($new_password);
 
 
 
 
 
753
  $query = "UPDATE " . $new_table_prefix . "users SET user_login = '$new_user', user_pass = '$new_password' WHERE user_login = '$old_user'";
754
  $wpdb->query($wpdb->prepare($query));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755
  }
756
 
757
  if(is_array($clone_options)){
758
 
759
  foreach($clone_options as $key => $option){
760
  if(!empty($key)){
761
- $query = "UPDATE " . $new_table_prefix . "options SET option_value = '$option' WHERE option_name = '$key'";
762
-
763
- $wpdb->query($wpdb->prepare($query));
 
 
 
 
 
 
764
  }
765
  }
766
  }
767
- $clone_options['_worker_nossl_key'] = get_option('_worker_nossl_key');
768
- $clone_options['_worker_public_key'] = get_option('_worker_public_key');
769
- $clone_options['_action_message_id'] = get_option('_action_message_id');
770
-
771
-
772
  }
773
 
774
  return true;
@@ -781,17 +809,14 @@ class MMB_Backup extends MMB_Core
781
  $file_path = ABSPATH . 'mwp_db';
782
  $file_name = glob($file_path . '/*.sql');
783
  $file_name = $file_name[0];
784
-
785
-
786
- $brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
787
  $command = $brace .$paths['mysql'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" ' . DB_NAME . ' < ' . $brace . $file_name . $brace;
788
-
789
  ob_start();
790
  $result = $this->mmb_exec($command);
791
  ob_get_clean();
792
  if (!$result) {
793
  //try php
794
-
795
  $this->restore_db_php($file_name);
796
  }
797
 
@@ -1624,6 +1649,7 @@ class MMB_Backup extends MMB_Core
1624
  $tasks = $this->get_backup_settings();
1625
  unset($tasks[$args['task_name']]);
1626
  update_option('mwp_backup_tasks',$tasks);
 
1627
  exit;
1628
  }
1629
  }
598
 
599
  function restore($args)
600
  {
601
+
602
  global $wpdb;
603
  if (empty($args)) {
604
  return false;
668
  $home = rtrim(get_option('home'),"/");
669
  $site_url = get_option('site_url');
670
 
671
+ if(trim($clone_from_url) || trim($mwp_clone)){
672
  $clone_options = array();
673
  $clone_options['_worker_nossl_key'] = get_option('_worker_nossl_key');
674
  $clone_options['_worker_public_key'] = get_option('_worker_public_key');
724
  $new_table_prefix = trim($this->get_table_prefix());
725
  //Retrieve old wp_config
726
  @unlink(ABSPATH . 'wp-config.php');
 
727
  //Replace table prefix
728
  $lines = file(ABSPATH . 'mwp-temp-wp-config.php');
729
 
747
  //Replace content urls
748
  $query = "UPDATE " . $new_table_prefix . "posts SET post_content = REPLACE (post_content, '$old','$home') WHERE post_content REGEXP 'src=\"(.*)$old(.*)\"' OR post_content REGEXP 'href=\"(.*)$old(.*)\"'";
749
  $wpdb->query($wpdb->prepare($query));
750
+
751
+ if(trim($new_password)) {
752
+ $new_password = wp_hash_password($new_password);
753
+ }
754
+ if(!trim($clone_from_url) && !trim($mwp_clone)){
755
+ if($new_user && $new_password){
756
+
757
  $query = "UPDATE " . $new_table_prefix . "users SET user_login = '$new_user', user_pass = '$new_password' WHERE user_login = '$old_user'";
758
  $wpdb->query($wpdb->prepare($query));
759
+ }
760
+ } else {
761
+
762
+ if($clone_from_url){
763
+ if($new_user && $new_password){
764
+ $query = "UPDATE " . $new_table_prefix . "users SET user_pass = '$new_password' WHERE user_login = '$new_user'";
765
+ $wpdb->query($wpdb->prepare($query));
766
+ }
767
+ }
768
+
769
+ if($mwp_clone){
770
+ if($admin_email){
771
+ //Clean Install
772
+ $query = "UPDATE " . $new_table_prefix . "options SET option_value = '$admin_email' WHERE option_name = 'admin_email'";
773
+ $wpdb->query($wpdb->prepare($query));
774
+ $query = "SELECT * FROM " . $new_table_prefix ."users LIMIT 1";
775
+ $temp_user = $wpdb->get_row($query);
776
+ if(!empty($temp_user)){
777
+ $query = "UPDATE " . $new_table_prefix . "users SET user_email='$admin_email', user_login = '$new_user', user_pass = '$new_password' WHERE user_login = '$temp_user->user_login'";
778
+ $wpdb->query($wpdb->prepare($query));
779
+ }
780
+ }
781
+ }
782
  }
783
 
784
  if(is_array($clone_options)){
785
 
786
  foreach($clone_options as $key => $option){
787
  if(!empty($key)){
788
+ $query = "SELECT option_value FROM " . $new_table_prefix . "options WHERE option_name = '$key'";
789
+ $res = $wpdb->get_var($query);
790
+ if($res == false){
791
+ $query = "INSERT INTO " . $new_table_prefix . "options (option_value,option_name) VALUES('$option','$key')";
792
+ $wpdb->query($wpdb->prepare($query));
793
+ } else {
794
+ $query = "UPDATE " . $new_table_prefix . "options SET option_value = '$option' WHERE option_name = '$key'";
795
+ $wpdb->query($wpdb->prepare($query));
796
+ }
797
  }
798
  }
799
  }
 
 
 
 
 
800
  }
801
 
802
  return true;
809
  $file_path = ABSPATH . 'mwp_db';
810
  $file_name = glob($file_path . '/*.sql');
811
  $file_name = $file_name[0];
812
+ $brace = (substr(PHP_OS, 0, 3) == 'WIN') ? '"' : '';
 
 
813
  $command = $brace .$paths['mysql'] . $brace . ' --host="' . DB_HOST . '" --user="' . DB_USER . '" --password="' . DB_PASSWORD . '" ' . DB_NAME . ' < ' . $brace . $file_name . $brace;
814
+
815
  ob_start();
816
  $result = $this->mmb_exec($command);
817
  ob_get_clean();
818
  if (!$result) {
819
  //try php
 
820
  $this->restore_db_php($file_name);
821
  }
822
 
1649
  $tasks = $this->get_backup_settings();
1650
  unset($tasks[$args['task_name']]);
1651
  update_option('mwp_backup_tasks',$tasks);
1652
+ $this->cleanup();
1653
  exit;
1654
  }
1655
  }
core.class.php CHANGED
@@ -130,6 +130,8 @@ class MMB_Core extends MMB_Helper
130
  add_action('admin_init', array($this,'admin_actions'));
131
  add_action('init', array( &$this, 'mmb_remote_action'), 9999);
132
  add_action('setup_theme', 'mmb_parse_request');
 
 
133
  }
134
 
135
  function mmb_remote_action(){
@@ -181,7 +183,7 @@ class MMB_Core extends MMB_Helper
181
  function network_admin_notice()
182
  {
183
  echo '<div class="error" style="text-align: center;"><p style="color: red; font-size: 14px; font-weight: bold;">Attention !</p><p>
184
- Please add this site and your network blogs, with your network adminstrator username, to your <a target="_blank" href="http://managewp.com/user-guide#multisite">ManageWP.com</a> account now to remove this notice or "Network Deactivate" the Worker plugin to avoid <a target="_blank" href="http://managewp.com/user-guide#security">security issues</a>.
185
  </p></div>';
186
  }
187
 
@@ -193,7 +195,7 @@ class MMB_Core extends MMB_Helper
193
  function admin_notice()
194
  {
195
  echo '<div class="error" style="text-align: center;"><p style="color: red; font-size: 14px; font-weight: bold;">Attention !</p><p>
196
- Please add this site to your <a target="_blank" href="http://managewp.com/user-guide#security">ManageWP.com</a> account now to remove this notice or deactivate the Worker plugin to avoid <a target="_blank" href="http://managewp.com/user-guide#security">security issues</a>.
197
  </p></div>';
198
  }
199
 
@@ -562,20 +564,17 @@ class MMB_Core extends MMB_Helper
562
 
563
  if (!headers_sent())
564
  header('P3P: CP="CAO PSA OUR"');
565
-
 
 
 
566
  $siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl');
567
  $user = $this->mmb_get_user_info($username);
568
  wp_set_current_user($user->ID);
569
 
570
- $expiration = time() + apply_filters('auth_cookie_expiration', 10800, $user->ID, false);
571
- $auth_cookie = wp_generate_auth_cookie($user->ID, $expiration, 'auth');
572
- $logged_in_cookie = wp_generate_auth_cookie($user->ID, $expiration, 'logged_in');
573
- $_COOKIE['wordpress_'.md5( $siteurl )] = $auth_cookie;
574
- $_COOKIE['wordpress_logged_in_'.md5( $siteurl )] = $logged_in_cookie;
575
-
576
- if(isset($this->mmb_multisite) && $this->mmb_multisite )
577
  wp_cookie_constants();
578
-
579
  wp_set_auth_cookie($user->ID);
580
  setcookie(MMB_XFRAME_COOKIE, md5(MMB_XFRAME_COOKIE), $expiration, COOKIEPATH, COOKIE_DOMAIN, false, true);
581
  $_COOKIE[MMB_XFRAME_COOKIE] = md5(MMB_XFRAME_COOKIE);
@@ -593,7 +592,27 @@ class MMB_Core extends MMB_Helper
593
  @mmb_worker_header();
594
  }
595
  }
596
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  function admin_actions(){
598
  add_filter('all_plugins', array($this, 'worker_replace'));
599
  }
130
  add_action('admin_init', array($this,'admin_actions'));
131
  add_action('init', array( &$this, 'mmb_remote_action'), 9999);
132
  add_action('setup_theme', 'mmb_parse_request');
133
+ add_action('set_auth_cookie', array( &$this, 'mmb_set_auth_cookie'));
134
+ add_action('set_logged_in_cookie', array( &$this, 'mmb_set_logged_in_cookie'));
135
  }
136
 
137
  function mmb_remote_action(){
183
  function network_admin_notice()
184
  {
185
  echo '<div class="error" style="text-align: center;"><p style="color: red; font-size: 14px; font-weight: bold;">Attention !</p><p>
186
+ Please add this site and your network blogs, with your network adminstrator username, to your <a target="_blank" href="http://managewp.com">ManageWP.com</a> account now to remove this notice or "Network Deactivate" the Worker plugin to avoid <a target="_blank" href="http://managewp.com/user-guide/security">security issues</a>.
187
  </p></div>';
188
  }
189
 
195
  function admin_notice()
196
  {
197
  echo '<div class="error" style="text-align: center;"><p style="color: red; font-size: 14px; font-weight: bold;">Attention !</p><p>
198
+ Please add this site now to your <a target="_blank" href="http://managewp.com">ManageWP.com</a> account. Or deactivate the Worker plugin to avoid <a target="_blank" href="http://managewp.com/user-guide/security">security issues</a>.
199
  </p></div>';
200
  }
201
 
564
 
565
  if (!headers_sent())
566
  header('P3P: CP="CAO PSA OUR"');
567
+
568
+ if(!defined('MMB_USER_LOGIN'))
569
+ define('MMB_USER_LOGIN', true);
570
+
571
  $siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl');
572
  $user = $this->mmb_get_user_info($username);
573
  wp_set_current_user($user->ID);
574
 
575
+ if(!defined('COOKIEHASH') || (isset($this->mmb_multisite) && $this->mmb_multisite) )
 
 
 
 
 
 
576
  wp_cookie_constants();
577
+
578
  wp_set_auth_cookie($user->ID);
579
  setcookie(MMB_XFRAME_COOKIE, md5(MMB_XFRAME_COOKIE), $expiration, COOKIEPATH, COOKIE_DOMAIN, false, true);
580
  $_COOKIE[MMB_XFRAME_COOKIE] = md5(MMB_XFRAME_COOKIE);
592
  @mmb_worker_header();
593
  }
594
  }
595
+
596
+ function mmb_set_auth_cookie( $auth_cookie ){
597
+ if(!defined('MMB_USER_LOGIN'))
598
+ return false;
599
+
600
+ if( !defined('COOKIEHASH') )
601
+ wp_cookie_constants();
602
+
603
+ $_COOKIE['wordpress_'.COOKIEHASH] = $auth_cookie;
604
+
605
+ }
606
+ function mmb_set_logged_in_cookie( $logged_in_cookie ){
607
+ if(!defined('MMB_USER_LOGIN'))
608
+ return false;
609
+
610
+ if( !defined('COOKIEHASH') )
611
+ wp_cookie_constants();
612
+
613
+ $_COOKIE['wordpress_logged_in_'.COOKIEHASH] = $logged_in_cookie;
614
+ }
615
+
616
  function admin_actions(){
617
  add_filter('all_plugins', array($this, 'worker_replace'));
618
  }
helper.class.php CHANGED
@@ -102,10 +102,6 @@ class MMB_Helper
102
 
103
  global $_mmb_item_filter;
104
  $call_object = $call_object !== null ? $call_object : $this;
105
- // $this->_log('key: '.print_r($key, true));
106
- // $this->_log('params: '.print_r($params, true));
107
- // $this->_log('call_object: '.print_r($call_object, true));
108
- // $this->_log('$_mmb_item_filter[$key]: '.print_r($_mmb_item_filter[$key], true));
109
  $return = array();
110
 
111
  if(isset($_mmb_item_filter[$key]) && !empty($_mmb_item_filter[$key])){
102
 
103
  global $_mmb_item_filter;
104
  $call_object = $call_object !== null ? $call_object : $this;
 
 
 
 
105
  $return = array();
106
 
107
  if(isset($_mmb_item_filter[$key]) && !empty($_mmb_item_filter[$key])){
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.11
8
  Author URI: http://www.prelovac.com
9
  */
10
 
@@ -20,7 +20,7 @@ Author URI: http://www.prelovac.com
20
  **************************************************************/
21
 
22
  if(!defined('MMB_WORKER_VERSION'))
23
- define('MMB_WORKER_VERSION', '3.9.11');
24
 
25
  if ( !defined('MMB_XFRAME_COOKIE')){
26
  $siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl');
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.12
8
  Author URI: http://www.prelovac.com
9
  */
10
 
20
  **************************************************************/
21
 
22
  if(!defined('MMB_WORKER_VERSION'))
23
+ define('MMB_WORKER_VERSION', '3.9.12');
24
 
25
  if ( !defined('MMB_XFRAME_COOKIE')){
26
  $siteurl = function_exists('get_site_option') ? get_site_option( 'siteurl' ) : get_option('siteurl');
readme.txt CHANGED
@@ -32,8 +32,9 @@ Check out [ManageWP.com](http://managewp.com/ "Manage Multiple Blogs").
32
 
33
  == Changelog ==
34
 
35
- = 3.9.11 =
36
  * Minor bug fixes
 
37
 
38
  = 3.9.10 =
39
  * Supporting updates for more premium plugins/themes
32
 
33
  == Changelog ==
34
 
35
+ = 3.9.12 =
36
  * Minor bug fixes
37
+ * Backup, clone, favorites functionality improved
38
 
39
  = 3.9.10 =
40
  * Supporting updates for more premium plugins/themes
version CHANGED
@@ -1 +1 @@
1
- 3.9.11
1
+ 3.9.12