Completed
Push — master ( cf7e49...23b00d )
by Steve
60:56 queued 51:28
created
engine/lib/users.php 2 patches
Indentation   +503 added lines, -503 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @access private
17 17
  */
18 18
 function get_user_entity_as_row($guid) {
19
-	return _elgg_services()->usersTable->getRow($guid);
19
+    return _elgg_services()->usersTable->getRow($guid);
20 20
 }
21 21
 
22 22
 /**
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  * @return bool Depending on success
28 28
  */
29 29
 function disable_user_entities($owner_guid) {
30
-	return _elgg_services()->usersTable->disableEntities($owner_guid);
30
+    return _elgg_services()->usersTable->disableEntities($owner_guid);
31 31
 }
32 32
 
33 33
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  * @return bool
40 40
  */
41 41
 function ban_user($user_guid, $reason = "") {
42
-	return _elgg_services()->usersTable->ban($user_guid, $reason);
42
+    return _elgg_services()->usersTable->ban($user_guid, $reason);
43 43
 }
44 44
 
45 45
 /**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
  * @return bool
51 51
  */
52 52
 function unban_user($user_guid) {
53
-	return _elgg_services()->usersTable->unban($user_guid);
53
+    return _elgg_services()->usersTable->unban($user_guid);
54 54
 }
55 55
 
56 56
 /**
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
  * @return bool
62 62
  */
63 63
 function make_user_admin($user_guid) {
64
-	return _elgg_services()->usersTable->makeAdmin($user_guid);
64
+    return _elgg_services()->usersTable->makeAdmin($user_guid);
65 65
 }
66 66
 
67 67
 /**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
  * @return bool
73 73
  */
74 74
 function remove_user_admin($user_guid) {
75
-	return _elgg_services()->usersTable->removeAdmin($user_guid);
75
+    return _elgg_services()->usersTable->removeAdmin($user_guid);
76 76
 }
77 77
 
78 78
 /**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  * @return \ElggUser|false
86 86
  */
87 87
 function get_user($guid) {
88
-	return _elgg_services()->entityTable->get($guid, 'user');
88
+    return _elgg_services()->entityTable->get($guid, 'user');
89 89
 }
90 90
 
91 91
 /**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  * @return \ElggUser|false Depending on success
97 97
  */
98 98
 function get_user_by_username($username) {
99
-	return _elgg_services()->usersTable->getByUsername($username);
99
+    return _elgg_services()->usersTable->getByUsername($username);
100 100
 }
101 101
 
102 102
 /**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  * @return \ElggUser
108 108
  */
109 109
 function get_user_by_code($hash) {
110
-	return _elgg_services()->persistentLogin->getUserFromHash($hash);
110
+    return _elgg_services()->persistentLogin->getUserFromHash($hash);
111 111
 }
112 112
 
113 113
 /**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
  * @return array
119 119
  */
120 120
 function get_user_by_email($email) {
121
-	return _elgg_services()->usersTable->getByEmail($email);
121
+    return _elgg_services()->usersTable->getByEmail($email);
122 122
 }
123 123
 
124 124
 /**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
  * @return \ElggUser[]|int
135 135
  */
136 136
 function find_active_users(array $options = []) {
137
-	return _elgg_services()->usersTable->findActive($options);
137
+    return _elgg_services()->usersTable->findActive($options);
138 138
 }
139 139
 
140 140
 /**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
  * @return bool
146 146
  */
147 147
 function send_new_password_request($user_guid) {
148
-	return _elgg_services()->passwords->sendNewPasswordRequest($user_guid);
148
+    return _elgg_services()->passwords->sendNewPasswordRequest($user_guid);
149 149
 }
150 150
 
151 151
 /**
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
  * @return bool
160 160
  */
161 161
 function force_user_password_reset($user_guid, $password) {
162
-	return _elgg_services()->passwords->forcePasswordReset($user_guid, $password);
162
+    return _elgg_services()->passwords->forcePasswordReset($user_guid, $password);
163 163
 }
164 164
 
165 165
 /**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
  * @return bool True on success
173 173
  */
174 174
 function execute_new_password_request($user_guid, $conf_code, $password = null) {
175
-	return _elgg_services()->passwords->executeNewPasswordReset($user_guid, $conf_code, $password);
175
+    return _elgg_services()->passwords->executeNewPasswordReset($user_guid, $conf_code, $password);
176 176
 }
177 177
 
178 178
 /**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
  * @return string
182 182
  */
183 183
 function generate_random_cleartext_password() {
184
-	return _elgg_services()->crypto->getRandomString(12, \ElggCrypto::CHARS_PASSWORD);
184
+    return _elgg_services()->crypto->getRandomString(12, \ElggCrypto::CHARS_PASSWORD);
185 185
 }
186 186
 
187 187
 
@@ -197,57 +197,57 @@  discard block
 block discarded – undo
197 197
  * @throws RegistrationException on invalid
198 198
  */
