Migrate Guru: Migrate & Clone WordPress Free - Version 4.31

Version Description

  • Fetching Mysql Version
  • Robust data fetch APIs
  • Core plugin changes
  • Sanitizing incoming params
Download this release

Release Info

Developer akshatc
Plugin Icon 128x128 Migrate Guru: Migrate & Clone WordPress Free
Version 4.31
Comparing to
See all releases

Code changes from version 3.4 to 4.31

account.php CHANGED
@@ -42,6 +42,10 @@ if (!class_exists('MGAccount')) :
42
  return $str;
43
  }
44
 
 
 
 
 
45
  public static function apiPublicAccount($settings) {
46
  $pubkey = $settings->getOption(self::$api_public_key);
47
  return self::find($settings, $pubkey);
@@ -98,6 +102,7 @@ if (!class_exists('MGAccount')) :
98
  }
99
 
100
  public function newAuthParams($version) {
 
101
  $args = array();
102
  $time = time();
103
  $sig = sha1($this->public.$this->secret.$time.$version);
@@ -106,6 +111,7 @@ if (!class_exists('MGAccount')) :
106
  $args['bvPublic'] = $this->public;
107
  $args['bvVersion'] = $version;
108
  $args['sha1'] = '1';
 
109
  return $args;
110
  }
111
 
@@ -118,7 +124,7 @@ if (!class_exists('MGAccount')) :
118
  self::update($settings, $accounts);
119
  }
120
 
121
- public function respInfo() {
122
  return array(
123
  "public" => substr($this->public, 0, 6),
124
  "sigmatch" => substr($this->sig_match, 0, 6)
@@ -179,4 +185,4 @@ if (!class_exists('MGAccount')) :
179
  return array_key_exists($pubkey, $accounts);
180
  }
181
  }
182
- endif;
42
  return $str;
43
  }
44
 
45
+ public static function sanitizeKey($key) {
46
+ return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key);
47
+ }
48
+
49
  public static function apiPublicAccount($settings) {
50
  $pubkey = $settings->getOption(self::$api_public_key);
51
  return self::find($settings, $pubkey);
102
  }
103
 
104
  public function newAuthParams($version) {
105
+ $bvinfo = new MGInfo($this->settings);
106
  $args = array();
107
  $time = time();
108
  $sig = sha1($this->public.$this->secret.$time.$version);
111
  $args['bvPublic'] = $this->public;
112
  $args['bvVersion'] = $version;
113
  $args['sha1'] = '1';
114
+ $args['plugname'] = $bvinfo->plugname;
115
  return $args;
116
  }
117
 
124
  self::update($settings, $accounts);
125
  }
126
 
127
+ public function info() {
128
  return array(
129
  "public" => substr($this->public, 0, 6),
130
  "sigmatch" => substr($this->sig_match, 0, 6)
185
  return array_key_exists($pubkey, $accounts);
186
  }
187
  }
188
+ endif;
callback/handler.php CHANGED
@@ -10,6 +10,7 @@ if (!class_exists('BVCallbackHandler')) :
10
  public $request;
11
  public $account;
12
  public $response;
 
13
 
14
  public function __construct($db, $settings, $siteinfo, $request, $account, $response) {
15
  $this->db = $db;
@@ -18,6 +19,7 @@ if (!class_exists('BVCallbackHandler')) :
18
  $this->request = $request;
19
  $this->account = $account;
20
  $this->response = $response;
 
21
  }
22
 
