@@ -17,13 +17,13 @@ |
||
| 17 | 17 | $uri = config('wiki.api_uri').'?action=query&list=search&srwhat=text&srsearch='.$search.'&srqiprofile=classic_noboostlinks&srnamespace=3000&format=json'; |
| 18 | 18 | try { |
| 19 | 19 | $response = $client->get($uri); |
| 20 | - }catch (\Throwable $e){ |
|
| 20 | + } catch (\Throwable $e) { |
|
| 21 | 21 | return ['results' => []]; |
| 22 | 22 | } |
| 23 | 23 | $content = json_decode($response->getBody()->getContents(), true); |
| 24 | - if(isset($content['query']['search'])){ |
|
| 24 | + if (isset($content['query']['search'])) { |
|
| 25 | 25 | $results = array_column($content['query']['search'], 'title'); |
| 26 | - return array_map(function ($item){ |
|
| 26 | + return array_map(function($item) { |
|
| 27 | 27 | return str_replace('Structure:', '', $item); |
| 28 | 28 | }, $results); |
| 29 | 29 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public function handle($request, \Closure $next) |
| 12 | 12 | { |
| 13 | 13 | $user = Auth::user(); |
| 14 | - if($user->context_id === null){ |
|
| 14 | + if ($user->context_id === null) { |
|
| 15 | 15 | return $next($request); |
| 16 | 16 | } |
| 17 | 17 | return redirect('/profile'); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | public function getByEmail(string $email): ?User |
| 18 | 18 | { |
| 19 | 19 | $record = \App\User::where('email', $email)->first(); |
| 20 | - if(!isset($record)){ |
|
| 20 | + if (!isset($record)) { |
|
| 21 | 21 | return null; |
| 22 | 22 | } |
| 23 | 23 | $roles = $record->roles()->pluck('name')->toArray(); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public function getById(string $id): ?User |
| 28 | 28 | { |
| 29 | 29 | $record = \App\User::where('uuid', $id)->first(); |
| 30 | - if(!isset($record)){ |
|
| 30 | + if (!isset($record)) { |
|
| 31 | 31 | return null; |
| 32 | 32 | } |
| 33 | 33 | $roles = $record->roles()->pluck('name')->toArray(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | unset($data['roles']); |
| 60 | 60 | $userModel->fill($data); |
| 61 | 61 | |
| 62 | - if($oldEmail !== $data['email']){ |
|
| 62 | + if ($oldEmail !== $data['email']) { |
|
| 63 | 63 | $userModel->email_verified_at = null; |
| 64 | 64 | $userModel->sendEmailVerificationNotification(); |
| 65 | 65 | } |
@@ -100,13 +100,13 @@ discard block |
||
| 100 | 100 | ->offset(($page-1)*$perPage) |
| 101 | 101 | ->limit($perPage) |
| 102 | 102 | ->get(); |
| 103 | - if(empty($records)){ |
|
| 103 | + if (empty($records)) { |
|
| 104 | 104 | return []; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $users = []; |
| 108 | - foreach($records as $record){ |
|
| 109 | - if($record->uuid === null){ |
|
| 108 | + foreach ($records as $record) { |
|
| 109 | + if ($record->uuid === null) { |
|
| 110 | 110 | $identity = new Identity(Uuid::uuid4(), $record->iemail, $record->ifirstname, $record->ilastname, null); |
| 111 | 111 | $state = new State($organizationId, null, false, []); |
| 112 | 112 | $users[] = new UserDto($identity, $state); |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | public function getAdminOfOrganization(string $organizationId): array |
| 133 | 133 | { |
| 134 | 134 | $records = \App\User::role(['admin'])->where('organization_id', $organizationId)->get(); |
| 135 | - if(empty($records)){ |
|
| 135 | + if (empty($records)) { |
|
| 136 | 136 | return []; |
| 137 | 137 | } |
| 138 | 138 | $users = []; |
| 139 | - foreach($records as $record){ |
|
| 139 | + foreach ($records as $record) { |
|
| 140 | 140 | $roles = \App\User::find($record->id)->roles()->pluck('name')->toArray(); |
| 141 | 141 | $users[] = new User($record->uuid, $record->email, $record->firstname, $record->lastname, $record->organization_id, $record->path_picture, $roles); |
| 142 | 142 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | public function getByProvider(string $provider, string $providerId): ?User |
| 147 | 147 | { |
| 148 | 148 | $record = \App\User::where('providers->'.$provider, $providerId)->first(); |
| 149 | - if(!isset($record)){ |
|
| 149 | + if (!isset($record)) { |
|
| 150 | 150 | return null; |
| 151 | 151 | } |
| 152 | 152 | $roles = $record->roles()->pluck('name')->toArray(); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function getStats(string $userId): Stats |
| 157 | 157 | { |
| 158 | 158 | $record = \App\User::where('uuid', $userId)->first(); |
| 159 | - if(isset($record) && $record->wiki_stats !== null){ |
|
| 159 | + if (isset($record) && $record->wiki_stats !== null) { |
|
| 160 | 160 | return new Stats($record->wiki_stats); |
| 161 | 161 | } |
| 162 | 162 | return new Stats([]); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | public function verifyEmail(string $userId) |
| 192 | 192 | { |
| 193 | 193 | $user = \App\User::where('uuid', $userId)->first(); |
| 194 | - if(!isset($user)){ |
|
| 194 | + if (!isset($user)) { |
|
| 195 | 195 | return; |
| 196 | 196 | } |
| 197 | 197 | $user->markEmailAsVerified(); |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | protected function redirectTo($request) |
| 16 | 16 | { |
| 17 | - if($request->has('sso')){ |
|
| 17 | + if ($request->has('sso')) { |
|
| 18 | 18 | session()->put('sso', $request->get('sso')); |
| 19 | 19 | session()->put('sig', $request->get('sig')); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if (! $request->expectsJson()) { |
|
| 22 | + if (!$request->expectsJson()) { |
|
| 23 | 23 | return route('login'); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function handle($request, Closure $next) |
| 17 | 17 | { |
| 18 | - if(session()->has('wiki_callback')){ |
|
| 18 | + if (session()->has('wiki_callback')) { |
|
| 19 | 19 | session()->keep(['wiki_callback', 'wiki_token']); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if($request->has('sso')){ |
|
| 22 | + if ($request->has('sso')) { |
|
| 23 | 23 | session()->put('sso', $request->get('sso')); |
| 24 | 24 | session()->put('sig', $request->get('sig')); |
| 25 | 25 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function handle(Registered $event) |
| 13 | 13 | { |
| 14 | - if (($event->user->providers === null || empty($event->user->providers)) && $event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) { |
|
| 14 | + if (($event->user->providers === null || empty($event->user->providers)) && $event->user instanceof MustVerifyEmail && !$event->user->hasVerifiedEmail()) { |
|
| 15 | 15 | $event->user->sendEmailVerificationNotification(); |
| 16 | 16 | } |
| 17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public function handle($request, Closure $next) |
| 12 | 12 | { |
| 13 | 13 | $user = Auth::user(); |
| 14 | - if(!$user->hasVerifiedEmail()){ |
|
| 14 | + if (!$user->hasVerifiedEmail()) { |
|
| 15 | 15 | $request->session()->flash('from_forum', true); |
| 16 | 16 | return redirect()->route('verification.notice'); |
| 17 | 17 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function adminlte_image() |
| 38 | 38 | { |
| 39 | 39 | $urlPicture = $this->path_picture != "" ? asset('storage/'.str_replace('app/public/', '', $this->path_picture)) : null; |
| 40 | - if(!isset($urlPicture) || $urlPicture === ""){ |
|
| 40 | + if (!isset($urlPicture) || $urlPicture === "") { |
|
| 41 | 41 | $urlPicture = url('').'/'.config('adminlte.logo_img'); |
| 42 | 42 | } |
| 43 | 43 | return $urlPicture; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | public function adminlte_desc() |
| 47 | 47 | { |
| 48 | 48 | $desc = $this->firstname.' '.$this->lastname; |
| 49 | - if($this->organization_id !== null){ |
|
| 49 | + if ($this->organization_id !== null) { |
|
| 50 | 50 | $organization = app(OrganizationRepository::class)->get($this->organization_id); |
| 51 | 51 | $desc .= ' - organisme : '.$organization->name(); |
| 52 | 52 | } |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | public function sendEmailVerificationNotification() |
| 77 | 77 | { |
| 78 | 78 | $callback = ''; |
| 79 | - if(session()->has('wiki_callback')){ |
|
| 79 | + if (session()->has('wiki_callback')) { |
|
| 80 | 80 | $callback = base64_encode(urldecode(session()->get('wiki_callback'))); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if(session()->has('sso')){ |
|
| 83 | + if (session()->has('sso')) { |
|
| 84 | 84 | $sso = session()->get('sso'); |
| 85 | 85 | $sig = session()->get('sig'); |
| 86 | 86 | $callback = base64_encode(url('discourse/sso?sso='.$sso.'&sig='.$sig)); |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | public function addCharacteristics(array $characteristics) |
| 107 | 107 | { |
| 108 | - foreach($characteristics as $characteristicUuid){ |
|
| 109 | - $characteristic = CharacteristicsModel::where('uuid', (string)$characteristicUuid)->first(); |
|
| 110 | - if(isset($characteristic)) { |
|
| 108 | + foreach ($characteristics as $characteristicUuid) { |
|
| 109 | + $characteristic = CharacteristicsModel::where('uuid', (string) $characteristicUuid)->first(); |
|
| 110 | + if (isset($characteristic)) { |
|
| 111 | 111 | $this->characteristics()->save($characteristic); |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | public function syncCharacteristics(array $characteristics) |
| 117 | 117 | { |
| 118 | 118 | $characteristicsToSync = []; |
| 119 | - foreach($characteristics as $characteristicUuid){ |
|
| 120 | - $characteristicModel = CharacteristicsModel::where('uuid', (string)$characteristicUuid)->first(); |
|
| 121 | - if(isset($characteristicModel)) { |
|
| 119 | + foreach ($characteristics as $characteristicUuid) { |
|
| 120 | + $characteristicModel = CharacteristicsModel::where('uuid', (string) $characteristicUuid)->first(); |
|
| 121 | + if (isset($characteristicModel)) { |
|
| 122 | 122 | $characteristicsToSync[] = $characteristicModel->id; |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | public function deleted(PageModel $pageModel) |
| 25 | 25 | { |
| 26 | - Log::info('Deleting all data from the page internal id: ' . $pageModel->id); |
|
| 27 | - DB::transaction(function () use($pageModel){ |
|
| 26 | + Log::info('Deleting all data from the page internal id: '.$pageModel->id); |
|
| 27 | + DB::transaction(function() use($pageModel){ |
|
| 28 | 28 | try { |
| 29 | 29 | $characteristic = CharacteristicsModel::query()->where('page_id', $pageModel->page_id)->first(); |
| 30 | 30 | if (isset($characteristic)) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | UserCharacteristicsModel::query()->where('characteristic_id', $characteristic->id)->delete(); |
| 37 | 37 | } |
| 38 | 38 | } catch (\Throwable $e) { |
| 39 | - Log::emergency('Error deleting all data from the page internal id: ' . $pageModel->id); |
|
| 39 | + Log::emergency('Error deleting all data from the page internal id: '.$pageModel->id); |
|
| 40 | 40 | throw $e; |
| 41 | 41 | } |
| 42 | 42 | }); |