199 199
 function validate_username($username) {
200
-	global $CONFIG;
201
-
202
-	// Basic, check length
203
-	if (!isset($CONFIG->minusername)) {
204
-		$CONFIG->minusername = 4;
205
-	}
206
-
207
-	if (strlen($username) < $CONFIG->minusername) {
208
-		$msg = elgg_echo('registration:usernametooshort', [$CONFIG->minusername]);
209
-		throw new \RegistrationException($msg);
210
-	}
211
-
212
-	// username in the database has a limit of 128 characters
213
-	if (strlen($username) > 128) {
214
-		$msg = elgg_echo('registration:usernametoolong', [128]);
215
-		throw new \RegistrationException($msg);
216
-	}
217
-
218
-	// Blacklist for bad characters (partially nicked from mediawiki)
219
-	$blacklist = '/[' .
220
-		'\x{0080}-\x{009f}' . // iso-8859-1 control chars
221
-		'\x{00a0}' .          // non-breaking space
222
-		'\x{2000}-\x{200f}' . // various whitespace
223
-		'\x{2028}-\x{202f}' . // breaks and control chars
224
-		'\x{3000}' .          // ideographic space
225
-		'\x{e000}-\x{f8ff}' . // private use
226
-		']/u';
227
-
228
-	if (preg_match($blacklist, $username)) {
229
-		// @todo error message needs work
230
-		throw new \RegistrationException(elgg_echo('registration:invalidchars'));
231
-	}
232
-
233
-	// Belts and braces
234
-	// @todo Tidy into main unicode
235
-	$blacklist2 = '\'/\\"*& ?#%^(){}[]~?<>;|¬`@+=';
236
-
237
-	$blacklist2 = elgg_trigger_plugin_hook('username:character_blacklist', 'user',
238
-		['blacklist' => $blacklist2], $blacklist2);
239
-
240
-	for ($n = 0; $n < strlen($blacklist2); $n++) {
241
-		if (strpos($username, $blacklist2[$n]) !== false) {
242
-			$msg = elgg_echo('registration:invalidchars', [$blacklist2[$n], $blacklist2]);
243
-			$msg = htmlspecialchars($msg, ENT_QUOTES, 'UTF-8');
244
-			throw new \RegistrationException($msg);
245
-		}
246
-	}
247
-
248
-	$result = true;
249
-	return elgg_trigger_plugin_hook('registeruser:validate:username', 'all',
250
-		['username' => $username], $result);
200
+    global $CONFIG;
201
+
202
+    // Basic, check length
203
+    if (!isset($CONFIG->minusername)) {
204
+        $CONFIG->minusername = 4;
205
+    }
206
+
207
+    if (strlen($username) < $CONFIG->minusername) {
208
+        $msg = elgg_echo('registration:usernametooshort', [$CONFIG->minusername]);
209
+        throw new \RegistrationException($msg);
210
+    }
211
+
212
+    // username in the database has a limit of 128 characters
213
+    if (strlen($username) > 128) {
214
+        $msg = elgg_echo('registration:usernametoolong', [128]);
215
+        throw new \RegistrationException($msg);
216
+    }
217
+
218
+    // Blacklist for bad characters (partially nicked from mediawiki)
219
+    $blacklist = '/[' .
220
+        '\x{0080}-\x{009f}' . // iso-8859-1 control chars
221
+        '\x{00a0}' .          // non-breaking space
222
+        '\x{2000}-\x{200f}' . // various whitespace
223
+        '\x{2028}-\x{202f}' . // breaks and control chars
224
+        '\x{3000}' .          // ideographic space
225
+        '\x{e000}-\x{f8ff}' . // private use
226
+        ']/u';
227
+
228
+    if (preg_match($blacklist, $username)) {
229
+        // @todo error message needs work
230
+        throw new \RegistrationException(elgg_echo('registration:invalidchars'));
231
+    }
232
+
233
+    // Belts and braces
234
+    // @todo Tidy into main unicode
235
+    $blacklist2 = '\'/\\"*& ?#%^(){}[]~?<>;|¬`@+=';
236
+
237
+    $blacklist2 = elgg_trigger_plugin_hook('username:character_blacklist', 'user',
238
+        ['blacklist' => $blacklist2], $blacklist2);
239
+
240
+    for ($n = 0; $n < strlen($blacklist2); $n++) {
241
+        if (strpos($username, $blacklist2[$n]) !== false) {
242
+            $msg = elgg_echo('registration:invalidchars', [$blacklist2[$n], $blacklist2]);
243
+            $msg = htmlspecialchars($msg, ENT_QUOTES, 'UTF-8');
244
+            throw new \RegistrationException($msg);
245
+        }
246
+    }
247
+
248
+    $result = true;
249
+    return elgg_trigger_plugin_hook('registeruser:validate:username', 'all',
250
+        ['username' => $username], $result);
251 251
 }
252 252
 
253 253
 /**
@@ -259,20 +259,20 @@  discard block
 block discarded – undo
259 259
  * @throws RegistrationException on invalid
260 260
  */
261 261
 function validate_password($password) {
262
-	global $CONFIG;
262
+    global $CONFIG;
263 263
 
264
-	if (!isset($CONFIG->min_password_length)) {
265
-		$CONFIG->min_password_length = 6;
266
-	}
264
+    if (!isset($CONFIG->min_password_length)) {
265
+        $CONFIG->min_password_length = 6;
266
+    }
267 267
 
268
-	if (strlen($password) < $CONFIG->min_password_length) {
269
-		$msg = elgg_echo('registration:passwordtooshort', [$CONFIG->min_password_length]);
270
-		throw new \RegistrationException($msg);
271
-	}
268
+    if (strlen($password) < $CONFIG->min_password_length) {
269
+        $msg = elgg_echo('registration:passwordtooshort', [$CONFIG->min_password_length]);
270
+        throw new \RegistrationException($msg);
271
+    }
272 272
 
273
-	$result = true;
274
-	return elgg_trigger_plugin_hook('registeruser:validate:password', 'all',
275
-		['password' => $password], $result);
273
+    $result = true;
274
+    return elgg_trigger_plugin_hook('registeruser:validate:password', 'all',
275
+        ['password' => $password], $result);
276 276
 }
277 277
 
278 278
 /**
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
  * @return bool
285 285
  */
286 286
 function validate_email_address($address) {
287
-	if (!is_email_address($address)) {
288
-		throw new \RegistrationException(elgg_echo('registration:notemail'));
289
-	}
290
-
291
-	// Got here, so lets try a hook (defaulting to ok)
292
-	$result = true;
293
-	return elgg_trigger_plugin_hook('registeruser:validate:email', 'all',
294
-		['email' => $address], $result);
287
+    if (!is_email_address($address)) {
288
+        throw new \RegistrationException(elgg_echo('registration:notemail'));
289
+    }
290
+
291
+    // Got here, so lets try a hook (defaulting to ok)
292
+    $result = true;
293
+    return elgg_trigger_plugin_hook('registeruser:validate:email', 'all',
294
+        ['email' => $address], $result);
295 295
 }
296 296
 
297 297
 /**
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
  * @throws RegistrationException
309 309
  */
310 310
 function register_user($username, $password, $name, $email, $allow_multiple_emails = false) {
311
-	return _elgg_services()->usersTable->register($username, $password, $name, $email, $allow_multiple_emails);
311
+    return _elgg_services()->usersTable->register($username, $password, $name, $email, $allow_multiple_emails);
312 312
 }
313 313
 
314 314
 /**
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
  * @see elgg_validate_invite_code
321 321
  */
322 322
 function generate_invite_code($username) {
323
-	return _elgg_services()->usersTable->generateInviteCode($username);
323
+    return _elgg_services()->usersTable->generateInviteCode($username);
324 324
 }
325 325
 
326 326
 /**
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
  * @since 1.10
335 335
  */
336 336
 function elgg_validate_invite_code($username, $code) {
337
-	return _elgg_services()->usersTable->validateInviteCode($username, $code);
337
+    return _elgg_services()->usersTable->validateInviteCode($username, $code);
338 338
 }
339 339
 
340 340
 /**
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
  * @since 1.8.0
348 348
  */
349 349
 function elgg_set_user_validation_status($user_guid, $status, $method = '') {
350
-	return _elgg_services()->usersTable->setValidationStatus($user_guid, $status, $method);
350
+    return _elgg_services()->usersTable->setValidationStatus($user_guid, $status, $method);
351 351
 }
352 352
 
353 353
 /**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
  * @since 1.8.0
359 359
  */
360 360
 function elgg_get_user_validation_status($user_guid) {
361
-	return _elgg_services()->usersTable->getValidationStatus($user_guid);
361
+    return _elgg_services()->usersTable->getValidationStatus($user_guid);
362 362
 }
363 363
 
364 364
 /**
@@ -372,24 +372,24 @@  discard block
 block discarded – undo
372 372
  */
373 373
 function elgg_user_account_page_handler($page_elements, $handler) {
374 374
 
375
-	switch ($handler) {
376
-		case 'login':
377
-			echo elgg_view_resource("account/login");
378
-			break;
379
-		case 'forgotpassword':
380
-			echo elgg_view_resource("account/forgotten_password");
381
-			break;
382
-		case 'changepassword':
383
-			echo elgg_view_resource("account/change_password");
384
-			break;
385
-		case 'register':
386
-			echo elgg_view_resource("account/register");
387
-			break;
388
-		default:
389
-			return false;
390
-	}
391
-
392
-	return true;
375
+    switch ($handler) {
376
+        case 'login':
377
+            echo elgg_view_resource("account/login");
378
+            break;
379
+        case 'forgotpassword':
380
+            echo elgg_view_resource("account/forgotten_password");
381
+            break;
382
+        case 'changepassword':
383
+            echo elgg_view_resource("account/change_password");
384
+            break;
385
+        case 'register':
386
+            echo elgg_view_resource("account/register");
387
+            break;
388
+        default:
389
+            return false;
390
+    }
391
+
392
+    return true;
393 393
 }
