| @@ -9,9 +9,10 @@ | ||
| 9 | 9 | public $brandname = 'WP Remote'; |
| 10 | 10 | public $badgeinfo = 'wprbadge'; |
| 11 | 11 | public $ip_header_option = 'wpripheader'; |
| 12 | 12 | public $brand_option = 'bv_whitelabel_infos'; |
| 13 | - public $version = '5.53'; | |
| 13 | + public $wp_lp_whitelabel_option = 'wprLpWhitelabelConf'; | |
| 14 | + public $version = '6.36'; | |
| 14 | 15 | public $webpage = 'https://wpremote.com'; |
| 15 | 16 | public $appurl = 'https://app.wpremote.com'; |
| 16 | 17 | public $slug = 'wpremote/plugin.php'; |
| 17 | 18 | public $plug_redirect = 'wprredirect'; |
| @@ -20,9 +21,10 @@ | ||
| 20 | 21 | public $services_option_name = 'wprconfig'; |
| 21 | 22 | public $author = 'WP Remote'; |
| 22 | 23 | public $title = 'WP Remote'; |
| 23 | 24 | |
| 24 | - const DB_VERSION = '4'; | |
| 25 | + const DB_VERSION = '5'; | |
| 26 | + const AL_CONF_VERSION = '1.1'; | |
| 25 | 27 | |
| 26 | 28 | public function __construct($settings) { |
| 27 | 29 | $this->settings = $settings; |
| 28 | 30 | $this->config = $this->settings->getOption($this->services_option_name); |
| @@ -59,9 +61,12 @@ | ||
| 59 | 61 | |
| 60 | 62 | public function getConnectionKey() { |
| 61 | 63 | require_once dirname( __FILE__ ) . '/recover.php'; |
| 62 | 64 | $bvsiteinfo = new WPRWPSiteInfo(); |
| 63 | - return base64_encode(WPRRecover::defaultSecret($this->settings).":".$bvsiteinfo->siteurl()); | |
| 65 | + $encoded_url = base64_encode($bvsiteinfo->siteurl()); | |
| 66 | + $secret = WPRRecover::defaultSecret($this->settings); | |
| 67 | + | |
| 68 | + return base64_encode("v2:".$secret.":".$encoded_url.":".$this->plugname); | |
| 64 | 69 | } |
| 65 | 70 | |
| 66 | 71 | public function getDefaultSecret() { |
| 67 | 72 | require_once dirname( __FILE__ ) . '/recover.php'; |
| @@ -81,29 +86,15 @@ | ||
| 81 | 86 | } |
| 82 | 87 | |
| 83 | 88 | public static function getRequestID() { |
| 84 | 89 | if (!defined("BV_REQUEST_ID")) { |
| 85 | - define("BV_REQUEST_ID", uniqid(mt_rand())); | |
| 90 | + define("BV_REQUEST_ID", uniqid(mt_rand())); // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_mt_rand | |
| 86 | 91 | } |
| 87 | 92 | return BV_REQUEST_ID; |
| 88 | 93 | } |
| 89 | 94 | |
| 90 | - public function canSetCWBranding() { | |
| 91 | - if (WPRWPSiteInfo::isCWServer()) { | |
| 92 | - | |
| 93 | - $bot_protect_accounts = WPRAccount::accountsByType($this->settings, 'botprotect'); | |
| 94 | - if (sizeof($bot_protect_accounts) >= 1) | |
| 95 | - return true; | |
| 96 | - | |
| 97 | - $bot_protect_accounts = WPRAccount::accountsByPattern($this->settings, 'email', '/@cw_user\.com$/'); | |
| 98 | - if (sizeof($bot_protect_accounts) >= 1) | |
| 99 | - return true; | |
| 100 | - } | |
| 101 | - | |
| 102 | - return false; | |
| 103 | - } | |
| 104 | - | |
| 105 | 95 | public function canWhiteLabel($slug = NULL) { |
| 96 | + // phpcs:disable WordPress.Security.NonceVerification.Recommended | |
| 106 | 97 | if (array_key_exists("bv_override_global_whitelabel", $_REQUEST)) { |
| 107 | 98 | return false; |
| 108 | 99 | } |
| 109 | 100 | if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) && |
| @@ -109,8 +100,9 @@ | ||
| 109 | 100 | if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) && |
| 110 | 101 | $_REQUEST["bv_override_plugin_whitelabel"] === $slug) { |
| 111 | 102 | return false; |
| 112 | 103 | } |
| 104 | + // phpcs:enable WordPress.Security.NonceVerification.Recommended | |
| 113 | 105 | return true; |
| 114 | 106 | } |
| 115 | 107 | |
| 116 | 108 | public function getPluginWhitelabelInfo($slug = null) { |
| @@ -132,8 +124,13 @@ | ||
| 132 | 124 | $whitelabel_infos = $this->settings->getOption($this->brand_option); |
| 133 | 125 | return is_array($whitelabel_infos) ? $whitelabel_infos : array(); |
| 134 | 126 | } |
| 135 | 127 | |
| 128 | + public function getLPWhitelabelInfo() { | |
| 129 | + $infos = $this->settings->getOption($this->wp_lp_whitelabel_option); | |
| 130 | + return is_array($infos) ? $infos : array(); | |
| 131 | + } | |
| 132 | + | |
| 136 | 133 | public function getPluginsWhitelabelInfoByTitle() { |
| 137 | 134 | $whitelabel_infos = $this->getPluginsWhitelabelInfos(); |
| 138 | 135 | $whitelabel_infos_by_title = array(); |
| 139 | 136 | foreach ($whitelabel_infos as $slug => $whitelabel_info) { |
| @@ -149,9 +146,8 @@ | ||
| 149 | 146 | $brand = $this->getPluginWhitelabelInfo(); |
| 150 | 147 | if (is_array($brand) && array_key_exists('menuname', $brand)) { |
| 151 | 148 | return $brand['menuname']; |
| 152 | 149 | } |
| 153 | - | |
| 154 | 150 | return $this->brandname; |
| 155 | 151 | } |
| 156 | 152 | |
| 157 | 153 | public function getBrandIcon() { |