PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.0
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
← All changes | Modules/Integrations/FluentCart/Http/Controllers/PaywallController.php +10 -3 2.7.72.10.0 View file →
@@ -4,9 +4,9 @@
4 4
5 5 use FluentCart\App\Models\Product;
6 6 use FluentCart\App\Models\ProductDetail;
7 7 use FluentCart\App\Models\ProductVariation;
8 -use FluentCart\App\Services\Permission\PermissionManager;
8 +use FluentCart\App\Services\Permission\PermissionManager as CartPermissionManager;
9 9 use FluentCommunity\App\Models\BaseSpace;
10 10 use FluentCommunity\Framework\Support\Arr;
11 11 use FluentCommunity\App\Services\Helper;
12 12 use FluentCart\App\Helpers\Helper as CartHelper;
@@ -18,8 +18,15 @@
18 18 public function getPaywalls(Request $request, $spaceId)
19 19 {
20 20 $space = BaseSpace::withoutGlobalScopes()->findOrFail($spaceId);
21 21
22 + $userId = get_current_user_id();
23 + if ($space->privacy === 'secret' && !$space->getMembership($userId) && !$space->isAdmin($userId, true)) {
24 + return $this->sendError([
25 + 'message' => __('The space could not be found', 'fluent-community')
26 + ], 404);
27 + }
28 +
22 29 $paywallIds = array_map('intval', $request->get('paywall_ids', []));
23 30 $productIds = Arr::get($space->settings, 'cart_product_ids', []);
24 31
25 32 $paywallQuery = Product::whereIn('ID', $productIds)
@@ -133,9 +140,9 @@
133 140 }
134 141
135 142 public function searchProduct(Request $request)
136 143 {
137 - $search = trim($request->getSafe('search'));
144 + $search = trim((string) $request->getSafe('search', 'sanitize_text_field', ''));
138 145
139 146 $products = Product::query()
140 147 ->select('ID', 'post_title')
141 148 ->when($search !== '', function ($query) use ($search) {
@@ -165,9 +172,9 @@
165 172 }
166 173
167 174 public function createProduct(Request $request)
168 175 {
169 - if (!PermissionManager::hasPermission('products/create')) {
176 + if (!CartPermissionManager::hasPermission('products/create')) {
170 177 return $this->sendError([
171 178 'message' => __('You do not have permission to create products', 'fluent-community')
172 179 ], 422);
173 180 }