394 394
 
395 395
 /**
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
  * @return string
404 404
  */
405 405
 function elgg_get_registration_url(array $query = [], $fragment = '') {
406
-	$url = elgg_normalize_url('register');
407
-	$url = elgg_http_add_url_query_elements($url, $query) . $fragment;
408
-	return elgg_trigger_plugin_hook('registration_url', 'site', $query, $url);
406
+    $url = elgg_normalize_url('register');
407
+    $url = elgg_http_add_url_query_elements($url, $query) . $fragment;
408
+    return elgg_trigger_plugin_hook('registration_url', 'site', $query, $url);
409 409
 }
410 410
 
411 411
 /**
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
  * @return string
419 419
  */
420 420
 function elgg_get_login_url(array $query = [], $fragment = '') {
421
-	$url = elgg_normalize_url('login');
422
-	$url = elgg_http_add_url_query_elements($url, $query) . $fragment;
423
-	return elgg_trigger_plugin_hook('login_url', 'site', $query, $url);
421
+    $url = elgg_normalize_url('login');
422
+    $url = elgg_http_add_url_query_elements($url, $query) . $fragment;
423
+    return elgg_trigger_plugin_hook('login_url', 'site', $query, $url);
424 424
 }
425 425
 
426 426
 /**
@@ -430,11 +430,11 @@  discard block
 block discarded – undo
430 430
  * @return void
431 431
  */
432 432
 function set_last_action($user_guid) {
433
-	$user = get_user($user_guid);
434
-	if (!$user) {
435
-		return;
436
-	}
437
-	_elgg_services()->usersTable->setLastAction($user);
433
+    $user = get_user($user_guid);
434
+    if (!$user) {
435
+        return;
436
+    }
437
+    _elgg_services()->usersTable->setLastAction($user);
438 438
 }
439 439
 
440 440
 /**
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
  * @return void
445 445
  */
446 446
 function set_last_login($user_guid) {
447
-	$user = get_user($user_guid);
448
-	if (!$user) {
449
-		return;
450
-	}
451
-	_elgg_services()->usersTable->setLastLogin($user);
447
+    $user = get_user($user_guid);
448
+    if (!$user) {
449
+        return;
450
+    }
451
+    _elgg_services()->usersTable->setLastLogin($user);
452 452
 }
453 453
 
454 454
 /**
@@ -463,23 +463,23 @@  discard block
 block discarded – undo
463 463
  * @access private
464 464
  */
465 465
 function user_avatar_hook($hook, $type, $return, $params) {
466
-	$user = elgg_extract('entity', $params);
467
-	$size = elgg_extract('size', $params, 'medium');
466
+    $user = elgg_extract('entity', $params);
467
+    $size = elgg_extract('size', $params, 'medium');
468 468
 
469
-	if (!$user instanceof ElggUser) {
470
-		return;
471
-	}
469
+    if (!$user instanceof ElggUser) {
470
+        return;
471
+    }
472 472
 
473
-	if (elgg_get_config('walled_garden')) {
474
-		return;
475
-	}
473
+    if (elgg_get_config('walled_garden')) {
474
+        return;
475
+    }
476 476
 
477
-	if (!$user->hasIcon($size, 'icon')) {
478
-		return;
479
-	}
477
+    if (!$user->hasIcon($size, 'icon')) {
478
+        return;
479
+    }
480 480
 	
481
-	$icon = $user->getIcon($size, 'icon');
482
-	return elgg_get_inline_url($icon, false);
481
+    $icon = $user->getIcon($size, 'icon');
482
+    return elgg_get_inline_url($icon, false);
483 483
 }
484 484
 
485 485
 /**
@@ -487,112 +487,112 @@  discard block
 block discarded – undo
487 487
  * @access private
488 488
  */
