Browse Source

Replace x() by isset(), !empty() or defaults()

- Remove extraneous parentheses around empty() calls
- Remove duplicate calls to intval(), count() or strlen() after empty()
- Replace ternary operators outputting binary value with empty() return value
- Rewrite defaults() without x()
tags/2019.01
Hypolite Petovan 7 months ago
parent
commit
458981f75c
100 changed files with 908 additions and 923 deletions
  1. 20
    21
      boot.php
  2. 5
    5
      doc/themes.md
  3. 109
    112
      include/api.php
  4. 18
    18
      include/conversation.php
  5. 320
    317
      mod/admin.php
  6. 2
    2
      mod/api.php
  7. 8
    8
      mod/cal.php
  8. 1
    1
      mod/common.php
  9. 1
    1
      mod/contactgroup.php
  10. 1
    1
      mod/crepair.php
  11. 3
    3
      mod/delegate.php
  12. 3
    3
      mod/dfrn_confirm.php
  13. 13
    13
      mod/dfrn_notify.php
  14. 18
    19
      mod/dfrn_poll.php
  15. 24
    24
      mod/dfrn_request.php
  16. 13
    13
      mod/directory.php
  17. 1
    1
      mod/dirfind.php
  18. 2
    2
      mod/display.php
  19. 2
    2
      mod/fbrowser.php
  20. 2
    2
      mod/friendica.php
  21. 7
    7
      mod/hcard.php
  22. 2
    2
      mod/home.php
  23. 3
    3
      mod/item.php
  24. 1
    1
      mod/like.php
  25. 1
    1
      mod/localtime.php
  26. 5
    5
      mod/manage.php
  27. 6
    6
      mod/message.php
  28. 1
    1
      mod/modexp.php
  29. 28
    28
      mod/network.php
  30. 1
    1
      mod/noscrape.php
  31. 4
    4
      mod/oexchange.php
  32. 1
    1
      mod/openid.php
  33. 2
    2
      mod/parse_url.php
  34. 6
    6
      mod/photos.php
  35. 4
    4
      mod/ping.php
  36. 6
    6
      mod/poco.php
  37. 3
    3
      mod/poke.php
  38. 1
    1
      mod/profile.php
  39. 1
    1
      mod/profiles.php
  40. 1
    1
      mod/pubsubhubbub.php
  41. 1
    1
      mod/redir.php
  42. 10
    10
      mod/register.php
  43. 3
    3
      mod/removeme.php
  44. 8
    20
      mod/search.php
  45. 70
    70
      mod/settings.php
  46. 1
    1
      mod/starred.php
  47. 1
    1
      mod/subthread.php
  48. 1
    1
      mod/suggest.php
  49. 1
    1
      mod/tagger.php
  50. 1
    1
      mod/tagrm.php
  51. 2
    2
      mod/uimport.php
  52. 5
    5
      mod/wall_attach.php
  53. 6
    6
      mod/wall_upload.php
  54. 4
    4
      mod/wallmessage.php
  55. 1
    1
      mod/webfinger.php
  56. 2
    2
      spec/dfrn2_contact_request.svg
  57. 2
    2
      src/App.php
  58. 2
    2
      src/Content/Nav.php
  59. 3
    3
      src/Content/OEmbed.php
  60. 12
    12
      src/Content/Text/BBCode.php
  61. 2
    2
      src/Content/Text/HTML.php
  62. 1
    1
      src/Core/Authentication.php
  63. 6
    6
      src/Core/Console/AutomaticInstallation.php
  64. 2
    2
      src/Core/NotificationsManager.php
  65. 1
    1
      src/Core/Session/DatabaseSessionHandler.php
  66. 1
    1
      src/Core/UserImport.php
  67. 1
    1
      src/Database/DBStructure.php
  68. 6
    7
      src/Model/Contact.php
  69. 2
    2
      src/Model/FileTag.php
  70. 2
    2
      src/Model/Group.php
  71. 9
    9
      src/Model/Item.php
  72. 1
    1
      src/Model/Photo.php
  73. 18
    18
      src/Model/Profile.php
  74. 4
    4
      src/Model/User.php
  75. 1
    1
      src/Module/Contact.php
  76. 2
    2
      src/Module/Feed.php
  77. 7
    7
      src/Module/Login.php
  78. 4
    4
      src/Module/Magic.php
  79. 2
    2
      src/Network/Probe.php
  80. 3
    3
      src/Object/Post.php
  81. 4
    4
      src/Protocol/DFRN.php
  82. 1
    1
      src/Protocol/PortableContact.php
  83. 1
    1
      src/Render/FriendicaSmarty.php
  84. 1
    1
      src/Render/FriendicaSmartyEngine.php
  85. 1
    1
      src/Util/Emailer.php
  86. 6
    6
      src/Util/Network.php
  87. 1
    1
      src/Util/Temporal.php
  88. 1
    1
      src/Worker/OnePoll.php
  89. 1
    1
      tests/src/Core/Console/AutomaticInstallationConsoleTest.php
  90. 7
    7
      view/php/default.php
  91. 3
    3
      view/php/minimal.php
  92. 1
    1
      view/php/none.php
  93. 1
    1
      view/theme/duepuntozero/style.php
  94. 1
    1
      view/theme/frio/php/PHPColors/Color.php
  95. 8
    8
      view/theme/frio/php/default.php
  96. 1
    1
      view/theme/frio/php/frio_boot.php
  97. 6
    6
      view/theme/frio/php/standard.php
  98. 1
    1
      view/theme/frio/style.php
  99. 1
    1
      view/theme/frio/theme.php
  100. 0
    0
      view/theme/smoothly/php/default.php

+ 20
- 21
boot.php View File

@@ -341,12 +341,13 @@ function get_app()
341 341
 /**
342 342
  * @brief Multi-purpose function to check variable state.
343 343
  *
344
- * Usage: x($var) or $x($array, 'key')
344
+ * Usage: x($var) or x($array, 'key')
345 345
  *
346 346
  * returns false if variable/key is not set
347 347
  * if variable is set, returns 1 if has 'non-zero' value, otherwise returns 0.
348 348
  * e.g. x('') or x(0) returns 0;
349 349
  *
350
+ * @deprecated since version 2018.12
350 351
  * @param string|array $s variable to check
351 352
  * @param string       $k key inside the array to check
352 353
  *
@@ -383,13 +384,12 @@ function x($s, $k = null)
383 384
  * - defaults($var, $default)
384 385
  * - defaults($array, 'key', $default)
385 386
  *
387
+ * @param array $args
386 388
  * @brief Returns a defaut value if the provided variable or array key is falsy
387
- * @see x()
388 389
  * @return mixed
389 390
  */
