Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/bp-better-messages/addons/buddyboss.php
+++ b/bp-better-messages/addons/buddyboss.php
@@ -67,6 +67,7 @@
if( ! is_admin() ){
add_filter( 'bp_disable_group_messages', '__return_false' );
}
+
/**
* BuddyBoss Pushs
*/
@@ -106,7 +107,7 @@
$url = Better_Messages()->url . "addons/onesignal/sub-update{$suffix}.js";
- echo '<script src="' . $url . '?ver=0.1"></script>';
+ echo '<script src="' . $url . '?ver=0.2"></script>';
}
public function update_subscription( WP_REST_Request $request )
@@ -299,7 +300,7 @@
$online = [];
- if( Better_Messages()->websocket ) {
+ if( Better_Messages()->websocket && apply_filters('better_messages_bb_app_push_only_online', true) ) {
$online = Better_Messages()->websocket->get_online_users();
}
--- a/bp-better-messages/addons/files.php
+++ b/bp-better-messages/addons/files.php
@@ -34,6 +34,8 @@
add_action( 'better_messages_register_script_dependencies', array($this, 'load_scripts'), 10, 1);
add_filter( 'bp_better_messages_script_variable', array( $this, 'attachments_script_vars' ), 10, 1 );
}
+
+ add_action( 'bp_better_chat_settings_updated', array($this, 'create_index_file') );
}
public $scripts_loaded = false;
@@ -402,6 +404,22 @@
exit;
}
+ public function create_index_file()
+ {
+ try {
+ add_filter('upload_dir', array( $this, 'upload_dir'));
+ $upload_dir = wp_upload_dir();
+ $path = trailingslashit($upload_dir['path']);
+ $index = $path . 'index.php';
+
+ if ( ! file_exists($index) ) {
+ file_put_contents($index, "<?phpn // Silence is golden.");
+ }
+ } finally {
+ remove_filter('upload_dir', array( $this, 'upload_dir'));
+ }
+ }
+
public function upload_dir($dir){
$dirName = apply_filters('bp_better_messages_upload_dir_name', 'bp-better-messages');
@@ -471,9 +489,7 @@
$name = wp_basename($file['name']);
- if( Better_Messages()->settings['attachmentsRandomName'] === '1'){
- $_FILES['file']['name'] = Better_Messages()->functions->random_string(20) . '.' . $extension;
- }
+ $_FILES['file']['name'] = Better_Messages()->functions->random_string(20) . '.' . $extension;
if( ! in_array( strtolower($extension), $extensions ) ){
return new WP_Error(
--- a/bp-better-messages/addons/gamipress.php
+++ b/bp-better-messages/addons/gamipress.php
@@ -24,7 +24,7 @@
add_action( 'bp_better_messages_new_thread_created', array( $this, 'core_charge_new_thread_created'), 10, 2 );
add_action( 'better_messages_before_new_thread', array( $this, 'core_charge_for_new_thread' ), 10, 2 );
- add_filter( 'better_messages_private_call_allowed_error', array( $this, 'is_call_allowed' ), 10, 4 );
+ add_filter( 'better_messages_call_create_custom_error', array( $this, 'is_call_allowed' ), 10, 4 );
add_action( 'better_messages_register_call_usage', array( $this, 'call_usage_charge' ), 10, 3 );
}
--- a/bp-better-messages/addons/mycred.php
+++ b/bp-better-messages/addons/mycred.php
@@ -24,7 +24,7 @@
add_action( 'bp_better_messages_new_thread_created', array( $this, 'mycred_core_charge_new_thread_created'), 10, 2 );
add_action( 'better_messages_before_new_thread', array( $this, 'mycred_core_charge_for_new_thread' ), 10, 2 );
- add_filter( 'better_messages_private_call_allowed_error', array( $this, 'is_call_allowed' ), 10, 4 );
+ add_filter( 'better_messages_call_create_custom_error', array( $this, 'is_call_allowed' ), 10, 4 );
add_action( 'better_messages_register_call_usage', array( $this, 'call_usage_charge' ), 10, 3 );
}
--- a/bp-better-messages/addons/onesignal.php
+++ b/bp-better-messages/addons/onesignal.php
@@ -40,7 +40,7 @@
$url = Better_Messages()->url . "addons/onesignal/sub-update{$suffix}.js";
- echo '<script src="' . $url . '?ver=0.1"></script>';
+ echo '<script src="' . $url . '?ver=0.2"></script>';
}
public function rest_api_init()
@@ -54,52 +54,94 @@
public function update_subscription( WP_REST_Request $request )
{
- if( ! class_exists('OneSignal') ) return false;
-
$user_id = Better_Messages()->functions->get_current_user_id();
- if( $user_id <= 0 ){
- return new WP_Error( 'onesignal_error', 'User ID is required', array( 'status' => 400 ) );
+ if ($user_id <= 0) {
+ return new WP_Error('onesignal_error', 'User ID is required', array('status' => 400));
}
- $onesignal_wp_settings = OneSignal::get_onesignal_settings();
- $onesignal_app_id = $onesignal_wp_settings['app_id'];
- $onesignal_auth_key = $onesignal_wp_settings['app_rest_api_key'];
-
- $subscription_id = (string) $request->get_param( 'subscription_id');
-
- if( ! $subscription_id ){
- return new WP_Error( 'onesignal_error', 'Subscription ID is required', array( 'status' => 400 ) );
+ if (class_exists('OneSignal')) {
+ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
+ $onesignal_app_id = $onesignal_wp_settings['app_id'];
+ $onesignal_auth_key = $onesignal_wp_settings['app_rest_api_key'];
+
+ $subscription_id = (string) $request->get_param('subscription_id');
+
+ if ( ! $subscription_id ) {
+ return new WP_Error('onesignal_error', 'Subscription ID is required', array('status' => 400));
+ }
+
+ $onesignal_post_url = "https://api.onesignal.com/apps/{$onesignal_app_id}/subscriptions/{$subscription_id}/user/identity";
+
+ $fields = [
+ 'identity' => [
+ 'external_id' => (string)$user_id
+ ]
+ ];
+
+ $request = array(
+ 'method' => 'PATCH',
+ 'headers' => array(
+ 'content-type' => 'application/json;charset=utf-8',
+ 'Authorization' => 'Basic ' . $onesignal_auth_key,
+ ),
+ 'body' => wp_json_encode($fields),
+ 'timeout' => 3,
+ );
+
+ $response = wp_remote_request($onesignal_post_url, $request);
+
+ if (is_wp_error($response)) {
+ return new WP_Error('onesignal_error', $response->get_error_message(), array('status' => 500));
+ }
+
+ return [
+ 'user_id' => $user_id,
+ 'subscription_id' => $subscription_id,
+ ];
}
- $onesignal_post_url = "https://api.onesignal.com/apps/{$onesignal_app_id}/subscriptions/{$subscription_id}/user/identity";
-
- $fields = [
- 'identity' => [
- 'external_id' => (string) $user_id
- ]
- ];
-
- $request = array(
- 'method' => 'PATCH',
- 'headers' => array(
- 'content-type' => 'application/json;charset=utf-8',
- 'Authorization' => 'Basic ' . $onesignal_auth_key,
- ),
- 'body' => wp_json_encode($fields),
- 'timeout' => 3,
- );
-
- $response = wp_remote_request($onesignal_post_url, $request);
-
- if( is_wp_error($response) ){
- return new WP_Error( 'onesignal_error', $response->get_error_message(), array( 'status' => 500 ) );
+ if( defined('ONESIGNAL_VERSION_V3' ) ) {
+ $apiKey = get_option('OneSignalWPSetting')['app_rest_api_key'] ?? '';
+ if( $apiKey === '' ) return false;
+ $onesignal_app_id = get_option('OneSignalWPSetting')['app_id'];
+ $subscription_id = (string) $request->get_param('subscription_id');
+
+ if ( ! $subscription_id ) {
+ return new WP_Error('onesignal_error', 'Subscription ID is required', array('status' => 400));
+ }
+
+ $onesignal_post_url = "https://api.onesignal.com/apps/{$onesignal_app_id}/subscriptions/{$subscription_id}/user/identity";
+
+ $fields = [
+ 'identity' => [
+ 'external_id' => (string)$user_id
+ ]
+ ];
+
+ $request = array(
+ 'method' => 'PATCH',
+ 'headers' => array(
+ 'content-type' => 'application/json;charset=utf-8',
+ 'Authorization' => 'Key ' . $apiKey,
+ ),
+ 'body' => wp_json_encode($fields),
+ 'timeout' => 3,
+ );
+
+ $response = wp_remote_request($onesignal_post_url, $request);
+
+ if ( is_wp_error( $response ) ) {
+ return new WP_Error('onesignal_error', $response->get_error_message(), array('status' => 500));
+ }
+
+ return [
+ 'user_id' => $user_id,
+ 'subscription_id' => $subscription_id,
+ ];
}
- return [
- 'user_id' => $user_id,
- 'subscription_id' => $subscription_id,
- ];
+ return false;
}
public function add_onesignal_script_variable( $script_variable ){
@@ -112,59 +154,106 @@
public function send_bulk_pushs( $pushs, $all_recipients, $notification, $message )
{
- if( ! class_exists('OneSignal_Admin') || ! class_exists('OneSignal') ) return $pushs;
+ if( class_exists('OneSignal_Admin') && class_exists('OneSignal') ) {
- $onesignal_wp_settings = OneSignal::get_onesignal_settings();
+ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
- if( $onesignal_wp_settings['app_id'] === '' || $onesignal_wp_settings['app_rest_api_key'] === '' ) return $pushs;
+ if ($onesignal_wp_settings['app_id'] === '' || $onesignal_wp_settings['app_rest_api_key'] === '') return $pushs;
- $image = $notification['icon'];
+ $image = $notification['icon'];
- $fields = array(
- 'app_id' => $onesignal_wp_settings['app_id'],
- 'chrome_web_icon' => $image,
- 'chrome_web_badge' => $image,
- 'firefox_icon' => $image,
- 'headings' => [ 'en' => stripslashes_deep(wp_specialchars_decode($notification['title'])) ],
- 'url' => $notification['data']['url'],
- 'contents' => [ 'en' => stripslashes_deep(wp_specialchars_decode($notification['body'])) ],
- );
-
- $pushs = [
- 'onesignal_api_key' => $onesignal_wp_settings['app_rest_api_key'],
- 'user_ids' => array_map('strval', $all_recipients),
- 'fields' => $fields
- ];
+ $fields = array(
+ 'app_id' => $onesignal_wp_settings['app_id'],
+ 'chrome_web_icon' => $image,
+ 'chrome_web_badge' => $image,
+ 'firefox_icon' => $image,
+ 'headings' => ['en' => stripslashes_deep(wp_specialchars_decode($notification['title']))],
+ 'url' => $notification['data']['url'],
+ 'contents' => ['en' => stripslashes_deep(wp_specialchars_decode($notification['body']))],
+ );
+
+ $pushs = [
+ 'onesignal_api_key' => $onesignal_wp_settings['app_rest_api_key'],
+ 'user_ids' => array_map('strval', $all_recipients),
+ 'fields' => $fields
+ ];
+ } else if( defined('ONESIGNAL_VERSION_V3' ) ){
+ $apiKey = get_option('OneSignalWPSetting')['app_rest_api_key'] ?? '';
+ if( $apiKey === '' ) return $pushs;
+
+ $image = $notification['icon'];
+
+ $fields = array(
+ 'app_id' => get_option('OneSignalWPSetting')['app_id'],
+ 'chrome_web_icon' => $image,
+ 'chrome_web_badge' => $image,
+ 'firefox_icon' => $image,
+ 'headings' => ['en' => stripslashes_deep(wp_specialchars_decode($notification['title']))],
+ 'url' => $notification['data']['url'],
+ 'contents' => ['en' => stripslashes_deep(wp_specialchars_decode($notification['body']))],
+ );
+
+ $pushs = [
+ 'onesignal_api_key' => $apiKey,
+ 'user_ids' => array_map('strval', $all_recipients),
+ 'fields' => $fields
+ ];
+ }
return $pushs;
}
public function send_pushs( $result, $user_id, $notification, $type, $thread_id, $message_id, $sender_id ){
- if( ! class_exists('OneSignal_Admin') || ! class_exists('OneSignal') ) return $result;
+ if( class_exists('OneSignal_Admin') && class_exists('OneSignal') ) {
+
+ $onesignal_wp_settings = OneSignal::get_onesignal_settings();
- $onesignal_wp_settings = OneSignal::get_onesignal_settings();
+ if ($onesignal_wp_settings['app_id'] === '' || $onesignal_wp_settings['app_rest_api_key'] === '') return $result;
+
+ $onesignal_auth_key = $onesignal_wp_settings['app_rest_api_key'];
+
+ $image = $notification['icon'];
+
+ $fields = array(
+ 'app_id' => $onesignal_wp_settings['app_id'],
+ 'chrome_web_icon' => $image,
+ 'chrome_web_badge' => $image,
+ 'firefox_icon' => $image,
+ 'headings' => ['en' => stripslashes_deep(wp_specialchars_decode($notification['title']))],
+ 'url' => $notification['data']['url'],
+ 'contents' => ['en' => stripslashes_deep(wp_specialchars_decode($notification['body']))],
+ );
+
+ return [
+ 'onesignal_api_key' => $onesignal_auth_key,
+ 'user_ids' => array_map('strval', [$user_id]),
+ 'fields' => $fields
+ ];
+ } else if( defined('ONESIGNAL_VERSION_V3' ) ){
+ $apiKey = get_option('OneSignalWPSetting')['app_rest_api_key'] ?? '';
+
+ if( $apiKey === '' ) return $result;
+
+ $image = $notification['icon'];
+
+ $fields = array(
+ 'app_id' => get_option('OneSignalWPSetting')['app_id'],
+ 'chrome_web_icon' => $image,
+ 'chrome_web_badge' => $image,
+ 'firefox_icon' => $image,
+ 'headings' => ['en' => stripslashes_deep(wp_specialchars_decode($notification['title']))],
+ 'url' => $notification['data']['url'],
+ 'contents' => ['en' => stripslashes_deep(wp_specialchars_decode($notification['body']))],
+ );
+
+ return [
+ 'onesignal_api_key' => $apiKey,
+ 'user_ids' => array_map('strval', [$user_id]),
+ 'fields' => $fields
+ ];
+ }
- if( $onesignal_wp_settings['app_id'] === '' || $onesignal_wp_settings['app_rest_api_key'] === '' ) return $result;
-
- $onesignal_auth_key = $onesignal_wp_settings['app_rest_api_key'];
-
- $image = $notification['icon'];
-
- $fields = array(
- 'app_id' => $onesignal_wp_settings['app_id'],
- 'chrome_web_icon' => $image,
- 'chrome_web_badge' => $image,
- 'firefox_icon' => $image,
- 'headings' => [ 'en' => stripslashes_deep(wp_specialchars_decode($notification['title'])) ],
- 'url' => $notification['data']['url'],
- 'contents' => [ 'en' => stripslashes_deep(wp_specialchars_decode($notification['body'])) ],
- );
-
- return [
- 'onesignal_api_key' => $onesignal_auth_key,
- 'user_ids' => array_map('strval', [ $user_id ]),
- 'fields' => $fields
- ];
+ return $result;
}
public function push_message_in_settings( $message ){
--- a/bp-better-messages/addons/urls.php
+++ b/bp-better-messages/addons/urls.php
@@ -55,7 +55,11 @@
$blacklist = [
'127.0.0.1',
'localhost',
- '::1'
+ '::1',
+ '0.0.0.0',
+ '10.0.0.0/8',
+ '172.16.0.0/12',
+ '192.168.0.0/16'
];
if( in_array( $parts['host'], $blacklist ) ){
@@ -63,7 +67,16 @@
}
if (filter_var($parts['host'], FILTER_VALIDATE_IP)) {
- return false;
+ foreach ($blacklist as $blocked) {
+ if (strpos($blocked, '/') !== false) {
+ list($subnet, $mask) = explode('/', $blocked);
+ if ((ip2long($parts['host']) & ~((1 << (32 - $mask)) - 1)) == ip2long($subnet)) {
+ return false;
+ }
+ } else if ($parts['host'] === $blocked) {
+ return false;
+ }
+ }
}
return true;
--- a/bp-better-messages/bp-better-messages.php
+++ b/bp-better-messages/bp-better-messages.php
@@ -5,7 +5,7 @@
Plugin Name: Better Messages
Plugin URI: https://www.wordplus.org
Description: Realtime private messaging system for WordPress
- Version: 2.6.7
+ Version: 2.7.0
Author: WordPlus
Author URI: https://www.wordplus.org
Requires PHP: 7.1
@@ -16,7 +16,7 @@
defined( 'ABSPATH' ) || exit;
if ( !class_exists( 'Better_Messages' ) && !function_exists( 'bpbm_fs' ) ) {
class Better_Messages {
- public $version = '2.6.7';
+ public $version = '2.7.0';
public $db_version = '1.0.4';
@@ -471,6 +471,7 @@
$script_variables = array(
'hash' => md5( $hash ),
'user_id' => get_current_user_id(),
+ 'version' => $this->version,
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'restUrl' => esc_url_raw( get_rest_url( null, '/better-messages/v1/' ) ),
'nonce' => wp_create_nonce( 'wp_rest' ),
@@ -537,7 +538,6 @@
'listStatus' => ( $this->realtime && $this->settings['messagesStatusList'] ? '1' : '0' ),
'statusDetails' => ( $this->realtime && $this->settings['messagesStatusDetailed'] ? '1' : '0' ),
'combinedView' => ( $this->settings['combinedView'] == '1' ? '1' : '0' ),
- 'offlineCalls' => ( $this->settings['offlineCallsAllowed'] == '1' ? '1' : '0' ),
'onSiteNotification' => ( $this->settings['disableOnSiteNotification'] == '1' ? '0' : '1' ),
'onsitePosition' => ( $this->settings['onsitePosition'] === 'right' ? 'right' : 'left' ),
'titleNotifications' => ( $this->settings['titleNotifications'] == '1' ? '1' : '0' ),
--- a/bp-better-messages/inc/api/db-migrate.php
+++ b/bp-better-messages/inc/api/db-migrate.php
@@ -4,7 +4,7 @@
class Better_Messages_Rest_Api_DB_Migrate
{
- private $db_version = 1.3;
+ private $db_version = 1.4;
public static function instance()
{
@@ -518,6 +518,13 @@
],
'1.3' => [
"ALTER TABLE `" . bm_get_table('recipients') ."` ADD INDEX `unread_count_index` (`user_id`, `is_deleted`, `unread_count`);"
+ ],
+ '1.4' => [
+ function (){
+ if( Better_Messages()->files ) {
+ Better_Messages_Files()->create_index_file();
+ }
+ }
]
];
--- a/bp-better-messages/inc/functions.php
+++ b/bp-better-messages/inc/functions.php
@@ -1865,7 +1865,6 @@
$item['canVideo'] = (int) $this->video_calls_active() && $item['isFriend'];
$item['canAudio'] = (int) $this->audio_calls_active() && $item['isFriend'];
}
- // if( Better_Messages()->settings['callsLimitFriends'] === '1' )
}
return apply_filters( 'better_messages_rest_user_item', $item, $user_id, $include_personal );
@@ -3395,7 +3394,7 @@
public function get_user_roles( $user_id ){
if( $user_id > 0 ){
- $user = get_userdata( $user_id );
+ $user = get_userdata( $user_id );
if( ! $user ){
return [];
@@ -3516,6 +3515,10 @@
return wp_kses( $content, $messages_allowedtags );
}
+
+ function current_time( $gmt = true, $type = 'mysql' ) {
+ return current_time( $type, $gmt );
+ }
}
endif;
--- a/bp-better-messages/inc/guests.php
+++ b/bp-better-messages/inc/guests.php
@@ -235,10 +235,10 @@
return $item;
}
- $item['canBlock'] = false;
- $item['canVideo'] = false;
- $item['canAudio'] = false;
- $item['verified'] = false;
+ $item['canBlock'] = 0;
+ $item['canVideo'] = 0;
+ $item['canAudio'] = 0;
+ $item['verified'] = 0;
$item['avatar'] = Better_Messages()->url . 'assets/images/avatar.png';
@@ -248,7 +248,7 @@
$item['name'] = $guest_user->name;
if( ! empty( $guest_user->ip ) && str_starts_with($guest_user->ip, 'ai-chat-bot-') ){
- $item['is_bot'] = true;
+ $item['is_bot'] = 1;
$bot_id = str_replace('ai-chat-bot-', '', $guest_user->ip);
if( has_post_thumbnail( $bot_id ) ) {
@@ -484,11 +484,13 @@
public function get_client_ip(){
$ip = '';
- if ( isset($_SERVER['HTTP_CLIENT_IP']) && ! empty($_SERVER['HTTP_CLIENT_IP'])) {
+ if ( isset($_SERVER['HTTP_X_REAL_IP']) && ! empty($_SERVER['HTTP_X_REAL_IP']) && ! str_contains($_SERVER['HTTP_X_REAL_IP'], ',') ) {
+ $ip = $_SERVER['HTTP_X_REAL_IP'];
+ } else if ( isset($_SERVER['HTTP_CLIENT_IP']) && ! empty($_SERVER['HTTP_CLIENT_IP']) && ! str_contains($_SERVER['HTTP_CLIENT_IP'], ',')) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
- } elseif ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && ! empty($_SERVER['HTTP_X_FORWARDED_FOR'] )) {
+ } elseif ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && ! empty($_SERVER['HTTP_X_FORWARDED_FOR'] ) && ! str_contains($_SERVER['HTTP_X_FORWARDED_FOR'], ',') ) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
- } else if( isset($_SERVER['REMOTE_ADDR']) && ! empty($_SERVER['REMOTE_ADDR'] ) ){
+ } else if( isset($_SERVER['REMOTE_ADDR']) && ! empty($_SERVER['REMOTE_ADDR'] ) && ! str_contains($_SERVER['REMOTE_ADDR'], ',') ){
$ip = $_SERVER['REMOTE_ADDR'];
}
--- a/bp-better-messages/inc/moderation.php
+++ b/bp-better-messages/inc/moderation.php
@@ -323,6 +323,8 @@
wp_cache_set( $key, $result, 'bm_messages' );
+ if( empty( $result ) ) return (object) [];
+
return $result;
}
--- a/bp-better-messages/inc/notifications.php
+++ b/bp-better-messages/inc/notifications.php
@@ -90,7 +90,7 @@
{
$notifications_interval = (int) Better_Messages()->settings['notificationsInterval'];
if( $notifications_interval > 0 ) {
- if (! wp_next_scheduled('bp_better_messages_send_notifications')) {
+ if ( ! wp_next_scheduled('bp_better_messages_send_notifications') ) {
wp_schedule_event(time(), 'bp_better_messages_notifications', 'bp_better_messages_send_notifications');
}
} else {
--- a/bp-better-messages/inc/options.php
+++ b/bp-better-messages/inc/options.php
@@ -31,7 +31,6 @@
'attachmentsRetention' => 365,
'attachmentsEnable' => '0',
'attachmentsHide' => '1',
- 'attachmentsRandomName' => '1',
'attachmentsMaxSize' => wp_max_upload_size() / 1024 / 1024,
'attachmentsMaxNumber' => 0,
'miniChatsEnable' => '0',
@@ -88,7 +87,6 @@
'allowMuteThreads' => '1',
'callsRevertIcons' => '0',
'callRequestTimeLimit' => '30',
- 'offlineCallsNotifications' => '0',
'callsLimitFriends' => '0',
'stopBPNotifications' => '0',
'restrictThreadsDeleting' => '0',
@@ -183,7 +181,6 @@
'restrictBlockUsers' => [],
'restrictBlockUsersImmun' => [],
'messagesViewer' => '1',
- 'offlineCallsAllowed' => '0',
'enableReactions' => '1',
'enableReactionsPopup' => '1',
'peepsoHeader' => '1',
@@ -501,9 +498,6 @@
if ( !isset( $settings['attachmentsHide'] ) ) {
$settings['attachmentsHide'] = '0';
}
- if ( !isset( $settings['attachmentsRandomName'] ) ) {
- $settings['attachmentsRandomName'] = '0';
- }
if ( !isset( $settings['miniChatsEnable'] ) ) {
$settings['miniChatsEnable'] = '0';
}
@@ -633,9 +627,6 @@
if ( !isset( $settings['mobilePopupLocationBottom'] ) ) {
$settings['mobilePopupLocationBottom'] = '0';
}
- if ( !isset( $settings['offlineCallsNotifications'] ) ) {
- $settings['offlineCallsNotifications'] = '0';
- }
if ( !isset( $settings['callsLimitFriends'] ) ) {
$settings['callsLimitFriends'] = '0';
}
@@ -837,10 +828,6 @@
$settings['messagesViewer'] = '0';
}
- if( ! isset( $settings['offlineCallsAllowed'] ) ) {
- $settings['offlineCallsAllowed'] = '0';
- }
-
if( ! isset( $settings['enableReactions'] ) ) {
$settings['enableReactions'] = '0';
}
--- a/bp-better-messages/inc/rest-api.php
+++ b/bp-better-messages/inc/rest-api.php
@@ -355,6 +355,7 @@
$message->thread_id = $_thread_id;
$meta = apply_filters('better_messages_rest_message_meta', [], (int) $message->message_id, (int) $message->thread_id, $message->message );
+ if( empty( $meta ) ) $meta = (object) [];
$message->meta = $meta;
$message->favorited = (Better_Messages()->functions->is_message_starred($message->message_id, $current_user_id)) ? 1 : 0;
@@ -1195,7 +1196,8 @@
$meta = apply_filters('better_messages_rest_message_meta', $meta, (int) $message->message_id, (int) $message->thread_id, $message->message );
- $messages[ $key ]->meta = $meta;
+ if( empty( $meta ) ) $meta = (object) [];
+ $messages[ $key ]->meta = $meta;
if( $apply_filters ) {
$messages[$key]->favorited = (Better_Messages()->functions->is_message_starred($message->message_id, $current_user_id)) ? 1 : 0;
@@ -1283,7 +1285,7 @@
/** Find all unloaded unread */
$sql = $wpdb->prepare("
SELECT
- `threads`.`id` as `thread_id`,
+ `threads`.`id` as `thread_id`,
( SELECT `id`
FROM " . bm_get_table('messages') . "
WHERE `thread_id` = `threads`.`id`
@@ -1754,7 +1756,7 @@
'subject' => (string) html_entity_decode($thread->subject),
'image' => $image,
'lastTime' => (int) $thread->created_at,
- 'participants' => array_map('intval', array_values($_all_user_ids)),
+ 'participants' => array_map( 'intval', array_values($_all_user_ids) ),
'participantsCount' => (int) count( $_all_user_ids ),
'moderators' => $moderators,
'url' => $url,
--- a/bp-better-messages/inc/shortcodes.php
+++ b/bp-better-messages/inc/shortcodes.php
@@ -81,7 +81,7 @@
}
if( isset( $args['subject'] ) ) {
- $attrs .= ' data-subject="' . $args['subject'] . '"';
+ $attrs .= ' data-subject="' . urlencode($args['subject']) . '"';
}
if( isset( $args['target'] ) ) {
--- a/bp-better-messages/vendor/freemius/includes/class-freemius.php
+++ b/bp-better-messages/vendor/freemius/includes/class-freemius.php
@@ -110,6 +110,12 @@
private $_enable_anonymous = true;
/**
+ * @since 2.9.1
+ * @var string|null Hints the SDK whether the plugin supports parallel activation mode, preventing the auto-deactivation of the free version when the premium version is activated, and vice versa.
+ */
+ private $_premium_plugin_basename_from_parallel_activation;
+
+ /**
* @since 1.1.7.5
* @var bool Hints the SDK if plugin should run in anonymous mode (only adds feedback form).
*/
@@ -1651,6 +1657,31 @@
);
}
}
+
+ if (
+ $this->is_user_in_admin() &&
+ $this->is_parallel_activation() &&
+ $this->_premium_plugin_basename !== $this->_premium_plugin_basename_from_parallel_activation
+ ) {
+ $this->_premium_plugin_basename = $this->_premium_plugin_basename_from_parallel_activation;
+
+ register_activation_hook(
+ dirname( $this->_plugin_dir_path ) . '/' . $this->_premium_plugin_basename,
+ array( &$this, '_activate_plugin_event_hook' )
+ );
+ }
+ }
+
+ /**
+ * Determines if a plugin is running in parallel activation mode.
+ *
+ * @author Leo Fajardo (@leorw)
+ * @since 2.9.1
+ *
+ * @return bool
+ */
+ private function is_parallel_activation() {
+ return ! empty( $this->_premium_plugin_basename_from_parallel_activation );
}
/**
@@ -5155,11 +5186,35 @@
$this->_plugin :
new FS_Plugin();
+ $is_premium = $this->get_bool_option( $plugin_info, 'is_premium', true );
$premium_suffix = $this->get_option( $plugin_info, 'premium_suffix', '(Premium)' );
+ $module_type = $this->get_option( $plugin_info, 'type', $this->_module_type );
+
+ $parallel_activation = $this->get_option( $plugin_info, 'parallel_activation' );
+
+ if (
+ ! $is_premium &&
+ is_array( $parallel_activation ) &&
+ ( WP_FS__MODULE_TYPE_PLUGIN === $module_type ) &&
+ $this->get_bool_option( $parallel_activation, 'enabled' )
+ ) {
+ $premium_basename = $this->get_option( $parallel_activation, 'premium_version_basename' );
+
+ if ( empty( $premium_basename ) ) {
+ throw new Exception('You need to specify the premium version basename to enable parallel version activation.');
+ }
+
+ $this->_premium_plugin_basename_from_parallel_activation = $premium_basename;
+
+ if ( is_plugin_active( $premium_basename ) ) {
+ $is_premium = true;
+ }
+ }
+
$plugin->update( array(
'id' => $id,
- 'type' => $this->get_option( $plugin_info, 'type', $this->_module_type ),
+ 'type' => $module_type,
'public_key' => $public_key,
'slug' => $this->_slug,
'premium_slug' => $this->get_option( $plugin_info, 'premium_slug', "{$this->_slug}-premium" ),
@@ -5167,7 +5222,7 @@
'version' => $this->get_plugin_version(),
'title' => $this->get_plugin_name( $premium_suffix ),
'file' => $this->_plugin_basename,
- 'is_premium' => $this->get_bool_option( $plugin_info, 'is_premium', true ),
+ 'is_premium' => $is_premium,
'premium_suffix' => $premium_suffix,
'is_live' => $this->get_bool_option( $plugin_info, 'is_live', true ),
'affiliate_moderation' => $this->get_option( $plugin_info, 'has_affiliation' ),
@@ -5236,7 +5291,14 @@
$this->_anonymous_mode = false;
} else {
$this->_enable_anonymous = $this->get_bool_option( $plugin_info, 'enable_anonymous', true );
- $this->_anonymous_mode = $this->get_bool_option( $plugin_info, 'anonymous_mode', false );
+ $this->_anonymous_mode = (
+ $this->get_bool_option( $plugin_info, 'anonymous_mode', false ) ||
+ (
+ $this->apply_filters( 'playground_anonymous_mode', true ) &&
+ ! empty( $_SERVER['HTTP_HOST'] ) &&
+ FS_Site::is_playground_wp_environment_by_host( $_SERVER['HTTP_HOST'] )
+ )
+ );
}
$this->_permissions = $this->get_option( $plugin_info, 'permissions', array() );
$this->_is_bundle_license_auto_activation_enabled = $this->get_option( $plugin_info, 'bundle_license_auto_activation', false );
@@ -5444,7 +5506,7 @@
if ( $this->is_registered() ) {
// Schedule code type changes event.
- $this->schedule_install_sync();
+ $this->maybe_schedule_install_sync_cron();
}
/**
@@ -6508,6 +6570,33 @@
}
/**
+ * Instead of running blocking install sync event, execute non blocking scheduled cron job.
+ *
+ * @param int $except_blog_id Since 2.0.0 when running in a multisite network environment, the cron execution is consolidated. This param allows excluding specified blog ID from being the cron job executor.
+ *
+ * @author Leo Fajardo (@leorw)
+ * @since 2.9.1
+ */
+ private function maybe_schedule_install_sync_cron( $except_blog_id = 0 ) {
+ if ( ! $this->is_user_in_admin() ) {
+ return;
+ }
+
+ if ( $this->is_clone() ) {
+ return;
+ }
+
+ if (
+ // The event has been properly scheduled, so no need to reschedule it.
+ is_numeric( $this->next_install_sync() )
+ ) {
+ return;
+ }
+
+ $this->schedule_cron( 'install_sync', 'install_sync', 'single', WP_FS__SCRIPT_START_TIME, false, $except_blog_id );
+ }
+
+ /**
* @author Vova Feldman (@svovaf)
* @since 1.1.7.3
*
@@ -6605,22 +6694,6 @@
}
/**
- * Instead of running blocking install sync event, execute non blocking scheduled wp-cron.
- *
- * @author Vova Feldman (@svovaf)
- * @since 1.1.7.3
- *
- * @param int $except_blog_id Since 2.0.0 when running in a multisite network environment, the cron execution is consolidated. This param allows excluding excluded specified blog ID from being the cron executor.
- */
- private function schedule_install_sync( $except_blog_id = 0 ) {
- if ( $this->is_clone() ) {
- return;
- }
-
- $this->schedule_cron( 'install_sync', 'install_sync', 'single', WP_FS__SCRIPT_START_TIME, false, $except_blog_id );
- }
-
- /**
* Unix timestamp for previous install sync cron execution or false if never executed.
*
* @todo There's some very strange bug that $this->_storage->install_sync_timestamp value is not being updated. But for sure the sync event is working.
@@ -7411,7 +7484,7 @@
*/
if (
is_plugin_active( $other_version_basename ) &&
- $this->apply_filters( 'deactivate_on_activation', true )
+ $this->apply_filters( 'deactivate_on_activation', ! $this->is_parallel_activation() )
) {
deactivate_plugins( $other_version_basename );
}
@@ -7425,7 +7498,7 @@
// Schedule re-activation event and sync.
// $this->sync_install( array(), true );
- $this->schedule_install_sync();
+ $this->maybe_schedule_install_sync_cron();
// If activating the premium module version, add an admin notice to congratulate for an upgrade completion.
if ( $is_premium_version_activation ) {
@@ -8616,7 +8689,7 @@
return;
}
- $this->schedule_install_sync();
+ $this->maybe_schedule_install_sync_cron();
// $this->sync_install( array(), true );
}
@@ -15974,7 +16047,7 @@
if ( $this->is_install_sync_scheduled() &&
$context_blog_id == $this->get_install_sync_cron_blog_id()
) {
- $this->schedule_install_sync( $context_blog_id );
+ $this->maybe_schedule_install_sync_cron( $context_blog_id );
}
}
@@ -23927,13 +24000,15 @@
// Start trial button.
$button = ' ' . sprintf(
- '<a style="margin-left: 10px; vertical-align: super;" href="%s"><button class="button button-primary">%s ➜</button></a>',
+ '<div><a class="button button-primary" href="%s">%s ➜</a></div>',
$trial_url,
$this->get_text_x_inline( 'Start free trial', 'call to action', 'start-free-trial' )
);
+ $message_text = $this->apply_filters( 'trial_promotion_message', "{$message} {$cc_string}" );
+
$this->_admin_notices->add_sticky(
- $this->apply_filters( 'trial_promotion_message', "{$message} {$cc_string} {$button}" ),
+ "<div class="fs-trial-message-container"><div>{$message_text}</div> {$button}</div>",
'trial_promotion',
'',
'promotion'
@@ -25403,7 +25478,7 @@
$img_dir = WP_FS__DIR_IMG;
// Locate the main assets folder.
- if ( 1 < count( $fs_active_plugins->plugins ) ) {
+ if ( ! empty( $fs_active_plugins->plugins ) ) {
$plugin_or_theme_img_dir = ( $this->is_plugin() ? WP_PLUGIN_DIR : get_theme_root( get_stylesheet() ) );
foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) {
--- a/bp-better-messages/vendor/freemius/includes/class-fs-plugin-updater.php
+++ b/bp-better-messages/vendor/freemius/includes/class-fs-plugin-updater.php
@@ -542,24 +542,8 @@
global $wp_current_filter;
- $current_plugin_version = $this->_fs->get_plugin_version();
-
- if ( ! empty( $wp_current_filter ) && 'upgrader_process_complete' === $wp_current_filter[0] ) {
- if (
- is_null( $this->_update_details ) ||
- ( is_object( $this->_update_details ) && $this->_update_details->new_version !== $current_plugin_version )
- ) {
- /**
- * After an update, clear the stored update details and reparse the plugin's main file in order to get
- * the updated version's information and prevent the previous update information from showing up on the
- * updates page.
- *
- * @author Leo Fajardo (@leorw)
- * @since 2.3.1
- */
- $this->_update_details = null;
- $current_plugin_version = $this->_fs->get_plugin_version( true );
- }
+ if ( ! empty( $wp_current_filter ) && in_array( 'upgrader_process_complete', $wp_current_filter ) ) {
+ return $transient_data;
}
if ( ! isset( $this->_update_details ) ) {
@@ -568,7 +552,7 @@
false,
fs_request_get_bool( 'force-check' ),
FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
- $current_plugin_version
+ $this->_fs->get_plugin_version()
);
$this->_update_details = false;
--- a/bp-better-messages/vendor/freemius/includes/entities/class-fs-plugin-plan.php
+++ b/bp-better-messages/vendor/freemius/includes/entities/class-fs-plugin-plan.php
@@ -13,7 +13,6 @@
/**
* Class FS_Plugin_Plan
*
- * @property FS_Pricing[] $pricing
*/
class FS_Plugin_Plan extends FS_Entity {
--- a/bp-better-messages/vendor/freemius/includes/entities/class-fs-site.php
+++ b/bp-better-messages/vendor/freemius/includes/entities/class-fs-site.php
@@ -10,16 +10,16 @@
exit;
}
- /**
- * @property int $blog_id
- */
- #[AllowDynamicProperties]
class FS_Site extends FS_Scope_Entity {
/**
* @var number
*/
public $site_id;
/**
+ * @var int
+ */
+ public $blog_id;
+ /**
* @var number
*/
public $plugin_id;
@@ -190,7 +190,7 @@
fs_ends_with( $subdomain, '.cloudwaysapps.com' ) ||
// Kinsta
(
- ( fs_starts_with( $subdomain, 'staging-' ) || fs_starts_with( $subdomain, 'env-' ) ) &&
+ ( fs_starts_with( $subdomain, 'stg-' ) || fs_starts_with( $subdomain, 'staging-' ) || fs_starts_with( $subdomain, 'env-' ) ) &&
( fs_ends_with( $subdomain, '.kinsta.com' ) || fs_ends_with( $subdomain, '.kinsta.cloud' ) )
) ||
// DesktopServer
@@ -208,6 +208,40 @@
);
}
+ /**
+ * @author Leo Fajardo (@leorw)
+ * @since 2.9.1
+ *
+ * @param string $host
+ *
+ * @return bool
+ */
+ static function is_playground_wp_environment_by_host( $host ) {
+ // Services aimed at providing a WordPress sandbox environment.
+ $sandbox_wp_environment_domains = array(
+ // InstaWP
+ 'instawp.xyz',
+
+ // TasteWP
+ 'tastewp.com',
+
+ // WordPress Playground
+ 'playground.wordpress.net',
+ );
+
+ foreach ( $sandbox_wp_environment_domains as $domain) {
+ if (
+ ( $host === $domain ) ||
+ fs_ends_with( $host, '.' . $domain ) ||
+ fs_ends_with( $host, '-' . $domain )
+ ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
function is_localhost() {
return ( WP_FS__IS_LOCALHOST_FOR_SERVER || self::is_localhost_by_address( $this->url ) );
}
--- a/bp-better-messages/vendor/freemius/includes/entities/class-fs-user.php
+++ b/bp-better-messages/vendor/freemius/includes/entities/class-fs-user.php
@@ -48,6 +48,19 @@
parent::__construct( $user );
}
+ /**
+ * This method removes the deprecated 'is_beta' property from the serialized data.
+ * Should clean up the serialized data to avoid PHP 8.2 warning on next execution.
+ *
+ * @return void
+ */
+ function __wakeup() {
+ if ( property_exists( $this, 'is_beta' ) ) {
+ // If we enter here, and we are running PHP 8.2, we already had the warning. But we sanitize data for next execution.
+ unset( $this->is_beta );
+ }
+ }
+
function get_name() {
return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
}
--- a/bp-better-messages/vendor/freemius/includes/managers/class-fs-admin-menu-manager.php
+++ b/bp-better-messages/vendor/freemius/includes/managers/class-fs-admin-menu-manager.php
@@ -699,16 +699,36 @@
$menu = $this->find_main_submenu();
}
+ $menu_slug = $menu['menu'][2];
$parent_slug = isset( $menu['parent_slug'] ) ?
- $menu['parent_slug'] :
- 'admin.php';
+ $menu['parent_slug'] :
+ 'admin.php';
- return admin_url(
- $parent_slug .
- ( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
- 'page=' .
- $menu['menu'][2]
- );
+ if ( fs_apply_filter( $this->_module_unique_affix, 'enable_cpt_advanced_menu_logic', false ) ) {
+ $parent_slug = 'admin.php';
+
+ /**
+ * This line and the `if` block below it are based on the `menu_page_url()` function of WordPress.
+ *
+ * @author Leo Fajardo (@leorw)
+ * @since 2.10.2
+ */
+ global $_parent_pages;
+
+ if ( ! empty( $_parent_pages[ $menu_slug ] ) ) {
+ $_parent_slug = $_parent_pages[ $menu_slug ];
+ $parent_slug = isset( $_parent_pages[ $_parent_slug ] ) ?
+ $parent_slug :
+ $menu['parent_slug'];
+ }
+ }
+
+ return admin_url(
+ $parent_slug .
+ ( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
+ 'page=' .
+ $menu_slug
+ );
}
/**
--- a/bp-better-messages/vendor/freemius/includes/managers/class-fs-admin-notice-manager.php
+++ b/bp-better-messages/vendor/freemius/includes/managers/class-fs-admin-notice-manager.php
@@ -194,8 +194,14 @@
* @since 1.0.7
*/
static function _add_sticky_dismiss_javascript() {
+ $sticky_admin_notice_js_template_name = 'sticky-admin-notice-js.php';
+
+ if ( ! file_exists( fs_get_template_path( $sticky_admin_notice_js_template_name ) ) ) {
+ return;
+ }
+
$params = array();
- fs_require_once_template( 'sticky-admin-notice-js.php', $params );
+ fs_require_once_template( $sticky_admin_notice_js_template_name, $params );
}
private static $_added_sticky_javascript = false;
--- a/bp-better-messages/vendor/freemius/start.php
+++ b/bp-better-messages/vendor/freemius/start.php
@@ -15,7 +15,7 @@
*
* @var string
*/
- $this_sdk_version = '2.9.0';
+ $this_sdk_version = '2.11.0';
#region SDK Selection Logic --------------------------------------------------------------------
@@ -36,7 +36,16 @@
require_once dirname( __FILE__ ) . '/includes/fs-essential-functions.php';
}
- /**
+ /**
+ * We updated the logic to support SDK loading from a subfolder of a theme as well as from a parent theme
+ * If the SDK is found in the active theme, it sets the relative path accordingly.
+ * If not, it checks the parent theme and sets the relative path if found there.
+ * This allows the SDK to be loaded from composer dependencies or from a custom `vendor/freemius` folder.
+ *
+ * @author Daniele Alessandra (@DanieleAlessandra)
+ * @since 2.9.0.5
+ *
+ *
* This complex logic fixes symlink issues (e.g. with Vargant). The logic assumes
* that if it's a file from an SDK running in a theme, the location of the SDK
* is in the main theme's folder.
@@ -83,16 +92,50 @@
*/
$themes_directory = get_theme_root( get_stylesheet() );
$themes_directory_name = basename( $themes_directory );
- $theme_candidate_basename = basename( dirname( $fs_root_path ) ) . '/' . basename( $fs_root_path );
- if ( $file_path == fs_normalize_path( realpath( trailingslashit( $themes_directory ) . $theme_candidate_basename . '/' . basename( $file_path ) ) )
- ) {
- $this_sdk_relative_path = '../' . $themes_directory_name . '/' . $theme_candidate_basename;
- $is_theme = true;
- } else {
- $this_sdk_relative_path = plugin_basename( $fs_root_path );
- $is_theme = false;
- }
+ // This change ensures that the condition works even if the SDK is located in a subdirectory (e.g., vendor)
+ $theme_candidate_sdk_basename = str_replace( $themes_directory . '/' . get_stylesheet() . '/', '', $fs_root_path );
+
+ // Check if the current file is part of the active theme.
+ $is_current_sdk_from_active_theme = $file_path == $themes_directory . '/' . get_stylesheet() . '/' . $theme_candidate_sdk_basename . '/' . basename( $file_path );
+ $is_current_sdk_from_parent_theme = false;
+
+ // Check if the current file is part of the parent theme.
+ if ( ! $is_current_sdk_from_active_theme ) {
+ $theme_candidate_sdk_basename = str_replace( $themes_directory . '/' . get_template() . '/',
+ '',
+ $fs_root_path );
+ $is_current_sdk_from_parent_theme = $file_path == $themes_directory . '/' . get_template() . '/' . $theme_candidate_sdk_basename . '/' . basename( $file_path );
+ }
+
+ $theme_name = null;
+ if ( $is_current_sdk_from_active_theme ) {
+ $theme_name = get_stylesheet();
+ $this_sdk_relative_path = '../' . $themes_directory_name . '/' . $theme_name . '/' . $theme_candidate_sdk_basename;
+ $is_theme = true;
+ } else if ( $is_current_sdk_from_parent_theme ) {
+ $theme_name = get_template();
+ $this_sdk_relative_path = '../' . $themes_directory_name . '/' . $theme_name . '/' . $theme_candidate_sdk_basename;
+ $is_theme = true;
+ } else {
+ $this_sdk_relative_path = plugin_basename( $fs_root_path );
+ $is_theme = false;
+
+ /**
+ * If this file was included from another plugin with lower SDK version, and if this plugin is symlinked, then we need to get the actual plugin path,
+ * as the value right now will be wrong, it will only remove the directory separator from the file_path.
+ *
+ * The check of `fs_find_direct_caller_plugin_file` determines that this file was indeed included by a different plugin than the main plugin.
+ */
+ if ( DIRECTORY_SEPARATOR . $this_sdk_relative_path === $fs_root_path && function_exists( 'fs_find_direct_caller_plugin_file' ) ) {
+ $original_plugin_dir_name = dirname( fs_find_direct_caller_plugin_file( $file_path ) );
+
+ // Remove everything before the original plugin directory name.
+ $this_sdk_relative_path = substr( $this_sdk_relative_path, strpos( $this_sdk_relative_path, $original_plugin_dir_name ) );
+
+ unset( $original_plugin_dir_name );
+ }
+ }
if ( ! isset( $fs_active_plugins ) ) {
// Load all Freemius powered active plugins.
@@ -176,7 +219,8 @@
$this_sdk_version != $fs_active_plugins->plugins[ $this_sdk_relative_path ]->version
) {
if ( $is_theme ) {
- $plugin_path = basename( dirname( $this_sdk_relative_path ) );
+ // Saving relative path and not only directory name as it could be a subfolder
+ $plugin_path = $theme_name;
} else {
$plugin_path = plugin_basename( fs_find_direct_caller_plugin_file( $file_path ) );
}
@@ -225,11 +269,23 @@
$is_newest_sdk_type_theme = ( isset( $fs_newest_sdk->type ) && 'theme' === $fs_newest_sdk->type );
- if ( ! $is_newest_sdk_type_theme ) {
- $is_newest_sdk_plugin_active = is_plugin_active( $fs_newest_sdk->plugin_path );
- } else {
- $current_theme = wp_get_theme();
- $is_newest_sdk_plugin_active = ( $current_theme->stylesheet === $fs_newest_sdk->plugin_path );
+ /**
+ * @var bool $is_newest_sdk_module_active
+ * True if the plugin with the newest SDK is active.
+ * True if the newest SDK is part of the current theme or current theme's parent.
+ * False otherwise.
+ */
+ if ( ! $is_newest_sdk_type_theme ) {
+ $is_newest_sdk_module_active = is_plugin_active( $fs_newest_sdk->plugin_path );
+ } else {
+ $current_theme = wp_get_theme();
+ // Detect if current theme is the one registered as newer SDK
+ $is_newest_sdk_module_active = (
+ strpos(
+ $fs_newest_sdk->plugin_path,
+ '../' . $themes_directory_name . '/' . $current_theme->get_stylesheet() . '/'
+ ) === 0
+ );
$current_theme_parent = $current_theme->parent();
@@ -237,13 +293,19 @@
* If the current theme is a child of the theme that has the newest SDK, this prevents a redirects loop
* from happening by keeping the SDK info stored in the `fs_active_plugins` option.
*/
- if ( ! $is_newest_sdk_plugin_active && $current_theme_parent instanceof WP_Theme ) {
- $is_newest_sdk_plugin_active = ( $fs_newest_sdk->plugin_path === $current_theme_parent->stylesheet );
+ if ( ! $is_newest_sdk_module_active && $current_theme_parent instanceof WP_Theme ) {
+ // Detect if current theme parent is the one registered as newer SDK
+ $is_newest_sdk_module_active = (
+ strpos(
+ $fs_newest_sdk->plugin_path,
+ '../' . $themes_directory_name . '/' . $current_theme_parent->get_stylesheet() . '/'
+ ) === 0
+ );
}
}
if ( $is_current_sdk_newest &&
- ! $is_newest_sdk_plugin_active &&
+ ! $is_newest_sdk_module_active &&
! $fs_active_plugins->newest->in_activation
) {
// If current SDK is the newest and the plugin is NOT active, it means
@@ -262,14 +324,14 @@
. '/start.php' );
}
- $is_newest_sdk_path_valid = ( $is_newest_sdk_plugin_active || $fs_active_plugins->newest->in_activation ) && file_exists( $sdk_starter_path );
+ $is_newest_sdk_path_valid = ( $is_newest_sdk_module_active || $fs_active_plugins->newest->in_activation ) && file_exists( $sdk_starter_path );
if ( ! $is_newest_sdk_path_valid && ! $is_current_sdk_newest ) {
// Plugin with newest SDK is no longer active, or SDK was moved to a different location.
unset( $fs_active_plugins->plugins[ $fs_active_plugins->newest->sdk_path ] );
}
- if ( ! ( $is_newest_sdk_plugin_active || $fs_active_plugins->newest->in_activation ) ||
+ if ( ! ( $is_newest_sdk_module_active || $fs_active_plugins->newest->in_activation ) ||
! $is_newest_sdk_path_valid ||
// Is newest SDK downgraded.
( $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
@@ -284,7 +346,7 @@
// Find the active plugin with the newest SDK version and update the newest reference.
fs_fallback_to_newest_active_sdk();
} else {
- if ( $is_newest_sdk_plugin_active &&
+ if ( $is_newest_sdk_module_active &&
$this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
( $fs_active_plugins->newest->in_activation ||
( class_exists( 'Freemius' ) && ( ! defined( 'WP_FS__SDK_VERSION' ) || version_compare( WP_FS__SDK_VERSION, $this_sdk_version, '<' ) ) )
@@ -313,7 +375,7 @@
return;
}
- if ( version_compare( $this_sdk_version, $fs_active_plugins->newest->version, '<' ) ) {
+ if ( isset( $fs_active_plugins->newest ) && version_compare( $this_sdk_version, $fs_active_plugins->newest->version, '<' ) ) {
$newest_sdk = $fs_active_plugins->plugins[ $fs_active_plugins->newest->sdk_path ];
$plugins_or_theme_dir_path = ( ! isset( $newest_sdk->type ) || 'theme' !== $newest_sdk->type ) ?
--- a/bp-better-messages/vendor/freemius/templates/forms/license-activation.php
+++ b/bp-better-messages/vendor/freemius/templates/forms/license-activation.php
@@ -569,7 +569,7 @@
licenseKey = $otherLicenseKey.val();
} else {
if ( ! hasLicensesDropdown ) {
- licenseID = $availableLicenseKey.data( 'id' );
+ licenseID = $availableLicenseKey.data( 'id' ).toString();
} else {
licenseID = $licensesDropdown.val();
}
--- a/bp-better-messages/vendor/freemius/templates/powered-by.php
+++ b/bp-better-messages/vendor/freemius/templates/powered-by.php
@@ -1,61 +0,0 @@
-<?php
- /**
- * @package Freemius
- * @copyright Copyright (c) 2015, Freemius, Inc.
- * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
- * @since 1.0.5
- */
-
- /**
- * Note for WordPress.org Theme/Plugin reviewer:
- * Freemius is an SDK for plugin and theme developers. Since the core
- * of the SDK is relevant both for plugins and themes, for obvious reasons,
- * we only develop and maintain one code base.
- *
- * This code will not run for wp.org themes (only plugins)
- * since theme admin settings/options are now only allowed in the customizer.
- *
- * In addition, this page loads an i-frame. We intentionally named it 'frame'
- * so it will pass the "Theme Check" that is looking for the string "i" . "frame".
- *
- * If you have any questions or need clarifications, please don't hesitate
- * pinging me on slack, my username is @svovaf.
- *
- * @author Vova Feldman (@svovaf)
- * @since 1.2.2
- */
-
- if ( ! defined( 'ABSPATH' ) ) {
- exit;
- }
-
- $VARS = isset($VARS) ? $VARS : array();
-
- $fs = freemius( $VARS['module_id'] );
-
- if ( ! $fs->is_whitelabeled() && ! $fs->apply_filters( 'hide_freemius_powered_by', false ) ) {
- wp_enqueue_script( 'jquery' );
- wp_enqueue_script( 'json2' );
- fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.js' );
- fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
- ?>
-<div id="pframe"></div>
-<script type="text/javascript">
- (function ($) {
- $(function () {
- var
- base_url = '<?php echo WP_FS__ADDRESS ?>',
- pfram