489 489
 function elgg_user_hover_menu($hook, $type, $return, $params) {
490
-	$user = elgg_extract('entity', $params);
491
-	/* @var \ElggUser $user */
490
+    $user = elgg_extract('entity', $params);
491
+    /* @var \ElggUser $user */
492 492
 
493
-	if (!$user instanceof \ElggUser) {
494
-		return;
495
-	}
493
+    if (!$user instanceof \ElggUser) {
494
+        return;
495
+    }
496 496
 
497
-	if (!elgg_is_logged_in()) {
498
-		return;
499
-	}
497
+    if (!elgg_is_logged_in()) {
498
+        return;
499
+    }
500 500
 	
501
-	if ($user->canEdit()) {
502
-		$return[] = ElggMenuItem::factory([
503
-			'name' => 'profile:edit',
504
-			'text' => elgg_echo('profile:edit'),
505
-			'icon' => 'address-card',
506
-			'href' => "profile/$user->username/edit",
507
-			'section' => (elgg_get_logged_in_user_guid() == $user->guid)? 'action' : 'admin',
508
-		]);
509
-
510
-		$return[] = ElggMenuItem::factory([
511
-			'name' => 'avatar:edit',
512
-			'text' => elgg_echo('avatar:edit'),
513
-			'icon' => 'image',
514
-			'href' => "avatar/edit/$user->username",
515
-			'section' => (elgg_get_logged_in_user_guid() == $user->guid)? 'action' : 'admin',
516
-		]);
517
-	}
518
-
519
-	// prevent admins from banning or deleting themselves
520
-	if (elgg_get_logged_in_user_guid() == $user->guid) {
521
-		return $return;
522
-	}
523
-
524
-	if (!elgg_is_admin_logged_in()) {
525
-		return $return;
526
-	}
501
+    if ($user->canEdit()) {
502
+        $return[] = ElggMenuItem::factory([
503
+            'name' => 'profile:edit',
504
+            'text' => elgg_echo('profile:edit'),
505
+            'icon' => 'address-card',
506
+            'href' => "profile/$user->username/edit",
507
+            'section' => (elgg_get_logged_in_user_guid() == $user->guid)? 'action' : 'admin',
508
+        ]);
509
+
510
+        $return[] = ElggMenuItem::factory([
511
+            'name' => 'avatar:edit',
512
+            'text' => elgg_echo('avatar:edit'),
513
+            'icon' => 'image',
514
+            'href' => "avatar/edit/$user->username",
515
+            'section' => (elgg_get_logged_in_user_guid() == $user->guid)? 'action' : 'admin',
516
+        ]);
517
+    }
518
+
519
+    // prevent admins from banning or deleting themselves
520
+    if (elgg_get_logged_in_user_guid() == $user->guid) {
521
+        return $return;
522
+    }
523
+
524
+    if (!elgg_is_admin_logged_in()) {
525
+        return $return;
526
+    }
527 527
 	
528
-	// following items are admin only
529
-	if (!$user->isBanned()) {
530
-		$return[] = ElggMenuItem::factory([
531
-			'name' => 'ban',
532
-			'text' => elgg_echo('ban'),
533
-			'icon' => 'ban',
534
-			'href' => "action/admin/user/ban?guid={$user->guid}",
535
-			'confirm' => true,
536
-			'section' => 'admin',
537
-		]);
538
-	} else {
539
-		$return[] = ElggMenuItem::factory([
540
-			'name' => 'unban',
541
-			'text' => elgg_echo('unban'),
542
-			'icon' => 'ban',
543
-			'href' => "action/admin/user/unban?guid={$user->guid}",
544
-			'confirm' => true,
545
-			'section' => 'admin',
546
-		]);
547
-	}
528
+    // following items are admin only
529
+    if (!$user->isBanned()) {
530
+        $return[] = ElggMenuItem::factory([
531
+            'name' => 'ban',
532
+            'text' => elgg_echo('ban'),
533
+            'icon' => 'ban',
534
+            'href' => "action/admin/user/ban?guid={$user->guid}",
535
+            'confirm' => true,
536
+            'section' => 'admin',
537
+        ]);
538
+    } else {
539
+        $return[] = ElggMenuItem::factory([
540
+            'name' => 'unban',
541
+            'text' => elgg_echo('unban'),
542
+            'icon' => 'ban',
543
+            'href' => "action/admin/user/unban?guid={$user->guid}",
544
+            'confirm' => true,
545
+            'section' => 'admin',
546
+        ]);
547
+    }
548 548
 	
549
-	$return[] = ElggMenuItem::factory([
550
-		'name' => 'delete',
551
-		'text' => elgg_echo('delete'),
552
-		'icon' => 'delete',
553
-		'href' => "action/admin/user/delete?guid={$user->guid}",
554
-		'confirm' => true,
555
-		'section' => 'admin',
556
-	]);
549
+    $return[] = ElggMenuItem::factory([
550
+        'name' => 'delete',
551
+        'text' => elgg_echo('delete'),
552
+        'icon' => 'delete',
553
+        'href' => "action/admin/user/delete?guid={$user->guid}",
554
+        'confirm' => true,
555
+        'section' => 'admin',
556
+    ]);
557 557
 	
558
-	$return[] = ElggMenuItem::factory([
559
-		'name' => 'resetpassword',
560
-		'text' => elgg_echo('resetpassword'),
561
-		'icon' => 'refresh',
562
-		'href' => "action/admin/user/resetpassword?guid={$user->guid}",
563
-		'confirm' => true,
564
-		'section' => 'admin',
565
-	]);
558
+    $return[] = ElggMenuItem::factory([
559
+        'name' => 'resetpassword',
560
+        'text' => elgg_echo('resetpassword'),
561
+        'icon' => 'refresh',
562
+        'href' => "action/admin/user/resetpassword?guid={$user->guid}",
563
+        'confirm' => true,
564
+        'section' => 'admin',
565
+    ]);
566 566
 	
567
-	if (!$user->isAdmin()) {
568
-		$return[] = ElggMenuItem::factory([
569
-			'name' => 'makeadmin',
570
-			'text' => elgg_echo('makeadmin'),
571
-			'icon' => 'level-up',
572
-			'href' => "action/admin/user/makeadmin?guid={$user->guid}",
573
-			'confirm' => true,
574
-			'section' => 'admin',
575
-		]);
576
-	} else {
577
-		$return[] = ElggMenuItem::factory([
578
-			'name' => 'removeadmin',
579
-			'text' => elgg_echo('removeadmin'),
580
-			'icon' => 'level-down',
581
-			'href' => "action/admin/user/removeadmin?guid={$user->guid}",
582
-			'confirm' => true,
583
-			'section' => 'admin',
584
-		]);
585
-	}
567
+    if (!$user->isAdmin()) {
568
+        $return[] = ElggMenuItem::factory([
569
+            'name' => 'makeadmin',
570
+            'text' => elgg_echo('makeadmin'),
571
+            'icon' => 'level-up',
572
+            'href' => "action/admin/user/makeadmin?guid={$user->guid}",
573
+            'confirm' => true,
574
+            'section' => 'admin',
575
+        ]);
576
+    } else {
577
+        $return[] = ElggMenuItem::factory([
578
+            'name' => 'removeadmin',
579
+            'text' => elgg_echo('removeadmin'),
580
+            'icon' => 'level-down',
581
+            'href' => "action/admin/user/removeadmin?guid={$user->guid}",
582
+            'confirm' => true,
583
+            'section' => 'admin',
584
+        ]);
585
+    }
586 586
 	
587
-	$return[] = ElggMenuItem::factory([
588
-		'name' => 'settings:edit',
589
-		'text' => elgg_echo('settings:edit'),
590
-		'icon' => 'cogs',
591
-		'href' => "settings/user/$user->username",
592
-		'section' => 'admin',
593
-	]);
594
-
595
-	return $return;
587
+    $return[] = ElggMenuItem::factory([
588
+        'name' => 'settings:edit',
589
+        'text' => elgg_echo('settings:edit'),
590
+        'icon' => 'cogs',
591
+        'href' => "settings/user/$user->username",
592
+        'section' => 'admin',
593
+    ]);
594
+
595
+    return $return;
596 596
 }
597 597
 
598 598
 /**
@@ -607,41 +607,41 @@  discard block
 block discarded – undo
607 607
  * @access private
608 608
  */
609 609
 function elgg_users_setup_entity_menu($hook, $type, $return, $params) {
610
-	if (elgg_in_context('widgets')) {
611
-		return $return;
612
-	}
613
-
614
-	$entity = $params['entity'];
615
-	if (!elgg_instanceof($entity, 'user')) {
616
-		return $return;
617
-	}
618
-	/* @var \ElggUser $entity */
619
-
620
-	if ($entity->isBanned()) {
621
-		$banned = elgg_echo('banned');
622
-		$options = [
623
-			'name' => 'banned',
624
-			'text' => "<span>$banned</span>",
625
-			'href' => false,
626
-			'priority' => 0,
627
-		];
628
-		$return = [\ElggMenuItem::factory($options)];
629
-	} else {
630
-		$return = [];
631
-		$location = $entity->location;
632
-		if (is_string($location) && $location !== '') {
633
-			$location = htmlspecialchars($location, ENT_QUOTES, 'UTF-8', false);
634
-			$options = [
635
-				'name' => 'location',
636
-				'text' => "<span>$location</span>",
637
-				'href' => false,
638
-				'priority' => 150,
639
-			];
640
-			$return[] = \ElggMenuItem::factory($options);
641
-		}
642
-	}
643
-
644
-	return $return;
610
+    if (elgg_in_context('widgets')) {
611
+        return $return;
612
+    }
613
+
614
+    $entity = $params['entity'];
615
+    if (!elgg_instanceof($entity, 'user')) {
616
+        return $return;
617
+    }
618
+    /* @var \ElggUser $entity */
619
+
620
+    if ($entity->isBanned()) {
621
+        $banned = elgg_echo('banned');
622
+        $options = [
623
+            'name' => 'banned',
624
+            'text' => "<span>$banned</span>",
625
+            'href' => false,
626
+            'priority' => 0,
627
+        ];
628
+        $return = [\ElggMenuItem::factory($options)];
629
+    } else {
630
+        $return = [];
631
+        $location = $entity->location;
632
+        if (is_string($location) && $location !== '') {
633
+            $location = htmlspecialchars($location, ENT_QUOTES, 'UTF-8', false);
634
+            $options = [
635
+                'name' => 'location',
636
+                'text' => "<span>$location</span>",
637
+                'href' => false,
638
+                'priority' => 150,
639
+            ];
640
+            $return[] = \ElggMenuItem::factory($options);
641
+        }
642
+    }
643
+
644
+    return $return;
645 645
 }
