PluginProbe
The WP Remote WordPress Plugin / 4.78
The WP Remote WordPress Plugin v4.78
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
wpremote / wp_admin.php

wp_admin.php in The WP Remote WordPress Plugin 4.78, at wp_admin.php

215 lines 7.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) exit;
4 if (!class_exists('WPRWPAdmin')) :
5
6 class WPRWPAdmin {
7 public $settings;
8 public $siteinfo;
9 public $bvinfo;
10 public $bvapi;
11
12 function __construct($settings, $siteinfo, $bvapi = null) {
13 $this->settings = $settings;
14 $this->siteinfo = $siteinfo;
15 $this->bvapi = new WPRWPAPI($settings);
16 $this->bvinfo = new WPRInfo($this->settings);
17 }
18
19 public function mainUrl($_params = '') {
20 if (function_exists('network_admin_url')) {
21 return network_admin_url('admin.php?page='.$this->bvinfo->plugname.$_params);
22 } else {
23 return admin_url('admin.php?page='.$this->bvinfo->plugname.$_params);
24 }
25 }
26
27 function removeAdminNotices() {
28 if (array_key_exists('page', $_REQUEST) && $_REQUEST['page'] == $this->bvinfo->plugname) {
29 remove_all_actions('admin_notices');
30 remove_all_actions('all_admin_notices');
31 }
32 }
33
34 public function initHandler() {
35 if (!current_user_can('activate_plugins'))
36 return;
37
38 if (array_key_exists('bvnonce', $_REQUEST) &&
39 wp_verify_nonce($_REQUEST['bvnonce'], "bvnonce") &&
40 array_key_exists('blogvaultkey', $_REQUEST) &&
41 (strlen($_REQUEST['blogvaultkey']) == 64) &&
42 (array_key_exists('page', $_REQUEST) &&
43 $_REQUEST['page'] == $this->bvinfo->plugname)) {
44 $keys = str_split($_REQUEST['blogvaultkey'], 32);
45 WPRAccount::addAccount($this->settings, $keys[0], $keys[1]);
46 if (array_key_exists('redirect', $_REQUEST)) {
47 $location = $_REQUEST['redirect'];
48 wp_redirect($this->bvinfo->appUrl()."/dash/redir?q=".urlencode($location));
49 exit();
50 }
51 }
52 if ($this->bvinfo->isActivateRedirectSet()) {
53 $this->settings->updateOption($this->bvinfo->plug_redirect, 'no');
54 ##ACTIVATEREDIRECTCODE##
55 wp_redirect($this->mainUrl());
56 }
57 }
58
59 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( 'bvsurface', plugins_url('css/bvmui.min.css', __FILE__));
62 wp_enqueue_style( 'bootstrap', plugins_url('css/bootstrap.min.css', __FILE__));
63 wp_enqueue_style( 'bvplugin', plugins_url('css/bvplugin.min.css', __FILE__));
64 }
65 }
66
67 public function menu() {
68 $brand = $this->bvinfo->getBrandInfo();
69 if (!$brand || (!array_key_exists('hide', $brand) && !array_key_exists('hide_from_menu', $brand))) {
70 $bname = $this->bvinfo->getBrandName();
71 $icon = $this->bvinfo->getBrandIcon();
72 add_menu_page($bname, $bname, 'manage_options', $this->bvinfo->plugname,
73 array($this, 'adminPage'), plugins_url($icon, __FILE__ ));
74 }
75 }
76
77 public function hidePluginDetails($plugin_metas, $slug) {
78 $brand = $this->bvinfo->getBrandInfo();
79 $bvslug = $this->bvinfo->slug;
80
81 if ($slug === $bvslug && $brand && array_key_exists('hide_plugin_details', $brand)){
82 foreach ($plugin_metas as $pluginKey => $pluginValue) {
83 if (strpos($pluginValue, sprintf('>%s<', translate('View details')))) {
84 unset($plugin_metas[$pluginKey]);
85 break;
86 }
87 }
88 }
89 return $plugin_metas;
90 }
91
92 public function settingsLink($links, $file) {
93 #XNOTE: Fix this
94 if ( $file == plugin_basename( dirname(__FILE__).'/blogvault.php' ) ) {
95 $brand = $this->bvinfo->getBrandInfo();
96 if (!$brand || !array_key_exists('hide_plugin_details', $brand)) {
97 $links[] = '<a href="'.$this->mainUrl().'">'.__( 'Settings' ).'</a>';
98 }
99 }
100 return $links;
101 }
102
103 public function getPluginLogo() {
104 $brand = $this->bvinfo->getBrandInfo();
105 if ($brand && array_key_exists('logo', $brand)) {
106 return $brand['logo'];
107 }
108 return $this->bvinfo->logo;
109 }
110
111 public function getWebPage() {
112 $brand = $this->bvinfo->getBrandInfo();
113 if ($brand && array_key_exists('webpage', $brand)) {
114 return $brand['webpage'];
115 }
116 return $this->bvinfo->webpage;
117 }
118
119 public function siteInfoTags() {
120 require_once dirname( __FILE__ ) . '/recover.php';
121 $bvnonce = wp_create_nonce("bvnonce");
122 $public = WPRAccount::getApiPublicKey($this->settings);
123 $secret = WPRRecover::defaultSecret($this->settings);
124 $tags = "<input type='hidden' name='url' value='".$this->siteinfo->wpurl()."'/>\n".
125 "<input type='hidden' name='homeurl' value='".$this->siteinfo->homeurl()."'/>\n".
126 "<input type='hidden' name='siteurl' value='".$this->siteinfo->siteurl()."'/>\n".
127 "<input type='hidden' name='dbsig' value='".$this->siteinfo->dbsig(false)."'/>\n".
128 "<input type='hidden' name='plug' value='".$this->bvinfo->plugname."'/>\n".
129 "<input type='hidden' name='adminurl' value='".$this->mainUrl()."'/>\n".
130 "<input type='hidden' name='bvversion' value='".$this->bvinfo->version."'/>\n".
131 "<input type='hidden' name='serverip' value='".$_SERVER["SERVER_ADDR"]."'/>\n".
132 "<input type='hidden' name='abspath' value='".ABSPATH."'/>\n".
133 "<input type='hidden' name='secret' value='".$secret."'/>\n".
134 "<input type='hidden' name='public' value='".$public."'/>\n".
135 "<input type='hidden' name='bvnonce' value='".$bvnonce."'/>\n";
136 return $tags;
137 }
138
139 public function activateWarning() {
140 global $hook_suffix;
141 if (!WPRAccount::isConfigured($this->settings) && $hook_suffix == 'index.php' ) {
142 ?>
143 <div id="message" class="updated" style="padding: 8px; font-size: 16px; background-color: #dff0d8">
144 <a class="button-primary" href="<?php echo $this->mainUrl(); ?>">Activate WPRemote</a>
145 &nbsp;&nbsp;&nbsp;<b>Almost Done:</b> Activate your WPRemote account to backup & secure your site.
146 </div>
147 <?php
148 }
149 }
150
151 public function showAddAccountPage() {
152 require_once dirname( __FILE__ ) . "/admin/add_new_account.php";
153 }
154
155 public function showAccountDetailsPage() {
156 require_once dirname( __FILE__ ) . "/admin/account_details.php";
157 }
158
159 public function adminPage() {
160 if (isset($_REQUEST['bvnonce']) && wp_verify_nonce( $_REQUEST['bvnonce'], 'bvnonce' )) {
161 $info = array();
162 $this->siteinfo->basic($info);
163 $this->bvapi->pingbv('/bvapi/disconnect', $info, $_REQUEST['pubkey']);
164 WPRAccount::remove($this->settings, $_REQUEST['pubkey']);
165 }
166 if (WPRAccount::isConfigured($this->settings)) {
167 if (!isset($_REQUEST['add_account'])) {
168 $this->showAccountDetailsPage();
169 } else {
170 $this->showAddAccountPage();
171 }
172 } else {
173 $this->showAddAccountPage();
174 }
175 }
176
177 public function initBranding($plugins) {
178 $slug = $this->bvinfo->slug;
179
180 if (!is_array($plugins) || !isset($slug, $plugins)) {
181 return $plugins;
182 }
183
184 $brand = $this->bvinfo->getBrandInfo();
185 if ($brand) {
186 if (array_key_exists('hide', $brand)) {
187 unset($plugins[$slug]);
188 } else {
189 if (array_key_exists('name', $brand)) {
190 $plugins[$slug]['Name'] = $brand['name'];
191 }
192 if (array_key_exists('title', $brand)) {
193 $plugins[$slug]['Title'] = $brand['title'];
194 }
195 if (array_key_exists('description', $brand)) {
196 $plugins[$slug]['Description'] = $brand['description'];
197 }
198 if (array_key_exists('authoruri', $brand)) {
199 $plugins[$slug]['AuthorURI'] = $brand['authoruri'];
200 }
201 if (array_key_exists('author', $brand)) {
202 $plugins[$slug]['Author'] = $brand['author'];
203 }
204 if (array_key_exists('authorname', $brand)) {
205 $plugins[$slug]['AuthorName'] = $brand['authorname'];
206 }
207 if (array_key_exists('pluginuri', $brand)) {
208 $plugins[$slug]['PluginURI'] = $brand['pluginuri'];
209 }
210 }
211 }
212 return $plugins;
213 }
214 }
215 endif;