| @@ -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.68'; | |
| 13 | + public $wp_lp_whitelabel_option = 'wprLpWhitelabelConf'; | |
| 14 | + public $version = '6.76'; | |
| 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'; |
| @@ -36,8 +37,16 @@ | ||
| 36 | 37 | } |
| 37 | 38 | return false; |
| 38 | 39 | } |
| 39 | 40 | |
| 41 | + # The server leases capture for a few days at a time; a stale configuration | |
| 42 | + # registers nothing. | |
| 43 | + public function isActivityLogActive() { | |
| 44 | + $config = isset($this->config['activity_log']) ? $this->config['activity_log'] : null; | |
| 45 | + return $this->hasValidDBVersion() && is_array($config) && !empty($config['hooks']) && | |
| 46 | + isset($config['enabled_until']) && is_numeric($config['enabled_until']) && $config['enabled_until'] > time(); | |
| 47 | + } | |
| 48 | + | |
| 40 | 49 | public function hasValidDBVersion() { |
| 41 | 50 | return WPRInfo::DB_VERSION === $this->getCurrentDBVersion(); |
| 42 | 51 | } |
| 43 | 52 | |
| @@ -62,16 +71,17 @@ | ||
| 62 | 71 | require_once dirname( __FILE__ ) . '/recover.php'; |
| 63 | 72 | $bvsiteinfo = new WPRWPSiteInfo(); |
| 64 | 73 | $encoded_url = base64_encode($bvsiteinfo->siteurl()); |
| 65 | 74 | $secret = WPRRecover::defaultSecret($this->settings); |
| 75 | + $tag = WPRRecover::connectionTag($this->settings); | |
| 66 | 76 | |
| 67 | - return base64_encode("v1:".$secret.":".$encoded_url); | |
| 68 | - } | |
| 77 | + #No tag means this site has no salt material in wp-config.php, and there | |
| 78 | + #is no connection key that would be safe to hand out. | |
| 79 | + if (empty($secret) || empty($tag)) { | |
| 80 | + return null; | |
| 81 | + } | |
| 69 | 82 | |
| 70 | - public function getDefaultSecret() { | |
| 71 | - require_once dirname( __FILE__ ) . '/recover.php'; | |
| 72 | - $bvsiteinfo = new WPRWPSiteInfo(); | |
| 73 | - return WPRRecover::defaultSecret($this->settings); | |
| 83 | + return base64_encode("v3:".$secret.":".$encoded_url.":".$this->plugname.":".$tag); | |
| 74 | 84 | } |
| 75 | 85 | |
| 76 | 86 | public function getLatestElementorDBVersion($file) { |
| 77 | 87 | $managerClass = $file === "elementor/elementor.php" ? '\Elementor\Core\Upgrade\Manager' : '\ElementorPro\Core\Upgrade\Manager'; |
| @@ -84,30 +94,16 @@ | ||
| 84 | 94 | return $manager->get_new_version(); |
| 85 | 95 | } |
| 86 | 96 | |
| 87 | 97 | public static function getRequestID() { |
| 88 | - if (!defined("BV_REQUEST_ID")) { | |
| 89 | - define("BV_REQUEST_ID", uniqid(mt_rand())); | |
| 98 | + if (!defined("WPR_REQUEST_ID")) { | |
| 99 | + define("WPR_REQUEST_ID", uniqid(mt_rand())); // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_mt_rand | |
| 90 | 100 | } |
| 91 | - return BV_REQUEST_ID; | |
| 101 | + return WPR_REQUEST_ID; | |
| 92 | 102 | } |
| 93 | 103 | |
| 94 | - public function canSetCWBranding() { | |
| 95 | - if (WPRWPSiteInfo::isCWServer()) { | |
| 96 | - | |
| 97 | - $bot_protect_accounts = WPRAccount::accountsByType($this->settings, 'botprotect'); | |
| 98 | - if (sizeof($bot_protect_accounts) >= 1) | |
| 99 | - return true; | |
| 100 | - | |
| 101 | - $bot_protect_accounts = WPRAccount::accountsByPattern($this->settings, 'email', '/@cw_user\.com$/'); | |
| 102 | - if (sizeof($bot_protect_accounts) >= 1) | |
| 103 | - return true; | |
| 104 | - } | |
| 105 | - | |
| 106 | - return false; | |
| 107 | - } | |
| 108 | - | |
| 109 | 104 | public function canWhiteLabel($slug = NULL) { |
| 105 | + // phpcs:disable WordPress.Security.NonceVerification.Recommended | |
| 110 | 106 | if (array_key_exists("bv_override_global_whitelabel", $_REQUEST)) { |
| 111 | 107 | return false; |
| 112 | 108 | } |
| 113 | 109 | if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) && |
| @@ -113,8 +109,9 @@ | ||
| 113 | 109 | if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) && |
| 114 | 110 | $_REQUEST["bv_override_plugin_whitelabel"] === $slug) { |
| 115 | 111 | return false; |
| 116 | 112 | } |
| 113 | + // phpcs:enable WordPress.Security.NonceVerification.Recommended | |
| 117 | 114 | return true; |
| 118 | 115 | } |
| 119 | 116 | |
| 120 | 117 | public function getPluginWhitelabelInfo($slug = null) { |
| @@ -136,8 +133,13 @@ | ||
| 136 | 133 | $whitelabel_infos = $this->settings->getOption($this->brand_option); |
| 137 | 134 | return is_array($whitelabel_infos) ? $whitelabel_infos : array(); |
| 138 | 135 | } |
| 139 | 136 | |
| 137 | + public function getLPWhitelabelInfo() { | |
| 138 | + $infos = $this->settings->getOption($this->wp_lp_whitelabel_option); | |
| 139 | + return is_array($infos) ? $infos : array(); | |
| 140 | + } | |
| 141 | + | |
| 140 | 142 | public function getPluginsWhitelabelInfoByTitle() { |
| 141 | 143 | $whitelabel_infos = $this->getPluginsWhitelabelInfos(); |
| 142 | 144 | $whitelabel_infos_by_title = array(); |
| 143 | 145 | foreach ($whitelabel_infos as $slug => $whitelabel_info) { |
| @@ -153,9 +155,8 @@ | ||
| 153 | 155 | $brand = $this->getPluginWhitelabelInfo(); |
| 154 | 156 | if (is_array($brand) && array_key_exists('menuname', $brand)) { |
| 155 | 157 | return $brand['menuname']; |
| 156 | 158 | } |
| 157 | - | |
| 158 | 159 | return $this->brandname; |
| 159 | 160 | } |
| 160 | 161 | |
| 161 | 162 | public function getBrandIcon() { |
| @@ -245,5 +246,5 @@ | ||
| 245 | 246 | "plugname" => $this->plugname |
| 246 | 247 | ); |
| 247 | 248 | } |
| 248 | 249 | } |
| 249 | -endif; | |
| 250 | +endif; | |