646 646
 
647 647
 /**
@@ -653,49 +653,49 @@  discard block
 block discarded – undo
653 653
  * @access private
654 654
  */
655 655
 function elgg_profile_fields_setup() {
656
-	global $CONFIG;
657
-
658
-	$profile_defaults =  [
659
-		'description' => 'longtext',
660
-		'briefdescription' => 'text',
661
-		'location' => 'location',
662
-		'interests' => 'tags',
663
-		'skills' => 'tags',
664
-		'contactemail' => 'email',
665
-		'phone' => 'text',
666
-		'mobile' => 'text',
667
-		'website' => 'url',
668
-		'twitter' => 'text',
669
-	];
670
-
671
-	$loaded_defaults = [];
672
-	$fieldlist = elgg_get_config('profile_custom_fields');
673
-	if ($fieldlist || $fieldlist === '0') {
674
-		$fieldlistarray = explode(',', $fieldlist);
675
-		foreach ($fieldlistarray as $listitem) {
676
-			if ($translation = elgg_get_config("admin_defined_profile_{$listitem}")) {
677
-				$type = elgg_get_config("admin_defined_profile_type_{$listitem}");
678
-				$loaded_defaults["admin_defined_profile_{$listitem}"] = $type;
679
-				add_translation(get_current_language(), ["profile:admin_defined_profile_{$listitem}" => $translation]);
680
-			}
681
-		}
682
-	}
683
-
684
-	if (count($loaded_defaults)) {
685
-		$CONFIG->profile_using_custom = true;
686
-		$profile_defaults = $loaded_defaults;
687
-	}
688
-
689
-	$CONFIG->profile_fields = elgg_trigger_plugin_hook('profile:fields', 'profile', null, $profile_defaults);
690
-
691
-	// register any tag metadata names
692
-	foreach ($CONFIG->profile_fields as $name => $type) {
693
-		if ($type == 'tags' || $type == 'location' || $type == 'tag') {
694
-			elgg_register_tag_metadata_name($name);
695
-			// register a tag name translation
696
-			add_translation(get_current_language(), ["tag_names:$name" => elgg_echo("profile:$name")]);
697
-		}
698
-	}
656
+    global $CONFIG;
657
+
658
+    $profile_defaults =  [
659
+        'description' => 'longtext',
660
+        'briefdescription' => 'text',
661
+        'location' => 'location',
662
+        'interests' => 'tags',
663
+        'skills' => 'tags',
664
+        'contactemail' => 'email',
665
+        'phone' => 'text',
666
+        'mobile' => 'text',
667
+        'website' => 'url',
668
+        'twitter' => 'text',
669
+    ];
670
+
671
+    $loaded_defaults = [];
672
+    $fieldlist = elgg_get_config('profile_custom_fields');
673
+    if ($fieldlist || $fieldlist === '0') {
674
+        $fieldlistarray = explode(',', $fieldlist);
675
+        foreach ($fieldlistarray as $listitem) {
676
+            if ($translation = elgg_get_config("admin_defined_profile_{$listitem}")) {
677
+                $type = elgg_get_config("admin_defined_profile_type_{$listitem}");
678
+                $loaded_defaults["admin_defined_profile_{$listitem}"] = $type;
679
+                add_translation(get_current_language(), ["profile:admin_defined_profile_{$listitem}" => $translation]);
680
+            }
681
+        }
682
+    }
683
+
684
+    if (count($loaded_defaults)) {
685
+        $CONFIG->profile_using_custom = true;
686
+        $profile_defaults = $loaded_defaults;
687
+    }
688
+
689
+    $CONFIG->profile_fields = elgg_trigger_plugin_hook('profile:fields', 'profile', null, $profile_defaults);
690
+
691
+    // register any tag metadata names
692
+    foreach ($CONFIG->profile_fields as $name => $type) {
693
+        if ($type == 'tags' || $type == 'location' || $type == 'tag') {
694
+            elgg_register_tag_metadata_name($name);
695
+            // register a tag name translation
696
+            add_translation(get_current_language(), ["tag_names:$name" => elgg_echo("profile:$name")]);
697
+        }
698
+    }
699 699
 }
700 700
 
701 701
 /**
@@ -708,15 +708,15 @@  discard block
 block discarded – undo
708 708
  * @access private
709 709
  */
710 710
 function elgg_avatar_page_handler($page) {
711
-	$user = get_user_by_username(elgg_extract(1, $page));
712
-	if ($user) {
713
-		elgg_set_page_owner_guid($user->getGUID());
714
-	}
715
-
716
-	if ($page[0] == 'edit') {
717
-		echo elgg_view_resource("avatar/edit");
718
-		return true;
719
-	}
711
+    $user = get_user_by_username(elgg_extract(1, $page));
712
+    if ($user) {
713
+        elgg_set_page_owner_guid($user->getGUID());
714
+    }
715
+
716
+    if ($page[0] == 'edit') {
717
+        echo elgg_view_resource("avatar/edit");
718
+        return true;
719
+    }
720 720
 }
721 721
 
722 722
 /**
@@ -727,14 +727,14 @@  discard block
 block discarded – undo
727 727
  * @access private
728 728
  */
729 729
 function elgg_profile_page_handler($page) {
730
-	$user = get_user_by_username($page[0]);
731
-	elgg_set_page_owner_guid($user->guid);
732
-
733
-	if ($page[1] == 'edit') {
734
-		echo elgg_view_resource("profile/edit");
735
-		return true;
736
-	}
737
-	return false;
730
+    $user = get_user_by_username($page[0]);
731
+    elgg_set_page_owner_guid($user->guid);
732
+
733
+    if ($page[1] == 'edit') {
734
+        echo elgg_view_resource("profile/edit");
735
+        return true;
736
+    }
737
+    return false;
738 738
 }
739 739
 
740 740
 /**
@@ -753,28 +753,28 @@  discard block
 block discarded – undo
753 753
  */
