PluginProbe
The WP Remote WordPress Plugin / 6.44
The WP Remote WordPress Plugin v6.44
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
← All changes | wp_admin.php +89 -65 4.976.44 View file →
@@ -24,9 +24,9 @@
24 24 }
25 25 }
26 26
27 27 function removeAdminNotices() {
28 - if (array_key_exists('page', $_REQUEST) && $_REQUEST['page'] == $this->bvinfo->plugname) {
28 + if (WPRHelper::getRawParam('REQUEST', 'page') === $this->bvinfo->plugname) {
29 29 remove_all_actions('admin_notices');
30 30 remove_all_actions('all_admin_notices');
31 31 }
32 32 }
@@ -33,40 +33,47 @@
33 33
34 34 public function initHandler() {
35 35 if (!current_user_can('activate_plugins'))
36 36 return;
37 + $bvnonce = WPRHelper::getRawParam('REQUEST', 'bvnonce');
38 + $blogvaultkey = WPRHelper::getRawParam('REQUEST', 'blogvaultkey');
39 + $blogvaultkey = $blogvaultkey ? WPRAccount::sanitizeKey($blogvaultkey) : "";
37 40
38 - if (array_key_exists('bvnonce', $_REQUEST) &&
39 - wp_verify_nonce($_REQUEST['bvnonce'], "bvnonce") &&
40 - array_key_exists('blogvaultkey', $_REQUEST) &&
41 - (strlen(WPRAccount::sanitizeKey($_REQUEST['blogvaultkey'])) == 64) &&
42 - (array_key_exists('page', $_REQUEST) &&
43 - $_REQUEST['page'] == $this->bvinfo->plugname)) {
44 - $keys = str_split($_REQUEST['blogvaultkey'], 32);
41 + if ($bvnonce && wp_verify_nonce($bvnonce, "bvnonce") &&
42 + $blogvaultkey && strlen($blogvaultkey) == 64 &&
43 + (WPRHelper::getRawParam('REQUEST', 'page') === $this->bvinfo->plugname)) {
44 + $keys = str_split($blogvaultkey, 32);
45 45 WPRAccount::addAccount($this->settings, $keys[0], $keys[1]);
46 - if (array_key_exists('redirect', $_REQUEST)) {
47 - $location = $_REQUEST['redirect'];
46 +
47 + $location = WPRHelper::getStringParamSanitized('REQUEST', 'redirect', 'url');
48 + if ($location) {
48 49 wp_redirect($this->bvinfo->appUrl()."/dash/redir?q=".urlencode($location));
49 50 exit();
50 51 }
51 52 }
53 +
52 54 if ($this->bvinfo->isActivateRedirectSet()) {
53 55 $this->settings->updateOption($this->bvinfo->plug_redirect, 'no');
54 56 ##ACTIVATEREDIRECTCODE##
55 - wp_redirect($this->mainUrl());
57 + if (!wp_doing_ajax()) {
58 + wp_redirect($this->mainUrl());
59 + }
56 60 }
57 61 }
58 62
59 63 public function wprsecAdminMenu($hook) {
60 - if ($hook === 'toplevel_page_wpremote' || preg_match("/wpr_add_account$/", $hook) || preg_match("/wpr_account_details$/", $hook)) {
61 - wp_enqueue_style( 'bootstrap', plugins_url('css/bootstrap.min.css', __FILE__));
62 - wp_enqueue_style( 'bvplugin', plugins_url('css/bvplugin.min.css', __FILE__));
64 + if ($hook === 'toplevel_page_wpremote' || WPRHelper::safePregMatch("/wpr_add_account$/", $hook) || WPRHelper::safePregMatch("/wpr_account_details$/", $hook)) {
65 + wp_enqueue_style( 'bootstrap', plugins_url('css/bootstrap.min.css', __FILE__), array(), $this->bvinfo->version);
66 + wp_enqueue_style( 'bvplugin', plugins_url('css/bvplugin.min.css', __FILE__), array(), $this->bvinfo->version);
67 + wp_enqueue_script( 'wpr-connection-key', plugins_url('js/connection-key.js', __FILE__), array(), $this->bvinfo->version, true);
63 68 }
64 69 }
65 70
66 71 public function menu() {
67 - $brand = $this->bvinfo->getBrandInfo();
68 - if (!is_array($brand) || (!array_key_exists('hide', $brand) && !array_key_exists('hide_from_menu', $brand))) {
72 + $brand = $this->bvinfo->getPluginWhitelabelInfo();
73 + $can_whitelabel = $this->bvinfo->canWhiteLabel();
74 + $hide_from_menu = array_key_exists('hide', $brand) || array_key_exists('hide_from_menu', $brand);
75 + if (!$can_whitelabel || !$hide_from_menu) {
69 76 $bname = $this->bvinfo->getBrandName();
70 77 $icon = $this->bvinfo->getBrandIcon();
71 78 add_menu_page($bname, $bname, 'manage_options', $this->bvinfo->plugname,
72 79 array($this, 'adminPage'), plugins_url($icon, __FILE__ ));
@@ -73,13 +80,17 @@
73 80 }
74 81 }
75 82
76 83 public function hidePluginUpdate($plugins) {
77 - $brand = $this->bvinfo->getBrandInfo();
78 - $bvslug = $this->bvinfo->slug;
79 - if (isset($plugins->response[$bvslug]) && is_array($brand)) {
80 - if (array_key_exists('hide_from_menu', $brand) || array_key_exists('hide', $brand)) {
81 - unset($plugins->response[$bvslug]);
84 + if (!$this->bvinfo->canWhiteLabel()) {
85 + return $plugins;
86 + }
87 + $whitelabel_infos = $this->bvinfo->getPluginsWhitelabelInfos();
88 + foreach ($whitelabel_infos as $slug => $brand) {
89 + if ($this->bvinfo->canWhiteLabel($slug) && isset($plugins->response[$slug]) && is_array($brand)) {
90 + if (array_key_exists('hide_from_menu', $brand) || array_key_exists('hide', $brand)) {
91 + unset($plugins->response[$slug]);
92 + }
82 93 }
83 94 }
84 95 return $plugins;
85 96 }
@@ -84,14 +95,16 @@
84 95 return $plugins;
85 96 }
86 97
87 98 public function hidePluginDetails($plugin_metas, $slug) {
88 - $brand = $this->bvinfo->getBrandInfo();
89 - $bvslug = $this->bvinfo->slug;
90 -
91 - if ($slug === $bvslug && is_array($brand) && array_key_exists('hide_plugin_details', $brand)){
99 + if (!is_array($plugin_metas) || !$this->bvinfo->canWhiteLabel($slug)) {
100 + return $plugin_metas;
101 + }
102 + $whitelabel_info = $this->bvinfo->getPluginWhitelabelInfo($slug);
103 + if (array_key_exists('hide_plugin_details', $whitelabel_info)) {
92 104 foreach ($plugin_metas as $pluginKey => $pluginValue) {
93 - if (strpos($pluginValue, sprintf('>%s<', translate('View details')))) {
105 + // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
106 + if (strpos($pluginValue, sprintf('>%s<', __('View details')))) {
94 107 unset($plugin_metas[$pluginKey]);
95 108 break;
96 109 }
97 110 }
@@ -99,31 +112,33 @@
99 112 return $plugin_metas;
100 113 }
101 114
102 115 public function handlePluginHealthInfo($plugins) {
103 - $brand = $this->bvinfo->getBrandInfo();
104 - $title = $this->bvinfo->title;
105 116 if (!isset($plugins["wp-plugins-active"]) ||
106 - !isset($plugins["wp-plugins-active"]["fields"]) ||
107 - !isset($plugins["wp-plugins-active"]["fields"][$title])) {
117 + !isset($plugins["wp-plugins-active"]["fields"]) || !$this->bvinfo->canWhiteLabel()) {
108 118 return $plugins;
109 119 }
110 - if (is_array($brand)) {
111 - if (array_key_exists('hide', $brand)) {
112 - unset($plugins["wp-plugins-active"]["fields"][$title]);
113 - } else {
114 - $plugin = $plugins["wp-plugins-active"]["fields"][$title];
115 - $author = $this->bvinfo->author;
116 - if (array_key_exists('name', $brand)) {
117 - $plugin["label"] = $brand['name'];
120 +
121 + $whitelabel_infos_by_title = $this->bvinfo->getPluginsWhitelabelInfoByTitle();
122 +
123 + foreach ($whitelabel_infos_by_title as $title => $brand) {
124 + if (is_array($brand) && array_key_exists('slug', $brand) && $this->bvinfo->canWhiteLabel($brand["slug"])) {
125 + if (array_key_exists('hide', $brand)) {
126 + unset($plugins["wp-plugins-active"]["fields"][$title]);
127 + } else {
128 + $plugin = $plugins["wp-plugins-active"]["fields"][$title];
129 + $author = $brand['default_author'];
130 + if (array_key_exists('name', $brand)) {
131 + $plugin["label"] = $brand['name'];
132 + }
133 + if (array_key_exists('author', $brand)) {
134 + $plugin["value"] = str_replace($author, $brand['author'], $plugin["value"]);
135 + }
136 + if (array_key_exists('description', $brand)) {
137 + $plugin["debug"] = str_replace($author, $brand['author'], $plugin["debug"]);
138 + }
139 + $plugins["wp-plugins-active"]["fields"][$title] = $plugin;
118 140 }
119 - if (array_key_exists('author', $brand)) {
120 - $plugin["value"] = str_replace($author, $brand['author'], $plugin["value"]);
121 - }
122 - if (array_key_exists('description', $brand)) {
123 - $plugin["debug"] = str_replace($author, $brand['author'], $plugin["debug"]);
124 - }
125 - $plugins["wp-plugins-active"]["fields"][$title] = $plugin;
126 141 }
127 142 }
128 143 return $plugins;
129 144 }
@@ -129,12 +144,13 @@
129 144 }
130 145
131 146 public function settingsLink($links, $file) {
132 147 #XNOTE: Fix this
133 - if ( $file == plugin_basename( dirname(__FILE__).'/blogvault.php' ) ) {
134 - $brand = $this->bvinfo->getBrandInfo();
135 - if (!$brand || !array_key_exists('hide_plugin_details', $brand)) {
136 - $links[] = '<a href="'.$this->mainUrl().'">'.__( 'Settings' ).'</a>';
148 + if ( $file == plugin_basename( dirname(__FILE__).'/plugin.php' ) ) {
149 + $brand = $this->bvinfo->getPluginWhitelabelInfo();
150 + if (!array_key_exists('hide_plugin_details', $brand)) {
151 + // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
152 + $links[] = '<a href="'.$this->mainUrl().'">'.__('Settings').'</a>';
137 153 }
138 154 }
139 155 return $links;
140 156 }
@@ -139,10 +155,10 @@
139 155 return $links;
140 156 }
141 157
142 158 public function getPluginLogo() {
143 - $brand = $this->bvinfo->getBrandInfo();
144 - if (is_array($brand) && array_key_exists('logo', $brand)) {
159 + $brand = $this->bvinfo->getPluginWhitelabelInfo();
160 + if (array_key_exists('logo', $brand)) {
145 161 return $brand['logo'];
146 162 }
147 163 return $this->bvinfo->logo;
148 164 }
@@ -147,10 +163,10 @@
147 163 return $this->bvinfo->logo;
148 164 }
149 165
150 166 public function getWebPage() {
151 - $brand = $this->bvinfo->getBrandInfo();
152 - if (is_array($brand) && array_key_exists('webpage', $brand)) {
167 + $brand = $this->bvinfo->getPluginWhitelabelInfo();
168 + if (array_key_exists('webpage', $brand)) {
153 169 return $brand['webpage'];
154 170 }
155 171 return $this->bvinfo->webpage;
156 172 }
@@ -159,8 +175,9 @@
159 175 require_once dirname( __FILE__ ) . '/recover.php';
160 176 $bvnonce = wp_create_nonce("bvnonce");
161 177 $public = WPRAccount::getApiPublicKey($this->settings);
162 178 $secret = WPRRecover::defaultSecret($this->settings);
179 + $server_ip = WPRHelper::getStringParamEscaped('SERVER', 'SERVER_ADDR', 'attr');
163 180 $tags = "<input type='hidden' name='url' value='".esc_attr($this->siteinfo->wpurl())."'/>\n".
164 181 "<input type='hidden' name='homeurl' value='".esc_attr($this->siteinfo->homeurl())."'/>\n".
165 182 "<input type='hidden' name='siteurl' value='".esc_attr($this->siteinfo->siteurl())."'/>\n".
166 183 "<input type='hidden' name='dbsig' value='".esc_attr($this->siteinfo->dbsig(false))."'/>\n".
@@ -166,9 +183,9 @@
166 183 "<input type='hidden' name='dbsig' value='".esc_attr($this->siteinfo->dbsig(false))."'/>\n".
167 184 "<input type='hidden' name='plug' value='".esc_attr($this->bvinfo->plugname)."'/>\n".
168 185 "<input type='hidden' name='adminurl' value='".esc_attr($this->mainUrl())."'/>\n".
169 186 "<input type='hidden' name='bvversion' value='".esc_attr($this->bvinfo->version)."'/>\n".
170 - "<input type='hidden' name='serverip' value='".esc_attr($_SERVER["SERVER_ADDR"])."'/>\n".
187 + "<input type='hidden' name='serverip' value='".$server_ip."'/>\n".
171 188 "<input type='hidden' name='abspath' value='".esc_attr(ABSPATH)."'/>\n".
172 189 "<input type='hidden' name='secret' value='".esc_attr($secret)."'/>\n".
173 190 "<input type='hidden' name='public' value='".esc_attr($public)."'/>\n".
174 191 "<input type='hidden' name='bvnonce' value='".esc_attr($bvnonce)."'/>\n";
@@ -195,13 +212,20 @@
195 212 require_once dirname( __FILE__ ) . "/admin/account_details.php";
196 213 }
197 214
198 215 public function adminPage() {
199 - if (isset($_REQUEST['bvnonce']) && wp_verify_nonce( $_REQUEST['bvnonce'], 'bvnonce' )) {
216 + $bvnonce = WPRHelper::getRawParam('REQUEST', 'bvnonce');
217 + if ($bvnonce && wp_verify_nonce($bvnonce, 'bvnonce')) {
200 218 $info = array();
201 219 $this->siteinfo->basic($info);
202 - $this->bvapi->pingbv('/bvapi/disconnect', $info, $_REQUEST['pubkey']);
203 - WPRAccount::remove($this->settings, $_REQUEST['pubkey']);
220 +
221 + $pubkey = WPRHelper::getRawParam('REQUEST', 'pubkey');
222 +
223 + if (!empty($pubkey)) {
224 + $pubkey = WPRAccount::sanitizeKey($pubkey);
225 + $this->bvapi->pingbv('/bvapi/disconnect', $info, $pubkey);
226 + WPRAccount::remove($this->settings, $pubkey);
227 + }
204 228 }
205 229 if (WPRAccount::isConfigured($this->settings)) {
206 230 if (!isset($_REQUEST['add_account'])) {
207 231 $this->showAccountDetailsPage();
@@ -212,17 +236,17 @@
212 236 $this->showAddAccountPage();
213 237 }
214 238 }
215 239
216 - public function initBranding($plugins) {
217 - $slug = $this->bvinfo->slug;
218 -
219 - if (!is_array($plugins) || !isset($slug, $plugins)) {
240 + public function initWhitelabel($plugins) {
241 + if (!is_array($plugins) || !$this->bvinfo->canWhiteLabel()) {
220 242 return $plugins;
221 243 }
222 -
223 - $brand = $this->bvinfo->getBrandInfo();
224 - if (is_array($brand)) {
244 + $whitelabel_infos = $this->bvinfo->getPluginsWhitelabelInfos();
245 + foreach ($whitelabel_infos as $slug => $brand) {
246 + if (!isset($slug) || !$this->bvinfo->canWhiteLabel($slug) || !array_key_exists($slug, $plugins) || !is_array($brand)) {
247 + continue;
248 + }
225 249 if (array_key_exists('hide', $brand)) {
226 250 unset($plugins[$slug]);
227 251 } else {
228 252 if (array_key_exists('name', $brand)) {
@@ -250,5 +274,5 @@
250 274 }
251 275 return $plugins;
252 276 }
253 277 }
254 -endif;
278 +endif;