| @@ -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.45'; | |
| 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); |
| @@ -56,49 +58,43 @@ | ||
| 56 | 58 | |
| 57 | 59 | return false; |
| 58 | 60 | } |
| 59 | 61 | |
| 60 | - public function getLatestElementorDBVersion($file) { | |
| 61 | - if (defined('ELEMENTOR_PATH') && file_exists(ELEMENTOR_PATH . 'core/upgrade/manager.php')) { | |
| 62 | - include_once ELEMENTOR_PATH . 'core/upgrade/manager.php'; | |
| 62 | + public function getConnectionKey() { | |
| 63 | + require_once dirname( __FILE__ ) . '/recover.php'; | |
| 64 | + $bvsiteinfo = new WPRWPSiteInfo(); | |
| 65 | + $encoded_url = base64_encode($bvsiteinfo->siteurl()); | |
| 66 | + $secret = WPRRecover::defaultSecret($this->settings); | |
| 63 | 67 | |
| 64 | - if ($file === 'elementor-pro/elementor-pro.php') { | |
| 65 | - $managerClass = '\ElementorPro\Core\Upgrade\Manager'; | |
| 66 | - } else { | |
| 67 | - $managerClass = '\Elementor\Core\Upgrade\Manager'; | |
| 68 | - } | |
| 68 | + return base64_encode("v2:".$secret.":".$encoded_url.":".$this->plugname); | |
| 69 | + } | |
| 69 | 70 | |
| 70 | - $manager = new $managerClass(); | |
| 71 | + public function getDefaultSecret() { | |
| 72 | + require_once dirname( __FILE__ ) . '/recover.php'; | |
| 73 | + $bvsiteinfo = new WPRWPSiteInfo(); | |
| 74 | + return WPRRecover::defaultSecret($this->settings); | |
| 75 | + } | |
| 71 | 76 | |
| 72 | - return $manager->get_new_version(); | |
| 77 | + public function getLatestElementorDBVersion($file) { | |
| 78 | + $managerClass = $file === "elementor/elementor.php" ? '\Elementor\Core\Upgrade\Manager' : '\ElementorPro\Core\Upgrade\Manager'; | |
| 79 | + | |
| 80 | + if (!class_exists($managerClass)) { | |
| 81 | + return false; | |
| 73 | 82 | } |
| 74 | 83 | |
| 75 | - return false; | |
| 84 | + $manager = new $managerClass(); | |
| 85 | + return $manager->get_new_version(); | |
| 76 | 86 | } |
| 77 | 87 | |
| 78 | 88 | public static function getRequestID() { |
| 79 | 89 | if (!defined("BV_REQUEST_ID")) { |
| 80 | - define("BV_REQUEST_ID", uniqid(mt_rand())); | |
| 90 | + define("BV_REQUEST_ID", uniqid(mt_rand())); // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_mt_rand | |
| 81 | 91 | } |
| 82 | 92 | return BV_REQUEST_ID; |
| 83 | 93 | } |
| 84 | 94 | |
| 85 | - public function canSetCWBranding() { | |
| 86 | - if (WPRWPSiteInfo::isCWServer()) { | |
| 87 | - | |
| 88 | - $bot_protect_accounts = WPRAccount::accountsByType($this->settings, 'botprotect'); | |
| 89 | - if (sizeof($bot_protect_accounts) >= 1) | |
| 90 | - return true; | |
| 91 | - | |
| 92 | - $bot_protect_accounts = WPRAccount::accountsByPattern($this->settings, 'email', '/@cw_user\.com$/'); | |
| 93 | - if (sizeof($bot_protect_accounts) >= 1) | |
| 94 | - return true; | |
| 95 | - } | |
| 96 | - | |
| 97 | - return false; | |
| 98 | - } | |
| 99 | - | |
| 100 | 95 | public function canWhiteLabel($slug = NULL) { |
| 96 | + // phpcs:disable WordPress.Security.NonceVerification.Recommended | |
| 101 | 97 | if (array_key_exists("bv_override_global_whitelabel", $_REQUEST)) { |
| 102 | 98 | return false; |
| 103 | 99 | } |
| 104 | 100 | if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) && |
| @@ -104,8 +100,9 @@ | ||
| 104 | 100 | if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) && |
| 105 | 101 | $_REQUEST["bv_override_plugin_whitelabel"] === $slug) { |
| 106 | 102 | return false; |
| 107 | 103 | } |
| 104 | + // phpcs:enable WordPress.Security.NonceVerification.Recommended | |
| 108 | 105 | return true; |
| 109 | 106 | } |
| 110 | 107 | |
| 111 | 108 | public function getPluginWhitelabelInfo($slug = null) { |
| @@ -127,8 +124,13 @@ | ||
| 127 | 124 | $whitelabel_infos = $this->settings->getOption($this->brand_option); |
| 128 | 125 | return is_array($whitelabel_infos) ? $whitelabel_infos : array(); |
| 129 | 126 | } |
| 130 | 127 | |
| 128 | + public function getLPWhitelabelInfo() { | |
| 129 | + $infos = $this->settings->getOption($this->wp_lp_whitelabel_option); | |
| 130 | + return is_array($infos) ? $infos : array(); | |
| 131 | + } | |
| 132 | + | |
| 131 | 133 | public function getPluginsWhitelabelInfoByTitle() { |
| 132 | 134 | $whitelabel_infos = $this->getPluginsWhitelabelInfos(); |
| 133 | 135 | $whitelabel_infos_by_title = array(); |
| 134 | 136 | foreach ($whitelabel_infos as $slug => $whitelabel_info) { |
| @@ -144,9 +146,8 @@ | ||
| 144 | 146 | $brand = $this->getPluginWhitelabelInfo(); |
| 145 | 147 | if (is_array($brand) && array_key_exists('menuname', $brand)) { |
| 146 | 148 | return $brand['menuname']; |
| 147 | 149 | } |
| 148 | - | |
| 149 | 150 | return $this->brandname; |
| 150 | 151 | } |
| 151 | 152 | |
| 152 | 153 | public function getBrandIcon() { |