| @@ -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.56'; | |
| 13 | + public $wp_lp_whitelabel_option = 'wprLpWhitelabelConf'; | |
| 14 | + public $version = '6.72'; | |
| 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,15 +61,19 @@ | ||
| 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()); | |
| 64 | - } | |
| 65 | + $encoded_url = base64_encode($bvsiteinfo->siteurl()); | |
| 66 | + $secret = WPRRecover::defaultSecret($this->settings); | |
| 67 | + $tag = WPRRecover::connectionTag($this->settings); | |
| 65 | 68 | |
| 66 | - public function getDefaultSecret() { | |
| 67 | - require_once dirname( __FILE__ ) . '/recover.php'; | |
| 68 | - $bvsiteinfo = new WPRWPSiteInfo(); | |
| 69 | - return WPRRecover::defaultSecret($this->settings); | |
| 69 | + #No tag means this site has no salt material in wp-config.php, and there | |
| 70 | + #is no connection key that would be safe to hand out. | |
| 71 | + if (empty($secret) || empty($tag)) { | |
| 72 | + return null; | |
| 73 | + } | |
| 74 | + | |
| 75 | + return base64_encode("v3:".$secret.":".$encoded_url.":".$this->plugname.":".$tag); | |
| 70 | 76 | } |
| 71 | 77 | |
| 72 | 78 | public function getLatestElementorDBVersion($file) { |
| 73 | 79 | $managerClass = $file === "elementor/elementor.php" ? '\Elementor\Core\Upgrade\Manager' : '\ElementorPro\Core\Upgrade\Manager'; |
| @@ -80,30 +86,16 @@ | ||
| 80 | 86 | return $manager->get_new_version(); |
| 81 | 87 | } |
| 82 | 88 | |
| 83 | 89 | public static function getRequestID() { |
| 84 | - if (!defined("BV_REQUEST_ID")) { | |
| 85 | - define("BV_REQUEST_ID", uniqid(mt_rand())); | |
| 90 | + if (!defined("WPR_REQUEST_ID")) { | |
| 91 | + define("WPR_REQUEST_ID", uniqid(mt_rand())); // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_mt_rand | |
| 86 | 92 | } |
| 87 | - return BV_REQUEST_ID; | |
| 93 | + return WPR_REQUEST_ID; | |
| 88 | 94 | } |
| 89 | 95 | |
| 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 | 96 | public function canWhiteLabel($slug = NULL) { |
| 97 | + // phpcs:disable WordPress.Security.NonceVerification.Recommended | |
| 106 | 98 | if (array_key_exists("bv_override_global_whitelabel", $_REQUEST)) { |
| 107 | 99 | return false; |
| 108 | 100 | } |
| 109 | 101 | if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) && |
| @@ -109,8 +101,9 @@ | ||
| 109 | 101 | if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) && |
| 110 | 102 | $_REQUEST["bv_override_plugin_whitelabel"] === $slug) { |
| 111 | 103 | return false; |
| 112 | 104 | } |
| 105 | + // phpcs:enable WordPress.Security.NonceVerification.Recommended | |
| 113 | 106 | return true; |
| 114 | 107 | } |
| 115 | 108 | |
| 116 | 109 | public function getPluginWhitelabelInfo($slug = null) { |
| @@ -132,8 +125,13 @@ | ||
| 132 | 125 | $whitelabel_infos = $this->settings->getOption($this->brand_option); |
| 133 | 126 | return is_array($whitelabel_infos) ? $whitelabel_infos : array(); |
| 134 | 127 | } |
| 135 | 128 | |
| 129 | + public function getLPWhitelabelInfo() { | |
| 130 | + $infos = $this->settings->getOption($this->wp_lp_whitelabel_option); | |
| 131 | + return is_array($infos) ? $infos : array(); | |
| 132 | + } | |
| 133 | + | |
| 136 | 134 | public function getPluginsWhitelabelInfoByTitle() { |
| 137 | 135 | $whitelabel_infos = $this->getPluginsWhitelabelInfos(); |
| 138 | 136 | $whitelabel_infos_by_title = array(); |
| 139 | 137 | foreach ($whitelabel_infos as $slug => $whitelabel_info) { |
| @@ -149,9 +147,8 @@ | ||
| 149 | 147 | $brand = $this->getPluginWhitelabelInfo(); |
| 150 | 148 | if (is_array($brand) && array_key_exists('menuname', $brand)) { |
| 151 | 149 | return $brand['menuname']; |
| 152 | 150 | } |
| 153 | - | |
| 154 | 151 | return $this->brandname; |
| 155 | 152 | } |
| 156 | 153 | |
| 157 | 154 | public function getBrandIcon() { |