390
-function defaults() {
391
-	$args = func_get_args();
392
-
391
+function defaults(...$args)
392
+{
393 393
 	if (count($args) < 2) {
394 394
 		throw new BadFunctionCallException('defaults() requires at least 2 parameters');
395 395
 	}
@@ -400,16 +400,15 @@ function defaults() {
400 400
 		throw new BadFunctionCallException('defaults($arr, $key, $def) $key is null');
401 401
 	}
402 402
 
403
-	$default = array_pop($args);
403
+	// The default value always is the last argument
404
+	$return = array_pop($args);
404 405
 
405
-	if (call_user_func_array('x', $args)) {
406
-		if (count($args) === 1) {
407
-			$return = $args[0];
408
-		} else {
409
-			$return = $args[0][$args[1]];
410
-		}
411
-	} else {
412
-		$return = $default;
406
+	if (count($args) == 2 && is_array($args[0]) && !empty($args[0][$args[1]])) {
407
+		$return = $args[0][$args[1]];
408
+	}
409
+
410
+	if (count($args) == 1 && !empty($args[0])) {
411
+		$return = $args[0];
413 412
 	}
414 413
 
415 414
 	return $return;
@@ -446,15 +445,15 @@ function public_contact()
446 445
 {
447 446
 	static $public_contact_id = false;
448 447
 
449
-	if (!$public_contact_id && x($_SESSION, 'authenticated')) {
450
-		if (x($_SESSION, 'my_address')) {
448
+	if (!$public_contact_id && !empty($_SESSION['authenticated'])) {
449
+		if (!empty($_SESSION['my_address'])) {
451 450
 			// Local user
452 451
 			$public_contact_id = intval(Contact::getIdForURL($_SESSION['my_address'], 0, true));
453
-		} elseif (x($_SESSION, 'visitor_home')) {
452
+		} elseif (!empty($_SESSION['visitor_home'])) {
454 453
 			// Remote user
455 454
 			$public_contact_id = intval(Contact::getIdForURL($_SESSION['visitor_home'], 0, true));
456 455
 		}
457
-	} elseif (!x($_SESSION, 'authenticated')) {
456
+	} elseif (empty($_SESSION['authenticated'])) {
458 457
 		$public_contact_id = false;
459 458
 	}
460 459
 
@@ -479,7 +478,7 @@ function remote_user()
479 478
 		return false;
480 479
 	}
481 480
 
482
-	if (x($_SESSION, 'authenticated') && x($_SESSION, 'visitor_id')) {
481
+	if (!empty($_SESSION['authenticated']) && !empty($_SESSION['visitor_id'])) {
483 482
 		return intval($_SESSION['visitor_id']);
484 483
 	}
485 484
 	return false;
@@ -499,7 +498,7 @@ function notice($s)
499 498
 	}
500 499
 
501 500
 	$a = get_app();
502
-	if (!x($_SESSION, 'sysmsg')) {
501
+	if (empty($_SESSION['sysmsg'])) {
503 502
 		$_SESSION['sysmsg'] = [];
504 503
 	}
505 504
 	if ($a->interactive) {
@@ -522,7 +521,7 @@ function info($s)
522 521
 		return;
523 522
 	}
524 523
 
525
-	if (!x($_SESSION, 'sysmsg_info')) {
524
+	if (empty($_SESSION['sysmsg_info'])) {
526 525
 		$_SESSION['sysmsg_info'] = [];
527 526
 	}
528 527
 	if ($a->interactive) {

+ 5
- 5
doc/themes.md View File

@@ -181,13 +181,13 @@ Next take the default.php file found in the /view direcotry and exchange the asi
181 181
 So the central part of the file now looks like this:
182 182
 
183 183
     <body>
184
-        <?php if(x($page,'nav')) echo $page['nav']; ?>
185
-        <aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></aside>
186
-        <section><?php if(x($page,'content')) echo $page['content']; ?>
184
+        <?php if(!empty($page['nav'])) echo $page['nav']; ?>
185
+        <aside><?php if(!empty($page['right_aside'])) echo $page['right_aside']; ?></aside>
186
+        <section><?php if(!empty($page['content'])) echo $page['content']; ?>
187 187
                 <div id="page-footer"></div>
188 188
         </section>
189
-        <right_aside><?php if(x($page,'aside')) echo $page['aside']; ?></right_aside>
190
-        <footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
189
+        <right_aside><?php if(!empty($page['aside'])) echo $page['aside']; ?></right_aside>
190
+        <footer><?php if(!empty($page['footer'])) echo $page['footer']; ?></footer>
191 191
     </body>
192 192
 
193 193
 Finally we need a style.css file, inheriting the definitions from the parent theme and containing out changes for the new theme.

+ 109
- 112
include/api.php View File

@@ -68,7 +68,7 @@ $called_api = [];
68 68
  */
69 69
 function api_user()
70 70
 {
71
-	if (x($_SESSION, 'allow_api')) {
71
+	if (!empty($_SESSION['allow_api'])) {
72 72
 		return local_user();
73 73
 	}
74 74
 
@@ -186,8 +186,8 @@ function api_login(App $a)
186 186
 	}
187 187
 
188 188
 	// workaround for HTTP-auth in CGI mode
189
-	if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
190
-		$userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
189
+	if (!empty($_SERVER['REDIRECT_REMOTE_USER'])) {
190
+		$userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6));
191 191
 		if (strlen($userpass)) {
192 192
 			list($name, $password) = explode(':', $userpass);
193 193
 			$_SERVER['PHP_AUTH_USER'] = $name;
@@ -195,7 +195,7 @@ function api_login(App $a)
195 195
 		}
196 196
 	}
197 197
 
198
-	if (!x($_SERVER, 'PHP_AUTH_USER')) {
198
+	if (empty($_SERVER['PHP_AUTH_USER'])) {
199 199
 		Logger::log('API_login: ' . print_r($_SERVER, true), Logger::DEBUG);
200 200
 		header('WWW-Authenticate: Basic realm="Friendica"');
201 201
 		throw new UnauthorizedException("This API requires login");
@@ -396,7 +396,7 @@ function api_call(App $a)
396 396
 					case "json":
397 397
 						header("Content-Type: application/json");
398 398
 						$json = json_encode(end($return));
399
-						if (x($_GET, 'callback')) {
399
+						if (!empty($_GET['callback'])) {
400 400
 							$json = $_GET['callback'] . "(" . $json . ")";
401 401
 						}
402 402
 						$return = $json;
@@ -550,7 +550,7 @@ function api_get_user(App $a, $contact_id = null)
550 550
 		}
551 551
 	}
552 552
 
553
-	if (is_null($user) && x($_GET, 'user_id')) {
553
+	if (is_null($user) && !empty($_GET['user_id'])) {
554 554
 		$user = DBA::escape(api_unique_id_to_nurl($_GET['user_id']));
555 555
 
556 556
 		if ($user == "") {
@@ -563,7 +563,7 @@ function api_get_user(App $a, $contact_id = null)
563 563
 			$extra_query .= "AND `contact`.`uid`=" . intval(api_user());
564 564
 		}
565 565
 	}
566
-	if (is_null($user) && x($_GET, 'screen_name')) {
566
+	if (is_null($user) && !empty($_GET['screen_name'])) {
567 567
 		$user = DBA::escape($_GET['screen_name']);
568 568
 		$extra_query = "AND `contact`.`nick` = '%s' ";
569 569
 		if (api_user() !== false) {
@@ -571,7 +571,7 @@ function api_get_user(App $a, $contact_id = null)
571 571
 		}
572 572
 	}
573 573
 
574
-	if (is_null($user) && x($_GET, 'profileurl')) {
574
+	if (is_null($user) && !empty($_GET['profileurl'])) {
575 575
 		$user = DBA::escape(Strings::normaliseLink($_GET['profileurl']));
576 576
 		$extra_query = "AND `contact`.`nurl` = '%s' ";
577 577
 		if (api_user() !== false) {
@@ -980,7 +980,7 @@ function api_account_verify_credentials($type)
980 980
 	unset($_REQUEST["screen_name"]);
981 981
 	unset($_GET["screen_name"]);
982 982
 
983
-	$skip_status = (x($_REQUEST, 'skip_status')?$_REQUEST['skip_status'] : false);
983
+	$skip_status = defaults($_REQUEST, 'skip_status', false);
984 984
 
985 985
 	$user_info = api_get_user($a);
986 986
 
@@ -1014,10 +1014,10 @@ api_register_func('api/account/verify_credentials', 'api_account_verify_credenti
1014 1014
  */
1015 1015
 function requestdata($k)
1016 1016
 {
1017
-	if (x($_POST, $k)) {
1017
+	if (!empty($_POST[$k])) {
1018 1018
 		return $_POST[$k];
1019 1019
 	}
1020
-	if (x($_GET, $k)) {
1020
+	if (!empty($_GET[$k])) {
1021 1021
 		return $_GET[$k];
1022 1022
 	}
1023 1023
 	return null;
@@ -1172,7 +1172,7 @@ function api_statuses_update($type)
1172 1172
 		}
1173 1173
 	}
1174 1174
 
1175
-	if (x($_FILES, 'media')) {
1175
+	if (!empty($_FILES['media'])) {
1176 1176
 		// upload the image if we have one
1177 1177
 		$picture = wall_upload_post($a, false);
1178 1178
 		if (is_array($picture)) {
@@ -1199,7 +1199,7 @@ function api_statuses_update($type)
1199 1199
 
1200 1200
 	$_REQUEST['api_source'] = true;
1201 1201
 
1202
-	if (!x($_REQUEST, "source")) {
1202
+	if (empty($_REQUEST['source'])) {
1203 1203
 		$_REQUEST["source"] = api_source();
1204 1204
 	}
1205 1205
 
@@ -1231,7 +1231,7 @@ function api_media_upload()
1231 1231
 
1232 1232
 	api_get_user($a);
1233 1233
 
1234
-	if (!x($_FILES, 'media')) {
1234
+	if (empty($_FILES['media'])) {
1235 1235
 		// Output error
1236 1236
 		throw new BadRequestException("No media.");
1237 1237
 	}
@@ -1445,7 +1445,7 @@ function api_users_search($type)
1445 1445
 
1446 1446
 	$userlist = [];
1447 1447
 
1448
-	if (x($_GET, 'q')) {
1448
+	if (!empty($_GET['q'])) {
1449 1449
 		$r = q("SELECT id FROM `contact` WHERE `uid` = 0 AND `name` = '%s'", DBA::escape($_GET["q"]));
1450 1450
 
1451 1451
 		if (!DBA::isResult($r)) {
@@ -1530,21 +1530,21 @@ function api_search($type)
1530 1530
 
1531 1531
 	$data = [];
1532 1532
 
1533
-	if (!x($_REQUEST, 'q')) {
1533
+	if (empty($_REQUEST['q'])) {
1534 1534
 		throw new BadRequestException("q parameter is required.");
1535 1535
 	}
1536 1536
 
1537
-	if (x($_REQUEST, 'rpp')) {
1537
+	if (!empty($_REQUEST['rpp'])) {
1538 1538
 		$count = $_REQUEST['rpp'];
1539
-	} elseif (x($_REQUEST, 'count')) {
1539
+	} elseif (!empty($_REQUEST['count'])) {
1540 1540
 		$count = $_REQUEST['count'];
1541 1541
 	} else {
1542 1542
 		$count = 15;
1543 1543
 	}
1544 1544
 
1545
-	$since_id = (x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0);
1546
-	$max_id = (x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0);
1547
-	$page = (x($_REQUEST, 'page') ? $_REQUEST['page'] - 1 : 0);
1545
+	$since_id = defaults($_REQUEST, 'since_id', 0);
1546
+	$max_id = defaults($_REQUEST, 'max_id', 0);
1547
+	$page = (!empty($_REQUEST['page']) ? $_REQUEST['page'] - 1 : 0);
1548 1548
 
1549 1549
 	$start = $page * $count;
1550 1550
 
@@ -1598,16 +1598,15 @@ function api_statuses_home_timeline($type)
1598 1598
 	// get last network messages
1599 1599
 
1600 1600
 	// params
1601
-	$count = (x($_REQUEST, 'count') ? $_REQUEST['count'] : 20);
1602
-	$page = (x($_REQUEST, 'page') ? $_REQUEST['page'] - 1 : 0);
1601
+	$count = defaults($_REQUEST, 'count', 20);
1602
+	$page = (!empty($_REQUEST['page']) ? $_REQUEST['page'] - 1 : 0);
1603 1603
 	if ($page < 0) {
1604 1604
 		$page = 0;
1605 1605
 	}
1606
-	$since_id = (x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0);
1607
-	$max_id = (x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0);
1608
-	//$since_id = 0;//$since_id = (x($_REQUEST, 'since_id')?$_REQUEST['since_id'] : 0);
1609
-	$exclude_replies = (x($_REQUEST, 'exclude_replies') ? 1 : 0);
1610
-	$conversation_id = (x($_REQUEST, 'conversation_id') ? $_REQUEST['conversation_id'] : 0);
1606
+	$since_id = defaults($_REQUEST, 'since_id', 0);
1607
+	$max_id = defaults($_REQUEST, 'max_id', 0);
1608
+	$exclude_replies = !empty($_REQUEST['exclude_replies']);
1609
+	$conversation_id = defaults($_REQUEST, 'conversation_id', 0);
1611 1610
 
1612 1611
 	$start = $page * $count;
1613 1612
 
@@ -1618,7 +1617,7 @@ function api_statuses_home_timeline($type)
1618 1617
 		$condition[0] .= " AND `item`.`id` <= ?";
1619 1618
 		$condition[] = $max_id;
1620 1619
 	}
1621
-	if ($exclude_replies > 0) {
1620
+	if ($exclude_replies) {
1622 1621
 		$condition[0] .= ' AND `item`.`parent` = `item`.`id`';
1623 1622
 	}
1624 1623
 	if ($conversation_id > 0) {
@@ -1681,19 +1680,17 @@ function api_statuses_public_timeline($type)
1681 1680
 	// get last network messages
1682 1681
 
1683 1682
 	// params
1684
-	$count = (x($_REQUEST, 'count') ? $_REQUEST['count'] : 20);
1685
-	$page = (x($_REQUEST, 'page') ? $_REQUEST['page'] -1 : 0);
1683
+	$count = defaults($_REQUEST, 'count', 20);
1684
+	$page = (!empty($_REQUEST['page']) ? $_REQUEST['page'] -1 : 0);
1686 1685
 	if ($page < 0) {
1687 1686
 		$page = 0;
1688 1687
 	}
1689
-	$since_id = (x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0);
1690
-	$max_id = (x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0);
1691
-	//$since_id = 0;//$since_id = (x($_REQUEST, 'since_id')?$_REQUEST['since_id'] : 0);
1692
-	$exclude_replies = (x($_REQUEST, 'exclude_replies') ? 1 : 0);
1693
-	$conversation_id = (x($_REQUEST, 'conversation_id') ? $_REQUEST['conversation_id'] : 0);
1688
+	$since_id = defaults($_REQUEST, 'since_id', 0);
1689
+	$max_id = defaults($_REQUEST, 'max_id', 0);
1690
+	$exclude_replies = (!empty($_REQUEST['exclude_replies']) ? 1 : 0);
1691
+	$conversation_id = defaults($_REQUEST, 'conversation_id', 0);
1694 1692
 
1695 1693
 	$start = $page * $count;
1696
-	$sql_extra = '';
1697 1694
 
1698 1695
 	if ($exclude_replies && !$conversation_id) {
1699 1696
 		$condition = ["`gravity` IN (?, ?) AND `iid` > ? AND NOT `private` AND `wall` AND NOT `user`.`hidewall`",
@@ -1762,12 +1759,12 @@ function api_statuses_networkpublic_timeline($type)
1762 1759
 		throw new ForbiddenException();
1763 1760
 	}
1764 1761
 
1765
-	$since_id        = x($_REQUEST, 'since_id')        ? $_REQUEST['since_id']        : 0;
1766
-	$max_id          = x($_REQUEST, 'max_id')          ? $_REQUEST['max_id']          : 0;
1762
+	$since_id        = defaults($_REQUEST, 'since_id', 0);
1763
+	$max_id          = defaults($_REQUEST, 'max_id', 0);
1767 1764
 
1768 1765
 	// pagination
1769
-	$count = x($_REQUEST, 'count') ? $_REQUEST['count']   : 20;
1770
-	$page  = x($_REQUEST, 'page')  ? $_REQUEST['page']    : 1;
1766
+	$count = defaults($_REQUEST, 'count', 20);
1767
+	$page  = defaults($_REQUEST, 'page', 1);
1771 1768
 	if ($page < 1) {
1772 1769
 		$page = 1;
1773 1770
 	}
@@ -2001,7 +1998,7 @@ function api_statuses_repeat($type)
2001 1998
 		$_REQUEST['profile_uid'] = api_user();
2002 1999
 		$_REQUEST['api_source'] = true;
2003 2000
 
2004
-		if (!x($_REQUEST, "source")) {
2001
+		if (empty($_REQUEST['source'])) {
2005 2002
 			$_REQUEST["source"] = api_source();
2006 2003
 		}
2007 2004
 
@@ -2150,14 +2147,14 @@ function api_statuses_user_timeline($type)
2150 2147
 		Logger::DEBUG
2151 2148
 	);
2152 2149
 
2153
-	$since_id        = x($_REQUEST, 'since_id')        ? $_REQUEST['since_id']        : 0;
2154
-	$max_id          = x($_REQUEST, 'max_id')          ? $_REQUEST['max_id']          : 0;
2155
-	$exclude_replies = x($_REQUEST, 'exclude_replies') ? 1                            : 0;
2156
-	$conversation_id = x($_REQUEST, 'conversation_id') ? $_REQUEST['conversation_id'] : 0;
2150
+	$since_id        = defaults($_REQUEST, 'since_id', 0);
2151
+	$max_id          = defaults($_REQUEST, 'max_id', 0);
2152
+	$exclude_replies = !empty($_REQUEST['exclude_replies']);
2153
+	$conversation_id = defaults($_REQUEST, 'conversation_id', 0);
2157 2154
 
2158 2155
 	// pagination
2159
-	$count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 20;
2160
-	$page  = x($_REQUEST, 'page')  ? $_REQUEST['page']  : 1;
2156
+	$count = defaults($_REQUEST, 'count', 20);
2157
+	$page  = defaults($_REQUEST, 'page', 1);
2161 2158
 	if ($page < 1) {
2162 2159
 		$page = 1;
2163 2160
 	}
@@ -2170,7 +2167,7 @@ function api_statuses_user_timeline($type)
2170 2167
 		$condition[0] .= ' AND `item`.`wall` ';
2171 2168
 	}
2172 2169
 
2173
-	if ($exclude_replies > 0) {
2170
+	if ($exclude_replies) {
2174 2171
 		$condition[0] .= ' AND `item`.`parent` = `item`.`id`';
2175 2172
 	}
2176 2173
 
@@ -2309,10 +2306,10 @@ function api_favorites($type)
2309 2306
 		$ret = [];
2310 2307
 	} else {
2311 2308
 		// params
2312
-		$since_id = (x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0);
2313
-		$max_id = (x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0);
2314
-		$count = (x($_GET, 'count') ? $_GET['count'] : 20);
2315
-		$page = (x($_REQUEST, 'page') ? $_REQUEST['page'] -1 : 0);
2309
+		$since_id = defaults($_REQUEST, 'since_id', 0);
2310
+		$max_id = defaults($_REQUEST, 'max_id', 0);
2311
+		$count = defaults($_GET, 'count', 20);
2312
+		$page = (!empty($_REQUEST['page']) ? $_REQUEST['page'] -1 : 0);
2316 2313
 		if ($page < 0) {
2317 2314
 			$page = 0;
2318 2315
 		}
@@ -2390,7 +2387,7 @@ function api_format_messages($item, $recipient, $sender)
2390 2387
 	}
2391 2388
 
2392 2389
 	//don't send title to regular StatusNET requests to avoid confusing these apps
2393
-	if (x($_GET, 'getText')) {
2390
+	if (!empty($_GET['getText'])) {
2394 2391
 		$ret['title'] = $item['title'];
2395 2392
 		if ($_GET['getText'] == 'html') {
2396 2393
 			$ret['text'] = BBCode::convert($item['body'], false);
@@ -2400,7 +2397,7 @@ function api_format_messages($item, $recipient, $sender)
2400 2397
 	} else {
2401 2398
 		$ret['text'] = $item['title'] . "\n" . HTML::toPlaintext(BBCode::convert(api_clean_plain_items($item['body']), false, 2, true), 0);
2402 2399
 	}
2403
-	if (x($_GET, 'getUserObjects') && $_GET['getUserObjects'] == 'false') {
2400
+	if (!empty($_GET['getUserObjects']) && $_GET['getUserObjects'] == 'false') {
2404 2401
 		unset($ret['sender']);
2405 2402
 		unset($ret['recipient']);
2406 2403
 	}
@@ -2530,7 +2527,7 @@ function api_get_attachments(&$body)
2530 2527
  */
2531 2528
 function api_get_entitities(&$text, $bbcode)
2532 2529
 {
2533
-	$include_entities = strtolower(x($_REQUEST, 'include_entities') ? $_REQUEST['include_entities'] : "false");
2530
+	$include_entities = strtolower(defaults($_REQUEST, 'include_entities', "false"));
2534 2531
 
2535 2532
 	if ($include_entities != "true") {
2536 2533
 		preg_match_all("/\[img](.*?)\[\/img\]/ism", $bbcode, $images);
@@ -3119,15 +3116,15 @@ function api_lists_statuses($type)
3119 3116
 	}
3120 3117
 
3121 3118
 	// params
3122
-	$count = (x($_REQUEST, 'count') ? $_REQUEST['count'] : 20);
3123
-	$page = (x($_REQUEST, 'page') ? $_REQUEST['page'] - 1 : 0);
3119
+	$count = defaults($_REQUEST, 'count', 20);
3120
+	$page = (!empty($_REQUEST['page']) ? $_REQUEST['page'] - 1 : 0);
3124 3121
 	if ($page < 0) {
3125 3122
 		$page = 0;
3126 3123
 	}
3127
-	$since_id = (x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0);
3128
-	$max_id = (x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0);
3129
-	$exclude_replies = (x($_REQUEST, 'exclude_replies') ? 1 : 0);
3130
-	$conversation_id = (x($_REQUEST, 'conversation_id') ? $_REQUEST['conversation_id'] : 0);
3124
+	$since_id = defaults($_REQUEST, 'since_id', 0);
3125
+	$max_id = defaults($_REQUEST, 'max_id', 0);
3126
+	$exclude_replies = (!empty($_REQUEST['exclude_replies']) ? 1 : 0);
3127
+	$conversation_id = defaults($_REQUEST, 'conversation_id', 0);
3131 3128
 
3132 3129
 	$start = $page * $count;
3133 3130
 
@@ -3185,8 +3182,8 @@ function api_statuses_f($qtype)
3185 3182
 	}
3186 3183
 
3187 3184
 	// pagination
3188
-	$count = x($_GET, 'count') ? $_GET['count'] : 20;
3189
-	$page = x($_GET, 'page') ? $_GET['page'] : 1;
3185
+	$count = defaults($_GET, 'count', 20);
3186
+	$page = defaults($_GET, 'page', 1);
3190 3187
 	if ($page < 1) {
3191 3188
 		$page = 1;
3192 3189
 	}
@@ -3194,7 +3191,7 @@ function api_statuses_f($qtype)
3194 3191
 
3195 3192
 	$user_info = api_get_user($a);
3196 3193
 
3197
-	if (x($_GET, 'cursor') && $_GET['cursor'] == 'undefined') {
3194
+	if (!empty($_GET['cursor']) && $_GET['cursor'] == 'undefined') {
3198 3195
 		/* this is to stop Hotot to load friends multiple times
3199 3196
 		*  I'm not sure if I'm missing return something or
3200 3197
 		*  is a bug in hotot. Workaround, meantime
@@ -3522,7 +3519,7 @@ function api_direct_messages_new($type)
3522 3519
 
3523 3520
 	$replyto = '';
3524 3521
 	$sub     = '';
3525
-	if (x($_REQUEST, 'replyto')) {
3522
+	if (!empty($_REQUEST['replyto'])) {
3526 3523
 		$r = q(
3527 3524
 			'SELECT `parent-uri`, `title` FROM `mail` WHERE `uid`=%d AND `id`=%d',
3528 3525
 			intval(api_user()),
@@ -3531,7 +3528,7 @@ function api_direct_messages_new($type)
3531 3528
 		$replyto = $r[0]['parent-uri'];
3532 3529
 		$sub     = $r[0]['title'];
3533 3530
 	} else {
3534
-		if (x($_REQUEST, 'title')) {
3531
+		if (!empty($_REQUEST['title'])) {
3535 3532
 			$sub = $_REQUEST['title'];
3536 3533
 		} else {
3537 3534
 			$sub = ((strlen($_POST['text'])>10) ? substr($_POST['text'], 0, 10)."...":$_POST['text']);
@@ -3583,10 +3580,10 @@ function api_direct_messages_destroy($type)
3583 3580
 	// params
3584 3581
 	$user_info = api_get_user($a);
3585 3582
 	//required
3586
-	$id = (x($_REQUEST, 'id') ? $_REQUEST['id'] : 0);
3583
+	$id = defaults($_REQUEST, 'id', 0);
3587 3584
 	// optional
3588
-	$parenturi = (x($_REQUEST, 'friendica_parenturi') ? $_REQUEST['friendica_parenturi'] : "");
3589
-	$verbose = (x($_GET, 'friendica_verbose') ? strtolower($_GET['friendica_verbose']) : "false");
3585
+	$parenturi = defaults($_REQUEST, 'friendica_parenturi', "");
3586
+	$verbose = (!empty($_GET['friendica_verbose']) ? strtolower($_GET['friendica_verbose']) : "false");
3590 3587
 	/// @todo optional parameter 'include_entities' from Twitter API not yet implemented
3591 3588
 
3592 3589
 	$uid = $user_info['uid'];
@@ -3838,7 +3835,7 @@ function api_direct_messages_box($type, $box, $verbose)
3838 3835
  */
3839 3836
 function api_direct_messages_sentbox($type)
3840 3837
 {
3841
-	$verbose = (x($_GET, 'friendica_verbose') ? strtolower($_GET['friendica_verbose']) : "false");
3838
+	$verbose = !empty($_GET['friendica_verbose']) ? strtolower($_GET['friendica_verbose']) : "false";
3842 3839
 	return api_direct_messages_box($type, "sentbox", $verbose);
3843 3840
 }
3844 3841
 
@@ -3852,7 +3849,7 @@ function api_direct_messages_sentbox($type)
3852 3849
  */
3853 3850
 function api_direct_messages_inbox($type)
3854 3851
 {
3855
-	$verbose = (x($_GET, 'friendica_verbose') ? strtolower($_GET['friendica_verbose']) : "false");
3852
+	$verbose = !empty($_GET['friendica_verbose']) ? strtolower($_GET['friendica_verbose']) : "false";
3856 3853
 	return api_direct_messages_box($type, "inbox", $verbose);
3857 3854
 }
3858 3855
 
@@ -3864,7 +3861,7 @@ function api_direct_messages_inbox($type)
3864 3861
  */
3865 3862
 function api_direct_messages_all($type)
3866 3863
 {
3867
-	$verbose = (x($_GET, 'friendica_verbose') ? strtolower($_GET['friendica_verbose']) : "false");
3864
+	$verbose = !empty($_GET['friendica_verbose']) ? strtolower($_GET['friendica_verbose']) : "false";
3868 3865
 	return api_direct_messages_box($type, "all", $verbose);
3869 3866
 }
3870 3867
 
@@ -3876,7 +3873,7 @@ function api_direct_messages_all($type)
3876 3873
  */
3877 3874
 function api_direct_messages_conversation($type)
3878 3875
 {
3879
-	$verbose = (x($_GET, 'friendica_verbose') ? strtolower($_GET['friendica_verbose']) : "false");
3876
+	$verbose = !empty($_GET['friendica_verbose']) ? strtolower($_GET['friendica_verbose']) : "false";
3880 3877
 	return api_direct_messages_box($type, "conversation", $verbose);
3881 3878
 }
3882 3879
 
@@ -3940,7 +3937,7 @@ function api_fr_photoalbum_delete($type)
3940 3937
 		throw new ForbiddenException();
3941 3938
 	}
3942 3939
 	// input params
3943
-	$album = (x($_REQUEST, 'album') ? $_REQUEST['album'] : "");
3940
+	$album = defaults($_REQUEST, 'album', "");
3944 3941
 
3945 3942
 	// we do not allow calls without album string
3946 3943
 	if ($album == "") {
@@ -3992,8 +3989,8 @@ function api_fr_photoalbum_update($type)
3992 3989
 		throw new ForbiddenException();
3993 3990
 	}
3994 3991
 	// input params
3995
-	$album = (x($_REQUEST, 'album') ? $_REQUEST['album'] : "");
3996
-	$album_new = (x($_REQUEST, 'album_new') ? $_REQUEST['album_new'] : "");
3992
+	$album = defaults($_REQUEST, 'album', "");
3993
+	$album_new = defaults($_REQUEST, 'album_new', "");
3997 3994
 
3998 3995
 	// we do not allow calls without album string
3999 3996
 	if ($album == "") {
@@ -4077,15 +4074,15 @@ function api_fr_photo_create_update($type)
4077 4074
 		throw new ForbiddenException();
4078 4075
 	}
4079 4076
 	// input params
4080
-	$photo_id = (x($_REQUEST, 'photo_id') ? $_REQUEST['photo_id'] : null);
4081
-	$desc = (x($_REQUEST, 'desc') ? $_REQUEST['desc'] : (array_key_exists('desc', $_REQUEST) ? "" : null)); // extra check necessary to distinguish between 'not provided' and 'empty string'
4082
-	$album = (x($_REQUEST, 'album') ? $_REQUEST['album'] : null);
4083
-	$album_new = (x($_REQUEST, 'album_new') ? $_REQUEST['album_new'] : null);
4084
-	$allow_cid = (x($_REQUEST, 'allow_cid') ? $_REQUEST['allow_cid'] : (array_key_exists('allow_cid', $_REQUEST) ? " " : null));
4085
-	$deny_cid = (x($_REQUEST, 'deny_cid') ? $_REQUEST['deny_cid'] : (array_key_exists('deny_cid', $_REQUEST) ? " " : null));
4086
-	$allow_gid = (x($_REQUEST, 'allow_gid') ? $_REQUEST['allow_gid'] : (array_key_exists('allow_gid', $_REQUEST) ? " " : null));
4087
-	$deny_gid = (x($_REQUEST, 'deny_gid') ? $_REQUEST['deny_gid'] : (array_key_exists('deny_gid', $_REQUEST) ? " " : null));
4088
-	$visibility = (x($_REQUEST, 'visibility') ? (($_REQUEST['visibility'] == "true" || $_REQUEST['visibility'] == 1) ? true : false) : false);
4077
+	$photo_id = defaults($_REQUEST, 'photo_id', null);
4078
+	$desc = defaults($_REQUEST, 'desc', (array_key_exists('desc', $_REQUEST) ? "" : null)) ; // extra check necessary to distinguish between 'not provided' and 'empty string'
4079
+	$album = defaults($_REQUEST, 'album', null);
4080
+	$album_new = defaults($_REQUEST, 'album_new', null);
4081
+	$allow_cid = defaults($_REQUEST, 'allow_cid', (array_key_exists('allow_cid', $_REQUEST) ? " " : null));
4082
+	$deny_cid  = defaults($_REQUEST, 'deny_cid' , (array_key_exists('deny_cid' , $_REQUEST) ? " " : null));
4083
+	$allow_gid = defaults($_REQUEST, 'allow_gid', (array_key_exists('allow_gid', $_REQUEST) ? " " : null));
4084
+	$deny_gid  = defaults($_REQUEST, 'deny_gid' , (array_key_exists('deny_gid' , $_REQUEST) ? " " : null));
4085
+	$visibility = !empty($_REQUEST['visibility']) || $_REQUEST['visibility'] !== "false";
4089 4086
 
4090 4087
 	// do several checks on input parameters
4091 4088
 	// we do not allow calls without album string
@@ -4097,7 +4094,7 @@ function api_fr_photo_create_update($type)
4097 4094
 		$mode = "create";
4098 4095
 
4099 4096
 		// error if no media posted in create-mode
4100
-		if (!x($_FILES, 'media')) {
4097
+		if (empty($_FILES['media'])) {
4101 4098
 			// Output error
4102 4099
 			throw new BadRequestException("no media data submitted");
4103 4100
 		}
@@ -4188,7 +4185,7 @@ function api_fr_photo_create_update($type)
4188 4185
 			$nothingtodo = true;
4189 4186
 		}
4190 4187
 
4191
-		if (x($_FILES, 'media')) {
4188
+		if (!empty($_FILES['media'])) {
4192 4189
 			$nothingtodo = false;
4193 4190
 			$media = $_FILES['media'];
4194 4191
 			$data = save_media_to_database("photo", $media, $type, $album, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $desc, 0, $visibility, $photo_id);
@@ -4224,7 +4221,7 @@ function api_fr_photo_delete($type)
4224 4221
 		throw new ForbiddenException();
4225 4222
 	}
4226 4223
 	// input params
4227
-	$photo_id = (x($_REQUEST, 'photo_id') ? $_REQUEST['photo_id'] : null);
4224
+	$photo_id = defaults($_REQUEST, 'photo_id', null);
4228 4225
 
4229 4226
 	// do several checks on input parameters
4230 4227
 	// we do not allow calls without photo id
@@ -4275,11 +4272,11 @@ function api_fr_photo_detail($type)
4275 4272
 	if (api_user() === false) {
4276 4273
 		throw new ForbiddenException();
4277 4274
 	}
4278
-	if (!x($_REQUEST, 'photo_id')) {
4275
+	if (empty($_REQUEST['photo_id'])) {
4279 4276
 		throw new BadRequestException("No photo id.");
4280 4277
 	}
4281 4278
 
4282
-	$scale = (x($_REQUEST, 'scale') ? intval($_REQUEST['scale']) : false);
4279
+	$scale = (!empty($_REQUEST['scale']) ? intval($_REQUEST['scale']) : false);
4283 4280
 	$photo_id = $_REQUEST['photo_id'];
4284 4281
 
4285 4282
 	// prepare json/xml output with data from database for the requested photo
@@ -4308,7 +4305,7 @@ function api_account_update_profile_image($type)
4308 4305
 	$profile_id = defaults($_REQUEST, 'profile_id', 0);
4309 4306
 
4310 4307
 	// error if image data is missing
4311
-	if (!x($_FILES, 'image')) {
4308
+	if (empty($_FILES['image'])) {
4312 4309
 		throw new BadRequestException("no media data submitted");
4313 4310
 	}
4314 4311
 
@@ -4326,9 +4323,9 @@ function api_account_update_profile_image($type)
4326 4323
 
4327 4324
 	// get mediadata from image or media (Twitter call api/account/update_profile_image provides image)
4328 4325
 	$media = null;
4329
-	if (x($_FILES, 'image')) {
4326
+	if (!empty($_FILES['image'])) {
4330 4327
 		$media = $_FILES['image'];
4331
-	} elseif (x($_FILES, 'media')) {
4328
+	} elseif (!empty($_FILES['media'])) {
4332 4329
 		$media = $_FILES['media'];
4333 4330
 	}
4334 4331
 	// save new profile image
@@ -4788,8 +4785,8 @@ function prepare_photo_data($type, $scale, $photo_id)
4788 4785
  */
4789 4786
 function api_friendica_remoteauth()
4790 4787
 {
4791
-	$url = (x($_GET, 'url') ? $_GET['url'] : '');
4792
-	$c_url = (x($_GET, 'c_url') ? $_GET['c_url'] : '');
4788
+	$url = defaults($_GET, 'url', '');
4789
+	$c_url = defaults($_GET, 'c_url', '');
4793 4790
 
4794 4791
 	if ($url === '' || $c_url === '') {
4795 4792
 		throw new BadRequestException("Wrong parameters.");
@@ -5092,7 +5089,7 @@ function api_in_reply_to($item)
5092 5089
  */
5093 5090
 function api_clean_plain_items($text)
5094 5091
 {
5095
-	$include_entities = strtolower(x($_REQUEST, 'include_entities') ? $_REQUEST['include_entities'] : "false");
5092
+	$include_entities = strtolower(defaults($_REQUEST, 'include_entities', "false"));
5096 5093
 
5097 5094
 	$text = BBCode::cleanPictureLinks($text);
5098 5095
 	$URLSearchString = "^\[\]";
@@ -5224,7 +5221,7 @@ function api_friendica_group_show($type)
5224 5221
 
5225 5222
 	// params
5226 5223
 	$user_info = api_get_user($a);
5227
-	$gid = (x($_REQUEST, 'gid') ? $_REQUEST['gid'] : 0);
5224
+	$gid = defaults($_REQUEST, 'gid', 0);
5228 5225
 	$uid = $user_info['uid'];
5229 5226
 
5230 5227
 	// get data of the specified group id or all groups if not specified
@@ -5289,8 +5286,8 @@ function api_friendica_group_delete($type)
5289 5286
 
5290 5287
 	// params
5291 5288
 	$user_info = api_get_user($a);
5292
-	$gid = (x($_REQUEST, 'gid') ? $_REQUEST['gid'] : 0);
5293
-	$name = (x($_REQUEST, 'name') ? $_REQUEST['name'] : "");
5289
+	$gid = defaults($_REQUEST, 'gid', 0);
5290
+	$name = defaults($_REQUEST, 'name', "");
5294 5291
 	$uid = $user_info['uid'];
5295 5292
 
5296 5293
 	// error if no gid specified
@@ -5351,7 +5348,7 @@ function api_lists_destroy($type)
5351 5348
 
5352 5349
 	// params
5353 5350
 	$user_info = api_get_user($a);
5354
-	$gid = (x($_REQUEST, 'list_id') ? $_REQUEST['list_id'] : 0);
5351
+	$gid = defaults($_REQUEST, 'list_id', 0);
5355 5352
 	$uid = $user_info['uid'];
5356 5353
 
5357 5354
 	// error if no gid specified
@@ -5467,7 +5464,7 @@ function api_friendica_group_create($type)
5467 5464
 
5468 5465
 	// params
5469 5466
 	$user_info = api_get_user($a);
5470
-	$name = (x($_REQUEST, 'name') ? $_REQUEST['name'] : "");
5467
+	$name = defaults($_REQUEST, 'name', "");
5471 5468
 	$uid = $user_info['uid'];
5472 5469
 	$json = json_decode($_POST['json'], true);
5473 5470
 	$users = $json['user'];
@@ -5496,7 +5493,7 @@ function api_lists_create($type)
5496 5493
 
5497 5494
 	// params
5498 5495
 	$user_info = api_get_user($a);
5499
-	$name = (x($_REQUEST, 'name') ? $_REQUEST['name'] : "");
5496
+	$name = defaults($_REQUEST, 'name', "");
5500 5497
 	$uid = $user_info['uid'];
5501 5498
 
5502 5499
 	$success = group_create($name, $uid);
@@ -5531,8 +5528,8 @@ function api_friendica_group_update($type)
5531 5528
 	// params
5532 5529
 	$user_info = api_get_user($a);
5533 5530
 	$uid = $user_info['uid'];
5534
-	$gid = (x($_REQUEST, 'gid') ? $_REQUEST['gid'] : 0);
5535
-	$name = (x($_REQUEST, 'name') ? $_REQUEST['name'] : "");
5531
+	$gid = defaults($_REQUEST, 'gid', 0);
5532
+	$name = defaults($_REQUEST, 'name', "");
5536 5533
 	$json = json_decode($_POST['json'], true);
5537 5534
 	$users = $json['user'];
5538 5535
 
@@ -5604,8 +5601,8 @@ function api_lists_update($type)
5604 5601
 
5605 5602
 	// params
5606 5603
 	$user_info = api_get_user($a);
5607
-	$gid = (x($_REQUEST, 'list_id') ? $_REQUEST['list_id'] : 0);
5608
-	$name = (x($_REQUEST, 'name') ? $_REQUEST['name'] : "");
5604
+	$gid = defaults($_REQUEST, 'list_id', 0);
5605
+	$name = defaults($_REQUEST, 'name', "");
5609 5606
 	$uid = $user_info['uid'];
5610 5607
 
5611 5608
 	// error if no gid specified
@@ -5650,7 +5647,7 @@ function api_friendica_activity($type)
5650 5647
 	$verb = strtolower($a->argv[3]);
5651 5648
 	$verb = preg_replace("|\..*$|", "", $verb);
5652 5649
 
5653
-	$id = (x($_REQUEST, 'id') ? $_REQUEST['id'] : 0);
5650
+	$id = defaults($_REQUEST, 'id', 0);
5654 5651
 
5655 5652
 	$res = Item::performLike($id, $verb);
5656 5653
 
@@ -5732,7 +5729,7 @@ function api_friendica_notification_seen($type)
5732 5729
 		throw new BadRequestException("Invalid argument count");
5733 5730
 	}
5734 5731
 
5735
-	$id = (x($_REQUEST, 'id') ? intval($_REQUEST['id']) : 0);
5732
+	$id = (!empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0);
5736 5733
 
5737 5734
 	$nm = new NotificationsManager();
5738 5735
 	$note = $nm->getByID($id);
@@ -5775,7 +5772,7 @@ function api_friendica_direct_messages_setseen($type)
5775 5772
 	// params
5776 5773
 	$user_info = api_get_user($a);
5777 5774
 	$uid = $user_info['uid'];
5778
-	$id = (x($_REQUEST, 'id') ? $_REQUEST['id'] : 0);
5775
+	$id = defaults($_REQUEST, 'id', 0);
5779 5776
 
5780 5777
 	// return error if id is zero
5781 5778
 	if ($id == "") {
@@ -5824,7 +5821,7 @@ function api_friendica_direct_messages_search($type, $box = "")
5824 5821
 
5825 5822
 	// params
5826 5823
 	$user_info = api_get_user($a);
5827
-	$searchstring = (x($_REQUEST, 'searchstring') ? $_REQUEST['searchstring'] : "");
5824
+	$searchstring = defaults($_REQUEST, 'searchstring', "");
5828 5825
 	$uid = $user_info['uid'];
5829 5826
 
5830 5827
 	// error if no searchstring specified
@@ -5886,7 +5883,7 @@ function api_friendica_profile_show($type)
5886 5883
 	}
5887 5884
 
5888 5885
 	// input params
5889
-	$profile_id = (x($_REQUEST, 'profile_id') ? $_REQUEST['profile_id'] : 0);
5886
+	$profile_id = defaults($_REQUEST, 'profile_id', 0);
5890 5887
 
5891 5888
 	// retrieve general information about profiles for user
5892 5889
 	$multi_profiles = Feature::isEnabled(api_user(), 'multi_profiles');

+ 18
- 18
include/conversation.php View File

@@ -462,17 +462,17 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
462 462
 				. "<script> var profile_uid = " . $_SESSION['uid']
463 463
 				. "; var netargs = '" . substr($a->cmd, 8)
464 464
 				. '?f='
465
-				. ((x($_GET, 'cid'))    ? '&cid='    . rawurlencode($_GET['cid'])    : '')
466
-				. ((x($_GET, 'search')) ? '&search=' . rawurlencode($_GET['search']) : '')
467
-				. ((x($_GET, 'star'))   ? '&star='   . rawurlencode($_GET['star'])   : '')
468
-				. ((x($_GET, 'order'))  ? '&order='  . rawurlencode($_GET['order'])  : '')
469
-				. ((x($_GET, 'bmark'))  ? '&bmark='  . rawurlencode($_GET['bmark'])  : '')
470
-				. ((x($_GET, 'liked'))  ? '&liked='  . rawurlencode($_GET['liked'])  : '')
471
-				. ((x($_GET, 'conv'))   ? '&conv='   . rawurlencode($_GET['conv'])   : '')
472
-				. ((x($_GET, 'nets'))   ? '&nets='   . rawurlencode($_GET['nets'])   : '')
473
-				. ((x($_GET, 'cmin'))   ? '&cmin='   . rawurlencode($_GET['cmin'])   : '')
474
-				. ((x($_GET, 'cmax'))   ? '&cmax='   . rawurlencode($_GET['cmax'])   : '')
475
-				. ((x($_GET, 'file'))   ? '&file='   . rawurlencode($_GET['file'])   : '')
465
+				. (!empty($_GET['cid'])    ? '&cid='    . rawurlencode($_GET['cid'])    : '')
466
+				. (!empty($_GET['search']) ? '&search=' . rawurlencode($_GET['search']) : '')
467
+				. (!empty($_GET['star'])   ? '&star='   . rawurlencode($_GET['star'])   : '')
468
+				. (!empty($_GET['order'])  ? '&order='  . rawurlencode($_GET['order'])  : '')
469
+				. (!empty($_GET['bmark'])  ? '&bmark='  . rawurlencode($_GET['bmark'])  : '')
470
+				. (!empty($_GET['liked'])  ? '&liked='  . rawurlencode($_GET['liked'])  : '')
471
+				. (!empty($_GET['conv'])   ? '&conv='   . rawurlencode($_GET['conv'])   : '')
472
+				. (!empty($_GET['nets'])   ? '&nets='   . rawurlencode($_GET['nets'])   : '')
473
+				. (!empty($_GET['cmin'])   ? '&cmin='   . rawurlencode($_GET['cmin'])   : '')
474
+				. (!empty($_GET['cmax'])   ? '&cmax='   . rawurlencode($_GET['cmax'])   : '')
475
+				. (!empty($_GET['file'])   ? '&file='   . rawurlencode($_GET['file'])   : '')
476 476
 
477 477
 				. "'; var profile_page = " . $pager->getPage() . "; </script>\r\n";
478 478
 		}
@@ -482,7 +482,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
482 482
 
483 483
 		if (!$update) {
484 484
 			$tab = 'posts';
485
-			if (x($_GET, 'tab')) {
485
+			if (!empty($_GET['tab'])) {
486 486
 				$tab = Strings::escapeTags(trim($_GET['tab']));
487 487
 			}
488 488
 			if ($tab === 'posts') {
@@ -951,7 +951,7 @@ function builtin_activity_puller($item, &$conv_responses) {
951 951
 
952 952
 			$url = '<a href="'. $url . '"'. $sparkle .'>' . htmlentities($item['author-name']) . '</a>';
953 953
 
954
-			if (!x($item, 'thr-parent')) {
954
+			if (empty($item['thr-parent'])) {
955 955
 				$item['thr-parent'] = $item['parent-uri'];
956 956
 			}
957 957
 
@@ -1064,7 +1064,7 @@ function format_like($cnt, array $arr, $type, $id) {
1064 1064
 		$expanded .= "\t" . '<div class="wall-item-' . $type . '-expanded" id="' . $type . 'list-' . $id . '" style="display: none;" >' . $explikers . EOL . '</div>';
1065 1065
 	}
1066 1066
 
1067
-	$phrase .= EOL ;
1067
+	$phrase .= EOL;
1068 1068
 	$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('voting_fakelink.tpl'), [
1069 1069
 		'$phrase' => $phrase,
1070 1070
 		'$type' => $type,
@@ -1079,7 +1079,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
1079 1079
 {
1080 1080
 	$o = '';
1081 1081
 
1082
-	$geotag = x($x, 'allow_location') ? Renderer::replaceMacros(Renderer::getMarkupTemplate('jot_geotag.tpl'), []) : '';
1082
+	$geotag = !empty($x['allow_location']) ? Renderer::replaceMacros(Renderer::getMarkupTemplate('jot_geotag.tpl'), []) : '';
1083 1083
 
1084 1084
 	$tpl = Renderer::getMarkupTemplate('jot-header.tpl');
1085 1085
 	$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
@@ -1100,7 +1100,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
1100 1100
 
1101 1101
 	// Private/public post links for the non-JS ACL form
1102 1102
 	$private_post = 1;
1103
-	if (x($_REQUEST, 'public')) {
1103
+	if (!empty($_REQUEST['public'])) {
1104 1104
 		$private_post = 0;
1105 1105
 	}
1106 1106
 
@@ -1432,11 +1432,11 @@ function sort_thr_commented(array $a, array $b)
1432 1432
 }
1433 1433
 
1434 1434
 function render_location_dummy(array $item) {
1435
-	if (x($item, 'location') && !empty($item['location'])) {
1435
+	if (!empty($item['location']) && !empty($item['location'])) {
1436 1436
 		return $item['location'];
1437 1437
 	}
1438 1438
 
1439
-	if (x($item, 'coord') && !empty($item['coord'])) {
1439
+	if (!empty($item['coord']) && !empty($item['coord'])) {
1440 1440
 		return $item['coord'];
1441 1441
 	}
1442 1442
 }

+ 320
- 317
mod/admin.php View File

@@ -58,7 +58,7 @@ function admin_post(App $a)
58 58
 
59 59
 	// do not allow a page manager to access the admin panel at all.
60 60
 
61
-	if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
61
+	if (!empty($_SESSION['submanage'])) {
62 62
 		return;
63 63
 	}
64 64
 
@@ -167,14 +167,14 @@ function admin_content(App $a)
167 167
 		return Login::form();
168 168
 	}
169 169
 
170
-	if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
170
+	if (!empty($_SESSION['submanage'])) {
171 171
 		return "";
172 172
 	}
173 173
 
174 174
 	// APC deactivated, since there are problems with PHP 5.5
175 175
 	//if (function_exists("apc_delete")) {
176
-	//	$toDelete = new APCIterator('user', APC_ITER_VALUE);
177
-	//	apc_delete($toDelete);
176
+	// $toDelete = new APCIterator('user', APC_ITER_VALUE);
177
+	// apc_delete($toDelete);
178 178
 	//}
179 179
 	// Header stuff
180 180
 	$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/settings_head.tpl'), []);
@@ -321,7 +321,7 @@ function admin_page_tos(App $a)
321 321
 		'$title' => L10n::t('Administration'),
322 322
 		'$page' => L10n::t('Terms of Service'),
323 323
 		'$displaytos' => ['displaytos', L10n::t('Display Terms of Service'), Config::get('system', 'tosdisplay'), L10n::t('Enable the Terms of Service page. If this is enabled a link to the terms will be added to the registration form and the general information page.')],
324
-		'$displayprivstatement' => ['displayprivstatement', L10n::t('Display Privacy Statement'), Config::get('system','tosprivstatement'), L10n::t('Show some informations regarding the needed information to operate the node according e.g. to <a href="%s" target="_blank">EU-GDPR</a>.','https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')],
324
+		'$displayprivstatement' => ['displayprivstatement', L10n::t('Display Privacy Statement'), Config::get('system', 'tosprivstatement'), L10n::t('Show some informations regarding the needed information to operate the node according e.g. to <a href="%s" target="_blank">EU-GDPR</a>.', 'https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')],
325 325
 		'$preview' => L10n::t('Privacy Statement Preview'),
326 326
 		'$privtext' => $tos->privacy_complete,
327 327
 		'$tostext' => ['tostext', L10n::t('The Terms of Service'), Config::get('system', 'tostext'), L10n::t('Enter the Terms of Service for your node here. You can use BBCode. Headers of sections should be [h2] and below.')],
@@ -329,6 +329,7 @@ function admin_page_tos(App $a)
329 329
 		'$submit' => L10n::t('Save Settings'),
330 330
 	]);
331 331
 }
332
+
332 333
 /**
333 334
  * @brief Process send data from Admin TOS Page
334 335
  *
@@ -338,13 +339,13 @@ function admin_page_tos_post(App $a)
338 339
 {
339 340
 	BaseModule::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos');
340 341
 
341
-	if (!x($_POST, "page_tos")) {
342
+	if (empty($_POST['page_tos'])) {
342 343
 		return;
343 344
 	}
344 345
 
345
-	$displaytos = ((x($_POST, 'displaytos')) ? True : False);
346
-	$displayprivstatement = ((x($_POST, 'displayprivstatement')) ? True : False);
347
-	$tostext = ((x($_POST, 'tostext')) ? strip_tags(trim($_POST['tostext'])) : '');
346
+	$displaytos = !empty($_POST['displaytos']);
347
+	$displayprivstatement = !empty($_POST['displayprivstatement']);
348
+	$tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
348 349
 
349 350
 	Config::set('system', 'tosdisplay', $displaytos);
350 351
 	Config::set('system', 'tosprivstatement', $displayprivstatement);
@@ -354,6 +355,7 @@ function admin_page_tos_post(App $a)
354 355
 
355 356
 	return; // NOTREACHED
356 357
 }
358
+
357 359
 /**
358 360
  * @brief Subpage to modify the server wide block list via the admin panel.
359 361
  *
@@ -407,13 +409,13 @@ function admin_page_blocklist(App $a)
407 409
  */
408 410
 function admin_page_blocklist_post(App $a)
409 411
 {
410
-	if (!x($_POST, "page_blocklist_save") && (!x($_POST['page_blocklist_edit']))) {
412
+	if (empty($_POST['page_blocklist_save']) && empty($_POST['page_blocklist_edit'])) {
411 413
 		return;
412 414
 	}
413 415
 
414 416
 	BaseModule::checkFormSecurityTokenRedirectOnError('/admin/blocklist', 'admin_blocklist');
415 417
 
416
-	if (x($_POST['page_blocklist_save'])) {
418
+	if (!empty($_POST['page_blocklist_save'])) {
417 419
 		//  Add new item to blocklist
418 420
 		$blocklist = Config::get('system', 'blocklist');
419 421
 		$blocklist[] = [
@@ -429,7 +431,7 @@ function admin_page_blocklist_post(App $a)
429 431
 			// Trimming whitespaces as well as any lingering slashes
430 432
 			$domain = Strings::escapeTags(trim($domain, "\x00..\x1F/"));
431 433
 			$reason = Strings::escapeTags(trim($_POST['reason'][$id]));
432
-			if (!x($_POST['delete'][$id])) {
434
+			if (empty($_POST['delete'][$id])) {
433 435
 				$blocklist[] = [
434 436
 					'domain' => $domain,
435 437
 					'reason' => $reason
@@ -451,12 +453,12 @@ function admin_page_blocklist_post(App $a)
451 453
  */
452 454
 function admin_page_contactblock_post(App $a)
453 455
 {
454
-	$contact_url = x($_POST, 'contact_url') ? $_POST['contact_url'] : '';
455
-	$contacts    = x($_POST, 'contacts')    ? $_POST['contacts']    : [];
456
+	$contact_url = defaults($_POST, 'contact_url', '');
457
+	$contacts    = defaults($_POST, 'contacts', []);
456 458
 
457 459
 	BaseModule::checkFormSecurityTokenRedirectOnError('/admin/contactblock', 'admin_contactblock');
458 460
 
459
-	if (x($_POST, 'page_contactblock_block')) {
461
+	if (!empty($_POST['page_contactblock_block'])) {
460 462
 		$contact_id = Contact::getIdForURL($contact_url);
461 463
 		if ($contact_id) {
462 464
 			Contact::block($contact_id);
@@ -465,7 +467,7 @@ function admin_page_contactblock_post(App $a)
465 467
 			notice(L10n::t("Could not find any contact entry for this URL \x28%s\x29", $contact_url));
466 468
 		}
467 469
 	}
468
-	if (x($_POST, 'page_contactblock_unblock')) {
470
+	if (!empty($_POST['page_contactblock_unblock'])) {
469 471
 		foreach ($contacts as $uid) {
470 472
 			Contact::unblock($uid);
471 473
 		}
@@ -559,13 +561,13 @@ function admin_page_deleteitem(App $a)
559 561
  */
560 562
 function admin_page_deleteitem_post(App $a)
561 563
 {
562
-	if (!x($_POST['page_deleteitem_submit'])) {
564
+	if (empty($_POST['page_deleteitem_submit'])) {
563 565
 		return;
564 566
 	}
565 567
 
566 568
 	BaseModule::checkFormSecurityTokenRedirectOnError('/admin/deleteitem/', 'admin_deleteitem');
567 569
 
568
-	if (x($_POST['page_deleteitem_submit'])) {
570
+	if (!empty($_POST['page_deleteitem_submit'])) {
569 571
 		$guid = trim(Strings::escapeTags($_POST['deleteitemguid']));
570 572
 		// The GUID should not include a "/", so if there is one, we got an URL
571 573
 		// and the last part of it is most likely the GUID.
@@ -838,7 +840,7 @@ function admin_page_workerqueue(App $a, $deferred)
838 840
 		$info = L10n::t('This page lists the currently queued worker jobs. These jobs are handled by the worker cronjob you\'ve set up during install.');
839 841
 	}
840 842
 
841
-	$entries = DBA::select('workerqueue', ['id', 'parameter', 'created', 'priority'], $condition, ['order'=> ['priority']]);
843
+	$entries = DBA::select('workerqueue', ['id', 'parameter', 'created', 'priority'], $condition, ['order' => ['priority']]);
842 844
 
843 845
 	$r = [];
844 846
 	while ($entry = DBA::fetch($entries)) {
@@ -938,7 +940,7 @@ function admin_page_summary(App $a)
938 940
 	$users = 0;
939 941
 	foreach ($r as $u) {
940 942
 		$accounts[$u['page-flags']][1] = $u['count'];
941
-		$users+= $u['count'];
943
+		$users += $u['count'];
942 944
 	}
943 945
 
944 946
 	Logger::log('accounts: ' . print_r($accounts, true), Logger::DATA);
@@ -962,10 +964,10 @@ function admin_page_summary(App $a)
962 964
 	$max_allowed_packet = (($r) ? $r[0]['Value'] : 0);
963 965
 
964 966
 	$server_settings = ['label' => L10n::t('Server Settings'),
965
-				'php' => ['upload_max_filesize' => ini_get('upload_max_filesize'),
966
-						  'post_max_size' => ini_get('post_max_size'),
967
-						  'memory_limit' => ini_get('memory_limit')],
968
-				'mysql' => ['max_allowed_packet' => $max_allowed_packet]];
967
+		'php' => ['upload_max_filesize' => ini_get('upload_max_filesize'),
968
+			'post_max_size' => ini_get('post_max_size'),
969
+			'memory_limit' => ini_get('memory_limit')],
970
+		'mysql' => ['max_allowed_packet' => $max_allowed_packet]];
969 971
 
970 972
 	$t = Renderer::getMarkupTemplate('admin/summary.tpl');
971 973
 	return Renderer::replaceMacros($t, [
@@ -1001,17 +1003,17 @@ function admin_page_site_post(App $a)
1001 1003
 		return;
1002 1004
 	}
1003 1005
 
1004
-	if (!x($_POST, "page_site")) {
1006
+	if (empty($_POST['page_site'])) {
1005 1007
 		return;
1006 1008
 	}
1007 1009
 
1008 1010
 	// relocate
1009
-	if (x($_POST, 'relocate') && x($_POST, 'relocate_url') && $_POST['relocate_url'] != "") {
1011
+	if (!empty($_POST['relocate']) && !empty($_POST['relocate_url']) && $_POST['relocate_url'] != "") {
1010 1012
 		$new_url = $_POST['relocate_url'];
1011 1013
 		$new_url = rtrim($new_url, "/");
1012 1014
 
1013 1015
 		$parsed = @parse_url($new_url);
1014
-		if (!is_array($parsed) || !x($parsed, 'host') || !x($parsed, 'scheme')) {
1016
+		if (!is_array($parsed) || empty($parsed['host']) || empty($parsed['scheme'])) {
1015 1017
 			notice(L10n::t("Can not parse base url. Must have at least <scheme>://<domain>"));
1016 1018
 			$a->internalRedirect('admin/site');
1017 1019
 		}
@@ -1046,6 +1048,7 @@ function admin_page_site_post(App $a)
1046 1048
 				$a->internalRedirect('admin/site');
1047 1049
 			}
1048 1050
 		}
1051
+
1049 1052
 		// update tables
1050 1053
 		// update profile links in the format "http://server.tld"
1051 1054
 		update_table($a, "profile", ['photo', 'thumb'], $old_url, $new_url);
@@ -1059,7 +1062,7 @@ function admin_page_site_post(App $a)
1059 1062
 		update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host);
1060 1063
 
1061 1064
 		// update config
1062
-		Config::set('system', 'hostname', parse_url($new_url,  PHP_URL_HOST));
1065
+		Config::set('system', 'hostname', parse_url($new_url, PHP_URL_HOST));
1063 1066
 		Config::set('system', 'url', $new_url);
1064 1067
 		$a->setBaseURL($new_url);
1065 1068
 
@@ -1076,98 +1079,97 @@ function admin_page_site_post(App $a)
1076 1079
 	}
1077 1080
 	// end relocate
1078 1081
 
1079
-	$sitename 		=	((x($_POST,'sitename'))			? Strings::escapeTags(trim($_POST['sitename']))		: '');
1080
-	$hostname 		=	((x($_POST,'hostname'))			? Strings::escapeTags(trim($_POST['hostname']))		: '');
1081
-	$sender_email		=	((x($_POST,'sender_email'))		? Strings::escapeTags(trim($_POST['sender_email']))		: '');
1082
-	$banner			=	((x($_POST,'banner'))			? trim($_POST['banner'])			: false);
1083
-	$shortcut_icon 		=	((x($_POST,'shortcut_icon'))		? Strings::escapeTags(trim($_POST['shortcut_icon']))		: '');
1084
-	$touch_icon 		=	((x($_POST,'touch_icon'))		? Strings::escapeTags(trim($_POST['touch_icon']))		: '');
1085
-	$info			=	((x($_POST,'info'))			? trim($_POST['info'])				: false);
1086
-	$language		=	((x($_POST,'language'))			? Strings::escapeTags(trim($_POST['language']))		: '');
1087
-	$theme			=	((x($_POST,'theme'))			? Strings::escapeTags(trim($_POST['theme']))			: '');
1088
-	$theme_mobile		=	((x($_POST,'theme_mobile'))		? Strings::escapeTags(trim($_POST['theme_mobile']))		: '');
1089
-	$maximagesize		=	((x($_POST,'maximagesize'))		? intval(trim($_POST['maximagesize']))		:  0);
1090
-	$maximagelength		=	((x($_POST,'maximagelength'))		? intval(trim($_POST['maximagelength']))	:  MAX_IMAGE_LENGTH);
1091
-	$jpegimagequality	=	((x($_POST,'jpegimagequality'))		? intval(trim($_POST['jpegimagequality']))	:  JPEG_QUALITY);
1092
-
1093
-
1094
-	$register_policy	=	((x($_POST,'register_policy'))		? intval(trim($_POST['register_policy']))	:  0);
1095
-	$daily_registrations	=	((x($_POST,'max_daily_registrations'))	? intval(trim($_POST['max_daily_registrations']))	:0);
1096
-	$abandon_days	    	=	((x($_POST,'abandon_days'))		? intval(trim($_POST['abandon_days']))		:  0);
1097
-
1098
-	$register_text		=	((x($_POST,'register_text'))		? strip_tags(trim($_POST['register_text']))		: '');
1099
-
1100
-	$allowed_sites		=	((x($_POST,'allowed_sites'))		? Strings::escapeTags(trim($_POST['allowed_sites']))		: '');
1101
-	$allowed_email		=	((x($_POST,'allowed_email'))		? Strings::escapeTags(trim($_POST['allowed_email']))		: '');
1102
-	$forbidden_nicknames	=	((x($_POST,'forbidden_nicknames'))	? strtolower(Strings::escapeTags(trim($_POST['forbidden_nicknames'])))		: '');
1103
-	$no_oembed_rich_content = x($_POST,'no_oembed_rich_content');
1104
-	$allowed_oembed		=	((x($_POST,'allowed_oembed'))		? Strings::escapeTags(trim($_POST['allowed_oembed']))		: '');
1105
-	$block_public		=	((x($_POST,'block_public'))		? True						: False);
1106
-	$force_publish		=	((x($_POST,'publish_all'))		? True						: False);
1107
-	$global_directory	=	((x($_POST,'directory'))		? Strings::escapeTags(trim($_POST['directory']))		: '');
1108
-	$newuser_private		=	((x($_POST,'newuser_private'))		? True					: False);
1109
-	$enotify_no_content		=	((x($_POST,'enotify_no_content'))	? True					: False);
1110
-	$private_addons			=	((x($_POST,'private_addons'))		? True					: False);
1111
-	$disable_embedded		=	((x($_POST,'disable_embedded'))		? True					: False);
1112
-	$allow_users_remote_self	=	((x($_POST,'allow_users_remote_self'))	? True					: False);
1113
-	$explicit_content	=	((x($_POST,'explicit_content'))	? True					: False);
1114
-
1115
-	$no_multi_reg		=	((x($_POST,'no_multi_reg'))		? True						: False);
1116
-	$no_openid		=	!((x($_POST,'no_openid'))		? True						: False);
1117
-	$no_regfullname		=	!((x($_POST,'no_regfullname'))		? True						: False);
1118
-	$community_page_style	=	((x($_POST,'community_page_style'))	? intval(trim($_POST['community_page_style']))	: 0);
1119
-	$max_author_posts_community_page	=	((x($_POST,'max_author_posts_community_page'))	? intval(trim($_POST['max_author_posts_community_page']))	: 0);
1120
-
1121
-	$verifyssl		=	((x($_POST,'verifyssl'))		? True						: False);
1122
-	$proxyuser		=	((x($_POST,'proxyuser'))		? Strings::escapeTags(trim($_POST['proxyuser']))		: '');
1123
-	$proxy			=	((x($_POST,'proxy'))			? Strings::escapeTags(trim($_POST['proxy']))			: '');
1124
-	$timeout		=	((x($_POST,'timeout'))			? intval(trim($_POST['timeout']))		: 60);
1125
-	$maxloadavg		=	((x($_POST,'maxloadavg'))		? intval(trim($_POST['maxloadavg']))		: 50);
1126
-	$maxloadavg_frontend	=	((x($_POST,'maxloadavg_frontend'))	? intval(trim($_POST['maxloadavg_frontend']))	: 50);
1127
-	$min_memory		=	((x($_POST,'min_memory'))		? intval(trim($_POST['min_memory']))		: 0);
1128
-	$optimize_max_tablesize	=	((x($_POST,'optimize_max_tablesize'))	? intval(trim($_POST['optimize_max_tablesize'])): 100);
1129
-	$optimize_fragmentation	=	((x($_POST,'optimize_fragmentation'))	? intval(trim($_POST['optimize_fragmentation'])): 30);
1130
-	$poco_completion	=	((x($_POST,'poco_completion'))		? intval(trim($_POST['poco_completion']))	: false);
1131
-	$poco_requery_days	=	((x($_POST,'poco_requery_days'))	? intval(trim($_POST['poco_requery_days']))	: 7);
1132
-	$poco_discovery		=	((x($_POST,'poco_discovery'))		? intval(trim($_POST['poco_discovery']))	: 0);
1133
-	$poco_discovery_since	=	((x($_POST,'poco_discovery_since'))	? intval(trim($_POST['poco_discovery_since']))	: 30);
1134
-	$poco_local_search	=	((x($_POST,'poco_local_search'))	? intval(trim($_POST['poco_local_search']))	: false);
1135
-	$nodeinfo		=	((x($_POST,'nodeinfo'))			? intval(trim($_POST['nodeinfo']))		: false);
1136
-	$dfrn_only		=	((x($_POST,'dfrn_only'))		? True						: False);
1137
-	$ostatus_disabled	=	!((x($_POST,'ostatus_disabled'))	? True  					: False);
1138
-	$ostatus_full_threads	=	((x($_POST,'ostatus_full_threads'))	? True  					: False);
1139
-	$diaspora_enabled	=	((x($_POST,'diaspora_enabled'))		? True   					: False);
1140
-	$ssl_policy		=	((x($_POST,'ssl_policy'))		? intval($_POST['ssl_policy']) 			: 0);
1141
-	$force_ssl		=	((x($_POST,'force_ssl'))		? True   					: False);
1142
-	$hide_help		=	((x($_POST,'hide_help'))		? True   					: False);
1143
-	$dbclean		=	((x($_POST,'dbclean'))			? True   					: False);
1144
-	$dbclean_expire_days	=	((x($_POST,'dbclean_expire_days'))	? intval($_POST['dbclean_expire_days'])		: 0);
1145
-	$dbclean_unclaimed	=	((x($_POST,'dbclean_unclaimed'))	? intval($_POST['dbclean_unclaimed'])		: 0);
1146
-	$dbclean_expire_conv	=	((x($_POST,'dbclean_expire_conv'))	? intval($_POST['dbclean_expire_conv'])		: 0);
1147
-	$suppress_tags		=	((x($_POST,'suppress_tags'))		? True   					: False);
1148
-	$itemcache		=	((x($_POST,'itemcache'))		? Strings::escapeTags(trim($_POST['itemcache']))		: '');
1149
-	$itemcache_duration	=	((x($_POST,'itemcache_duration'))	? intval($_POST['itemcache_duration'])		: 0);
1150
-	$max_comments		=	((x($_POST,'max_comments'))		? intval($_POST['max_comments'])		: 0);
1151
-	$temppath		=	((x($_POST,'temppath'))			? Strings::escapeTags(trim($_POST['temppath']))		: '');
1152
-	$basepath		=	((x($_POST,'basepath'))			? Strings::escapeTags(trim($_POST['basepath']))		: '');
1153
-	$singleuser		=	((x($_POST,'singleuser'))		? Strings::escapeTags(trim($_POST['singleuser']))		: '');
1154
-	$proxy_disabled		=	((x($_POST,'proxy_disabled'))		? True						: False);
1155
-	$only_tag_search	=	((x($_POST,'only_tag_search'))		? True						: False);
1156
-	$rino			=	((x($_POST,'rino'))			? intval($_POST['rino'])			: 0);
1157
-	$check_new_version_url	=	((x($_POST, 'check_new_version_url'))	?	Strings::escapeTags(trim($_POST['check_new_version_url']))	: 'none');
1158
-
1159
-	$worker_queues		=	((x($_POST,'worker_queues'))		? intval($_POST['worker_queues'])		: 10);
1160
-	$worker_dont_fork	=	((x($_POST,'worker_dont_fork'))		? True						: False);
1161
-	$worker_fastlane	=	((x($_POST,'worker_fastlane'))		? True						: False);
1162
-	$worker_frontend	=	((x($_POST,'worker_frontend'))		? True						: False);
1163
-
1164
-	$relay_directly		=	((x($_POST,'relay_directly'))		? True						: False);
1165
-	$relay_server		=	((x($_POST,'relay_server'))		? Strings::escapeTags(trim($_POST['relay_server']))		: '');
1166
-	$relay_subscribe	=	((x($_POST,'relay_subscribe'))		? True						: False);
1167
-	$relay_scope		=	((x($_POST,'relay_scope'))		? Strings::escapeTags(trim($_POST['relay_scope']))		: '');
1168
-	$relay_server_tags	=	((x($_POST,'relay_server_tags'))	? Strings::escapeTags(trim($_POST['relay_server_tags']))	: '');
1169
-	$relay_user_tags	=	((x($_POST,'relay_user_tags'))		? True						: False);
1170
-	$active_panel           =       (defaults($_POST, 'active_panel', '')   ? "#" . Strings::escapeTags(trim($_POST['active_panel'])) : '');
1082
+	$sitename         = (!empty($_POST['sitename'])         ? Strings::escapeTags(trim($_POST['sitename']))      : '');
1083
+	$hostname         = (!empty($_POST['hostname'])         ? Strings::escapeTags(trim($_POST['hostname']))      : '');
1084
+	$sender_email     = (!empty($_POST['sender_email'])     ? Strings::escapeTags(trim($_POST['sender_email']))  : '');
1085
+	$banner           = (!empty($_POST['banner'])           ? trim($_POST['banner'])                             : false);
1086
+	$shortcut_icon    = (!empty($_POST['shortcut_icon'])    ? Strings::escapeTags(trim($_POST['shortcut_icon'])) : '');
1087
+	$touch_icon       = (!empty($_POST['touch_icon'])       ? Strings::escapeTags(trim($_POST['touch_icon']))    : '');
1088
+	$info             = (!empty($_POST['info'])             ? trim($_POST['info'])                               : false);
1089
+	$language         = (!empty($_POST['language'])         ? Strings::escapeTags(trim($_POST['language']))      : '');
1090
+	$theme            = (!empty($_POST['theme'])            ? Strings::escapeTags(trim($_POST['theme']))         : '');
1091
+	$theme_mobile     = (!empty($_POST['theme_mobile'])     ? Strings::escapeTags(trim($_POST['theme_mobile']))  : '');
1092
+	$maximagesize     = (!empty($_POST['maximagesize'])     ? intval(trim($_POST['maximagesize']))               : 0);
1093
+	$maximagelength   = (!empty($_POST['maximagelength'])   ? intval(trim($_POST['maximagelength']))             : MAX_IMAGE_LENGTH);
1094
+	$jpegimagequality = (!empty($_POST['jpegimagequality']) ? intval(trim($_POST['jpegimagequality']))           : JPEG_QUALITY);
1095
+
1096
+	$register_policy        = (!empty($_POST['register_policy'])         ? intval(trim($_POST['register_policy']))             : 0);
1097
+	$daily_registrations    = (!empty($_POST['max_daily_registrations']) ? intval(trim($_POST['max_daily_registrations']))     : 0);
1098
+	$abandon_days           = (!empty($_POST['abandon_days'])            ? intval(trim($_POST['abandon_days']))                : 0);
1099
+
1100
+	$register_text          = (!empty($_POST['register_text'])           ? strip_tags(trim($_POST['register_text']))           : '');
1101
+
1102
+	$allowed_sites          = (!empty($_POST['allowed_sites'])           ? Strings::escapeTags(trim($_POST['allowed_sites']))  : '');
1103
+	$allowed_email          = (!empty($_POST['allowed_email'])           ? Strings::escapeTags(trim($_POST['allowed_email']))  : '');
1104
+	$forbidden_nicknames    = (!empty($_POST['forbidden_nicknames'])     ? strtolower(Strings::escapeTags(trim($_POST['forbidden_nicknames']))) : '');
1105
+	$no_oembed_rich_content = !empty($_POST['no_oembed_rich_content']);
1106
+	$allowed_oembed         = (!empty($_POST['allowed_oembed'])          ? Strings::escapeTags(trim($_POST['allowed_oembed'])) : '');
1107
+	$block_public           = !empty($_POST['block_public']);
1108
+	$force_publish          = !empty($_POST['publish_all']);
1109
+	$global_directory       = (!empty($_POST['directory'])               ? Strings::escapeTags(trim($_POST['directory']))      : '');
1110
+	$newuser_private        = !empty($_POST['newuser_private']);
1111
+	$enotify_no_content     = !empty($_POST['enotify_no_content']);
1112
+	$private_addons         = !empty($_POST['private_addons']);
1113
+	$disable_embedded       = !empty($_POST['disable_embedded']);
1114
+	$allow_users_remote_self = !empty($_POST['allow_users_remote_self']);
1115
+	$explicit_content       = !empty($_POST['explicit_content']);
1116
+
1117
+	$no_multi_reg           = !empty($_POST['no_multi_reg']);
1118
+	$no_openid              = !empty($_POST['no_openid']);
1119
+	$no_regfullname         = !empty($_POST['no_regfullname']);
1120
+	$community_page_style   = (!empty($_POST['community_page_style']) ? intval(trim($_POST['community_page_style'])) : 0);
1121
+	$max_author_posts_community_page = (!empty($_POST['max_author_posts_community_page']) ? intval(trim($_POST['max_author_posts_community_page'])) : 0);
1122
+
1123
+	$verifyssl              = !empty($_POST['verifyssl']);
1124
+	$proxyuser              = (!empty($_POST['proxyuser'])              ? Strings::escapeTags(trim($_POST['proxyuser'])) : '');
1125
+	$proxy                  = (!empty($_POST['proxy'])                  ? Strings::escapeTags(trim($_POST['proxy']))     : '');
1126
+	$timeout                = (!empty($_POST['timeout'])                ? intval(trim($_POST['timeout']))                : 60);
1127
+	$maxloadavg             = (!empty($_POST['maxloadavg'])             ? intval(trim($_POST['maxloadavg']))             : 50);
1128
+	$maxloadavg_frontend    = (!empty($_POST['maxloadavg_frontend'])    ? intval(trim($_POST['maxloadavg_frontend']))    : 50);
1129
+	$min_memory             = (!empty($_POST['min_memory'])             ? intval(trim($_POST['min_memory']))             : 0);
1130
+	$optimize_max_tablesize = (!empty($_POST['optimize_max_tablesize']) ? intval(trim($_POST['optimize_max_tablesize'])) : 100);
1131
+	$optimize_fragmentation = (!empty($_POST['optimize_fragmentation']) ? intval(trim($_POST['optimize_fragmentation'])) : 30);
1132
+	$poco_completion        = (!empty($_POST['poco_completion'])        ? intval(trim($_POST['poco_completion']))        : false);
1133
+	$poco_requery_days      = (!empty($_POST['poco_requery_days'])      ? intval(trim($_POST['poco_requery_days']))      : 7);
1134
+	$poco_discovery         = (!empty($_POST['poco_discovery'])         ? intval(trim($_POST['poco_discovery']))         : 0);
1135
+	$poco_discovery_since   = (!empty($_POST['poco_discovery_since'])   ? intval(trim($_POST['poco_discovery_since']))   : 30);
1136
+	$poco_local_search      = !empty($_POST['poco_local_search']);
1137
+	$nodeinfo               = !empty($_POST['nodeinfo']);
1138
+	$dfrn_only              = !empty($_POST['dfrn_only']);
1139
+	$ostatus_disabled       = !empty($_POST['ostatus_disabled']);
1140
+	$ostatus_full_threads   = !empty($_POST['ostatus_full_threads']);
1141
+	$diaspora_enabled       = !empty($_POST['diaspora_enabled']);
1142
+	$ssl_policy             = (!empty($_POST['ssl_policy'])             ? intval($_POST['ssl_policy'])                    : 0);
1143
+	$force_ssl              = !empty($_POST['force_ssl']);
1144
+	$hide_help              = !empty($_POST['hide_help']);
1145
+	$dbclean                = !empty($_POST['dbclean']);
1146
+	$dbclean_expire_days    = (!empty($_POST['dbclean_expire_days'])    ? intval($_POST['dbclean_expire_days'])           : 0);
1147
+	$dbclean_unclaimed      = (!empty($_POST['dbclean_unclaimed'])      ? intval($_POST['dbclean_unclaimed'])             : 0);
1148
+	$dbclean_expire_conv    = (!empty($_POST['dbclean_expire_conv'])    ? intval($_POST['dbclean_expire_conv'])           : 0);
1149
+	$suppress_tags          = !empty($_POST['suppress_tags']);
1150
+	$itemcache              = (!empty($_POST['itemcache'])              ? Strings::escapeTags(trim($_POST['itemcache']))  : '');
1151
+	$itemcache_duration     = (!empty($_POST['itemcache_duration'])     ? intval($_POST['itemcache_duration'])            : 0);
1152
+	$max_comments           = (!empty($_POST['max_comments'])           ? intval($_POST['max_comments'])                  : 0);
1153
+	$temppath               = (!empty($_POST['temppath'])               ? Strings::escapeTags(trim($_POST['temppath']))   : '');
1154
+	$basepath               = (!empty($_POST['basepath'])               ? Strings::escapeTags(trim($_POST['basepath']))   : '');
1155
+	$singleuser             = (!empty($_POST['singleuser'])             ? Strings::escapeTags(trim($_POST['singleuser'])) : '');
1156
+	$proxy_disabled         = !empty($_POST['proxy_disabled']);
1157
+	$only_tag_search        = !empty($_POST['only_tag_search']);
1158
+	$rino                   = (!empty($_POST['rino'])                   ? intval($_POST['rino'])                          : 0);
1159
+	$check_new_version_url  = (!empty($_POST['check_new_version_url'])  ? Strings::escapeTags(trim($_POST['check_new_version_url'])) : 'none');
1160
+
1161
+	$worker_queues    = (!empty($_POST['worker_queues'])                ? intval($_POST['worker_queues'])                 : 10);
1162
+	$worker_dont_fork = !empty($_POST['worker_dont_fork']);
1163
+	$worker_fastlane  = !empty($_POST['worker_fastlane']);
1164
+	$worker_frontend  = !empty($_POST['worker_frontend']);
1165
+
1166
+	$relay_directly    = !empty($_POST['relay_directly']);
1167
+	$relay_server      = (!empty($_POST['relay_server'])      ? Strings::escapeTags(trim($_POST['relay_server']))       : '');
1168
+	$relay_subscribe   = !empty($_POST['relay_subscribe']);
1169
+	$relay_scope       = (!empty($_POST['relay_scope'])       ? Strings::escapeTags(trim($_POST['relay_scope']))        : '');
1170
+	$relay_server_tags = (!empty($_POST['relay_server_tags']) ? Strings::escapeTags(trim($_POST['relay_server_tags']))  : '');
1171
+	$relay_user_tags   = !empty($_POST['relay_user_tags']);
1172
+	$active_panel      = (!empty($_POST['active_panel'])      ? "#" . Strings::escapeTags(trim($_POST['active_panel'])) : '');
1171 1173
 
1172 1174
 	// Has the directory url changed? If yes, then resubmit the existing profiles there
1173 1175
 	if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
@@ -1217,24 +1219,24 @@ function admin_page_site_post(App $a)
1217 1219
 			);
1218 1220
 		}
1219 1221
 	}
1220
-	Config::set('system', 'ssl_policy', $ssl_policy);
1221
-	Config::set('system', 'maxloadavg', $maxloadavg);
1222
-	Config::set('system', 'maxloadavg_frontend', $maxloadavg_frontend);
1223
-	Config::set('system', 'min_memory', $min_memory);
1222
+	Config::set('system', 'ssl_policy'            , $ssl_policy);
1223
+	Config::set('system', 'maxloadavg'            , $maxloadavg);
1224
+	Config::set('system', 'maxloadavg_frontend'   , $maxloadavg_frontend);
1225
+	Config::set('system', 'min_memory'            , $min_memory);
1224 1226
 	Config::set('system', 'optimize_max_tablesize', $optimize_max_tablesize);
1225 1227
 	Config::set('system', 'optimize_fragmentation', $optimize_fragmentation);
1226
-	Config::set('system', 'poco_completion', $poco_completion);
1227
-	Config::set('system', 'poco_requery_days', $poco_requery_days);
1228
-	Config::set('system', 'poco_discovery', $poco_discovery);
1229
-	Config::set('system', 'poco_discovery_since', $poco_discovery_since);
1230
-	Config::set('system', 'poco_local_search', $poco_local_search);
1231
-	Config::set('system', 'nodeinfo', $nodeinfo);
1232
-	Config::set('config', 'sitename', $sitename);
1233
-	Config::set('config', 'hostname', $hostname);
1234
-	Config::set('config', 'sender_email', $sender_email);
1235
-	Config::set('system', 'suppress_tags', $suppress_tags);
1236
-	Config::set('system', 'shortcut_icon', $shortcut_icon);
1237
-	Config::set('system', 'touch_icon', $touch_icon);
1228
+	Config::set('system', 'poco_completion'       , $poco_completion);
1229
+	Config::set('system', 'poco_requery_days'     , $poco_requery_days);
1230
+	Config::set('system', 'poco_discovery'        , $poco_discovery);
1231
+	Config::set('system', 'poco_discovery_since'  , $poco_discovery_since);
1232
+	Config::set('system', 'poco_local_search'     , $poco_local_search);
1233
+	Config::set('system', 'nodeinfo'              , $nodeinfo);
1234
+	Config::set('config', 'sitename'              , $sitename);
1235
+	Config::set('config', 'hostname'              , $hostname);
1236
+	Config::set('config', 'sender_email'          , $sender_email);
1237
+	Config::set('system', 'suppress_tags'         , $suppress_tags);
1238
+	Config::set('system', 'shortcut_icon'         , $shortcut_icon);
1239
+	Config::set('system', 'touch_icon'            , $touch_icon);
1238 1240
 
1239 1241
 	if ($banner == "") {
1240 1242
 		Config::delete('system', 'banner');
@@ -1261,49 +1263,49 @@ function admin_page_site_post(App $a)
1261 1263
 	} else {
1262 1264
 		Config::set('system', 'singleuser', $singleuser);
1263 1265
 	}
1264
-	Config::set('system', 'maximagesize', $maximagesize);
1265
-	Config::set('system', 'max_image_length', $maximagelength);
1266
-	Config::set('system', 'jpeg_quality', $jpegimagequality);
1266
+	Config::set('system', 'maximagesize'           , $maximagesize);
1267
+	Config::set('system', 'max_image_length'       , $maximagelength);
1268
+	Config::set('system', 'jpeg_quality'           , $jpegimagequality);
1267 1269
 
1268
-	Config::set('config', 'register_policy', $register_policy);
1270
+	Config::set('config', 'register_policy'        , $register_policy);
1269 1271
 	Config::set('system', 'max_daily_registrations', $daily_registrations);
1270
-	Config::set('system', 'account_abandon_days', $abandon_days);
1271
-	Config::set('config', 'register_text', $register_text);
1272
-	Config::set('system', 'allowed_sites', $allowed_sites);
1273
-	Config::set('system', 'allowed_email', $allowed_email);
1274
-	Config::set('system', 'forbidden_nicknames', $forbidden_nicknames);
1275
-	Config::set('system', 'no_oembed_rich_content', $no_oembed_rich_content);
1276
-	Config::set('system', 'allowed_oembed', $allowed_oembed);
1277
-	Config::set('system', 'block_public', $block_public);
1278
-	Config::set('system', 'publish_all', $force_publish);
1279
-	Config::set('system', 'newuser_private', $newuser_private);
1280
-	Config::set('system', 'enotify_no_content', $enotify_no_content);
1281
-	Config::set('system', 'disable_embedded', $disable_embedded);
1272
+	Config::set('system', 'account_abandon_days'   , $abandon_days);
1273
+	Config::set('config', 'register_text'          , $register_text);
1274
+	Config::set('system', 'allowed_sites'          , $allowed_sites);
1275
+	Config::set('system', 'allowed_email'          , $allowed_email);
1276
+	Config::set('system', 'forbidden_nicknames'    , $forbidden_nicknames);
1277
+	Config::set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
1278
+	Config::set('system', 'allowed_oembed'         , $allowed_oembed);
1279
+	Config::set('system', 'block_public'           , $block_public);
1280
+	Config::set('system', 'publish_all'            , $force_publish);
1281
+	Config::set('system', 'newuser_private'        , $newuser_private);
1282
+	Config::set('system', 'enotify_no_content'     , $enotify_no_content);
1283
+	Config::set('system', 'disable_embedded'       , $disable_embedded);
1282 1284
 	Config::set('system', 'allow_users_remote_self', $allow_users_remote_self);
1283
-	Config::set('system', 'explicit_content', $explicit_content);
1284
-	Config::set('system', 'check_new_version_url', $check_new_version_url);
1285
+	Config::set('system', 'explicit_content'       , $explicit_content);
1286
+	Config::set('system', 'check_new_version_url'  , $check_new_version_url);
1285 1287
 
1286 1288
 	Config::set('system', 'block_extended_register', $no_multi_reg);
1287
-	Config::set('system', 'no_openid', $no_openid);
1288
-	Config::set('system', 'no_regfullname', $no_regfullname);
1289
-	Config::set('system', 'community_page_style', $community_page_style);
1289
+	Config::set('system', 'no_openid'              , $no_openid);
1290
+	Config::set('system', 'no_regfullname'         , $no_regfullname);
1291
+	Config::set('system', 'community_page_style'   , $community_page_style);
1290 1292
 	Config::set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
1291
-	Config::set('system', 'verifyssl', $verifyssl);
1292
-	Config::set('system', 'proxyuser', $proxyuser);
1293
-	Config::set('system', 'proxy', $proxy);
1294
-	Config::set('system', 'curl_timeout', $timeout);
1295
-	Config::set('system', 'dfrn_only', $dfrn_only);
1296
-	Config::set('system', 'ostatus_disabled', $ostatus_disabled);
1297
-	Config::set('system', 'ostatus_full_threads', $ostatus_full_threads);
1298
-	Config::set('system', 'diaspora_enabled', $diaspora_enabled);
1299
-
1300
-	Config::set('config', 'private_addons', $private_addons);
1301
-
1302
-	Config::set('system', 'force_ssl', $force_ssl);
1303
-	Config::set('system', 'hide_help', $hide_help);
1304
-
1305
-	Config::set('system', 'dbclean', $dbclean);
1306
-	Config::set('system', 'dbclean-expire-days', $dbclean_expire_days);
1293
+	Config::set('system', 'verifyssl'              , $verifyssl);
1294
+	Config::set('system', 'proxyuser'              , $proxyuser);
1295
+	Config::set('system', 'proxy'                  , $proxy);
1296
+	Config::set('system', 'curl_timeout'           , $timeout);
1297
+	Config::set('system', 'dfrn_only'              , $dfrn_only);
1298
+	Config::set('system', 'ostatus_disabled'       , $ostatus_disabled);
1299
+	Config::set('system', 'ostatus_full_threads'   , $ostatus_full_threads);
1300
+	Config::set('system', 'diaspora_enabled'       , $diaspora_enabled);
1301
+
1302
+	Config::set('config', 'private_addons'         , $private_addons);
1303
+
1304
+	Config::set('system', 'force_ssl'              , $force_ssl);
1305
+	Config::set('system', 'hide_help'              , $hide_help);
1306
+
1307
+	Config::set('system', 'dbclean'                , $dbclean);
1308
+	Config::set('system', 'dbclean-expire-days'    , $dbclean_expire_days);
1307 1309
 	Config::set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
1308 1310
 
1309 1311
 	if ($dbclean_unclaimed == 0) {
@@ -1330,23 +1332,23 @@ function admin_page_site_post(App $a)
1330 1332
 		$basepath = App::getRealPath($basepath);
1331 1333
 	}
1332 1334
 
1333
-	Config::set('system', 'basepath', $basepath);
1334
-	Config::set('system', 'proxy_disabled', $proxy_disabled);
1335
-	Config::set('system', 'only_tag_search', $only_tag_search);
1335
+	Config::set('system', 'basepath'         , $basepath);
1336
+	Config::set('system', 'proxy_disabled'   , $proxy_disabled);
1337
+	Config::set('system', 'only_tag_search'  , $only_tag_search);
1336 1338
 
1337
-	Config::set('system', 'worker_queues', $worker_queues);
1338
-	Config::set('system', 'worker_dont_fork', $worker_dont_fork);
1339
-	Config::set('system', 'worker_fastlane', $worker_fastlane);
1340
-	Config::set('system', 'frontend_worker', $worker_frontend);
1339
+	Config::set('system', 'worker_queues'    , $worker_queues);
1340
+	Config::set('system', 'worker_dont_fork' , $worker_dont_fork);
1341
+	Config::set('system', 'worker_fastlane'  , $worker_fastlane);
1342
+	Config::set('system', 'frontend_worker'  , $worker_frontend);
1341 1343
 
1342
-	Config::set('system', 'relay_directly', $relay_directly);
1343
-	Config::set('system', 'relay_server', $relay_server);
1344
-	Config::set('system', 'relay_subscribe', $relay_subscribe);
1345
-	Config::set('system', 'relay_scope', $relay_scope);
1344
+	Config::set('system', 'relay_directly'   , $relay_directly);
1345
+	Config::set('system', 'relay_server'     , $relay_server);
1346
+	Config::set('system', 'relay_subscribe'  , $relay_subscribe);
1347
+	Config::set('system', 'relay_scope'      , $relay_scope);
1346 1348
 	Config::set('system', 'relay_server_tags', $relay_server_tags);
1347
-	Config::set('system', 'relay_user_tags', $relay_user_tags);
1349
+	Config::set('system', 'relay_user_tags'  , $relay_user_tags);
1348 1350
 
1349
-	Config::set('system', 'rino_encrypt', $rino);
1351
+	Config::set('system', 'rino_encrypt'     , $rino);
1350 1352
 
1351 1353
 	info(L10n::t('Site settings updated.') . EOL);
1352 1354
 
@@ -1484,120 +1486,121 @@ function admin_page_site(App $a)
1484 1486
 
1485 1487
 	$t = Renderer::getMarkupTemplate('admin/site.tpl');
1486 1488
 	return Renderer::replaceMacros($t, [
1487
-		'$title' => L10n::t('Administration'),
1488
-		'$page' => L10n::t('Site'),
1489
-		'$submit' => L10n::t('Save Settings'),
1490
-		'$republish' => L10n::t('Republish users to directory'),
1491
-		'$registration' => L10n::t('Registration'),
1492
-		'$upload' => L10n::t('File upload'),
1493
-		'$corporate' => L10n::t('Policies'),
1494
-		'$advanced' => L10n::t('Advanced'),
1489
+		'$title'             => L10n::t('Administration'),
1490
+		'$page'              => L10n::t('Site'),
1491
+		'$submit'            => L10n::t('Save Settings'),
1492
+		'$republish'         => L10n::t('Republish users to directory'),
1493
+		'$registration'      => L10n::t('Registration'),
1494
+		'$upload'            => L10n::t('File upload'),
1495
+		'$corporate'         => L10n::t('Policies'),
1496
+		'$advanced'          => L10n::t('Advanced'),
1495 1497
 		'$portable_contacts' => L10n::t('Auto Discovered Contact Directory'),
1496
-		'$performance' => L10n::t('Performance'),
1497
-		'$worker_title' => L10n::t('Worker'),
1498
-		'$relay_title' => L10n::t('Message Relay'),
1499
-		'$relocate' => L10n::t('Relocate Instance'),
1500
-		'$relocate_warning' => L10n::t('Warning! Advanced function. Could make this server unreachable.'),
1501
-		'$baseurl' => System::baseUrl(true),
1498
+		'$performance'       => L10n::t('Performance'),
1499
+		'$worker_title'      => L10n::t('Worker'),
1500
+		'$relay_title'       => L10n::t('Message Relay'),
1501
+		'$relocate'          => L10n::t('Relocate Instance'),
1502
+		'$relocate_warning'  => L10n::t('Warning! Advanced function. Could make this server unreachable.'),
1503
+		'$baseurl'           => System::baseUrl(true),
1504
+
1502 1505
 		// name, label, value, help string, extra data...
1503
-		'$sitename' 		=> ['sitename', L10n::t("Site name"), Config::get('config', 'sitename'),''],
1504
-		'$hostname' 		=> ['hostname', L10n::t("Host name"), Config::get('config', 'hostname'), ""],
1505
-		'$sender_email'		=> ['sender_email', L10n::t("Sender Email"), Config::get('config', 'sender_email'), L10n::t("The email address your server shall use to send notification emails from."), "", "", "email"],
1506
-		'$banner'		=> ['banner', L10n::t("Banner/Logo"), $banner, ""],
1507
-		'$shortcut_icon'	=> ['shortcut_icon', L10n::t("Shortcut icon"), Config::get('system','shortcut_icon'),  L10n::t("Link to an icon that will be used for browsers.")],
1508
-		'$touch_icon'		=> ['touch_icon', L10n::t("Touch icon"), Config::get('system','touch_icon'),  L10n::t("Link to an icon that will be used for tablets and mobiles.")],
1509
-		'$info'			=> ['info', L10n::t('Additional Info'), $info, L10n::t('For public servers: you can add additional information here that will be listed at %s/servers.', get_server())],
1510
-		'$language' 		=> ['language', L10n::t("System language"), Config::get('system','language'), "", $lang_choices],
1511
-		'$theme' 		=> ['theme', L10n::t("System theme"), Config::get('system','theme'), L10n::t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices],
1512
-		'$theme_mobile' 	=> ['theme_mobile', L10n::t("Mobile system theme"), Config::get('system', 'mobile-theme', '---'), L10n::t("Theme for mobile devices"), $theme_choices_mobile],
1513
-		'$ssl_policy'		=> ['ssl_policy', L10n::t("SSL link policy"), (string) intval(Config::get('system','ssl_policy')), L10n::t("Determines whether generated links should be forced to use SSL"), $ssl_choices],
1514
-		'$force_ssl'		=> ['force_ssl', L10n::t("Force SSL"), Config::get('system','force_ssl'), L10n::t("Force all Non-SSL requests to SSL - Attention: on some systems it could lead to endless loops.")],
1515
-		'$hide_help'		=> ['hide_help', L10n::t("Hide help entry from navigation menu"), Config::get('system','hide_help'), L10n::t("Hides the menu entry for the Help pages from the navigation menu. You can still access it calling /help directly.")],
1516
-		'$singleuser' 		=> ['singleuser', L10n::t("Single user instance"), Config::get('system', 'singleuser', '---'), L10n::t("Make this instance multi-user or single-user for the named user"), $user_names],
1517
-		'$maximagesize'		=> ['maximagesize', L10n::t("Maximum image size"), Config::get('system','maximagesize'), L10n::t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")],
1518
-		'$maximagelength'	=> ['maximagelength', L10n::t("Maximum image length"), Config::get('system','max_image_length'), L10n::t("Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.")],
1519
-		'$jpegimagequality'	=> ['jpegimagequality', L10n::t("JPEG image quality"), Config::get('system','jpeg_quality'), L10n::t("Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.")],
1520
-
1521
-		'$register_policy'	=> ['register_policy', L10n::t("Register policy"), Config::get('config', 'register_policy'), "", $register_choices],
1522
-		'$daily_registrations'	=> ['max_daily_registrations', L10n::t("Maximum Daily Registrations"), Config::get('system', 'max_daily_registrations'), L10n::t("If registration is permitted above, this sets the maximum number of new user registrations to accept per day.  If register is set to closed, this setting has no effect.")],
1523
-		'$register_text'	=> ['register_text', L10n::t("Register text"), Config::get('config', 'register_text'), L10n::t("Will be displayed prominently on the registration page. You can use BBCode here.")],
1524
-		'$forbidden_nicknames' => ['forbidden_nicknames', L10n::t('Forbidden Nicknames'), Config::get('system', 'forbidden_nicknames'), L10n::t('Comma separated list of nicknames that are forbidden from registration. Preset is a list of role names according RFC 2142.')],
1525
-		'$abandon_days'		=> ['abandon_days', L10n::t('Accounts abandoned after x days'), Config::get('system','account_abandon_days'), L10n::t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')],
1526
-		'$allowed_sites'	=> ['allowed_sites', L10n::t("Allowed friend domains"), Config::get('system','allowed_sites'), L10n::t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")],
1527
-		'$allowed_email'	=> ['allowed_email', L10n::t("Allowed email domains"), Config::get('system','allowed_email'), L10n::t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")],
1528
-		'$no_oembed_rich_content' => ['no_oembed_rich_content', L10n::t("No OEmbed rich content"), Config::get('system','no_oembed_rich_content'), L10n::t("Don't show the rich content \x28e.g. embedded PDF\x29, except from the domains listed below.")],
1529
-		'$allowed_oembed'	=> ['allowed_oembed', L10n::t("Allowed OEmbed domains"), Config::get('system','allowed_oembed'), L10n::t("Comma separated list of domains which oembed content is allowed to be displayed. Wildcards are accepted.")],
1530
-		'$block_public'		=> ['block_public', L10n::t("Block public"), Config::get('system','block_public'), L10n::t("Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.")],
1531
-		'$force_publish'	=> ['publish_all', L10n::t("Force publish"), Config::get('system','publish_all'), L10n::t("Check to force all profiles on this site to be listed in the site directory.") . '<strong>' . L10n::t('Enabling this may violate privacy laws like the GDPR') . '</strong>'],
1532
-		'$global_directory'	=> ['directory', L10n::t("Global directory URL"), Config::get('system', 'directory', 'https://dir.friendica.social'), L10n::t("URL to the global directory. If this is not set, the global directory is completely unavailable to the application.")],
1533
-		'$newuser_private'	=> ['newuser_private', L10n::t("Private posts by default for new users"), Config::get('system','newuser_private'), L10n::t("Set default post permissions for all new members to the default privacy group rather than public.")],
1534
-		'$enotify_no_content'	=> ['enotify_no_content', L10n::t("Don't include post content in email notifications"), Config::get('system','enotify_no_content'), L10n::t("Don't include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.")],
1535
-		'$private_addons'	=> ['private_addons', L10n::t("Disallow public access to addons listed in the apps menu."), Config::get('config','private_addons'), L10n::t("Checking this box will restrict addons listed in the apps menu to members only.")],
1536
-		'$disable_embedded'	=> ['disable_embedded', L10n::t("Don't embed private images in posts"), Config::get('system','disable_embedded'), L10n::t("Don't replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.")],
1537
-		'$explicit_content' => ['explicit_content', L10n::t('Explicit Content'), Config::get('system', 'explicit_content', False), L10n::t('Set this to announce that your node is used mostly for explicit content that might not be suited for minors. This information will be published in the node information and might be used, e.g. by the global directory, to filter your node from listings of nodes to join. Additionally a note about this will be shown at the user registration page.')],
1538
-		'$allow_users_remote_self' => ['allow_users_remote_self', L10n::t('Allow Users to set remote_self'), Config::get('system','allow_users_remote_self'), L10n::t('With checking this, every user is allowed to mark every contact as a remote_self in the repair contact dialog. Setting this flag on a contact causes mirroring every posting of that contact in the users stream.')],
1539
-		'$no_multi_reg'		=> ['no_multi_reg', L10n::t("Block multiple registrations"),  Config::get('system','block_extended_register'), L10n::t("Disallow users to register additional accounts for use as pages.")],
1540
-		'$no_openid'		=> ['no_openid', L10n::t("OpenID support"), !Config::get('system','no_openid'), L10n::t("OpenID support for registration and logins.")],
1541
-		'$no_regfullname'	=> ['no_regfullname', L10n::t("Fullname check"), !Config::get('system','no_regfullname'), L10n::t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")],
1542
-		'$community_page_style' => ['community_page_style', L10n::t("Community pages for visitors"), Config::get('system','community_page_style'), L10n::t("Which community pages should be available for visitors. Local users always see both pages."), $community_page_style_choices],
1543
-		'$max_author_posts_community_page' => ['max_author_posts_community_page', L10n::t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), L10n::t("The maximum number of posts per user on the community page. \x28Not valid for 'Global Community'\x29")],
1544
-		'$ostatus_disabled' 	=> ['ostatus_disabled', L10n::t("Enable OStatus support"), !Config::get('system','ostatus_disabled'), L10n::t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")],
1545
-		'$ostatus_full_threads'	=> ['ostatus_full_threads', L10n::t("Only import OStatus/ActivityPub threads from our contacts"), Config::get('system','ostatus_full_threads'), L10n::t("Normally we import every content from our OStatus and ActivityPub contacts. With this option we only store threads that are started by a contact that is known on our system.")],
1546
-		'$ostatus_not_able'	=> L10n::t("OStatus support can only be enabled if threading is enabled."),
1547
-		'$diaspora_able'	=> $diaspora_able,
1548
-		'$diaspora_not_able'	=> L10n::t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
1549
-		'$diaspora_enabled'	=> ['diaspora_enabled', L10n::t("Enable Diaspora support"), Config::get('system', 'diaspora_enabled', $diaspora_able), L10n::t("Provide built-in Diaspora network compatibility.")],
1550
-		'$dfrn_only'		=> ['dfrn_only', L10n::t('Only allow Friendica contacts'), Config::get('system','dfrn_only'), L10n::t("All contacts must use Friendica protocols. All other built-in communication protocols disabled.")],
1551
-		'$verifyssl' 		=> ['verifyssl', L10n::t("Verify SSL"), Config::get('system','verifyssl'), L10n::t("If you wish, you can turn on strict certificate checking. This will mean you cannot connect \x28at all\x29 to self-signed SSL sites.")],
1552
-		'$proxyuser'		=> ['proxyuser', L10n::t("Proxy user"), Config::get('system','proxyuser'), ""],
1553
-		'$proxy'		=> ['proxy', L10n::t("Proxy URL"), Config::get('system','proxy'), ""],
1554
-		'$timeout'		=> ['timeout', L10n::t("Network timeout"), Config::get('system', 'curl_timeout', 60), L10n::t("Value is in seconds. Set to 0 for unlimited \x28not recommended\x29.")],
1555
-		'$maxloadavg'		=> ['maxloadavg', L10n::t("Maximum Load Average"), Config::get('system', 'maxloadavg', 50), L10n::t("Maximum system load before delivery and poll processes are deferred - default 50.")],
1556
-		'$maxloadavg_frontend'	=> ['maxloadavg_frontend', L10n::t("Maximum Load Average \x28Frontend\x29"), Config::get('system', 'maxloadavg_frontend', 50), L10n::t("Maximum system load before the frontend quits service - default 50.")],
1557
-		'$min_memory'		=> ['min_memory', L10n::t("Minimal Memory"), Config::get('system', 'min_memory', 0), L10n::t("Minimal free memory in MB for the worker. Needs access to /proc/meminfo - default 0 \x28deactivated\x29.")],
1558
-		'$optimize_max_tablesize'=> ['optimize_max_tablesize', L10n::t("Maximum table size for optimization"), $optimize_max_tablesize, L10n::t("Maximum table size \x28in MB\x29 for the automatic optimization. Enter -1 to disable it.")],
1559
-		'$optimize_fragmentation'=> ['optimize_fragmentation', L10n::t("Minimum level of fragmentation"), Config::get('system', 'optimize_fragmentation', 30), L10n::t("Minimum fragmenation level to start the automatic optimization - default value is 30%.")],
1560
-
1561
-		'$poco_completion'	=> ['poco_completion', L10n::t("Periodical check of global contacts"), Config::get('system','poco_completion'), L10n::t("If enabled, the global contacts are checked periodically for missing or outdated data and the vitality of the contacts and servers.")],
1562
-		'$poco_requery_days'	=> ['poco_requery_days', L10n::t("Days between requery"), Config::get('system','poco_requery_days'), L10n::t("Number of days after which a server is requeried for his contacts.")],
1563
-		'$poco_discovery'	=> ['poco_discovery', L10n::t("Discover contacts from other servers"), (string) intval(Config::get('system','poco_discovery')), L10n::t("Periodically query other servers for contacts. You can choose between 'users': the users on the remote system, 'Global Contacts': active contacts that are known on the system. The fallback is meant for Redmatrix servers and older friendica servers, where global contacts weren't available. The fallback increases the server load, so the recommened setting is 'Users, Global Contacts'."), $poco_discovery_choices],
1564
-		'$poco_discovery_since'	=> ['poco_discovery_since', L10n::t("Timeframe for fetching global contacts"), (string) intval(Config::get('system','poco_discovery_since')), L10n::t("When the discovery is activated, this value defines the timeframe for the activity of the global contacts that are fetched from other servers."), $poco_discovery_since_choices],
1565
-		'$poco_local_search'	=> ['poco_local_search', L10n::t("Search the local directory"), Config::get('system','poco_local_search'), L10n::t("Search the local directory instead of the global directory. When searching locally, every search will be executed on the global directory in the background. This improves the search results when the search is repeated.")],
1566
-
1567
-		'$nodeinfo'		=> ['nodeinfo', L10n::t("Publish server information"), Config::get('system','nodeinfo'), L10n::t("If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See <a href='http://the-federation.info/'>the-federation.info</a> for details.")],
1568
-
1569
-		'$check_new_version_url' => ['check_new_version_url', L10n::t("Check upstream version"), Config::get('system', 'check_new_version_url'), L10n::t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices],
1570
-		'$suppress_tags'	=> ['suppress_tags', L10n::t("Suppress Tags"), Config::get('system','suppress_tags'), L10n::t("Suppress showing a list of hashtags at the end of the posting.")],
1571
-		'$dbclean'		=> ['dbclean', L10n::t("Clean database"), Config::get('system','dbclean', false), L10n::t("Remove old remote items, orphaned database records and old content from some other helper tables.")],
1572
-		'$dbclean_expire_days' 	=> ['dbclean_expire_days', L10n::t("Lifespan of remote items"), Config::get('system','dbclean-expire-days', 0), L10n::t("When the database cleanup is enabled, this defines the days after which remote items will be deleted. Own items, and marked or filed items are always kept. 0 disables this behaviour.")],
1573
-		'$dbclean_unclaimed' 	=> ['dbclean_unclaimed', L10n::t("Lifespan of unclaimed items"), Config::get('system','dbclean-expire-unclaimed', 90), L10n::t("When the database cleanup is enabled, this defines the days after which unclaimed remote items (mostly content from the relay) will be deleted. Default value is 90 days. Defaults to the general lifespan value of remote items if set to 0.")],
1574
-		'$dbclean_expire_conv' 	=> ['dbclean_expire_conv', L10n::t("Lifespan of raw conversation data"), Config::get('system','dbclean_expire_conversation', 90), L10n::t("The conversation data is used for ActivityPub and OStatus, as well as for debug purposes. It should be safe to remove it after 14 days, default is 90 days.")],
1575
-		'$itemcache'		=> ['itemcache', L10n::t("Path to item cache"), Config::get('system','itemcache'), L10n::t("The item caches buffers generated bbcode and external images.")],
1576
-		'$itemcache_duration' 	=> ['itemcache_duration', L10n::t("Cache duration in seconds"), Config::get('system','itemcache_duration'), L10n::t("How long should the cache files be hold? Default value is 86400 seconds \x28One day\x29. To disable the item cache, set the value to -1.")],
1577
-		'$max_comments' 	=> ['max_comments', L10n::t("Maximum numbers of comments per post"), Config::get('system','max_comments'), L10n::t("How much comments should be shown for each post? Default value is 100.")],
1578
-		'$temppath'		=> ['temppath', L10n::t("Temp path"), Config::get('system','temppath'), L10n::t("If you have a restricted system where the webserver can't access the system temp path, enter another path here.")],
1579
-		'$basepath'		=> ['basepath', L10n::t("Base path to installation"), Config::get('system','basepath'), L10n::t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot.")],
1580
-		'$proxy_disabled'	=> ['proxy_disabled', L10n::t("Disable picture proxy"), Config::get('system','proxy_disabled'), L10n::t("The picture proxy increases performance and privacy. It shouldn't be used on systems with very low bandwidth.")],
1581
-		'$only_tag_search'	=> ['only_tag_search', L10n::t("Only search in tags"), Config::get('system','only_tag_search'), L10n::t("On large systems the text search can slow down the system extremely.")],
1582
-
1583
-		'$relocate_url'		=> ['relocate_url', L10n::t("New base url"), System::baseUrl(), L10n::t("Change base url for this server. Sends relocate message to all Friendica and Diaspora* contacts of all users.")],
1584
-
1585
-		'$rino' 		=> ['rino', L10n::t("RINO Encryption"), intval(Config::get('system','rino_encrypt')), L10n::t("Encryption layer between nodes."), [0 => L10n::t("Disabled"), 1 => L10n::t("Enabled")]],
1586
-
1587
-		'$worker_queues' 	=> ['worker_queues', L10n::t("Maximum number of parallel workers"), Config::get('system','worker_queues'), L10n::t("On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.", 5, 20, 10)],
1588
-		'$worker_dont_fork'	=> ['worker_dont_fork', L10n::t("Don't use 'proc_open' with the worker"), Config::get('system','worker_dont_fork'), L10n::t("Enable this if your system doesn't allow the use of 'proc_open'. This can happen on shared hosters. If this is enabled you should increase the frequency of worker calls in your crontab.")],
1589
-		'$worker_fastlane'	=> ['worker_fastlane', L10n::t("Enable fastlane"), Config::get('system','worker_fastlane'), L10n::t("When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.")],
1590
-		'$worker_frontend'	=> ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system','frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed \x28e.g. messages being delivered\x29. On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', System::baseUrl())],
1591
-
1592
-		'$relay_subscribe' 	=> ['relay_subscribe', L10n::t("Subscribe to relay"), Config::get('system','relay_subscribe'), L10n::t("Enables the receiving of public posts from the relay. They will be included in the search, subscribed tags and on the global community page.")],
1593
-		'$relay_server'		=> ['relay_server', L10n::t("Relay server"), Config::get('system', 'relay_server', 'https://relay.diasp.org'), L10n::t("Address of the relay server where public posts should be send to. For example https://relay.diasp.org")],
1594
-		'$relay_directly'	=> ['relay_directly', L10n::t("Direct relay transfer"), Config::get('system','relay_directly'), L10n::t("Enables the direct transfer to other servers without using the relay servers")],
1595
-		'$relay_scope'		=> ['relay_scope', L10n::t("Relay scope"), Config::get('system','relay_scope'), L10n::t("Can be 'all' or 'tags'. 'all' means that every public post should be received. 'tags' means that only posts with selected tags should be received."), ['' => L10n::t('Disabled'), 'all' => L10n::t('all'), 'tags' => L10n::t('tags')]],
1596
-		'$relay_server_tags' 	=> ['relay_server_tags', L10n::t("Server tags"), Config::get('system','relay_server_tags'), L10n::t("Comma separated list of tags for the 'tags' subscription.")],
1597
-		'$relay_user_tags' 	=> ['relay_user_tags', L10n::t("Allow user tags"), Config::get('system', 'relay_user_tags', true), L10n::t("If enabled, the tags from the saved searches will used for the 'tags' subscription in addition to the 'relay_server_tags'.")],
1598
-
1599
-		'$form_security_token'	=> BaseModule::getFormSecurityToken("admin_site"),
1600
-		'$relocate_button'      => L10n::t('Start Relocation'),
1506
+		'$sitename'         => ['sitename', L10n::t("Site name"), Config::get('config', 'sitename'), ''],
1507
+		'$hostname'         => ['hostname', L10n::t("Host name"), Config::get('config', 'hostname'), ""],
1508
+		'$sender_email'     => ['sender_email', L10n::t("Sender Email"), Config::get('config', 'sender_email'), L10n::t("The email address your server shall use to send notification emails from."), "", "", "email"],
1509
+		'$banner'           => ['banner', L10n::t("Banner/Logo"), $banner, ""],
1510
+		'$shortcut_icon'    => ['shortcut_icon', L10n::t("Shortcut icon"), Config::get('system', 'shortcut_icon'), L10n::t("Link to an icon that will be used for browsers.")],
1511
+		'$touch_icon'       => ['touch_icon', L10n::t("Touch icon"), Config::get('system', 'touch_icon'), L10n::t("Link to an icon that will be used for tablets and mobiles.")],
1512
+		'$info'             => ['info', L10n::t('Additional Info'), $info, L10n::t('For public servers: you can add additional information here that will be listed at %s/servers.', get_server())],
1513
+		'$language'         => ['language', L10n::t("System language"), Config::get('system', 'language'), "", $lang_choices],
1514
+		'$theme'            => ['theme', L10n::t("System theme"), Config::get('system', 'theme'), L10n::t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices],
1515
+		'$theme_mobile'     => ['theme_mobile', L10n::t("Mobile system theme"), Config::get('system', 'mobile-theme', '---'), L10n::t("Theme for mobile devices"), $theme_choices_mobile],
1516
+		'$ssl_policy'       => ['ssl_policy', L10n::t("SSL link policy"), (string)intval(Config::get('system', 'ssl_policy')), L10n::t("Determines whether generated links should be forced to use SSL"), $ssl_choices],
1517
+		'$force_ssl'        => ['force_ssl', L10n::t("Force SSL"), Config::get('system', 'force_ssl'), L10n::t("Force all Non-SSL requests to SSL - Attention: on some systems it could lead to endless loops.")],
1518
+		'$hide_help'        => ['hide_help', L10n::t("Hide help entry from navigation menu"), Config::get('system', 'hide_help'), L10n::t("Hides the menu entry for the Help pages from the navigation menu. You can still access it calling /help directly.")],
1519
+		'$singleuser'       => ['singleuser', L10n::t("Single user instance"), Config::get('system', 'singleuser', '---'), L10n::t("Make this instance multi-user or single-user for the named user"), $user_names],
1520
+		'$maximagesize'     => ['maximagesize', L10n::t("Maximum image size"), Config::get('system', 'maximagesize'), L10n::t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")],
1521
+		'$maximagelength'   => ['maximagelength', L10n::t("Maximum image length"), Config::get('system', 'max_image_length'), L10n::t("Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.")],
1522
+		'$jpegimagequality' => ['jpegimagequality', L10n::t("JPEG image quality"), Config::get('system', 'jpeg_quality'), L10n::t("Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.")],
1523
+
1524
+		'$register_policy'        => ['register_policy', L10n::t("Register policy"), Config::get('config', 'register_policy'), "", $register_choices],
1525
+		'$daily_registrations'    => ['max_daily_registrations', L10n::t("Maximum Daily Registrations"), Config::get('system', 'max_daily_registrations'), L10n::t("If registration is permitted above, this sets the maximum number of new user registrations to accept per day.  If register is set to closed, this setting has no effect.")],
1526
+		'$register_text'          => ['register_text', L10n::t("Register text"), Config::get('config', 'register_text'), L10n::t("Will be displayed prominently on the registration page. You can use BBCode here.")],
1527
+		'$forbidden_nicknames'    => ['forbidden_nicknames', L10n::t('Forbidden Nicknames'), Config::get('system', 'forbidden_nicknames'), L10n::t('Comma separated list of nicknames that are forbidden from registration. Preset is a list of role names according RFC 2142.')],
1528
+		'$abandon_days'           => ['abandon_days', L10n::t('Accounts abandoned after x days'), Config::get('system', 'account_abandon_days'), L10n::t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')],
1529
+		'$allowed_sites'          => ['allowed_sites', L10n::t("Allowed friend domains"), Config::get('system', 'allowed_sites'), L10n::t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")],
1530
+		'$allowed_email'          => ['allowed_email', L10n::t("Allowed email domains"), Config::get('system', 'allowed_email'), L10n::t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")],
1531
+		'$no_oembed_rich_content' => ['no_oembed_rich_content', L10n::t("No OEmbed rich content"), Config::get('system', 'no_oembed_rich_content'), L10n::t("Don't show the rich content \x28e.g. embedded PDF\x29, except from the domains listed below.")],
1532
+		'$allowed_oembed'         => ['allowed_oembed', L10n::t("Allowed OEmbed domains"), Config::get('system', 'allowed_oembed'), L10n::t("Comma separated list of domains which oembed content is allowed to be displayed. Wildcards are accepted.")],
1533
+		'$block_public'           => ['block_public', L10n::t("Block public"), Config::get('system', 'block_public'), L10n::t("Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.")],
1534
+		'$force_publish'          => ['publish_all', L10n::t("Force publish"), Config::get('system', 'publish_all'), L10n::t("Check to force all profiles on this site to be listed in the site directory.") . '<strong>' . L10n::t('Enabling this may violate privacy laws like the GDPR') . '</strong>'],
1535
+		'$global_directory'       => ['directory', L10n::t("Global directory URL"), Config::get('system', 'directory', 'https://dir.friendica.social'), L10n::t("URL to the global directory. If this is not set, the global directory is completely unavailable to the application.")],
1536
+		'$newuser_private'        => ['newuser_private', L10n::t("Private posts by default for new users"), Config::get('system', 'newuser_private'), L10n::t("Set default post permissions for all new members to the default privacy group rather than public.")],
1537
+		'$enotify_no_content'     => ['enotify_no_content', L10n::t("Don't include post content in email notifications"), Config::get('system', 'enotify_no_content'), L10n::t("Don't include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.")],
1538
+		'$private_addons'         => ['private_addons', L10n::t("Disallow public access to addons listed in the apps menu."), Config::get('config', 'private_addons'), L10n::t("Checking this box will restrict addons listed in the apps menu to members only.")],
1539
+		'$disable_embedded'       => ['disable_embedded', L10n::t("Don't embed private images in posts"), Config::get('system', 'disable_embedded'), L10n::t("Don't replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.")],
1540
+		'$explicit_content'       => ['explicit_content', L10n::t('Explicit Content'), Config::get('system', 'explicit_content', false), L10n::t('Set this to announce that your node is used mostly for explicit content that might not be suited for minors. This information will be published in the node information and might be used, e.g. by the global directory, to filter your node from listings of nodes to join. Additionally a note about this will be shown at the user registration page.')],
1541
+		'$allow_users_remote_self'=> ['allow_users_remote_self', L10n::t('Allow Users to set remote_self'), Config::get('system', 'allow_users_remote_self'), L10n::t('With checking this, every user is allowed to mark every contact as a remote_self in the repair contact dialog. Setting this flag on a contact causes mirroring every posting of that contact in the users stream.')],
1542
+		'$no_multi_reg'           => ['no_multi_reg', L10n::t("Block multiple registrations"), Config::get('system', 'block_extended_register'), L10n::t("Disallow users to register additional accounts for use as pages.")],
1543
+		'$no_openid'              => ['no_openid', L10n::t("Disable OpenID"), Config::get('system', 'no_openid'), L10n::t("Disable OpenID support for registration and logins.")],
1544
+		'$no_regfullname'         => ['no_regfullname', L10n::t("No Fullname check"), Config::get('system', 'no_regfullname'), L10n::t("Allow users to register without a space between the first name and the last name in their full name.")],
1545
+		'$community_page_style'   => ['community_page_style', L10n::t("Community pages for visitors"), Config::get('system', 'community_page_style'), L10n::t("Which community pages should be available for visitors. Local users always see both pages."), $community_page_style_choices],
1546
+		'$max_author_posts_community_page' => ['max_author_posts_community_page', L10n::t("Posts per user on community page"), Config::get('system', 'max_author_posts_community_page'), L10n::t("The maximum number of posts per user on the community page. \x28Not valid for 'Global Community'\x29")],
1547
+		'$ostatus_disabled'       => ['ostatus_disabled', L10n::t("Disable OStatus support"), Config::get('system', 'ostatus_disabled'), L10n::t("Disable built-in OStatus (StatusNet, GNU Social etc.) compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")],
1548
+		'$ostatus_full_threads'   => ['ostatus_full_threads', L10n::t("Only import OStatus/ActivityPub threads from our contacts"), Config::get('system', 'ostatus_full_threads'), L10n::t("Normally we import every content from our OStatus and ActivityPub contacts. With this option we only store threads that are started by a contact that is known on our system.")],
1549
+		'$ostatus_not_able'       => L10n::t("OStatus support can only be enabled if threading is enabled."),
1550
+		'$diaspora_able'          => $diaspora_able,
1551
+		'$diaspora_not_able'      => L10n::t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
1552
+		'$diaspora_enabled'       => ['diaspora_enabled', L10n::t("Enable Diaspora support"), Config::get('system', 'diaspora_enabled', $diaspora_able), L10n::t("Provide built-in Diaspora network compatibility.")],
1553
+		'$dfrn_only'              => ['dfrn_only', L10n::t('Only allow Friendica contacts'), Config::get('system', 'dfrn_only'), L10n::t("All contacts must use Friendica protocols. All other built-in communication protocols disabled.")],
1554
+		'$verifyssl'              => ['verifyssl', L10n::t("Verify SSL"), Config::get('system', 'verifyssl'), L10n::t("If you wish, you can turn on strict certificate checking. This will mean you cannot connect \x28at all\x29 to self-signed SSL sites.")],
1555
+		'$proxyuser'              => ['proxyuser', L10n::t("Proxy user"), Config::get('system', 'proxyuser'), ""],
1556
+		'$proxy'                  => ['proxy', L10n::t("Proxy URL"), Config::get('system', 'proxy'), ""],
1557
+		'$timeout'                => ['timeout', L10n::t("Network timeout"), Config::get('system', 'curl_timeout', 60), L10n::t("Value is in seconds. Set to 0 for unlimited \x28not recommended\x29.")],
1558
+		'$maxloadavg'             => ['maxloadavg', L10n::t("Maximum Load Average"), Config::get('system', 'maxloadavg', 50), L10n::t("Maximum system load before delivery and poll processes are deferred - default 50.")],
1559
+		'$maxloadavg_frontend'    => ['maxloadavg_frontend', L10n::t("Maximum Load Average \x28Frontend\x29"), Config::get('system', 'maxloadavg_frontend', 50), L10n::t("Maximum system load before the frontend quits service - default 50.")],
1560
+		'$min_memory'             => ['min_memory', L10n::t("Minimal Memory"), Config::get('system', 'min_memory', 0), L10n::t("Minimal free memory in MB for the worker. Needs access to /proc/meminfo - default 0 \x28deactivated\x29.")],
1561
+		'$optimize_max_tablesize' => ['optimize_max_tablesize', L10n::t("Maximum table size for optimization"), $optimize_max_tablesize, L10n::t("Maximum table size \x28in MB\x29 for the automatic optimization. Enter -1 to disable it.")],
1562
+		'$optimize_fragmentation' => ['optimize_fragmentation', L10n::t("Minimum level of fragmentation"), Config::get('system', 'optimize_fragmentation', 30), L10n::t("Minimum fragmenation level to start the automatic optimization - default value is 30%.")],
1563
+
1564
+		'$poco_completion'        => ['poco_completion', L10n::t("Periodical check of global contacts"), Config::get('system', 'poco_completion'), L10n::t("If enabled, the global contacts are checked periodically for missing or outdated data and the vitality of the contacts and servers.")],
1565
+		'$poco_requery_days'      => ['poco_requery_days', L10n::t("Days between requery"), Config::get('system', 'poco_requery_days'), L10n::t("Number of days after which a server is requeried for his contacts.")],
1566
+		'$poco_discovery'         => ['poco_discovery', L10n::t("Discover contacts from other servers"), (string)intval(Config::get('system', 'poco_discovery')), L10n::t("Periodically query other servers for contacts. You can choose between 'users': the users on the remote system, 'Global Contacts': active contacts that are known on the system. The fallback is meant for Redmatrix servers and older friendica servers, where global contacts weren't available. The fallback increases the server load, so the recommened setting is 'Users, Global Contacts'."), $poco_discovery_choices],
1567
+		'$poco_discovery_since'   => ['poco_discovery_since', L10n::t("Timeframe for fetching global contacts"), (string)intval(Config::get('system', 'poco_discovery_since')), L10n::t("When the discovery is activated, this value defines the timeframe for the activity of the global contacts that are fetched from other servers."), $poco_discovery_since_choices],
1568
+		'$poco_local_search'      => ['poco_local_search', L10n::t("Search the local directory"), Config::get('system', 'poco_local_search'), L10n::t("Search the local directory instead of the global directory. When searching locally, every search will be executed on the global directory in the background. This improves the search results when the search is repeated.")],
1569
+
1570
+		'$nodeinfo'               => ['nodeinfo', L10n::t("Publish server information"), Config::get('system', 'nodeinfo'), L10n::t("If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See <a href='http://the-federation.info/'>the-federation.info</a> for details.")],
1571
+
1572
+		'$check_new_version_url'  => ['check_new_version_url', L10n::t("Check upstream version"), Config::get('system', 'check_new_version_url'), L10n::t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices],
1573
+		'$suppress_tags'          => ['suppress_tags', L10n::t("Suppress Tags"), Config::get('system', 'suppress_tags'), L10n::t("Suppress showing a list of hashtags at the end of the posting.")],
1574
+		'$dbclean'                => ['dbclean', L10n::t("Clean database"), Config::get('system', 'dbclean', false), L10n::t("Remove old remote items, orphaned database records and old content from some other helper tables.")],
1575
+		'$dbclean_expire_days'    => ['dbclean_expire_days', L10n::t("Lifespan of remote items"), Config::get('system', 'dbclean-expire-days', 0), L10n::t("When the database cleanup is enabled, this defines the days after which remote items will be deleted. Own items, and marked or filed items are always kept. 0 disables this behaviour.")],
1576
+		'$dbclean_unclaimed'      => ['dbclean_unclaimed', L10n::t("Lifespan of unclaimed items"), Config::get('system', 'dbclean-expire-unclaimed', 90), L10n::t("When the database cleanup is enabled, this defines the days after which unclaimed remote items (mostly content from the relay) will be deleted. Default value is 90 days. Defaults to the general lifespan value of remote items if set to 0.")],
1577
+		'$dbclean_expire_conv'    => ['dbclean_expire_conv', L10n::t("Lifespan of raw conversation data"), Config::get('system', 'dbclean_expire_conversation', 90), L10n::t("The conversation data is used for ActivityPub and OStatus, as well as for debug purposes. It should be safe to remove it after 14 days, default is 90 days.")],
1578
+		'$itemcache'              => ['itemcache', L10n::t("Path to item cache"), Config::get('system', 'itemcache'), L10n::t("The item caches buffers generated bbcode and external images.")],
1579
+		'$itemcache_duration'     => ['itemcache_duration', L10n::t("Cache duration in seconds"), Config::get('system', 'itemcache_duration'), L10n::t("How long should the cache files be hold? Default value is 86400 seconds \x28One day\x29. To disable the item cache, set the value to -1.")],
1580
+		'$max_comments'           => ['max_comments', L10n::t("Maximum numbers of comments per post"), Config::get('system', 'max_comments'), L10n::t("How much comments should be shown for each post? Default value is 100.")],
1581
+		'$temppath'               => ['temppath', L10n::t("Temp path"), Config::get('system', 'temppath'), L10n::t("If you have a restricted system where the webserver can't access the system temp path, enter another path here.")],
1582
+		'$basepath'               => ['basepath', L10n::t("Base path to installation"), Config::get('system', 'basepath'), L10n::t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot.")],
1583
+		'$proxy_disabled'         => ['proxy_disabled', L10n::t("Disable picture proxy"), Config::get('system', 'proxy_disabled'), L10n::t("The picture proxy increases performance and privacy. It shouldn't be used on systems with very low bandwidth.")],
1584
+		'$only_tag_search'        => ['only_tag_search', L10n::t("Only search in tags"), Config::get('system', 'only_tag_search'), L10n::t("On large systems the text search can slow down the system extremely.")],
1585
+
1586
+		'$relocate_url'           => ['relocate_url', L10n::t("New base url"), System::baseUrl(), L10n::t("Change base url for this server. Sends relocate message to all Friendica and Diaspora* contacts of all users.")],
1587
+
1588
+		'$rino'                   => ['rino', L10n::t("RINO Encryption"), intval(Config::get('system', 'rino_encrypt')), L10n::t("Encryption layer between nodes."), [0 => L10n::t("Disabled"), 1 => L10n::t("Enabled")]],
1589
+
1590
+		'$worker_queues'          => ['worker_queues', L10n::t("Maximum number of parallel workers"), Config::get('system', 'worker_queues'), L10n::t("On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.", 5, 20, 10)],
1591
+		'$worker_dont_fork'       => ['worker_dont_fork', L10n::t("Don't use 'proc_open' with the worker"), Config::get('system', 'worker_dont_fork'), L10n::t("Enable this if your system doesn't allow the use of 'proc_open'. This can happen on shared hosters. If this is enabled you should increase the frequency of worker calls in your crontab.")],
1592
+		'$worker_fastlane'        => ['worker_fastlane', L10n::t("Enable fastlane"), Config::get('system', 'worker_fastlane'), L10n::t("When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.")],
1593
+		'$worker_frontend'        => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system', 'frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed \x28e.g. messages being delivered\x29. On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', System::baseUrl())],
1594
+
1595
+		'$relay_subscribe'        => ['relay_subscribe', L10n::t("Subscribe to relay"), Config::get('system', 'relay_subscribe'), L10n::t("Enables the receiving of public posts from the relay. They will be included in the search, subscribed tags and on the global community page.")],
1596
+		'$relay_server'           => ['relay_server', L10n::t("Relay server"), Config::get('system', 'relay_server', 'https://relay.diasp.org'), L10n::t("Address of the relay server where public posts should be send to. For example https://relay.diasp.org")],
1597
+		'$relay_directly'         => ['relay_directly', L10n::t("Direct relay transfer"), Config::get('system', 'relay_directly'), L10n::t("Enables the direct transfer to other servers without using the relay servers")],
1598
+		'$relay_scope'            => ['relay_scope', L10n::t("Relay scope"), Config::get('system', 'relay_scope'), L10n::t("Can be 'all' or 'tags'. 'all' means that every public post should be received. 'tags' means that only posts with selected tags should be received."), ['' => L10n::t('Disabled'), 'all' => L10n::t('all'), 'tags' => L10n::t('tags')]],
1599
+		'$relay_server_tags'      => ['relay_server_tags', L10n::t("Server tags"), Config::get('system', 'relay_server_tags'), L10n::t("Comma separated list of tags for the 'tags' subscription.")],
1600
+		'$relay_user_tags'        => ['relay_user_tags', L10n::t("Allow user tags"), Config::get('system', 'relay_user_tags', true), L10n::t("If enabled, the tags from the saved searches will used for the 'tags' subscription in addition to the 'relay_server_tags'.")],
1601
+
1602
+		'$form_security_token'    => BaseModule::getFormSecurityToken("admin_site"),
1603
+		'$relocate_button'        => L10n::t('Start Relocation'),
1601 1604
 	]);
1602 1605
 }
1603 1606
 
@@ -1774,14 +1777,14 @@ function admin_page_users_post(App $a)
1774 1777
 			'body'     => $body]);
1775 1778
 	}
1776 1779
 
1777
-	if (x($_POST, 'page_users_block')) {
1780
+	if (!empty($_POST['page_users_block'])) {
1778 1781
 		foreach ($users as $uid) {
1779 1782
 			q("UPDATE `user` SET `blocked` = 1-`blocked` WHERE `uid` = %s", intval($uid)
1780 1783
 			);
1781 1784
 		}
1782 1785
 		notice(L10n::tt("%s user blocked/unblocked", "%s users blocked/unblocked", count($users)));
1783 1786
 	}
1784
-	if (x($_POST, 'page_users_delete')) {
1787
+	if (!empty($_POST['page_users_delete'])) {
1785 1788
 		foreach ($users as $uid) {
1786 1789
 			if (local_user() != $uid) {
1787 1790
 				User::remove($uid);
@@ -1792,13 +1795,13 @@ function admin_page_users_post(App $a)
1792 1795
 		notice(L10n::tt("%s user deleted", "%s users deleted", count($users)));
1793 1796
 	}
1794 1797
 
1795
-	if (x($_POST, 'page_users_approve')) {
1798
+	if (!empty($_POST['page_users_approve'])) {
1796 1799
 		require_once "mod/regmod.php";
1797 1800
 		foreach ($pending as $hash) {
1798 1801
 			user_allow($hash);
1799 1802
 		}
1800 1803
 	}
1801
-	if (x($_POST, 'page_users_deny')) {
1804
+	if (!empty($_POST['page_users_deny'])) {
1802 1805
 		require_once "mod/regmod.php";
1803 1806
 		foreach ($pending as $hash) {
1804 1807
 			user_deny($hash);
@@ -1872,7 +1875,7 @@ function admin_page_users(App $a)
1872 1875
 
1873 1876
 	$order = "contact.name";
1874 1877
 	$order_direction = "+";
1875
-	if (x($_GET, 'o')) {
1878
+	if (!empty($_GET['o'])) {
1876 1879
 		$new_order = $_GET['o'];
1877 1880
 		if ($new_order[0] === "-") {
1878 1881
 			$order_direction = "-";
@@ -2098,7 +2101,7 @@ function admin_page_addons(App $a, array $addons_admin)
2098 2101
 	/*
2099 2102
 	 * List addons
2100 2103
 	 */
2101
-	if (x($_GET, "a") && $_GET['a'] == "r") {
2104
+	if (!empty($_GET['a']) && $_GET['a'] == "r") {
2102 2105
 		BaseModule::checkFormSecurityTokenRedirectOnError($a->getBaseURL() . '/admin/addons', 'admin_themes', 't');
2103 2106
 		Addon::reload();
2104 2107
 		info("Addons reloaded");
@@ -2147,14 +2150,14 @@ function admin_page_addons(App $a, array $addons_admin)
2147 2150
 }
2148 2151
 
2149 2152
 /**
2150
- * @param array $themes
2153
+ * @param array  $themes
2151 2154
  * @param string $th
2152
- * @param int $result
2155
+ * @param int    $result
2153 2156
  */
2154 2157
 function toggle_theme(&$themes, $th, &$result)
2155 2158
 {
2156 2159
 	$count = count($themes);
2157
-	for ($x = 0; $x < $count; $x ++) {
2160
+	for ($x = 0; $x < $count; $x++) {
2158 2161
 		if ($themes[$x]['name'] === $th) {
2159 2162
 			if ($themes[$x]['allowed']) {
2160 2163
 				$themes[$x]['allowed'] = 0;
@@ -2168,14 +2171,14 @@ function toggle_theme(&$themes, $th, &$result)
2168 2171
 }
2169 2172
 
2170 2173
 /**
2171
- * @param array $themes
2174
+ * @param array  $themes
2172 2175
  * @param string $th
2173 2176
  * @return int
2174 2177
  */
2175 2178
 function theme_status($themes, $th)
2176 2179
 {
2177 2180
 	$count = count($themes);
2178
-	for ($x = 0; $x < $count; $x ++) {
2181
+	for ($x = 0; $x < $count; $x++) {
2179 2182
 		if ($themes[$x]['name'] === $th) {
2180 2183
 			if ($themes[$x]['allowed']) {
2181 2184
 				return 1;
@@ -2276,7 +2279,7 @@ function admin_page_themes(App $a)
2276 2279
 			return '';
2277 2280
 		}
2278 2281
 
2279
-		if (x($_GET, "a") && $_GET['a'] == "t") {
2282
+		if (!empty($_GET['a']) && $_GET['a'] == "t") {
2280 2283
 			BaseModule::checkFormSecurityTokenRedirectOnError('/admin/themes', 'admin_themes', 't');
2281 2284
 
2282 2285
 			// Toggle theme status
@@ -2364,7 +2367,7 @@ function admin_page_themes(App $a)
2364 2367
 	}
2365 2368
 
2366 2369
 	// reload active themes
2367
-	if (x($_GET, "a") && $_GET['a'] == "r") {
2370
+	if (!empty($_GET['a']) && $_GET['a'] == "r") {
2368 2371
 		BaseModule::checkFormSecurityTokenRedirectOnError(System::baseUrl() . '/admin/themes', 'admin_themes', 't');
2369 2372
 		foreach ($themes as $th) {
2370 2373
 			if ($th['allowed']) {
@@ -2409,12 +2412,12 @@ function admin_page_themes(App $a)
2409 2412
  */
2410 2413
 function admin_page_logs_post(App $a)
2411 2414
 {
2412
-	if (x($_POST, "page_logs")) {
2415
+	if (!empty($_POST['page_logs'])) {
2413 2416
 		BaseModule::checkFormSecurityTokenRedirectOnError('/admin/logs', 'admin_logs');
2414 2417
 
2415
-		$logfile   = ((x($_POST,'logfile'))   ? Strings::escapeTags(trim($_POST['logfile']))  : '');
2416
-		$debugging = ((x($_POST,'debugging')) ? true                             : false);
2417
-		$loglevel  = ((x($_POST,'loglevel'))  ? intval(trim($_POST['loglevel'])) : 0);
2418
+		$logfile   = (!empty($_POST['logfile']) ? Strings::escapeTags(trim($_POST['logfile'])) : '');
2419
+		$debugging = !empty($_POST['debugging']);
2420
+		$loglevel  = (!empty($_POST['loglevel']) ? intval(trim($_POST['loglevel'])) : 0);
2418 2421
 
2419 2422
 		Config::set('system', 'logfile', $logfile);
2420 2423
 		Config::set('system', 'debugging', $debugging);
@@ -2555,14 +2558,14 @@ function admin_page_features_post(App $a)
2555 2558
 			$feature_state = 'feature_' . $feature;
2556 2559
 			$featurelock = 'featurelock_' . $feature;
2557 2560
 
2558
-			if (x($_POST, $feature_state)) {
2561
+			if (!empty($_POST[$feature_state])) {
2559 2562
 				$val = intval($_POST[$feature_state]);
2560 2563
 			} else {
2561 2564
 				$val = 0;
2562 2565
 			}
2563 2566
 			Config::set('feature', $feature, $val);
2564 2567
 
2565
-			if (x($_POST, $featurelock)) {
2568
+			if (!empty($_POST[$featurelock])) {
2566 2569
 				Config::set('feature_lock', $feature, $val);
2567 2570
 			} else {
2568 2571
 				Config::delete('feature_lock', $feature);

+ 2
- 2
mod/api.php View File

@@ -38,7 +38,7 @@ function api_post(App $a)
38 38
 		return;
39 39
 	}
40 40
 
41
-	if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) {
41
+	if (count($a->user) && !empty($a->user['uid']) && $a->user['uid'] != local_user()) {
42 42
 		notice(L10n::t('Permission denied.') . EOL);
43 43
 		return;
44 44
 	}
@@ -62,7 +62,7 @@ function api_content(App $a)
62 62
 			killme();
63 63
 		}
64 64
 
65
-		if (x($_POST, 'oauth_yes')) {
65
+		if (!empty($_POST['oauth_yes'])) {
66 66
 			$app = oauth_get_client($request);
67 67
 			if (is_null($app)) {
68 68
 				return "Invalid request. Unknown token.";

+ 8
- 8
mod/cal.php View File

@@ -72,7 +72,7 @@ function cal_init(App $a)
72 72
 
73 73
 	$cal_widget = Widget\CalendarExport::getHTML();
74 74
 
75
-	if (!x($a->page, 'aside')) {
75
+	if (empty($a->page['aside'])) {
76 76
 		$a->page['aside'] = '';
77 77
 	}
78 78
 
@@ -100,7 +100,7 @@ function cal_content(App $a)
100 100
 	$mode = 'view';
101 101
 	$y = 0;
102 102
 	$m = 0;
103
-	$ignored = (x($_REQUEST, 'ignored') ? intval($_REQUEST['ignored']) : 0);
103
+	$ignored = (!empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0);
104 104
 
105 105
 	$format = 'ical';
106 106
 	if ($a->argc == 4 && $a->argv[2] == 'export') {
@@ -115,7 +115,7 @@ function cal_content(App $a)
115 115
 	$owner_uid = $a->data['user']['uid'];
116 116
 	$nick = $a->data['user']['nickname'];
117 117
 
118
-	if (x($_SESSION, 'remote') && is_array($_SESSION['remote'])) {
118
+	if (!empty($_SESSION['remote']) && is_array($_SESSION['remote'])) {
119 119
 		foreach ($_SESSION['remote'] as $v) {
120 120
 			if ($v['uid'] == $a->profile['profile_uid']) {
121 121
 				$contact_id = $v['cid'];
@@ -195,11 +195,11 @@ function cal_content(App $a)
195 195
 
196 196
 
197 197
 		if (!empty($a->argv[2]) && ($a->argv[2] === 'json')) {
198
-			if (x($_GET, 'start')) {
198
+			if (!empty($_GET['start'])) {
199 199
 				$start = $_GET['start'];
200 200
 			}
201 201
 
202
-			if (x($_GET, 'end')) {
202
+			if (!empty($_GET['end'])) {
203 203
 				$finish = $_GET['end'];
204 204
 			}
205 205
 		}
@@ -233,7 +233,7 @@ function cal_content(App $a)
233 233
 			$r = Event::sortByDate($r);
234 234
 			foreach ($r as $rr) {
235 235
 				$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
236
-				if (!x($links, $j)) {
236
+				if (empty($links[$j])) {
237 237
 					$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
238 238
 				}
239 239
 			}
@@ -248,7 +248,7 @@ function cal_content(App $a)
248 248
 		}
249 249
 
250 250
 		// links: array('href', 'text', 'extra css classes', 'title')
251
-		if (x($_GET, 'id')) {
251
+		if (!empty($_GET['id'])) {
252 252
 			$tpl = Renderer::getMarkupTemplate("event.tpl");
253 253
 		} else {
254 254
 //			if (Config::get('experimentals','new_calendar')==1){
@@ -284,7 +284,7 @@ function cal_content(App $a)
284 284
 			"list" => L10n::t("list"),
285 285
 		]);
286 286
 
287
-		if (x($_GET, 'id')) {
287
+		if (!empty($_GET['id'])) {
288 288
 			echo $o;
289 289
 			killme();
290 290
 		}

+ 1
- 1
mod/common.php View File

@@ -55,7 +55,7 @@ function common_content(App $a)
55 55
 				'url'    => 'contact/' . $cid
56 56
 			]);
57 57
 
58
-			if (!x($a->page, 'aside')) {
58
+			if (empty($a->page['aside'])) {
59 59
 				$a->page['aside'] = '';
60 60
 			}
61 61
 			$a->page['aside'] .= $vcard_widget;

+ 1
- 1
mod/contactgroup.php View File

@@ -40,7 +40,7 @@ function contactgroup_content(App $a)
40 40
 			}
41 41
 		}
42 42
 
43
-		if (x($change)) {
43
+		if (!empty($change)) {
44 44
 			if (in_array($change, $preselected)) {
45 45
 				Group::removeMember($group['id'], $change);
46 46
 			} else {

+ 1
- 1
mod/crepair.php View File

@@ -25,7 +25,7 @@ function crepair_init(App $a)
25 25
 		$contact = DBA::selectFirst('contact', [], ['uid' => local_user(), 'id' => $a->argv[1]]);
26 26
 	}
27 27
 
28
-	if (!x($a->page, 'aside')) {
28
+	if (empty($a->page['aside'])) {
29 29
 		$a->page['aside'] = '';
30 30
 	}
31 31
 

+ 3
- 3
mod/delegate.php View File

@@ -27,7 +27,7 @@ function delegate_post(App $a)
27 27
 		return;
28 28
 	}
29 29
 
30
-	if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) {
30
+	if (count($a->user) && !empty($a->user['uid']) && $a->user['uid'] != local_user()) {
31 31
 		notice(L10n::t('Permission denied.') . EOL);
32 32
 		return;
33 33
 	}
@@ -63,7 +63,7 @@ function delegate_content(App $a)
63 63
 
64 64
 	if ($a->argc > 2 && $a->argv[1] === 'add' && intval($a->argv[2])) {
65 65
 		// delegated admins can view but not change delegation permissions
66
-		if (x($_SESSION, 'submanage')) {
66
+		if (!empty($_SESSION['submanage'])) {
67 67
 			$a->internalRedirect('delegate');
68 68
 		}
69 69
 
@@ -84,7 +84,7 @@ function delegate_content(App $a)
84 84
 
85 85
 	if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
86 86
 		// delegated admins can view but not change delegation permissions
87
-		if (x($_SESSION, 'submanage')) {
87
+		if (!empty($_SESSION['submanage'])) {
88 88
 			$a->internalRedirect('delegate');
89 89
 		}
90 90
 

+ 3
- 3
mod/dfrn_confirm.php View File

@@ -63,7 +63,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
63 63
 	 * this being a page type which supports automatic friend acceptance. That is also Scenario 1
64 64
 	 * since we are operating on behalf of our registered user to approve a friendship.
65 65
 	 */
66
-	if (!x($_POST, 'source_url')) {
66
+	if (empty($_POST['source_url'])) {
67 67
 		$uid = defaults($handsfree, 'uid', local_user());
68 68
 		if (!$uid) {
69 69
 			notice(L10n::t('Permission denied.') . EOL);
@@ -417,7 +417,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
417 417
 	 * In the section above where the confirming party makes a POST and
418 418
 	 * retrieves xml status information, they are communicating with the following code.
419 419
 	 */
420
-	if (x($_POST, 'source_url')) {
420
+	if (!empty($_POST['source_url'])) {
421 421
 		// We are processing an external confirmation to an introduction created by our user.
422 422
 		$public_key =         defaults($_POST, 'public_key', '');
423 423
 		$dfrn_id    = hex2bin(defaults($_POST, 'dfrn_id'   , ''));
@@ -435,7 +435,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
435 435
 
436 436
 		// If $aes_key is set, both of these items require unpacking from the hex transport encoding.
437 437
 
438
-		if (x($aes_key)) {
438
+		if (!empty($aes_key)) {
439 439
 			$aes_key = hex2bin($aes_key);
440 440
 			$public_key = hex2bin($public_key);
441 441
 		}

+ 13
- 13
mod/dfrn_notify.php View File

@@ -39,16 +39,16 @@ function dfrn_notify_post(App $a) {
39 39
 		}
40 40
 	}
41 41
 
42
-	$dfrn_id      = ((x($_POST,'dfrn_id'))      ? Strings::escapeTags(trim($_POST['dfrn_id']))   : '');
43
-	$dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version']    : 2.0);
44
-	$challenge    = ((x($_POST,'challenge'))    ? Strings::escapeTags(trim($_POST['challenge'])) : '');
45
-	$data         = ((x($_POST,'data'))         ? $_POST['data']                    : '');
46
-	$key          = ((x($_POST,'key'))          ? $_POST['key']                     : '');
47
-	$rino_remote  = ((x($_POST,'rino'))         ? intval($_POST['rino'])            :  0);
48
-	$dissolve     = ((x($_POST,'dissolve'))     ? intval($_POST['dissolve'])        :  0);
49
-	$perm         = ((x($_POST,'perm'))         ? Strings::escapeTags(trim($_POST['perm']))      : 'r');
50
-	$ssl_policy   = ((x($_POST,'ssl_policy'))   ? Strings::escapeTags(trim($_POST['ssl_policy'])): 'none');
51
-	$page         = ((x($_POST,'page'))         ? intval($_POST['page'])            :  0);
42
+	$dfrn_id      = (!empty($_POST['dfrn_id'])      ? Strings::escapeTags(trim($_POST['dfrn_id']))   : '');
43
+	$dfrn_version = (!empty($_POST['dfrn_version']) ? (float) $_POST['dfrn_version']    : 2.0);
44
+	$challenge    = (!empty($_POST['challenge'])    ? Strings::escapeTags(trim($_POST['challenge'])) : '');
45
+	$data         = defaults($_POST, 'data', '');
46
+	$key          = defaults($_POST, 'key', '');
47
+	$rino_remote  = (!empty($_POST['rino'])         ? intval($_POST['rino'])            :  0);
48
+	$dissolve     = (!empty($_POST['dissolve'])     ? intval($_POST['dissolve'])        :  0);
49
+	$perm         = (!empty($_POST['perm'])         ? Strings::escapeTags(trim($_POST['perm']))      : 'r');
50
+	$ssl_policy   = (!empty($_POST['ssl_policy'])   ? Strings::escapeTags(trim($_POST['ssl_policy'])): 'none');
51
+	$page         = (!empty($_POST['page'])         ? intval($_POST['page'])            :  0);
52 52
 
53 53
 	$forum = (($page == 1) ? 1 : 0);
54 54
 	$prv   = (($page == 2) ? 1 : 0);
@@ -247,7 +247,7 @@ function dfrn_dispatch_private($user, $postdata)
247 247
 
248 248
 function dfrn_notify_content(App $a) {
249 249
 
250
-	if (x($_GET,'dfrn_id')) {
250
+	if (!empty($_GET['dfrn_id'])) {
251 251
 
252 252
 		/*
253 253
 		 * initial communication from external contact, $direction is their direction.
@@ -256,7 +256,7 @@ function dfrn_notify_content(App $a) {
256 256
 
257 257
 		$dfrn_id = Strings::escapeTags(trim($_GET['dfrn_id']));
258 258
 		$dfrn_version = (float) $_GET['dfrn_version'];
259
-		$rino_remote = ((x($_GET,'rino')) ? intval($_GET['rino']) : 0);
259
+		$rino_remote = (!empty($_GET['rino']) ? intval($_GET['rino']) : 0);
260 260
 		$type = "";
261 261
 		$last_update = "";
262 262
 
@@ -370,7 +370,7 @@ function dfrn_notify_content(App $a) {
370 370
 			. "\t" . '<perm>' . $perm . '</perm>' . "\r\n"
371 371
 			. "\t" . '<dfrn_id>' . $encrypted_id . '</dfrn_id>' . "\r\n"
372 372
 			. "\t" . '<challenge>' . $challenge . '</challenge>' . "\r\n"
373
-			. '</dfrn_notify>' . "\r\n" ;
373
+			. '</dfrn_notify>' . "\r\n";
374 374
 
375 375
 		killme();
376 376
 	}

+ 18
- 19
mod/dfrn_poll.php View File

@@ -31,7 +31,7 @@ function dfrn_poll_init(App $a)
31 31
 	$sec             = defaults($_GET, 'sec'            , '');
32 32
 	$dfrn_version    = (float) defaults($_GET, 'dfrn_version'   , 2.0);
33 33
 	$perm            = defaults($_GET, 'perm'           , 'r');
34
-	$quiet			 = x($_GET, 'quiet');
34
+	$quiet			 = !empty($_GET['quiet']);
35 35
 
36 36
 	// Possibly it is an OStatus compatible server that requests a user feed
37 37
 	$user_agent = defaults($_SERVER, 'HTTP_USER_AGENT', '');
@@ -51,7 +51,7 @@ function dfrn_poll_init(App $a)
51 51
 
52 52
 	$hidewall = false;
53 53
 
54
-	if (($dfrn_id === '') && (!x($_POST, 'dfrn_id'))) {
54
+	if (($dfrn_id === '') && empty($_POST['dfrn_id'])) {
55 55
 		if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
56 56
 			System::httpExit(403);
57 57
 		}
@@ -113,7 +113,7 @@ function dfrn_poll_init(App $a)
113 113
 
114 114
 				if ((int)$xml->status === 1) {
115 115
 					$_SESSION['authenticated'] = 1;
116
-					if (!x($_SESSION, 'remote')) {
116
+					if (empty($_SESSION['remote'])) {
117 117
 						$_SESSION['remote'] = [];
118 118
 					}
119 119
 
@@ -230,13 +230,13 @@ function dfrn_poll_init(App $a)
230 230
 
231 231
 function dfrn_poll_post(App $a)
232 232
 {
233
-	$dfrn_id      = x($_POST,'dfrn_id')      ? $_POST['dfrn_id']              : '';
234
-	$challenge    = x($_POST,'challenge')    ? $_POST['challenge']            : '';
235
-	$url          = x($_POST,'url')          ? $_POST['url']                  : '';
236
-	$sec          = x($_POST,'sec')          ? $_POST['sec']                  : '';
237
-	$ptype        = x($_POST,'type')         ? $_POST['type']                 : '';
238
-	$dfrn_version = x($_POST,'dfrn_version') ? (float) $_POST['dfrn_version'] : 2.0;
239
-	$perm         = x($_POST,'perm')         ? $_POST['perm']                 : 'r';
233
+	$dfrn_id      = defaults($_POST, 'dfrn_id'  , '');
234
+	$challenge    = defaults($_POST, 'challenge', '');
235
+	$url          = defaults($_POST, 'url'      , '');
236
+	$sec          = defaults($_POST, 'sec'      , '');
237
+	$ptype        = defaults($_POST, 'type'     , '');
238
+	$perm         = defaults($_POST, 'perm'     , 'r');
239
+	$dfrn_version = !empty($_POST['dfrn_version']) ? (float) $_POST['dfrn_version'] : 2.0;
240 240
 
241 241
 	if ($ptype === 'profile-check') {
242 242
 		if (strlen($challenge) && strlen($sec)) {
@@ -399,14 +399,13 @@ function dfrn_poll_post(App $a)
399 399
 
400 400
 function dfrn_poll_content(App $a)
401 401
 {
402
-	$dfrn_id         = x($_GET,'dfrn_id')         ? $_GET['dfrn_id']              : '';
403
-	$type            = x($_GET,'type')            ? $_GET['type']                 : 'data';
404
-	$last_update     = x($_GET,'last_update')     ? $_GET['last_update']          : '';
405
-	$destination_url = x($_GET,'destination_url') ? $_GET['destination_url']      : '';
406
-	$sec             = x($_GET,'sec')             ? $_GET['sec']                  : '';
407
-	$dfrn_version    = x($_GET,'dfrn_version')    ? (float) $_GET['dfrn_version'] : 2.0;
408
-	$perm            = x($_GET,'perm')            ? $_GET['perm']                 : 'r';
409
-	$quiet           = x($_GET,'quiet')           ? true                          : false;
402
+	$dfrn_id         = defaults($_GET, 'dfrn_id'        , '');
403
+	$type            = defaults($_GET, 'type'           , 'data');
404
+	$last_update     = defaults($_GET, 'last_update'    , '');
405
+	$destination_url = defaults($_GET, 'destination_url', '');
406
+	$sec             = defaults($_GET, 'sec'            , '');
407
+	$dfrn_version    = !empty($_GET['dfrn_version'])    ? (float) $_GET['dfrn_version'] : 2.0;
408
+	$quiet           = !empty($_GET['quiet']);
410 409
 
411 410
 	$direction = -1;
412 411
 	if (strpos($dfrn_id, ':') == 1) {
@@ -524,7 +523,7 @@ function dfrn_poll_content(App $a)
524 523
 
525 524
 				if (((int) $xml->status == 0) && ($xml->challenge == $hash) && ($xml->sec == $sec)) {
526 525
 					$_SESSION['authenticated'] = 1;
527
-					if (!x($_SESSION, 'remote')) {
526
+					if (empty($_SESSION['remote'])) {
528 527
 						$_SESSION['remote'] = [];
529 528
 					}
530 529
 

+ 24
- 24
mod/dfrn_request.php View File

@@ -64,7 +64,7 @@ function dfrn_request_post(App $a)
64 64
 		return;
65 65
 	}
66 66
 
67
-	if (x($_POST, 'cancel')) {
67
+	if (!empty($_POST['cancel'])) {
68 68
 		$a->internalRedirect();
69 69
 	}
70 70
 
@@ -73,18 +73,18 @@ function dfrn_request_post(App $a)
73 73
 	 * to confirm the request, and then we've clicked submit (perhaps after logging in).
74 74
 	 * That brings us here:
75 75
 	 */
76
-	if ((x($_POST, 'localconfirm')) && ($_POST['localconfirm'] == 1)) {
76
+	if (!empty($_POST['localconfirm']) && ($_POST['localconfirm'] == 1)) {
77 77
 		// Ensure this is a valid request
78
-		if (local_user() && ($a->user['nickname'] == $a->argv[1]) && (x($_POST, 'dfrn_url'))) {
79
-			$dfrn_url = Strings::escapeTags(trim($_POST['dfrn_url']));
80
-			$aes_allow = (((x($_POST, 'aes_allow')) && ($_POST['aes_allow'] == 1)) ? 1 : 0);
81
-			$confirm_key = ((x($_POST, 'confirm_key')) ? $_POST['confirm_key'] : "");