WordPress Backup & Security Plugin – BlogVault - Version 1.88

Version Description

  • Handling translations
  • Callback improvements
  • Adding delete transient callback
Download this release

Release Info

Developer akshatc
Plugin Icon 128x128 WordPress Backup & Security Plugin – BlogVault
Version 1.88
Comparing to
See all releases

Version 1.88

Files changed (67) hide show
  1. account.php +50 -0
  2. admin.php +184 -0
  3. admin/add_new_acc.php +76 -0
  4. admin/footer.php +20 -0
  5. admin/header.php +27 -0
  6. admin/main_page.php +38 -0
  7. admin/top_box.php +21 -0
  8. blogvault.php +97 -0
  9. callback.php +251 -0
  10. callback/recover.php +76 -0
  11. callback/response.php +107 -0
  12. callback/streams.php +166 -0
  13. callback/wings/account.php +34 -0
  14. callback/wings/auth.php +26 -0
  15. callback/wings/brand.php +48 -0
  16. callback/wings/bv_upgrader_skin.php +68 -0
  17. callback/wings/db.php +145 -0
  18. callback/wings/dynsync.php +81 -0
  19. callback/wings/fs.php +258 -0
  20. callback/wings/fw.php +34 -0
  21. callback/wings/info.php +292 -0
  22. callback/wings/ipstore.php +116 -0
  23. callback/wings/lp.php +72 -0
  24. callback/wings/manage.php +516 -0
  25. callback/wings/misc.php +71 -0
  26. callback/wings/monit.php +77 -0
  27. callback/wings/protect.php +62 -0
  28. css/bvmui.min.css +1 -0
  29. css/bvplugin.min.css +1 -0
  30. dynsync.php +576 -0
  31. fw/config.php +66 -0
  32. fw/fw.php +280 -0
  33. fw/request.php +295 -0
  34. img/adobe-logo.png +0 -0
  35. img/as_seen_in.png +0 -0
  36. img/bv.png +0 -0
  37. img/bv_badge.png +0 -0
  38. img/bv_for_free.jpg +0 -0
  39. img/bvlogo.png +0 -0
  40. img/cloudways-logo.png +0 -0
  41. img/icon.png +0 -0
  42. img/intel-logo.png +0 -0
  43. img/liquid-web.png +0 -0
  44. img/lock.png +0 -0
  45. img/malcare-wordpress-security.png +0 -0
  46. img/mclogo.png +0 -0
  47. img/pressable-logo.png +0 -0
  48. img/sap-logo.png +0 -0
  49. img/testimonial_bv.png +0 -0
  50. img/testimonial_mc.png +0 -0
  51. img/valet-logo.png +0 -0
  52. img/wp-engine-logo.png +0 -0
  53. img/wp-site-care-logo.png +0 -0
  54. img/yoast-logo.png +0 -0
  55. ipstore.php +97 -0
  56. license.txt +385 -0
  57. logger.php +24 -0
  58. lp/config.php +80 -0
  59. lp/lp.php +248 -0
  60. main.php +167 -0
  61. main/auth.php +106 -0
  62. main/db.php +166 -0
  63. main/lib.php +44 -0
  64. main/site_info.php +99 -0
  65. protect.php +45 -0
  66. publickeys/bvkey3.pub +14 -0
  67. readme.txt +427 -0
account.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ if (!class_exists('BVAccountInfo')) :
4
+
5
+ class BVAccountInfo {
6
+ public $bvmain;
7
+
8
+ function __construct($bvmain) {
9
+ $this->bvmain = $bvmain;
10
+ }
11
+
12
+ public function add($info) {
13
+ $accounts = $this->allAccounts();
14
+ if(!is_array($accounts)) {
15
+ $accounts = array();
16
+ }
17
+ $pubkey = $info['pubkey'];
18
+ $accounts[$pubkey]['lastbackuptime'] = time();
19
+ $accounts[$pubkey]['url'] = $info['url'];
20
+ $accounts[$pubkey]['email'] = $info['email'];
21
+ $this->update($accounts);
22
+ }
23
+
24
+ public function remove($pubkey) {
25
+ $bvkeys = $this->bvmain->info->getOption('bvkeys');
26
+ $accounts = $this->allAccounts();
27
+ $this->bvmain->auth->rmkeys($pubkey);
28
+ $this->bvmain->setup($this->bvmain->lib->randString(32));
29
+ if ($accounts && is_array($accounts)) {
30
+ unset($accounts[$pubkey]);
31
+ $this->update($accounts);
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+
37
+ public function allAccounts() {
38
+ return $this->bvmain->info->getOption('bvAccounts');
39
+ }
40
+
41
+ public function doesAccountExists($pubkey) {
42
+ $accounts = $this->allAccounts();
43
+ return array_key_exists($pubkey, $accounts);
44
+ }
45
+
46
+ public function update($accounts) {
47
+ $this->bvmain->info->updateOption('bvAccounts', $accounts);
48
+ }
49
+ }
50
+ endif;
admin.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVAdmin')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/account.php';
7
+
8
+ class BVAdmin {
9
+ public $bvmain;
10
+ public $account;
11
+ function __construct($bvmain) {
12
+ $this->bvmain = $bvmain;
13
+ $this->account = new BVAccountInfo($this->bvmain);
14
+ }
15
+
16
+ public function mainUrl($_params = '') {
17
+ if (function_exists('network_admin_url')) {
18
+ return network_admin_url('admin.php?page='.$this->bvmain->plugname.$_params);
19
+ } else {
20
+ return admin_url('admin.php?page='.$this->bvmain->plugname.$_params);
21
+ }
22
+ }
23
+
24
+ public function initHandler() {
25
+ if (!current_user_can('activate_plugins'))
26
+ return;
27
+
28
+ if (array_key_exists('bvnonce', $_REQUEST) &&
29
+ wp_verify_nonce($_REQUEST['bvnonce'], "bvnonce") &&
30
+ array_key_exists('blogvaultkey', $_REQUEST) &&
31
+ (strlen($_REQUEST['blogvaultkey']) == 64) &&
32
+ (array_key_exists('page', $_REQUEST) &&
33
+ $_REQUEST['page'] == $this->bvmain->plugname)) {
34
+ $keys = str_split($_REQUEST['blogvaultkey'], 32);
35
+ $this->bvmain->auth->updateKeys($keys[0], $keys[1]);
36
+ if (array_key_exists('redirect', $_REQUEST)) {
37
+ $location = $_REQUEST['redirect'];
38
+ wp_redirect($this->bvmain->appUrl()."/dash/redir?q=".urlencode($location));
39
+ exit();
40
+ }
41
+ }
42
+ if ($this->bvmain->isActivateRedirectSet()) {
43
+ wp_redirect($this->mainUrl());
44
+ }
45
+ }
46
+
47
+ public function menu() {
48
+ $brand = $this->bvmain->getBrandInfo();
49
+ if (!$brand || (!array_key_exists('hide', $brand) && !array_key_exists('hide_from_menu', $brand))) {
50
+ $bname = $this->bvmain->getBrandName();
51
+ add_menu_page($bname, $bname, 'manage_options', $this->bvmain->plugname,
52
+ array($this, 'adminPage'), plugins_url('img/icon.png', __FILE__ ));
53
+ }
54
+ }
55
+
56
+ public function hidePluginDetails($plugin_metas, $slug) {
57
+ $brand = $this->bvmain->getBrandInfo();
58
+ $bvslug = $this->bvmain->slug;
59
+
60
+ if ($slug === $bvslug && $brand && array_key_exists('hide_plugin_details', $brand)){
61
+ foreach ($plugin_metas as $pluginKey => $pluginValue) {
62
+ if (strpos($pluginValue, sprintf('>%s<', translate('View details')))) {
63
+ unset($plugin_metas[$pluginKey]);
64
+ break;
65
+ }
66
+ }
67
+ }
68
+ return $plugin_metas;
69
+ }
70
+
71
+ public function settingsLink($links, $file) {
72
+ #XNOTE: Fix this
73
+ if ( $file == plugin_basename( dirname(__FILE__).'/blogvault.php' ) ) {
74
+ $brand = $this->bvmain->getBrandInfo();
75
+ if (!$brand || !array_key_exists('hide_plugin_details', $brand)) {
76
+ $links[] = '<a href="'.$this->mainUrl().'">'.__( 'Settings' ).'</a>';
77
+ }
78
+ }
79
+ return $links;
80
+ }
81
+
82
+ public function getPluginLogo() {
83
+ $brand = $this->bvmain->getBrandInfo();
84
+ if ($brand && array_key_exists('logo', $brand)) {
85
+ return $brand['logo'];
86
+ }
87
+ return $this->bvmain->logo;
88
+ }
89
+
90
+ public function getWebPage() {
91
+ $brand = $this->bvmain->getBrandInfo();
92
+ if ($brand && array_key_exists('webpage', $brand)) {
93
+ return $brand['webpage'];
94
+ }
95
+ return $this->bvmain->webpage;
96
+ }
97
+
98
+ public function siteInfoTags() {
99
+ $bvnonce = wp_create_nonce("bvnonce");
100
+ $secret = $this->bvmain->auth->defaultSecret();
101
+ $tags = "<input type='hidden' name='url' value='".$this->bvmain->info->wpurl()."'/>\n".
102
+ "<input type='hidden' name='homeurl' value='".$this->bvmain->info->homeurl()."'/>\n".
103
+ "<input type='hidden' name='siteurl' value='".$this->bvmain->info->siteurl()."'/>\n".
104
+ "<input type='hidden' name='dbsig' value='".$this->bvmain->lib->dbsig(false)."'/>\n".
105
+ "<input type='hidden' name='plug' value='".$this->bvmain->plugname."'/>\n".
106
+ "<input type='hidden' name='adminurl' value='".$this->mainUrl()."'/>\n".
107
+ "<input type='hidden' name='bvversion' value='".$this->bvmain->version."'/>\n".
108
+ "<input type='hidden' name='serverip' value='".$_SERVER["SERVER_ADDR"]."'/>\n".
109
+ "<input type='hidden' name='abspath' value='".ABSPATH."'/>\n".
110
+ "<input type='hidden' name='secret' value='".$secret."'/>\n".
111
+ "<input type='hidden' name='bvnonce' value='".$bvnonce."'/>\n";
112
+ return $tags;
113
+ }
114
+
115
+ public function activateWarning() {
116
+ global $hook_suffix;
117
+ if (!$this->bvmain->isConfigured() && $hook_suffix == 'index.php' ) {
118
+ ?>
119
+ <div id="message" class="updated" style="padding: 8px; font-size: 16px; background-color: #dff0d8">
120
+ <a class="button-primary" href="<?php echo $this->mainUrl(); ?>">Activate BlogVault</a>
121
+ &nbsp;&nbsp;&nbsp;<b>Almost Done:</b> Activate your BlogVault account to backup & secure your site.
122
+ </div>
123
+ <?php
124
+ }
125
+ }
126
+
127
+ public function isConfigured() {
128
+ $accounts = $this->account->allAccounts();
129
+ return (is_array($accounts) && sizeof($accounts) >= 1);
130
+ }
131
+
132
+ public function adminPage() {
133
+ wp_enqueue_style( 'bvsurface', plugins_url('css/bvmui.min.css', __FILE__));
134
+ wp_enqueue_style( 'bvplugin', plugins_url('css/bvplugin.min.css', __FILE__));
135
+ if (isset($_REQUEST['bvnonce']) && wp_verify_nonce( $_REQUEST['bvnonce'], 'bvnonce' )) {
136
+ $this->account->remove($_REQUEST['pubkey']);
137
+ }
138
+ require_once dirname( __FILE__ ) . '/admin/header.php';
139
+ if ($this->isConfigured()) {
140
+ if (!isset($_REQUEST['add_account'])) {
141
+ require_once dirname( __FILE__ ) . '/admin/main_page.php';
142
+ } else {
143
+ require_once dirname( __FILE__ ) . '/admin/add_new_acc.php';
144
+ }
145
+ } else {
146
+ require_once dirname( __FILE__ ) . '/admin/add_new_acc.php';
147
+ }
148
+ require_once dirname( __FILE__ ) . '/admin/footer.php';
149
+ }
150
+
151
+ public function initBranding($plugins) {
152
+ $slug = $this->bvmain->slug;
153
+ $brand = $this->bvmain->getBrandInfo();
154
+ if ($brand) {
155
+ if (array_key_exists('hide', $brand)) {
156
+ unset($plugins[$slug]);
157
+ } else {
158
+ if (array_key_exists('name', $brand)) {
159
+ $plugins[$slug]['Name'] = $brand['name'];
160
+ }
161
+ if (array_key_exists('title', $brand)) {
162
+ $plugins[$slug]['Title'] = $brand['title'];
163
+ }
164
+ if (array_key_exists('description', $brand)) {
165
+ $plugins[$slug]['Description'] = $brand['description'];
166
+ }
167
+ if (array_key_exists('authoruri', $brand)) {
168
+ $plugins[$slug]['AuthorURI'] = $brand['authoruri'];
169
+ }
170
+ if (array_key_exists('author', $brand)) {
171
+ $plugins[$slug]['Author'] = $brand['author'];
172
+ }
173
+ if (array_key_exists('authorname', $brand)) {
174
+ $plugins[$slug]['AuthorName'] = $brand['authorname'];
175
+ }
176
+ if (array_key_exists('pluginuri', $brand)) {
177
+ $plugins[$slug]['PluginURI'] = $brand['pluginuri'];
178
+ }
179
+ }
180
+ }
181
+ return $plugins;
182
+ }
183
+ }
184
+ endif;
admin/add_new_acc.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->bvmain->isMalcare()) {
3
+ $signupFormTitle = "Let's scan your website";
4
+ $signupPurpose = array("Malware Scan", "Malware Clean", "Firewall", "Login Protection", "Others");
5
+ $signupButtonText = "Scan Site";
6
+ $signupButtonColor = "#4686f5";
7
+ } else {
8
+ $signupFormTitle = "Let's get your FREE Backup";
9
+ $signupPurpose = array("Backup", "Staging", "Restore", "Migrate", "Manage", "Others");
10
+ $signupButtonText = "Get started";
11
+ $signupButtonColor = "#25bea0";
12
+ }
13
+ ?>
14
+ <div id="content-wrapper" style="width: 99%">
15
+ <div class="mui-container-fluid" style="padding: 0px;">
16
+ <div class="mui-col-md-10" style="padding-left: 0px;">
17
+ <br>
18
+ <div class="bv-box" style="padding-top: 10px; padding-bottom: 10px;">
19
+ <?php require_once dirname( __FILE__ ) . "/top_box.php";?>
20
+ </div>
21
+ <div class="mui-panel new-account-panel">
22
+ <form dummy=">" action="<?php echo $this->bvmain->appUrl(); ?>/plugin/bvstart" style="padding-top:10px; margin: 0px;" onsubmit="document.getElementById('get-started').disabled = true;" method="post" name="signup">
23
+ <div style="width: 800px; margin: 0 auto; padding: 10px;">
24
+ <div class="mui--text-title form-title"><?php echo $signupFormTitle; ?></div>
25
+ <input type='hidden' name='bvsrc' value='wpplugin' />
26
+ <?php echo $this->siteInfoTags(); ?>
27
+ <input type="text" class="bv-input" id="email" name="email" style="width:430px;" placeholder="Enter your email" required>
28
+ <select name="purpose" class="bv-input select-purpose" required>
29
+ <option value="" hidden>Looking for?</option>
30
+ <?php
31
+ foreach($signupPurpose as $value) {
32
+ echo "<option value='".$value."'>".$value."</option>";
33
+ }
34
+ ?>
35
+ </select>
36
+ <button id="get-started" class="mui-btn mui-btn--raised mui-btn--primaryi get-started-button" type="submit" style="background: <?php echo $signupButtonColor; ?>;"><?php echo $signupButtonText; ?></button><br/>
37
+ <input type="checkbox" name="consent" value="1" required/>I agree to Blogvault <a href="https://www.blogvault.net/tos" target="_blank" rel="noopener noreferrer">Terms of Service</a> and <a href="https://www.blogvault.net/privacy" target="_blank" rel="noopener noreferrer">Privacy Policy</a>
38
+ </div>
39
+ </form>
40
+ <br/>
41
+ </div>
42
+ </div>
43
+ <div class="mui-col-md-2 side">
44
+ <?php if ($this->bvmain->isBlogvault()) { ?>
45
+ <div class="side-box" style="margin: 0px !important;">
46
+ <h2 class="side-box-title">Why choose BlogVault ?</h2>
47
+ <strong>
48
+ <ul>
49
+ <li><span class="bv-tick">&#10003;</span> 100% Working Backups</li>
50
+ <li><span class="bv-tick">&#10003;</span> FREE Staging Site</li>
51
+ <li><span class="bv-tick">&#10003;</span> Fastest Website Recovery</li>
52
+ <li><span class="bv-tick">&#10003;</span> Flawless 1-Click Migrations</li>
53
+ <li><span class="bv-tick">&#10003;</span> WooCommerce Backups</li>
54
+ <li><span class="bv-tick">&#10003;</span> Doesn't slow website ever</li>
55
+ <li><span class="bv-tick">&#10003;</span> Full Website Management</li>
56
+ </ul>
57
+ </strong>
58
+ </div>
59
+ <div class="side-box" style="margin-top: 20px; overflow: hidden;">
60
+ <h2 class="side-box-title">What's in BlogVault Pro?</h2>
61
+ <strong>
62
+ <ul>
63
+ <li><span class="bv-tick">&#10003;</span> Daily Automatic Backups</li>
64
+ <li><span class="bv-tick">&#10003;</span> Real-Time backups</li>
65
+ <li><span class="bv-tick">&#10003;</span> Personalized Support</li>
66
+ <li><span class="bv-tick">&#10003;</span> Add Users and Clients</li>
67
+ <li><span class="bv-tick">&#10003;</span> White Label Plugin</li>
68
+ <li><span class="bv-tick">&#10003;</span> Client Reporting</li>
69
+ </ul>
70
+ </strong>
71
+ <div class="bv-upgrade-button"><a href="https://blogvault.net/pricing/?utm_source=bv_plugin_lp_pricing&utm_medium=lp_upgrade&utm_campaign=bv_plugin_lp_upgrade&utm_term=upgrade_button&utm_content=button_link">Get Me Pro &raquo;</a></span>
72
+ </div>
73
+ </div>
74
+ <?php } ?>
75
+ </div>
76
+ </div>
admin/footer.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <footer>
2
+ <div style="background: #45b3e0; margin-top: 20px; padding-top:10px;">
3
+ <div style="width: 850px; margin: 0 auto;">
4
+ <span class="footer-logo" style="color: #FFF; padding: 10px; display: inline-block; font-weight: bold; font-size: 28px; margin-top: 26px; float: left;"> Trusted By </span>
5
+ <span class="footer-logo"><img src="<?php echo plugins_url("/../img/adobe-logo.png", __FILE__); ?>" style="height: 36px; margin-left: 70px;"/></span>
6
+ <span class="footer-logo"><img src="<?php echo plugins_url("/../img/intel-logo.png", __FILE__); ?>" style="height: 38px;" /></span>
7
+ <span class="footer-logo"><img src="<?php echo plugins_url("/../img/wp-site-care-logo.png", __FILE__); ?>" style="height: 32px;" /></span>
8
+ <span class="footer-logo"><img src="<?php echo plugins_url("/../img/valet-logo.png", __FILE__); ?>" style="height: 42px;" /></span>
9
+ <span><img src="<?php echo plugins_url("/../img/yoast-logo.png", __FILE__); ?>" style="height: 32px;" /></span>
10
+ </div>
11
+ </div>
12
+ <div style="background: #45b3e0;">
13
+ <div style="width: 850px; margin: 0 auto;">
14
+ <span class="footer-logo"><img src="<?php echo plugins_url("/../img/cloudways-logo.png", __FILE__); ?>" style="height: 48px; margin-bottom: 10px;" /></span>
15
+ <span class="footer-logo"><img src="<?php echo plugins_url("/../img/wp-engine-logo.png", __FILE__); ?>"/></span>
16
+ <span class="footer-logo"><img src="<?php echo plugins_url("/../img/liquid-web.png", __FILE__); ?>" /></span>
17
+ <span><img src="<?php echo plugins_url("/../img/pressable-logo.png", __FILE__); ?>" /></span>
18
+ </div>
19
+ </div>
20
+ </footer>
admin/header.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->bvmain->isMalcare()) {
3
+ $headerColor = "#4686f5";
4
+ $pluginSlug = "malcare-security";
5
+ $headerLogoLink = $this->getWebPage() . "/?utm_source=mc_plugin_lp_logo&utm_medium=logo_link&utm_campaign=mc_plugin_lp_header&utm_term=header_logo&utm_content=image_link";
6
+ } else {
7
+ $headerColor = "#25bea0";
8
+ $pluginSlug = "blogvault-real-time-backup";
9
+ $headerLogoLink = $this->getWebPage() . "/?utm_source=bv_plugin_lp_logo&utm_medium=logo_link&utm_campaign=bv_plugin_lp_header&utm_term=header_logo&utm_content=image_link";
10
+ }
11
+ ?>
12
+ <div id="content-wrapper" style="width: 99%;">
13
+ <!-- Content HTML goes here -->
14
+ <div class="mui-container-fluid">
15
+ <div class="mui--appbar-height"></div>
16
+ <br><br>
17
+ <div class="mui-row">
18
+ <div style="background: <?php echo $headerColor;?>; overflow: hidden;">
19
+ <a href="<?php echo $headerLogoLink; ?>"><img src="<?php echo plugins_url($this->getPluginLogo(), __FILE__); ?>" style="padding: 10px;"></a>
20
+ <div class="top-links">
21
+ <span class="bv-top-button"><a href="https://wordpress.org/support/plugin/<?php echo $pluginSlug; ?>/reviews/#new-post">Leave a Review</a></span>
22
+ <span class="bv-top-button"><a href="https://wordpress.org/support/plugin/<?php echo $pluginSlug; ?>/">Need Help?</a></span>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </div>
admin/main_page.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="content-wrapper">
2
+ <div class="bv-box" style= "width: 800px; margin: 20px auto; overflow: hidden; padding: 15px;">
3
+ <?php require_once dirname( __FILE__ ) . "/top_box.php";?>
4
+ </div>
5
+ <div class="mui-container-fluid">
6
+ <?php $accounts = $this->account->allAccounts();?>
7
+ <div class="mui-panel" style="width:800px; margin:0 auto;border:1px solid #CCC;">
8
+ <div class="mui--text-body1" style="text-align:center;font-size:18px;">Accounts associated with this website.</div><br/>
9
+ <table cellpadding="10" style="width:700px; margin:0 auto;border:1px solid black;">
10
+ <tr style="text-align:center;font-size:15px;border: 1px solid black;"> <th> Account Email</th><th>Last Synced At</th><th></th></tr>
11
+ <?php
12
+ $nonce = wp_create_nonce( 'bvnonce' );
13
+ foreach($accounts as $key => $value){
14
+ ?>
15
+ <form dummy=">" action="" style="padding:0 2% 2em 1%;" method="post">
16
+ <input type='hidden' name='bvnonce' value="<?php echo $nonce ?>" />
17
+ <input type='hidden' name='pubkey' value="<?php echo $key ?>" />
18
+ <tr style="text-align:center;font-size:15px;border: 1px solid black;">
19
+ <td >
20
+ <?php echo $value['email'] ?>
21
+ </td>
22
+ <td>
23
+ <?php echo date('Y-m-d H:i:s', $value['lastbackuptime']); ?>
24
+ </td>
25
+ <td >
26
+ <input type='submit' class="button-primary" value='Disconnect' name='disconnect'>
27
+ </td>
28
+ </tr>
29
+ </form>
30
+ <?php } ?>
31
+ </table>
32
+ <div class="mui-col-md-12 mui-col-md-offset-3" style="padding-top:2%;">
33
+ <a class="mui-btn mui-btn--raised mui-btn--primary" href=<?php echo $this->bvmain->appUrl(); ?> target="_blank">Visit Dashboard</a>
34
+ <a class="mui-btn mui-btn--raised mui-btn--primary" href=<?php echo $this->mainUrl('&add_account=true'); ?> >Connect New Account</a>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
admin/top_box.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->bvmain->isMalcare()) {
3
+ $mainTitle = "Are you Hacked? Scan Your Website for FREE.";
4
+ $videoId = "rBuYh2dIadk";
5
+ $testimonialImg = "/../img/testimonial_mc.png";
6
+ } else {
7
+ $mainTitle = "Create Smart Incremental Backups On Cloud.";
8
+ $videoId = "Y4teDRL08mY";
9
+ $testimonialImg = "/../img/testimonial_bv.png";
10
+ }
11
+ ?>
12
+ <div class="mui--text-title main-title"><?php echo $mainTitle; ?></div>
13
+ <br/><br/>
14
+ <div style= "width: 800px; margin: 20px auto; overflow: hidden;">
15
+ <div style="width: 49%; float: left; border-right: 2px solid #333;">
16
+ <iframe width="380" height="215" src="https://www.youtube.com/embed/<?php echo $videoId; ?>"></iframe>
17
+ </div>
18
+ <div style="width: 49%; float: right;">
19
+ <img src="<?php echo plugins_url($testimonialImg, __FILE__); ?>"/>
20
+ </div>
21
+ </div>
blogvault.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WordPress Backup & Security Plugin - BlogVault
4
+ Plugin URI: https://blogvault.net
5
+ Description: Easiest way to backup & secure your WordPress site
6
+ Author: Backup by BlogVault
7
+ Author URI: https://blogvault.net
8
+ Version: 1.88
9
+ Network: True
10
+ */
11
+
12
+ /* Copyright 2017 BlogVault (email : support@blogvault.net)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
+ */
27
+
28
+ /* Global response array */
29
+
30
+ if (!defined('ABSPATH')) exit;
31
+ global $bvcb, $bvresp;
32
+
33
+ require_once dirname( __FILE__ ) . '/main.php';
34
+ $bvmain = new BVBackup();
35
+
36
+ register_uninstall_hook(__FILE__, array('BVBackup', 'uninstall'));
37
+ register_activation_hook(__FILE__, array($bvmain, 'activate'));
38
+ register_deactivation_hook(__FILE__, array($bvmain, 'deactivate'));
39
+
40
+ add_action('wp_footer', array($bvmain, 'footerHandler'), 100);
41
+
42
+ if (is_admin()) {
43
+ require_once dirname( __FILE__ ) . '/admin.php';
44
+ $bvadmin = new BVAdmin($bvmain);
45
+ add_action('admin_init', array($bvadmin, 'initHandler'));
46
+ add_filter('all_plugins', array($bvadmin, 'initBranding'));
47
+ add_filter('plugin_row_meta', array($bvadmin, 'hidePluginDetails'), 10, 2);
48
+ if ($bvmain->info->isMultisite()) {
49
+ add_action('network_admin_menu', array($bvadmin, 'menu'));
50
+ } else {
51
+ add_action('admin_menu', array($bvadmin, 'menu'));
52
+ }
53
+ add_filter('plugin_action_links', array($bvadmin, 'settingsLink'), 10, 2);
54
+ add_action('admin_notices', array($bvadmin, 'activateWarning'));
55
+ ##ADMINENQUEUESCRIPTS##
56
+ }
57
+
58
+ if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) {
59
+ $_REQUEST = array_merge($_GET, $_POST);
60
+ }
61
+
62
+ if ((array_key_exists('bvplugname', $_REQUEST)) &&
63
+ stristr($_REQUEST['bvplugname'], $bvmain->plugname)) {
64
+ require_once dirname( __FILE__ ) . '/callback.php';
65
+ $bvcb = new BVCallback($bvmain);
66
+ $bvresp = new BVResponse();
67
+ if ($bvcb->preauth() === 1) {
68
+ if ($bvcb->authenticate() === 1) {
69
+ if (array_key_exists('afterload', $_REQUEST)) {
70
+ add_action('wp_loaded', array($bvcb, 'execute'));
71
+ } else if (array_key_exists('adajx', $_REQUEST)) {
72
+ add_action('wp_ajax_bvadm', array($bvcb, 'bvAdmExecuteWithUser'));
73
+ add_action('wp_ajax_nopriv_bvadm', array($bvcb, 'bvAdmExecuteWithoutUser'));
74
+ } else {
75
+ $bvcb->execute();
76
+ }
77
+ } else {
78
+ $bvcb->terminate(false, array_key_exists('bvdbg', $_REQUEST));
79
+ }
80
+ }
81
+ } else {
82
+ if ($bvmain->isProtectModuleEnabled()) {
83
+ require_once dirname( __FILE__ ) . '/protect.php';
84
+ $bvprotect = new BVProtect($bvmain);
85
+ $bvprotect->init();
86
+ require_once dirname( __FILE__ ) . '/ipstore.php';
87
+ $bvipstore = new BVIPStore($bvmain);
88
+ $bvipstore->init();
89
+ }
90
+
91
+ if ($bvmain->isDynSyncModuleEnabled()) {
92
+ require_once dirname( __FILE__ ) . '/dynsync.php';
93
+ $dynsync = new BVDynSync($bvmain);
94
+ $dynsync->init();
95
+ }
96
+
97
+ }
callback.php ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVCallback')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/callback/response.php';
7
+
8
+ class BVCallback {
9
+ public $bvmain;
10
+ function __construct($bvmain) {
11
+ $this->bvmain = $bvmain;
12
+ }
13
+
14
+ public function serversig($full = false) {
15
+ $sig = sha1($_SERVER['SERVER_ADDR'].ABSPATH);
16
+ if ($full)
17
+ return $sig;
18
+ else
19
+ return substr($sig, 0, 6);
20
+ }
21
+
22
+ public function terminate($with_basic, $bvdebug = false) {
23
+ global $bvresp;
24
+ $public = $this->bvmain->auth->defaultPublic();
25
+ $bvresp->addStatus("signature", "Blogvault API");
26
+ $bvresp->addStatus("asymauth", "true");
27
+ $bvresp->addStatus("sha1", "true");
28
+ $bvresp->addStatus("dbsig", $this->bvmain->lib->dbsig(false));
29
+ $bvresp->addStatus("serversig", $this->serversig(false));
30
+ $bvresp->addStatus("public", substr($public, 0, 6));
31
+ if (array_key_exists('adajx', $_REQUEST)) {
32
+ $bvresp->addStatus("adajx", true);
33
+ }
34
+ if ($with_basic) {
35
+ $binfo = array();
36
+ $this->bvmain->info->basic($binfo);
37
+ $bvresp->addStatus("basic", $binfo);
38
+ $bvresp->addStatus("bvversion", $this->bvmain->version);
39
+ }
40
+
41
+ if ($bvdebug) {
42
+ $bvresp->addStatus("inreq", $_REQUEST);
43
+ }
44
+
45
+ $bvresp->finish();
46
+ exit;
47
+ }
48
+
49
+ public function processParams() {
50
+ if (array_key_exists('concat', $_REQUEST)) {
51
+ foreach ($_REQUEST['concat'] as $key) {
52
+ $concated = '';
53
+ $count = intval($_REQUEST[$key]);
54
+ for ($i = 1; $i <= $count; $i++) {
55
+ $concated .= $_REQUEST[$key."_bv_".$i];
56
+ }
57
+ $_REQUEST[$key] = $concated;
58
+ }
59
+ }
60
+ if (array_key_exists('b64', $_REQUEST)) {
61
+ foreach ($_REQUEST['b64'] as $key) {
62
+ if (is_array($_REQUEST[$key])) {
63
+ $_REQUEST[$key] = array_map('base64_decode', $_REQUEST[$key]);
64
+ } else {
65
+ $_REQUEST[$key] = base64_decode($_REQUEST[$key]);
66
+ }
67
+ }
68
+ }
69
+ if (array_key_exists('unser', $_REQUEST)) {
70
+ foreach ($_REQUEST['unser'] as $key) {
71
+ $_REQUEST[$key] = json_decode($_REQUEST[$key], TRUE);
72
+ }
73
+ }
74
+ if (array_key_exists('b642', $_REQUEST)) {
75
+ foreach ($_REQUEST['b642'] as $key) {
76
+ if (is_array($_REQUEST[$key])) {
77
+ $_REQUEST[$key] = array_map('base64_decode', $_REQUEST[$key]);
78
+ } else {
79
+ $_REQUEST[$key] = base64_decode($_REQUEST[$key]);
80
+ }
81
+ }
82
+ }
83
+ if (array_key_exists('dic', $_REQUEST)) {
84
+ foreach ($_REQUEST['dic'] as $key => $mkey) {
85
+ $_REQUEST[$mkey] = $_REQUEST[$key];
86
+ unset($_REQUEST[$key]);
87
+ }
88
+ }
89
+ if (array_key_exists('clacts', $_REQUEST)) {
90
+ foreach ($_REQUEST['clacts'] as $action) {
91
+ remove_all_actions($action);
92
+ }
93
+ }
94
+ if (array_key_exists('clallacts', $_REQUEST)) {
95
+ global $wp_filter;
96
+ foreach ( $wp_filter as $filter => $val ){
97
+ remove_all_actions($filter);
98
+ }
99
+ }
100
+ if (array_key_exists('memset', $_REQUEST)) {
101
+ $val = intval(urldecode($_REQUEST['memset']));
102
+ @ini_set('memory_limit', $val.'M');
103
+ }
104
+ }
105
+
106
+ public function recover() {
107
+ $recover = new BVRecover(base64_decode($_REQUEST['sig']), $_REQUEST['orig'],
108
+ $_REQUEST['keyname'], $_REQUEST["keysize"]);
109
+ if ($recover->validate() && ($recover->process() === 1)) {
110
+ $recover->processKeyExchange();
111
+ return 1;
112
+ }
113
+ return false;
114
+ }
115
+
116
+ public function preauth() {
117
+ global $bvresp;
118
+ if (array_key_exists('obend', $_REQUEST) && function_exists('ob_end_clean'))
119
+ @ob_end_clean();
120
+ if (array_key_exists('op_reset', $_REQUEST) && function_exists('output_reset_rewrite_vars'))
121
+ @output_reset_rewrite_vars();
122
+ if (array_key_exists('binhead', $_REQUEST)) {
123
+ header("Content-type: application/binary");
124
+ header('Content-Transfer-Encoding: binary');
125
+ }
126
+ if (array_key_exists('bvrcvr', $_REQUEST)) {
127
+ require_once dirname( __FILE__ ) . '/callback/recover.php';
128
+ if ($this->recover() !== 1) {
129
+ $bvresp->addStatus("statusmsg", 'failed authentication');
130
+ }
131
+ $this->terminate(false, array_key_exists('bvdbg', $_REQUEST));
132
+ return false;
133
+ }
134
+ return 1;
135
+ }
136
+
137
+ public function authenticate() {
138
+ global $bvresp;
139
+ $auth = $this->bvmain->auth;
140
+ $method = $_REQUEST['bvMethod'];
141
+ $time = intval($_REQUEST['bvTime']);
142
+ $version = $_REQUEST['bvVersion'];
143
+ $sig = $_REQUEST['sig'];
144
+ $public = $auth->publicParam();
145
+
146
+ $bvresp->addStatus("requestedsig", $sig);
147
+ $bvresp->addStatus("requestedtime", $time);
148
+ $bvresp->addStatus("requestedversion", $version);
149
+
150
+ $sig_match = $auth->validate($public, $method, $time, $version, $sig);
151
+ if ($sig_match === 1) {
152
+ return 1;
153
+ } else {
154
+ $bvresp->addStatus("sigmatch", substr($sig_match, 0, 6));
155
+ $bvresp->addStatus("statusmsg", 'failed authentication');
156
+ return false;
157
+ }
158
+ }
159
+
160
+ public function route($wing, $method) {
161
+ global $bvresp;
162
+ $bvresp->addStatus("callback", $method);
163
+ switch ($wing) {
164
+ case 'manage':
165
+ require_once dirname( __FILE__ ) . '/callback/wings/manage.php';
166
+ $module = new BVManageCallback();
167
+ break;
168
+ case 'fs':
169
+ require_once dirname( __FILE__ ) . '/callback/wings/fs.php';
170
+ $module = new BVFSCallback();
171
+ break;
172
+ case 'db':
173
+ require_once dirname( __FILE__ ) . '/callback/wings/db.php';
174
+ $module = new BVDBCallback();
175
+ break;
176
+ case 'info':
177
+ require_once dirname( __FILE__ ) . '/callback/wings/info.php';
178
+ $module = new BVInfoCallback();
179
+ break;
180
+ case 'dynsync':
181
+ require_once dirname( __FILE__ ) . '/callback/wings/dynsync.php';
182
+ $module = new BVDynSyncCallback();
183
+ break;
184
+ case 'ipstr':
185
+ require_once dirname( __FILE__ ) . '/callback/wings/ipstore.php';
186
+ $module = new BVIPStoreCallback();
187
+ break;
188
+ case 'auth':
189
+ require_once dirname( __FILE__ ) . '/callback/wings/auth.php';
190
+ $module = new BVAuthCallback();
191
+ break;
192
+ case 'fw':
193
+ require_once dirname( __FILE__ ) . '/callback/wings/fw.php';
194
+ $module = new BVFirewallCallback();
195
+ break;
196
+ case 'lp':
197
+ require_once dirname( __FILE__ ) . '/callback/wings/lp.php';
198
+ $module = new BVLoginProtectCallback();
199
+ break;
200
+ case 'monit':
201
+ require_once dirname( __FILE__ ) . '/callback/wings/monit.php';
202
+ $module = new BVMonitCallback();
203
+ break;
204
+ case 'brand':
205
+ require_once dirname( __FILE__ ) . '/callback/wings/brand.php';
206
+ $module = new BVBrandCallback();
207
+ break;
208
+ case 'pt':
209
+ require_once dirname( __FILE__ ) . '/callback/wings/protect.php';
210
+ $module = new BVProtectCallback();
211
+ break;
212
+ case 'act':
213
+ require_once dirname( __FILE__ ) . '/callback/wings/account.php';
214
+ $module = new BVAccountCallback();
215
+ break;
216
+ default:
217
+ require_once dirname( __FILE__ ) . '/callback/wings/misc.php';
218
+ $module = new BVMiscCallback();
219
+ break;
220
+ }
221
+ $rval = $module->process($method);
222
+ if ($rval === false) {
223
+ $bvresp->addStatus("statusmsg", "Bad Command");
224
+ $bvresp->addStatus("status", false);
225
+ }
226
+ return 1;
227
+ }
228
+
229
+ public function bvAdmExecuteWithoutUser() {
230
+ global $bvresp;
231
+ $bvresp->addStatus("bvadmwithoutuser", true);
232
+ $this->execute();
233
+ }
234
+
235
+ public function bvAdmExecuteWithUser() {
236
+ global $bvresp;
237
+ $bvresp->addStatus("bvadmwithuser", true);
238
+ $this->execute();
239
+ }
240
+
241
+ public function execute() {
242
+ global $bvresp;
243
+ $this->processParams();
244
+ if ($bvresp->startStream()) {
245
+ $this->route($_REQUEST['wing'], $_REQUEST['bvMethod']);
246
+ $bvresp->endStream();
247
+ }
248
+ $this->terminate(true, array_key_exists('bvdbg', $_REQUEST));
249
+ }
250
+ }
251
+ endif;
callback/recover.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVRecover')) :
5
+ class BVRecover {
6
+ public $keyname;
7
+ public $keysize;
8
+ public $signature;
9
+ public $original;
10
+
11
+ function __construct($_sig, $_orig, $_keyname, $_keysize) {
12
+ $this->keyname = $_keyname;
13
+ $this->keysize = $_keysize;
14
+ $this->signature = $_sig;
15
+ $this->original = $_orig;
16
+ }
17
+
18
+ public function keyFile() {
19
+ return dirname(__DIR__)."/publickeys/$this->keyname.pub";
20
+ }
21
+
22
+ public function getAsymKey() {
23
+ return file_get_contents($this->keyFile());
24
+ }
25
+
26
+ public function asymEncrypt($source) {
27
+ $output = '';
28
+ $blocksize = 1 + floor(($this->keysize - 1) / 8) - 11;
29
+ while ($source) {
30
+ $input = substr($source, 0, $blocksize);
31
+ $source = substr($source, $blocksize);
32
+ openssl_public_encrypt($input, $encrypted, $this->getAsymKey());
33
+
34
+ $output .= $encrypted;
35
+ }
36
+ return base64_encode($output);
37
+ }
38
+
39
+ public function validate() {
40
+ global $bvresp;
41
+ if (!preg_match('/^\w+$/', $this->keyname)) {
42
+ $bvresp->addStatus('asymerror', 'badkey');
43
+ return false;
44
+ } else if (!file_exists($this->keyFile())) {
45
+ $bvresp->addStatus('asymerror', 'missingkey');
46
+ return false;
47
+ } else if (!function_exists('openssl_public_decrypt')) {
48
+ $bvresp->addStatus('asymerror', 'openssl_public_decrypt');
49
+ return false;
50
+ } else if (!function_exists('openssl_public_encrypt')) {
51
+ $bvresp->addStatus('asymerror', 'openssl_public_encrypt');
52
+ return false;
53
+ }
54
+ return true;
55
+ }
56
+
57
+ public function process() {
58
+ openssl_public_decrypt($this->signature, $decrypted, $this->getAsymKey());
59
+ if ((strlen($decrypted) >= 32) && ($this->original === substr($decrypted, 0, 32))) {
60
+ return 1;
61
+ }
62
+ return false;
63
+ }
64
+
65
+ public function processKeyExchange() {
66
+ global $bvresp, $bvcb;
67
+ $bvmain = $bvcb->bvmain;
68
+ $keys = $bvmain->auth->allKeys();
69
+ $keys['dbsig'] = $bvmain->lib->dbsig(true);
70
+ $keys['salt'] = $bvmain->lib->randString(32);
71
+ $bvresp->addStatus("activatetime", $bvmain->info->getOption('bvActivateTime'));
72
+ $bvresp->addStatus("currenttime", time());
73
+ $bvresp->addStatus("keys", $this->asymEncrypt(serialize($keys)));
74
+ }
75
+ }
76
+ endif;
callback/response.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVResponse')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/streams.php';
7
+
8
+ class BVResponse {
9
+ public $status;
10
+ public $stream;
11
+
12
+ function __construct() {
13
+ $this->status = array("blogvault" => "response");
14
+ }
15
+
16
+ public function addStatus($key, $value) {
17
+ $this->status[$key] = $value;
18
+ }
19
+
20
+ public function addArrayToStatus($key, $value) {
21
+ if (!isset($this->status[$key])) {
22
+ $this->status[$key] = array();
23
+ }
24
+ $this->status[$key][] = $value;
25
+ }
26
+
27
+ public function base64Encode($data, $chunk_size) {
28
+ if ($chunk_size) {
29
+ $out = "";
30
+ $len = strlen($data);
31
+ for ($i = 0; $i < $len; $i += $chunk_size) {
32
+ $out .= base64_encode(substr($data, $i, $chunk_size));
33
+ }
34
+ } else {
35
+ $out = base64_encode($data);
36
+ }
37
+ return $out;
38
+ }
39
+
40
+ public function finish() {
41
+ $response = "bvbvbvbvbv".serialize($this->status)."bvbvbvbvbv";
42
+ if (array_key_exists('bvb64resp', $_REQUEST)) {
43
+ $chunk_size = array_key_exists('bvb64cksize', $_REQUEST) ? intval($_REQUEST['bvb64cksize']) : false;
44
+ $response = "bvb64bvb64".$this->base64Encode($response, $chunk_size)."bvb64bvb64";
45
+ }
46
+ die($response);
47
+ }
48
+
49
+ public function writeStream($_string) {
50
+ if (strlen($_string) > 0) {
51
+ $chunk = "";
52
+ if (isset($_REQUEST['bvb64stream'])) {
53
+ $chunk_size = array_key_exists('bvb64cksize', $_REQUEST) ? intval($_REQUEST['bvb64cksize']) : false;
54
+ $_string = $this->base64Encode($_string, $chunk_size);
55
+ $chunk .= "BVB64" . ":";
56
+ }
57
+ $chunk .= (strlen($_string) . ":" . $_string);
58
+ if (isset($_REQUEST['checksum'])) {
59
+ if ($_REQUEST['checksum'] == 'crc32') {
60
+ $chunk = "CRC32" . ":" . crc32($_string) . ":" . $chunk;
61
+ } else if ($_REQUEST['checksum'] == 'md5') {
62
+ $chunk = "MD5" . ":" . md5($_string) . ":" . $chunk;
63
+ }
64
+ }
65
+ $this->stream->writeChunk($chunk);
66
+ }
67
+ }
68
+
69
+ public function startStream() {
70
+ global $bvcb;
71
+ $this->stream = new BVRespStream();
72
+ if (array_key_exists('apicall',$_REQUEST)) {
73
+ $this->stream = new BVHttpStream($_REQUEST['apihost'], intval($_REQUEST['apiport']), array_key_exists('apissl', $_REQUEST));
74
+ if (!$this->stream->connect()) {
75
+ $this->addStatus("httperror", "Cannot Open Connection to Host");
76
+ $this->addStatus("streamerrno", $this->stream->errno);
77
+ $this->addStatus("streamerrstr", $this->stream->errstr);
78
+ return false;
79
+ }
80
+ if (array_key_exists('acbmthd', $_REQUEST)) {
81
+ $url = $bvcb->bvmain->authenticatedUrl('/bvapi/'.$_REQUEST['acbmthd'], $_REQUEST['bvapicheck'], false);
82
+ if (array_key_exists('acbqry', $_REQUEST)) {
83
+ $url .= "&".$_REQUEST['acbqry'];
84
+ }
85
+ $this->stream->multipartChunkedPost($url);
86
+ } else {
87
+ $this->addStatus("httperror", "ApiCall method not present");
88
+ return false;
89
+ }
90
+ }
91
+ return true;
92
+ }
93
+
94
+ public function endStream() {
95
+ $this->stream->endStream();
96
+ if (array_key_exists('apicall', $_REQUEST)) {
97
+ $resp = $this->stream->getResponse();
98
+ if (array_key_exists('httperror', $resp)) {
99
+ $this->addStatus("httperror", $resp['httperror']);
100
+ } else {
101
+ $this->addStatus("respstatus", $resp['status']);
102
+ $this->addStatus("respstatus_string", $resp['status_string']);
103
+ }
104
+ }
105
+ }
106
+ }
107
+ endif;
callback/streams.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVRespStream')) :
5
+
6
+ class BVRespStream {
7
+ public function writeChunk($_string) {
8
+ echo "ckckckckck".$_string."ckckckckck";
9
+ }
10
+
11
+ public function endStream() {
12
+ echo "rerererere";
13
+ }
14
+ }
15
+
16
+ class BVHttpStream {
17
+ var $user_agent = 'BVHttpStream';
18
+ var $host;
19
+ var $port;
20
+ var $timeout = 20;
21
+ var $conn;
22
+ var $errno;
23
+ var $errstr;
24
+ var $boundary;
25
+ var $apissl;
26
+
27
+ /**
28
+ * PHP5 constructor.
29
+ */
30
+ function __construct($_host, $_port, $_apissl) {
31
+ $this->host = $_host;
32
+ $this->port = $_port;
33
+ $this->apissl = $_apissl;
34
+ }
35
+
36
+ public function connect() {
37
+ if ($this->apissl && function_exists('stream_socket_client')) {
38
+ $this->conn = stream_socket_client("ssl://".$this->host.":".$this->port, $errno, $errstr, $this->timeout);
39
+ } else {
40
+ $this->conn = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
41
+ }
42
+ if (!$this->conn) {
43
+ $this->errno = $errno;
44
+ $this->errstr = $errstr;
45
+ return false;
46
+ }
47
+ socket_set_timeout($this->conn, $this->timeout);
48
+ return true;
49
+ }
50
+
51
+ public function write($data) {
52
+ fwrite($this->conn, $data);
53
+ }
54
+
55
+ public function sendChunk($data) {
56
+ $this->write(sprintf("%x\r\n", strlen($data)));
57
+ $this->write($data);
58
+ $this->write("\r\n");
59
+ }
60
+
61
+ public function sendRequest($method, $url, $headers = array(), $body = null) {
62
+ $def_hdrs = array("Connection" => "keep-alive",
63
+ "Host" => $this->host);
64
+ $headers = array_merge($def_hdrs, $headers);
65
+ $request = strtoupper($method)." ".$url." HTTP/1.1\r\n";
66
+ if (null != $body) {
67
+ $headers["Content-length"] = strlen($body);
68
+ }
69
+ foreach($headers as $key=>$val) {
70
+ $request .= $key.":".$val."\r\n";
71
+ }
72
+ $request .= "\r\n";
73
+ if (null != $body) {
74
+ $request .= $body;
75
+ }
76
+ $this->write($request);
77
+ return $request;
78
+ }
79
+
80
+ public function post($url, $headers = array(), $body = "") {
81
+ if(is_array($body)) {
82
+ $b = "";
83
+ foreach($body as $key=>$val) {
84
+ $b .= $key."=".urlencode($val)."&";
85
+ }
86
+ $body = substr($b, 0, strlen($b) - 1);
87
+ }
88
+ $this->sendRequest("POST", $url, $headers, $body);
89
+ }
90
+
91
+ public function streamedPost($url, $headers = array()) {
92
+ $headers['Transfer-Encoding'] = "chunked";
93
+ $this->sendRequest("POST", $url, $headers);
94
+ }
95
+
96
+ public function multipartChunkedPost($url) {
97
+ $mph = array(
98
+ "Content-Disposition" => "form-data; name=bvinfile; filename=data",
99
+ "Content-Type" => "application/octet-stream"
100
+ );
101
+ $rnd = rand(100000, 999999);
102
+ $this->boundary = "----".$rnd;
103
+ $prologue = "--".$this->boundary."\r\n";
104
+ foreach($mph as $key=>$val) {
105
+ $prologue .= $key.":".$val."\r\n";
106
+ }
107
+ $prologue .= "\r\n";
108
+ $headers = array('Content-Type' => "multipart/form-data; boundary=".$this->boundary);
109
+ $this->streamedPost($url, $headers);
110
+ $this->sendChunk($prologue);
111
+ }
112
+
113
+ public function writeChunk($data) {
114
+ $this->sendChunk($data);
115
+ }
116
+
117
+ public function closeChunk() {
118
+ $this->sendChunk("");
119
+ }
120
+
121
+ public function endStream() {
122
+ $epilogue = "\r\n\r\n--".$this->boundary."--\r\n";
123
+ $this->sendChunk($epilogue);
124
+ $this->closeChunk();
125
+ }
126
+
127
+ public function getResponse() {
128
+ $response = array();
129
+ $response['headers'] = array();
130
+ $state = 1;
131
+ $conlen = 0;
132
+ stream_set_timeout($this->conn, 300);
133
+ while (!feof($this->conn)) {
134
+ $line = fgets($this->conn, 4096);
135
+ if (1 == $state) {
136
+ if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
137
+ $response['httperror'] = "Status code line invalid: ".htmlentities($line);
138
+ return $response;
139
+ }
140
+ $response['http_version'] = $m[1];
141
+ $response['status'] = $m[2];
142
+ $response['status_string'] = $m[3];
143
+ $state = 2;
144
+ } else if (2 == $state) {
145
+ # End of headers
146
+ if (2 == strlen($line)) {
147
+ if ($conlen > 0)
148
+ $response['body'] = fread($this->conn, $conlen);
149
+ return $response;
150
+ }
151
+ if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) {
152
+ // Skip to the next header
153
+ continue;
154
+ }
155
+ $key = strtolower(trim($m[1]));
156
+ $val = trim($m[2]);
157
+ $response['headers'][$key] = $val;
158
+ if ($key == "content-length") {
159
+ $conlen = intval($val);
160
+ }
161
+ }
162
+ }
163
+ return $response;
164
+ }
165
+ }
166
+ endif;
callback/wings/account.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVAccountCallback')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/../../account.php';
7
+
8
+ class BVAccountCallback {
9
+
10
+ function process($method) {
11
+ global $bvresp, $bvcb;
12
+ $account = new BVAccountInfo($bvcb->bvmain);
13
+ switch ($method) {
14
+ case "updt":
15
+ $info = array();
16
+ $info['email'] = $_REQUEST['email'];
17
+ $info['url'] = $_REQUEST['url'];
18
+ $info['pubkey'] = $_REQUEST['pubkey'];
19
+ $account->add($info);
20
+ $bvresp->addStatus("status", $account->doesAccountExists($_REQUEST['pubkey']));
21
+ break;
22
+ case "disc":
23
+ $account->remove($_REQUEST['pubkey']);
24
+ $bvresp->addStatus("status", !$account->doesAccountExists($_REQUEST['pubkey']));
25
+ case "fetch":
26
+ $bvresp->addStatus("status", $account->allAccounts());
27
+ break;
28
+ default:
29
+ return false;
30
+ }
31
+ return true;
32
+ }
33
+ }
34
+ endif;
callback/wings/auth.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVAuthCallback')) :
5
+ class BVAuthCallback {
6
+
7
+ function process($method) {
8
+ global $bvresp, $bvcb;
9
+ $auth = $bvcb->bvmain->auth;
10
+ switch ($method) {
11
+ case "addkeys":
12
+ $bvresp->addStatus("status", $auth->addKeys($_REQUEST['public'], $_REQUEST['secret']));
13
+ break;
14
+ case "updatekeys":
15
+ $bvresp->addStatus("status", $auth->updateKeys($_REQUEST['public'], $_REQUEST['secret']));
16
+ break;
17
+ case "rmkeys":
18
+ $bvresp->addStatus("status", $auth->rmKeys($_REQUEST['public']));
19
+ break;
20
+ default:
21
+ return false;
22
+ }
23
+ return true;
24
+ }
25
+ }
26
+ endif;
callback/wings/brand.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVBrandCallback')) :
5
+
6
+ class BVBrandCallback {
7
+ public function process($method) {
8
+ global $bvresp, $bvcb;
9
+ $info = $bvcb->bvmain->info;
10
+ $option_name = $bvcb->bvmain->brand_option;
11
+ switch($method) {
12
+ case 'setbrand':
13
+ $brandinfo = array();
14
+ if (array_key_exists('hide', $_REQUEST)) {
15
+ $brandinfo['hide'] = $_REQUEST['hide'];
16
+ } else {
17
+ $brandinfo['name'] = $_REQUEST['name'];
18
+ $brandinfo['title'] = $_REQUEST['title'];
19
+ $brandinfo['description'] = $_REQUEST['description'];
20
+ $brandinfo['pluginuri'] = $_REQUEST['pluginuri'];
21
+ $brandinfo['author'] = $_REQUEST['author'];
22
+ $brandinfo['authorname'] = $_REQUEST['authorname'];
23
+ $brandinfo['authoruri'] = $_REQUEST['authoruri'];
24
+ $brandinfo['menuname'] = $_REQUEST['menuname'];
25
+ $brandinfo['logo'] = $_REQUEST['logo'];
26
+ $brandinfo['webpage'] = $_REQUEST['webpage'];
27
+ $brandinfo['appurl'] = $_REQUEST['appurl'];
28
+ if (array_key_exists('hide_plugin_details', $_REQUEST)) {
29
+ $brandinfo['hide_plugin_details'] = $_REQUEST['hide_plugin_details'];
30
+ }
31
+ if (array_key_exists('hide_from_menu', $_REQUEST)) {
32
+ $brandinfo['hide_from_menu'] = $_REQUEST['hide_from_menu'];
33
+ }
34
+ }
35
+ $info->updateOption($option_name, $brandinfo);
36
+ $bvresp->addStatus("setbrand", $info->getOption($option_name));
37
+ break;
38
+ case 'rmbrand':
39
+ $info->deleteOption($option_name);
40
+ $bvresp->addStatus("rmbrand", !$info->getOption($option_name));
41
+ break;
42
+ default:
43
+ return false;
44
+ }
45
+ return true;
46
+ }
47
+ }
48
+ endif;
callback/wings/bv_upgrader_skin.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVUpgraderSkin')) :
5
+ class BVUpgraderSkin extends WP_Upgrader_Skin {
6
+ public $action = '';
7
+ public $plugin_info = array();
8
+ public $theme_info = array();
9
+ public $language_update = null;
10
+
11
+ function __construct($type, $package = '') {
12
+ $this->action = $type;
13
+ $this->package = $package;
14
+ parent::__construct(array());
15
+ }
16
+
17
+ function header() {}
18
+
19
+ function footer() {}
20
+
21
+ function get_key() {
22
+ $key = "bvgeneral";
23
+ switch ($this->action) {
24
+ case "theme_upgrade":
25
+ if (!empty($this->theme_info))
26
+ $key = $this->theme_info['Name'];
27
+ break;
28
+ case "plugin_upgrade":
29
+ if (!empty($this->plugin_info))
30
+ $key = $this->plugin_info['Name'];
31
+ break;
32
+ case "installer":
33
+ if (!empty($this->package))
34
+ $key = $this->package;
35
+ break;
36
+ case "upgrade_translations":
37
+ if (null != $this->language_update)
38
+ $key = $this->language_update->package;
39
+ break;
40
+ }
41
+ return $key;
42
+ }
43
+
44
+ function error($errors) {
45
+ global $bvresp;
46
+ $key = $this->get_key();
47
+ $message = array();
48
+ $message['error'] = true;
49
+ if (is_string($errors)) {
50
+ $message['message'] = $errors;
51
+ } elseif (is_wp_error($errors) && $errors->get_error_code()) {
52
+ $message['data'] = $errors->get_error_data();
53
+ $message['code'] = $errors->get_error_code();
54
+ }
55
+ $bvresp->addArrayToStatus($this->action.':'.$key, $message);
56
+ }
57
+
58
+ function feedback($string) {
59
+ global $bvresp;
60
+ if ( empty($string) )
61
+ return;
62
+ $key = $this->get_key();
63
+ $message = array();
64
+ $message['message'] = $string;
65
+ $bvresp->addArrayToStatus($this->action.':'.$key, $message);
66
+ }
67
+ }
68
+ endif;
callback/wings/db.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVDBCallback')) :
5
+ class BVDBCallback {
6
+
7
+ public function getLastID($pkeys, $end_row) {
8
+ $last_ids = array();
9
+ foreach($pkeys as $pk) {
10
+ $last_ids[$pk] = $end_row[$pk];
11
+ }
12
+ return $last_ids;
13
+ }
14
+
15
+ public function getTableData($table, $tname, $rcount, $offset, $limit, $bsize, $filter, $pkeys, $include_rows = false) {
16
+ global $bvcb, $bvresp;
17
+ $tinfo = array();
18
+
19
+ $rows_count = $bvcb->bvmain->db->rowsCount($table);
20
+ $bvresp->addStatus('count', $rows_count);
21
+ if ($limit == 0) {
22
+ $limit = $rows_count;
23
+ }
24
+ $srows = 1;
25
+ while (($limit > 0) && ($srows > 0)) {
26
+ if ($bsize > $limit)
27
+ $bsize = $limit;
28
+ $rows = $bvcb->bvmain->db->getTableContent($table, '*', $filter, $bsize, $offset);
29
+ $srows = sizeof($rows);
30
+ $data = array();
31
+ $data["offset"] = $offset;
32
+ $data["size"] = $srows;
33
+ $data["md5"] = md5(serialize($rows));
34
+ array_push($tinfo, $data);
35
+ if (!empty($pkeys) && $srows > 0) {
36
+ $end_row = end($rows);
37
+ $last_ids = $this->getLastID($pkeys, $end_row);
38
+ $data['last_ids'] = $last_ids;
39
+ $bvresp->addStatus('last_ids', $last_ids);
40
+ }
41
+ if ($include_rows) {
42
+ $data["rows"] = $rows;
43
+ $str = serialize($data);
44
+ $bvresp->writeStream($str);
45
+ }
46
+ $offset += $srows;
47
+ $limit -= $srows;
48
+ }
49
+ $bvresp->addStatus('size', $offset);
50
+ $bvresp->addStatus('tinfo', $tinfo);
51
+ }
52
+
53
+ public function process($method) {
54
+ global $bvresp, $bvcb;
55
+ $db = $bvcb->bvmain->db;
56
+ switch ($method) {
57
+ case "gettbls":
58
+ $bvresp->addStatus("tables", $db->showTables());
59
+ break;
60
+ case "tblstatus":
61
+ $bvresp->addStatus("statuses", $db->showTableStatus());
62
+ break;
63
+ case "tablekeys":
64
+ $table = urldecode($_REQUEST['table']);
65
+ $bvresp->addStatus("table_keys", $db->tableKeys($table));
66
+ break;
67
+ case "describetable":
68
+ $table = urldecode($_REQUEST['table']);
69
+ $bvresp->addStatus("table_description", $db->describeTable($table));
70
+ break;
71
+ case "checktable":
72
+ $table = urldecode($_REQUEST['table']);
73
+ $type = urldecode($_REQUEST['type']);
74
+ $bvresp->addStatus("status", $db->checkTable($table, $type));
75
+ break;
76
+ case "repairtable":
77
+ $table = urldecode($_REQUEST['table']);
78
+ $bvresp->addStatus("status", $db->repairTable($table));
79
+ break;
80
+ case "gettcrt":
81
+ $table = urldecode($_REQUEST['table']);
82
+ $bvresp->addStatus("create", $db->showTableCreate($table));
83
+ break;
84
+ case "getrowscount":
85
+ $table = urldecode($_REQUEST['table']);
86
+ $bvresp->addStatus("count", $db->rowsCount($table));
87
+ break;
88
+ case "gettablecontent":
89
+ $table = urldecode($_REQUEST['table']);
90
+ $fields = urldecode($_REQUEST['fields']);
91
+ $filter = (array_key_exists('filter', $_REQUEST)) ? urldecode($_REQUEST['filter']) : "";
92
+ $limit = intval(urldecode($_REQUEST['limit']));
93
+ $offset = intval(urldecode($_REQUEST['offset']));
94
+ $pkeys = (array_key_exists('pkeys', $_REQUEST)) ? $_REQUEST['pkeys'] : array();
95
+ $bvresp->addStatus('timestamp', time());
96
+ $bvresp->addStatus('tablename', $table);
97
+ $rows = $db->getTableContent($table, $fields, $filter, $limit, $offset);
98
+ $srows = sizeof($rows);
99
+ if (!empty($pkeys) && $srows > 0) {
100
+ $end_row = end($rows);
101
+ $bvresp->addStatus('last_ids', $this->getLastID($pkeys, $end_row));
102
+ }
103
+ $bvresp->addStatus("rows", $rows);
104
+ break;
105
+ case "tableinfo":
106
+ $table = urldecode($_REQUEST['table']);
107
+ $offset = intval(urldecode($_REQUEST['offset']));
108
+ $limit = intval(urldecode($_REQUEST['limit']));
109
+ $bsize = intval(urldecode($_REQUEST['bsize']));
110
+ $filter = (array_key_exists('filter', $_REQUEST)) ? urldecode($_REQUEST['filter']) : "";
111
+ $rcount = intval(urldecode($_REQUEST['rcount']));
112
+ $tname = urldecode($_REQUEST['tname']);
113
+ $pkeys = (array_key_exists('pkeys', $_REQUEST)) ? $_REQUEST['pkeys'] : array();
114
+ $this->getTableData($table, $tname, $rcount, $offset, $limit, $bsize, $filter, $pkeys, false);
115
+ break;
116
+ case "uploadrows":
117
+ $table = urldecode($_REQUEST['table']);
118
+ $offset = intval(urldecode($_REQUEST['offset']));
119
+ $limit = intval(urldecode($_REQUEST['limit']));
120
+ $bsize = intval(urldecode($_REQUEST['bsize']));
121
+ $filter = (array_key_exists('filter', $_REQUEST)) ? urldecode($_REQUEST['filter']) : "";
122
+ $rcount = intval(urldecode($_REQUEST['rcount']));
123
+ $tname = urldecode($_REQUEST['tname']);
124
+ $pkeys = (array_key_exists('pkeys', $_REQUEST)) ? $_REQUEST['pkeys'] : array();
125
+ $this->getTableData($table, $tname, $rcount, $offset, $limit, $bsize, $filter, $pkeys, true);
126
+ break;
127
+ case "tblexists":
128
+ $bvresp->addStatus("tblexists", $db->isTablePresent($_REQUEST['tablename']));
129
+ break;
130
+ case "crttbl":
131
+ $bvresp->addStatus("crttbl", $db->createTable($_REQUEST['query'], $_REQUEST['tablename']));
132
+ break;
133
+ case "drptbl":
134
+ $bvresp->addStatus("drptbl", $db->dropBVTable($_REQUEST['name']));
135
+ break;
136
+ case "trttbl":
137
+ $bvresp->addStatus("trttbl", $db->truncateBVTable($_REQUEST['name']));
138
+ break;
139
+ default:
140
+ return false;
141
+ }
142
+ return true;
143
+ }
144
+ }
145
+ endif;
callback/wings/dynsync.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVDynSyncCallback')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/../../dynsync.php';
7
+
8
+ class BVDynSyncCallback {
9
+ public function dropDynSyncTable() {
10
+ global $bvcb;
11
+ return $bvcb->bvmain->db->dropBVTable(BVDynSync::$dynsync_table);
12
+ }
13
+
14
+ public function createDynSyncTable() {
15
+ global $bvcb;
16
+ $db = $bvcb->bvmain->db;
17
+ $charset_collate = $db->getCharsetCollate();
18
+ $table = $bvcb->bvmain->db->getBVTable(BVDynSync::$dynsync_table);
19
+ $query = "CREATE TABLE $table (
20
+ id bigint(20) NOT NULL AUTO_INCREMENT,
21
+ site_id int NOT NULL,
22
+ event_type varchar(40) NOT NULL DEFAULT '',
23
+ event_tag varchar(40) NOT NULL DEFAULT '',
24
+ event_data text NOT NULL DEFAULT '',
25
+ PRIMARY KEY (id)
26
+ ) $charset_collate;";
27
+ return $db->createTable($query, BVDynSync::$dynsync_table);
28
+ }
29
+
30
+ public function process($method) {
31
+ global $bvresp, $bvcb;
32
+ $info = $bvcb->bvmain->info;
33
+ switch ($method) {
34
+ case "truncdynsynctable":
35
+ $bvresp->addStatus("status", $bvcb->bvmain->db->truncateBVTable(BVDynSync::$dynsync_table));
36
+ break;
37
+ case "dropdynsynctable":
38
+ $bvresp->addStatus("status", $this->dropDynSyncTable());
39
+ break;
40
+ case "createdynsynctable":
41
+ $bvresp->addStatus("status", $this->createDynSyncTable());
42
+ break;
43
+ case "setdynsync":
44
+ if (array_key_exists('dynplug', $_REQUEST)) {
45
+ $info->updateOption('bvdynplug', $_REQUEST['dynplug']);
46
+ } else {
47
+ $info->deleteOption('bvdynplug');
48
+ }
49
+ $info->updateOption('bvDynSyncActive', $_REQUEST['dynsync']);
50
+ break;
51
+ case "setwoodyn":
52
+ $info->updateOption('bvWooDynSync', $_REQUEST['woodyn']);
53
+ break;
54
+ case "setignorednames":
55
+ switch ($_REQUEST['table']) {
56
+ case "options":
57
+ $info->updateOption('bvIgnoredOptions', $_REQUEST['names']);
58
+ break;
59
+ case "postmeta":
60
+ $info->updateOption('bvIgnoredPostmeta', $_REQUEST['names']);
61
+ break;
62
+ }
63
+ break;
64
+ case "getignorednames":
65
+ switch ($_REQUEST['table']) {
66
+ case "options":
67
+ $names = $info->getOption('bvIgnoredOptions');
68
+ break;
69
+ case "postmeta":
70
+ $names = $info->getOption('bvIgnoredPostmeta');
71
+ break;
72
+ }
73
+ $bvresp->addStatus("names", $names);
74
+ break;
75
+ default:
76
+ return false;
77
+ }
78
+ return true;
79
+ }
80
+ }
81
+ endif;
callback/wings/fs.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVFSCallback')) :
5
+ class BVFSCallback {
6
+ function fileStat($relfile) {
7
+ $absfile = ABSPATH.$relfile;
8
+ $fdata = array();
9
+ $fdata["filename"] = $relfile;
10
+ $stats = @stat($absfile);
11
+ if ($stats) {
12
+ foreach (preg_grep('#size|uid|gid|mode|mtime#i', array_keys($stats)) as $key ) {
13
+ $fdata[$key] = $stats[$key];
14
+ }
15
+ if (is_link($absfile)) {
16
+ $fdata["link"] = @readlink($absfile);
17
+ }
18
+ } else {
19
+ $fdata["failed"] = true;
20
+ }
21
+ return $fdata;
22
+ }
23
+
24
+ function scanFilesUsingGlob($initdir = "./", $offset = 0, $limit = 0, $bsize = 512, $recurse = true, $regex = '{.??,}*') {
25
+ global $bvresp;
26
+ $i = 0;
27
+ $dirs = array();
28
+ $dirs[] = $initdir;
29
+ $bfc = 0;
30
+ $bfa = array();
31
+ $current = 0;
32
+ $abspath = realpath(ABSPATH).'/';
33
+ $abslen = strlen($abspath);
34
+ # XNOTE: $recurse cannot be used directly here
35
+ while ($i < count($dirs)) {
36
+ $dir = $dirs[$i];
37
+
38
+ foreach (glob($abspath.$dir.$regex, GLOB_NOSORT | GLOB_BRACE) as $absfile) {
39
+ $relfile = substr($absfile, $abslen);
40
+ if (is_dir($absfile) && !is_link($absfile)) {
41
+ $dirs[] = $relfile."/";
42
+ }
43
+ $current++;
44
+ if ($offset >= $current)
45
+ continue;
46
+ if (($limit != 0) && (($current - $offset) > $limit)) {
47
+ $i = count($dirs);
48
+ break;
49
+ }
50
+ $bfa[] = $this->fileStat($relfile);
51
+ $bfc++;
52
+ if ($bfc == $bsize) {
53
+ $str = serialize($bfa);
54
+ $bvresp->writeStream($str);
55
+ $bfc = 0;
56
+ $bfa = array();
57
+ }
58
+ }
59
+ $regex = '{.??,}*';
60
+ $i++;
61
+ if ($recurse == false)
62
+ break;
63
+ }
64
+ if ($bfc != 0) {
65
+ $str = serialize($bfa);
66
+ $bvresp->writeStream($str);
67
+ }
68
+ }
69
+
70
+ function scanFiles($initdir = "./", $offset = 0, $limit = 0, $bsize = 512, $recurse = true) {
71
+ global $bvresp;
72
+ $i = 0;
73
+ $dirs = array();
74
+ $dirs[] = $initdir;
75
+ $bfc = 0;
76
+ $bfa = array();
77
+ $current = 0;
78
+ while ($i < count($dirs)) {
79
+ $dir = $dirs[$i];
80
+ $d = @opendir(ABSPATH.$dir);
81
+ if ($d) {
82
+ while (($file = readdir($d)) !== false) {
83
+ if ($file == '.' || $file == '..') { continue; }
84
+ $relfile = $dir.$file;
85
+ $absfile = ABSPATH.$relfile;
86
+ if (is_dir($absfile) && !is_link($absfile)) {
87
+ $dirs[] = $relfile."/";
88
+ }
89
+ $current++;
90
+ if ($offset >= $current)
91
+ continue;
92
+ if (($limit != 0) && (($current - $offset) > $limit)) {
93
+ $i = count($dirs);
94
+ break;
95
+ }
96
+ $bfa[] = $this->fileStat($relfile);
97
+ $bfc++;
98
+ if ($bfc == $bsize) {
99
+ $str = serialize($bfa);
100
+ $bvresp->writeStream($str);
101
+ $bfc = 0;
102
+ $bfa = array();
103
+ }
104
+ }
105
+ closedir($d);
106
+ }
107
+ $i++;
108
+ if ($recurse == false)
109
+ break;
110
+ }
111
+ if ($bfc != 0) {
112
+ $str = serialize($bfa);
113
+ $bvresp->writeStream($str);
114
+ }
115
+ }
116
+
117
+ function calculateMd5($absfile, $fdata, $offset, $limit, $bsize) {
118
+ if ($offset == 0 && $limit == 0) {
119
+ $md5 = md5_file($absfile);
120
+ } else {
121
+ if ($limit == 0)
122
+ $limit = $fdata["size"];
123
+ if ($offset + $limit < $fdata["size"])
124
+ $limit = $fdata["size"] - $offset;
125
+ $handle = fopen($absfile, "rb");
126
+ $ctx = hash_init('md5');
127
+ fseek($handle, $offset, SEEK_SET);
128
+ $dlen = 1;
129
+ while (($limit > 0) && ($dlen > 0)) {
130
+ if ($bsize > $limit)
131
+ $bsize = $limit;
132
+ $d = fread($handle, $bsize);
133
+ $dlen = strlen($d);
134
+ hash_update($ctx, $d);
135
+ $limit -= $dlen;
136
+ }
137
+ fclose($handle);
138
+ $md5 = hash_final($ctx);
139
+ }
140
+ return $md5;
141
+ }
142
+
143
+ function getFilesStats($files, $offset = 0, $limit = 0, $bsize = 102400, $md5 = false) {
144
+ global $bvresp;
145
+ foreach ($files as $file) {
146
+ $fdata = $this->fileStat($file);
147
+ $absfile = ABSPATH.$file;
148
+ if (!is_readable($absfile)) {
149
+ $bvresp->addArrayToStatus("missingfiles", $file);
150
+ continue;
151
+ }
152
+ if ($md5 === true) {
153
+ $fdata["md5"] = $this->calculateMd5($absfile, $fdata, $offset, $limit, $bsize);
154
+ }
155
+ $bvresp->addArrayToStatus("stats", $fdata);
156
+ }
157
+ }
158
+
159
+ function uploadFiles($files, $offset = 0, $limit = 0, $bsize = 102400) {
160
+ global $bvresp;
161
+
162
+ foreach ($files as $file) {
163
+ if (!is_readable(ABSPATH.$file)) {
164
+ $bvresp->addArrayToStatus("missingfiles", $file);
165
+ continue;
166
+ }
167
+ $handle = fopen(ABSPATH.$file, "rb");
168
+ if (($handle != null) && is_resource($handle)) {
169
+ $fdata = $this->fileStat($file);
170
+ $_limit = $limit;
171
+ $_bsize = $bsize;
172
+ if ($_limit == 0)
173
+ $_limit = $fdata["size"];
174
+ if ($offset + $_limit > $fdata["size"])
175
+ $_limit = $fdata["size"] - $offset;
176
+ $fdata["limit"] = $_limit;
177
+ $sfdata = serialize($fdata);
178
+ $bvresp->writeStream($sfdata);
179
+ fseek($handle, $offset, SEEK_SET);
180
+ $dlen = 1;
181
+ while (($_limit > 0) && ($dlen > 0)) {
182
+ if ($_bsize > $_limit)
183
+ $_bsize = $_limit;
184
+ $d = fread($handle, $_bsize);
185
+ $dlen = strlen($d);
186
+ $bvresp->writeStream($d);
187
+ $_limit -= $dlen;
188
+ }
189
+ fclose($handle);
190
+ } else {
191
+ $bvresp->addArrayToStatus("unreadablefiles", $file);
192
+ }
193
+ }
194
+ }
195
+
196
+ function process($method) {
197
+ switch ($method) {
198
+ case "scanfilesglob":
199
+ $initdir = urldecode($_REQUEST['initdir']);
200
+ $offset = intval(urldecode($_REQUEST['offset']));
201
+ $limit = intval(urldecode($_REQUEST['limit']));
202
+ $bsize = intval(urldecode($_REQUEST['bsize']));
203
+ $regex = urldecode($_REQUEST['regex']);
204
+ $recurse = true;
205
+ if (array_key_exists('recurse', $_REQUEST) && $_REQUEST["recurse"] == "false") {
206
+ $recurse = false;
207
+ }
208
+ $this->scanFilesUsingGlob($initdir, $offset, $limit, $bsize, $recurse, $regex);
209
+ break;
210
+ case "scanfiles":
211
+ $initdir = urldecode($_REQUEST['initdir']);
212
+ $offset = intval(urldecode($_REQUEST['offset']));
213
+ $limit = intval(urldecode($_REQUEST['limit']));
214
+ $bsize = intval(urldecode($_REQUEST['bsize']));
215
+ $recurse = true;
216
+ if (array_key_exists('recurse', $_REQUEST) && $_REQUEST["recurse"] == "false") {
217
+ $recurse = false;
218
+ }
219
+ $this->scanFiles($initdir, $offset, $limit, $bsize, $recurse);
220
+ break;
221
+ case "getfilesstats":
222
+ $files = $_REQUEST['files'];
223
+ $offset = intval(urldecode($_REQUEST['offset']));
224
+ $limit = intval(urldecode($_REQUEST['limit']));
225
+ $bsize = intval(urldecode($_REQUEST['bsize']));
226
+ $md5 = false;
227
+ if (array_key_exists('md5', $_REQUEST)) {
228
+ $md5 = true;
229
+ }
230
+ $this->getFilesStats($files, $offset, $limit, $bsize, $md5);
231
+ break;
232
+ case "sendmanyfiles":
233
+ $files = $_REQUEST['files'];
234
+ $offset = intval(urldecode($_REQUEST['offset']));
235
+ $limit = intval(urldecode($_REQUEST['limit']));
236
+ $bsize = intval(urldecode($_REQUEST['bsize']));
237
+ $this->uploadFiles($files, $offset, $limit, $bsize);
238
+ break;
239
+ case "filelist":
240
+ $initdir = $_REQUEST['initdir'];
241
+ $glob_option = GLOB_MARK;
242
+ if(array_key_exists('onlydir', $_REQUEST)) {
243
+ $glob_option = GLOB_ONLYDIR;
244
+ }
245
+ $regex = "*";
246
+ if(array_key_exists('regex', $_REQUEST)){
247
+ $regex = $_REQUEST['regex'];
248
+ }
249
+ $directoryList = glob($initdir.$regex, $glob_option);
250
+ $this->getFilesStats($directoryList);
251
+ break;
252
+ default:
253
+ return false;
254
+ }
255
+ return true;
256
+ }
257
+ }
258
+ endif;
callback/wings/fw.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVFirewallCallback')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/../../fw/config.php';
7
+
8
+ class BVFirewallCallback {
9
+ public function process($method) {
10
+ global $bvcb, $bvresp;
11
+ $config = new BVFWConfig($bvcb->bvmain);
12
+ switch ($method) {
13
+ case "clrconfig":
14
+ $bvresp->addStatus("clearconfig", $config->clear());
15
+ break;
16
+ case "setmode":
17
+ $config->setMode($_REQUEST['mode']);
18
+ $bvresp->addStatus("setmode", $config->getMode());
19
+ break;
20
+ case "dsblrules":
21
+ $config->setDisabledRules($_REQUEST['disabled_rules']);
22
+ $bvresp->addStatus("disabled_rules", $config->getDisabledRules());
23
+ break;
24
+ case "setrulesmode":
25
+ $config->setRulesMode($_REQUEST['rules_mode']);
26
+ $bvresp->addStatus("rules_mode", $config->getRulesMode());
27
+ break;
28
+ default:
29
+ return false;
30
+ }
31
+ return true;
32
+ }
33
+ }
34
+ endif;
callback/wings/info.php ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVInfoCallback')) :
5
+ class BVInfoCallback {
6
+ public function getPosts($post_type, $count = 5) {
7
+ global $bvresp;
8
+ $output = array();
9
+ $args = array('numberposts' => $count, 'post_type' => $post_type);
10
+ $posts = get_posts($args);
11
+ $keys = array('post_title', 'guid', 'ID', 'post_date');
12
+ foreach ($posts as $post) {
13
+ $pdata = array();
14
+ $post_array = get_object_vars($post);
15
+ foreach ($keys as $key) {
16
+ $pdata[$key] = $post_array[$key];
17
+ }
18
+ $bvresp->addArrayToStatus("posts", $pdata);
19
+ }
20
+ }
21
+
22
+ public function getStats() {
23
+ global $bvresp;
24
+ $bvresp->addStatus("posts", get_object_vars(wp_count_posts()));
25
+ $bvresp->addStatus("pages", get_object_vars(wp_count_posts("page")));
26
+ $bvresp->addStatus("comments", get_object_vars(wp_count_comments()));
27
+ }
28
+
29
+ public function getPlugins() {
30
+ global $bvresp;
31
+ if (!function_exists('get_plugins')) {
32
+ require_once (ABSPATH."wp-admin/includes/plugin.php");
33
+ }
34
+ $plugins = get_plugins();
35
+ foreach ($plugins as $plugin_file => $plugin_data) {
36
+ $pdata = array(
37
+ 'file' => $plugin_file,
38
+ 'title' => $plugin_data['Title'],
39
+ 'version' => $plugin_data['Version'],
40
+ 'active' => is_plugin_active($plugin_file),
41
+ 'network' => $plugin_data['Network']
42
+ );
43
+ $bvresp->addArrayToStatus("plugins", $pdata);
44
+ }
45
+ }
46
+
47
+ public function themeToArray($theme) {
48
+ if (is_object($theme)) {
49
+ $pdata = array(
50
+ 'name' => $theme->Name,
51
+ 'title' => $theme->Title,
52
+ 'stylesheet' => $theme->get_stylesheet(),
53
+ 'template' => $theme->Template,
54
+ 'version' => $theme->Version
55
+ );
56
+ } else {
57
+ $pdata = array(
58
+ 'name' => $theme["Name"],
59
+ 'title' => $theme["Title"],
60
+ 'stylesheet' => $theme["Stylesheet"],
61
+ 'template' => $theme["Template"],
62
+ 'version' => $theme["Version"]
63
+ );
64
+ }
65
+ return $pdata;
66
+ }
67
+
68
+ public function getThemes() {
69
+ global $bvresp;
70
+ $themes = function_exists('wp_get_themes') ? wp_get_themes() : get_themes();
71
+ foreach($themes as $theme) {
72
+ $pdata = $this->themeToArray($theme);
73
+ $bvresp->addArrayToStatus("themes", $pdata);
74
+ }
75
+ $theme = function_exists('wp_get_theme') ? wp_get_theme() : get_current_theme();
76
+ $pdata = $this->themeToArray($theme);
77
+ $bvresp->addStatus("currenttheme", $pdata);
78
+ }
79
+
80
+ public function getSystemInfo() {
81
+ global $bvresp;
82
+ $sys_info = array(
83
+ 'serverip' => $_SERVER['SERVER_ADDR'],
84
+ 'host' => $_SERVER['HTTP_HOST'],
85
+ 'phpversion' => phpversion(),
86
+ 'AF_INET6' => defined('AF_INET6')
87
+ );
88
+ if (function_exists('get_current_user')) {
89
+ $sys_info['user'] = get_current_user();
90
+ }
91
+ if (function_exists('getmygid')) {
92
+ $sys_info['gid'] = getmygid();
93
+ }
94
+ if (function_exists('getmyuid')) {
95
+ $sys_info['uid'] = getmyuid();
96
+ }
97
+ if (function_exists('posix_getuid')) {
98
+ $sys_info['webuid'] = posix_getuid();
99
+ $sys_info['webgid'] = posix_getgid();
100
+ }
101
+ $bvresp->addStatus("sys", $sys_info);
102
+ }
103
+
104
+ public function getWpInfo() {
105
+ global $wp_version, $wp_db_version, $wp_local_package;
106
+ global $bvresp, $bvcb;
107
+ $upload_dir = wp_upload_dir();
108
+ $info = $bvcb->bvmain->info;
109
+
110
+ $wp_info = array(
111
+ 'dbprefix' => $bvcb->bvmain->db->dbprefix(),
112
+ 'wpmu' => $info->isMultisite(),
113
+ 'mainsite' => $info->isMainSite(),
114
+ 'name' => get_bloginfo('name'),
115
+ 'siteurl' => $info->siteurl(),
116
+ 'homeurl' => $info->homeurl(),
117
+ 'charset' => get_bloginfo('charset'),
118
+ 'wpversion' => $wp_version,
119
+ 'dbversion' => $wp_db_version,
120
+ 'abspath' => ABSPATH,
121
+ 'uploadpath' => $upload_dir['basedir'],
122
+ 'uploaddir' => wp_upload_dir(),
123
+ 'contentdir' => defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : null,
124
+ 'contenturl' => defined('WP_CONTENT_URL') ? WP_CONTENT_URL : null,
125
+ 'plugindir' => defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR : null,
126
+ 'dbcharset' => defined('DB_CHARSET') ? DB_CHARSET : null,
127
+ 'disallow_file_edit' => defined('DISALLOW_FILE_EDIT'),
128
+ 'disallow_file_mods' => defined('DISALLOW_FILE_MODS'),
129
+ 'locale' => get_locale(),
130
+ 'wp_local_string' => $wp_local_package,
131
+ 'charset_collate' => $bvcb->bvmain->db->getCharsetCollate()
132
+ );
133
+ $bvresp->addStatus("wp", $wp_info);
134
+ }
135
+
136
+ public function getUsers($args = array(), $full) {
137
+ global $bvresp, $bvcb;
138
+ $results = array();
139
+ $users = get_users($args);
140
+ if ('true' == $full) {
141
+ $results = $bvcb->bvmain->lib->objectToArray($users);
142
+ } else {
143
+ foreach( (array) $users as $user) {
144
+ $result = array();
145
+ $result['user_email'] = $user->user_email;
146
+ $result['ID'] = $user->ID;
147
+ $result['roles'] = $user->roles;
148
+ $result['user_login'] = $user->user_login;
149
+ $result['display_name'] = $user->display_name;
150
+ $result['user_registered'] = $user->user_registered;
151
+ $result['user_status'] = $user->user_status;
152
+ $result['user_url'] = $user->url;
153
+
154
+ $results[] = $result;
155
+ }
156
+ }
157
+ $bvresp->addStatus("users", $results);
158
+ }
159
+
160
+ public function availableFunctions(&$info) {
161
+ if (extension_loaded('openssl')) {
162
+ $info['openssl'] = "1";
163
+ }
164
+ if (function_exists('is_ssl') && is_ssl()) {
165
+ $info['https'] = "1";
166
+ }
167
+ if (function_exists('openssl_public_encrypt')) {
168
+ $info['openssl_public_encrypt'] = "1";
169
+ }
170
+ if (function_exists('openssl_public_decrypt')) {
171
+ $info['openssl_public_decrypt'] = "1";
172
+ }
173
+ $info['sha1'] = "1";
174
+ $info['apissl'] = "1";
175
+ if (function_exists('base64_encode')) {
176
+ $info['b64encode'] = true;
177
+ }
178
+ if (function_exists('base64_decode')) {
179
+ $info['b64decode'] = true;
180
+ }
181
+ return $info;
182
+ }
183
+
184
+ public function servicesInfo(&$info) {
185
+ global $bvcb;
186
+ $bvinfo = $bvcb->bvmain->info;
187
+ $info['dynsync'] = $bvinfo->getOption('bvDynSyncActive');
188
+ $info['woodyn'] = $bvinfo->getOption('bvWooDynSync');
189
+ $info['dynplug'] = $bvinfo->getOption('bvdynplug');
190
+ $info['ptplug'] = $bvinfo->getOption('bvptplug');
191
+ $info['fw'] = $this->getFWConfig();
192
+ $info['lp'] = $this->getLPConfig();
193
+ $info['brand'] = $bvinfo->getOption($bvcb->bvmain->brand_option);
194
+ $info['badgeinfo'] = $bvinfo->getOption($bvcb->bvmain->badgeinfo);
195
+ }
196
+
197
+ public function getLPConfig() {
198
+ global $bvcb;
199
+ $config = array();
200
+ $bvinfo = $bvcb->bvmain->info;
201
+ $mode = $bvinfo->getOption('bvlpmode');
202
+ $cplimit = $bvinfo->getOption('bvlpcaptchalimit');
203
+ $tplimit = $bvinfo->getOption('bvlptempblocklimit');
204
+ $bllimit = $bvinfo->getOption('bvlpblockAllLimit');
205
+ $config['mode'] = intval($mode ? $mode : 1);
206
+ $config['captcha_limit'] = intval($cplimit ? $cplimit : 3);
207
+ $config['temp_block_limit'] = intval($tplimit? $tplimit : 6);
208
+ $config['block_all_limit'] = intval($bllimit ? $bllimit : 100);
209
+ return $config;
210
+ }
211
+
212
+ public function getFWConfig() {
213
+ global $bvcb;
214
+ $config = array();
215
+ $bvinfo = $bvcb->bvmain->info;
216
+ $mode = $bvinfo->getOption('bvfwmode');
217
+ $drules = $bvinfo->getOption('bvfwdisabledrules');
218
+ $rmode = $bvinfo->getOption('bvfwrulesmode');
219
+ $config['mode'] = intval($mode ? $mode : 1);
220
+ $config['disabled_rules'] = $drules ? $drules : array();
221
+ $config['rules_mode'] = intval($rmode ? $rmode : 1);
222
+ return $config;
223
+ }
224
+
225
+ public function dbconf(&$info) {
226
+ global $bvcb;
227
+ if (defined('DB_CHARSET'))
228
+ $info['dbcharset'] = DB_CHARSET;
229
+ $info['dbprefix'] = $bvcb->bvmain->db->dbprefix();
230
+ $info['charset_collate'] = $bvcb->bvmain->db->getCharsetCollate();
231
+ return $info;
232
+ }
233
+
234
+ public function activate() {
235
+ global $bvcb, $bvresp;
236
+ $resp = array();
237
+ $bvcb->bvmain->info->basic($resp);
238
+ $this->servicesInfo($resp);
239
+ $this->dbconf($resp);
240
+ $this->availableFunctions($resp);
241
+ $bvresp->addStatus('actinfo', $resp);
242
+ }
243
+
244
+ public function process($method) {
245
+ global $bvresp, $bvcb;
246
+ switch ($method) {
247
+ case "activateinfo":
248
+ $this->activate();
249
+ break;
250
+ case "gtpsts":
251
+ $count = 5;
252
+ if (array_key_exists('count', $_REQUEST))
253
+ $count = $_REQUEST['count'];
254
+ $this->getPosts($_REQUEST['post_type'], $count);
255
+ break;
256
+ case "gtsts":
257
+ $this->getStats();
258
+ break;
259
+ case "gtplgs":
260
+ $this->getPlugins();
261
+ break;
262
+ case "gtthms":
263
+ $this->getThemes();
264
+ break;
265
+ case "gtsym":
266
+ $this->getSystemInfo();
267
+ break;
268
+ case "gtwp":
269
+ $this->getWpInfo();
270
+ break;
271
+ case "getoption":
272
+ $bvresp->addStatus("option", $bvresp->getOption($_REQUEST['name']));
273
+ break;
274
+ case "gtusrs":
275
+ $full = false;
276
+ if (array_key_exists('full', $_REQUEST))
277
+ $full = true;
278
+ $this->getUsers($_REQUEST['args'], $full);
279
+ break;
280
+ case "gttrnsnt":
281
+ $transient = $bvcb->bvmain->info->getTransient($_REQUEST['name']);
282
+ if ($transient && array_key_exists('asarray', $_REQUEST))
283
+ $transient = $bvcb->bvmain->lib->objectToArray($transient);
284
+ $bvresp->addStatus("transient", $transient);
285
+ break;
286
+ default:
287
+ return false;
288
+ }
289
+ return true;
290
+ }
291
+ }
292
+ endif;
callback/wings/ipstore.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVIPStoreCallback')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/../../ipstore.php';
7
+
8
+ class BVIPStoreCallback {
9
+
10
+ public function updateBVTableContent($table, $value, $filter) {
11
+ global $bvcb;
12
+ $bvcb->bvmain->db->query("UPDATE $table SET $value $filter;");
13
+ }
14
+
15
+ public function insertBVTableContent($table, $fields, $value) {
16
+ global $bvcb;
17
+ $bvcb->bvmain->db->query("INSERT INTO $table $fields values $value;");
18
+ }
19
+
20
+ public function deleteIPs($table, $rmfilters) {
21
+ if (is_array($rmfilters)) {
22
+ global $bvcb;
23
+ foreach ($rmfilters as $rmfilter) {
24
+ $rmfilter = base64_decode($rmfilter);
25
+ $bvcb->bvmain->db->deleteBVTableContent($table, $rmfilter);
26
+ }
27
+ }
28
+ }
29
+
30
+ public function insertIPs($table, $fields, $values) {
31
+ if (is_array($values)) {
32
+ foreach ($values as $value) {
33
+ $value = base64_decode($value);
34
+ $this->insertBVTableContent($table, $fields, $value);
35
+ }
36
+ }
37
+ }
38
+
39
+ public function updateIPs($table, $value, $filters) {
40
+ if (is_array($filters)) {
41
+ foreach ($filters as $filter) {
42
+ $filter = base64_decode($filter);
43
+ $this->updateBVTableContent($table, $value, $filter);
44
+ }
45
+ }
46
+ }
47
+
48
+ public function getIPs($table, $auto_increment_offset, $type, $category) {
49
+ global $bvcb;
50
+ $query = "SELECT `start_ip_range` FROM $table WHERE id < $auto_increment_offset AND `type` = $type AND ";
51
+ $query .= ($category == BVIPStore::FW) ? "`is_fw` = true;" : "`is_lp` = true;";
52
+ return $bvcb->bvmain->db->getCol($query);
53
+ }
54
+
55
+ public function getIPStoreOffset($table, $auto_increment_offset) {
56
+ global $bvcb;
57
+ $db = $bvcb->bvmain->db;
58
+ return intval($db->getVar("SELECT MAX(id) FROM $table WHERE id < $auto_increment_offset"));
59
+ }
60
+
61
+ public function getIPStoreInfo($table, $auto_increment_offset) {
62
+ global $bvcb;
63
+ $db = $bvcb->bvmain->db;
64
+ $info = array();
65
+ $info['fw_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset, BVIPStore::BLACKLISTED, BVIPStore::FW);
66
+ $info['lp_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset, BVIPStore::BLACKLISTED, BVIPStore::LP);
67
+ $info['fw_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset, BVIPStore::WHITELISTED, BVIPStore::FW);
68
+ $info['lp_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset, BVIPStore::WHITELISTED, BVIPStore::LP);
69
+ $info['ip_store_offset'] = $this->getIPStoreOffset($table, $auto_increment_offset);
70
+ $info['country_ips_size'] = intval($db->getVar("SELECT COUNT(id) FROM $table WHERE id >= $auto_increment_offset"));
71
+ return $info;
72
+ }
73
+
74
+ public function process($method) {
75
+ global $bvresp, $bvcb;
76
+ $db = $bvcb->bvmain->db;
77
+ $table = $_REQUEST['table'];
78
+ $bvTable = $db->getBVTable($table);
79
+ $auto_increment_offset = $_REQUEST['auto_increment_offset'];
80
+ if (!$db->isTablePresent($bvTable)) {
81
+ $bvresp->addStatus("info", false);
82
+ } else {
83
+ switch ($method) {
84
+ case "ipstrinfo":
85
+ $info = $this->getIPStoreInfo($bvTable, $auto_increment_offset);
86
+ $bvresp->addStatus("info", $info);
87
+ break;
88
+ case "insrtips":
89
+ $values = $_REQUEST['values'];
90
+ $fields = $_REQUEST['fields'];
91
+ $rmfilter = $_REQUEST['rmfilter'];
92
+ if ($rmfilter) {
93
+ $db->deleteBVTableContent($table, $rmfilter);
94
+ }
95
+ $this->insertIPs($bvTable, $fields, $values);
96
+ $bvresp->addStatus("offset", $this->getIPStoreOffset($bvTable, $auto_increment_offset));
97
+ break;
98
+ case "dltips":
99
+ $rmfilters = $_REQUEST['rmfilters'];
100
+ $this->deleteIPs($table, $rmfilters);
101
+ $bvresp->addStatus("offset", $this->getIPStoreOffset($bvTable, $auto_increment_offset));
102
+ break;
103
+ case "updtips":
104
+ $value = $_REQUEST['value'];
105
+ $filters = $_REQUEST['filters'];
106
+ $this->updateIPs($bvTable, $value, $filters);
107
+ $bvresp->addStatus("offset", $this->getIPStoreOffset($bvTable, $auto_increment_offset));
108
+ break;
109
+ default:
110
+ return false;
111
+ }
112
+ return true;
113
+ }
114
+ }
115
+ }
116
+ endif;
callback/wings/lp.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVLoginProtectCallback')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/../../lp/lp.php';
7
+
8
+ class BVLoginProtectCallback {
9
+ public function unBlockLogins() {
10
+ global $bvcb;
11
+ $info = $bvcb->bvmain->info;
12
+ $info->deleteTransient('bvlp_block_logins');
13
+ $info->setTransient('bvlp_allow_logins', 'true', 1800);
14
+ return $info->getTransient('bvlp_allow_logins');
15
+ }
16
+
17
+ public function blockLogins($time) {
18
+ global $bvcb;
19
+ $info = $bvcb->bvmain->info;
20
+ $info->deleteTransient('bvlp_allow_logins');
21
+ $info->setTransient('bvlp_block_logins', 'true', $time);
22
+ return $info->getTransient('bvlp_block_logins');
23
+ }
24
+
25
+ public function unBlockIP($ip, $attempts, $time) {
26
+ global $bvcb;
27
+ $info = $bvcb->bvmain->info;
28
+ $transient_name = BVLP::$unblock_ip_transient.$ip;
29
+ $info->setTransient($transient_name, $attempts, $time);
30
+ return $info->getTransient($transient_name);
31
+ }
32
+
33
+ public function process($method) {
34
+ global $bvcb, $bvresp;
35
+ $config = new BVLPConfig($bvcb->bvmain);
36
+ switch ($method) {
37
+ case "clrconfig":
38
+ $bvresp->addStatus("clearconfig", $config->clear());
39
+ break;
40
+ case "setmode":
41
+ $config->setMode($_REQUEST['mode']);
42
+ $bvresp->addStatus("setmode", $config->getMode());
43
+ break;
44
+ case "setcaptchalimit":
45
+ $config->setCaptchaLimit($_REQUEST['captcha_limit']);
46
+ $bvresp->addStatus("captcha_limit", $config->getCaptchaLimit());
47
+ break;
48
+ case "settmpblklimit":
49
+ $config->setTempBlockLimit($_REQUEST['temp_block_limit']);
50
+ $bvresp->addStatus("temp_block_limit", $config->getTempBlockLimit());
51
+ break;
52
+ case "setblkalllimit":
53
+ $config->setBlockAllLimit($_REQUEST['block_all_limit']);
54
+ $bvresp->addStatus("block_all_limit", $config->getBlockAllLimit());
55
+ break;
56
+ case "unblklogins":
57
+ $bvresp->addStatus("unblocklogins", $this->unBlockLogins());
58
+ break;
59
+ case "blklogins":
60
+ $time = array_key_exists('time', $_REQUEST) ? $_REQUEST['time'] : 1800;
61
+ $bvresp->addStatus("blocklogins", $this->blockLogins($time));
62
+ break;
63
+ case "unblkip":
64
+ $bvresp->addStatus("unblockip", $this->unBlockIP($_REQUEST['ip'], $_REQUEST['attempts'], $_REQUEST['time']));
65
+ break;
66
+ default:
67
+ return false;
68
+ }
69
+ return true;
70
+ }
71
+ }
72
+ endif;
callback/wings/manage.php ADDED
@@ -0,0 +1,516 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVManageCallback')) :
5
+ class BVManageCallback {
6
+ function getError($err) {
7
+ global $bvcb;
8
+ return $bvcb->bvmain->lib->objectToArray($err);
9
+ }
10
+
11
+ function is_pantheon() {
12
+ return (!empty($_ENV['PANTHEON_ENVIRONMENT']) && $_ENV['PANTHEON_ENVIRONMENT'] !== 'dev');
13
+ }
14
+
15
+ function isServerWritable() {
16
+ if ($this->is_pantheon()) {
17
+ return false;
18
+ }
19
+
20
+ if ((!defined('FTP_HOST') || !defined('FTP_USER')) && (get_filesystem_method(array(), false) != 'direct')) {
21
+ return false;
22
+ } else {
23
+ return true;
24
+ }
25
+ }
26
+
27
+ function include_files() {
28
+ @include_once ABSPATH.'wp-admin/includes/file.php';
29
+ @include_once ABSPATH.'wp-admin/includes/plugin.php';
30
+ @include_once ABSPATH.'wp-admin/includes/theme.php';
31
+ @include_once ABSPATH.'wp-admin/includes/misc.php';
32
+ @include_once ABSPATH.'wp-admin/includes/template.php';
33
+ @include_once ABSPATH.'wp-includes/pluggable.php';
34
+ @include_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
35
+ @include_once ABSPATH.'wp-admin/includes/user.php';
36
+ @include_once ABSPATH.'wp-includes/registration.php';
37
+ @include_once ABSPATH.'wp-admin/includes/update.php';
38
+ @require_once ABSPATH.'wp-admin/includes/update-core.php';
39
+ }
40
+
41
+ function edit($args) {
42
+ $result = array();
43
+ if ($args['type'] == 'plugins') {
44
+ $result['plugins'] = $this->editPlugins($args);
45
+ } elseif ($args['type'] == 'themes') {
46
+ $result['themes'] = $this->editThemes($args);
47
+ } elseif ($args['type'] == 'users') {
48
+ $result['users'] = $this->editWpusers($args);
49
+ }
50
+ return $result;
51
+ }
52
+
53
+ function editPlugins($args) {
54
+ $result = array();
55
+ $plugins = $args['items'];
56
+ foreach ($plugins as $plugin) {
57
+ if (array_key_exists('network', $plugin)) {
58
+ $networkwide = $plugin['network'];
59
+ } else {
60
+ $networkwide = false;
61
+ }
62
+ switch ($args['action']) {
63
+ case 'activate':
64
+ $res = activate_plugin($plugin['file'], '', $networkwide);
65
+ break;
66
+ case 'deactivate':
67
+ $res = deactivate_plugins(array($plugin['file']), false, $networkwide);
68
+ break;
69
+ case 'delete':
70
+ $res = delete_plugins(array($plugin['file']));
71
+ break;
72
+ case 'deactivate_delete':
73
+ $res = deactivate_plugins(array($plugin['file']), false, $networkwide);
74
+ if ($res || is_wp_error($res))
75
+ break;
76
+ $res = delete_plugins(array($plugin['file']));
77
+ default:
78
+ break;
79
+ }
80
+ if (is_wp_error($res)) {
81
+ $res = array('status' => "Error", 'message' => $res->get_error_message());
82
+ } elseif ($res === false) {
83
+ $res = array('status' => "Error", 'message' => "Failed to perform action.");
84
+ } else {
85
+ $res = array('status' => "Done");
86
+ }
87
+ $result[$plugin['file']] = $res;
88
+ }
89
+ return $result;
90
+ }
91
+
92
+ function editThemes($args) {
93
+ $result = array();
94
+ $themes = $args['items'];
95
+ foreach ($themes as $theme) {
96
+ switch ($args['action']) {
97
+ case 'activate':
98
+ $res = switch_theme($theme['template'], $theme['stylesheet']);
99
+ break;
100
+ case 'delete':
101
+ $res = delete_theme($theme['stylesheet']);
102
+ break;
103
+ default:
104
+ break;
105
+ }
106
+
107
+ if (is_wp_error($res)) {
108
+ $res = array('status' => "Error", 'message' => $res->get_error_message());
109
+ } elseif ($res === false) {
110
+ $res = array('status' => "Error", 'message' => "Failed to perform action.");
111
+ } else {
112
+ $res = array( 'status' => "Done");
113
+ }
114
+ $result[$theme['template']] = $res;
115
+ }
116
+ return $result;
117
+ }
118
+
119
+ function editWpusers($args) {
120
+ $result = array();
121
+ $items = $args['items'];
122
+ foreach ($items as $item) {
123
+ $res = array();
124
+ $user = get_user_by('id', $item['id']);
125
+ if ($user) {
126
+ switch ($args['action']) {
127
+ case 'changerole':
128
+ $data = array();
129
+ $data['role'] = $item['newrole'];
130
+ $data['ID'] = $user->ID;
131
+ $res = wp_update_user($data);
132
+ break;
133
+ case 'changepass':
134
+ $data = array();
135
+ $data['user_pass'] = $item['newpass'];
136
+ $data['ID'] = $user->ID;
137
+ $res = wp_update_user($data);
138
+ break;
139
+ case 'delete':
140
+ if ($args['reassign']) {
141
+ $user_to = get_user_by('id', $args['reassign']);
142
+ if ($user_to != false) {
143
+ $res = wp_delete_user($user->ID, $user_to->ID);
144
+ } else {
145
+ $res = array('status' => "Error", 'message' => 'Reassigned user doesnot exists');
146
+ }
147
+ } else {
148
+ $res = wp_delete_user($user->ID);
149
+ }
150
+ break;
151
+ }
152
+ if (is_wp_error($res)) {
153
+ $res = array('status' => "Error", 'message' => $res->get_error_message());
154
+ } else {
155
+ $res = array( 'status' => "Done");
156
+ }
157
+ } else {
158
+ $res = array('status' => "Error", 'message' => "Unable to find user");
159
+ }
160
+ $result[$item['id']] = $res;
161
+ }
162
+ return $result;
163
+ }
164
+
165
+ function addUser($args) {
166
+ if (username_exists($args['user_login'])) {
167
+ return array('status' => "Error", 'message' => "Username already exists");
168
+ }
169
+ if (email_exists($args['user_email'])) {
170
+ return array('status' => "Error", 'message' => "Email already exists");
171
+ }
172
+ $result = wp_insert_user($args);
173
+ if ( !is_wp_error( $result ) ) {
174
+ return array('status' => "Done", 'user_id' => $result);
175
+ } else {
176
+ return array('status' => "Error", 'message' => $this->getError($result));
177
+ }
178
+ }
179
+
180
+ function upgrade($params = null) {
181
+ $result = array();
182
+ $premium_upgrades = array();
183
+ if (array_key_exists('core', $params) && !empty($params['core'])) {
184
+ $result['core'] = $this->upgradeCore($params['core']);
185
+ }
186
+ if (array_key_exists('translations', $params) && !empty($params['translations'])) {
187
+ $result['translations'] = $this->upgradeTranslations($params['translations']);
188
+ }
189
+ if (array_key_exists('plugins', $params) && !empty($params['plugins'])) {
190
+ $files = array();
191
+ foreach ($params['plugins'] as $plugin) {
192
+ $files[] = $plugin['file'];
193
+ }
194
+ if (!empty($files)) {
195
+ $result['plugins'] = $this->upgradePlugins($files);
196
+ }
197
+ }
198
+ if (array_key_exists('themes', $params) && !empty($params['themes'])) {
199
+ $templates = array();
200
+ foreach ($params['themes'] as $theme) {
201
+ $templates[] = $theme['template'];
202
+ }
203
+ if (!empty($templates)) {
204
+ $result['themes'] = $this->upgradeThemes($templates);
205
+ }
206
+ }
207
+ return $result;
208
+ }
209
+
210
+ function get_translation_updates() {
211
+ global $bvcb;
212
+ $updates = array();
213
+ $transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme' );
214
+ foreach ( $transients as $transient => $type ) {
215
+ $transient = $bvcb->bvmain->info->getTransient( $transient );
216
+ if ( empty( $transient->translations ) )
217
+ continue;
218
+
219
+ foreach ( $transient->translations as $translation ) {
220
+ $updates[] = (object) $translation;
221
+ }
222
+ }
223
+ return $updates;
224
+ }
225
+
226
+ function upgradeTranslations($translations) {
227
+ $language_updates = $this->get_translation_updates();
228
+ $valid_updates = array();
229
+ $result = array();
230
+ if (!empty($language_updates)) {
231
+ foreach($language_updates as $update) {
232
+ if ($update && in_array($update->package, $translations)) {
233
+ $valid_updates[] = $update;
234
+ }
235
+ }
236
+ }
237
+ if (!empty($valid_updates)) {
238
+ if (class_exists('Language_Pack_Upgrader')) {
239
+ if (array_key_exists('bvskin', $_REQUEST)) {
240
+ require_once( "bv_upgrader_skin.php" );
241
+ $skin = new BVUpgraderSkin("upgrade_translations");
242
+ } else {
243
+ $skin = new Language_Pack_Upgrader_Skin(array());
244
+ }
245
+ $upgrader = new Language_Pack_Upgrader($skin);
246
+ $result = $upgrader->bulk_upgrade($valid_updates);
247
+ if (is_array($result) && !empty($result)) {
248
+ foreach ($result as $translate_tmp => $translate_info) {
249
+ if (is_wp_error($translate_info) || empty($translate_info)) {
250
+ $error = (!empty($translate_info)) ? is_wp_error($translate_info) : "Upgrade failed";
251
+ return array('status' => "Error", 'message' => $error);
252
+ }
253
+ }
254
+ }
255
+ return array('status' => "Done");
256
+ }
257
+ }
258
+ return array('status' => "Error", 'message' => "Upgrade failed");
259
+ }
260
+
261
+ function upgradeCore($args) {
262
+ global $wp_filesystem, $wp_version, $bvcb, $bvresp;
263
+ $core = $bvcb->bvmain->info->getTransient('update_core');
264
+ $core_update_index = intval($args['coreupdateindex']);
265
+ if (isset($core->updates) && !empty($core->updates)) {
266
+ $to_update = $core->updates[$core_update_index];
267
+ } else {
268
+ return array('status' => "Error", "message" => "Updates not available");
269
+ }
270
+ $bvresp->addStatus("Core_Upgrader", class_exists('Core_Upgrader'));
271
+ if (version_compare($wp_version, '3.1.9', '>')) {
272
+ $core = new Core_Upgrader();
273
+ $result = $core->upgrade($to_update);
274
+ if (is_wp_error($result)) {
275
+ return array('status' => "Error", "message" => $this->getError($result));
276
+ } else {
277
+ return array('status' => 'Done');
278
+ }
279
+ } else {
280
+ $bvresp->addStatus("wp_update_core", function_exists('wp_update_core'));
281
+ if (function_exists('wp_update_core')) {
282
+ $result = wp_update_core($to_update);
283
+ if (is_wp_error($result)) {
284
+ return array('status' => "Error", "message" => $this->getError($result));
285
+ } else {
286
+ return array('status' => 'Done');
287
+ }
288
+ }
289
+
290
+ $bvresp->addStatus("WP_Upgrader", class_exists('WP_Upgrader'));
291
+ if (class_exists('WP_Upgrader')) {
292
+ $upgrader = new WP_Upgrader();
293
+
294
+ $res = $upgrader->fs_connect(
295
+ array(
296
+ ABSPATH,
297
+ WP_CONTENT_DIR,
298
+ )
299
+ );
300
+ if (is_wp_error($res)) {
301
+ return array('status' => "Error", "message" => $this->getError($res));
302
+ }
303
+
304
+ $wp_dir = trailingslashit($wp_filesystem->abspath());
305
+
306
+ $core_package = false;
307
+ if (isset($to_update->package) && !empty($to_update->package)) {
308
+ $core_package = $to_update->package;
309
+ } elseif (isset($to_update->packages->full) && !empty($to_update->packages->full)) {
310
+ $core_package = $to_update->packages->full;
311
+ }
312
+
313
+ $download = $upgrader->download_package($core_package);
314
+ if (is_wp_error($download)) {
315
+ return array('status' => "Error", "message" => $this->getError($download));
316
+ }
317
+ $working_dir = $upgrader->unpack_package($download);
318
+ if (is_wp_error($working_dir)) {
319
+ return array('status' => "Error", "message" => $this->getError($working_dir));
320
+ }
321
+
322
+ if (!$wp_filesystem->copy($working_dir.'/wordpress/wp-admin/includes/update-core.php', $wp_dir.'wp-admin/includes/update-core.php', true)) {
323
+ $wp_filesystem->delete($working_dir, true);
324
+ return array('status' => "Error", "message" => "Unable to move files.");
325
+ }
326
+
327
+ $wp_filesystem->chmod($wp_dir.'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
328
+
329
+ $result = update_core($working_dir, $wp_dir);
330
+
331
+ if (is_wp_error($result)) {
332
+ return array('status' => "Error", "message" => $this->getError($result));
333
+ }
334
+ return array('status' => 'Done');
335
+ }
336
+ }
337
+ }
338
+
339
+ function upgradePlugins($plugins) {
340
+ $result = array();
341
+ if (class_exists('Plugin_Upgrader')) {
342
+ if (array_key_exists('bvskin', $_REQUEST)) {
343
+ require_once( "bv_upgrader_skin.php" );
344
+ $skin = new BVUpgraderSkin("plugin_upgrade");
345
+ } else {
346
+ $skin = new Bulk_Plugin_Upgrader_Skin();
347
+ }
348
+ $upgrader = new Plugin_Upgrader($skin);
349
+ $result = $upgrader->bulk_upgrade($plugins);
350
+ }
351
+ foreach($plugins as $file) {
352
+ $res = $result[$file];
353
+ if (!$res || is_wp_error($res)) {
354
+ $result[$file] = array('status' => "Error");
355
+ } else {
356
+ $result[$file] = array('status' => "Done");
357
+ }
358
+ }
359
+ return $result;
360
+ }
361
+
362
+ function upgradeThemes($themes) {
363
+ $result = array();
364
+ if (class_exists('Theme_Upgrader')) {
365
+ if (array_key_exists('bvskin', $_REQUEST)) {
366
+ require_once( "bv_upgrader_skin.php" );
367
+ $skin = new BVUpgraderSkin("theme_upgrade");
368
+ } else {
369
+ $skin = new Bulk_Theme_Upgrader_Skin();
370
+ }
371
+ $upgrader = new Theme_Upgrader($skin);
372
+ $result = $upgrader->bulk_upgrade($themes);
373
+ }
374
+ foreach($themes as $template) {
375
+ $res = $result[$template];
376
+ if (!$res || is_wp_error($res)) {
377
+ $result[$template] = array('status' => "Error");
378
+ } else {
379
+ $result[$template] = array('status' => "Done");
380
+ }
381
+ }
382
+ return $result;
383
+ }
384
+
385
+ function install($params) {
386
+ $result = array();
387
+ if (isset($params['plugins'])) {
388
+ foreach ($params['plugins'] as $plugin) {
389
+ if (!array_key_exists('plugins', $result))
390
+ $result["plugins"] = array();
391
+ $plugin['dest'] = WP_PLUGIN_DIR;
392
+ $res = $this->installPackage($plugin);
393
+ $pluginName = $plugin['package'];
394
+ $result["plugins"][$pluginName] = $res;
395
+ }
396
+ }
397
+ if (isset($params['themes'])) {
398
+ foreach ($params['themes'] as $theme) {
399
+ if (!array_key_exists('themes', $result))
400
+ $result["themes"] = array();
401
+ $theme['dest'] = WP_CONTENT_DIR.'/themes';
402
+ $res = $this->installPackage($theme);
403
+ $themeName = $theme['package'];
404
+ $result["themes"][$themeName] = $res;
405
+ }
406
+ }
407
+ return $result;
408
+ }
409
+
410
+ function installPackage($params) {
411
+ global $wp_filesystem;
412
+
413
+ if (!isset($params['package']) || empty($params['package'])) {
414
+ return array('status' => "Error", 'message' => "No package is sent");
415
+ }
416
+ $valid_domain_regex = "/^(http|https):\/\/[\-\w]*\.(blogvault\.net|w\.org|wp\.org|wordpress\.org)\//";
417
+ if (preg_match($valid_domain_regex, $params['package']) !== 1) {
418
+ return array('status' => "Error", 'message' => "Invalid package domain");
419
+ }
420
+ if (array_key_exists('bvskin', $_REQUEST)) {
421
+ require_once( "bv_upgrader_skin.php" );
422
+ $skin = new BVUpgraderSkin("installer", $params['package']);
423
+ } else {
424
+ $skin = new WP_Upgrader_Skin();
425
+ }
426
+ $upgrader = new WP_Upgrader($skin);
427
+ $upgrader->init();
428
+ $destination = $params['dest'];
429
+ $clear_destination = isset($params['cleardest']) ? $params['cleardest'] : false;
430
+ $package_url = $params['package'];
431
+ $key = basename($package_url);
432
+ $res = $upgrader->run(
433
+ array(
434
+ 'package' => $package_url,
435
+ 'destination' => $destination,
436
+ 'clear_destination' => $clear_destination,
437
+ 'clear_working' => true,
438
+ 'hook_extra' => array(),
439
+ )
440
+ );
441
+ if (is_wp_error($res)) {
442
+ $res = array('status' => "Error", 'message' => $this->getError($res));
443
+ } else {
444
+ $res = array( 'status' => "Done");
445
+ }
446
+ return $res;
447
+ }
448
+
449
+ function getPremiumUpdates() {
450
+ return apply_filters( 'mwp_premium_update_notification', array() );
451
+ }
452
+
453
+ function getPremiumUpgradesInfo() {
454
+ return apply_filters( 'mwp_premium_perform_update', array() );
455
+ }
456
+
457
+ function autoLogin($username, $isHttps) {
458
+ $user = get_user_by('login', $username);
459
+ if ($user != FALSE) {
460
+ wp_set_current_user( $user->ID );
461
+ if ($isHttps) {
462
+ wp_set_auth_cookie( $user->ID, false, true );
463
+ } else {
464
+ # As we are not sure about wp-cofig.php settings for sure login
465
+ wp_set_auth_cookie( $user->ID, false, true );
466
+ wp_set_auth_cookie( $user->ID, false, false );
467
+ }
468
+ $redirect_to = get_admin_url();
469
+ wp_safe_redirect( $redirect_to );
470
+ exit;
471
+ }
472
+ }
473
+
474
+ function process($method) {
475
+ global $wp_filesystem, $bvresp;
476
+ $this->include_files();
477
+
478
+ if (!$this->is_pantheon() && !$wp_filesystem) {
479
+ WP_Filesystem();
480
+ }
481
+
482
+ switch ($method) {
483
+ case "adusr":
484
+ $bvresp->addStatus("adduser", $this->addUser($_REQUEST['args']));
485
+ break;
486
+ case "upgrde":
487
+ $bvresp->addStatus("upgrades", $this->upgrade($_REQUEST['args']));
488
+ break;
489
+ case "edt":
490
+ $bvresp->addStatus("edit", $this->edit($_REQUEST['args']));
491
+ break;
492
+ case "instl":
493
+ $bvresp->addStatus("install", $this->install($_REQUEST['args']));
494
+ break;
495
+ case "getpremiumupdates":
496
+ $bvresp->addStatus("premiumupdates", $this->getPremiumUpdates());
497
+ break;
498
+ case "getpremiumupgradesinfo":
499
+ $bvresp->addStatus("premiumupgradesinfo", $this->getPremiumUpgradesInfo());
500
+ break;
501
+ case "wrteble":
502
+ $bvresp->addStatus("writeable", $this->isServerWritable());
503
+ break;
504
+ case "atolgn":
505
+ $isHttps = false;
506
+ if (array_key_exists('https', $_REQUEST))
507
+ $isHttps = true;
508
+ $bvresp->addStatus("autologin", $this->autoLogin($_REQUEST['username'], $isHttps));
509
+ break;
510
+ default:
511
+ return false;
512
+ }
513
+ return true;
514
+ }
515
+ }
516
+ endif;
callback/wings/misc.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVMiscCallback')) :
5
+
6
+ class BVMiscCallback {
7
+
8
+ function process($method) {
9
+ global $bvcb, $bvresp;
10
+ $info = $bvcb->bvmain->info;
11
+ switch ($method) {
12
+ case "enablebadge":
13
+ $option = $bvcb->bvmain->badgeinfo;
14
+ $badgeinfo = array();
15
+ $badgeinfo['badgeurl'] = $_REQUEST['badgeurl'];
16
+ $badgeinfo['badgeimg'] = $_REQUEST['badgeimg'];
17
+ $badgeinfo['badgealt'] = $_REQUEST['badgealt'];
18
+ $info->updateOption($option, $badgeinfo);
19
+ $bvresp->addStatus("status", $info->getOption($option));
20
+ break;
21
+ case "disablebadge":
22
+ $option = $bvcb->bvmain->badgeinfo;
23
+ $info->deleteOption($option);
24
+ $bvresp->addStatus("status", !$info->getOption($option));
25
+ break;
26
+ case "getoption":
27
+ $bvresp->addStatus('getoption', $info->getOption($_REQUEST['opkey']));
28
+ break;
29
+ case "setdynplug":
30
+ $info->updateOption('bvdynplug', $_REQUEST['dynplug']);
31
+ $bvresp->addStatus("setdynplug", $info->getOption('bvdynplug'));
32
+ break;
33
+ case "unsetdynplug":
34
+ $info->deleteOption('bvdynplug');
35
+ $bvresp->addStatus("unsetdynplug", $info->getOption('bvdynplug'));
36
+ break;
37
+ case "setptplug":
38
+ $info->updateOption('bvptplug', $_REQUEST['ptplug']);
39
+ $bvresp->addStatus("setptplug", $info->getOption('bvptplug'));
40
+ break;
41
+ case "unsetptplug":
42
+ $info->deleteOption('bvptlug');
43
+ $bvresp->addStatus("unsetptplug", $info->getOption('bvptlug'));
44
+ break;
45
+ case "wpupplgs":
46
+ $bvresp->addStatus("wpupdateplugins", wp_update_plugins());
47
+ break;
48
+ case "wpupthms":
49
+ $bvresp->addStatus("wpupdatethemes", wp_update_themes());
50
+ break;
51
+ case "wpupcre":
52
+ $bvresp->addStatus("wpupdatecore", wp_version_check());
53
+ break;
54
+ case "rmmonitime":
55
+ $bvcb->bvmain->unSetMonitTime();
56
+ $bvresp->addStatus("rmmonitime", !$bvcb->bvmain->getMonitTime());
57
+ break;
58
+ case "phpinfo":
59
+ phpinfo();
60
+ die();
61
+ break;
62
+ case "dlttrsnt":
63
+ $bvresp->addStatus("dlttrsnt", $bvcb->bvmain->info->deleteTransient($_REQUEST['key']));
64
+ break;
65
+ default:
66
+ return false;
67
+ }
68
+ return true;
69
+ }
70
+ }
71
+ endif;
callback/wings/monit.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVMonitCallback')) :
5
+
6
+ class BVMonitCallback {
7
+ public function getData($table, $limit = 0, $filter = "") {
8
+ global $bvcb;
9
+ $result = array();
10
+ $data = array();
11
+ $rows = $bvcb->bvmain->db->getTableContent($table, '*', $filter, $limit);
12
+ $last_id = 0;
13
+ foreach ($rows as $row) {
14
+ $result[] = $row;
15
+ $last_id = $row['id'];
16
+ }
17
+ $data['last_id'] = $last_id;
18
+ $data['rows'] = $result;
19
+ return $data;
20
+ }
21
+
22
+ public function deleteBvDynamicEvents($filter = "") {
23
+ global $bvcb;
24
+ $name = BVDynSync::$dynsync_table;
25
+ return $bvcb->bvmain->db->deleteBVTableContent($name, $filter);
26
+ }
27
+
28
+ public function process($method) {
29
+ global $bvresp, $bvcb;
30
+ $db = $bvcb->bvmain->db;
31
+ $info = $bvcb->bvmain->info;
32
+ $bvcb->bvmain->setMonitTime();
33
+ switch ($method) {
34
+ case "getdata":
35
+ if (array_key_exists('lp', $_REQUEST)) {
36
+ require_once dirname( __FILE__ ) . '/../../lp/config.php';
37
+ $lp_params = $_REQUEST['lp'];
38
+ $limit = intval(urldecode($lp_params['limit']));
39
+ $filter = urldecode($lp_params['filter']);
40
+ $db->deleteBVTableContent(BVLPConfig::$requests_table, $lp_params['rmfilter']);
41
+ $table = $bvcb->bvmain->db->getBVTable(BVLPConfig::$requests_table);
42
+ $bvresp->addStatus("lplogs", $this->getData($table, $limit, $filter));
43
+ }
44
+ if (array_key_exists('fw', $_REQUEST)) {
45
+ require_once dirname( __FILE__ ) . '/../../fw/config.php';
46
+ $fw_params = $_REQUEST['fw'];
47
+ $limit = intval(urldecode($fw_params['limit']));
48
+ $filter = urldecode($fw_params['filter']);
49
+ $db->deleteBVTableContent(BVFWConfig::$requests_table, $fw_params['rmfilter']);
50
+ $table = $bvcb->bvmain->db->getBVTable(BVFWConfig::$requests_table);
51
+ $bvresp->addStatus("fwlogs", $this->getData($table, $limit, $filter));
52
+ }
53
+ if (array_key_exists('dynevent', $_REQUEST)) {
54
+ require_once dirname( __FILE__ ) . '/../../dynsync.php';
55
+ $isdynsyncactive = $info->getOption('bvDynSyncActive');
56
+ if ($isdynsyncactive == 'yes') {
57
+ $limit = intval(urldecode($_REQUEST['limit']));
58
+ $filter = urldecode($_REQUEST['filter']);
59
+ $this->deleteBvDynamicEvents($_REQUEST['rmfilter']);
60
+ $table = $bvcb->bvmain->db->getBVTable(BVDynSync::$dynsync_table);
61
+ $data = $this->getData($table, $limit, $filter);
62
+ $bvresp->addStatus('last_id', $data['last_id']);
63
+ $bvresp->addStatus('events', $data['rows']);
64
+ $bvresp->addStatus('timestamp', time());
65
+ $bvresp->addStatus("status", true);
66
+ }
67
+ }
68
+ break;
69
+ case "rmdata":
70
+ require_once dirname( __FILE__ ) . '/../../dynsync.php';
71
+ $filter = urldecode($_REQUEST['filter']);
72
+ $bvresp->addStatus("status", $this->deleteBvDynamicEvents($filter));
73
+ break;
74
+ }
75
+ }
76
+ }
77
+ endif;
callback/wings/protect.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVProtectCallback')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/../../protect.php';
7
+
8
+ class BVProtectCallback {
9
+ public function process($method) {
10
+ global $bvcb, $bvresp;
11
+ $protect = new BVProtect($bvcb->bvmain);
12
+ $info = $bvcb->bvmain->info;
13
+ switch ($method) {
14
+ case "gtipprobeinfo":
15
+ $headers = $_REQUEST['hdrs'];
16
+ $hdrsinfo = array();
17
+ if ($headers && is_array($headers)) {
18
+ foreach($headers as $hdr) {
19
+ if (array_key_exists($hdr, $_SERVER)) {
20
+ $hdrsinfo[$hdr] = $_SERVER[$hdr];
21
+ }
22
+ }
23
+ }
24
+ $bvresp->addStatus("hdrsinfo", $hdrsinfo);
25
+ if ($iphdr = $info->getOption($bvcb->bvmain->ip_header_option)) {
26
+ $bvresp->addStatus("iphdr", $iphdr);
27
+ }
28
+ break;
29
+ case "gtraddr":
30
+ $raddr = array_key_exists('REMOTE_ADDR', $_SERVER) ? $_SERVER['REMOTE_ADDR'] : false;
31
+ $bvresp->addStatus("raddr", $raddr);
32
+ break;
33
+ case "gtallhdrs":
34
+ $data = (function_exists('getallheaders')) ? getallheaders() : false;
35
+ $bvresp->addStatus("allhdrs", $data);
36
+ break;
37
+ case "gtsvr":
38
+ $bvresp->addStatus("svr", $_SERVER);
39
+ break;
40
+ case "gtip":
41
+ $bvresp->addStatus("ip", $protect->getIP());
42
+ break;
43
+ case "stiphdr":
44
+ $option_name = $bvcb->bvmain->ip_header_option;
45
+ $iphdr = array('hdr' => $_REQUEST['hdr'], 'pos' => $_REQUEST['pos']);
46
+ $info->updateOption($option_name, $iphdr);
47
+ $bvresp->addStatus("iphdr", $info->getOption($option_name));
48
+ break;
49
+ case "gtiphdr":
50
+ $bvresp->addStatus("iphdr", $info->getOption($bvcb->bvmain->ip_header_option));
51
+ break;
52
+ case "rmiphdr":
53
+ $option_name = $bvcb->bvmain->ip_header_option;
54
+ $info->deleteOption($option_name);
55
+ $bvresp->addStatus("iphdr", $info->getOption($option_name));
56
+ break;
57
+ default:
58
+ return false;
59
+ }
60
+ }
61
+ }
62
+ endif;
css/bvmui.min.css ADDED
@@ -0,0 +1 @@
 
1
+ /*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */.mui-appbar{background-color:#2196f3;color:#FFF}.mui-btn{font-weight:500;font-size:14px;line-height:18px;text-transform:uppercase;color:rgba(0,0,0,0.87);background-color:#FFF;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;height:36px;padding:0 26px;margin:6px 0;border:0;border-radius:2px;cursor:pointer;-ms-touch-action:manipulation;touch-action:manipulation;background-image:none;text-align:center;line-height:36px;vertical-align:middle;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:14px;font-family:inherit;letter-spacing:.03em;position:relative;overflow:hidden}.mui-btn:hover,.mui-btn:focus,.mui-btn:active{color:rgba(0,0,0,0.87);background-color:white}.mui-btn[disabled]:hover,.mui-btn[disabled]:focus,.mui-btn[disabled]:active{color:rgba(0,0,0,0.87);background-color:#FFF}.mui-btn.mui-btn--flat{color:rgba(0,0,0,0.87);background-color:transparent}.mui-btn.mui-btn--flat:hover,.mui-btn.mui-btn--flat:focus,.mui-btn.mui-btn--flat:active{color:rgba(0,0,0,0.87);background-color:#f2f2f2}.mui-btn.mui-btn--flat[disabled]:hover,.mui-btn.mui-btn--flat[disabled]:focus,.mui-btn.mui-btn--flat[disabled]:active{color:rgba(0,0,0,0.87);background-color:transparent}.mui-btn:hover,.mui-btn:focus,.mui-btn:active{outline:0;text-decoration:none;color:rgba(0,0,0,0.87)}.mui-btn:hover,.mui-btn:focus{-webkit-box-shadow:0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2);box-shadow:0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2)}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-btn:hover,.mui-btn:focus{-webkit-box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2);box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2)}}@supports(-ms-ime-align:auto){.mui-btn:hover,.mui-btn:focus{-webkit-box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2);box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2)}}.mui-btn:active:hover{-webkit-box-shadow:0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2);box-shadow:0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2)}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-btn:active:hover{-webkit-box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2);box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2)}}@supports(-ms-ime-align:auto){.mui-btn:active:hover{-webkit-box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2);box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2)}}.mui-btn:disabled,.mui-btn.mui--is-disabled{cursor:not-allowed;pointer-events:none;opacity:.60;-webkit-box-shadow:none;box-shadow:none}.mui-btn+.mui-btn{margin-left:8px}.mui-btn--flat{background-color:transparent}.mui-btn--flat:hover,.mui-btn--flat:focus,.mui-btn--flat:active,.mui-btn--flat:active:hover{-webkit-box-shadow:none;box-shadow:none;background-color:#f2f2f2}.mui-btn--raised,.mui-btn--fab{-webkit-box-shadow:0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2);box-shadow:0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2)}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-btn--raised,.mui-btn--fab{-webkit-box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2);box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2)}}@supports(-ms-ime-align:auto){.mui-btn--raised,.mui-btn--fab{-webkit-box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2);box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 2px rgba(0,0,0,0.12),0 2px 2px rgba(0,0,0,0.2)}}.mui-btn--raised:active,.mui-btn--fab:active{-webkit-box-shadow:0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2);box-shadow:0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2)}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-btn--raised:active,.mui-btn--fab:active{-webkit-box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2);box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2)}}@supports(-ms-ime-align:auto){.mui-btn--raised:active,.mui-btn--fab:active{-webkit-box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2);box-shadow:0 -1px 2px rgba(0,0,0,0.12),-1px 0 2px rgba(0,0,0,0.12),0 0 4px rgba(0,0,0,0.12),1px 3px 4px rgba(0,0,0,0.2)}}.mui-btn--fab{position:relative;padding:0;width:55px;height:55px;line-height:55px;border-radius:50%;z-index:1}.mui-btn--primary{color:#FFF;background-color:#2196f3}.mui-btn--primary:hover,.mui-btn--primary:focus,.mui-btn--primary:active{color:#FFF;background-color:#39a1f4}.mui-btn--primary[disabled]:hover,.mui-btn--primary[disabled]:focus,.mui-btn--primary[disabled]:active{color:#FFF;background-color:#2196f3}.mui-btn--primary.mui-btn--flat{color:#2196f3;background-color:transparent}.mui-btn--primary.mui-btn--flat:hover,.mui-btn--primary.mui-btn--flat:focus,.mui-btn--primary.mui-btn--flat:active{color:#2196f3;background-color:#f2f2f2}.mui-btn--primary.mui-btn--flat[disabled]:hover,.mui-btn--primary.mui-btn--flat[disabled]:focus,.mui-btn--primary.mui-btn--flat[disabled]:active{color:#2196f3;background-color:transparent}.mui-btn--dark{color:#FFF;background-color:#424242}.mui-btn--dark:hover,.mui-btn--dark:focus,.mui-btn--dark:active{color:#FFF;background-color:#4f4f4f}.mui-btn--dark[disabled]:hover,.mui-btn--dark[disabled]:focus,.mui-btn--dark[disabled]:active{color:#FFF;background-color:#424242}.mui-btn--dark.mui-btn--flat{color:#424242;background-color:transparent}.mui-btn--dark.mui-btn--flat:hover,.mui-btn--dark.mui-btn--flat:focus,.mui-btn--dark.mui-btn--flat:active{color:#424242;background-color:#f2f2f2}.mui-btn--dark.mui-btn--flat[disabled]:hover,.mui-btn--dark.mui-btn--flat[disabled]:focus,.mui-btn--dark.mui-btn--flat[disabled]:active{color:#424242;background-color:transparent}.mui-btn--danger{color:#FFF;background-color:#f44336}.mui-btn--danger:hover,.mui-btn--danger:focus,.mui-btn--danger:active{color:#FFF;background-color:#f55a4e}.mui-btn--danger[disabled]:hover,.mui-btn--danger[disabled]:focus,.mui-btn--danger[disabled]:active{color:#FFF;background-color:#f44336}.mui-btn--danger.mui-btn--flat{color:#f44336;background-color:transparent}.mui-btn--danger.mui-btn--flat:hover,.mui-btn--danger.mui-btn--flat:focus,.mui-btn--danger.mui-btn--flat:active{color:#f44336;background-color:#f2f2f2}.mui-btn--danger.mui-btn--flat[disabled]:hover,.mui-btn--danger.mui-btn--flat[disabled]:focus,.mui-btn--danger.mui-btn--flat[disabled]:active{color:#f44336;background-color:transparent}.mui-btn--accent{color:#FFF;background-color:#ff4081}.mui-btn--accent:hover,.mui-btn--accent:focus,.mui-btn--accent:active{color:#FFF;background-color:#ff5a92}.mui-btn--accent[disabled]:hover,.mui-btn--accent[disabled]:focus,.mui-btn--accent[disabled]:active{color:#FFF;background-color:#ff4081}.mui-btn--accent.mui-btn--flat{color:#ff4081;background-color:transparent}.mui-btn--accent.mui-btn--flat:hover,.mui-btn--accent.mui-btn--flat:focus,.mui-btn--accent.mui-btn--flat:active{color:#ff4081;background-color:#f2f2f2}.mui-btn--accent.mui-btn--flat[disabled]:hover,.mui-btn--accent.mui-btn--flat[disabled]:focus,.mui-btn--accent.mui-btn--flat[disabled]:active{color:#ff4081;background-color:transparent}.mui-btn--small{height:30.6px;line-height:30.6px;padding:0 16px;font-size:13px}.mui-btn--large{height:54px;line-height:54px;padding:0 26px;font-size:14px}.mui-btn--fab.mui-btn--small{width:44px;height:44px;line-height:44px}.mui-btn--fab.mui-btn--large{width:75px;height:75px;line-height:75px}.mui-radio,.mui-checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.mui-radio>label,.mui-checkbox>label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:normal;cursor:pointer}.mui-radio input:disabled,.mui-checkbox input:disabled{cursor:not-allowed}.mui-radio input:focus,.mui-checkbox input:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.mui-radio>label>input[type="radio"],.mui-radio--inline>label>input[type="radio"],.mui-checkbox>label>input[type="checkbox"],.mui-checkbox--inline>label>input[type="checkbox"]{position:absolute;margin-left:-20px;margin-top:4px}.mui-radio+.mui-radio,.mui-checkbox+.mui-checkbox{margin-top:-5px}.mui-radio--inline,.mui-checkbox--inline{display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:normal;cursor:pointer}.mui-radio--inline>input[type="radio"],.mui-radio--inline>input[type="checkbox"],.mui-radio--inline>label>input[type="radio"],.mui-radio--inline>label>input[type="checkbox"],.mui-checkbox--inline>input[type="radio"],.mui-checkbox--inline>input[type="checkbox"],.mui-checkbox--inline>label>input[type="radio"],.mui-checkbox--inline>label>input[type="checkbox"]{margin:4px 0 0;line-height:normal}.mui-radio--inline+.mui-radio--inline,.mui-checkbox--inline+.mui-checkbox--inline{margin-top:0;margin-left:10px}.mui-container{-webkit-box-sizing:border-box;box-sizing:border-box;margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}.mui-container:before,.mui-container:after{content:" ";display:table}.mui-container:after{clear:both}@media(min-width:544px){.mui-container{max-width:570px}}@media(min-width:768px){.mui-container{max-width:740px}}@media(min-width:992px){.mui-container{max-width:960px}}@media(min-width:1200px){.mui-container{max-width:1170px}}.mui-container-fluid{-webkit-box-sizing:border-box;box-sizing:border-box;margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}.mui-container-fluid:before,.mui-container-fluid:after{content:" ";display:table}.mui-container-fluid:after{clear:both}.mui-divider{display:block;height:1px;background-color:rgba(0,0,0,0.12)}.mui--divider-top{border-top:1px solid rgba(0,0,0,0.12)}.mui--divider-bottom{border-bottom:1px solid rgba(0,0,0,0.12)}.mui--divider-left{border-left:1px solid rgba(0,0,0,0.12)}.mui--divider-right{border-right:1px solid rgba(0,0,0,0.12)}.mui-dropdown{display:inline-block;position:relative}[data-mui-toggle="dropdown"]{outline:0}.mui-dropdown__menu{position:absolute;top:100%;left:0;display:none;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:14px;text-align:left;background-color:#FFF;border-radius:2px;z-index:1;background-clip:padding-box}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-dropdown__menu{border-top:1px solid rgba(0,0,0,0.12);border-left:1px solid rgba(0,0,0,0.12)}}@supports(-ms-ime-align:auto){.mui-dropdown__menu{border-top:1px solid rgba(0,0,0,0.12);border-left:1px solid rgba(0,0,0,0.12)}}.mui-dropdown__menu.mui--is-open{display:block}.mui-dropdown__menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.429;color:rgba(0,0,0,0.87);text-decoration:none;white-space:nowrap}.mui-dropdown__menu>li>a:hover,.mui-dropdown__menu>li>a:focus{text-decoration:none;color:rgba(0,0,0,0.87);background-color:#eee}.mui-dropdown__menu>.mui--is-disabled>a,.mui-dropdown__menu>.mui--is-disabled>a:hover,.mui-dropdown__menu>.mui--is-disabled>a:focus{color:#eee}.mui-dropdown__menu>.mui--is-disabled>a:hover,.mui-dropdown__menu>.mui--is-disabled>a:focus{text-decoration:none;background-color:transparent;background-image:none;cursor:not-allowed}.mui-dropdown__menu--right{left:auto;right:0}.mui-form legend{display:block;width:100%;padding:0;margin-bottom:10px;font-size:21px;color:rgba(0,0,0,0.87);line-height:inherit;border:0}.mui-form fieldset{border:0;padding:0;margin:0 0 20px 0}@media(min-width:544px){.mui-form--inline .mui-textfield{display:inline-block;vertical-align:bottom;margin-bottom:0}.mui-form--inline .mui-radio,.mui-form--inline .mui-checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.mui-form--inline .mui-radio>label,.mui-form--inline .mui-checkbox>label{padding-left:0}.mui-form--inline .mui-radio>label>input[type="radio"],.mui-form--inline .mui-checkbox>label>input[type="checkbox"]{position:relative;margin-left:0}.mui-form--inline .mui-select{display:inline-block;vertical-align:bottom;margin-bottom:0}.mui-form--inline .mui-btn{margin-bottom:0;margin-top:0;vertical-align:bottom}}.mui-row{margin-left:-15px;margin-right:-15px}.mui-row:before,.mui-row:after{content:" ";display:table}.mui-row:after{clear:both}.mui-col-xs-1,.mui-col-sm-1,.mui-col-md-1,.mui-col-lg-1,.mui-col-xs-2,.mui-col-sm-2,.mui-col-md-2,.mui-col-lg-2,.mui-col-xs-3,.mui-col-sm-3,.mui-col-md-3,.mui-col-lg-3,.mui-col-xs-4,.mui-col-sm-4,.mui-col-md-4,.mui-col-lg-4,.mui-col-xs-5,.mui-col-sm-5,.mui-col-md-5,.mui-col-lg-5,.mui-col-xs-6,.mui-col-sm-6,.mui-col-md-6,.mui-col-lg-6,.mui-col-xs-7,.mui-col-sm-7,.mui-col-md-7,.mui-col-lg-7,.mui-col-xs-8,.mui-col-sm-8,.mui-col-md-8,.mui-col-lg-8,.mui-col-xs-9,.mui-col-sm-9,.mui-col-md-9,.mui-col-lg-9,.mui-col-xs-10,.mui-col-sm-10,.mui-col-md-10,.mui-col-lg-10,.mui-col-xs-11,.mui-col-sm-11,.mui-col-md-11,.mui-col-lg-11,.mui-col-xs-12,.mui-col-sm-12,.mui-col-md-12,.mui-col-lg-12{-webkit-box-sizing:border-box;box-sizing:border-box;min-height:1px;padding-left:15px;padding-right:15px}.mui-col-xs-1,.mui-col-xs-2,.mui-col-xs-3,.mui-col-xs-4,.mui-col-xs-5,.mui-col-xs-6,.mui-col-xs-7,.mui-col-xs-8,.mui-col-xs-9,.mui-col-xs-10,.mui-col-xs-11,.mui-col-xs-12{float:left}.mui-col-xs-1{width:8.33333%}.mui-col-xs-2{width:16.66667%}.mui-col-xs-3{width:25%}.mui-col-xs-4{width:33.33333%}.mui-col-xs-5{width:41.66667%}.mui-col-xs-6{width:50%}.mui-col-xs-7{width:58.33333%}.mui-col-xs-8{width:66.66667%}.mui-col-xs-9{width:75%}.mui-col-xs-10{width:83.33333%}.mui-col-xs-11{width:91.66667%}.mui-col-xs-12{width:100%}.mui-col-xs-offset-0{margin-left:0}.mui-col-xs-offset-1{margin-left:8.33333%}.mui-col-xs-offset-2{margin-left:16.66667%}.mui-col-xs-offset-3{margin-left:25%}.mui-col-xs-offset-4{margin-left:33.33333%}.mui-col-xs-offset-5{margin-left:41.66667%}.mui-col-xs-offset-6{margin-left:50%}.mui-col-xs-offset-7{margin-left:58.33333%}.mui-col-xs-offset-8{margin-left:66.66667%}.mui-col-xs-offset-9{margin-left:75%}.mui-col-xs-offset-10{margin-left:83.33333%}.mui-col-xs-offset-11{margin-left:91.66667%}.mui-col-xs-offset-12{margin-left:100%}@media(min-width:544px){.mui-col-sm-1,.mui-col-sm-2,.mui-col-sm-3,.mui-col-sm-4,.mui-col-sm-5,.mui-col-sm-6,.mui-col-sm-7,.mui-col-sm-8,.mui-col-sm-9,.mui-col-sm-10,.mui-col-sm-11,.mui-col-sm-12{float:left}.mui-col-sm-1{width:8.33333%}.mui-col-sm-2{width:16.66667%}.mui-col-sm-3{width:25%}.mui-col-sm-4{width:33.33333%}.mui-col-sm-5{width:41.66667%}.mui-col-sm-6{width:50%}.mui-col-sm-7{width:58.33333%}.mui-col-sm-8{width:66.66667%}.mui-col-sm-9{width:75%}.mui-col-sm-10{width:83.33333%}.mui-col-sm-11{width:91.66667%}.mui-col-sm-12{width:100%}.mui-col-sm-offset-0{margin-left:0}.mui-col-sm-offset-1{margin-left:8.33333%}.mui-col-sm-offset-2{margin-left:16.66667%}.mui-col-sm-offset-3{margin-left:25%}.mui-col-sm-offset-4{margin-left:33.33333%}.mui-col-sm-offset-5{margin-left:41.66667%}.mui-col-sm-offset-6{margin-left:50%}.mui-col-sm-offset-7{margin-left:58.33333%}.mui-col-sm-offset-8{margin-left:66.66667%}.mui-col-sm-offset-9{margin-left:75%}.mui-col-sm-offset-10{margin-left:83.33333%}.mui-col-sm-offset-11{margin-left:91.66667%}.mui-col-sm-offset-12{margin-left:100%}}@media(min-width:768px){.mui-col-md-1,.mui-col-md-2,.mui-col-md-3,.mui-col-md-4,.mui-col-md-5,.mui-col-md-6,.mui-col-md-7,.mui-col-md-8,.mui-col-md-9,.mui-col-md-10,.mui-col-md-11,.mui-col-md-12{float:left}.mui-col-md-1{width:8.33333%}.mui-col-md-2{width:16.66667%}.mui-col-md-3{width:25%}.mui-col-md-4{width:33.33333%}.mui-col-md-5{width:41.66667%}.mui-col-md-6{width:50%}.mui-col-md-7{width:58.33333%}.mui-col-md-8{width:66.66667%}.mui-col-md-9{width:75%}.mui-col-md-10{width:83.33333%}.mui-col-md-11{width:91.66667%}.mui-col-md-12{width:100%}.mui-col-md-offset-0{margin-left:0}.mui-col-md-offset-1{margin-left:8.33333%}.mui-col-md-offset-2{margin-left:16.66667%}.mui-col-md-offset-3{margin-left:25%}.mui-col-md-offset-4{margin-left:33.33333%}.mui-col-md-offset-5{margin-left:41.66667%}.mui-col-md-offset-6{margin-left:50%}.mui-col-md-offset-7{margin-left:58.33333%}.mui-col-md-offset-8{margin-left:66.66667%}.mui-col-md-offset-9{margin-left:75%}.mui-col-md-offset-10{margin-left:83.33333%}.mui-col-md-offset-11{margin-left:91.66667%}.mui-col-md-offset-12{margin-left:100%}}@media(min-width:992px){.mui-col-lg-1,.mui-col-lg-2,.mui-col-lg-3,.mui-col-lg-4,.mui-col-lg-5,.mui-col-lg-6,.mui-col-lg-7,.mui-col-lg-8,.mui-col-lg-9,.mui-col-lg-10,.mui-col-lg-11,.mui-col-lg-12{float:left}.mui-col-lg-1{width:8.33333%}.mui-col-lg-2{width:16.66667%}.mui-col-lg-3{width:25%}.mui-col-lg-4{width:33.33333%}.mui-col-lg-5{width:41.66667%}.mui-col-lg-6{width:50%}.mui-col-lg-7{width:58.33333%}.mui-col-lg-8{width:66.66667%}.mui-col-lg-9{width:75%}.mui-col-lg-10{width:83.33333%}.mui-col-lg-11{width:91.66667%}.mui-col-lg-12{width:100%}.mui-col-lg-offset-0{margin-left:0}.mui-col-lg-offset-1{margin-left:8.33333%}.mui-col-lg-offset-2{margin-left:16.66667%}.mui-col-lg-offset-3{margin-left:25%}.mui-col-lg-offset-4{margin-left:33.33333%}.mui-col-lg-offset-5{margin-left:41.66667%}.mui-col-lg-offset-6{margin-left:50%}.mui-col-lg-offset-7{margin-left:58.33333%}.mui-col-lg-offset-8{margin-left:66.66667%}.mui-col-lg-offset-9{margin-left:75%}.mui-col-lg-offset-10{margin-left:83.33333%}.mui-col-lg-offset-11{margin-left:91.66667%}.mui-col-lg-offset-12{margin-left:100%}}@media(min-width:1200px){.mui-col-xl-1,.mui-col-xl-2,.mui-col-xl-3,.mui-col-xl-4,.mui-col-xl-5,.mui-col-xl-6,.mui-col-xl-7,.mui-col-xl-8,.mui-col-xl-9,.mui-col-xl-10,.mui-col-xl-11,.mui-col-xl-12{float:left}.mui-col-xl-1{width:8.33333%}.mui-col-xl-2{width:16.66667%}.mui-col-xl-3{width:25%}.mui-col-xl-4{width:33.33333%}.mui-col-xl-5{width:41.66667%}.mui-col-xl-6{width:50%}.mui-col-xl-7{width:58.33333%}.mui-col-xl-8{width:66.66667%}.mui-col-xl-9{width:75%}.mui-col-xl-10{width:83.33333%}.mui-col-xl-11{width:91.66667%}.mui-col-xl-12{width:100%}.mui-col-xl-offset-0{margin-left:0}.mui-col-xl-offset-1{margin-left:8.33333%}.mui-col-xl-offset-2{margin-left:16.66667%}.mui-col-xl-offset-3{margin-left:25%}.mui-col-xl-offset-4{margin-left:33.33333%}.mui-col-xl-offset-5{margin-left:41.66667%}.mui-col-xl-offset-6{margin-left:50%}.mui-col-xl-offset-7{margin-left:58.33333%}.mui-col-xl-offset-8{margin-left:66.66667%}.mui-col-xl-offset-9{margin-left:75%}.mui-col-xl-offset-10{margin-left:83.33333%}.mui-col-xl-offset-11{margin-left:91.66667%}.mui-col-xl-offset-12{margin-left:100%}}.mui-panel{padding:15px;margin-bottom:20px;border-radius:0;background-color:#FFF;-webkit-box-shadow:0 2px 2px 0 rgba(0,0,0,0.16),0 0 2px 0 rgba(0,0,0,0.12);box-shadow:0 2px 2px 0 rgba(0,0,0,0.16),0 0 2px 0 rgba(0,0,0,0.12)}.mui-panel:before,.mui-panel:after{content:" ";display:table}.mui-panel:after{clear:both}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-panel{-webkit-box-shadow:0 -1px 2px 0 rgba(0,0,0,0.12),-1px 0 2px 0 rgba(0,0,0,0.12),0 2px 2px 0 rgba(0,0,0,0.16),0 0 2px 0 rgba(0,0,0,0.12);box-shadow:0 -1px 2px 0 rgba(0,0,0,0.12),-1px 0 2px 0 rgba(0,0,0,0.12),0 2px 2px 0 rgba(0,0,0,0.16),0 0 2px 0 rgba(0,0,0,0.12)}}@supports(-ms-ime-align:auto){.mui-panel{-webkit-box-shadow:0 -1px 2px 0 rgba(0,0,0,0.12),-1px 0 2px 0 rgba(0,0,0,0.12),0 2px 2px 0 rgba(0,0,0,0.16),0 0 2px 0 rgba(0,0,0,0.12);box-shadow:0 -1px 2px 0 rgba(0,0,0,0.12),-1px 0 2px 0 rgba(0,0,0,0.12),0 2px 2px 0 rgba(0,0,0,0.16),0 0 2px 0 rgba(0,0,0,0.12)}}.mui-select{display:block;padding-top:15px;margin-bottom:20px;position:relative}.mui-select:focus{outline:0}.mui-select:focus>select{height:33px;margin-bottom:-1px;border-color:#2196f3;border-width:2px}.mui-select>select{display:block;height:32px;width:100%;appearance:none;-webkit-appearance:none;-moz-appearance:none;outline:0;border:0;border-bottom:1px solid rgba(0,0,0,0.26);border-radius:0;-webkit-box-shadow:none;box-shadow:none;background-color:transparent;background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNiIgd2lkdGg9IjEwIj48cG9seWdvbiBwb2ludHM9IjAsMCAxMCwwIDUsNiIgc3R5bGU9ImZpbGw6cmdiYSgwLDAsMCwuMjQpOyIvPjwvc3ZnPg==");background-repeat:no-repeat;background-position:right center;cursor:pointer;color:rgba(0,0,0,0.87);font-size:16px;font-family:inherit;line-height:inherit;padding:0 25px 0 0}.mui-select>select::-ms-expand{display:none}.mui-select>select:focus{outline:0;height:33px;margin-bottom:-1px;border-color:#2196f3;border-width:2px}.mui-select>select:disabled{color:rgba(0,0,0,0.38);cursor:not-allowed;background-color:transparent;opacity:1}.mui-select>select:-moz-focusring{color:transparent;text-shadow:0 0 0 #000}.mui-select>select:focus::-ms-value{background:0;color:rgba(0,0,0,0.87)}.mui-select>label{position:absolute;top:0;display:block;width:100%;color:rgba(0,0,0,0.54);font-size:12px;font-weight:400;line-height:15px;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}.mui-select:focus>label,.mui-select>select:focus ~ label{color:#2196f3}.mui-select__menu{position:absolute;z-index:2;min-width:100%;overflow-y:auto;padding:8px 0;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#FFF;font-size:16px}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.mui-select__menu{border-left:1px solid rgba(0,0,0,0.12);border-top:1px solid rgba(0,0,0,0.12)}}@supports(-ms-ime-align:auto){.mui-select__menu{border-left:1px solid rgba(0,0,0,0.12);border-top:1px solid rgba(0,0,0,0.12)}}.mui-select__menu>div{padding:0 22px;height:42px;line-height:42px;cursor:pointer;white-space:nowrap}.mui-select__menu>div.mui--is-selected{background-color:#eee}.mui-select__menu>div.mui--is-disabled{color:rgba(0,0,0,0.38);cursor:not-allowed}.mui-select__menu>div:not(.mui-optgroup__label):not(.mui--is-disabled):hover{background-color:#e0e0e0}.mui-optgroup__option{text-indent:1em}.mui-optgroup__label{color:rgba(0,0,0,0.54);font-size:.9em}.mui-table{width:100%;max-width:100%;margin-bottom:20px}.mui-table>thead>tr>th,.mui-table>tbody>tr>th,.mui-table>tfoot>tr>th{text-align:left}.mui-table>thead>tr>th,.mui-table>thead>tr>td,.mui-table>tbody>tr>th,.mui-table>tbody>tr>td,.mui-table>tfoot>tr>th,.mui-table>tfoot>tr>td{padding:10px;line-height:1.429}.mui-table>thead>tr>th{border-bottom:2px solid rgba(0,0,0,0.12);font-weight:700}.mui-table>tbody+tbody{border-top:2px solid rgba(0,0,0,0.12)}.mui-table.mui-table--bordered>tbody>tr>td{border-bottom:1px solid rgba(0,0,0,0.12)}.mui-tabs__bar{list-style:none;padding-left:0;margin-bottom:0;background-color:transparent;white-space:nowrap;overflow-x:auto}.mui-tabs__bar>li{display:inline-block}.mui-tabs__bar>li>a{display:block;white-space:nowrap;text-transform:uppercase;font-weight:500;font-size:14px;color:rgba(0,0,0,0.87);cursor:default;height:48px;line-height:48px;padding-left:24px;padding-right:24px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mui-tabs__bar>li>a:hover{text-decoration:none}.mui-tabs__bar>li.mui--is-active{border-bottom:2px solid #2196f3}.mui-tabs__bar>li.mui--is-active>a{color:#2196f3}.mui-tabs__bar.mui-tabs__bar--justified{display:table;width:100%;table-layout:fixed}.mui-tabs__bar.mui-tabs__bar--justified>li{display:table-cell}.mui-tabs__bar.mui-tabs__bar--justified>li>a{text-align:center;padding-left:0;padding-right:0}.mui-tabs__pane{display:none}.mui-tabs__pane.mui--is-active{display:block}.mui-textfield{display:block;padding-top:15px;margin-bottom:20px;position:relative}.mui-textfield>label{position:absolute;top:0;display:block;width:100%;color:rgba(0,0,0,0.54);font-size:12px;font-weight:400;line-height:15px;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}.mui-textfield>textarea{padding-top:5px}.mui-textfield>input:focus ~ label,.mui-textfield>textarea:focus ~ label{color:#2196f3}.mui-textfield--float-label>label{position:absolute;-webkit-transform:translate(0px,15px);transform:translate(0px,15px);font-size:16px;line-height:32px;color:rgba(0,0,0,0.26);text-overflow:clip;cursor:text;pointer-events:none}.mui-textfield--float-label>input:focus ~ label,.mui-textfield--float-label>textarea:focus ~ label{-webkit-transform:translate(0px,0px);transform:translate(0px,0px);font-size:12px;line-height:15px;text-overflow:ellipsis}.mui-textfield--float-label>input:not(:focus).mui--is-not-empty ~ label,.mui-textfield--float-label>input:not(:focus)[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty) ~ label,.mui-textfield--float-label>input:not(:focus):not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) ~ label,.mui-textfield--float-label>textarea:not(:focus).mui--is-not-empty ~ label,.mui-textfield--float-label>textarea:not(:focus)[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty) ~ label,.mui-textfield--float-label>textarea:not(:focus):not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) ~ label{color:rgba(0,0,0,0.54);font-size:12px;line-height:15px;-webkit-transform:translate(0px,0px);transform:translate(0px,0px);text-overflow:ellipsis}.mui-textfield--wrap-label{display:table;width:100%;padding-top:0}.mui-textfield--wrap-label:not(.mui-textfield--float-label)>label{display:table-header-group;position:static;white-space:normal;overflow-x:visible}.mui-textfield>input,.mui-textfield>textarea{-webkit-box-sizing:border-box;box-sizing:border-box;display:block;background-color:transparent;color:rgba(0,0,0,0.87);border:0;border-bottom:1px solid rgba(0,0,0,0.26);outline:0;width:100%;padding:0;-webkit-box-shadow:none;box-shadow:none;border-radius:0;font-size:16px;font-family:inherit;line-height:inherit;background-image:none}.mui-textfield>input:focus,.mui-textfield>textarea:focus{border-color:#2196f3;border-width:2px}.mui-textfield>input:disabled,.mui-textfield>input:-moz-read-only,.mui-textfield>textarea:disabled,.mui-textfield>textarea:-moz-read-only{cursor:not-allowed;background-color:transparent;opacity:1}.mui-textfield>input:disabled,.mui-textfield>input:read-only,.mui-textfield>textarea:disabled,.mui-textfield>textarea:read-only{cursor:not-allowed;background-color:transparent;opacity:1}.mui-textfield>input::-webkit-input-placeholder,.mui-textfield>textarea::-webkit-input-placeholder{color:rgba(0,0,0,0.26);opacity:1}.mui-textfield>input:-ms-input-placeholder,.mui-textfield>textarea:-ms-input-placeholder{color:rgba(0,0,0,0.26);opacity:1}.mui-textfield>input::-ms-input-placeholder,.mui-textfield>textarea::-ms-input-placeholder{color:rgba(0,0,0,0.26);opacity:1}.mui-textfield>input::placeholder,.mui-textfield>textarea::placeholder{color:rgba(0,0,0,0.26);opacity:1}.mui-textfield>input{height:32px}.mui-textfield>input:focus{height:33px;margin-bottom:-1px}.mui-textfield>textarea{min-height:64px}.mui-textfield>textarea[rows]:not([rows="2"]):focus{margin-bottom:-1px}.mui-textfield>input:focus{height:33px;margin-bottom:-1px}.mui-textfield>input:invalid:not(:focus):not(:required),.mui-textfield>input:invalid:not(:focus):required.mui--is-not-empty,.mui-textfield>input:invalid:not(:focus):required.mui--is-empty.mui--is-touched,.mui-textfield>input:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>textarea:invalid:not(:focus):not(:required),.mui-textfield>textarea:invalid:not(:focus):required.mui--is-not-empty,.mui-textfield>textarea:invalid:not(:focus):required.mui--is-empty.mui--is-touched,.mui-textfield>textarea:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>textarea:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:not(:focus).mui--is-invalid:not(:required),.mui-textfield>input:not(:focus).mui--is-invalid:required.mui--is-not-empty,.mui-textfield>input:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-touched,.mui-textfield>input:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>textarea:not(:focus).mui--is-invalid:not(:required),.mui-textfield>textarea:not(:focus).mui--is-invalid:required.mui--is-not-empty,.mui-textfield>textarea:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-touched,.mui-textfield>textarea:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>textarea:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty){border-color:#f44336;border-width:2px}.mui-textfield>input:invalid:not(:focus):not(:required),.mui-textfield>input:invalid:not(:focus):required.mui--is-not-empty,.mui-textfield>input:invalid:not(:focus):required.mui--is-empty.mui--is-touched,.mui-textfield>input:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:not(:focus).mui--is-invalid:not(:required),.mui-textfield>input:not(:focus).mui--is-invalid:required.mui--is-not-empty,.mui-textfield>input:not(:focus).mui--is-invalid:required.mui--is-empty.mui--is-touched,.mui-textfield>input:not(:focus).mui--is-invalid:required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty),.mui-textfield>input:not(:focus).mui--is-invalid:required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty){height:33px;margin-bottom:-1px}.mui-textfield.mui-textfield--float-label>input:invalid:not(:focus):not(:required) ~ label,.mui-textfield.mui-textfield--float-label>input:invalid:not(:focus):required.mui--is-not-empty ~ label,.mui-textfield.mui-textfield--float-label>input:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty) ~ label,.mui-textfield.mui-textfield--float-label>input:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) ~ label,.mui-textfield.mui-textfield--float-label>textarea:invalid:not(:focus):not(:required) ~ label,.mui-textfield.mui-textfield--float-label>textarea:invalid:not(:focus):required.mui--is-not-empty ~ label,.mui-textfield.mui-textfield--float-label>textarea:invalid:not(:focus):required[value]:not([value=""]):not(.mui--is-empty):not(.mui--is-not-empty) ~ label,.mui-textfield.mui-textfield--float-label>textarea:invalid:not(:focus):required:not(:empty):not(.mui--is-empty):not(.mui--is-not-empty) ~ label{color:#f44336}.mui-textfield:not(.mui-textfield--float-label)>input:invalid:not(:focus):not(:required) ~ label,.mui-textfield:not(.mui-textfield--float-label)>input:invalid:not(:focus):required.mui--is-empty.mui--is-touched ~ label,.mui-textfield:not(.mui-textfield--float-label)>input:invalid:not(:focus):required.mui--is-not-empty ~ label,.mui-textfield:not(.mui-textfield--float-label)>textarea:invalid:not(:focus):not(:required) ~ label,.mui-textfield:not(.mui-textfield--float-label)>textarea:invalid:not(:focus):required.mui--is-empty.mui--is-touched ~ label,.mui-textfield:not(.mui-textfield--float-label)>textarea:invalid:not(:focus):required.mui--is-not-empty ~ label{color:#f44336}.mui-textfield.mui-textfield--float-label>.mui--is-invalid.mui--is-not-empty:not(:focus) ~ label{color:#f44336}.mui-textfield:not(.mui-textfield--float-label)>.mui--is-invalid:not(:focus) ~ label{color:#f44336}.mui--no-transition{-webkit-transition:none!important;transition:none!important}.mui--no-user-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mui-caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.mui--text-left{text-align:left!important}.mui--text-right{text-align:right!important}.mui--text-center{text-align:center!important}.mui--text-justify{text-align:justify!important}.mui--text-nowrap{white-space:nowrap!important}.mui--align-baseline{vertical-align:baseline!important}.mui--align-top{vertical-align:top!important}.mui--align-middle{vertical-align:middle!important}.mui--align-bottom{vertical-align:bottom!important}.mui--text-dark{color:rgba(0,0,0,0.87)}.mui--text-dark-secondary{color:rgba(0,0,0,0.54)}.mui--text-dark-hint{color:rgba(0,0,0,0.38)}.mui--text-light{color:#FFF}.mui--text-light-secondary{color:rgba(255,255,255,0.7)}.mui--text-light-hint{color:rgba(255,255,255,0.3)}.mui--text-accent{color:rgba(255,64,129,0.87)}.mui--text-accent-secondary{color:rgba(255,64,129,0.54)}.mui--text-accent-hint{color:rgba(255,64,129,0.38)}.mui--text-black{color:#000}.mui--text-white{color:#FFF}.mui--text-danger{color:#f44336}.mui--bg-primary{background-color:#2196f3}.mui--bg-primary-dark{background-color:#1976d2}.mui--bg-primary-light{background-color:#bbdefb}.mui--bg-accent{background-color:#ff4081}.mui--bg-accent-dark{background-color:#f50057}.mui--bg-accent-light{background-color:#ff80ab}.mui--bg-danger{background-color:#f44336}.mui-list--unstyled{padding-left:0;list-style:none}.mui-list--inline{padding-left:0;list-style:none;margin-left:-5px}.mui-list--inline>li{display:inline-block;padding-left:5px;padding-right:5px}.mui--z1,.mui-dropdown__menu,.mui-select__menu{-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.12),0 1px 2px rgba(0,0,0,0.24);box-shadow:0 1px 3px rgba(0,0,0,0.12),0 1px 2px rgba(0,0,0,0.24)}.mui--z2{-webkit-box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23);box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23)}.mui--z3{-webkit-box-shadow:0 10px 20px rgba(0,0,0,0.19),0 6px 6px rgba(0,0,0,0.23);box-shadow:0 10px 20px rgba(0,0,0,0.19),0 6px 6px rgba(0,0,0,0.23)}.mui--z4{-webkit-box-shadow:0 14px 28px rgba(0,0,0,0.25),0 10px 10px rgba(0,0,0,0.22);box-shadow:0 14px 28px rgba(0,0,0,0.25),0 10px 10px rgba(0,0,0,0.22)}.mui--z5{-webkit-box-shadow:0 19px 38px rgba(0,0,0,0.3),0 15px 12px rgba(0,0,0,0.22);box-shadow:0 19px 38px rgba(0,0,0,0.3),0 15px 12px rgba(0,0,0,0.22)}.mui--clearfix:before,.mui--clearfix:after{content:" ";display:table}.mui--clearfix:after{clear:both}.mui--pull-right{float:right!important}.mui--pull-left{float:left!important}.mui--hide{display:none!important}.mui--show{display:block!important}.mui--invisible{visibility:hidden}.mui--overflow-hidden{overflow:hidden!important}.mui--overflow-hidden-x{overflow-x:hidden!important}.mui--overflow-hidden-y{overflow-y:hidden!important}.mui--visible-xs-block,.mui--visible-xs-inline,.mui--visible-xs-inline-block,.mui--visible-sm-block,.mui--visible-sm-inline,.mui--visible-sm-inline-block,.mui--visible-md-block,.mui--visible-md-inline,.mui--visible-md-inline-block,.mui--visible-lg-block,.mui--visible-lg-inline,.mui--visible-lg-inline-block,.mui--visible-xl-block,.mui--visible-xl-inline,.mui--visible-xl-inline-block{display:none!important}@media(max-width:543px){.mui-visible-xs{display:block!important}table.mui-visible-xs{display:table}tr.mui-visible-xs{display:table-row!important}th.mui-visible-xs,td.mui-visible-xs{display:table-cell!important}.mui--visible-xs-block{display:block!important}.mui--visible-xs-inline{display:inline!important}.mui--visible-xs-inline-block{display:inline-block!important}}@media(min-width:544px) and (max-width:767px){.mui-visible-sm{display:block!important}table.mui-visible-sm{display:table}tr.mui-visible-sm{display:table-row!important}th.mui-visible-sm,td.mui-visible-sm{display:table-cell!important}.mui--visible-sm-block{display:block!important}.mui--visible-sm-inline{display:inline!important}.mui--visible-sm-inline-block{display:inline-block!important}}@media(min-width:768px) and (max-width:991px){.mui-visible-md{display:block!important}table.mui-visible-md{display:table}tr.mui-visible-md{display:table-row!important}th.mui-visible-md,td.mui-visible-md{display:table-cell!important}.mui--visible-md-block{display:block!important}.mui--visible-md-inline{display:inline!important}.mui--visible-md-inline-block{display:inline-block!important}}@media(min-width:992px) and (max-width:1199px){.mui-visible-lg{display:block!important}table.mui-visible-lg{display:table}tr.mui-visible-lg{display:table-row!important}th.mui-visible-lg,td.mui-visible-lg{display:table-cell!important}.mui--visible-lg-block{display:block!important}.mui--visible-lg-inline{display:inline!important}.mui--visible-lg-inline-block{display:inline-block!important}}@media(min-width:1200px){.mui-visible-xl{display:block!important}table.mui-visible-xl{display:table}tr.mui-visible-xl{display:table-row!important}th.mui-visible-xl,td.mui-visible-xl{display:table-cell!important}.mui--visible-xl-block{display:block!important}.mui--visible-xl-inline{display:inline!important}.mui--visible-xl-inline-block{display:inline-block!important}}@media(max-width:543px){.mui--hidden-xs{display:none!important}}@media(min-width:544px) and (max-width:767px){.mui--hidden-sm{display:none!important}}@media(min-width:768px) and (max-width:991px){.mui--hidden-md{display:none!important}}@media(min-width:992px) and (max-width:1199px){.mui--hidden-lg{display:none!important}}@media(min-width:1200px){.mui--hidden-xl{display:none!important}}.mui-scrlock--showbar-y{overflow-y:scroll!important}.mui-scrlock--showbar-x{overflow-x:scroll!important}#mui-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:99999999;background-color:rgba(0,0,0,0.2);overflow:auto}.mui-btn__ripple-container{position:absolute;top:0;left:0;display:block;height:100%;width:100%;overflow:hidden;z-index:0;pointer-events:none}.mui-ripple{position:absolute;top:0;left:0;border-radius:50%;opacity:0;pointer-events:none;-webkit-transform:scale(0.0001,0.0001);transform:scale(0.0001,0.0001)}.mui-ripple.mui--is-animating{-webkit-transform:none;transform:none;-webkit-transition:width .3s cubic-bezier(0,0,0.2,1),height .3s cubic-bezier(0,0,0.2,1),opacity .3s cubic-bezier(0,0,0.2,1),-webkit-transform .3s cubic-bezier(0,0,0.2,1);transition:width .3s cubic-bezier(0,0,0.2,1),height .3s cubic-bezier(0,0,0.2,1),opacity .3s cubic-bezier(0,0,0.2,1),-webkit-transform .3s cubic-bezier(0,0,0.2,1);transition:transform .3s cubic-bezier(0,0,0.2,1),width .3s cubic-bezier(0,0,0.2,1),height .3s cubic-bezier(0,0,0.2,1),opacity .3s cubic-bezier(0,0,0.2,1);transition:transform .3s cubic-bezier(0,0,0.2,1),width .3s cubic-bezier(0,0,0.2,1),height .3s cubic-bezier(0,0,0.2,1),opacity .3s cubic-bezier(0,0,0.2,1),-webkit-transform .3s cubic-bezier(0,0,0.2,1)}.mui-ripple.mui--is-visible{opacity:.3}.mui-btn .mui-ripple{background-color:#a6a6a6}.mui-btn--primary .mui-ripple{background-color:#FFF}.mui-btn--dark .mui-ripple{background-color:#FFF}.mui-btn--danger .mui-ripple{background-color:#FFF}.mui-btn--accent .mui-ripple{background-color:#FFF}.mui-btn--flat .mui-ripple{background-color:#a6a6a6}.mui--text-display4{font-weight:300;font-size:112px;line-height:112px}.mui--text-display3{font-weight:400;font-size:56px;line-height:56px}.mui--text-display2{font-weight:400;font-size:45px;line-height:48px}.mui--text-display1,h1{font-weight:400;font-size:34px;line-height:40px}.mui--text-headline,h2{font-weight:400;font-size:24px;line-height:32px}.mui--text-title,h3{font-weight:400;font-size:20px;line-height:28px}.mui--text-subhead,h4{font-weight:400;font-size:16px;line-height:24px}.mui--text-body2,h5{font-weight:500;font-size:14px;line-height:24px}.mui--text-body1{font-weight:400;font-size:14px;line-height:20px}.mui--text-caption{font-weight:400;font-size:12px;line-height:16px}.mui--text-menu{font-weight:500;font-size:13px;line-height:17px}.mui--text-button{font-weight:500;font-size:14px;line-height:18px;text-transform:uppercase}
css/bvplugin.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bv-box,.new-account-panel{-webkit-box-shadow:0 2px 2px 0 rgba(0,0,0,.24),0 0 2px 0 rgba(0,0,0,.24)}<style>.header{background:#25bea0}.top-links{width:400px;float:right;margin-top:15px}.bv-top-button{padding:5px;margin:5px;border:1px solid #17252A;display:inline-block;background:#17252A;border-radius:5px;float:right}.bv-top-button:hover{background:rgba(0,0,0,.6)}.bv-top-button a{text-decoration:none;color:#FFF}.main-title{text-align:center;font-size:32px;margin:10px;text-decoration:underline;font-weight:700}.bv-box{background:#FFF}.new-account-panel{margin-top:10px;margin-bottom:0;border:1px solid #000}.bv-input{font-size:20px;height:40px!important}.bv-tick{color:#52BE80;font-weight:700;padding-left:3px}h2{margin:0;padding:0}.form-title{font-size:24px;margin-bottom:10px}.select-purpose{width:200px;vertical-align:baseline !important;height:40px}.get-started-button{margin-left:10px;height:40px;margin-top:0;font-weight:700;color:#FFF}.side{float:left;margin-top:15px;padding-left:0;padding-right:0}.side-box{padding:0;border:1px solid #000}.side-box-title{font-size:14px;background:#17252a;text-align:center;color:#FFF}.bv-upgrade-button{background:#FF6037;width:80%;margin:0 auto 10px;text-align:center;padding:10px;border-radius:5px}.bv-upgrade-button a{color:#FFF;text-decoration:none;font-size:18px}.footer-logo{margin-right:30px}
dynsync.php ADDED
@@ -0,0 +1,576 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVDynSync')) :
5
+
6
+ class BVDynSync {
7
+
8
+ public static $dynsync_table = 'dynamic_sync';
9
+ public $bvmain;
10
+ /**
11
+ * PHP5 constructor.
12
+ */
13
+ function __construct($bvmain) {
14
+ $this->bvmain = $bvmain;
15
+ }
16
+
17
+ function init() {
18
+ $this->add_actions_and_listeners();
19
+ add_action('clear_dynsync_config', array($this, 'clearConfig'));
20
+ }
21
+
22
+ public function clearConfig() {
23
+ $this->bvmain->info->deleteOption('bvdynplug');
24
+ $this->bvmain->info->deleteOption('bvDynSyncActive');
25
+ $this->bvmain->info->deleteOption('bvWooDynSync');
26
+ $this->bvmain->db->dropBVTable(BVDynSync::$dynsync_table);
27
+ }
28
+
29
+ public static function getDynSyncTableName() {
30
+ return $this->bvmain->db->getBVTable(BVDynSync::$dynsync_table);
31
+ }
32
+
33
+ function add_event($event_type, $event_data) {
34
+ global $wp_current_filter;
35
+ $site_id = get_current_blog_id();
36
+ $values = array ( "event_type" => $event_type, "event_tag" => end($wp_current_filter), "event_data" => maybe_serialize($event_data), "site_id" => $site_id);
37
+ $this->bvmain->db->replaceIntoBVTable(BVDynSync::$dynsync_table, $values);
38
+ }
39
+
40
+ function add_db_event($table, $message) {
41
+ $_msg = array();
42
+ $_msg['table'] = $table;
43
+ $_msg['data'] = $message;
44
+ $this->add_event('db', $_msg);
45
+ }
46
+
47
+ function post_action_handler($post_id) {
48
+ if (current_filter() == 'delete_post')
49
+ $msg_type = 'delete';
50
+ else
51
+ $msg_type = 'edit';
52
+ $this->add_db_event('posts', array('ID' => $post_id, 'msg_type' => $msg_type));
53
+ }
54
+
55
+ function get_ignored_postmeta() {
56
+ $defaults = array(
57
+ '_excluded_links'
58
+ );
59
+ $ignored_postmeta = $this->bvmain->info->getOption('bvIgnoredPostmeta');
60
+ if (empty($ignored_postmeta)) {
61
+ $ignored_postmeta = array();
62
+ }
63
+ return array_unique(array_merge($defaults, $ignored_postmeta));
64
+ }
65
+
66
+ function postmeta_insert_handler($meta_id, $post_id, $meta_key, $meta_value='') {
67
+ if (in_array($meta_key, $this->get_ignored_postmeta(), true))
68
+ return;
69
+ $this->add_db_event('postmeta', array('meta_id' => $meta_id));
70
+ }
71
+
72
+ function postmeta_modification_handler($meta_id, $object_id, $meta_key, $meta_value) {
73
+ if (in_array($meta_key, $this->get_ignored_postmeta(), true))
74
+ return;
75
+ if (!is_array($meta_id))
76
+ return $this->add_db_event('postmeta', array('meta_id' => $meta_id));
77
+ foreach ($meta_id as $id) {
78
+ $this->add_db_event('postmeta', array('meta_id' => $id));
79
+ }
80
+ }
81
+
82
+ function postmeta_action_handler($meta_id, $post_id = null, $meta_key = null) {
83
+ if (in_array($meta_key, $this->get_ignored_postmeta(), true))
84
+ return;
85
+ if ( !is_array($meta_id) )
86
+ return $this->add_db_event('postmeta', array('meta_id' => $meta_id));
87
+ foreach ( $meta_id as $id )
88
+ $this->add_db_event('postmeta', array('meta_id' => $id));
89
+ }
90
+
91
+ function comment_action_handler($comment_id) {
92
+ if (current_filter() == 'delete_comment')
93
+ $msg_type = 'delete';
94
+ else
95
+ $msg_type = 'edit';
96
+ if (!is_array($comment_id)) {
97
+ if (wp_get_comment_status($comment_id) != 'spam')
98
+ $this->add_db_event('comments', array('comment_ID' => $comment_id, 'msg_type' => $msg_type));
99
+ } else {
100
+ foreach ($comment_id as $id) {
101
+ if (wp_get_comment_status($comment_id) != 'spam')
102
+ $this->add_db_event('comments', array('comment_ID' => $idi, 'msg_type' => $msg_type));
103
+ }
104
+ }
105
+ }
106
+
107
+ function commentmeta_insert_handler($meta_id, $comment_id = null) {
108
+ if (empty($comment_id) || wp_get_comment_status($comment_id) != 'spam')
109
+ $this->add_db_event('commentmeta', array('meta_id' => $meta_id));
110
+ }
111
+
112
+ function commentmeta_modification_handler($meta_id, $object_id, $meta_key, $meta_value) {
113
+ if (current_filter() == 'deleted_comment_meta')
114
+ $msg_type = 'delete';
115
+ else
116
+ $msg_type = 'edit';
117
+ if (!is_array($meta_id))
118
+ return $this->add_db_event('commentmeta', array('meta_id' => $meta_id, 'msg_type' => $msg_type));
119
+ foreach ($meta_id as $id) {
120
+ $this->add_db_event('commentmeta', array('meta_id' => $id, 'msg_type' => $msg_type));
121
+ }
122
+ }
123
+
124
+ function userid_action_handler($user_or_id) {
125
+ if (is_object($user_or_id))
126
+ $userid = intval( $user_or_id->ID );
127
+ else
128
+ $userid = intval( $user_or_id );
129
+ if ( !$userid )
130
+ return;
131
+ if (current_filter() == 'deleted_user')
132
+ $msg_type = 'delete';
133
+ else
134
+ $msg_type = 'edit';
135
+
136
+ $this->add_db_event('users', array('ID' => $userid));
137
+ }
138
+
139
+ function usermeta_insert_handler($umeta_id, $user_id = null) {
140
+ $this->add_db_event('usermeta', array('umeta_id' => $umeta_id));
141
+ }
142
+
143
+ function usermeta_modification_handler($umeta_id, $object_id, $meta_key, $meta_value = '') {
144
+ if (current_filter() == 'delete_usermeta')
145
+ $msg_type = 'delete';
146
+ else
147
+ $msg_type = 'edit';
148
+ if (!is_array($umeta_id))
149
+ return $this->add_db_event('usermeta', array('umeta_id' => $umeta_id, 'msg_type' => $msg_type));
150
+ foreach ($umeta_id as $id) {
151
+ $this->add_db_event('usermeta', array('umeta_id' => $id, 'msg_type' => $msg_type));
152
+ }
153
+ }
154
+
155
+ function link_action_handler($link_id) {
156
+ $this->add_db_event('links', array('link_id' => $link_id));
157
+ }
158
+
159
+ function edited_terms_handler($term_id, $taxonomy = null) {
160
+ $this->add_db_event('terms', array('term_id' => $term_id));
161
+ }
162
+
163
+ function term_handler($term_id, $tt_id, $taxonomy) {
164
+ $this->add_db_event('terms', array('term_id' => $term_id));
165
+ $this->term_taxonomy_handler($tt_id, $taxonomy);
166
+ }
167
+
168
+ function delete_term_handler($term, $tt_id, $taxonomy, $deleted_term ) {
169
+ $this->add_db_event('terms', array('term_id' => $term, 'msg_type' => 'delete'));
170
+ }
171
+
172
+ function term_taxonomy_handler($tt_id, $taxonomy = null) {
173
+ $this->add_db_event('term_taxonomy', array('term_taxonomy_id' => $tt_id));
174
+ }
175
+
176
+ function term_taxonomies_handler($tt_ids) {
177
+ foreach((array)$tt_ids as $tt_id) {
178
+ $this->term_taxonomy_handler($tt_id);
179
+ }
180
+ }
181
+
182
+ function term_relationship_handler($object_id, $term_id) {
183
+ $this->add_db_event('term_relationships', array('term_taxonomy_id' => $term_id, 'object_id' => $object_id));
184
+ }
185
+
186
+ function term_relationships_handler($object_id, $term_ids) {
187
+ foreach ((array)$term_ids as $term_id) {
188
+ $this->term_relationship_handler($object_id, $term_id);
189
+ }
190
+ }
191
+
192
+ function set_object_terms_handler( $object_id, $terms, $tt_ids ) {
193
+ $this->term_relationships_handler( $object_id, $tt_ids );
194
+ }
195
+
196
+ function get_ignored_options() {
197
+ $defaults = array(
198
+ 'cron',
199
+ 'wpsupercache_gc_time',
200
+ 'rewrite_rules',
201
+ 'akismet_spam_count',
202
+ 'iwp_client_user_hit_count',
203
+ '_disqus_sync_lock',
204
+ 'stats_cache'
205
+ );
206
+ $ignored_options = $this->bvmain->info->getOption('bvIgnoredOptions');
207
+ if (empty($ignored_options)) {
208
+ $ignored_options = array();
209
+ }
210
+ return array_unique(array_merge($defaults, $ignored_options));
211
+ }
212
+
213
+ function get_ping_permission($option_name) {
214
+ $ping_permitted = true;
215
+ $ignored_options = $this->get_ignored_options();
216
+ foreach($ignored_options as $val) {
217
+ if ($val{0} == '/') {
218
+ if (preg_match($val, $option_name))
219
+ $ping_permitted = false;
220
+ } else {
221
+ if ($val == $option_name)
222
+ $ping_permitted = false;
223
+ }
224
+ if (!$ping_permitted)
225
+ break;
226
+ }
227
+ return $ping_permitted;
228
+ }
229
+
230
+ function option_handler($option_name) {
231
+ if (current_filter() == 'deleted_option')
232
+ $msg_type = 'delete';
233
+ else
234
+ $msg_type = 'edit';
235
+ $ping_permitted = $this->get_ping_permission($option_name);
236
+ if ($ping_permitted)
237
+ $this->add_db_event('options', array('option_name' => $option_name, 'msg_type' => 'delete'));
238
+ return $option_name;
239
+ }
240
+
241
+ function theme_action_handler($theme) {
242
+ $this->add_event('themes', array('theme' => $this->bvmain->info->getOption('stylesheet')));
243
+ }
244
+
245
+ function plugin_action_handler($plugin='') {
246
+ $this->add_event('plugins', array('name' => $plugin));
247
+ }
248
+
249
+ function upload_handler($file) {
250
+ $this->add_event('uploads', array('file' => $file['file']));
251
+ return $file;
252
+ }
253
+
254
+ function wpmu_new_blog_create_handler($site_id) {
255
+ $this->add_db_event('blogs', array('site_id' => $site_id));
256
+ }
257
+
258
+ function sitemeta_handler($option) {
259
+ $ping_permitted = $this->get_ping_permission($option);
260
+ if ($ping_permitted && is_multisite()) {
261
+ $this->add_db_event('sitemeta', array('site_id' => $this->bvmain->db->getSiteId(), 'meta_key' => $option));
262
+ }
263
+ return $ping_permitted;
264
+ }
265
+
266
+ /* WOOCOMMERCE SUPPORT FUNCTIONS BEGINS FROM HERE*/
267
+
268
+ function woocommerce_resume_order_handler($order_id) {
269
+ $this->add_db_event('woocommerce_order_items', array('order_id' => $order_id, 'msg_type' => 'delete'));
270
+ $meta_ids = array();
271
+ $itemmeta_table = $this->bvmain->db->getWPTable('woocommerce_order_itemmeta');
272
+ $items_table = $this->bvmain->db->getWPTable('woocommerce_order_items');
273
+ foreach( $this->bvmain->db->getResult($this->bvmain->db->prepare("SELECT {$itemmeta_table}.meta_id FROM {$itemmeta_table} INNER JOIN {$items_table} WHERE {$items_table}.order_item_id = {$itemmeta_table}.order_item_id AND {$items_table}.order_id = %d", $order_id)) as $key => $row) {
274
+ if (!in_array($row->meta_id, $meta_ids, true)) {
275
+ $meta_ids[] = $row->meta_id;
276
+ $this->add_db_event('woocommerce_order_itemmeta', array('meta_id' => $row->meta_id, 'msg_type' => 'delete'));
277
+ }
278
+ }
279
+ }
280
+
281
+ function woocommerce_new_order_item_handler($item_id, $item, $order_id) {
282
+ $this->add_db_event('woocommerce_order_items', array('order_item_id' => $item_id));
283
+ $this->add_db_event('woocommerce_order_itemmeta', array('order_item_id' => $item_id));
284
+ }
285
+
286
+ function woocommerce_update_order_item_handler($item_id, $args){
287
+ $this->add_db_event('woocommerce_order_items', array('order_item_id' => $item_id));
288
+ }
289
+
290
+ function woocommerce_delete_order_item_handler($item_id) {
291
+ $this->add_db_event('woocommerce_order_itemmeta', array('order_item_id' => $item_id, 'msg_type' => 'delete'));
292
+ $this->add_db_event('woocommerce_order_items', array('order_item_id' => $item_id, 'msg_type' => 'delete'));
293
+ }
294
+
295
+ function woocommerce_downloadable_product_permissions_delete_handler($bool, $download_id, $product_id, $order) {
296
+ $this->add_db_event('woocommerce_downloadable_product_permissions', array('order_id' => $order->id, 'product_id' => $product_id, 'download_id' => $download_id));
297
+ return true;
298
+ }
299
+
300
+ function woocommerce_attribute_added_handler($attribute_id, $attribute) {
301
+ $this->add_db_event('woocommerce_attribute_taxonomies', array('attribute_id' => $attribute_id));
302
+ }
303
+
304
+ function woocommerce_attribute_updated_handler($attribute_id, $attribute, $old_attribute_name) {
305
+ $this->add_db_event('woocommerce_attribute_taxonomies', array('attribute_id' => $attribute_id));
306
+ # $woocommerce->attribute_taxonomy_name( $attribute_name )
307
+ $this->add_db_event('term_taxonomy', array('taxonomy' => wc_attribute_taxonomy_name($attribute['attribute_name'])));
308
+ # sanitize_title( $attribute_name )
309
+ $this->add_db_event('woocommerce_termmeta', array('meta_key' => 'order_pa_' . $attribute['attribute_name']));#deprecated
310
+ $this->add_db_event('termmeta', array('meta_key' => 'order_pa_' . $attribute['attribute_name']));
311
+ $this->add_db_event('postmeta', array('meta_key' => '_product_attributes'));
312
+ # sanitize_title( $attribute_name )
313
+ $this->add_db_event('postmeta', array('meta_key' => 'attribute_pa_' . $attribute['attribute_name']));
314
+ }
315
+
316
+ function woocommerce_attribute_deleted_handler($attribute_id, $attribute_name, $taxonomy) {
317
+ return $this->add_db_event('woocommerce_attribute_taxonomies', array('attribute_id' => $attribute_id, 'msg_type' => 'delete'));
318
+ }
319
+
320
+ function woocommerce_revoke_access_to_product_download_handler($download_id, $product_id, $order_id, $permission_id ) {
321
+ $this->add_db_event('woocommerce_downloadable_product_permissions', array('permission_id' => $permission_id, 'msg_type' => 'delete'));
322
+ }
323
+
324
+ function woocommerce_tax_rate_handler($tax_rate_id, $_tax_rate) {
325
+ $this->add_db_event('woocommerce_tax_rates', array('tax_rate_id' => $tax_rate_id));
326
+ $this->add_db_event('woocommerce_tax_rate_locations', array('tax_rate_id' => $tax_rate_id));
327
+ }
328
+
329
+ function woocommerce_tax_rate_deleted_handler($tax_rate_id) {
330
+ $this->add_db_event('woocommerce_tax_rates', array('tax_rate_id' => $tax_rate_id, 'msg_type' => 'delete'));
331
+ $this->add_db_event('woocommerce_tax_rate_locations', array('tax_rate_id' => $tax_rate_id, 'msg_type' => 'delete'));
332
+ }
333
+
334
+ function woocommerce_grant_product_download_access_handler($data) {
335
+ $this->add_db_event('woocommerce_downloadable_product_permissions', array('download_id' => $data['download_id'], 'user_id' => $data['user_id'], 'order_id' => $data['order_id'], 'product_id' => $data['product_id']));
336
+ }
337
+
338
+ function woocommerce_download_product_handler($user_email, $order_key, $product_id, $user_id, $download_id, $order_id) {
339
+ $this->add_db_event('woocommerce_downloadable_product_permissions', array('order_id' => $order_id, 'user_id' => $user_id, 'order_key' => $order_key, 'product_id' => $product_id));
340
+ }
341
+
342
+ function woocommerce_delete_order_items_handler($postid) {
343
+ $meta_ids = array();
344
+ $order_item_ids = array();
345
+ foreach( $this->bvmain->db->getResult("SELECT {$this->bvmain->db->dbprefix}woocommerce_order_itemmeta.meta_id, {$this->bvmain->db->dbprefix}woocommerce_order_items.order_item_id FROM {$this->bvmain->db->dbprefix}woocommerce_order_items JOIN {$this->bvmain->db->dbprefix}woocommerce_order_itemmeta ON {$this->bvmain->db->dbprefix}woocommerce_order_items.order_item_id = {$this->bvmain->db->dbprefix}woocommerce_order_itemmeta.order_item_id WHERE {$this->bvmain->db->dbprefix}woocommerce_order_items.order_id = '{$postid}'") as $key => $row) {
346
+ if (!in_array($row->meta_id, $meta_ids, true)) {
347
+ $meta_ids[] = $row->meta_id;
348
+ $this->add_db_event('woocommerce_order_itemmeta', array('meta_id' => $row->meta_id, 'msg_type' => 'delete'));
349
+ }
350
+ if (!in_array($row->order_item_id, $order_item_ids, true)) {
351
+ $order_item_ids[] = $row->order_item_id;
352
+ $this->add_db_event('woocommerce_order_items', array('order_item_id' => $row->order_item_id, 'msg_type' => 'delete'));
353
+ }
354
+ }
355
+ }
356
+
357
+ function woocommerce_payment_token_handler($token_id) {
358
+ $this->add_db_event('woocommerce_payment_tokens', array('token_id' => $token_id));
359
+ }
360
+
361
+ function woocommerce_payment_token_deleted_handler($token_id, $object) {
362
+ $this->add_db_event('woocommerce_payment_tokens', array('token_id' => $token_id, 'msg_type' => 'delete'));
363
+ $this->add_db_event('woocommerce_payment_tokenmeta', array('payment_token_id' => $token_id, 'msg_type' => 'delete'));
364
+ }
365
+
366
+ function woocommerce_shipping_zone_method_added_handler($instance_id, $method_id, $zone_id) {
367
+ $this->add_db_event('woocommerce_shipping_zone_methods', array('instance_id' => $instance_id));
368
+ $this->add_db_event('woocommerce_shipping_zones', array('zone_id' => $zone_id));
369
+ $this->add_db_event('woocommerce_shipping_zone_locations', array('zone_id' => $zone_id));
370
+ }
371
+
372
+ function woocommerce_shipping_zone_method_deleted_handler($instance_id, $method_id, $zone_id) {
373
+ $this->add_db_event('woocommerce_shipping_zone_methods', array('instance_id' => $instance_id, 'msg_type' => 'delete'));
374
+ }
375
+
376
+ function woocommerce_shipping_zone_method_status_toggled_handler($instance_id, $method_id, $zone_id, $is_enabled) {
377
+ $this->add_db_event('woocommerce_shipping_zone_methods', array('instance_id' => absint( $instance_id )));
378
+ }
379
+
380
+ function woocommerce_deleted_order_downloadable_permissions_handler($post_id) {
381
+ $this->add_db_event('woocommerce_downloadable_product_permissions', array('order_id' => $post_id, 'msg_type' => 'delete'));
382
+ }
383
+
384
+ function woocommerce_delete_shipping_zone_handler($zone_id) {
385
+ $this->add_db_event('woocommerce_shipping_zone_methods', array('zone_id' => $zone_id, 'msg_type' => 'delete'));
386
+ $this->add_db_event('woocommerce_shipping_zone_locations', array('zone_id' => $zone_id, 'msg_type' => 'delete'));
387
+ $this->add_db_event('woocommerce_shipping_zones', array('zone_id' => $zone_id, 'msg_type' => 'delete'));
388
+ }
389
+
390
+ function woocommerce_webhook_handler($webhook_id) {
391
+ $this->add_db_event('wc_webhooks', array('webhook_id' => $webhook_id));
392
+ }
393
+
394
+ function woocommerce_webhook_delete_handler($webhook_id, $webhook) {
395
+ $this->add_db_event('wc_webhooks', array('webhook_id' => $webhook_id, 'msg_type' => 'delete'));
396
+ }
397
+
398
+ function woocommerce_delete_shipping_zone_method_handler($instance_id) {
399
+ $this->add_db_event('woocommerce_shipping_zone_methods', array('instance_id' => $instance_id, 'msg_type' => 'delete'));
400
+ }
401
+
402
+ function woocommerce_order_term_meta_handler($meta_id, $object_id, $meta_key, $meta_value) {
403
+ if (current_filter() == 'deleted_order_item_meta')
404
+ $msg_type = 'delete';
405
+ else
406
+ $msg_type = 'edit';
407
+ if (!is_array($meta_id)) {
408
+ $this->add_db_event('woocommerce_order_itemmeta', array('meta_id' => $meta_id, 'msg_type' => $msg_type));
409
+ } else {
410
+ foreach ($meta_id as $id) {
411
+ $this->add_db_event('woocommerce_order_itemmeta', array('meta_id' => $id, 'msg_type' => $msg_type));
412
+ }
413
+ }
414
+ }
415
+
416
+ function woocommerce_payment_token_meta_handler($meta_id, $object_id, $meta_key, $meta_value) {
417
+ if (current_filter() == 'deleted_payment_token_meta')
418
+ $msg_type = 'delete';
419
+ else
420
+ $msg_type = 'edit';
421
+ if (!is_array($meta_id)) {
422
+ $this->add_db_event('woocommerce_payment_tokenmeta', array('meta_id' => $meta_id, 'msg_type' => $msg_type));
423
+ } else {
424
+ foreach ($meta_id as $id) {
425
+ $this->add_db_event('woocommerce_payment_tokenmeta', array('meta_id' => $id, 'msg_type' => $msg_type));
426
+ }
427
+ }
428
+ }
429
+
430
+ function woocommerce_api_product_attribute_handler($id, $data) {
431
+ $this->add_db_event('woocommerce_attribute_taxonomies', array('attribute_id' => $id));
432
+ }
433
+
434
+
435
+ /* ADDING ACTION AND LISTENERS FOR CAPTURING EVENTS. */
436
+ public function add_actions_and_listeners() {
437
+ /* CAPTURING EVENTS FOR WP_COMMENTS TABLE */
438
+ add_action('delete_comment', array($this, 'comment_action_handler'));
439
+ add_action('wp_set_comment_status', array($this, 'comment_action_handler'));
440
+ add_action('trashed_comment', array($this, 'comment_action_handler'));
441
+ add_action('untrashed_comment', array($this, 'comment_action_handler'));
442
+ add_action('wp_insert_comment', array($this, 'comment_action_handler'));
443
+ add_action('comment_post', array($this, 'comment_action_handler'));
444
+ add_action('edit_comment', array($this, 'comment_action_handler'));
445
+
446
+ /* CAPTURING EVENTS FOR WP_COMMENTMETA TABLE */
447
+ add_action('added_comment_meta', array($this, 'commentmeta_insert_handler' ), 10, 2);
448
+ add_action('updated_comment_meta', array($this, 'commentmeta_modification_handler'), 10, 4);
449
+ add_action('deleted_comment_meta', array($this, 'commentmeta_modification_handler'), 10, 4);
450
+
451
+ /* CAPTURING EVENTS FOR WP_USERMETA TABLE */
452
+ add_action('added_user_meta', array($this, 'usermeta_insert_handler' ), 10, 2);
453
+ add_action('updated_user_meta', array($this, 'usermeta_modification_handler' ), 10, 4);
454
+ add_action('deleted_user_meta', array($this, 'usermeta_modification_handler' ), 10, 4);
455
+ add_action('added_usermeta', array( $this, 'usermeta_modification_handler'), 10, 4);
456
+ add_action('update_usermeta', array( $this, 'usermeta_modification_handler'), 10, 4);
457
+ add_action('delete_usermeta', array( $this, 'usermeta_modification_handler'), 10, 4);
458
+
459
+ /* CAPTURING EVENTS FOR WP_USERS TABLE */
460
+ add_action('user_register', array($this, 'userid_action_handler'));
461
+ add_action('password_reset', array($this, 'userid_action_handler'));
462
+ add_action('profile_update', array($this, 'userid_action_handler'));
463
+ add_action('deleted_user', array($this, 'userid_action_handler'));
464
+
465
+ /* CAPTURING EVENTS FOR WP_POSTS TABLE */
466
+ add_action('delete_post', array($this, 'post_action_handler'));
467
+ add_action('trash_post', array($this, 'post_action_handler'));
468
+ add_action('untrash_post', array($this, 'post_action_handler'));
469
+ add_action('edit_post', array($this, 'post_action_handler'));
470
+ add_action('save_post', array($this, 'post_action_handler'));
471
+ add_action('wp_insert_post', array($this, 'post_action_handler'));
472
+ add_action('edit_attachment', array($this, 'post_action_handler'));
473
+ add_action('add_attachment', array($this, 'post_action_handler'));
474
+ add_action('delete_attachment', array($this, 'post_action_handler'));
475
+ add_action('private_to_published', array($this, 'post_action_handler'));
476
+ add_action('wp_restore_post_revision', array($this, 'post_action_handler'));
477
+
478
+ /* CAPTURING EVENTS FOR WP_POSTMETA TABLE */
479
+ // Why events for both delete and deleted
480
+ add_action('added_post_meta', array($this, 'postmeta_insert_handler'), 10, 4);
481
+ add_action('update_post_meta', array($this, 'postmeta_modification_handler'), 10, 4);
482
+ add_action('updated_post_meta', array($this, 'postmeta_modification_handler'), 10, 4);
483
+ add_action('delete_post_meta', array($this, 'postmeta_modification_handler'), 10, 4);
484
+ add_action('deleted_post_meta', array($this, 'postmeta_modification_handler'), 10, 4);
485
+ add_action('added_postmeta', array($this, 'postmeta_action_handler'), 10, 3);
486
+ add_action('update_postmeta', array($this, 'postmeta_action_handler'), 10, 3);
487
+ add_action('delete_postmeta', array($this, 'postmeta_action_handler'), 10, 3);
488
+
489
+ /* CAPTURING EVENTS FOR WP_LINKS TABLE */
490
+ add_action('edit_link', array($this, 'link_action_handler'));
491
+ add_action('add_link', array($this, 'link_action_handler'));
492
+ add_action('delete_link', array($this, 'link_action_handler'));
493
+
494
+ /* CAPTURING EVENTS FOR WP_TERM AND WP_TERM_TAXONOMY TABLE */
495
+ add_action('created_term', array($this, 'term_handler'), 10, 3);
496
+ add_action('edited_term', array( $this, 'term_handler' ), 10, 3);
497
+ add_action('edited_terms', array($this, 'edited_terms_handler'), 10, 2);
498
+ add_action('delete_term', array($this, 'delete_term_handler'), 10, 4);
499
+ add_action('edit_term_taxonomy', array($this, 'term_taxonomy_handler'), 10, 2);
500
+ add_action('delete_term_taxonomy', array($this, 'term_taxonomy_handler'));
501
+ add_action('edit_term_taxonomies', array($this, 'term_taxonomies_handler'));
502
+ add_action('add_term_relationship', array($this, 'term_relationship_handler'), 10, 2);
503
+ add_action('delete_term_relationships', array($this, 'term_relationships_handler'), 10, 2);
504
+ add_action('set_object_terms', array($this, 'set_object_terms_handler'), 10, 3);
505
+
506
+ add_action('switch_theme', array($this, 'theme_action_handler'));
507
+ add_action('activate_plugin', array($this, 'plugin_action_handler'));
508
+ add_action('deactivate_plugin', array($this, 'plugin_action_handler'));
509
+
510
+ /* CAPTURING EVENTS FOR WP_OPTIONS */
511
+ add_action('deleted_option', array($this, 'option_handler'));
512
+ add_action('updated_option', array($this, 'option_handler'));
513
+ add_action('added_option', array($this, 'option_handler'));
514
+
515
+ /* CAPTURING EVENTS FOR FILES UPLOAD */
516
+ add_action('wp_handle_upload', array($this, 'upload_handler'));
517
+
518
+ /* These are applicable only in case of WPMU */
519
+ /* XNOTE: Handle registration_log_handler from within the server */
520
+ add_action('wpmu_new_blog', array($this, 'wpmu_new_blog_create_handler'), 10, 1);
521
+ add_action('refresh_blog_details', array($this, 'wpmu_new_blog_create_handler'), 10, 1);
522
+ add_action('delete_site_option',array($this, 'sitemeta_handler'), 10, 1);
523
+ add_action('add_site_option', array($this, 'sitemeta_handler'), 10, 1);
524
+ add_action('update_site_option', array($this, 'sitemeta_handler'), 10, 1);
525
+
526
+ $is_woo_dyn = $this->bvmain->info->getOption('bvWooDynSync');
527
+ if ($is_woo_dyn == 'yes') {
528
+ add_action('woocommerce_resume_order', array($this, 'woocommerce_resume_order_handler'), 10, 1);
529
+ add_action('woocommerce_new_order_item', array($this, 'woocommerce_new_order_item_handler'), 10, 3);
530
+ add_action('woocommerce_update_order_item', array($this, 'woocommerce_update_order_item_handler'), 10, 2);
531
+ add_action('woocommerce_delete_order_item', array($this, 'woocommerce_delete_order_item_handler'), 10, 1);
532
+ add_action('woocommerce_delete_order_items', array($this, 'woocommerce_delete_order_items_handler'), 10, 1);
533
+ add_action('added_order_item_meta', array($this, 'woocommerce_order_term_meta_handler' ), 10, 4);
534
+ add_action('updated_order_item_meta', array($this, 'woocommerce_order_term_meta_handler'), 10, 4);
535
+ add_action('deleted_order_item_meta', array($this, 'woocommerce_order_term_meta_handler'), 10, 4);
536
+
537
+ add_action('woocommerce_attribute_added', array($this, 'woocommerce_attribute_added_handler' ), 10, 2 );
538
+ add_action('woocommerce_attribute_updated', array($this, 'woocommerce_attribute_updated_handler'), 10, 3 );
539
+ add_action('woocommerce_attribute_deleted', array($this, 'woocommerce_attribute_deleted_handler'), 10, 3 );
540
+
541
+ add_action('woocommerce_tax_rate_added', array($this, 'woocommerce_tax_rate_handler'), 10, 2);
542
+ add_action('woocommerce_tax_rate_deleted', array($this, 'woocommerce_tax_rate_deleted_handler'), 10, 1);
543
+ add_action('woocommerce_tax_rate_updated', array($this, 'woocommerce_tax_rate_handler'), 10, 2);
544
+
545
+ add_action('woocommerce_new_webhook', array($this, 'woocommerce_webhook_handler'), 10, 1);
546
+ add_action('woocommerce_webhook_updated', array($this, 'woocommerce_webhook_handler'), 10, 1);
547
+ add_action('woocommerce_webhook_deleted', array($this, 'woocommerce_webhook_delete_handler'), 10, 2);
548
+
549
+ add_action('woocommerce_download_product', array($this, 'woocommerce_download_product_handler'), 10, 6);
550
+ add_action('woocommerce_grant_product_download_access', array($this, 'woocommerce_grant_product_download_access_handler'), 10, 1);
551
+ add_action('woocommerce_ajax_revoke_access_to_product_download', array($this, 'woocommerce_revoke_access_to_product_download_handler'), 10, 4);
552
+ add_action('woocommerce_deleted_order_downloadable_permissions', array($this, 'woocommerce_deleted_order_downloadable_permissions_handler'), 10, 1);
553
+ add_filter('woocommerce_process_product_file_download_paths_remove_access_to_old_file', array($this, 'woocommerce_downloadable_product_permissions_delete_handler', 10, 4));
554
+
555
+ add_action('woocommerce_new_payment_token', array($this, 'woocommerce_payment_token_handler'), 10, 1);
556
+ add_action('woocommerce_payment_token_created', array($this, 'woocommerce_payment_token_handler'), 10, 1);
557
+ add_action('woocommerce_payment_token_updated', array($this, 'woocommerce_payment_token_handler'), 10, 1);
558
+ add_action('woocommerce_payment_token_deleted', array($this, 'woocommerce_payment_token_deleted_handler'), 10, 2);
559
+ add_action('added_payment_token_meta', array($this, 'woocommerce_payment_token_meta_handler' ), 10, 4);
560
+ add_action('updated_payment_token_meta', array($this, 'woocommerce_payment_token_meta_handler'), 10, 4);
561
+ add_action('deleted_payment_token_meta', array($this, 'woocommerce_payment_token_meta_handler'), 10, 4);
562
+
563
+
564
+ add_action('woocommerce_shipping_zone_method_added', array($this, 'woocommerce_shipping_zone_method_added_handler'), 10, 3);
565
+ add_action('woocommerce_shipping_zone_method_status_toggled', array($this, 'woocommerce_shipping_zone_method_status_toggled_handler'), 10, 4);
566
+ add_action('woocommerce_shipping_zone_method_deleted', array($this, 'woocommerce_shipping_zone_method_deleted_handler'), 10, 3);
567
+
568
+ add_action('woocommerce_delete_shipping_zone', array($this, 'woocommerce_delete_shipping_zone_handler'), 10, 1);
569
+ add_action('woocommerce_delete_shipping_zone_method', array($this, 'woocommerce_delete_shipping_zone_method_handler'), 10, 1);
570
+
571
+ add_action('woocommerce_api_create_product_attribute', array($this, 'woocommerce_api_product_attribute_handler'), 10, 2);
572
+ add_action('woocommerce_api_edit_product_attribute', array($this, 'woocommerce_api_product_attribute_handler'), 10, 2);
573
+ }
574
+ }
575
+ }
576
+ endif;
fw/config.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVFWConfig')) :
5
+ class BVFWConfig {
6
+ public $bvmain;
7
+ public static $requests_table = 'fw_requests';
8
+
9
+ function __construct($bvmain) {
10
+ $this->bvmain = $bvmain;
11
+ }
12
+
13
+ #mode
14
+ const DISABLED = 1;
15
+ const AUDIT = 2;
16
+ const PROTECT = 3;
17
+
18
+ public function setMode($mode) {
19
+ if (!$mode) {
20
+ $this->bvmain->info->deleteOption('bvfwmode');
21
+ } else {
22
+ $this->bvmain->info->updateOption('bvfwmode', intval($mode));
23
+ }
24
+ }
25
+
26
+ public function setRulesMode($mode) {
27
+ if (!$mode) {
28
+ $this->bvmain->info->deleteOption('bvfwrulesmode');
29
+ } else {
30
+ $this->bvmain->info->updateOption('bvfwrulesmode', intval($mode));
31
+ }
32
+ }
33
+
34
+ public function setDisabledRules($rules) {
35
+ if (!$rules) {
36
+ $this->bvmain->info->deleteOption('bvfwdisabledrules');
37
+ } else {
38
+ $this->bvmain->info->updateOption('bvfwdisabledrules', $rules);
39
+ }
40
+ }
41
+
42
+ public function getMode() {
43
+ $mode = $this->bvmain->info->getOption('bvfwmode');
44
+ return intval($mode ? $mode : BVFWConfig::DISABLED);
45
+ }
46
+
47
+ public function getRulesMode() {
48
+ $mode = $this->bvmain->info->getOption('bvfwrulesmode');
49
+ return intval($mode ? $mode : BVFWConfig::DISABLED);
50
+ }
51
+
52
+ public function getDisabledRules() {
53
+ $rules = $this->bvmain->info->getOption('bvfwdisabledrules');
54
+ return ($rules ? $rules : array());
55
+ }
56
+
57
+ public function clear() {
58
+ $this->setMode(false);
59
+ $this->setRulesMode(false);
60
+ $this->setDisabledRules(false);
61
+ $this->bvmain->db->dropBVTable(BVFWConfig::$requests_table);
62
+ $this->bvmain->info->deleteOption('bvptplug');
63
+ return true;
64
+ }
65
+ }
66
+ endif;
fw/fw.php ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVFW')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/config.php';
7
+ require_once dirname( __FILE__ ) . '/request.php';
8
+ require_once dirname( __FILE__ ) . './../ipstore.php';
9
+
10
+ class BVFW {
11
+ public $request;
12
+ public $config;
13
+ public $bvmain;
14
+ public $ipstore;
15
+ public $category;
16
+ public $logger;
17
+ #all rule id will also come under this
18
+
19
+ const SQLIREGEX = '/(?:[^\\w<]|\\/\\*\\![0-9]*|^)(?:
20
+ @@HOSTNAME|
21
+ ALTER|ANALYZE|ASENSITIVE|
22
+ BEFORE|BENCHMARK|BETWEEN|BIGINT|BINARY|BLOB|
23
+ CALL|CASE|CHANGE|CHAR|CHARACTER|CHAR_LENGTH|COLLATE|COLUMN|CONCAT|CONDITION|CONSTRAINT|CONTINUE|CONVERT|CREATE|CROSS|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|
24
+ DATABASE|DATABASES|DAY_HOUR|DAY_MICROSECOND|DAY_MINUTE|DAY_SECOND|DECIMAL|DECLARE|DEFAULT|DELAYED|DELETE|DESCRIBE|DETERMINISTIC|DISTINCT|DISTINCTROW|DOUBLE|DROP|DUAL|DUMPFILE|
25
+ EACH|ELSE|ELSEIF|ELT|ENCLOSED|ESCAPED|EXISTS|EXIT|EXPLAIN|EXTRACTVALUE|
26
+ FETCH|FLOAT|FLOAT4|FLOAT8|FORCE|FOREIGN|FROM|FULLTEXT|
27
+ GRANT|GROUP|HAVING|HEX|HIGH_PRIORITY|HOUR_MICROSECOND|HOUR_MINUTE|HOUR_SECOND|
28
+ IFNULL|IGNORE|INDEX|INFILE|INNER|INOUT|INSENSITIVE|INSERT|INTERVAL|ISNULL|ITERATE|
29
+ JOIN|KILL|LEADING|LEAVE|LIMIT|LINEAR|LINES|LOAD|LOAD_FILE|LOCALTIME|LOCALTIMESTAMP|LOCK|LONG|LONGBLOB|LONGTEXT|LOOP|LOW_PRIORITY|
30
+ MASTER_SSL_VERIFY_SERVER_CERT|MATCH|MAXVALUE|MEDIUMBLOB|MEDIUMINT|MEDIUMTEXT|MID|MIDDLEINT|MINUTE_MICROSECOND|MINUTE_SECOND|MODIFIES|
31
+ NATURAL|NO_WRITE_TO_BINLOG|NULL|NUMERIC|OPTION|ORD|ORDER|OUTER|OUTFILE|
32
+ PRECISION|PRIMARY|PRIVILEGES|PROCEDURE|PROCESSLIST|PURGE|
33
+ RANGE|READ_WRITE|REGEXP|RELEASE|REPEAT|REQUIRE|RESIGNAL|RESTRICT|RETURN|REVOKE|RLIKE|ROLLBACK|
34
+ SCHEMA|SCHEMAS|SECOND_MICROSECOND|SELECT|SENSITIVE|SEPARATOR|SHOW|SIGNAL|SLEEP|SMALLINT|SPATIAL|SPECIFIC|SQLEXCEPTION|SQLSTATE|SQLWARNING|SQL_BIG_RESULT|SQL_CALC_FOUND_ROWS|SQL_SMALL_RESULT|STARTING|STRAIGHT_JOIN|SUBSTR|
35
+ TABLE|TERMINATED|TINYBLOB|TINYINT|TINYTEXT|TRAILING|TRANSACTION|TRIGGER|
36
+ UNDO|UNHEX|UNION|UNLOCK|UNSIGNED|UPDATE|UPDATEXML|USAGE|USING|UTC_DATE|UTC_TIME|UTC_TIMESTAMP|
37
+ VALUES|VARBINARY|VARCHAR|VARCHARACTER|VARYING|WHEN|WHERE|WHILE|WRITE|YEAR_MONTH|ZEROFILL)(?=[^\\w]|$)/ix';
38
+ const XSSREGEX = '/(?:
39
+ #tags
40
+ (?:\\<|\\+ADw\\-|\\xC2\\xBC)(script|iframe|svg|object|embed|applet|link|style|meta|\\/\\/|\\?xml\\-stylesheet)(?:[^\\w]|\\xC2\\xBE)|
41
+ #protocols
42
+ (?:^|[^\\w])(?:(?:\\s*(?:&\\#(?:x0*6a|0*106)|j)\\s*(?:&\\#(?:x0*61|0*97)|a)\\s*(?:&\\#(?:x0*76|0*118)|v)\\s*(?:&\\#(?:x0*61|0*97)|a)|\\s*(?:&\\#(?:x0*76|0*118)|v)\\s*(?:&\\#(?:x0*62|0*98)|b)|\\s*(?:&\\#(?:x0*65|0*101)|e)\\s*(?:&\\#(?:x0*63|0*99)|c)\\s*(?:&\\#(?:x0*6d|0*109)|m)\\s*(?:&\\#(?:x0*61|0*97)|a)|\\s*(?:&\\#(?:x0*6c|0*108)|l)\\s*(?:&\\#(?:x0*69|0*105)|i)\\s*(?:&\\#(?:x0*76|0*118)|v)\\s*(?:&\\#(?:x0*65|0*101)|e))\\s*(?:&\\#(?:x0*73|0*115)|s)\\s*(?:&\\#(?:x0*63|0*99)|c)\\s*(?:&\\#(?:x0*72|0*114)|r)\\s*(?:&\\#(?:x0*69|0*105)|i)\\s*(?:&\\#(?:x0*70|0*112)|p)\\s*(?:&\\#(?:x0*74|0*116)|t)|\\s*(?:&\\#(?:x0*6d|0*109)|m)\\s*(?:&\\#(?:x0*68|0*104)|h)\\s*(?:&\\#(?:x0*74|0*116)|t)\\s*(?:&\\#(?:x0*6d|0*109)|m)\\s*(?:&\\#(?:x0*6c|0*108)|l)|\\s*(?:&\\#(?:x0*6d|0*109)|m)\\s*(?:&\\#(?:x0*6f|0*111)|o)\\s*(?:&\\#(?:x0*63|0*99)|c)\\s*(?:&\\#(?:x0*68|0*104)|h)\\s*(?:&\\#(?:x0*61|0*97)|a)|\\s*(?:&\\#(?:x0*64|0*100)|d)\\s*(?:&\\#(?:x0*61|0*97)|a)\\s*(?:&\\#(?:x0*74|0*116)|t)\\s*(?:&\\#(?:x0*61|0*97)|a)(?!(?:&\\#(?:x0*3a|0*58)|\\:)(?:&\\#(?:x0*69|0*105)|i)(?:&\\#(?:x0*6d|0*109)|m)(?:&\\#(?:x0*61|0*97)|a)(?:&\\#(?:x0*67|0*103)|g)(?:&\\#(?:x0*65|0*101)|e)(?:&\\#(?:x0*2f|0*47)|\\/)(?:(?:&\\#(?:x0*70|0*112)|p)(?:&\\#(?:x0*6e|0*110)|n)(?:&\\#(?:x0*67|0*103)|g)|(?:&\\#(?:x0*62|0*98)|b)(?:&\\#(?:x0*6d|0*109)|m)(?:&\\#(?:x0*70|0*112)|p)|(?:&\\#(?:x0*67|0*103)|g)(?:&\\#(?:x0*69|0*105)|i)(?:&\\#(?:x0*66|0*102)|f)|(?:&\\#(?:x0*70|0*112)|p)?(?:&\\#(?:x0*6a|0*106)|j)(?:&\\#(?:x0*70|0*112)|p)(?:&\\#(?:x0*65|0*101)|e)(?:&\\#(?:x0*67|0*103)|g)|(?:&\\#(?:x0*74|0*116)|t)(?:&\\#(?:x0*69|0*105)|i)(?:&\\#(?:x0*66|0*102)|f)(?:&\\#(?:x0*66|0*102)|f)|(?:&\\#(?:x0*73|0*115)|s)(?:&\\#(?:x0*76|0*118)|v)(?:&\\#(?:x0*67|0*103)|g)(?:&\\#(?:x0*2b|0*43)|\\+)(?:&\\#(?:x0*78|0*120)|x)(?:&\\#(?:x0*6d|0*109)|m)(?:&\\#(?:x0*6c|0*108)|l))(?:(?:&\\#(?:x0*3b|0*59)|;)(?:&\\#(?:x0*63|0*99)|c)(?:&\\#(?:x0*68|0*104)|h)(?:&\\#(?:x0*61|0*97)|a)(?:&\\#(?:x0*72|0*114)|r)(?:&\\#(?:x0*73|0*115)|s)(?:&\\#(?:x0*65|0*101)|e)(?:&\\#(?:x0*74|0*116)|t)(?:&\\#(?:x0*3d|0*61)|=)[\\-a-z0-9]+)?(?:(?:&\\#(?:x0*3b|0*59)|;)(?:&\\#(?:x0*62|0*98)|b)(?:&\\#(?:x0*61|0*97)|a)(?:&\\#(?:x0*73|0*115)|s)(?:&\\#(?:x0*65|0*101)|e)(?:&\\#(?:x0*36|0*54)|6)(?:&\\#(?:x0*34|0*52)|4))?(?:&\\#(?:x0*2c|0*44)|,)))\\s*(?:&\\#(?:x0*3a|0*58)|&colon|\\:)|
43
+ #css expression
44
+ (?:^|[^\\w])(?:(?:\\\\0*65|\\\\0*45|e)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*78|\\\\0*58|x)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*70|\\\\0*50|p)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*72|\\\\0*52|r)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*65|\\\\0*45|e)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*73|\\\\0*53|s)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*73|\\\\0*53|s)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*69|\\\\0*49|i)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*6f|\\\\0*4f|o)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*6e|\\\\0*4e|n))[^\\w]*?(?:\\\\0*28|\\()|
45
+ #css properties
46
+ (?:^|[^\\w])(?:(?:(?:\\\\0*62|\\\\0*42|b)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*65|\\\\0*45|e)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*68|\\\\0*48|h)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*61|\\\\0*41|a)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*76|\\\\0*56|v)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*69|\\\\0*49|i)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*6f|\\\\0*4f|o)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*72|\\\\0*52|r)(?:\\/\\*.*?\\*\\/)*)|(?:(?:\\\\0*2d|\\\\0*2d|-)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*6d|\\\\0*4d|m)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*6f|\\\\0*4f|o)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*7a|\\\\0*5a|z)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*2d|\\\\0*2d|-)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*62|\\\\0*42|b)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*69|\\\\0*49|i)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*6e|\\\\0*4e|n)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*64|\\\\0*44|d)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*69|\\\\0*49|i)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*6e|\\\\0*4e|n)(?:\\/\\*.*?\\*\\/)*(?:\\\\0*67|\\\\0*47|g)(?:\\/\\*.*?\\*\\/)*))[^\\w]*(?:\\\\0*3a|\\\\0*3a|:)[^\\w]*(?:\\\\0*75|\\\\0*55|u)(?:\\\\0*72|\\\\0*52|r)(?:\\\\0*6c|\\\\0*4c|l)|
47
+ #properties
48
+ (?:^|[^\\w])(?:on(?:abort|activate|afterprint|afterupdate|autocomplete|autocompleteerror|beforeactivate|beforecopy|beforecut|beforedeactivate|beforeeditfocus|beforepaste|beforeprint|beforeunload|beforeupdate|blur|bounce|cancel|canplay|canplaythrough|cellchange|change|click|close|contextmenu|controlselect|copy|cuechange|cut|dataavailable|datasetchanged|datasetcomplete|dblclick|deactivate|drag|dragend|dragenter|dragleave|dragover|dragstart|drop|durationchange|emptied|encrypted|ended|error|errorupdate|filterchange|finish|focus|focusin|focusout|formchange|forminput|hashchange|help|input|invalid|keydown|keypress|keyup|languagechange|layoutcomplete|load|loadeddata|loadedmetadata|loadstart|losecapture|message|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|move|moveend|movestart|mozfullscreenchange|mozfullscreenerror|mozpointerlockchange|mozpointerlockerror|offline|online|page|pagehide|pageshow|paste|pause|play|playing|popstate|progress|propertychange|ratechange|readystatechange|reset|resize|resizeend|resizestart|rowenter|rowexit|rowsdelete|rowsinserted|scroll|search|seeked|seeking|select|selectstart|show|stalled|start|storage|submit|suspend|timer|timeupdate|toggle|unload|volumechange|waiting|webkitfullscreenchange|webkitfullscreenerror|wheel)|formaction|data\\-bind|ev:event)[^\\w]
49
+ )/ix';
50
+
51
+ public function __construct($bvmain, $ip) {
52
+ $this->bvmain = $bvmain;
53
+ $this->config = new BVFWConfig($this->bvmain);
54
+ $this->request = new BVRequest($ip);
55
+ $this->ipstore = new BVIPStore($bvmain);
56
+ $this->logger = new BVLogger($this->bvmain->db, BVFWConfig::$requests_table);
57
+ }
58
+
59
+ public function init() {
60
+ if ($this->isActive()) {
61
+ $this->execute();
62
+ }
63
+ add_action('clear_fw_config', array($this->config, 'clear'));
64
+ }
65
+
66
+ public function initLogger() {
67
+ add_filter('status_header', array($this->request, 'captureRespCode'));
68
+ add_action('admin_init', array($this, 'log'));
69
+ add_action('template_redirect', array($this, 'log'));
70
+ }
71
+
72
+ public function log() {
73
+ if (!function_exists('is_user_logged_in') || !is_user_logged_in()) {
74
+ $this->logger->log($this->request->getDataToLog());
75
+ }
76
+ }
77
+
78
+ public function isActive() {
79
+ return ($this->config->getMode() !== BVFWConfig::DISABLED);
80
+ }
81
+
82
+ public function isProtecting() {
83
+ return ($this->config->getMode() === BVFWConfig::PROTECT);
84
+ }
85
+
86
+ public function terminateRequest($category = null) {
87
+ if ($category)
88
+ $this->request->setCategory($category);
89
+ $this->request->setStatus(BVRequest::BLOCKED);
90
+ $this->request->setRespCode(403);
91
+ if ($this->isProtecting()) {
92
+ header("Cache-Control: no-cache, no-store, must-revalidate");
93
+ header("Pragma: no-cache");
94
+ header("Expires: 0");
95
+ header('HTTP/1.0 403 Forbidden');
96
+ $this->log();
97
+ $brandname = $this->bvmain->getBrandName();
98
+ die("
99
+ <div style='height: 98vh;'>
100
+ <div style='text-align: center; padding: 10% 0; font-family: Arial, Helvetica, sans-serif;'>
101
+ <div><p><img src=".plugins_url('../img/icon.png', __FILE__)."><h2>Firewall</h2><h3>powered by</h3><h2>"
102
+ .$brandname."</h2></p><div>
103
+ <p>Blocked because of Malicious Activities</p>
104
+ </div>
105
+ </div>
106
+ ");
107
+ exit;
108
+ }
109
+ }
110
+
111
+ public function isBlacklistedIP() {
112
+ return $this->ipstore->checkIPPresent($this->request->getIP(), BVIPStore::BLACKLISTED, BVIPStore::FW);
113
+ }
114
+
115
+ public function isWhitelistedIP() {
116
+ return $this->ipstore->checkIPPresent($this->request->getIP(), BVIPStore::WHITELISTED, BVIPStore::FW);
117
+ }
118
+
119
+ public function canBypassFirewall() {
120
+ if ($this->isWhitelistedIP()) {
121
+ $this->request->setCategory(BVRequest::WHITELISTED);
122
+ $this->request->setStatus(BVRequest::BYPASSED);
123
+ return true;
124
+ }
125
+ return false;
126
+ }
127
+
128
+ public function execute() {
129
+ $this->initLogger();
130
+ if (!$this->canBypassFirewall()) {
131
+ if ($this->isBlacklistedIP()) {
132
+ $this->terminateRequest(BVRequest::BLACKLISTED);
133
+ } else {
134
+ $this->evaluateRules();
135
+ }
136
+ }
137
+ }
138
+
139
+ public function getServerValue($key) {
140
+ if (isset($_SERVER) && array_key_exists($key, $_SERVER)) {
141
+ return $_SERVER[$key];
142
+ }
143
+ return null;
144
+ }
145
+
146
+ public function match($pattern, $subject) {
147
+ if (is_array($subject)) {
148
+ foreach ($subject as $val) {
149
+ return $this->match($pattern, $val);
150
+ }
151
+ return false;
152
+ } else {
153
+ return preg_match((string) $pattern, (string) $subject, $matches) > 0;
154
+ }
155
+ }
156
+
157
+ public function matchMD5($str, $val) {
158
+ return md5((string) $str) === $val;
159
+ }
160
+
161
+ public function getLength($val) {
162
+ return strlen(is_array($val) ? join('', $val) : (string) $val);
163
+ }
164
+
165
+ public function contains($pattern, $subject) {
166
+ if (is_array($pattern)) {
167
+ return in_array($pattern, $subject, true);
168
+ }
169
+ return strpos((string) $subject, (string) $pattern) !== false;
170
+ }
171
+
172
+ public function equals($value, $subject) {
173
+ return $value == $subject;
174
+ }
175
+
176
+ public function notEquals($value, $subject) {
177
+ return $value != $subject;
178
+ }
179
+
180
+ public function evaluateRules() {
181
+ if ($this->config->getRulesMode() == BVFWConfig::DISABLED)
182
+ return false;
183
+
184
+ $request = $this->request;
185
+ $disabledRules = $this->config->getDisabledRules();
186
+ if (!in_array(108, $disabledRules, true)) {
187
+ if ($this->match(BVFW::XSSREGEX, $request->getQueryString()))
188
+ $this->terminateRequest(108);
189
+ }
190
+ if (!in_array(112, $disabledRules, true)) {
191
+ if ($this->match('/\\/wp\\-admin[\\/]+admin\\-ajax\\.php/', $request->getPath()) &&
192
+ (($this->equals('revslider_show_image', $request->getQueryString('action')) && $this->match('/\\.php$/i', $request->getQueryString('img'))) or
193
+ ($this->equals('revslider_show_image', $request->getBody('action')) && $this->match('/\\.php$/i', $request->getQueryString('img')))))
194
+ $this->terminateRequest(112);
195
+ }
196
+ if (!in_array(114, $disabledRules, true)) {
197
+ if ($this->match('/<\\!(?:DOCTYPE|ENTITY)\\s+(?:%\\s*)?\\w+\\s+SYSTEM/i', $request->getBody()) or
198
+ $this->match('/<\\!(?:DOCTYPE|ENTITY)\\s+(?:%\\s*)?\\w+\\s+SYSTEM/i', $request->getQueryString()))
199
+ $this->terminateRequest(114);
200
+ }
201
+ if (!in_array(115, $disabledRules, true)) {
202
+ if ($this->match('#/wp\\-admin/admin\\-ajax\\.php$#i', $this->getServerValue('script_filename')) && ($this->equals('update-plugin', $request->getBody('action')) or
203
+ $this->equals('update-plugin', $request->getQueryString('action'))) && ($this->match('/(^|\\/|\\\\|%2f|%5c)\\.\\.(\\\\|\\/|%2f|%5c)/i', $request->getBody()) or
204
+ ($this->match('/(^|\\/|\\\\|%2f|%5c)\\.\\.(\\\\|\\/|%2f|%5c)/i', $request->getQueryString()))))
205
+ $this->terminateRequest(115);
206
+ }
207
+ if (!in_array(132, $disabledRules, true)) {
208
+ if (($this->equals('Y', $request->getBody('kentopvc_hidden'))) &&
209
+ ((!$this->match('/^1?$/', $request->getBody('kento_pvc_hide'))) or
210
+ (!$this->match('/^1?$/', $request->getBody('kento_pvc_uniq'))) or
211
+ (!$this->match('/^1?$/', $request->getBody('kento_pvc_posttype'))) or
212
+ ($this->match(BVFW::XSSREGEX, $request->getBody('kento_pvc_today_text'))) or
213
+ ($this->match(BVFW::XSSREGEX, $request->getBody('kento_pvc_total_text'))) or
214
+ ($this->match(BVFW::XSSREGEX, $request->getBody('kento_pvc_numbers_lang')))))
215
+ $this->terminateRequest(132);
216
+ }
217
+ if (!in_array(133, $disabledRules, true)) {
218
+ if ((($this->match('#/wp\\-mobile\\-detector[/]+resize\\.php#i', $request->getPath())) or
219
+ ($this->match('#/wp\\-mobile\\-detector[/]+timthumb\\.php#i', $request->getPath()))) &&
220
+ ((($this->getLength($request->getBody('src')) > 0) &&
221
+ (!$this->match('/\\.(?:png|gif|jpg|jpeg|jif|jfif|svg)$/i', $request->getBody('src')))) or
222
+ (($this->getLength($request->getQueryString('src'))) &&
223
+ (!$this->match('/\\.(?:png|gif|jpg|jpeg|jif|jfif|svg)$/i', $request->getQueryString('src'))))))
224
+ $this->terminateRequest(133);
225
+ }
226
+ if (!in_array(145, $disabledRules, true)) {
227
+ if ((($this->match('/Abonti|aggregator|AhrefsBot|asterias|BDCbot|BLEXBot|BuiltBotTough|Bullseye|BunnySlippers|ca\\-crawler|CCBot|Cegbfeieh|CheeseBot|CherryPicker|CopyRightCheck|cosmos|Crescent|discobot|DittoSpyder|DotBot|Download Ninja|EasouSpider|EmailCollector|EmailSiphon|EmailWolf|EroCrawler|Exabot|ExtractorPro|Fasterfox|FeedBooster|Foobot|Genieo|grub\\-client|Harvest|hloader|httplib|HTTrack|humanlinks|ieautodiscovery|InfoNaviRobot|IstellaBot|Java\\/1\\.|JennyBot|k2spider|Kenjin Spider|Keyword Density\\/0\\.9|larbin|LexiBot|libWeb|libwww|LinkextractorPro|linko|LinkScan\\/8\\.1a Unix|LinkWalker|LNSpiderguy|lwp\\-trivial|magpie|Mata Hari|MaxPointCrawler|MegaIndex|Microsoft URL Control|MIIxpc|Mippin|Missigua Locator|Mister PiX|MJ12bot|moget|MSIECrawler|NetAnts|NICErsPRO|Niki\\-Bot|NPBot|Nutch|Offline Explorer|Openfind|panscient\\.com|PHP\\/5\\.\\{|ProPowerBot\\/2\\.14|ProWebWalker|Python\\-urllib|QueryN Metasearch|RepoMonkey|RMA|SemrushBot|SeznamBot|SISTRIX|sitecheck\\.Internetseer\\.com|SiteSnagger|SnapPreviewBot|Sogou|SpankBot|spanner|spbot|Spinn3r|suzuran|Szukacz\\/1\\.4|Teleport|Telesoft|The Intraformant|TheNomad|TightTwatBot|Titan|toCrawl\\/UrlDispatcher|True_Robot|turingos|TurnitinBot|UbiCrawler|UnisterBot|URLy Warning|VCI|WBSearchBot|Web Downloader\\/6\\.9|Web Image Collector|WebAuto|WebBandit|WebCopier|WebEnhancer|WebmasterWorldForumBot|WebReaper|WebSauger|Website Quester|Webster Pro|WebStripper|WebZip|Wotbox|wsr\\-agent|WWW\\-Collector\\-E|Xenu|Zao|Zeus|ZyBORG|coccoc|Incutio|lmspider|memoryBot|SemrushBot|serf|Unknown|uptime files/i', $request->getHeader('User-Agent'))) &&
228
+ ($this->match(BVFW::XSSREGEX, $request->getHeader('User-Agent')))) or
229
+ (($this->match('/semalt\\.com|kambasoft\\.com|savetubevideo\\.com|buttons\\-for\\-website\\.com|sharebutton\\.net|soundfrost\\.org|srecorder\\.com|softomix\\.com|softomix\\.net|myprintscreen\\.com|joinandplay\\.me|fbfreegifts\\.com|openmediasoft\\.com|zazagames\\.org|extener\\.org|openfrost\\.com|openfrost\\.net|googlsucks\\.com|best\\-seo\\-offer\\.com|buttons\\-for\\-your\\-website\\.com|www\\.Get\\-Free\\-Traffic\\-Now\\.com|best\\-seo\\-solution\\.com|buy\\-cheap\\-online\\.info|site3\\.free\\-share\\-buttons\\.com|webmaster\\-traffic\\.co/i', $request->getHeader('Referer'))) &&
230
+ ($this->match(BVFW::XSSREGEX, $request->getHeader('User-Agent')))))
231
+ $this->terminateRequest(145);
232
+ }
233
+ if (!in_array(146, $disabledRules, true)) {
234
+ if ($this->match('/sitemap_.*?<.*?(:?_\\d+)?\\.xml(:?\\.gz)?/i', $request->getPath()))
235
+ $this->terminateRequest(146);
236
+ }
237
+ if (!in_array(155, $disabledRules, true)) {
238
+ if (($this->match(BVFW::XSSREGEX, $request->getHeader('Client-IP'))) or
239
+ ($this->match(BVFW::XSSREGEX, $request->getHeader('X-Forwarded'))) or
240
+ ($this->match(BVFW::XSSREGEX, $request->getHeader('X-Cluster-Client-IP'))) or
241
+ ($this->match(BVFW::XSSREGEX, $request->getHeader('Forwarded-For'))) or
242
+ ($this->match(BVFW::XSSREGEX, $request->getHeader('Forwarded'))))
243
+ $this->terminateRequest(155);
244
+ }
245
+ if (!in_array(156, $disabledRules, true)) {
246
+ if ($this->match('#/wp\\-admin/admin\\-ajax\\.php$#i', $this->getServerValue('script_filename')) or
247
+ (($this->match(BVFW::SQLIREGEX, $request->getBody('umm_user'))) or
248
+ ($this->match(BVFW::SQLIREGEX, $request->getQueryString('umm_user')))))
249
+ $this->terminateRequest(156);
250
+ }
251
+ if (!in_array(165, $disabledRules, true)) {
252
+ if ($this->match('/O:\\d+:"(?!stdClass")[^"]+":/', $request->getCookies('ecwid_oauth_state')))
253
+ $this->terminateRequest(165);
254
+ }
255
+ if (!in_array(167, $disabledRules, true)) {
256
+ if ((!$this->match('/\\.(jpe?g|png|mpeg|mov|flv|pdf|docx?|txt|csv|avi|mp3|wma|wav)($|\\.)/i', $request->getFileNames())) &&
257
+ ($this->getLength($request->getBody('save_bepro_listing')) > 0))
258
+ $this->terminateRequest(167);
259
+ }
260
+ if (!in_array(168, $disabledRules, true)) {
261
+ if (($this->match('#/wp\\-admin/admin\\-ajax\\.php$#i', $this->getServerValue('script_filename'))) &&
262
+ ($this->equals('master-slider', $request->getQueryString('page'))) &&
263
+ ($this->getLength($request->getBody('page')) > 0) &&
264
+ ($this->notEquals('master-slider', $request->getBody('page'))))
265
+ $this->terminateRequest(168);
266
+ }
267
+ if (!in_array(169, $disabledRules, true)) {
268
+ if (($this->equals('fancybox-for-wordpress', $request->getQueryString('page'))) &&
269
+ ($this->match(BVFW::XSSREGEX, $request->getBody('mfbfw'))))
270
+ $this->terminateRequest(169);
271
+ }
272
+ if (!in_array(171, $disabledRules, true)) {
273
+ if ((($this->match('#wp-json/wp/v\\d+/posts/#i', $request->getPath())) or
274
+ ($this->match('#/wp/v\\d+/posts/#i', $request->getQueryString('rest_route')))) &&
275
+ ($this->match('/[^0-9]/', $request->getQueryString('id'))))
276
+ $this->terminateRequest(171);
277
+ }
278
+ }
279
+ }
280
+ endif;
fw/request.php ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVRequest')) :
5
+ class BVRequest {
6
+ private $fileNames;
7
+ private $files;
8
+ private $headers;
9
+ private $host;
10
+ private $ip;
11
+ private $method;
12
+ private $path;
13
+ private $queryString;
14
+ private $timestamp;
15
+ private $uri;
16
+ private $body;
17
+ private $cookies;
18
+ private $respcode;
19
+ private $status;
20
+
21
+ #status
22
+ const ALLOWED = 1;
23
+ const BLOCKED = 2;
24
+ const BYPASSED = 3;
25
+
26
+ #category
27
+ const BLACKLISTED = 1;
28
+ const WHITELISTED = 2;
29
+ const NORMAL = 3;
30
+
31
+ public function __construct($ip) {
32
+ $fileNames = array();
33
+ $headers = array();
34
+ $host = '';
35
+ $method = '';
36
+ $path = '';
37
+ $this->ip = $ip;
38
+ $this->setRespCode(200);
39
+ $this->setCategory(BVRequest::NORMAL);
40
+ $this->setStatus(BVRequest::ALLOWED);
41
+ $this->setTimestamp(time());
42
+ $this->setQueryString(BVRequest::removeMagicQuotes($_GET));
43
+ $this->setCookies(BVRequest::removeMagicQuotes($_COOKIE));
44
+ $this->setBody(BVRequest::removeMagicQuotes($_POST));
45
+ $this->setFiles(BVRequest::removeMagicQuotes($_FILES));
46
+ if (!empty($_FILES)) {
47
+ foreach ($_FILES as $input => $file) {
48
+ $fileNames[$input] = BVRequest::removeMagicQuotes($file['name']);
49
+ }
50
+ }
51
+ $this->setFileNames($fileNames);
52
+ if (is_array($_SERVER)) {
53
+ foreach ($_SERVER as $key => $value) {
54
+ if (strpos($key, 'HTTP_') === 0) {
55
+ $header = substr($key, 5);
56
+ $header = str_replace(array(' ', '_'), array('', ' '), $header);
57
+ $header = ucwords(strtolower($header));
58
+ $header = str_replace(' ', '-', $header);
59
+ $headers[$header] = BVRequest::removeMagicQuotes($value);
60
+ }
61
+ }
62
+ if (array_key_exists('CONTENT_TYPE', $_SERVER)) {
63
+ $headers['Content-Type'] = BVRequest::removeMagicQuotes($_SERVER['CONTENT_TYPE']);
64
+ }
65
+ if (array_key_exists('CONTENT_LENGTH', $_SERVER)) {
66
+ $headers['Content-Length'] = BVRequest::removeMagicQuotes($_SERVER['CONTENT_LENGTH']);
67
+ }
68
+ if (array_key_exists('REFERER', $_SERVER)) {
69
+ $headers['Referer'] = BVRequest::removeMagicQuotes($_SERVER['REFERER']);
70
+ }
71
+ if (array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
72
+ $headers['User-Agent'] = BVRequest::removeMagicQuotes($_SERVER['HTTP_USER_AGENT']);
73
+ }
74
+
75
+ if (array_key_exists('Host', $headers)) {
76
+ $host = $headers['Host'];
77
+ } else if (array_key_exists('SERVER_NAME', $_SERVER)) {
78
+ $host = BVRequest::removeMagicQuotes($_SERVER['SERVER_NAME']);
79
+ }
80
+
81
+ $method = array_key_exists('REQUEST_METHOD', $_SERVER) ? BVRequest::removeMagicQuotes($_SERVER['REQUEST_METHOD']) : 'GET';
82
+ $uri = array_key_exists('REQUEST_URI', $_SERVER) ? BVRequest::removeMagicQuotes($_SERVER['REQUEST_URI']) : '';
83
+ $_uri = parse_url($uri);
84
+ $path = (is_array($_uri) && array_key_exists('path', $_uri)) ? $_uri['path'] : $uri;
85
+ }
86
+ $this->setHeaders($headers);
87
+ $this->setHost($host);
88
+ $this->setMethod($method);
89
+ $this->setUri($uri);
90
+ $this->setPath($path);
91
+ }
92
+
93
+ public function setStatus($status) {
94
+ $this->status = $status;
95
+ }
96
+
97
+ public function setCategory($category) {
98
+ $this->category = $category;
99
+ }
100
+
101
+ public function setBody($body) {
102
+ $this->body = $body;
103
+ }
104
+
105
+ public function setCookies($cookies) {
106
+ $this->cookies = $cookies;
107
+ }
108
+
109
+ public function setFileNames($fileNames) {
110
+ $this->fileNames = $fileNames;
111
+ }
112
+
113
+ public function setFiles($files) {
114
+ $this->files = $files;
115
+ }
116
+
117
+ public function setHeaders($headers) {
118
+ $this->headers = $headers;
119
+ }
120
+
121
+ public function setRespCode($code) {
122
+ $this->respcode = $code;
123
+ }
124
+
125
+ public function getRespCode() {
126
+ return $this->respcode;
127
+ }
128
+
129
+ public function setHost($host) {
130
+ $this->host = $host;
131
+ }
132
+
133
+ public function setMethod($method) {
134
+ $this->method = $method;
135
+ }
136
+
137
+ public function setPath($path) {
138
+ $this->path = $path;
139
+ }
140
+
141
+ public function setQueryString($queryString) {
142
+ $this->queryString = $queryString;
143
+ }
144
+
145
+ public function setTimestamp($timestamp) {
146
+ $this->timestamp = $timestamp;
147
+ }
148
+
149
+ public function setUri($uri) {
150
+ $this->uri = $uri;
151
+ }
152
+
153
+ public function getStatus() {
154
+ return $this->status;
155
+ }
156
+
157
+ public function getCategory() {
158
+ return $this->category;
159
+ }
160
+
161
+ public function captureRespCode($status_header) {
162
+ if (preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $status_header, $tokens)) {
163
+ $this->setRespCode(intval($tokens[2]));
164
+ }
165
+ return $status_header;
166
+ }
167
+
168
+ public function getDataToLog() {
169
+ $querystr = maybe_serialize($this->getQueryString());
170
+ $querystr = (strlen($querystr) > 512) ? maybe_serialize(array("bv_over_size" => true)) : $querystr;
171
+ $referer = $this->getHeader('Referer') ? $this->getHeader('Referer') : '';
172
+ $user_agent = $this->getHeader('User-Agent') ? $this->getHeader('User-Agent') : '';
173
+ $data = array(
174
+ "path" => $this->getPath(),
175
+ "filenames" => maybe_serialize($this->getFileNames()),
176
+ "host" => $this->getHost(),
177
+ "time" => $this->getTimeStamp(),
178
+ "ip" => $this->getIP(),
179
+ "method" => $this->getMethod(),
180
+ "query_string" => $querystr,
181
+ "user_agent" => $user_agent,
182
+ "resp_code" => $this->getRespCode(),
183
+ "referer" => $referer,
184
+ "status" => $this->getStatus(),
185
+ "category" => $this->getCategory()
186
+ );
187
+ return $data;
188
+ }
189
+
190
+ protected function getKeyVal($array, $key) {
191
+ if (is_array($array)) {
192
+ if (is_array($key)) {
193
+ $_key = array_shift($key);
194
+ if (array_key_exists($_key, $array)) {
195
+ if (count($key) > 0) {
196
+ return $this->getKeyVal($array[$_key], $key);
197
+ } else {
198
+ return $array[$_key];
199
+ }
200
+ }
201
+ } else {
202
+ return array_key_exists($key, $array) ? $array[$key] : null;
203
+ }
204
+ }
205
+ return null;
206
+ }
207
+
208
+ public function getBody() {
209
+ if (func_num_args() > 0) {
210
+ $args = func_get_args();
211
+ return $this->getKeyVal($this->body, $args);
212
+ }
213
+ return $this->body;
214
+ }
215
+
216
+ public function getCookies() {
217
+ if (func_num_args() > 0) {
218
+ $args = func_get_args();
219
+ return $this->getKeyVal($this->cookies, $args);
220
+ }
221
+ return $this->cookies;
222
+ }
223
+
224
+ public function getQueryString() {
225
+ if (func_num_args() > 0) {
226
+ $args = func_get_args();
227
+ return $this->getKeyVal($this->queryString, $args);
228
+ }
229
+ return $this->queryString;
230
+ }
231
+
232
+ public function getHeader($key) {
233
+ if (array_key_exists($key, $this->headers)) {
234
+ return $this->headers[$key];
235
+ }
236
+ return null;
237
+ }
238
+
239
+ public function getFiles() {
240
+ if (func_num_args() > 0) {
241
+ $args = func_get_args();
242
+ return $this->getKeyVal($this->files, $args);
243
+ }
244
+ return $this->files;
245
+ }
246
+
247
+ public function getFileNames() {
248
+ if (func_num_args() > 0) {
249
+ $args = func_get_args();
250
+ return $this->getKeyVal($this->fileNames, $args);
251
+ }
252
+ return $this->fileNames;
253
+ }
254
+
255
+ public function getHost() {
256
+ return $this->host;
257
+ }
258
+
259
+ public function getURI() {
260
+ return $this->uri;
261
+ }
262
+
263
+ public function getPath() {
264
+ return $this->path;
265
+ }
266
+
267
+ public function getIP() {
268
+ return $this->ip;
269
+ }
270
+
271
+ public function getMethod() {
272
+ return $this->method;
273
+ }
274
+
275
+ public function getTimestamp() {
276
+ return $this->timestamp;
277
+ }
278
+
279
+ public static function removeMagicQuotes($value) {
280
+ if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) {
281
+ return BVRequest::removeSlashesRecursively($value);
282
+ }
283
+ return $value;
284
+ }
285
+
286
+ public static function removeSlashesRecursively($value) {
287
+ if (is_array($value)) {
288
+ $value = array_map(array('self', 'removeSlashesRecursively',), $value);
289
+ } else if (is_string($value)) {
290
+ $value = stripslashes($value);
291
+ }
292
+ return $value;
293
+ }
294
+ }
295
+ endif;
img/adobe-logo.png ADDED
Binary file
img/as_seen_in.png ADDED
Binary file
img/bv.png ADDED
Binary file
img/bv_badge.png ADDED
Binary file
img/bv_for_free.jpg ADDED
Binary file
img/bvlogo.png ADDED
Binary file
img/cloudways-logo.png ADDED
Binary file
img/icon.png ADDED
Binary file
img/intel-logo.png ADDED
Binary file
img/liquid-web.png ADDED
Binary file
img/lock.png ADDED
Binary file
img/malcare-wordpress-security.png ADDED
Binary file
img/mclogo.png ADDED
Binary file
img/pressable-logo.png ADDED
Binary file
img/sap-logo.png ADDED
Binary file
img/testimonial_bv.png ADDED
Binary file
img/testimonial_mc.png ADDED
Binary file
img/valet-logo.png ADDED
Binary file
img/wp-engine-logo.png ADDED
Binary file
img/wp-site-care-logo.png ADDED
Binary file
img/yoast-logo.png ADDED
Binary file
ipstore.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ if (!class_exists('BVIPStore')) :
4
+
5
+ class BVIPStore {
6
+
7
+ public $bvmain;
8
+ public static $name = 'ip_store';
9
+
10
+ #TYPE
11
+ const BLACKLISTED = 1;
12
+ const WHITELISTED = 2;
13
+
14
+ #CATEGORY
15
+ const FW = 3;
16
+ const LP = 4;
17
+
18
+ function __construct($bvmain) {
19
+ $this->bvmain = $bvmain;
20
+ }
21
+
22
+ function init() {
23
+ add_action('clear_ip_store', array($this, 'clearConfig'));
24
+ }
25
+
26
+ public function clearConfig() {
27
+ $this->bvmain->db->dropBVTable(BVIPStore::$name);
28
+ }
29
+
30
+ public function hasIPv6Support() {
31
+ return defined('AF_INET6');
32
+ }
33
+
34
+ public static function isValidIP($ip) {
35
+ return filter_var($ip, FILTER_VALIDATE_IP) !== false;
36
+ }
37
+
38
+ public function bvInetPton($ip) {
39
+ $pton = $this->isValidIP($ip) ? ($this->hasIPv6Support() ? inet_pton($ip) : $this->_bvInetPton($ip)) : false;
40
+ return $pton;
41
+ }
42
+
43
+ public function _bvInetPton($ip) {
44
+ if (preg_match('/^(?:\d{1,3}(?:\.|$)){4}/', $ip)) {
45
+ $octets = explode('.', $ip);
46
+ $bin = chr($octets[0]) . chr($octets[1]) . chr($octets[2]) . chr($octets[3]);
47
+ return $bin;
48
+ }
49
+
50
+ if (preg_match('/^((?:[\da-f]{1,4}(?::|)){0,8})(::)?((?:[\da-f]{1,4}(?::|)){0,8})$/i', $ip)) {
51
+ if ($ip === '::') {
52
+ return "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
53
+ }
54
+ $colon_count = substr_count($ip, ':');
55
+ $dbl_colon_pos = strpos($ip, '::');
56
+ if ($dbl_colon_pos !== false) {
57
+ $ip = str_replace('::', str_repeat(':0000',
58
+ (($dbl_colon_pos === 0 || $dbl_colon_pos === strlen($ip) - 2) ? 9 : 8) - $colon_count) . ':', $ip);
59
+ $ip = trim($ip, ':');
60
+ }
61
+
62
+ $ip_groups = explode(':', $ip);
63
+ $ipv6_bin = '';
64
+ foreach ($ip_groups as $ip_group) {
65
+ $ipv6_bin .= pack('H*', str_pad($ip_group, 4, '0', STR_PAD_LEFT));
66
+ }
67
+
68
+ return strlen($ipv6_bin) === 16 ? $ipv6_bin : false;
69
+ }
70
+
71
+ if (preg_match('/^(?:\:(?:\:0{1,4}){0,4}\:|(?:0{1,4}\:){5})ffff\:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/i', $ip, $matches)) {
72
+ $octets = explode('.', $matches[1]);
73
+ return chr($octets[0]) . chr($octets[1]) . chr($octets[2]) . chr($octets[3]);
74
+ }
75
+
76
+ return false;
77
+ }
78
+
79
+ public function checkIPPresent($ip, $type, $category) {
80
+ $db = $this->bvmain->db;
81
+ $table = $db->getBVTable(BVIPStore::$name);
82
+ if ($db->isTablePresent($table)) {
83
+ $binIP = $this->bvInetPton($ip);
84
+ if ($binIP !== false) {
85
+ $category_str = ($category == BVIPStore::FW) ? "`is_fw` = true" : "`is_lp` = true";
86
+ $query_str = "SELECT * FROM $table WHERE %s >= `start_ip_range` && %s <= `end_ip_range` && " . $category_str . " && `type` = %d LIMIT 1;";
87
+ $query = $db->prepare($query_str, array($binIP, $binIP, $type));
88
+ if ($db->getVar($query) > 0)
89
+ return true;
90
+ }
91
+ return false;
92
+ }
93
+ return false;
94
+ }
95
+
96
+ }
97
+ endif;
license.txt ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ WordPress - Web publishing software
2
+
3
+ Copyright 2015 by the contributors
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ This program incorporates work covered by the following copyright and
20
+ permission notices:
21
+
22
+ b2 is (c) 2001, 2002 Michel Valdrighi - m@tidakada.com -
23
+ http://tidakada.com
24
+
25
+ Wherever third party code has been used, credit has been given in the code's
26
+ comments.
27
+
28
+ b2 is released under the GPL
29
+
30
+ and
31
+
32
+ WordPress - Web publishing software
33
+
34
+ Copyright 2003-2010 by the contributors
35
+
36
+ WordPress is released under the GPL
37
+
38
+ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
39
+
40
+ GNU GENERAL PUBLIC LICENSE
41
+ Version 2, June 1991
42
+
43
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
44
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
45
+ Everyone is permitted to copy and distribute verbatim copies
46
+ of this license document, but changing it is not allowed.
47
+
48
+ Preamble
49
+
50
+ The licenses for most software are designed to take away your
51
+ freedom to share and change it. By contrast, the GNU General Public
52
+ License is intended to guarantee your freedom to share and change free
53
+ software--to make sure the software is free for all its users. This
54
+ General Public License applies to most of the Free Software
55
+ Foundation's software and to any other program whose authors commit to
56
+ using it. (Some other Free Software Foundation software is covered by
57
+ the GNU Lesser General Public License instead.) You can apply it to
58
+ your programs, too.
59
+
60
+ When we speak of free software, we are referring to freedom, not
61
+ price. Our General Public Licenses are designed to make sure that you
62
+ have the freedom to distribute copies of free software (and charge for
63
+ this service if you wish), that you receive source code or can get it
64
+ if you want it, that you can change the software or use pieces of it
65
+ in new free programs; and that you know you can do these things.
66
+
67
+ To protect your rights, we need to make restrictions that forbid
68
+ anyone to deny you these rights or to ask you to surrender the rights.
69
+ These restrictions translate to certain responsibilities for you if you
70
+ distribute copies of the software, or if you modify it.
71
+
72
+ For example, if you distribute copies of such a program, whether
73
+ gratis or for a fee, you must give the recipients all the rights that
74
+ you have. You must make sure that they, too, receive or can get the
75
+ source code. And you must show them these terms so they know their
76
+ rights.
77
+
78
+ We protect your rights with two steps: (1) copyright the software, and
79
+ (2) offer you this license which gives you legal permission to copy,
80
+ distribute and/or modify the software.
81
+
82
+ Also, for each author's protection and ours, we want to make certain
83
+ that everyone understands that there is no warranty for this free
84
+ software. If the software is modified by someone else and passed on, we
85
+ want its recipients to know that what they have is not the original, so
86
+ that any problems introduced by others will not reflect on the original
87
+ authors' reputations.
88
+
89
+ Finally, any free program is threatened constantly by software
90
+ patents. We wish to avoid the danger that redistributors of a free
91
+ program will individually obtain patent licenses, in effect making the
92
+ program proprietary. To prevent this, we have made it clear that any
93
+ patent must be licensed for everyone's free use or not licensed at all.
94
+
95
+ The precise terms and conditions for copying, distribution and
96
+ modification follow.
97
+
98
+ GNU GENERAL PUBLIC LICENSE
99
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
100
+
101
+ 0. This License applies to any program or other work which contains
102
+ a notice placed by the copyright holder saying it may be distributed
103
+ under the terms of this General Public License. The "Program", below,
104
+ refers to any such program or work, and a "work based on the Program"
105
+ means either the Program or any derivative work under copyright law:
106
+ that is to say, a work containing the Program or a portion of it,
107
+ either verbatim or with modifications and/or translated into another
108
+ language. (Hereinafter, translation is included without limitation in
109
+ the term "modification".) Each licensee is addressed as "you".
110
+
111
+ Activities other than copying, distribution and modification are not
112
+ covered by this License; they are outside its scope. The act of
113
+ running the Program is not restricted, and the output from the Program
114
+ is covered only if its contents constitute a work based on the
115
+ Program (independent of having been made by running the Program).
116
+ Whether that is true depends on what the Program does.
117
+
118
+ 1. You may copy and distribute verbatim copies of the Program's
119
+ source code as you receive it, in any medium, provided that you
120
+ conspicuously and appropriately publish on each copy an appropriate
121
+ copyright notice and disclaimer of warranty; keep intact all the
122
+ notices that refer to this License and to the absence of any warranty;
123
+ and give any other recipients of the Program a copy of this License
124
+ along with the Program.
125
+
126
+ You may charge a fee for the physical act of transferring a copy, and
127
+ you may at your option offer warranty protection in exchange for a fee.
128
+
129
+ 2. You may modify your copy or copies of the Program or any portion
130
+ of it, thus forming a work based on the Program, and copy and
131
+ distribute such modifications or work under the terms of Section 1
132
+ above, provided that you also meet all of these conditions:
133
+
134
+ a) You must cause the modified files to carry prominent notices
135
+ stating that you changed the files and the date of any change.
136
+
137
+ b) You must cause any work that you distribute or publish, that in
138
+ whole or in part contains or is derived from the Program or any
139
+ part thereof, to be licensed as a whole at no charge to all third
140
+ parties under the terms of this License.
141
+
142
+ c) If the modified program normally reads commands interactively
143
+ when run, you must cause it, when started running for such
144
+ interactive use in the most ordinary way, to print or display an
145
+ announcement including an appropriate copyright notice and a
146
+ notice that there is no warranty (or else, saying that you provide
147
+ a warranty) and that users may redistribute the program under
148
+ these conditions, and telling the user how to view a copy of this
149
+ License. (Exception: if the Program itself is interactive but
150
+ does not normally print such an announcement, your work based on
151
+ the Program is not required to print an announcement.)
152
+
153
+ These requirements apply to the modified work as a whole. If
154
+ identifiable sections of that work are not derived from the Program,
155
+ and can be reasonably considered independent and separate works in
156
+ themselves, then this License, and its terms, do not apply to those
157
+ sections when you distribute them as separate works. But when you
158
+ distribute the same sections as part of a whole which is a work based
159
+ on the Program, the distribution of the whole must be on the terms of
160
+ this License, whose permissions for other licensees extend to the
161
+ entire whole, and thus to each and every part regardless of who wrote it.
162
+
163
+ Thus, it is not the intent of this section to claim rights or contest
164
+ your rights to work written entirely by you; rather, the intent is to
165
+ exercise the right to control the distribution of derivative or
166
+ collective works based on the Program.
167
+
168
+ In addition, mere aggregation of another work not based on the Program
169
+ with the Program (or with a work based on the Program) on a volume of
170
+ a storage or distribution medium does not bring the other work under
171
+ the scope of this License.
172
+
173
+ 3. You may copy and distribute the Program (or a work based on it,
174
+ under Section 2) in object code or executable form under the terms of
175
+ Sections 1 and 2 above provided that you also do one of the following:
176
+
177
+ a) Accompany it with the complete corresponding machine-readable
178
+ source code, which must be distributed under the terms of Sections
179
+ 1 and 2 above on a medium customarily used for software interchange; or,
180
+
181
+ b) Accompany it with a written offer, valid for at least three
182
+ years, to give any third party, for a charge no more than your
183
+ cost of physically performing source distribution, a complete
184
+ machine-readable copy of the corresponding source code, to be
185
+ distributed under the terms of Sections 1 and 2 above on a medium
186
+ customarily used for software interchange; or,
187
+
188
+ c) Accompany it with the information you received as to the offer
189
+ to distribute corresponding source code. (This alternative is
190
+ allowed only for noncommercial distribution and only if you
191
+ received the program in object code or executable form with such
192
+ an offer, in accord with Subsection b above.)
193
+
194
+ The source code for a work means the preferred form of the work for
195
+ making modifications to it. For an executable work, complete source
196
+ code means all the source code for all modules it contains, plus any
197
+ associated interface definition files, plus the scripts used to
198
+ control compilation and installation of the executable. However, as a
199
+ special exception, the source code distributed need not include
200
+ anything that is normally distributed (in either source or binary
201
+ form) with the major components (compiler, kernel, and so on) of the
202
+ operating system on which the executable runs, unless that component
203
+ itself accompanies the executable.
204
+
205
+ If distribution of executable or object code is made by offering
206
+ access to copy from a designated place, then offering equivalent
207
+ access to copy the source code from the same place counts as
208
+ distribution of the source code, even though third parties are not
209
+ compelled to copy the source along with the object code.
210
+
211
+ 4. You may not copy, modify, sublicense, or distribute the Program
212
+ except as expressly provided under this License. Any attempt
213
+ otherwise to copy, modify, sublicense or distribute the Program is
214
+ void, and will automatically terminate your rights under this License.
215
+ However, parties who have received copies, or rights, from you under
216
+ this License will not have their licenses terminated so long as such
217
+ parties remain in full compliance.
218
+
219
+ 5. You are not required to accept this License, since you have not
220
+ signed it. However, nothing else grants you permission to modify or
221
+ distribute the Program or its derivative works. These actions are
222
+ prohibited by law if you do not accept this License. Therefore, by
223
+ modifying or distributing the Program (or any work based on the
224
+ Program), you indicate your acceptance of this License to do so, and
225
+ all its terms and conditions for copying, distributing or modifying
226
+ the Program or works based on it.
227
+
228
+ 6. Each time you redistribute the Program (or any work based on the
229
+ Program), the recipient automatically receives a license from the
230
+ original licensor to copy, distribute or modify the Program subject to
231
+ these terms and conditions. You may not impose any further
232
+ restrictions on the recipients' exercise of the rights granted herein.
233
+ You are not responsible for enforcing compliance by third parties to
234
+ this License.
235
+
236
+ 7. If, as a consequence of a court judgment or allegation of patent
237
+ infringement or for any other reason (not limited to patent issues),
238
+ conditions are imposed on you (whether by court order, agreement or
239
+ otherwise) that contradict the conditions of this License, they do not
240
+ excuse you from the conditions of this License. If you cannot
241
+ distribute so as to satisfy simultaneously your obligations under this
242
+ License and any other pertinent obligations, then as a consequence you
243
+ may not distribute the Program at all. For example, if a patent
244
+ license would not permit royalty-free redistribution of the Program by
245
+ all those who receive copies directly or indirectly through you, then
246
+ the only way you could satisfy both it and this License would be to
247
+ refrain entirely from distribution of the Program.
248
+
249
+ If any portion of this section is held invalid or unenforceable under
250
+ any particular circumstance, the balance of the section is intended to
251
+ apply and the section as a whole is intended to apply in other
252
+ circumstances.
253
+
254
+ It is not the purpose of this section to induce you to infringe any
255
+ patents or other property right claims or to contest validity of any
256
+ such claims; this section has the sole purpose of protecting the
257
+ integrity of the free software distribution system, which is
258
+ implemented by public license practices. Many people have made
259
+ generous contributions to the wide range of software distributed
260
+ through that system in reliance on consistent application of that
261
+ system; it is up to the author/donor to decide if he or she is willing
262
+ to distribute software through any other system and a licensee cannot
263
+ impose that choice.
264
+
265
+ This section is intended to make thoroughly clear what is believed to
266
+ be a consequence of the rest of this License.
267
+
268
+ 8. If the distribution and/or use of the Program is restricted in
269
+ certain countries either by patents or by copyrighted interfaces, the
270
+ original copyright holder who places the Program under this License
271
+ may add an explicit geographical distribution limitation excluding
272
+ those countries, so that distribution is permitted only in or among
273
+ countries not thus excluded. In such case, this License incorporates
274
+ the limitation as if written in the body of this License.
275
+
276
+ 9. The Free Software Foundation may publish revised and/or new versions
277
+ of the General Public License from time to time. Such new versions will
278
+ be similar in spirit to the present version, but may differ in detail to
279
+ address new problems or concerns.
280
+
281
+ Each version is given a distinguishing version number. If the Program
282
+ specifies a version number of this License which applies to it and "any
283
+ later version", you have the option of following the terms and conditions
284
+ either of that version or of any later version published by the Free
285
+ Software Foundation. If the Program does not specify a version number of
286
+ this License, you may choose any version ever published by the Free Software
287
+ Foundation.
288
+
289
+ 10. If you wish to incorporate parts of the Program into other free
290
+ programs whose distribution conditions are different, write to the author
291
+ to ask for permission. For software which is copyrighted by the Free
292
+ Software Foundation, write to the Free Software Foundation; we sometimes
293
+ make exceptions for this. Our decision will be guided by the two goals
294
+ of preserving the free status of all derivatives of our free software and
295
+ of promoting the sharing and reuse of software generally.
296
+
297
+ NO WARRANTY
298
+
299
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
300
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
301
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
302
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
303
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
304
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
305
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
306
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
307
+ REPAIR OR CORRECTION.
308
+
309
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
310
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
311
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
312
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
313
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
314
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
315
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
316
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
317
+ POSSIBILITY OF SUCH DAMAGES.
318
+
319
+ END OF TERMS AND CONDITIONS
320
+
321
+ How to Apply These Terms to Your New Programs
322
+
323
+ If you develop a new program, and you want it to be of the greatest
324
+ possible use to the public, the best way to achieve this is to make it
325
+ free software which everyone can redistribute and change under these terms.
326
+
327
+ To do so, attach the following notices to the program. It is safest
328
+ to attach them to the start of each source file to most effectively
329
+ convey the exclusion of warranty; and each file should have at least
330
+ the "copyright" line and a pointer to where the full notice is found.
331
+
332
+ <one line to give the program's name and a brief idea of what it does.>
333
+ Copyright (C) <year> <name of author>
334
+
335
+ This program is free software; you can redistribute it and/or modify
336
+ it under the terms of the GNU General Public License as published by
337
+ the Free Software Foundation; either version 2 of the License, or
338
+ (at your option) any later version.
339
+
340
+ This program is distributed in the hope that it will be useful,
341
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
342
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
343
+ GNU General Public License for more details.
344
+
345
+ You should have received a copy of the GNU General Public License along
346
+ with this program; if not, write to the Free Software Foundation, Inc.,
347
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
348
+
349
+ Also add information on how to contact you by electronic and paper mail.
350
+
351
+ If the program is interactive, make it output a short notice like this
352
+ when it starts in an interactive mode:
353
+
354
+ Gnomovision version 69, Copyright (C) year name of author
355
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
356
+ This is free software, and you are welcome to redistribute it
357
+ under certain conditions; type `show c' for details.
358
+
359
+ The hypothetical commands `show w' and `show c' should show the appropriate
360
+ parts of the General Public License. Of course, the commands you use may
361
+ be called something other than `show w' and `show c'; they could even be
362
+ mouse-clicks or menu items--whatever suits your program.
363
+
364
+ You should also get your employer (if you work as a programmer) or your
365
+ school, if any, to sign a "copyright disclaimer" for the program, if
366
+ necessary. Here is a sample; alter the names:
367
+
368
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
369
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
370
+
371
+ <signature of Ty Coon>, 1 April 1989
372
+ Ty Coon, President of Vice
373
+
374
+ This General Public License does not permit incorporating your program into
375
+ proprietary programs. If your program is a subroutine library, you may
376
+ consider it more useful to permit linking proprietary applications with the
377
+ library. If this is what you want to do, use the GNU Lesser General
378
+ Public License instead of this License.
379
+
380
+ WRITTEN OFFER
381
+
382
+ The source code for any program binaries or compressed scripts that are
383
+ included with WordPress can be freely obtained at the following URL:
384
+
385
+ https://wordpress.org/download/source/
logger.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVLogger')) :
5
+ class BVLogger {
6
+ public $db;
7
+ public $table;
8
+ const MAXROWCOUNT = 100000;
9
+
10
+ function __construct($db, $table) {
11
+ $this->db = $db;
12
+ $this->table = $table;
13
+ }
14
+
15
+ public function log($data) {
16
+ if (is_array($data)) {
17
+ $tablename = $this->db->getBVTable($this->table);
18
+ if ($this->db->rowsCount($tablename) > BVLogger::MAXROWCOUNT)
19
+ $this->db->deleteRowsFromtable($this->table, 1);
20
+ $this->db->replaceIntoBVTable($this->table, $data);
21
+ }
22
+ }
23
+ }
24
+ endif;
lp/config.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVLPConfig')) :
5
+ class BVLPConfig {
6
+ public $bvmain;
7
+ public static $requests_table = 'lp_requests';
8
+
9
+ #mode
10
+ const DISABLED = 1;
11
+ const AUDIT = 2;
12
+ const PROTECT = 3;
13
+
14
+ public function __construct($bvmain) {
15
+ $this->bvmain = $bvmain;
16
+ }
17
+
18
+ public function setMode($mode) {
19
+ if (!$mode) {
20
+ $this->bvmain->info->deleteOption('bvlpmode');
21
+ } else {
22
+ $this->bvmain->info->updateOption('bvlpmode', intval($mode));
23
+ }
24
+ }
25
+
26
+ public function setCaptchaLimit($count) {
27
+ if (!$count) {
28
+ $this->bvmain->info->deleteOption('bvlpcaptchaLimit');
29
+ } else {
30
+ $this->bvmain->info->updateOption('bvlpcaptchaLimit', intval($count));
31
+ }
32
+ }
33
+
34
+ public function setTempBlockLimit($count) {
35
+ if (!$count) {
36
+ $this->bvmain->info->deleteOption('bvlptempblocklimit');
37
+ } else {
38
+ $this->bvmain->info->updateOption('bvlptempblocklimit', intval($count));
39
+ }
40
+ }
41
+
42
+ public function setBlockAllLimit($count) {
43
+ if (!$count) {
44
+ $this->bvmain->info->deleteOption('bvlpblockalllimit');
45
+ } else {
46
+ $this->bvmain->info->updateOption('bvlpblockalllimit', intval($count));
47
+ }
48
+ }
49
+
50
+ public function getMode() {
51
+ $mode = $this->bvmain->info->getOption('bvlpmode');
52
+ return intval($mode ? $mode : BVLPConfig::DISABLED);
53
+ }
54
+
55
+ public function getCaptchaLimit() {
56
+ $limit = $this->bvmain->info->getOption('bvlpcaptchalimit');
57
+ return ($limit ? $limit : 3);
58
+ }
59
+
60
+ public function getTempBlockLimit() {
61
+ $limit = $this->bvmain->info->getOption('bvlptempblocklimit');
62
+ return ($limit ? $limit : 10);
63
+ }
64
+
65
+ public function getBlockAllLimit() {
66
+ $limit = $this->bvmain->info->getOption('bvlpblockAlllimit');
67
+ return ($limit ? $limit : 100);
68
+ }
69
+
70
+ public function clear() {
71
+ $this->setMode(false);
72
+ $this->setCaptchaLimit(false);
73
+ $this->setTempBlockLimit(false);
74
+ $this->setBlockAllLimit(false);
75
+ $this->bvmain->db->dropBVTable(BVLPConfig::$requests_table);
76
+ $this->bvmain->info->deleteOption('bvptplug');
77
+ return true;
78
+ }
79
+ }
80
+ endif;
lp/lp.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVLP')) :
5
+
6
+ require_once dirname( __FILE__ ) . '/config.php';
7
+ require_once dirname( __FILE__ ) . './../ipstore.php';
8
+
9
+ class BVLP {
10
+
11
+ private $ip;
12
+ private $time;
13
+ private $category;
14
+ private $username;
15
+ private $message;
16
+ public $config;
17
+ public $bvmain;
18
+ public $logger;
19
+ public $ipstore;
20
+ public static $requests_table = 'lp_requests';
21
+ public static $unblock_ip_transient = 'bvlp_unblock_ip';
22
+
23
+ #status
24
+ const LOGINFAILURE = 1;
25
+ const LOGINSUCCESS = 2;
26
+ const LOGINBLOCKED = 3;
27
+
28
+ #categories
29
+ const CAPTCHABLOCK = 1;
30
+ const TEMPBLOCK = 2;
31
+ const ALLBLOCKED = 3;
32
+ const UNBLOCKED = 4;
33
+ const BLACKLISTED = 5;
34
+ const BYPASSED = 6;
35
+ const ALLOWED = 7;
36
+
37
+ public function __construct($bvmain, $ip) {
38
+ $this->bvmain = $bvmain;
39
+ $this->ip = $ip;
40
+ $this->config = new BVLPConfig($this->bvmain);
41
+ $this->ipstore = new BVIPStore($bvmain);
42
+ $this->logger = new BVLogger($this->bvmain->db, BVLPConfig::$requests_table);
43
+ $this->time = strtotime(date("Y-m-d H:i:s"));
44
+ }
45
+
46
+ public function init() {
47
+ if ($this->isActive()) {
48
+ $this->lpInit();
49
+ }
50
+ add_action('clear_lp_config', array($this->config, 'clear'));
51
+ }
52
+
53
+ public function lpInit() {
54
+ add_filter('authenticate', array($this, 'loginInit'), 30, 3);
55
+ add_action('wp_login', array($this, 'loginSuccess'));
56
+ add_action('wp_login_failed', array($this, 'loginFailed'));
57
+ }
58
+
59
+ public function setMessage($message) {
60
+ $this->message = $message;
61
+ }
62
+
63
+ public function setUserName($username) {
64
+ $this->username = $username;
65
+ }
66
+
67
+ public function setCategory($category) {
68
+ $this->category = $category;
69
+ }
70
+
71
+ public function getCaptchaLink() {
72
+ $bvmain = $this->bvmain;
73
+ $url = $bvmain->authenticatedUrl('/captcha/solve');
74
+ $url .= "&adminurl=".base64_encode(get_admin_url());
75
+ return $url;
76
+ }
77
+
78
+ public function getUserName() {
79
+ return $this->username ? $this->username : '';
80
+ }
81
+
82
+ public function getMessage() {
83
+ return $this->message ? $this->message : '';
84
+ }
85
+
86
+ public function getCategory() {
87
+ return $this->category ? $this->category : BVLP::ALLOWED;
88
+ }
89
+
90
+ public function getCaptchaLimit() {
91
+ return $this->config->getCaptchaLimit();
92
+ }
93
+
94
+ public function getTempBlockLimit() {
95
+ return $this->config->getTempBlockLimit();
96
+ }
97
+
98
+ public function getBlockAllLimit() {
99
+ return $this->config->getBlockAllLimit();
100
+ }
101
+
102
+ public function getLoginLogsTable() {
103
+ global $bvdb;
104
+ return $bvdb->getBVTable(BVLP::$requests_table);
105
+ }
106
+
107
+ public function getAllowLoginsTransient() {
108
+ return $this->bvmain->info->getTransient('bvlp_allow_logins');
109
+ }
110
+
111
+ public function getBlockLoginsTransient() {
112
+ return $this->bvmain->info->getTransient('bvlp_block_logins');
113
+ }
114
+
115
+ public function terminateTemplate() {
116
+ $brandname = $this->bvmain->getBrandName();
117
+ $templates = array (
118
+ 1 => "<p>Too many failed attempts, You are barred from logging into this site.</p><a href=".$this->getCaptchaLink()."
119
+ class='btn btn-default'>Click here</a> to unblock yourself.",
120
+ 2 => "You cannot login to this site for 30 minutes because of too many failed login attempts.",
121
+ 3 => "<p>Logins to this site are currently blocked.</p><a href=".$this->getCaptchaLink()."
122
+ class='btn btn-default'>Click here</a> to unblock yourself.",
123
+ 5 => "Your IP is blacklisted."
124
+ );
125
+ return "
126
+ <div style='height: 98vh;'>
127
+ <div style='text-align: center; padding: 10% 0; font-family: Arial, Helvetica, sans-serif;'>
128
+ <div><p><img src=".plugins_url('../img/icon.png', __FILE__)."><h2>Login Protection</h2><h3>powered by</h3><h2>"
129
+ .$brandname."</h2></p><div>
130
+ <p>" . $templates[$this->getCategory()]. "</p>
131
+ </div>
132
+ </div>";
133
+ }
134
+
135
+ public function isProtecting() {
136
+ return ($this->config->getMode() === BVLPConfig::PROTECT);
137
+ }
138
+
139
+ public function isActive() {
140
+ return ($this->config->getMode() !== BVLPConfig::DISABLED);
141
+ }
142
+
143
+ public function isBlacklistedIP() {
144
+ return $this->ipstore->checkIPPresent($this->ip, BVIPStore::BLACKLISTED, BVIPStore::LP);
145
+ }
146
+
147
+ public function isWhitelistedIP() {
148
+ return $this->ipstore->checkIPPresent($this->ip, BVIPStore::WHITELISTED, BVIPStore::LP);
149
+ }
150
+
151
+ public function isUnBlockedIP() {
152
+ $transient_name = BVLP::$unblock_ip_transient.$this->ip;
153
+ $attempts = $this->bvmain->info->getTransient($transient_name);
154
+ if ($attempts && $attempts > 0) {
155
+ $this->bvmain->info->setTransient($transient_name, $attempts - 1, 600 * $attempts);
156
+ return true;
157
+ }
158
+ return false;
159
+ }
160
+
161
+ public function isLoginBlocked() {
162
+ if ($this->getAllowLoginsTransient() ||
163
+ ($this->getLoginCount(BVLP::LOGINFAILURE) < $this->getBlockAllLimit())) {
164
+ return false;
165
+ }
166
+ return true;
167
+ }
168
+
169
+ public function log($status) {
170
+ $data = array (
171
+ "ip" => $this->ip,
172
+ "status" => $status,
173
+ "time" => $this->time,
174
+ "category" => $this->getCategory(),
175
+ "username" => $this->getUserName(),
176
+ "message" => $this->getMessage());
177
+ $this->logger->log($data);
178
+ }
179
+
180
+ public function terminateLogin() {
181
+ $this->setMessage('Login Blocked');
182
+ $this->log(BVLP::LOGINBLOCKED);
183
+ if ($this->isProtecting()) {
184
+ header("Cache-Control: no-cache, no-store, must-revalidate");
185
+ header("Pragma: no-cache");
186
+ header("Expires: 0");
187
+ header('HTTP/1.0 403 Forbidden');
188
+ die($this->terminateTemplate());
189
+ exit;
190
+ }
191
+ }
192
+
193
+ public function loginInit($user, $username = '', $password = '') {
194
+ if ($this->isUnBlockedIP()) {
195
+ $this->setCategory(BVLP::UNBLOCKED);
196
+ } else {
197
+ $failed_attempts = $this->getLoginCount(BVLP::LOGINFAILURE, $this->ip);
198
+ if ($this->isBlacklistedIP()) {
199
+ $this->setCategory(BVLP::BLACKLISTED);
200
+ $this->terminateLogin();
201
+ } else if ($this->isKnownLogin() || $this->isWhitelistedIP()) {
202
+ $this->setCategory(BVLP::BYPASSED);
203
+ } else if ($this->isLoginBlocked()) {
204
+ $this->setCategory(BVLP::ALLBLOCKED);
205
+ $this->terminateLogin();
206
+ } else if ($failed_attempts >= $this->getTempBlockLimit()) {
207
+ $this->setCategory(BVLP::TEMPBLOCK);
208
+ $this->terminateLogin();
209
+ } else if ($failed_attempts >= $this->getCaptchaLimit()) {
210
+ $this->setCategory(BVLP::CAPTCHABLOCK);
211
+ $this->terminateLogin();
212
+ }
213
+ }
214
+ if (!empty($user) && !empty($password) && is_wp_error($user)) {
215
+ $this->setMessage($user->get_error_code());
216
+ }
217
+ return $user;
218
+ }
219
+
220
+ public function loginFailed($username) {
221
+ $this->setUserName($username);
222
+ $this->log(BVLP::LOGINFAILURE);
223
+ }
224
+
225
+ public function loginSuccess($username) {
226
+ $this->setUserName($username);
227
+ $this->setMessage('Login Success');
228
+ $this->log(BVLP::LOGINSUCCESS);
229
+ }
230
+
231
+ public function isKnownLogin() {
232
+ return $this->getLoginCount(BVLP::LOGINSUCCESS, $this->ip, 3600) > 0;
233
+ }
234
+
235
+ public function getLoginCount($status, $ip = null, $gap = 1800) {
236
+ $db = $this->bvmain->db;
237
+ $table = $db->getBVTable(BVLP::$requests_table);
238
+ $query = $db->prepare("SELECT COUNT(*) as count from `$table` WHERE status=%d && time > %d", array($status, ($this->time - $gap)));
239
+ if ($ip) {
240
+ $query .= $db->prepare(" && ip=%s", $ip);
241
+ }
242
+ $rows = $db->getResult($query);
243
+ if (!$rows)
244
+ return 0;
245
+ return intval($rows[0]['count']);
246
+ }
247
+ }
248
+ endif;
main.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ if (!class_exists('BVBackup')) :
4
+
5
+ require_once dirname( __FILE__ ) . '/main/lib.php';
6
+ require_once dirname( __FILE__ ) . '/main/site_info.php';
7
+ require_once dirname( __FILE__ ) . '/main/auth.php';
8
+ require_once dirname( __FILE__ ) . '/main/db.php';
9
+
10
+ class BVBackup {
11
+ public $version = '1.88';
12
+ public $plugname = 'bvbackup';
13
+ public $brandname = 'BlogVault';
14
+ public $webpage = 'https://blogvault.net';
15
+ public $appurl = 'https://app.blogvault.net';
16
+ public $slug = 'blogvault-real-time-backup/blogvault.php';
17
+ public $plug_redirect = 'bvredirect';
18
+ public $badgeinfo = 'bvbadge';
19
+ public $logo = '../img/bvlogo.png';
20
+
21
+ public $ip_header_option = 'bvipheader';
22
+ public $brand_option = 'bvbrand';
23
+
24
+ public $lib;
25
+ public $info;
26
+ public $auth;
27
+ public $db;
28
+ function __construct() {
29
+ $this->lib = new BVLib();
30
+ $this->info = new BVSiteInfo($this->lib);
31
+ $this->auth = new BVAuth($this->info);
32
+ $this->db = new BVDb();
33
+ }
34
+
35
+ public function appUrl() {
36
+ if (defined('BV_APP_URL')) {
37
+ return BV_APP_URL;
38
+ } else {
39
+ $brand = $this->getBrandInfo();
40
+ if ($brand && array_key_exists('appurl', $brand)) {
41
+ return $brand['appurl'];
42
+ }
43
+ return $this->appurl;
44
+ }
45
+ }
46
+
47
+ public function getIPHeader() {
48
+ return $this->info->getOption($this->ip_header_option);
49
+ }
50
+
51
+ public function getBrandName() {
52
+ $brand = $this->getBrandInfo();
53
+ if ($brand && array_key_exists('menuname', $brand)) {
54
+ return $brand['menuname'];
55
+ }
56
+ return $this->brandname;
57
+ }
58
+
59
+ public function isMalcare() {
60
+ return $this->getBrandName() === 'MalCare - Pro';
61
+ }
62
+
63
+ public function isBlogvault() {
64
+ return $this->getBrandName() === 'BlogVault';
65
+ }
66
+
67
+ public function getBrandInfo() {
68
+ return $this->info->getOption($this->brand_option);
69
+ }
70
+
71
+ public function authenticatedUrl($method, $apicheck = null, $full = true) {
72
+ $_params = $this->auth->newAuthParams($this->version);
73
+ if ($apicheck) {
74
+ $_params['bvapicheck'] = $apicheck;
75
+ }
76
+ $qstr = http_build_query($_params);
77
+ if (!$full)
78
+ return $method."?".$qstr;
79
+ return $this->appUrl().$method."?".$qstr;
80
+ }
81
+
82
+ public function isConfigured() {
83
+ return $this->auth->defaultPublic();
84
+ }
85
+
86
+ public function getMonitTime() {
87
+ $time = $this->info->getOption('bvmonittime');
88
+ return ($time ? $time : 0);
89
+ }
90
+
91
+ public function unSetMonitTime() {
92
+ return $this->info->deleteOption('bvmonittime');
93
+ }
94
+
95
+ public function setMonitTime() {
96
+ return $this->info->updateOption('bvmonittime', time());
97
+ }
98
+
99
+ public function isActivePlugin() {
100
+ $expiry_time = time() - (3 * 24 * 3600);
101
+ return ($this->getMonitTime() > $expiry_time);
102
+ }
103
+
104
+ public function isProtectModuleEnabled() {
105
+ return ($this->info->getOption('bvptplug') === $this->plugname) &&
106
+ $this->isActivePlugin();
107
+ }
108
+
109
+ public function isDynSyncModuleEnabled() {
110
+ return ($this->info->getOption('bvdynplug') === $this->plugname) &&
111
+ $this->isActivePlugin();
112
+ }
113
+
114
+ public function pingbv($method) {
115
+ $body = array();
116
+ $this->info->basic($body);
117
+ $body['plug'] = $this->plugname;
118
+ $url = $this->authenticatedUrl($method);
119
+ $this->lib->http_request($url, $body);
120
+ }
121
+
122
+ public function setup($rand_secret) {
123
+ $this->info->updateOption('bvSecretKey', $rand_secret);
124
+ $this->info->updateOption($this->plug_redirect, 'yes');
125
+ $this->info->updateOption('bvActivateTime', time());
126
+ }
127
+
128
+ public function isActivateRedirectSet() {
129
+ if ($this->info->getOption($this->plug_redirect) === 'yes') {
130
+ $this->info->updateOption($this->plug_redirect, 'no');
131
+ return true;
132
+ }
133
+ return false;
134
+ }
135
+
136
+ public function activate() {
137
+ if (!isset($_REQUEST['blogvaultkey'])) {
138
+ ##BVKEYSLOCATE##
139
+ }
140
+ if ($this->isConfigured()) {
141
+ /* This informs the server about the activation */
142
+ $this->pingbv('/bvapi/activate');
143
+ } else {
144
+ $this->setup($this->lib->randString(32));
145
+ }
146
+ }
147
+
148
+ public function footerHandler() {
149
+ $bvfooter = $this->info->getOption($this->badgeinfo);
150
+ if ($bvfooter) {
151
+ echo '<div style="max-width:150px;min-height:70px;margin:0 auto;text-align:center;position:relative;">
152
+ <a href='.$bvfooter['badgeurl'].' target="_blank" ><img src="'.plugins_url($bvfooter['badgeimg'], __FILE__).'" alt="'.$bvfooter['badgealt'].'" /></a></div>';
153
+ }
154
+ }
155
+
156
+ public function deactivate() {
157
+ $this->pingbv('/bvapi/deactivate');
158
+ }
159
+
160
+ public static function uninstall() {
161
+ do_action('clear_lp_config');
162
+ do_action('clear_fw_config');
163
+ do_action('clear_ip_store');
164
+ do_action('clear_dynsync_config');
165
+ }
166
+ }
167
+ endif;
main/auth.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVAuth')) :
5
+
6
+ class BVAuth {
7
+ public $info;
8
+ function __construct($info) {
9
+ $this->info = $info;
10
+ }
11
+
12
+ public function defaultPublic() {
13
+ return $this->info->getOption('bvPublic');
14
+ }
15
+
16
+ public function defaultSecret() {
17
+ return $this->info->getOption('bvSecretKey');
18
+ }
19
+
20
+ public function allKeys() {
21
+ $keys = $this->info->getOption('bvkeys');
22
+ if (!is_array($keys)) {
23
+ $keys = array();
24
+ }
25
+ $public = $this->defaultPublic();
26
+ $secret = $this->defaultSecret();
27
+ if ($public)
28
+ $keys[$public] = $secret;
29
+ $keys['default'] = $secret;
30
+ return $keys;
31
+ }
32
+
33
+ public function publicParam() {
34
+ if (array_key_exists('pubkey', $_REQUEST)) {
35
+ return $_REQUEST['pubkey'];
36
+ } else {
37
+ return $this->defaultPublic();
38
+ }
39
+ }
40
+
41
+ public function secretForPublic($public = false) {
42
+ $bvkeys = $this->allKeys();
43
+ if ($public && array_key_exists($public, $bvkeys) && isset($bvkeys[$public]))
44
+ return $bvkeys[$public];
45
+ else
46
+ return $this->defaultSecret();
47
+ }
48
+
49
+ public function addKeys($public, $secret) {
50
+ $bvkeys = $this->info->getOption('bvkeys');
51
+ if ($bvkeys && is_array($bvkeys))
52
+ $bvkeys[$public] = $secret;
53
+ else
54
+ $bvkeys = array($public => $secret);
55
+ $this->info->updateOption('bvkeys', $bvkeys);
56
+ }
57
+
58
+ public function updateKeys($publickey, $secretkey) {
59
+ $this->info->updateOption('bvPublic', $publickey);
60
+ $this->info->updateOption('bvSecretKey', $secretkey);
61
+ $this->addKeys($publickey, $secretkey);
62
+ }
63
+
64
+ public function rmKeys($publickey) {
65
+ $bvkeys = $this->info->getOption('bvkeys');
66
+ if ($bvkeys && is_array($bvkeys)) {
67
+ unset($bvkeys[$publickey]);
68
+ $this->info->updateOption('bvkeys', $bvkeys);
69
+ return true;
70
+ }
71
+ return false;
72
+ }
73
+
74
+ public function validate($public, $method, $time, $version, $sig) {
75
+ $secret = $this->secretForPublic($public);
76
+ if ($time < intval($this->info->getOption('bvLastRecvTime')) - 300) {
77
+ return false;
78
+ }
79
+ if (array_key_exists('sha1', $_REQUEST)) {
80
+ $sig_match = sha1($method.$secret.$time.$version);
81
+ } else {
82
+ $sig_match = md5($method.$secret.$time.$version);
83
+ }
84
+ if ($sig_match !== $sig) {
85
+ return $sig_match;
86
+ }
87
+ $this->info->updateOption('bvLastRecvTime', $time);
88
+ return 1;
89
+ }
90
+
91
+ public function newAuthParams($version) {
92
+ $args = array();
93
+ $time = time();
94
+ $public = $this->publicParam();
95
+ $secret = $this->secretForPublic($public);
96
+
97
+ $sig = sha1($public.$secret.$time.$version);
98
+ $args['sig'] = $sig;
99
+ $args['bvTime'] = $time;
100
+ $args['bvPublic'] = $public;
101
+ $args['bvVersion'] = $version;
102
+ $args['sha1'] = '1';
103
+ return $args;
104
+ }
105
+ }
106
+ endif;
main/db.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVDb')) :
5
+
6
+ class BVDb {
7
+ function dbprefix() {
8
+ global $wpdb;
9
+ $prefix = $wpdb->base_prefix ? $wpdb->base_prefix : $wpdb->prefix;
10
+ return $prefix;
11
+ }
12
+
13
+ function prepare($query, $args) {
14
+ global $wpdb;
15
+ return $wpdb->prepare($query, $args);
16
+ }
17
+
18
+ function getSiteId() {
19
+ global $wpdb;
20
+ return $wpdb->siteid;
21
+ }
22
+
23
+ function getResult($query, $obj = ARRAY_A) {
24
+ global $wpdb;
25
+ return $wpdb->get_results($query, $obj);
26
+ }
27
+
28
+ function query($query) {
29
+ global $wpdb;
30
+ return $wpdb->query($query);
31
+ }
32
+
33
+ function getVar($query, $col = 0, $row = 0) {
34
+ global $wpdb;
35
+ return $wpdb->get_var($query, $col, $row);
36
+ }
37
+
38
+ function getCol($query, $col = 0) {
39
+ global $wpdb;
40
+ return $wpdb->get_col($query, $col);
41
+ }
42
+
43
+ function tableName($table) {
44
+ return $table[0];
45
+ }
46
+
47
+ function showTables() {
48
+ $tables = $this->getResult("SHOW TABLES", ARRAY_N);
49
+ return array_map(array($this, 'tableName'), $tables);
50
+ }
51
+
52
+ function showTableStatus() {
53
+ return $this->getResult("SHOW TABLE STATUS");
54
+ }
55
+
56
+ function tableKeys($table) {
57
+ return $this->getResult("SHOW KEYS FROM $table;");
58
+ }
59
+
60
+ function describeTable($table) {
61
+ return $this->getResult("DESCRIBE $table;");
62
+ }
63
+
64
+ function checkTable($table, $type) {
65
+ return $this->getResult("CHECK TABLE $table $type;");
66
+ }
67
+
68
+ function repairTable($table) {
69
+ return $this->getResult("REPAIR TABLE $table;");
70
+ }
71
+
72
+ function showTableCreate($table) {
73
+ return $this->getVar("SHOW CREATE TABLE $table;", 1);
74
+ }
75
+
76
+ function rowsCount($table) {
77
+ $count = $this->getVar("SELECT COUNT(*) FROM $table;");
78
+ return intval($count);
79
+ }
80
+
81
+ function createTable($query, $name) {
82
+ $table = $this->getBVTable($name);
83
+ if (!$this->isTablePresent($table)) {
84
+ if (array_key_exists('usedbdelta', $_REQUEST)) {
85
+ if (!function_exists('dbDelta'))
86
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
87
+ dbDelta($query);
88
+ } else {
89
+ $this->query($query);
90
+ }
91
+ }
92
+ return $this->isTablePresent($table);
93
+ }
94
+
95
+ function getTableContent($table, $fields = '*', $filter = '', $limit = 0, $offset = 0) {
96
+ $query = "SELECT $fields from $table $filter";
97
+ if ($limit > 0)
98
+ $query .= " LIMIT $limit";
99
+ if ($offset > 0)
100
+ $query .= " OFFSET $offset";
101
+ $rows = $this->getResult($query);
102
+ return $rows;
103
+ }
104
+
105
+ function isTablePresent($table) {
106
+ return ($this->getVar("SHOW TABLES LIKE '$table'") === $table);
107
+ }
108
+
109
+ function getCharsetCollate() {
110
+ global $wpdb;
111
+ if (method_exists($wpdb, 'get_charset_collate')) {
112
+ return $wpdb->get_charset_collate();
113
+ }
114
+ return '';
115
+ }
116
+
117
+ function getWPTable($name) {
118
+ return ($this->dbprefix() . $name);
119
+ }
120
+
121
+ function getBVTable($name) {
122
+ return ($this->getWPTable("bv_" . $name));
123
+ }
124
+
125
+ function truncateBVTable($name) {
126
+ $table = $this->getBVTable($name);
127
+ if ($this->isTablePresent($table)) {
128
+ return $this->query("TRUNCATE TABLE $table;");
129
+ } else {
130
+ return false;
131
+ }
132
+ }
133
+
134
+ function deleteBVTableContent($name, $filter = "") {
135
+ $table = $this->getBVTable($name);
136
+ if ($this->isTablePresent($table)) {
137
+ return $this->query("DELETE FROM $table $filter;");
138
+ } else {
139
+ return false;
140
+ }
141
+ }
142
+
143
+ function dropBVTable($name) {
144
+ $table = $this->getBVTable($name);
145
+ if ($this->isTablePresent($table)) {
146
+ $this->query("DROP TABLE IF EXISTS $table;");
147
+ }
148
+ return !$this->isTablePresent($table);
149
+ }
150
+
151
+ function deleteRowsFromtable($name, $count = 1) {
152
+ $table = $this->getBVTable($name);
153
+ if ($this->isTablePresent($table)) {
154
+ return $this->getResult("DELETE FROM $table LIMIT $count;");
155
+ } else {
156
+ return false;
157
+ }
158
+ }
159
+
160
+ function replaceIntoBVTable($name, $value) {
161
+ global $wpdb;
162
+ $table = $this->getBVTable($name);
163
+ return $wpdb->replace($table, $value);
164
+ }
165
+ }
166
+ endif;
main/lib.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVLib')) :
5
+
6
+ class BVLib {
7
+ public function objectToArray($obj) {
8
+ return json_decode(json_encode($obj), true);
9
+ }
10
+
11
+ public function dbsig($full = false) {
12
+ if (defined('DB_USER') && defined('DB_NAME') &&
13
+ defined('DB_PASSWORD') && defined('DB_HOST')) {
14
+ $sig = sha1(DB_USER.DB_NAME.DB_PASSWORD.DB_HOST);
15
+ } else {
16
+ $sig = "bvnone".$this->randString(34);
17
+ }
18
+ if ($full)
19
+ return $sig;
20
+ else
21
+ return substr($sig, 0, 6);
22
+ }
23
+
24
+ public function randString($length) {
25
+ $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
26
+
27
+ $str = "";
28
+ $size = strlen($chars);
29
+ for( $i = 0; $i < $length; $i++ ) {
30
+ $str .= $chars[rand(0, $size - 1)];
31
+ }
32
+ return $str;
33
+ }
34
+
35
+ public function http_request($url, $body) {
36
+ $_body = array(
37
+ 'method' => 'POST',
38
+ 'timeout' => 15,
39
+ 'body' => $body);
40
+
41
+ return wp_remote_post($url, $_body);
42
+ }
43
+ }
44
+ endif;
main/site_info.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) exit;
4
+ if (!class_exists('BVSiteInfo')) :
5
+
6
+ class BVSiteInfo {
7
+ public function getOption($key) {
8
+ $res = false;
9
+ if (function_exists('get_site_option')) {
10
+ $res = get_site_option($key, false);
11
+ }
12
+ if ($res === false) {
13
+ $res = get_option($key, false);
14
+ }
15
+ return $res;
16
+ }
17
+
18
+ public function deleteOption($key) {
19
+ if (function_exists('delete_site_option')) {
20
+ return delete_site_option($key);
21
+ } else {
22
+ return delete_option($key);
23
+ }
24
+ }
25
+
26
+ public function updateOption($key, $value) {
27
+ if (function_exists('update_site_option')) {
28
+ return update_site_option($key, $value);
29
+ } else {
30
+ return update_option($key, $value);
31
+ }
32
+ }
33
+
34
+ public function setTransient($name, $value, $time) {
35
+ if (function_exists('set_site_transient')) {
36
+ return set_site_transient($name, $value, $time);
37
+ }
38
+ return false;
39
+ }
40
+
41
+ public function deleteTransient($name) {
42
+ if (function_exists('delete_site_transient')) {
43
+ return delete_site_transient($name);
44
+ }
45
+ return false;
46
+ }
47
+
48
+ public function getTransient($name) {
49
+ if (function_exists('get_site_transient')) {
50
+ return get_site_transient($name);
51
+ }
52
+ return false;
53
+ }
54
+
55
+ public function wpurl() {
56
+ if (function_exists('network_site_url'))
57
+ return network_site_url();
58
+ else
59
+ return get_bloginfo('wpurl');
60
+ }
61
+
62
+ public function siteurl() {
63
+ if (function_exists('site_url')) {
64
+ return site_url();
65
+ } else {
66
+ return get_bloginfo('wpurl');
67
+ }
68
+ }
69
+
70
+ public function homeurl() {
71
+ if (function_exists('home_url')) {
72
+ return home_url();
73
+ } else {
74
+ return get_bloginfo('url');
75
+ }
76
+ }
77
+
78
+ public function isMultisite() {
79
+ if (function_exists('is_multisite'))
80
+ return is_multisite();
81
+ return false;
82
+ }
83
+
84
+ public function isMainSite() {
85
+ if (!function_exists('is_main_site' ) || !$this->isMultisite())
86
+ return true;
87
+ return is_main_site();
88
+ }
89
+
90
+ public function basic(&$info) {
91
+ $info['wpurl'] = $this->wpurl();
92
+ $info['siteurl'] = $this->siteurl();
93
+ $info['homeurl'] = $this->homeurl();
94
+ $info['serverip'] = $_SERVER['SERVER_ADDR'];
95
+ $info['abspath'] = ABSPATH;
96
+ return $info;
97
+ }
98
+ }
99
+ endif;
protect.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ if (!class_exists('BVProtect')) :
4
+
5
+ require_once dirname( __FILE__ ) . '/logger.php';
6
+ require_once dirname( __FILE__ ) . '/fw/fw.php';
7
+ require_once dirname( __FILE__ ) . '/lp/lp.php';
8
+
9
+ class BVProtect {
10
+ public $bvmain;
11
+
12
+ function __construct($bvmain) {
13
+ $this->bvmain = $bvmain;
14
+ }
15
+
16
+ public function init() {
17
+ $ip = $this->getIP();
18
+ $fw = new BVFW($this->bvmain, $ip);
19
+ $fw->init();
20
+ $lp = new BVLP($this->bvmain, $ip);
21
+ $lp->init();
22
+ }
23
+
24
+ public function getIP() {
25
+ $ip = '127.0.0.1';
26
+ if (($ipHeader = $this->bvmain->getIPHeader()) && is_array($ipHeader)) {
27
+ if (array_key_exists($ipHeader['hdr'], $_SERVER)) {
28
+ $_ips = preg_split("/(,| |\t)/", $_SERVER[$ipHeader['hdr']]);
29
+ if (array_key_exists(intval($ipHeader['pos']), $_ips)) {
30
+ $ip = $_ips[intval($ipHeader['pos'])];
31
+ }
32
+ }
33
+ } else if (array_key_exists('REMOTE_ADDR', $_SERVER)) {
34
+ $ip = $_SERVER['REMOTE_ADDR'];
35
+ }
36
+ $ip = trim($ip);
37
+ if (preg_match('/^\[([0-9a-fA-F:]+)\](:[0-9]+)$/', $ip, $matches)) {
38
+ $ip = $matches[1];
39
+ } elseif (preg_match('/^([0-9.]+)(:[0-9]+)$/', $ip, $matches)) {
40
+ $ip = $matches[1];
41
+ }
42
+ return $ip;
43
+ }
44
+ }
45
+ endif;
publickeys/bvkey3.pub ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN PUBLIC KEY-----
2
+ MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqFB9e3GLIO4DaAvTKl30
3
+ UPW3H0op9CqSAvUxngDolJPvAbjnjSfdv/39V3EVJJvUVBm25gq+613WnMhpACM+
4
+ v7I7X4wzNFp1q1N9/b7fE2CU+UfU8nToH2DEzDtwsaKlTCJlqj602CClSKgj83Ks
5
+ uUuR0/YSWV2JRX1O/4SvbmzJ41FM46uptTAx/8OlgTPr8H/SyEJA1Z0jE0KbPr2Y
6
+ QY2gNauPB2V7SguRae+z1EYGVML9LPsblD7TETTRi6R6aR3eV4EZYBTQ5D0y+MA6
7
+ 9BlY0CQePgQ8Vf+7LFMgy+OL742FYwF5Etz16yMxIASSLvNvsJMvCSrgenzYjpuG
8
+ QRTm0PXonNT/+b634bqYMTRAu+uBIGLeunO32Upb/NeypXnorZF32zxyGPxfhd8j
9
+ +plyKlb0RSmKfzwbwzxDsyxwvy//Vfy45mf7qtohRdZeNekWIEr6qubk0mjyOh/F
10
+ 2QpXw+YUCNa/zlhx1mKzhwAfVBAtG1jpJOdNnyHtGhcI64OwWOV0N8jzcLRFmo6w
11
+ sf3P49LZ01J0mW3vYmENlKRM9mtI6TUDC0LM90k5UyY6aUUPER0XMJuyO7z6IQyl
12
+ XMlY+Pan91L81od3GS2UsegPmelRh8gvh/uJoN7dOqPTmTotT7VT60751GxYRz0Q
13
+ VvqoWbbNL8R1xQWHtgAqffcCAwEAAQ==
14
+ -----END PUBLIC KEY-----
readme.txt ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Backup & Staging - BlogVault Backups ===
2
+ Contributors: BlogVault Backup
3
+ Tags: backup, wordpress backup, backup plugin, cloud backup, database backup, back up, staging, restore, s3 backup, dropbox backup, google drive backup
4
+ Plugin URI: https://blogvault.net/
5
+ Donate link: https://app.blogvault.net/home/signup
6
+ Requires at least: 4.0
7
+ Tested up to: 5.2.1
8
+ Stable tag: 1.88
9
+ License: GPLv2 or later
10
+ License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
11
+
12
+ Backup , Restore, Migrate, and Stage your website with our incremental backup technology. Backup easily to S3 and Dropbox. Complete website backups.
13
+
14
+ == DESCRIPTION ==
15
+ The Most Reliable Incremental Backup Plugin with Free Cloud Storage. Best Part, Comes with a FREE Staging Environment.
16
+
17
+ Check out more BlogVault customer testimonials from **[here](http://bit.ly/2RGXKN2)**
18
+
19
+ With a 100% Successful Website Restore Rate, BlogVault is the world's Fastest and most Reliable WordPress Backup solution trusted by over 4,50,000+ websites.
20
+
21
+ **Companies you Trust, Trust BlogVault.**
22
+
23
+ We officially power migration for some of the largest web hosts from WPEngine, Pantheon, FlyWheel, LiquidWeb, Cloudways, Savvii and many more.
24
+
25
+ It is the perfect solution for developer and agencies as it comes with all the tools you need to maintain and manage multiple websites. **From One-Click Staging to Flawless Migrations to Complete Website Management and a White Label Solution**. It even provides out of the box **Client Reporting**.
26
+
27
+ Learn more about BlogVault from **[here](http://bit.ly/2RLJh2e)**
28
+
29
+ == BlogVault in Numbers ==
30
+ * 1+ million Successful Website Restorations
31
+ * 450,000+ Sites backed up and counting
32
+ * 330GB Largest site Backed Up
33
+ * 10,000+ Web hosts Compatibility
34
+ * Five Star Support
35
+
36
+ [youtube https://www.youtube.com/watch?v=Y4teDRL08mY]
37
+
38
+ == Benefits of Using BlogVault as Your Go-to Backup Solution ==
39
+
40
+ = 1. Incremental Backups Guaranteed to Always Work =
41
+ * Incremental backups that never overloads your server
42
+ * Free offsite storage ensures 24X7 availability
43
+ * 90 days archive to recover from any mistake
44
+ * First plugin with Multi-site backup support
45
+
46
+ = 2. Fastest Website Recovery Within Minutes =
47
+ * 1 million+ website restores with 100% success rate
48
+ * Differential Restore for lightning-fast recovery
49
+ * 90 days archive to recover from any mistake
50
+ * Perform full Restore even if your website is offline
51
+
52
+ = 3. Deploy a Staging Site in One-click for Free =
53
+ * Safely test your website updates and changes
54
+ * Staging site runs on our cloud servers
55
+ * Completely free of cost
56
+ * One-click Merge to push changes to live site
57
+
58
+ = 4. Frustration-Free Website Migrations in 1-Click =
59
+ * Compatible & approved with 5,000+ web hosts
60
+ * Zero downtime guaranteed
61
+ * Intelligent automatic rewrite of all website URLs
62
+ * Migrate to a new domain, host, DNS or server
63
+
64
+ = 5. Real-time Backups for WooCommerce Stores =
65
+ * Backup all orders as and when they take place
66
+ * Recover anytime with 365 days of backup archives
67
+ * 24X7 data protection with offsite storage
68
+
69
+ = 6. Manage Multiple Websites from a Single Dashboard =
70
+ * Perform WordPress core, theme, plugin updates
71
+ * Invite team members for efficient collaboration
72
+ * Exclusive White-label solution to grow revenues
73
+ * Beautiful and comprehensive Client Reporting
74
+
75
+ = 7. Last, BlogVault is a "Service," Not just a Backup Plugin =
76
+ * Always improving & adding features unlike plugins
77
+ * Our Support always has your back
78
+ * Full peace of mind with encrypted offsite storage
79
+ * Access backups 24X7 with independent dashboard
80
+
81
+ == Why Choose BlogVault Backup Services? ==
82
+
83
+ * **Set up & Running in Just 60 Secs -** Get started in no time. Log in. Auto-Install. And that’s it!
84
+ * **Comes with Built-in Free Staging -** Develop your site the way you’ve always wanted to. Update without breaking live site.
85
+ * **Doesn’t Slow Down Website, Ever -** All processing take place on our own server. Your site does not slow down at all.
86
+ * **No Technical Knowledge Needed -** Automated workflows that ensure everything you need is only a click away.
87
+ * **Personal Support for Everyone -** Agile & Responsive Customer Support that caters to Everyone.
88
+
89
+ **Have You Tried BlogVault Pro Yet?**
90
+
91
+ BlogVault offers an unrestricted 7 days free trial. **Explore all features of full BlogVault for FREE**.
92
+
93
+ **[Try out BlogVault](http://bit.ly/2RKzrgY)** without any commitment. No credit card needed.
94
+
95
+ == FREQUENTLY ASKED QUESTIONS ==
96
+
97
+ =Can I Setup my BlogVault backup account myself?=
98
+ Yes. Take the help of this **[step-by-step guide](http://bit.ly/2RJg9sv)**.
99
+
100
+ =I am unable to reach the backup plugin. What can I do?=
101
+ You can send an email to the support team on *support@blogvault.net* and notify our team regarding this.
102
+
103
+ =Are there any prerequisites for using BlogVault?=
104
+ No. All you need is a WordPress site. We don’t use your website resources for backing up so you will not experience any downtime, or page delay while executing BlogVault functions.
105
+
106
+ =Do you have a free plan? How does it work?=
107
+ BlogVault is a paid backup service. But we understand the user's dilemma before starting a new service, which is why we provide a 7 days free trial period. You can avail free trial without any registration, just enter your email ID, password and site URL. Moreover, we do not discriminate between our trial period users and premium customers.
108
+
109
+ =How do I upgrade from my free trial to a premium account?=
110
+ To upgrade from free trial version to a premium account, please take the help of **[this guide](http://bit.ly/2RHvPfS)**.
111
+
112
+ =How do I upgrade to a bigger Plan?=
113
+ To upgrade to a bigger Plan, take the help of **[this guide](http://bit.ly/2RHvPfS)**.
114
+
115
+ =Do I need to pay for support and help?=
116
+ Never! We will be with you for any queries regarding backups or anything at all times. **[Click here](https://blogvault.net/contact)** to get in touch with us!
117
+
118
+ =What exactly does BlogVault backup?=
119
+ BlogVault Backup Service backs up everything in your WordPress site incrementally and completely – Including posts, pages, files, themes, images, etc. A WordPress site consists of 2 parts:
120
+ * Database backup – We back up the complete database.
121
+ * Files backup – We back up all the files within your core WordPress folders (wp-content, wp-includes, and wp-admin).
122
+
123
+ This strategy ensures that we do not miss anything on your site.
124
+
125
+ =How often does BlogVault backup my website?=
126
+ BlogVault backs up your website daily, automatically.
127
+
128
+ =How safe are my backup files?=
129
+ Your backups are very safe. We use encrypted cloud backups and off-site BlogVault servers to store your site backups and run security operations. This ensures seamless integration of security to your website without affecting your site servers.
130
+
131
+ =Can I have all backups sync to my Google Drive and not Dropbox?=
132
+ We do not automatically sync your backups to Dropbox. However, we do provide an interface that can help enable you to move your backup to Dropbox. You can also download your Backups to your computer and then upload them on Google Drive.
133
+
134
+ =Can BlogVault be used for WooCommerce store websites?=
135
+ Yes, BlogVault integrates well with WooCommerce websites with the special inbuilt Real Time backups functionality. Please see **[WooCommerce backups page](http://bit.ly/2RKNfrR)**.
136
+
137
+ =What does BlogVault backup from a WooCommerce site?=
138
+ BlogVault backups files and tables, database metadata like database name, location, all content, settings, and configuration.
139
+
140
+ =Can I restore WooCommerce backup using BlogVault?=
141
+ Yes. Restoring a backup using BlogVault is easy. Take a look at **[how to restore a site](http://bit.ly/2RL9gXN)**.
142
+
143
+ =Can I use BlogVault to handle Backup Restoration?=
144
+ Yes, BlogVault’s Auto recovery functionality gets your site back up and running with almost Zero Downtime. Please see **[Auto-Recovery page](http://bit.ly/2RKsEUE)**.
145
+
146
+ =What is the difference between Restore and Test Restore?=
147
+ Test Restore is meant to test the backups only, whereas Restore helps to restore a backup on the live site, directly.
148
+
149
+ =Can I restore a backup to a new server?=
150
+ Yes. You can do this by making use of our integrated Migration feature where you can choose the backup version that you want to migrate to a new server or new site.
151
+
152
+ =Where is the staging site located?=
153
+ Your staging site will be on BlogVault servers.
154
+
155
+ =How long is my staging valid?=
156
+ With BlogVault backup service, you can extend your staging site validity up to 56 days.
157
+
158
+ =What do I do after Staging a site?=
159
+ After you are satisfied with your staging site, BlogVault Backup Service allows you can push the changes you like, onto your actual live site, directly.
160
+
161
+ =Will I receive emails from the staging environment?=
162
+ No, we do not have a mailing system at the Staging server. Many sites have automated emails setup on their sites. On staging environments, they do not want these to be triggered. Staging environment does not have protection for spam emails. Blocking all emails ensures that the staging server IP is not blacklisted.
163
+
164
+ =Can I merge WooCommerce website staging site to live site?=
165
+ If you move them from the staging site to the live site, all your new orders will be lost on the live site. But we have provided you with the option with the selective merge. Select only the tables you want to merge and let BlogVault take care of the rest for you. Please don’t forget to backup your website before you start merging.
166
+
167
+ =Does BlogVault backup work with all web hosts?=
168
+ Yes. We’ve built BlogVault to work with any web host in the world. You just need to provide FTP credentials for the destination server. We migrate your WordPress site, whether you are:
169
+
170
+ Migrating to or from GoDaddy, BlueHost, SiteGround, HostGator, WPEngine, Flywheel, etc. OR Migrating to any other web host (in this case you’ll have to select either the cPanel or FTP options).
171
+
172
+ =Will there be downtime during migration?=
173
+ No, BlogVault Backup Service will cause no downtime to the destination server while migration.
174
+
175
+ =Will BlogVault start backing up the new site after migration?=
176
+ Unless otherwise specified, BlogVault will backup a site following DNS resolution. If you migrated the site to a different URL, make sure the new URL is added as a site with BlogVault to enable backup. If the migration were to the same URL at a different host, BlogVault would automatically start doing a backup from the new location as soon as the DNS is updated.
177
+
178
+ =Can I update WordPress core, plugins and themes directly?=
179
+ Yes. Take a look at this **[Manage Site help doc](http://bit.ly/2ROA9du)**. Before updating on the live site, we’d suggest you update on a staging site. BlogVault Backup Service comes with a free staging website.
180
+
181
+ =Can I manage my site users and their password directly?=
182
+ Yes. With BlogVault backup service, you can manage your site users and passwords. Take the help of this **[Manage Site help doc](http://bit.ly/2ROA9du)**.
183
+
184
+ =Can I add Clients and Team Members on my BlogVault Backup account?=
185
+ Yes, you can.
186
+
187
+ Our client feature is for your reference alone. You can assign a client to their site. If you want to give a user, the dashboard access, please add them as your team members under the team section. Please see **[How do I add clients and team members](http://bit.ly/2RK7p5t)**?
188
+
189
+ =Isn’t WordPress or Web Host backing up my website for me?=
190
+ WordPress by default does not back up your site for you. As for web hosts, if your site is not on wordpress.com, then you have a reason to worry. Servers, while generally robust, do fail from time to time for various reasons. Moreover, web hosting providers usually do not provide complete backups. When such backups are restored, sites crash and data is lost. Several such horror stories inspired us to build this service!
191
+
192
+ =Do I really need BlogVault?=
193
+ BlogVault provides comprehensive and complete backup services. Apart from handling website security, it can also assist you with instant Migration as well as Staging and Merging services at very reasonable rates.
194
+ This is a backup and security service that remains committed to your website security by handling site management functions. If you care about keeping your WordPress website safe, then you definitely need a security solution like BlogVault.
195
+
196
+ =What will the security report contain?=
197
+ Your Website Reports will contain details on the following:
198
+ * WP Version
199
+ * Total Backups made
200
+ * Backups Time range
201
+ * Total security scans made (Backup+Security plan only)
202
+ * Active Theme
203
+ * Number of Published Posts
204
+ * Number of Published Pages
205
+ * Number of Approved Comments
206
+ * Total database tables
207
+ * Total Files
208
+ * Total Plugins
209
+ * Active Plugins
210
+ * Installed Themes
211
+
212
+ =Is BlogVault compatible with all other plugins and themes?=
213
+ BlogVault is compatible with all plugins and themes. It works even if you have a different backup plugin installed. If you want to uninstall a plugin and install BlogVault plugin, kindly take a look at our guide on **[How to install BlogVault](http://bit.ly/2RKgPxP)**.
214
+
215
+ =Error: "FTP permission issues, FTP is correct but we might not have permissions to upload or remove a file."=
216
+ This could happen when you’re on shared hosting. Contact your host and ask them to grant you access to upload files via FTP.
217
+
218
+ =Error: "Execution expired, Connection timed out, Connection reset by a peer in both FTP and HTTP requests."=
219
+ Nothing to worry, this notification means your destination server denied our requests to offload your site’s data. This could be because of a few reasons:
220
+ * Your destination site isn’t reachable (you’ll have to contact your destination web host about this)
221
+ * You have a firewall installed, which is blocking consecutive requests from the same source (in which case, please wait for some time and try again)
222
+
223
+ =How can I submit a feature request?=
224
+ We are happy to accept all feature requests for our products and services. Simply fill in a detailed description of our **[contact form](https://blogvault.net/contact/)**, and we’ll make sure the correct department reviews the request. We cannot guarantee that all requests will be satisfied, but we love hearing feedback from our users.
225
+
226
+ =Very happy with the service and want to give you guys a review. Where do I do it?=
227
+ Thank you. We really appreciate these kind words, and it makes our day. We would love it if you could review our service **[here](http://bit.ly/2RKkko2)**.
228
+
229
+ == SCREENSHOTS ==
230
+
231
+ 1. BlogVault provides you a comprehensive History page that lets you manage all your WordPress backups with ease.
232
+ 2. Trusted by over 4,00,000+ websites, BlogVault is the best WordPress backup service for your website.
233
+ 3. Check the Performance Speed of your website from the BlogVault dashboard.
234
+ 4. Manage multiple WordPress sites from one dashboard.
235
+ 5. With Uptime Monitoring you get notified the moment your website is shut down.
236
+ 6. With BlogVault's free Staging test updates, plugins, and WordPress themes without breaking your live site.
237
+ 7. With BlogVault's White-Label Solution you can showcase our service under your own brilliant brand.
238
+ 8. For WooCommerce sites, BlogVault’s Real Time Backups can make all the difference.
239
+ 9. We power WordPress migration for WPEngine, Pantheon, FlyWheel, LiquidWeb, Cloudways, Savvii and many more. Need we say more?
240
+
241
+ == CHANGELOG ==
242
+ = 1.88 =
243
+ * Handling translations
244
+ * Callback improvements
245
+ * Adding delete transient callback
246
+
247
+ = 1.87 =
248
+ * Checking Whitelisted IP's first
249
+
250
+ = 1.86 =
251
+ * Making add account compatible for PHP 5.3
252
+ * Updating tested upto 5.1
253
+
254
+ = 1.85 =
255
+ * UI improvements
256
+
257
+ = 1.84 =
258
+ * Disable form on submit
259
+
260
+ = 1.83 =
261
+ * Setting blocked page to be non-cacheable
262
+
263
+ = 1.82 =
264
+ * Improving ip extraction and updating tested upto 5.0
265
+
266
+ = 1.81 =
267
+ * Adding Geoblocking functionality
268
+
269
+ = 1.78 =
270
+ * Adding support for hourly backup
271
+
272
+ = 1.77 =
273
+ * Adding function_exists for getmyuid and get_current_user functions
274
+
275
+ = 1.76 =
276
+ * Removing create_funtion for PHP 7.2 compatibility
277
+
278
+ = 1.75 =
279
+ * Adding check for multisite.
280
+
281
+ = 1.74 =
282
+ * DynSync Bug Fix for multisite.
283
+
284
+ = 1.73 =
285
+ * Ability to show captcha for all login blocked
286
+
287
+ = 1.72 =
288
+ * Adding Misc Callback
289
+
290
+ = 1.71 =
291
+ * Adding logout functionality in the plugin
292
+
293
+ = 1.69 =
294
+ * Adding support for chunked base64 encoding
295
+
296
+ = 1.68 =
297
+ * Updating upload rows
298
+
299
+ = 1.67 =
300
+ * Latest WooCommerce plugin compatibility
301
+
302
+ = 1.66 =
303
+ * Updating TOS and privacy policies
304
+
305
+ = 1.65 =
306
+ * Bug fix for dynsync
307
+
308
+ = 1.64 =
309
+ * Bug fixes for lp and fw
310
+
311
+ = 1.62 =
312
+ * SSL support in plugin for API calls
313
+ * Adding support for plugin branding
314
+
315
+ = 1.61 =
316
+ * Better handling for request IP
317
+
318
+ = 1.53 =
319
+ * Restructuring plugin completely
320
+ * Better security
321
+
322
+ = 1.49 =
323
+ * Updated WooCommerce Dynamic Sync
324
+
325
+ = 1.46 =
326
+ * Separating the functions into clear modules.
327
+ * Re-enabling dbsig, but only for identity.
328
+ * Making comparisons stricter.
329
+ * Changing asym key.
330
+
331
+ = 1.44 =
332
+ * Disabled dbsig.
333
+ * Updated asym_key.
334
+
335
+ = 1.42 =
336
+ * Using custom skin to track site management.
337
+ * Clearing actions during callback.
338
+
339
+ = 1.41 =
340
+ * Better integrity checking.
341
+ * Woo Commerce Dynamic sync support.
342
+
343
+ = 1.40 =
344
+ * Manage sites straight from BlogVault dashboard.
345
+
346
+ = 1.31 =
347
+ * Changing dynamic backups to be pull-based.
348
+
349
+ = 1.30 =
350
+ * Using dbsig based authenticatation.
351
+
352
+ = 1.22 =
353
+ * Adding support for GLOB based directory listings.
354
+
355
+ = 1.21 =
356
+ * Adding support for PHP 5 style constructors.
357
+
358
+ = 1.20 =
359
+ * Adding DB Signature and Server Signature to uniquely identify a site.
360
+ * Adding the stats api to the WordPress Backup plugin.
361
+ * Sending tablename/rcount as part of the callback.
362
+
363
+ = 1.17 =
364
+ * Add support for repair table so that the backup plugin itself can be used to repair tables without needing PHPMyAdmin access.
365
+ * Making the plugin to be available network wide.
366
+
367
+ = 1.16 =
368
+ * Improving the Base64 Decode functionality so that it is extensible for any parameter in the future and backups can be completed for any site.
369
+ * Separating out callbacks gettablecreate and getrowscount to make the backups more modular.
370
+ * The plugin will now automatically ping the server once a day. This will ensure that we know if we are not doing the backup of a site where the plugin is activated.
371
+ * Use SHA1 for authentication instead of MD5.
372
+
373
+ = 1.15 =
374
+ * Separating to multiple files.
375
+ * Adding BVSecurity with limit logins.
376
+
377
+ = 1.14 =
378
+ * Better handling for real-time backup events for WooCommerce.
379
+ * Support real-time backups for WooCommerce version 2.1.12.
380
+ * Improving the is_admin check with current_user_can('activate_plugins').
381
+ * Removing the option to manually add the BlogVault badge for the free backup plan.
382
+
383
+ = 1.13 =
384
+ * Adding events for the dynamic backup of the usermeta table.
385
+
386
+ = 1.12 =
387
+ * Introducing the free weekly backup plan.
388
+ * Show the ad for the free backup plan in the sidebar.
389
+ * Changing default backup plans to pay for year in advance.
390
+
391
+ = 1.11 =
392
+ * Making the backup plugin compatible with older versions of WordPress. network_site_url was not available in WP versions older than 3.0. For older versions we use get_bloginfo("wpurl").
393
+ * The randomly generated secret key is sent to the server during login or signup. This will let us configure the keys easily on the plugin for backups to take place.
394
+ * Adding the screenshot to show all backups being managed from one dashboard.
395
+
396
+ = 1.10 =
397
+ * Ability to not do dynamic backups for updates to certain changes to the options table.
398
+ * Additional options which need to be blocked for dynamic backups can be sent from the server.
399
+ * Ability to not do dynamic backups for updates to certain changes to the postmeta table.
400
+ * Additional postmeta keys which need to be blocked for dynamic backups can be sent from the server.
401
+ * Do not dynamically backup comments which have been marked as spam.
402
+ * Do not dynamically backup commentmeta for comments which have been marked as spam.
403
+ * Improve the look and feel of the admin page.
404
+ * Include link to the review of the BlogVault Backup plugin by MIGHTYminnow.
405
+
406
+ = 1.09 =
407
+ * When the plugin is activated but an BlogVault Account is not created then the secret key is left empty. This is a security issue. Hence we will set a random value for the secret key when the plugin is installed.
408
+
409
+ = 1.08 =
410
+ * Changing the name to Backup Plugin by BlogVault.
411
+ * Updating the tested WordPress version to 3.9.
412
+
413
+ = 1.06 =
414
+ * Setting BlogVault key now validates the nonce to prevent XSRF.
415
+ * Updating the plugin description with video introducing BlogVault.
416
+
417
+ = 1.05 =
418
+ * Real-time backup for WooCommerce.
419
+
420
+ = 1.04 =
421
+ * Separating the different BlogVault functions into classes.
422
+ * Ability to update the BlogVault Key.
423
+ * Retrieving/Updating option only on the main site of a Network install.
424
+
425
+ = 1.02 =
426
+ * Releasing the BlogVault plugin into the WordPress repository.
427
+