23
  public function bvAdmExecuteWithoutUser() {
@@ -30,17 +32,16 @@ if (!class_exists('BVCallbackHandler')) :
30
 
31
  public function execute($resp = array()) {
32
  $this->routeRequest();
33
- $bvinfo = new MGInfo($this->settings);
34
  $resp = array(
35
- "request_info" => $this->request->respInfo(),
36
- "site_info" => $this->siteinfo->respInfo(),
37
- "account_info" => $this->account->respInfo(),
38
- "bvinfo" => $bvinfo->respInfo(),
39
  "api_pubkey" => substr(MGAccount::getApiPublicKey($this->settings), 0, 8)
40
  );
41
  $this->response->terminate($resp);
42
  }
43
-
44
  public function routeRequest() {
45
  switch ($this->request->wing) {
46
  case 'manage':
@@ -67,17 +68,9 @@ if (!class_exists('BVCallbackHandler')) :
67
  require_once dirname( __FILE__ ) . '/wings/ipstore.php';
68
  $module = new BVIPStoreCallback($this);
69
  break;
70
- case 'fw':
71
- require_once dirname( __FILE__ ) . '/wings/fw.php';
72
- $module = new BVFirewallCallback($this);
73
- break;
74
- case 'lp':
75
- require_once dirname( __FILE__ ) . '/wings/lp.php';
76
- $module = new BVLoginProtectCallback($this);
77
- break;
78
- case 'monit':
79
- require_once dirname( __FILE__ ) . '/wings/monit.php';
80
- $module = new BVMonitCallback($this);
81
  break;
82
  case 'brand':
83
  require_once dirname( __FILE__ ) . '/wings/brand.php';
@@ -91,6 +84,10 @@ if (!class_exists('BVCallbackHandler')) :
91
  require_once dirname( __FILE__ ) . '/wings/account.php';
92
  $module = new BVAccountCallback($this);
93
  break;
 
 
 
 
94
  default:
95
  require_once dirname( __FILE__ ) . '/wings/misc.php';
96
  $module = new BVMiscCallback($this);
10
  public $request;
11
  public $account;
12
  public $response;
13
+ public $bvinfo;
14
 
15
  public function __construct($db, $settings, $siteinfo, $request, $account, $response) {
16
  $this->db = $db;
19
  $this->request = $request;
20
  $this->account = $account;
21
  $this->response = $response;
22
+ $this->bvinfo = new MGInfo($this->settings);
23
  }
24
 
25
  public function bvAdmExecuteWithoutUser() {
32
 
33
  public function execute($resp = array()) {
34
  $this->routeRequest();
 
35
  $resp = array(
36
+ "request_info" => $this->request->info(),
37
+ "site_info" => $this->siteinfo->info(),
38
+ "account_info" => $this->account->info(),
39
+ "bvinfo" => $this->bvinfo->info(),
40
  "api_pubkey" => substr(MGAccount::getApiPublicKey($this->settings), 0, 8)
41
  );
42
  $this->response->terminate($resp);
43
  }
44
+
45
  public function routeRequest() {
46
  switch ($this->request->wing) {
47
  case 'manage':
68
  require_once dirname( __FILE__ ) . '/wings/ipstore.php';
69
  $module = new BVIPStoreCallback($this);
70
  break;
71
+ case 'wtch':
72
+ require_once dirname( __FILE__ ) . '/wings/watch.php';
73
+ $module = new BVWatchCallback($this);
 
 
 
 
 
 
 
 
74
  break;
75
  case 'brand':
76
  require_once dirname( __FILE__ ) . '/wings/brand.php';
84
  require_once dirname( __FILE__ ) . '/wings/account.php';
85
  $module = new BVAccountCallback($this);
86
  break;
87
+ case 'fswrt':
88
+ require_once dirname( __FILE__ ) . '/wings/fs_write.php';
89
+ $module = new BVFSWriteCallback();
90
+ break;
91
  default:
92
  require_once dirname( __FILE__ ) . '/wings/misc.php';
93
  $module = new BVMiscCallback($this);
callback/request.php CHANGED
@@ -40,7 +40,7 @@ if (!class_exists('BVCallbackRequest')) :
40
  return array_key_exists('apicall', $this->params);
41
  }
42
 
43
- public function respInfo() {
44
  $info = array(
45
  "requestedsig" => $this->sig,
46
  "requestedtime" => $this->time,
@@ -89,7 +89,7 @@ if (!class_exists('BVCallbackRequest')) :
89
  if (array_key_exists('bvprms', $in_params) && isset($in_params['bvprms']) &&
90
  array_key_exists('bvprmsmac', $in_params) && isset($in_params['bvprmsmac'])) {
91
  $digest_algo = 'SHA1';
92
- $sent_mac = $in_params['bvprmsmac'];
93
 
94
  if (array_key_exists('bvprmshshalgo', $in_params) && isset($in_params['bvprmshshalgo'])) {
95
  $digest_algo = $in_params['bvprmshshalgo'];
40
  return array_key_exists('apicall', $this->params);
41
  }
42
 
43
+ public function info() {
44
  $info = array(
45
  "requestedsig" => $this->sig,
46
  "requestedtime" => $this->time,
89
  if (array_key_exists('bvprms', $in_params) && isset($in_params['bvprms']) &&
90
  array_key_exists('bvprmsmac', $in_params) && isset($in_params['bvprmsmac'])) {
91
  $digest_algo = 'SHA1';
92
+ $sent_mac = MGAccount::sanitizeKey($in_params['bvprmsmac']);
93
 
94
  if (array_key_exists('bvprmshshalgo', $in_params) && isset($in_params['bvprmshshalgo'])) {
95
  $digest_algo = $in_params['bvprmshshalgo'];
callback/wings/account.php CHANGED
@@ -21,7 +21,7 @@ class BVAccountCallback extends BVCallbackBase {
21
  $resp = array("status" => MGAccount::exists($this->settings, $params['public']));
22
  break;
23
  case "rmacc":
24
- $resp = array("status" => $account->remove($params['public']));
25
  break;
26
  case "updt":
27
  $info = array();
@@ -32,7 +32,8 @@ class BVAccountCallback extends BVCallbackBase {
32
  $resp = array("status" => MGAccount::exists($this->settings, $params['pubkey']));
33
  break;
34
  case "updtapikey":
35
- $resp = array("status" => MGAccount::updateApiPublicKey($this->settings, $params['pubkey']));
 
36
  break;
37
  case "rmdefsec":
38
  $resp = array("status" => $settings->deleteOption('bvDefaultSecret'));
21
  $resp = array("status" => MGAccount::exists($this->settings, $params['public']));
22
  break;
23
  case "rmacc":
24
+ $resp = array("status" => MGAccount::remove($this->settings, $params['public']));
25
  break;
26
  case "updt":
27
  $info = array();
32
  $resp = array("status" => MGAccount::exists($this->settings, $params['pubkey']));
33
  break;
34
  case "updtapikey":
35
+ MGAccount::updateApiPublicKey($this->settings, $params['pubkey']);
36
+ $resp = array("status" => $this->settings->getOption(MGAccount::$api_public_key));
37
  break;
38
  case "rmdefsec":
39
  $resp = array("status" => $settings->deleteOption('bvDefaultSecret'));
callback/wings/db.php CHANGED
@@ -9,9 +9,13 @@ class BVDBCallback extends BVCallbackBase {
9
  public $stream;
10
  public $account;
11
 
 
 
12
  public function __construct($callback_handler) {
13
  $this->db = $callback_handler->db;
14
  $this->account = $callback_handler->account;
 
 
15
  }
16
 
17
  public function getLastID($pkeys, $end_row) {
@@ -64,6 +68,9 @@ class BVDBCallback extends BVCallbackBase {
64
  $db = $this->db;
65
  $params = $request->params;
66
  $stream_init_info = BVStream::startStream($this->account, $request);
 
 
 
67
  if (array_key_exists('stream', $stream_init_info)) {
68
  $this->stream = $stream_init_info['stream'];
69
  switch ($request->method) {
@@ -140,17 +147,17 @@ class BVDBCallback extends BVCallbackBase {
140
  $resp = $this->getTableData($table, $tname, $rcount, $offset, $limit, $bsize, $filter, $pkeys, true);
141
  break;
142
  case "tblexists":
143
- $resp = array("tblexists" => $db->isTablePresent($params['tablename']));
144
  break;
145
  case "crttbl":
146
  $usedbdelta = array_key_exists('usedbdelta', $params);
147
- $resp = array("crttbl" => $db->createTable($params['query'], $params['tablename'], $usedbdelta));
148
  break;
149
  case "drptbl":
150
- $resp = array("drptbl" => $db->dropBVTable($params['name']));
151
  break;
152
  case "trttbl":
153
- $resp = array("trttbl" => $db->truncateBVTable($params['name']));
154
  break;
155
  case "altrtbl":
156
  $resp = array("altrtbl" => $db->alterBVTable($params['query'], $params['query']));
9
  public $stream;
10
  public $account;
11
 
12
+ public static $bvTables = array("fw_requests", "lp_requests", "ip_store");
13
+
14
  public function __construct($callback_handler) {
15
  $this->db = $callback_handler->db;
16
  $this->account = $callback_handler->account;
17
+ $this->siteinfo = $callback_handler->siteinfo;
18
+ $this->bvinfo = $callback_handler->bvinfo;
19
  }
20
 
21
  public function getLastID($pkeys, $end_row) {
68
  $db = $this->db;
69
  $params = $request->params;
70
  $stream_init_info = BVStream::startStream($this->account, $request);
71
+
72
+
73
+
74
  if (array_key_exists('stream', $stream_init_info)) {
75
  $this->stream = $stream_init_info['stream'];
76
  switch ($request->method) {
147
  $resp = $this->getTableData($table, $tname, $rcount, $offset, $limit, $bsize, $filter, $pkeys, true);
148
  break;
149
  case "tblexists":
150
+ $resp = array("tblexists" => $db->isTablePresent($params['table']));
151
  break;
152
  case "crttbl":
153
  $usedbdelta = array_key_exists('usedbdelta', $params);
154
+ $resp = array("crttbl" => $db->createTable($params['query'], $params['table'], $usedbdelta));
155
  break;
156
  case "drptbl":
157
+ $resp = array("drptbl" => $db->dropBVTable($params['table']));
158
  break;
159
  case "trttbl":
160
+ $resp = array("trttbl" => $db->truncateBVTable($params['table']));
161
  break;
162
  case "altrtbl":
163
  $resp = array("altrtbl" => $db->alterBVTable($params['query'], $params['query']));
callback/wings/fs.php CHANGED
@@ -8,6 +8,8 @@ class BVFSCallback extends BVCallbackBase {
8
  public $stream;
9
  public $account;
10
 
 
 
11
  public function __construct($callback_handler) {
12
  $this->account = $callback_handler->account;
13
  }
@@ -149,6 +151,34 @@ class BVFSCallback extends BVCallbackBase {
149
  return $md5;
150
  }
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  function getFilesStats($files, $offset = 0, $limit = 0, $bsize = 102400, $md5 = false) {
153
  $result = array();
154
  foreach ($files as $file) {
@@ -207,6 +237,9 @@ class BVFSCallback extends BVCallbackBase {
207
  function process($request) {
208
  $params = $request->params;
209
  $stream_init_info = BVStream::startStream($this->account, $request);
 
 
 
210
  if (array_key_exists('stream', $stream_init_info)) {
211
  $this->stream = $stream_init_info['stream'];
212
  switch ($request->method) {
@@ -264,6 +297,26 @@ class BVFSCallback extends BVCallbackBase {
264
  $directoryList = glob($initdir.$regex, $glob_option);
265
  $resp = $this->getFilesStats($directoryList);
266
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  default:
268
  $resp = false;
269
  }
8
  public $stream;
9
  public $account;
10
 
11
+ public static $cwAllowedFiles = array(".htaccess", ".user.ini", "malcare-waf.php");
12
+
13
  public function __construct($callback_handler) {
14
  $this->account = $callback_handler->account;
15
  }
151
  return $md5;
152
  }
153
 
154
+ function getFilesContent($files, $withContent = true) {
155
+ $result = array();
156
+ foreach ($files as $file) {
157
+ $fdata = $this->fileStat($file);
158
+ $absfile = ABSPATH.$file;
159
+
160
+ if (is_dir($absfile) && !is_link($absfile)) {
161
+ $fdata['is_dir'] = true;
162
+ } else {
163
+ if (!is_readable($file)) {
164
+ $fdata['error'] = 'file not readable';
165
+ } else {
166
+ if ($withContent === true) {
167
+ if ($content = file_get_contents($absfile)) {
168
+ $fdata['content'] = $content;
169
+ } else {
170
+ $fdata['error'] = 'unable to read file';
171
+ }
172
+ }
173
+ }
174
+ }
175
+
176
+ $result[$file] = $fdata;
177
+ }
178
+
179
+ return $result;
180
+ }
181
+
182
  function getFilesStats($files, $offset = 0, $limit = 0, $bsize = 102400, $md5 = false) {
183
  $result = array();
184
  foreach ($files as $file) {
237
  function process($request) {
238
  $params = $request->params;
239
  $stream_init_info = BVStream::startStream($this->account, $request);
240
+
241
+
242
+
243
  if (array_key_exists('stream', $stream_init_info)) {
244
  $this->stream = $stream_init_info['stream'];
245
  switch ($request->method) {
297
  $directoryList = glob($initdir.$regex, $glob_option);
298
  $resp = $this->getFilesStats($directoryList);
299
  break;
300
+ case "dirsexists":
301
+ $resp = array();
302
+ $dirs = $params['dirs'];
303
+
304
+ foreach ($dirs as $dir) {
305
+ $path = ABSPATH.$dir;
306
+ if (file_exists($path) && is_dir($path) && !is_link($path)) {
307
+ $resp[$dir] = true;
308
+ } else {
309
+ $resp[$dir] = false;
310
+ }
311
+ }
312
+
313
+ $resp["status"] = "Done";
314
+ break;
315
+ case "gtfilescntent":
316
+ $files = $params['files'];
317
+ $withContent = array_key_exists('withcontent', $params) ? $params['withcontent'] : true;
318
+ $resp = array("files_content" => $this->getFilesContent($files, $withContent));
319
+ break;
320
  default:
321
  $resp = false;
322
  }
callback/wings/info.php CHANGED
@@ -96,11 +96,13 @@ class BVInfoCallback extends BVCallbackBase {
96
 
97
  public function getSystemInfo() {
98
  $sys_info = array(
99
- 'serverip' => $_SERVER['SERVER_ADDR'],
100
  'host' => $_SERVER['HTTP_HOST'],
101
  'phpversion' => phpversion(),
102
  'AF_INET6' => defined('AF_INET6')
103
  );
 
 
 
104
  if (function_exists('get_current_user')) {
105
  $sys_info['user'] = get_current_user();
106
  }
@@ -133,7 +135,9 @@ class BVInfoCallback extends BVCallbackBase {
133
  'charset' => get_bloginfo('charset'),
134
  'wpversion' => $wp_version,
135
  'dbversion' => $wp_db_version,
 
136
  'abspath' => ABSPATH,
 
137
  'uploadpath' => $upload_dir['basedir'],
138
  'uploaddir' => wp_upload_dir(),
139
  'contentdir' => defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : null,
@@ -203,51 +207,11 @@ class BVInfoCallback extends BVCallbackBase {
203
  $data['dynsync'] = $settings->getOption('bvDynSyncActive');
204
  $data['woodyn'] = $settings->getOption('bvWooDynSync');
205
  $data['dynplug'] = $settings->getOption('bvdynplug');
206
- $data['ptplug'] = $settings->getOption('bvptplug');
207
- $data['fw'] = $this->getFWConfig();
208
- $data['lp'] = $this->getLPConfig();
209
  $data['brand'] = $settings->getOption($this->bvinfo->brand_option);
210
  $data['badgeinfo'] = $settings->getOption($this->bvinfo->badgeinfo);
211
  }
212
 
213
- public function getLPConfig() {
214
- $config = array();
215
- $settings = $this->settings;
216
- $mode = $settings->getOption('bvlpmode');
217
- $cplimit = $settings->getOption('bvlpcaptchalimit');
218
- $tplimit = $settings->getOption('bvlptempblocklimit');
219
- $bllimit = $settings->getOption('bvlpblockAllLimit');
220
- $config['mode'] = intval($mode ? $mode : 1);
221
- $config['captcha_limit'] = intval($cplimit ? $cplimit : 3);
222
- $config['temp_block_limit'] = intval($tplimit? $tplimit : 6);
223
- $config['block_all_limit'] = intval($bllimit ? $bllimit : 100);
224
- return $config;
225
- }
226
-
227
- public function getFWConfig() {
228
- $config = array();
229
- $settings = $this->settings;
230
- $mode = $settings->getOption('bvfwmode');
231
- $drules = $settings->getOption('bvfwdisabledrules');
232
- $arules = $settings->getOption('bvfwauditrules');
233
- $rmode = $settings->getOption('bvfwrulesmode');
234
- $reqprofilingmode = $settings->getOption('bvfwreqprofilingmode');
235
- $bypass_level = $settings->getOption('bvfwbypasslevel');
236
- $custom_roles = $settings->getOption('bvfwcustomroles');
237
- $cookiemode = $settings->getOption('bvfwcookiemode');
238
- $cookiekey = (string) $settings->getOption('bvfwcookiekey');
239
- $config['mode'] = intval($mode ? $mode : 1);
240
- $config['disabled_rules'] = $drules ? $drules : array();
241
- $config['audit_rules'] = $arules ? $arules : array();
242
- $config['rules_mode'] = intval($rmode ? $rmode : 1);
243
- $config['req_profiling_mode'] = intval($reqprofilingmode ? $reqprofilingmode : 1);
244
- $config['bypslevl'] = intval($bypass_level ? $bypass_level : 2);
245
- $config['cstmrls'] = $custom_roles ? $custom_roles : array();
246
- $config['cookiemode'] = intval($cookiemode ? $cookiemode : 2);
247
- $config['cookiekey'] = $cookiekey;
248
- return $config;
249
- }
250
-
251
  public function dbconf(&$info) {
252
  $db = $this->db;
253
  if (defined('DB_CHARSET'))
@@ -256,6 +220,15 @@ class BVInfoCallback extends BVCallbackBase {
256
  $info['charset_collate'] = $db->getCharsetCollate();
257
  return $info;
258
  }
 
 
 
 
 
 
 
 
 
259
 
260
  public function activate() {
261
  $resp = array();
@@ -266,6 +239,15 @@ class BVInfoCallback extends BVCallbackBase {
266
  return array('actinfo' => $resp);
267
  }
268
 
 
 
 
 
 
 
 
 
 
269
  public function process($request) {
270
  $db = $this->db;
271
  $params = $request->params;
@@ -273,6 +255,9 @@ class BVInfoCallback extends BVCallbackBase {
273
  case "activateinfo":
274
  $resp = $this->activate();
275
  break;
 
 
 
276
  case "gtpsts":
277
  $count = 5;
278
  if (array_key_exists('count', $params))
@@ -294,6 +279,13 @@ class BVInfoCallback extends BVCallbackBase {
294
  case "gtwp":
295
  $resp = $this->getWpInfo();
296
  break;
 
 
 
 
 
 
 
297
  case "getoption":
298
  $resp = array("option" => $this->settings->getOption($params['name']));
299
  break;
@@ -309,6 +301,19 @@ class BVInfoCallback extends BVCallbackBase {
309
  $transient = $this->objectToArray($transient);
310
  $resp = array("transient" => $transient);
311
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  default:
313
  $resp = false;
314
  }
96
 
97
  public function getSystemInfo() {
98
  $sys_info = array(
 
99
  'host' => $_SERVER['HTTP_HOST'],
100
  'phpversion' => phpversion(),
101
  'AF_INET6' => defined('AF_INET6')
102
  );
103
+ if (array_key_exists('SERVER_ADDR', $_SERVER)) {
104
+ $sys_info['serverip'] = $_SERVER['SERVER_ADDR'];
105
+ }
106
  if (function_exists('get_current_user')) {
107
  $sys_info['user'] = get_current_user();
108
  }
135
  'charset' => get_bloginfo('charset'),
136
  'wpversion' => $wp_version,
137
  'dbversion' => $wp_db_version,
138
+ 'mysql_version' => $db->getMysqlVersion(),
139
  'abspath' => ABSPATH,
140
+ 'bvpluginpath' => defined('MGBASEPATH') ? MGBASEPATH : null,
141
  'uploadpath' => $upload_dir['basedir'],
142
  'uploaddir' => wp_upload_dir(),
143
  'contentdir' => defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : null,
207
  $data['dynsync'] = $settings->getOption('bvDynSyncActive');
208
  $data['woodyn'] = $settings->getOption('bvWooDynSync');
209
  $data['dynplug'] = $settings->getOption('bvdynplug');
210
+ $data['protect'] = $settings->getOption('bvptconf');
 
 
211
  $data['brand'] = $settings->getOption($this->bvinfo->brand_option);
212
  $data['badgeinfo'] = $settings->getOption($this->bvinfo->badgeinfo);
213
  }
214
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  public function dbconf(&$info) {
216
  $db = $this->db;
217
  if (defined('DB_CHARSET'))
220
  $info['charset_collate'] = $db->getCharsetCollate();
221
  return $info;
222
  }
223
+
224
+ public function cookieInfo() {
225
+ $resp = array();
226
+ if (defined('COOKIEPATH'))
227
+ $resp['cookiepath'] = COOKIEPATH;
228
+ if (defined('COOKIE_DOMAIN'))
229
+ $resp['cookiedomain'] = COOKIE_DOMAIN;
230
+ return array('cookieinfo' => $resp);
231
+ }
232
 
233
  public function activate() {
234
  $resp = array();
239
  return array('actinfo' => $resp);
240
  }
241
 
242
+ public function getHostInfo() {
243
+ $host_info = $_SERVER;
244
+ $host_info['PHP_SERVER_NAME'] = php_uname('\n');
245
+ if (array_key_exists('IS_PRESSABLE', get_defined_constants())) {
246
+ $host_info['IS_PRESSABLE'] = true;
247
+ }
248
+ return array('host_info' => $host_info);
249
+ }
250
+
251
  public function process($request) {
252
  $db = $this->db;
253
  $params = $request->params;
255
  case "activateinfo":
256
  $resp = $this->activate();
257
  break;
258
+ case "ckeyinfo":
259
+ $resp = $this->cookieInfo();
260
+ break;
261
  case "gtpsts":
262
  $count = 5;
263
  if (array_key_exists('count', $params))
279
  case "gtwp":
280
  $resp = $this->getWpInfo();
281
  break;
282
+ case "gtallhdrs":
283
+ $data = (function_exists('getallheaders')) ? getallheaders() : false;
284
+ $resp = array("allhdrs" => $data);
285
+ break;
286
+ case "gtsvr":
287
+ $resp = array("svr" => $_SERVER);
288
+ break;
289
  case "getoption":
290
  $resp = array("option" => $this->settings->getOption($params['name']));
291
  break;
301
  $transient = $this->objectToArray($transient);
302
  $resp = array("transient" => $transient);
303
  break;
304
+ case "gthost":
305
+ $resp = $this->getHostInfo();
306
+ break;
307
+ case "gtplinfo":
308
+ $args = array(
309
+ 'slug' => wp_unslash($params['slug'])
310
+ );
311
+ $action = $params['action'];
312
+ $args = (object) $args;
313
+ $args = apply_filters('plugins_api_args', $args, $action);
314
+ $data = apply_filters('plugins_api', false, $action, $args);
315
+ $resp = array("plugins_info" => $data);
316
+ break;
317
  default:
318
  $resp = false;
319
  }
callback/wings/misc.php CHANGED
@@ -16,6 +16,32 @@ class BVMiscCallback extends BVCallbackBase {
16
  $this->bvinfo = new MGInfo($callback_handler->settings);
17
  }
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  public function process($request) {
20
  $bvinfo = $this->bvinfo;
21
  $settings = $this->settings;
@@ -23,9 +49,9 @@ class BVMiscCallback extends BVCallbackBase {
23
  switch ($request->method) {
24
  case "dummyping":
25
  $resp = array();
26
- $resp = array_merge($resp, $this->siteinfo->respInfo());
27
- $resp = array_merge($resp, $this->account->respInfo());
28
- $resp = array_merge($resp, $this->bvinfo->respInfo());
29
  break;
30
  case "enablebadge":
31
  $option = $bvinfo->badgeinfo;
@@ -52,27 +78,15 @@ class BVMiscCallback extends BVCallbackBase {
52
  $settings->deleteOption('bvdynplug');
53
  $resp = array("unsetdynplug" => $settings->getOption('bvdynplug'));
54
  break;
55
- case "setptplug":
56
- $settings->updateOption('bvptplug', $params['ptplug']);
57
- $resp = array("setptplug" => $settings->getOption('bvptplug'));
58
- break;
59
- case "unsetptplug":
60
- $settings->deleteOption('bvptlug');
61
- $resp = array("unsetptplug" => $settings->getOption('bvptlug'));
62
- break;
63
  case "wpupplgs":
64
- $resp = array("wpupdateplugins" => wp_update_plugins());
65
  break;
66
  case "wpupthms":
67
- $resp = array("wpupdatethemes" => wp_update_themes());
68
  break;
69
  case "wpupcre":
70
  $resp = array("wpupdatecore" => wp_version_check());
71
  break;
72
- case "rmmonitime":
73
- $this->settings->deleteOption('bvmonittime');
74
- $resp = array("rmmonitime" => !$bvinfo->getMonitTime());
75
- break;
76
  case "phpinfo":
77
  phpinfo();
78
  die();
@@ -80,6 +94,9 @@ class BVMiscCallback extends BVCallbackBase {
80
  case "dlttrsnt":
81
  $resp = array("dlttrsnt" => $settings->deleteTransient($params['key']));
82
  break;
 
 
 
83
  default:
84
  $resp = false;
85
  }
16
  $this->bvinfo = new MGInfo($callback_handler->settings);
17
  }
18
 
19
+ public function refreshPluginUpdates() {
20
+ global $wp_current_filter;
21
+ $wp_current_filter[] = 'load-update-core.php';
22
+
23
+ wp_update_plugins();
24
+
25
+ array_pop($wp_current_filter);
26
+
27
+ wp_update_plugins();
28
+
29
+ return array("wpupdateplugins" => true);
30
+ }
31
+
32
+ public function refreshThemeUpdates() {
33
+ global $wp_current_filter;
34
+ $wp_current_filter[] = 'load-update-core.php';
35
+
36
+ wp_update_themes();
37
+
38
+ array_pop($wp_current_filter);
39
+
40
+ wp_update_themes();
41
+
42
+ return array("wpupdatethemes" => true);
43
+ }
44
+
45
  public function process($request) {
46
  $bvinfo = $this->bvinfo;
47
  $settings = $this->settings;
49
  switch ($request->method) {
50
  case "dummyping":
51
  $resp = array();
52
+ $resp = array_merge($resp, $this->siteinfo->info());
53
+ $resp = array_merge($resp, $this->account->info());
54
+ $resp = array_merge($resp, $this->bvinfo->info());
55
  break;
56
  case "enablebadge":
57
  $option = $bvinfo->badgeinfo;
78
  $settings->deleteOption('bvdynplug');
79
  $resp = array("unsetdynplug" => $settings->getOption('bvdynplug'));
80
  break;
 
 
 
 
 
 
 
 
81
  case "wpupplgs":
82
+ $resp = $this->refreshPluginUpdates();
83
  break;
84
  case "wpupthms":
85
+ $resp = $this->refreshThemeUpdates();
86
  break;
87
  case "wpupcre":
88
  $resp = array("wpupdatecore" => wp_version_check());
89
  break;
 
 
 
 
90
  case "phpinfo":
91
  phpinfo();
92
  die();
94
  case "dlttrsnt":
95
  $resp = array("dlttrsnt" => $settings->deleteTransient($params['key']));
96
  break;
97
+ case "setmanulsignup":
98
+ $resp = array("setmanulsignup" => $settings->updateOption("bvmanualsignup", true));
99
+ break;
100
  default:
101
  $resp = false;
102
  }
info.php CHANGED
@@ -9,17 +9,23 @@ if (!class_exists('MGInfo')) :
9
  public $badgeinfo = 'bvmgbadge';
10
  public $ip_header_option = 'bvmgipheader';
11
  public $brand_option = 'bvmgbrand';
12
- public $version = '3.4';
13
  public $webpage = 'https://www.migrateguru.com';
14
  public $appurl = 'https://mg.blogvault.net';
15
  public $slug = 'migrate-guru/migrateguru.php';
16
  public $plug_redirect = 'bvmgredirect';
17
  public $logo = '../img/migrateguru.png';
 
18
 
19
  public function __construct($settings) {
20
  $this->settings = $settings;
21
  }
22
 
 
 
 
 
 
23
  public function getBrandInfo() {
24
  return $this->settings->getOption($this->brand_option);
25
  }
@@ -29,11 +35,20 @@ if (!class_exists('MGInfo')) :
29
  if ($brand && array_key_exists('menuname', $brand)) {
30
  return $brand['menuname'];
31
  }
 
32
  return $this->brandname;
33
  }
34
 
35
- public function getMonitTime() {
36
- $time = $this->settings->getOption('bvmonittime');
 
 
 
 
 
 
 
 
37
  return ($time ? $time : 0);
38
  }
39
 
@@ -48,10 +63,10 @@ if (!class_exists('MGInfo')) :
48
  return $this->appurl;
49
  }
50
  }
51
-
52
  public function isActivePlugin() {
53
  $expiry_time = time() - (3 * 24 * 3600);
54
- return ($this->getMonitTime() > $expiry_time);
55
  }
56
 
57
  public function isProtectModuleEnabled() {
@@ -63,6 +78,7 @@ if (!class_exists('MGInfo')) :
63
  return ($this->settings->getOption('bvdynplug') === $this->plugname) &&
64
  $this->isActivePlugin();
65
  }
 
66
  public function isActivateRedirectSet() {
67
  return ($this->settings->getOption($this->plug_redirect) === 'yes') ? true : false;
68
  }
@@ -75,10 +91,11 @@ if (!class_exists('MGInfo')) :
75
  return $this->getBrandName() === 'BlogVault';
76
  }
77
 
78
- public function respInfo() {
79
  return array(
80
  "bvversion" => $this->version,
81
- "sha1" => "true"
 
82
  );
83
  }
84
  }
9
  public $badgeinfo = 'bvmgbadge';
10
  public $ip_header_option = 'bvmgipheader';
11
  public $brand_option = 'bvmgbrand';
12
+ public $version = '4.31';
13
  public $webpage = 'https://www.migrateguru.com';
14
  public $appurl = 'https://mg.blogvault.net';
15
  public $slug = 'migrate-guru/migrateguru.php';
16
  public $plug_redirect = 'bvmgredirect';
17
  public $logo = '../img/migrateguru.png';
18
+ public $brand_icon = '/img/icon.png';
19
 
20
  public function __construct($settings) {
21
  $this->settings = $settings;
22
  }
23
 
24
+ public function isManualSignup() {
25
+ $scanOption = $this->settings->getOption('bvmanualsignup');
26
+ return (isset($scanOption) && $scanOption == 1);
27
+ }
28
+
29
  public function getBrandInfo() {
30
  return $this->settings->getOption($this->brand_option);
31
  }
35
  if ($brand && array_key_exists('menuname', $brand)) {
36
  return $brand['menuname'];
37
  }
38
+
39
  return $this->brandname;
40
  }
41
 
42
+ public function getBrandIcon() {
43
+ $brand = $this->getBrandInfo();
44
+ if ($brand && array_key_exists('brand_icon', $brand)) {
45
+ return $brand['brand_icon'];
46
+ }
47
+ return $this->brand_icon;
48
+ }
49
+
50
+ public function getWatchTime() {
51
+ $time = $this->settings->getOption('bvwatchtime');
52
  return ($time ? $time : 0);
53
  }
54
 
63
  return $this->appurl;
64
  }
65
  }
66
+
67
  public function isActivePlugin() {
68
  $expiry_time = time() - (3 * 24 * 3600);
69
+ return ($this->getWatchTime() > $expiry_time);
70
  }
71
 
72
  public function isProtectModuleEnabled() {
78
  return ($this->settings->getOption('bvdynplug') === $this->plugname) &&
79
  $this->isActivePlugin();
80
  }
81
+
82
  public function isActivateRedirectSet() {
83
  return ($this->settings->getOption($this->plug_redirect) === 'yes') ? true : false;
84
  }
91
  return $this->getBrandName() === 'BlogVault';
92
  }
93
 
94
+ public function info() {
95
  return array(
96
  "bvversion" => $this->version,
97
+ "sha1" => "true",
98
+ "plugname" => $this->plugname
99
  );
100
  }
101
  }
migrateguru.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://www.migrateguru.com
5
  Description: Migrating your site(s) to any WordPress Hosting platform has never been so easy.
6
  Author: Migrate Guru
7
  Author URI: http://www.migrateguru.com
8
- Version: 3.4
9
  Network: True
10
  */
11
 
@@ -28,6 +28,7 @@ Network: True
28
  /* Global response array */
29
 
30
  if (!defined('ABSPATH')) exit;
 
31
  require_once dirname( __FILE__ ) . '/wp_settings.php';
32
  require_once dirname( __FILE__ ) . '/wp_site_info.php';
33
  require_once dirname( __FILE__ ) . '/wp_db.php';
@@ -65,6 +66,7 @@ if (is_admin()) {
65
  add_action('admin_menu', array($wpadmin, 'menu'));
66
  }
67
  add_filter('plugin_action_links', array($wpadmin, 'settingsLink'), 10, 2);
 
68
  ##ACTIVATEWARNING##
69
  add_action('admin_enqueue_scripts', array($wpadmin, 'mgsecAdminMenu'));
70
  }
@@ -80,7 +82,7 @@ if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "
80
  require_once dirname( __FILE__ ) . '/callback/request.php';
81
  require_once dirname( __FILE__ ) . '/recover.php';
82
 
83
- $pubkey = $_REQUEST['pubkey'];
84
 
85
  if (array_key_exists('rcvracc', $_REQUEST)) {
86
  $account = MGRecover::find($bvsettings, $pubkey);
@@ -92,13 +94,15 @@ if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "
92
  $response = new BVCallbackResponse($request->bvb64cksize);
93
 
94
  if ($account && (1 === $account->authenticate($request))) {
 
 
95
  require_once dirname( __FILE__ ) . '/callback/handler.php';
96
  $params = $request->processParams($_REQUEST);
97
  if ($params === false) {
98
  $resp = array(
99
- "account_info" => $account->respInfo(),
100
- "request_info" => $request->respInfo(),
101
- "bvinfo" => $bvinfo->respInfo(),
102
  "statusmsg" => "BVPRMS_CORRUPTED"
103
  );
104
  $response->terminate($resp);
@@ -115,9 +119,9 @@ if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "
115
  }
116
  } else {
117
  $resp = array(
118
- "account_info" => $account ? $account->respInfo() : array("error" => "ACCOUNT_NOT_FOUND"),
119
- "request_info" => $request->respInfo(),
120
- "bvinfo" => $bvinfo->respInfo(),
121
  "statusmsg" => "FAILED_AUTH",
122
  "api_pubkey" => substr(MGAccount::getApiPublicKey($bvsettings), 0, 8),
123
  "def_sigmatch" => substr(MGAccount::getSigMatch($request, MGRecover::getDefaultSecret($bvsettings)), 0, 8)
5
  Description: Migrating your site(s) to any WordPress Hosting platform has never been so easy.
6
  Author: Migrate Guru
7
  Author URI: http://www.migrateguru.com
8
+ Version: 4.31
9
  Network: True
10
  */
11
 
28
  /* Global response array */
29
 
30
  if (!defined('ABSPATH')) exit;
31
+
32
  require_once dirname( __FILE__ ) . '/wp_settings.php';
33
  require_once dirname( __FILE__ ) . '/wp_site_info.php';
34
  require_once dirname( __FILE__ ) . '/wp_db.php';
66
  add_action('admin_menu', array($wpadmin, 'menu'));
67
  }
68
  add_filter('plugin_action_links', array($wpadmin, 'settingsLink'), 10, 2);
69
+ add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3);
70
  ##ACTIVATEWARNING##
71
  add_action('admin_enqueue_scripts', array($wpadmin, 'mgsecAdminMenu'));
72
  }
82
  require_once dirname( __FILE__ ) . '/callback/request.php';
83
  require_once dirname( __FILE__ ) . '/recover.php';
84
 
85
+ $pubkey = MGAccount::sanitizeKey($_REQUEST['pubkey']);
86
 
87
  if (array_key_exists('rcvracc', $_REQUEST)) {
88
  $account = MGRecover::find($bvsettings, $pubkey);
94
  $response = new BVCallbackResponse($request->bvb64cksize);
95
 
96
  if ($account && (1 === $account->authenticate($request))) {
97
+ ##BVBASEPATH##
98
+
99
  require_once dirname( __FILE__ ) . '/callback/handler.php';
100
  $params = $request->processParams($_REQUEST);
101
  if ($params === false) {
102
  $resp = array(
103
+ "account_info" => $account->info(),
104
+ "request_info" => $request->info(),
105
+ "bvinfo" => $bvinfo->info(),
106
  "statusmsg" => "BVPRMS_CORRUPTED"
107
  );
108
  $response->terminate($resp);
119
  }
120
  } else {
121
  $resp = array(
122
+ "account_info" => $account ? $account->info() : array("error" => "ACCOUNT_NOT_FOUND"),
123
+ "request_info" => $request->info(),
124
+ "bvinfo" => $bvinfo->info(),
125
  "statusmsg" => "FAILED_AUTH",
126
  "api_pubkey" => substr(MGAccount::getApiPublicKey($bvsettings), 0, 8),
127
  "def_sigmatch" => substr(MGAccount::getSigMatch($request, MGRecover::getDefaultSecret($bvsettings)), 0, 8)
readme.txt CHANGED
@@ -4,9 +4,9 @@ Tags: migrate, migrate WordPress, WordPress migration, migration, clone, transfe
4
  Plugin URI: https://www.migrateguru.com/
5
  Donate link: https://www.migrateguru.com/
6
  Requires at least: 4.0
7
- Requires PHP: 5.4.0
8
  Tested up to: 5.4
9
- Stable tag: 3.4
 
10
  License: GPLv2 or later
11
  License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
12
 
@@ -132,6 +132,12 @@ Yes, we do. You can access it here: https://migrateguru.freshdesk.com/support/ho
132
  6. Click ‘Migrate’.
133
 
134
  == Changelog =
 
 
 
 
 
 
135
  = 3.4 =
136
  * Plugin branding fixes
137
 
4
  Plugin URI: https://www.migrateguru.com/
5
  Donate link: https://www.migrateguru.com/
6
  Requires at least: 4.0
 
7
  Tested up to: 5.4
8
+ Requires PHP: 5.4.0
9
+ Stable tag: 4.31
10
  License: GPLv2 or later
11
  License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
12
 
132
  6. Click ‘Migrate’.
133
 
134
  == Changelog =
135
+ = 4.31 =
136
+ * Fetching Mysql Version
137
+ * Robust data fetch APIs
138
+ * Core plugin changes
139
+ * Sanitizing incoming params
140
+
141
  = 3.4 =
142
  * Plugin branding fixes
143
 
recover.php CHANGED
@@ -44,4 +44,4 @@ if (!class_exists('MGRecover')) :
44
  return $account;
45
  }
46
  }
47
- endif;
44
  return $account;
45
  }
46
  }
47
+ endif;
wp_actions.php CHANGED
@@ -36,8 +36,7 @@ if (!class_exists('MGWPAction')) :
36
  }
37
 
38
  public static function uninstall() {
39
- ##CLEARLPCONFIG##
40
- ##CLEARFWCONFIG##
41
  ##CLEARIPSTORE##
42
  ##CLEARDYNSYNCCONFIG##
43
  }
36
  }
37
 
38
  public static function uninstall() {
39
+ ##CLEARPTCONFIG##
 
40
  ##CLEARIPSTORE##
41
  ##CLEARDYNSYNCCONFIG##
42
  }
wp_admin.php CHANGED
@@ -6,10 +6,12 @@ class MGWPAdmin {
6
  public $settings;
7
  public $siteinfo;
8
  public $bvinfo;
 
9
 
10
- function __construct($settings, $siteinfo) {
11
  $this->settings = $settings;
12
  $this->siteinfo = $siteinfo;
 
13
  $this->bvinfo = new MGInfo($this->settings);
14
  }
15
 
@@ -21,6 +23,13 @@ class MGWPAdmin {
21
  }
22
  }
23
 
 
 
 
 
 
 
 
24
  public function initHandler() {
25
  if (!current_user_can('activate_plugins'))
26
  return;
@@ -49,8 +58,9 @@ class MGWPAdmin {
49
  $brand = $this->bvinfo->getBrandInfo();
50
  if (!$brand || (!array_key_exists('hide', $brand) && !array_key_exists('hide_from_menu', $brand))) {
51
  $bname = $this->bvinfo->getBrandName();
 
52
  add_menu_page($bname, $bname, 'manage_options', $this->bvinfo->plugname,
53
- array($this, 'adminPage'), plugins_url('img/icon.png', __FILE__ ));
54
  }
55
  }
56
 
6
  public $settings;
7
  public $siteinfo;
8
  public $bvinfo;
9
+ public $bvapi;
10
 
11
+ function __construct($settings, $siteinfo, $bvapi = null) {
12
  $this->settings = $settings;
13
  $this->siteinfo = $siteinfo;
14
+ $this->bvapi = $bvapi;
15
  $this->bvinfo = new MGInfo($this->settings);
16
  }
17
 
23
  }
24
  }
25
 
26
+ function removeAdminNotices() {
27
+ if (array_key_exists('page', $_REQUEST) && $_REQUEST['page'] == $this->bvinfo->plugname) {
28
+ remove_all_actions('admin_notices');
29
+ remove_all_actions('all_admin_notices');
30
+ }
31
+ }
32
+
33
  public function initHandler() {
34
  if (!current_user_can('activate_plugins'))
35
  return;
58
  $brand = $this->bvinfo->getBrandInfo();
59
  if (!$brand || (!array_key_exists('hide', $brand) && !array_key_exists('hide_from_menu', $brand))) {
60
  $bname = $this->bvinfo->getBrandName();
61
+ $icon = $this->bvinfo->getBrandIcon();
62
  add_menu_page($bname, $bname, 'manage_options', $this->bvinfo->plugname,
63
+ array($this, 'adminPage'), plugins_url($icon, __FILE__ ));
64
  }
65
  }
66
 
wp_api.php CHANGED
@@ -8,30 +8,35 @@ if (!class_exists('MGWPAPI')) :
8
  public function __construct($settings) {
9
  $this->settings = $settings;
10
  }
11
-
12
  public function pingbv($method, $body, $public = false) {
13
  if ($public) {
14
- $this->create_request_params($method, $public);
15
  } else {
16
- $accounts = MGAccount::allAccounts($this->settings);
17
- foreach ($accounts as $pubkey => $value ) {
18
- $this->create_request_params($method, $pubkey);
19
  }
20
  }
21
  }
22
 
23
- public function create_request_params($method, $pubkey) {
24
  $account = MGAccount::find($this->settings, $pubkey);
25
- $url = $account->authenticatedUrl($method);
26
- $this->http_request($url, $body);
 
 
27
  }
28
 
29
- public function http_request($url, $body) {
30
  $_body = array(
31
  'method' => 'POST',
32
  'timeout' => 15,
33
- 'body' => $body);
34
-
 
 
 
35
  return wp_remote_post($url, $_body);
36
  }
37
  }
8
  public function __construct($settings) {
9
  $this->settings = $settings;
10
  }
11
+
12
  public function pingbv($method, $body, $public = false) {
13
  if ($public) {
14
+ $this->do_request($method, $body, $public);
15
  } else {
16
+ $api_public_key = $this->settings->getOption('bvApiPublic');
17
+ if (!empty($api_public_key) && (strlen($api_public_key) >= 32)) {
18
+ $this->do_request($method, $body, $api_public_key);
19
  }
20
  }
21
  }
22
 
23
+ public function do_request($method, $body, $pubkey) {
24
  $account = MGAccount::find($this->settings, $pubkey);
25
+ if (isset($account)) {
26
+ $url = $account->authenticatedUrl($method);
27
+ $this->http_request($url, $body);
28
+ }
29
  }
30
 
31
+ public function http_request($url, $body, $headers = array()) {
32
  $_body = array(
33
  'method' => 'POST',
34
  'timeout' => 15,
35
+ 'body' => $body
36
+ );
37
+ if (!empty($headers)) {
38
+ $_body['headers'] = $headers;
39
+ }
40
  return wp_remote_post($url, $_body);
41
  }
42
  }
wp_db.php CHANGED
@@ -168,5 +168,24 @@ class MGWPDb {
168
  $table = $this->getBVTable($name);
169
  return $wpdb->replace($table, $value);
170
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  }
172
  endif;
168
  $table = $this->getBVTable($name);
169
  return $wpdb->replace($table, $value);
170
  }
171
+
172
+ public function tinfo($name) {
173
+ $result = array();
174
+ $table = $this->getBVTable($name);
175
+
176
+ $result['name'] = $table;
177
+
178
+ if ($this->isTablePresent($table)) {
179
+ $result['exists'] = true;
180
+ $result['createquery'] = $this->showTableCreate($table);
181
+ }
182
+
183
+ return $result;
184
+ }
185
+
186
+ public function getMysqlVersion() {
187
+ global $wpdb;
188
+ return $wpdb->db_version();
189
+ }
190
  }
191
  endif;
wp_site_info.php CHANGED
@@ -39,7 +39,7 @@ class MGWPSiteInfo {
39
  return is_main_site();
40
  }
41
 
42
- public function respInfo() {
43
  $info = array();
44
  $this->basic($info);
45
  $info['dbsig'] = $this->dbsig(false);
@@ -51,12 +51,18 @@ class MGWPSiteInfo {
51
  $info['wpurl'] = $this->wpurl();
52
  $info['siteurl'] = $this->siteurl();
53
  $info['homeurl'] = $this->homeurl();
54
- $info['serverip'] = $_SERVER['SERVER_ADDR'];
 
 
55
  $info['abspath'] = ABSPATH;
56
  }
57
 
58
  public function serversig($full = false) {
59
- $sig = sha1($_SERVER['SERVER_ADDR'].ABSPATH);
 
 
 
 
60
  if ($full)
61
  return $sig;
62
  else
@@ -75,5 +81,9 @@ class MGWPSiteInfo {
75
  else
76
  return substr($sig, 0, 6);
77
  }
 
 
 
 
78
  }
79
  endif;
39
  return is_main_site();
40
  }
41
 
42
+ public function info() {
43
  $info = array();
44
  $this->basic($info);
45
  $info['dbsig'] = $this->dbsig(false);
51
  $info['wpurl'] = $this->wpurl();
52
  $info['siteurl'] = $this->siteurl();
53
  $info['homeurl'] = $this->homeurl();
54
+ if (array_key_exists('SERVER_ADDR', $_SERVER)) {
55
+ $info['serverip'] = $_SERVER['SERVER_ADDR'];
56
+ }
57
  $info['abspath'] = ABSPATH;
58
  }
59
 
60
  public function serversig($full = false) {
61
+ $sig_param = ABSPATH;
62
+ if (array_key_exists('SERVER_ADDR', $_SERVER)) {
63
+ $sig_param = $_SERVER['SERVER_ADDR'].ABSPATH;
64
+ }
65
+ $sig = sha1($sig_param);
66
  if ($full)
67
  return $sig;
68
  else
81
  else
82
  return substr($sig, 0, 6);
83
  }
84
+
85
+ public static function isCWServer() {
86
+ return isset($_SERVER['cw_allowed_ip']);
87
+ }
88
  }
89
  endif;