754 754
 function _elgg_user_page_menu($hook, $type, $return, $params) {
755 755
 	
756
-	$owner = elgg_get_page_owner_entity();
757
-	if (!$owner) {
758
-		return;
759
-	}
760
-
761
-	$return[] = \ElggMenuItem::factory([
762
-		'name' => 'edit_avatar',
763
-		'href' => "avatar/edit/{$owner->username}",
764
-		'text' => elgg_echo('avatar:edit'),
765
-		'section' => '1_profile',
766
-		'contexts' => ['settings'],
767
-	]);
756
+    $owner = elgg_get_page_owner_entity();
757
+    if (!$owner) {
758
+        return;
759
+    }
760
+
761
+    $return[] = \ElggMenuItem::factory([
762
+        'name' => 'edit_avatar',
763
+        'href' => "avatar/edit/{$owner->username}",
764
+        'text' => elgg_echo('avatar:edit'),
765
+        'section' => '1_profile',
766
+        'contexts' => ['settings'],
767
+    ]);
768 768
 	
769
-	$return[] = \ElggMenuItem::factory([
770
-		'name' => 'edit_profile',
771
-		'href' => "profile/{$owner->username}/edit",
772
-		'text' => elgg_echo('profile:edit'),
773
-		'section' => '1_profile',
774
-		'contexts' => ['settings'],
775
-	]);
769
+    $return[] = \ElggMenuItem::factory([
770
+        'name' => 'edit_profile',
771
+        'href' => "profile/{$owner->username}/edit",
772
+        'text' => elgg_echo('profile:edit'),
773
+        'section' => '1_profile',
774
+        'contexts' => ['settings'],
775
+    ]);
776 776
 	
777
-	return $return;
777
+    return $return;
778 778
 }
779 779
 
780 780
 /**
@@ -793,68 +793,68 @@  discard block
 block discarded – undo
793 793
  */
794 794
 function _elgg_user_topbar_menu($hook, $type, $return, $params) {
795 795
 	
796
-	$viewer = elgg_get_logged_in_user_entity();
797
-	if (!$viewer) {
798
-		return;
799
-	}
800
-
801
-	$toggle = elgg_view_icon('chevron-down', ['class' => 'elgg-state-closed']);
802
-	$toggle .= elgg_view_icon('chevron-up', ['class' => 'elgg-state-opened']);
803
-
804
-	// If JS fails here, allow easy access to place where they can upgrade/flush caches
805
-	$href = elgg_is_admin_logged_in() ? elgg_get_login_url() : '#';
806
-
807
-	$return[] = \ElggMenuItem::factory([
808
-		'name' => 'account',
809
-		'text' => elgg_echo('account') . $toggle,
810
-		'href' => $href,
811
-		'priority' => 800,
812
-		'section' => 'alt',
813
-		'child_menu' => [
814
-			'display' => 'dropdown',
815
-			'class' => 'elgg-topbar-child-menu',
816
-			'data-position' => json_encode([
817
-				'at' => 'right+10px bottom',
818
-				'my' => 'right top',
819
-				'collision' => 'fit fit',
820
-			]),
821
-		],
822
-	]);
796
+    $viewer = elgg_get_logged_in_user_entity();
797
+    if (!$viewer) {
798
+        return;
799
+    }
800
+
801
+    $toggle = elgg_view_icon('chevron-down', ['class' => 'elgg-state-closed']);
802
+    $toggle .= elgg_view_icon('chevron-up', ['class' => 'elgg-state-opened']);
803
+
804
+    // If JS fails here, allow easy access to place where they can upgrade/flush caches
805
+    $href = elgg_is_admin_logged_in() ? elgg_get_login_url() : '#';
806
+
807
+    $return[] = \ElggMenuItem::factory([
808
+        'name' => 'account',
809
+        'text' => elgg_echo('account') . $toggle,
810
+        'href' => $href,
811
+        'priority' => 800,
812
+        'section' => 'alt',
813
+        'child_menu' => [
814
+            'display' => 'dropdown',
815
+            'class' => 'elgg-topbar-child-menu',
816
+            'data-position' => json_encode([
817
+                'at' => 'right+10px bottom',
818
+                'my' => 'right top',
819
+                'collision' => 'fit fit',
820
+            ]),
821
+        ],
822
+    ]);
823 823
 	
824
-	$return[] = \ElggMenuItem::factory([
825
-		'name' => 'usersettings',
826
-		'parent_name' => 'account',
827
-		'href' => "settings/user/{$viewer->username}",
828
-		'text' => elgg_echo('settings'),
829
-		'icon' => 'cogs',
830
-		'priority' => 300,
831
-		'section' => 'alt',
832
-	]);
824
+    $return[] = \ElggMenuItem::factory([
825
+        'name' => 'usersettings',
826
+        'parent_name' => 'account',
827
+        'href' => "settings/user/{$viewer->username}",
828
+        'text' => elgg_echo('settings'),
829
+        'icon' => 'cogs',
830
+        'priority' => 300,
831
+        'section' => 'alt',
832
+    ]);
833 833
 	
834
-	if ($viewer->isAdmin()) {
835
-		$return[] = \ElggMenuItem::factory([
836
-			'name' => 'administration',
837
-			'parent_name' => 'account',
838
-			'href' => 'admin',
839
-			'text' => elgg_echo('admin'),
840
-			'icon' => 'tasks',
841
-			'priority' => 800,
842
-			'section' => 'alt',
843
-		]);
844
-	}
834
+    if ($viewer->isAdmin()) {
835
+        $return[] = \ElggMenuItem::factory([
836
+            'name' => 'administration',
837
+            'parent_name' => 'account',
838
+            'href' => 'admin',
839
+            'text' => elgg_echo('admin'),
840
+            'icon' => 'tasks',
841
+            'priority' => 800,
842
+            'section' => 'alt',
843
+        ]);
844
+    }
845 845
 	
846
-	$return[] = \ElggMenuItem::factory([
847
-		'name' => 'logout',
848
-		'parent_name' => 'account',
849
-		'href' => 'action/logout',
850
-		'text' => elgg_echo('logout'),
851
-		'icon' => 'sign-out',
852
-		'is_action' => true,
853
-		'priority' => 900,
854
-		'section' => 'alt',
855
-	]);
846
+    $return[] = \ElggMenuItem::factory([
847
+        'name' => 'logout',
848
+        'parent_name' => 'account',
849
+        'href' => 'action/logout',
850
+        'text' => elgg_echo('logout'),
851
+        'icon' => 'sign-out',
852
+        'is_action' => true,
853
+        'priority' => 900,
854
+        'section' => 'alt',
855
+    ]);
856 856
 	
857
-	return $return;
857
+    return $return;
858 858
 }
859 859
 
860 860
 /**
@@ -868,13 +868,13 @@  discard block
 block discarded – undo
868 868
  */
869 869
 function _elgg_user_set_icon_file($hook, $type, $icon, $params) {
870 870
 
871
-	$entity = elgg_extract('entity', $params);
872
-	$size = elgg_extract('size', $params, 'medium');
871
+    $entity = elgg_extract('entity', $params);
872
+    $size = elgg_extract('size', $params, 'medium');
873 873
 
874
-	$icon->owner_guid = $entity->guid;
875
-	$icon->setFilename("profile/{$entity->guid}{$size}.jpg");
874
+    $icon->owner_guid = $entity->guid;
875
+    $icon->setFilename("profile/{$entity->guid}{$size}.jpg");
876 876
 	
877
-	return $icon;
877
+    return $icon;
878 878
 }
879 879
 
880 880
 /**
@@ -889,27 +889,27 @@  discard block
 block discarded – undo
889 889
  */
