@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | private function validContacts(Tree $tree): array |
329 | 329 | { |
330 | 330 | $contacts = [ |
331 | - User::find((int)$tree->getPreference('CONTACT_USER_ID')), |
|
332 | - User::find((int)$tree->getPreference('WEBMASTER_USER_ID')), |
|
331 | + User::find((int) $tree->getPreference('CONTACT_USER_ID')), |
|
332 | + User::find((int) $tree->getPreference('WEBMASTER_USER_ID')), |
|
333 | 333 | ]; |
334 | 334 | |
335 | 335 | return array_filter($contacts); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | { |
354 | 354 | // Create a dummy user, so we can send messages from the tree. |
355 | 355 | $from = new User( |
356 | - (object)[ |
|
356 | + (object) [ |
|
357 | 357 | 'user_id' => null, |
358 | 358 | 'user_name' => '', |
359 | 359 | 'real_name' => $tree->getTitle(), |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | |
364 | 364 | // Create a dummy user, so we can reply to visitors. |
365 | 365 | $sender = new User( |
366 | - (object)[ |
|
366 | + (object) [ |
|
367 | 367 | 'user_id' => null, |
368 | 368 | 'user_name' => '', |
369 | 369 | 'real_name' => $sender_name, |
@@ -448,7 +448,7 @@ |
||
448 | 448 | */ |
449 | 449 | public function julianDay(): int |
450 | 450 | { |
451 | - return (int)(($this->minimumJulianDay() + $this->maximumJulianDay()) / 2); |
|
451 | + return (int) (($this->minimumJulianDay() + $this->maximumJulianDay()) / 2); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | /** |
@@ -88,8 +88,7 @@ discard block |
||
88 | 88 | self::$table_prefix = $config['tblpfx']; |
89 | 89 | |
90 | 90 | $dsn = (substr($config['dbhost'], 0, 1) === '/' ? |
91 | - "mysql:unix_socket='{$config['dbhost']};dbname={$config['dbname']}" : |
|
92 | - "mysql:host={$config['dbhost']};dbname={$config['dbname']};port={$config['dbport']}" |
|
91 | + "mysql:unix_socket='{$config['dbhost']};dbname={$config['dbname']}" : "mysql:host={$config['dbhost']};dbname={$config['dbname']};port={$config['dbport']}" |
|
93 | 92 | ); |
94 | 93 | |
95 | 94 | // Create the underlying PDO object. |
@@ -222,7 +221,7 @@ discard block |
||
222 | 221 | public static function updateSchema($namespace, $schema_name, $target_version): bool |
223 | 222 | { |
224 | 223 | try { |
225 | - $current_version = (int)Site::getPreference($schema_name); |
|
224 | + $current_version = (int) Site::getPreference($schema_name); |
|
226 | 225 | } catch (PDOException $ex) { |
227 | 226 | DebugBar::addThrowable($ex); |
228 | 227 | |
@@ -239,7 +238,7 @@ discard block |
||
239 | 238 | $migration = new $class(); |
240 | 239 | $migration->upgrade(); |
241 | 240 | $current_version++; |
242 | - Site::setPreference($schema_name, (string)$current_version); |
|
241 | + Site::setPreference($schema_name, (string) $current_version); |
|
243 | 242 | $updates_applied = true; |
244 | 243 | } |
245 | 244 |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $this->pageh = $tmpw; |
146 | 146 | } |
147 | 147 | // Store the pagewidth without margins |
148 | - $this->noMarginWidth = (int)($this->pagew - $this->leftmargin - $this->rightmargin); |
|
148 | + $this->noMarginWidth = (int) ($this->pagew - $this->leftmargin - $this->rightmargin); |
|
149 | 149 | // If RTL |
150 | 150 | if ($this->rtl) { |
151 | 151 | $this->alignRTL = 'right'; |
@@ -727,14 +727,14 @@ discard block |
||
727 | 727 | public function textWrap($str, $width): string |
728 | 728 | { |
729 | 729 | // Calculate the line width |
730 | - $lw = (int)($width / ($this->getCurrentStyleHeight() / 2)); |
|
730 | + $lw = (int) ($width / ($this->getCurrentStyleHeight() / 2)); |
|
731 | 731 | // Wordwrap each line |
732 | 732 | $lines = explode("\n", $str); |
733 | 733 | // Line Feed counter |
734 | 734 | $lfct = count($lines); |
735 | 735 | $wraptext = ''; |
736 | 736 | foreach ($lines as $line) { |
737 | - $wtext = FunctionsRtl::utf8WordWrap($line, $lw, "\n", true); |
|
737 | + $wtext = FunctionsRtl::utf8WordWrap($line, $lw, "\n", true); |
|
738 | 738 | $wraptext .= $wtext; |
739 | 739 | // Add a new line as long as it’s not the last line |
740 | 740 | if ($lfct > 1) { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | private function getPersonalFacts(Individual $individual): array |
143 | 143 | { |
144 | - $facts = $individual->getFacts(); |
|
144 | + $facts = $individual->getFacts(); |
|
145 | 145 | foreach ($individual->getSpouseFamilies() as $family) { |
146 | 146 | $facts = array_merge($facts, $family->getFacts()); |
147 | 147 | // Add birth of children from this family to the facts array |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | 'provider' => 'openstreetmap', |
216 | 216 | 'style' => 'mapnik', |
217 | 217 | ]; |
218 | - self::$map_providers = [ |
|
218 | + self::$map_providers = [ |
|
219 | 219 | 'openstreetmap' => [ |
220 | 220 | 'name' => 'OpenStreetMap', |
221 | 221 | 'styles' => ['mapnik' => 'Mapnik'], |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | { |
215 | 215 | if ($analytics_id) { |
216 | 216 | // Add extra dimensions (i.e. filtering categories) |
217 | - $dimensions = (object)[ |
|
217 | + $dimensions = (object) [ |
|
218 | 218 | 'dimension1' => $this->tree ? $this->tree->getName() : '-', |
219 | 219 | 'dimension2' => $this->tree ? Auth::accessLevel($this->tree) : '-', |
220 | 220 | ]; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | if ($project_id && $security_id) { |
277 | 277 | return |
278 | 278 | '<script>' . |
279 | - 'var sc_project=' . (int)$project_id . ',sc_invisible=1,sc_security="' . $security_id . |
|
279 | + 'var sc_project=' . (int) $project_id . ',sc_invisible=1,sc_security="' . $security_id . |
|
280 | 280 | '",scJsHost = (("https:"===document.location.protocol)?"https://secure.":"http://www.");' . |
281 | 281 | 'document.write("<sc"+"ript src=\'"+scJsHost+"statcounter.com/counter/counter.js\'></"+"script>");' . |
282 | 282 | '</script>'; |
@@ -1798,7 +1798,7 @@ discard block |
||
1798 | 1798 | public function menuSearchPhonetic(): Menu |
1799 | 1799 | { |
1800 | 1800 | /* I18N: search using “sounds like”, rather than exact spelling */ |
1801 | - return new Menu(I18N::translate('Phonetic search'), route('search-phonetic', ['ged' => $this->tree->getName(), 'action' => 'soundex',]), 'menu-search-soundex', ['rel' => 'nofollow']); |
|
1801 | + return new Menu(I18N::translate('Phonetic search'), route('search-phonetic', ['ged' => $this->tree->getName(), 'action' => 'soundex', ]), 'menu-search-soundex', ['rel' => 'nofollow']); |
|
1802 | 1802 | } |
1803 | 1803 | |
1804 | 1804 | /** |
@@ -342,7 +342,7 @@ |
||
342 | 342 | public function fileSizeKB(): string |
343 | 343 | { |
344 | 344 | $size = $this->fileSizeBytes(); |
345 | - $size = (int)(($size + 1023) / 1024); |
|
345 | + $size = (int) (($size + 1023) / 1024); |
|
346 | 346 | |
347 | 347 | /* I18N: size of file in KB */ |
348 | 348 | return I18N::translate('%s KB', I18N::number($size)); |
@@ -57,7 +57,7 @@ |
||
57 | 57 | $days = (int) $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS); |
58 | 58 | $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE); |
59 | 59 | $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE); |
60 | - $show_user = (bool)$this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER); |
|
60 | + $show_user = (bool) $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER); |
|
61 | 61 | |
62 | 62 | extract($cfg, EXTR_OVERWRITE); |
63 | 63 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function cleanup(Request $request): Response |
51 | 51 | { |
52 | - $months = (int)$request->get('months', 6); |
|
52 | + $months = (int) $request->get('months', 6); |
|
53 | 53 | |
54 | 54 | $inactive_threshold = time() - $months * 30 * self::SECONDS_PER_DAY; |
55 | 55 | $unverified_threshold = time() - 7 * self::SECONDS_PER_DAY; |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | |
59 | 59 | $inactive_users = array_filter($users, function (User $user) use ($inactive_threshold): bool { |
60 | 60 | if ($user->getPreference('sessiontime') === '0') { |
61 | - $datelogin = (int)$user->getPreference('reg_timestamp'); |
|
61 | + $datelogin = (int) $user->getPreference('reg_timestamp'); |
|
62 | 62 | } else { |
63 | - $datelogin = (int)$user->getPreference('sessiontime'); |
|
63 | + $datelogin = (int) $user->getPreference('sessiontime'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return $datelogin < $inactive_threshold && $user->getPreference('verified'); |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | |
69 | 69 | $unverified_users = array_filter($users, function (User $user) use ($unverified_threshold): bool { |
70 | 70 | if ($user->getPreference('sessiontime') === '0') { |
71 | - $datelogin = (int)$user->getPreference('reg_timestamp'); |
|
71 | + $datelogin = (int) $user->getPreference('reg_timestamp'); |
|
72 | 72 | } else { |
73 | - $datelogin = (int)$user->getPreference('sessiontime'); |
|
73 | + $datelogin = (int) $user->getPreference('sessiontime'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return $datelogin < $unverified_threshold && !$user->getPreference('verified'); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | public function cleanupAction(Request $request): RedirectResponse |
98 | 98 | { |
99 | 99 | foreach (User::all() as $user) { |
100 | - if ((bool)$request->get('del_' . $user->getUserId())) { |
|
100 | + if ((bool) $request->get('del_' . $user->getUserId())) { |
|
101 | 101 | Log::addAuthenticationLog('Deleted user: ' . $user->getUserName()); |
102 | 102 | $user->delete(); |
103 | 103 | |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | public function data(Request $request, User $user): JsonResponse |
145 | 145 | { |
146 | 146 | $search = $request->get('search')['value']; |
147 | - $start = (int)$request->get('start'); |
|
148 | - $length = (int)$request->get('length'); |
|
147 | + $start = (int) $request->get('start'); |
|
148 | + $length = (int) $request->get('length'); |
|
149 | 149 | $order = $request->get('order', []); |
150 | - $draw = (int)$request->get('draw'); |
|
150 | + $draw = (int) $request->get('draw'); |
|
151 | 151 | |
152 | 152 | $sql_select = |
153 | 153 | "SELECT SQL_CALC_FOUND_ROWS u.user_id, user_name, real_name, email, us1.setting_value AS language, us2.setting_value AS registered_at, us3.setting_value AS active_at, us4.setting_value AS verified, us5.setting_value AS verified_by_admin" . |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $args = []; |
163 | 163 | |
164 | 164 | if ($search) { |
165 | - $sql_select .= " AND (user_name LIKE CONCAT('%', :search_1, '%') OR real_name LIKE CONCAT('%', :search_2, '%') OR email LIKE CONCAT('%', :search_3, '%'))"; |
|
165 | + $sql_select .= " AND (user_name LIKE CONCAT('%', :search_1, '%') OR real_name LIKE CONCAT('%', :search_2, '%') OR email LIKE CONCAT('%', :search_3, '%'))"; |
|
166 | 166 | $args['search_1'] = $search; |
167 | 167 | $args['search_2'] = $search; |
168 | 168 | $args['search_3'] = $search; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | if ($length) { |
193 | 193 | $user->setPreference('admin_users_page_size', $length); |
194 | - $sql_select .= " LIMIT :limit OFFSET :offset"; |
|
194 | + $sql_select .= " LIMIT :limit OFFSET :offset"; |
|
195 | 195 | $args['limit'] = $length; |
196 | 196 | $args['offset'] = $start; |
197 | 197 | } |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | $rows = Database::prepare($sql_select)->execute($args)->fetchAll(); |
200 | 200 | |
201 | 201 | // Total filtered/unfiltered rows |
202 | - $recordsFiltered = (int)Database::prepare("SELECT FOUND_ROWS()")->fetchOne(); |
|
203 | - $recordsTotal = (int)Database::prepare("SELECT COUNT(*) FROM `##user` WHERE user_id > 0")->fetchOne(); |
|
202 | + $recordsFiltered = (int) Database::prepare("SELECT FOUND_ROWS()")->fetchOne(); |
|
203 | + $recordsTotal = (int) Database::prepare("SELECT COUNT(*) FROM `##user` WHERE user_id > 0")->fetchOne(); |
|
204 | 204 | |
205 | 205 | $installed_languages = []; |
206 | 206 | foreach (I18N::installedLocales() as $installed_locale) { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function edit(Request $request): Response |
288 | 288 | { |
289 | - $user_id = (int)$request->get('user_id'); |
|
289 | + $user_id = (int) $request->get('user_id'); |
|
290 | 290 | $user = User::find($user_id); |
291 | 291 | |
292 | 292 | if ($user === null) { |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | */ |
370 | 370 | public function update(Request $request, User $user): RedirectResponse |
371 | 371 | { |
372 | - $user_id = (int)$request->get('user_id'); |
|
372 | + $user_id = (int) $request->get('user_id'); |
|
373 | 373 | $username = $request->get('username'); |
374 | 374 | $real_name = $request->get('real_name'); |
375 | 375 | $email = $request->get('email'); |
@@ -379,11 +379,11 @@ discard block |
||
379 | 379 | $timezone = $request->get('timezone'); |
380 | 380 | $contact_method = $request->get('contact_method'); |
381 | 381 | $comment = $request->get('comment'); |
382 | - $auto_accept = (bool)$request->get('auto_accept'); |
|
383 | - $canadmin = (bool)$request->get('canadmin'); |
|
384 | - $visible_online = (bool)$request->get('visible_online'); |
|
385 | - $verified = (bool)$request->get('verified'); |
|
386 | - $approved = (bool)$request->get('approved'); |
|
382 | + $auto_accept = (bool) $request->get('auto_accept'); |
|
383 | + $canadmin = (bool) $request->get('canadmin'); |
|
384 | + $visible_online = (bool) $request->get('visible_online'); |
|
385 | + $verified = (bool) $request->get('verified'); |
|
386 | + $approved = (bool) $request->get('approved'); |
|
387 | 387 | |
388 | 388 | $edit_user = User::find($user_id); |
389 | 389 | |
@@ -400,10 +400,10 @@ discard block |
||
400 | 400 | ->setPreference('TIMEZONE', $timezone) |
401 | 401 | ->setPreference('contactmethod', $contact_method) |
402 | 402 | ->setPreference('comment', $comment) |
403 | - ->setPreference('auto_accept', (string)$auto_accept) |
|
404 | - ->setPreference('visibleonline', (string)$visible_online) |
|
405 | - ->setPreference('verified', (string)$verified) |
|
406 | - ->setPreference('verified_by_admin', (string)$approved); |
|
403 | + ->setPreference('auto_accept', (string) $auto_accept) |
|
404 | + ->setPreference('visibleonline', (string) $visible_online) |
|
405 | + ->setPreference('verified', (string) $verified) |
|
406 | + ->setPreference('verified_by_admin', (string) $approved); |
|
407 | 407 | |
408 | 408 | if ($pass1 !== '') { |
409 | 409 | $edit_user->setPassword($pass1); |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | } |
416 | 416 | |
417 | 417 | foreach (Tree::getAll() as $tree) { |
418 | - $path_length = (int)$request->get('RELATIONSHIP_PATH_LENGTH' . $tree->getTreeId()); |
|
418 | + $path_length = (int) $request->get('RELATIONSHIP_PATH_LENGTH' . $tree->getTreeId()); |
|
419 | 419 | $gedcom_id = $request->get('gedcomid' . $tree->getTreeId(), ''); |
420 | 420 | $can_edit = $request->get('canedit' . $tree->getTreeId(), ''); |
421 | 421 | |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | |
427 | 427 | $tree->setUserPreference($edit_user, 'gedcomid', $gedcom_id); |
428 | 428 | $tree->setUserPreference($edit_user, 'canedit', $can_edit); |
429 | - $tree->setUserPreference($edit_user, 'RELATIONSHIP_PATH_LENGTH', (string)$path_length); |
|
429 | + $tree->setUserPreference($edit_user, 'RELATIONSHIP_PATH_LENGTH', (string) $path_length); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | $url = route('admin-users'); |