PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.01
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.01
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 | app/Http/Controllers/AdminController.php +57 -1 2.7.72.10.01 View file →
@@ -8,8 +8,9 @@
8 8 use FluentCommunity\App\Services\CustomSanitizer;
9 9 use FluentCommunity\App\Services\FeedsHelper;
10 10 use FluentCommunity\App\Services\ProfileHelper;
11 11 use FluentCommunity\Modules\Auth\AuthHelper;
12 +use FluentCommunity\Modules\PushNotification\PushNotificationModule;
12 13 use FluentCommunity\App\Services\Helper;
13 14 use FluentCommunity\App\Services\OnboardingService;
14 15 use FluentCommunity\Framework\Http\Request\Request;
15 16 use FluentCommunity\Framework\Support\Arr;
@@ -41,8 +42,9 @@
41 42 public function saveGeneralSettings(Request $request)
42 43 {
43 44 $inputs = $request->get('settings', []);
44 45 $settings = Helper::generalSettings(false);
46 + $storedSettings = $settings;
45 47 $inputs = Arr::only($inputs, array_keys($settings));
46 48
47 49 $settings['logo'] = Arr::get($inputs, 'logo', '');
48 50 $settings['white_logo'] = Arr::get($inputs, 'white_logo', '');
@@ -129,8 +131,18 @@
129 131 $settings['slug'] = $newSlug;
130 132 $slugChanged = true;
131 133 }
132 134
135 + if (!Helper::isSuperAdmin()) {
136 + foreach (['auth_url', 'cutsom_auth_url', 'auth_form_type', 'auth_redirect', 'custom_signup_url', 'use_custom_signup_page', 'explicit_registration'] as $restrictedKey) {
137 + if ($settings[$restrictedKey] != Arr::get($storedSettings, $restrictedKey, '')) {
138 + return $this->sendError([
139 + 'message' => __('You do not have permission to change the authentication and login settings', 'fluent-community')
140 + ]);
141 + }
142 + }
143 + }
144 +
133 145 update_option('fluent_community_settings', $settings);
134 146
135 147 $redirectUrl = '';
136 148
@@ -200,8 +212,52 @@
200 212 'message' => __('Email notification settings have been updated', 'fluent-community')
201 213 ];
202 214 }
203 215
216 + public function getPushSettings(Request $request)
217 + {
218 + $data = [
219 + 'push_settings' => Utility::getPushNotificationSettings(),
220 + 'push_available' => PushNotificationModule::isFluentNotifyActive(),
221 + 'push_setup' => [
222 + 'state' => PushNotificationModule::getSetupState(),
223 + 'settings_url' => PushNotificationModule::getSettingsUrl(),
224 + 'can_install' => current_user_can('install_plugins'),
225 + 'can_activate' => current_user_can('activate_plugins'),
226 + 'has_installer' => (bool)has_action('fluent_community/install_fluent_notify_plugin'),
227 + 'learn_more_url' => 'https://fluentnotify.com'
228 + ]
229 + ];
230 +
231 + return apply_filters('fluent_community/push_settings_api_response', $data, $request->all());
232 + }
233 +
234 + public function savePushSettings(Request $request)
235 + {
236 + $prevSettings = Utility::getPushNotificationSettings();
237 +
238 + $settings = Arr::only((array)$request->get('settings', []), array_keys($prevSettings));
239 + $settings = wp_parse_args($settings, $prevSettings);
240 +
241 + foreach ($settings as $key => $value) {
242 + if ($key === 'prompt_placements') {
243 + $settings[$key] = array_values(array_intersect(
244 + array_map('sanitize_text_field', (array)$value),
245 + PushNotificationModule::PROMPT_PLACEMENTS
246 + ));
247 + } else {
248 + $settings[$key] = $value === 'yes' ? 'yes' : 'no';
249 + }
250 + }
251 +
252 + Utility::updateOption('global_push_settings', $settings);
253 +
254 + return [
255 + 'push_settings' => $settings,
256 + 'message' => __('Push notification settings have been updated', 'fluent-community')
257 + ];
258 + }
259 +
204 260 public function getStorageSettings(Request $request)
205 261 {
206 262 if (!defined('FLUENT_COMMUNITY_PRO')) {
207 263 $config = [
@@ -229,9 +285,9 @@
229 285 'message' => __('You cannot update the storage settings as it is defined in the config file', 'fluent-community')
230 286 ]);
231 287 }
232 288
233 - $config = $request->get('config', []);
289 + $config = (array)$request->get('config', []);
234 290
235 291 $driver = Arr::get($config, 'driver', 'local');
236 292
237 293 $validation = [