890 890
 function _elgg_user_get_subscriber_unban_action($hook, $type, $return_value, $params) {
891 891
 	
892
-	if (!elgg_get_config('security_notify_user_ban')) {
893
-		return;
894
-	}
892
+    if (!elgg_get_config('security_notify_user_ban')) {
893
+        return;
894
+    }
895 895
 	
896
-	$event = elgg_extract('event', $params);
897
-	if (!($event instanceof \Elgg\Notifications\Event)) {
898
-		return;
899
-	}
896
+    $event = elgg_extract('event', $params);
897
+    if (!($event instanceof \Elgg\Notifications\Event)) {
898
+        return;
899
+    }
900 900
 	
901
-	if ($event->getAction() !== 'unban') {
902
-		return;
903
-	}
901
+    if ($event->getAction() !== 'unban') {
902
+        return;
903
+    }
904 904
 	
905
-	$user = $event->getObject();
906
-	if (!($user instanceof \ElggUser)) {
907
-		return;
908
-	}
905
+    $user = $event->getObject();
906
+    if (!($user instanceof \ElggUser)) {
907
+        return;
908
+    }
909 909
 	
910
-	$return_value[$user->getGUID()] = ['email'];
910
+    $return_value[$user->getGUID()] = ['email'];
911 911
 	
912
-	return $return_value;
912
+    return $return_value;
913 913
 }
914 914
 
915 915
 /**
@@ -925,29 +925,29 @@  discard block
 block discarded – undo
925 925
  */
926 926
 function _elgg_user_ban_notification($event, $type, $user) {
927 927
 	
928
-	if (!elgg_get_config('security_notify_user_ban')) {
929
-		return;
930
-	}
928
+    if (!elgg_get_config('security_notify_user_ban')) {
929
+        return;
930
+    }
931 931
 	
932
-	if (!($user instanceof \ElggUser)) {
933
-		return;
934
-	}
932
+    if (!($user instanceof \ElggUser)) {
933
+        return;
934
+    }
935 935
 	
936
-	$site = elgg_get_site_entity();
936
+    $site = elgg_get_site_entity();
937 937
 	
938
-	$subject = elgg_echo('user:notification:ban:subject', [$site->name], $language);
939
-	$body = elgg_echo('user:notification:ban:body', [
940
-		$recipient->name,
941
-		$site->name,
942
-		$site->getURL(),
943
-	], $language);
938
+    $subject = elgg_echo('user:notification:ban:subject', [$site->name], $language);
939
+    $body = elgg_echo('user:notification:ban:body', [
940
+        $recipient->name,
941
+        $site->name,
942
+        $site->getURL(),
943
+    ], $language);
944 944
 	
945
-	$params = [
946
-		'action' => 'ban',
947
-		'object' => $user,
948
-	];
945
+    $params = [
946
+        'action' => 'ban',
947
+        'object' => $user,
948
+    ];
949 949
 	
950
-	notify_user($user->getGUID(), $site->getGUID(), $subject, $body, $params, ['email']);
950
+    notify_user($user->getGUID(), $site->getGUID(), $subject, $body, $params, ['email']);
951 951
 }
952 952
 
953 953
 /**
@@ -962,34 +962,34 @@  discard block
 block discarded – undo
962 962
  */
963 963
 function _elgg_user_prepare_unban_notification($hook, $type, $return_value, $params) {
964 964
 	
965
-	if (!($return_value instanceof \Elgg\Notifications\Notification)) {
966
-		return;
967
-	}
965
+    if (!($return_value instanceof \Elgg\Notifications\Notification)) {
966
+        return;
967
+    }
968 968
 	
969
-	$recipient = elgg_extract('recipient', $params);
970
-	$object = elgg_extract('object', $params);
971
-	$language = elgg_extract('language', $params);
969
+    $recipient = elgg_extract('recipient', $params);
970
+    $object = elgg_extract('object', $params);
971
+    $language = elgg_extract('language', $params);
972 972
 	
973
-	if (!($recipient instanceof ElggUser) || !($object instanceof ElggUser)) {
974
-		return;
975
-	}
973
+    if (!($recipient instanceof ElggUser) || !($object instanceof ElggUser)) {
974
+        return;
975
+    }
976 976
 	
977
-	if ($recipient->getGUID() !== $object->getGUID()) {
978
-		return;
979
-	}
977
+    if ($recipient->getGUID() !== $object->getGUID()) {
978
+        return;
979
+    }
980 980
 	
981
-	$site = elgg_get_site_entity();
981
+    $site = elgg_get_site_entity();
982 982
 	
983
-	$return_value->subject = elgg_echo('user:notification:unban:subject', [$site->name], $language);
984
-	$return_value->body = elgg_echo('user:notification:unban:body', [
985
-		$recipient->name,
986
-		$site->name,
987
-		$site->getURL(),
988
-	], $language);
989
-
990
-	$return_value->url = $recipient->getURL();
983
+    $return_value->subject = elgg_echo('user:notification:unban:subject', [$site->name], $language);
984
+    $return_value->body = elgg_echo('user:notification:unban:body', [
985
+        $recipient->name,
986
+        $site->name,
987
+        $site->getURL(),
988
+    ], $language);
989
+
990
+    $return_value->url = $recipient->getURL();
991 991
 	
992
-	return $return_value;
992
+    return $return_value;
993 993
 }
994 994
 
995 995
 /**
@@ -1000,42 +1000,42 @@  discard block
 block discarded – undo
1000 1000
  */
1001 1001
 function users_init() {
1002 1002
 
1003
-	elgg_register_page_handler('register', 'elgg_user_account_page_handler');
1004
-	elgg_register_page_handler('forgotpassword', 'elgg_user_account_page_handler');
1005
-	elgg_register_page_handler('changepassword', 'elgg_user_account_page_handler');
1006
-	elgg_register_page_handler('login', 'elgg_user_account_page_handler');
1007
-	elgg_register_page_handler('avatar', 'elgg_avatar_page_handler');
1008
-	elgg_register_page_handler('profile', 'elgg_profile_page_handler');
1003
+    elgg_register_page_handler('register', 'elgg_user_account_page_handler');
1004
+    elgg_register_page_handler('forgotpassword', 'elgg_user_account_page_handler');
1005
+    elgg_register_page_handler('changepassword', 'elgg_user_account_page_handler');
1006
+    elgg_register_page_handler('login', 'elgg_user_account_page_handler');
1007
+    elgg_register_page_handler('avatar', 'elgg_avatar_page_handler');
1008
+    elgg_register_page_handler('profile', 'elgg_profile_page_handler');
1009 1009
 
1010
-	elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'elgg_user_hover_menu');
1011
-	elgg_register_plugin_hook_handler('register', 'menu:page', '_elgg_user_page_menu');
1012
-	elgg_register_plugin_hook_handler('register', 'menu:topbar', '_elgg_user_topbar_menu');
1010
+    elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'elgg_user_hover_menu');
1011
+    elgg_register_plugin_hook_handler('register', 'menu:page', '_elgg_user_page_menu');
1012
+    elgg_register_plugin_hook_handler('register', 'menu:topbar', '_elgg_user_topbar_menu');
1013 1013
 
1014
-	elgg_register_action('login', '', 'public');
1015
-	elgg_register_action('logout');
1016
-	elgg_register_action('register', '', 'public');
1017
-	elgg_register_action('useradd', '', 'admin');
1018
-	elgg_register_action('avatar/upload');
1019
-	elgg_register_action('avatar/crop');
1020
-	elgg_register_action('avatar/remove');
1021
-	elgg_register_action('profile/edit');
1014
+    elgg_register_action('login', '', 'public');
1015
+    elgg_register_action('logout');
1016
+    elgg_register_action('register', '', 'public');
1017
+    elgg_register_action('useradd', '', 'admin');
1018
+    elgg_register_action('avatar/upload');
1019
+    elgg_register_action('avatar/crop');
1020
+    elgg_register_action('avatar/remove');
1021
+    elgg_register_action('profile/edit');
1022 1022
 
1023
-	elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'user_avatar_hook');
1023
+    elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'user_avatar_hook');
1024 1024
 
1025
-	elgg_register_action('user/changepassword', '', 'public');
1026
-	elgg_register_action('user/requestnewpassword', '', 'public');
1025
+    elgg_register_action('user/changepassword', '', 'public');
1026
+    elgg_register_action('user/requestnewpassword', '', 'public');
1027 1027
 
1028
-	// Register the user type
1029
-	elgg_register_entity_type('user', '');
1028
+    // Register the user type
1029
+    elgg_register_entity_type('user', '');
1030 1030
 
1031
-	elgg_register_plugin_hook_handler('register', 'menu:entity', 'elgg_users_setup_entity_menu', 501);
1031
+    elgg_register_plugin_hook_handler('register', 'menu:entity', 'elgg_users_setup_entity_menu', 501);
1032 1032
 
1033
-	elgg_register_plugin_hook_handler('entity:icon:file', 'user', '_elgg_user_set_icon_file');
1033
+    elgg_register_plugin_hook_handler('entity:icon:file', 'user', '_elgg_user_set_icon_file');
1034 1034
 	
1035
-	elgg_register_notification_event('user', '', ['unban']);
1036
-	elgg_register_plugin_hook_handler('get', 'subscriptions', '_elgg_user_get_subscriber_ban_action');
1037
-	elgg_register_event_handler('ban', 'user', '_elgg_user_ban_notification');
1038
-	elgg_register_plugin_hook_handler('prepare', 'notification:unban:user:', '_elgg_user_prepare_unban_notification');
1035
+    elgg_register_notification_event('user', '', ['unban']);
1036
+    elgg_register_plugin_hook_handler('get', 'subscriptions', '_elgg_user_get_subscriber_ban_action');
1037
+    elgg_register_event_handler('ban', 'user', '_elgg_user_ban_notification');
1038
+    elgg_register_plugin_hook_handler('prepare', 'notification:unban:user:', '_elgg_user_prepare_unban_notification');
1039 1039
 	
1040 1040
 }
1041 1041
 
@@ -1051,13 +1051,13 @@  discard block
 block discarded – undo
1051 1051
  * @access private
1052 1052
  */
1053 1053
 function users_test($hook, $type, $value, $params) {
1054
-	global $CONFIG;
1055
-	$value[] = "{$CONFIG->path}engine/tests/ElggUserTest.php";
1056
-	return $value;
1054
+    global $CONFIG;
1055
+    $value[] = "{$CONFIG->path}engine/tests/ElggUserTest.php";
1056
+    return $value;
1057 1057
 }
1058 1058
 
1059 1059
 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
1060
-	$events->registerHandler('init', 'system', 'users_init', 0);
1061
-	$events->registerHandler('init', 'system', 'elgg_profile_fields_setup', 10000); // Ensure this runs after other plugins
1062
-	$hooks->registerHandler('unit_test', 'system', 'users_test');
1060
+    $events->registerHandler('init', 'system', 'users_init', 0);
1061
+    $events->registerHandler('init', 'system', 'elgg_profile_fields_setup', 10000); // Ensure this runs after other plugins
1062
+    $hooks->registerHandler('unit_test', 'system', 'users_test');
1063 1063
 };
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 	}
217 217
 
218 218
 	// Blacklist for bad characters (partially nicked from mediawiki)
219
-	$blacklist = '/[' .
220
-		'\x{0080}-\x{009f}' . // iso-8859-1 control chars
221
-		'\x{00a0}' .          // non-breaking space
222
-		'\x{2000}-\x{200f}' . // various whitespace
223
-		'\x{2028}-\x{202f}' . // breaks and control chars
224
-		'\x{3000}' .          // ideographic space
225
-		'\x{e000}-\x{f8ff}' . // private use
219
+	$blacklist = '/['.
220
+		'\x{0080}-\x{009f}'.// iso-8859-1 control chars
221
+		'\x{00a0}'.// non-breaking space
222
+		'\x{2000}-\x{200f}'.// various whitespace
223
+		'\x{2028}-\x{202f}'.// breaks and control chars
224
+		'\x{3000}'.// ideographic space
225
+		'\x{e000}-\x{f8ff}'.// private use
226 226
 		']/u';
227 227
 
228 228
 	if (preg_match($blacklist, $username)) {
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
  */
405 405
 function elgg_get_registration_url(array $query = [], $fragment = '') {
406 406
 	$url = elgg_normalize_url('register');
407
-	$url = elgg_http_add_url_query_elements($url, $query) . $fragment;
407
+	$url = elgg_http_add_url_query_elements($url, $query).$fragment;
408 408
 	return elgg_trigger_plugin_hook('registration_url', 'site', $query, $url);
409 409
 }
410 410
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
  */
420 420
 function elgg_get_login_url(array $query = [], $fragment = '') {
421 421
 	$url = elgg_normalize_url('login');
422
-	$url = elgg_http_add_url_query_elements($url, $query) . $fragment;
422
+	$url = elgg_http_add_url_query_elements($url, $query).$fragment;
423 423
 	return elgg_trigger_plugin_hook('login_url', 'site', $query, $url);
424 424
 }
425 425
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 			'text' => elgg_echo('profile:edit'),
505 505
 			'icon' => 'address-card',
506 506
 			'href' => "profile/$user->username/edit",
507
-			'section' => (elgg_get_logged_in_user_guid() == $user->guid)? 'action' : 'admin',
507
+			'section' => (elgg_get_logged_in_user_guid() == $user->guid) ? 'action' : 'admin',
508 508
 		]);
509 509
 
510 510
 		$return[] = ElggMenuItem::factory([
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 			'text' => elgg_echo('avatar:edit'),
513 513
 			'icon' => 'image',
514 514
 			'href' => "avatar/edit/$user->username",
515
-			'section' => (elgg_get_logged_in_user_guid() == $user->guid)? 'action' : 'admin',
515
+			'section' => (elgg_get_logged_in_user_guid() == $user->guid) ? 'action' : 'admin',
516 516
 		]);
517 517
 	}
518 518
 
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 function elgg_profile_fields_setup() {
656 656
 	global $CONFIG;
657 657
 
658
-	$profile_defaults =  [
658
+	$profile_defaults = [
659 659
 		'description' => 'longtext',
660 660
 		'briefdescription' => 'text',
661 661
 		'location' => 'location',
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 
807 807
 	$return[] = \ElggMenuItem::factory([
808 808
 		'name' => 'account',
809
-		'text' => elgg_echo('account') . $toggle,
809
+		'text' => elgg_echo('account').$toggle,
810 810
 		'href' => $href,
811 811
 		'priority' => 800,
812 812
 		'section' => 'alt',
Please login to merge, or discard this patch.