diff --git a/VERSION b/VERSION
index 8033ba2083..d04d731e2f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2018.12-dev
+2018.12-rc
diff --git a/boot.php b/boot.php
index f3d1f6f649..222011f6b7 100644
--- a/boot.php
+++ b/boot.php
@@ -39,7 +39,7 @@ require_once 'include/text.php';
define('FRIENDICA_PLATFORM', 'Friendica');
define('FRIENDICA_CODENAME', 'The Tazmans Flax-lily');
-define('FRIENDICA_VERSION', '2018.12-dev');
+define('FRIENDICA_VERSION', '2018.12-rc');
define('DFRN_PROTOCOL_VERSION', '2.23');
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
@@ -338,41 +338,6 @@ function get_app()
return BaseObject::getApp();
}
-/**
- * @brief Multi-purpose function to check variable state.
- *
- * Usage: x($var) or $x($array, 'key')
- *
- * returns false if variable/key is not set
- * if variable is set, returns 1 if has 'non-zero' value, otherwise returns 0.
- * e.g. x('') or x(0) returns 0;
- *
- * @param string|array $s variable to check
- * @param string $k key inside the array to check
- *
- * @return bool|int
- */
-function x($s, $k = null)
-{
- if ($k != null) {
- if ((is_array($s)) && (array_key_exists($k, $s))) {
- if ($s[$k]) {
- return (int) 1;
- }
- return (int) 0;
- }
- return false;
- } else {
- if (isset($s)) {
- if ($s) {
- return (int) 1;
- }
- return (int) 0;
- }
- return false;
- }
-}
-
/**
* Return the provided variable value if it exists and is truthy or the provided
* default value instead.
@@ -383,13 +348,12 @@ function x($s, $k = null)
* - defaults($var, $default)
* - defaults($array, 'key', $default)
*
+ * @param array $args
* @brief Returns a defaut value if the provided variable or array key is falsy
- * @see x()
* @return mixed
*/
-function defaults() {
- $args = func_get_args();
-
+function defaults(...$args)
+{
if (count($args) < 2) {
throw new BadFunctionCallException('defaults() requires at least 2 parameters');
}
@@ -400,16 +364,15 @@ function defaults() {
throw new BadFunctionCallException('defaults($arr, $key, $def) $key is null');
}
- $default = array_pop($args);
+ // The default value always is the last argument
+ $return = array_pop($args);
- if (call_user_func_array('x', $args)) {
- if (count($args) === 1) {
- $return = $args[0];
- } else {
- $return = $args[0][$args[1]];
- }
- } else {
- $return = $default;
+ if (count($args) == 2 && is_array($args[0]) && !empty($args[0][$args[1]])) {
+ $return = $args[0][$args[1]];
+ }
+
+ if (count($args) == 1 && !empty($args[0])) {
+ $return = $args[0];
}
return $return;
@@ -446,15 +409,15 @@ function public_contact()
{
static $public_contact_id = false;
- if (!$public_contact_id && x($_SESSION, 'authenticated')) {
- if (x($_SESSION, 'my_address')) {
+ if (!$public_contact_id && !empty($_SESSION['authenticated'])) {
+ if (!empty($_SESSION['my_address'])) {
// Local user
$public_contact_id = intval(Contact::getIdForURL($_SESSION['my_address'], 0, true));
- } elseif (x($_SESSION, 'visitor_home')) {
+ } elseif (!empty($_SESSION['visitor_home'])) {
// Remote user
$public_contact_id = intval(Contact::getIdForURL($_SESSION['visitor_home'], 0, true));
}
- } elseif (!x($_SESSION, 'authenticated')) {
+ } elseif (empty($_SESSION['authenticated'])) {
$public_contact_id = false;
}
@@ -479,7 +442,7 @@ function remote_user()
return false;
}
- if (x($_SESSION, 'authenticated') && x($_SESSION, 'visitor_id')) {
+ if (!empty($_SESSION['authenticated']) && !empty($_SESSION['visitor_id'])) {
return intval($_SESSION['visitor_id']);
}
return false;
@@ -499,7 +462,7 @@ function notice($s)
}
$a = get_app();
- if (!x($_SESSION, 'sysmsg')) {
+ if (empty($_SESSION['sysmsg'])) {
$_SESSION['sysmsg'] = [];
}
if ($a->interactive) {
@@ -522,7 +485,7 @@ function info($s)
return;
}
- if (!x($_SESSION, 'sysmsg_info')) {
+ if (empty($_SESSION['sysmsg_info'])) {
$_SESSION['sysmsg_info'] = [];
}
if ($a->interactive) {
@@ -891,3 +854,22 @@ function validate_include(&$file)
// Simply return flag
return $valid;
}
+
+/**
+ * PHP 5 compatible dirname() with count parameter
+ *
+ * @see http://php.net/manual/en/function.dirname.php#113193
+ *
+ * @deprecated with PHP 7
+ * @param string $path
+ * @param int $levels
+ * @return string
+ */
+function rdirname($path, $levels = 1)
+{
+ if ($levels > 1) {
+ return dirname(rdirname($path, --$levels));
+ } else {
+ return dirname($path);
+ }
+}
\ No newline at end of file
diff --git a/config/dbstructure.config.php b/config/dbstructure.config.php
index 99e3de9d06..ca34936065 100644
--- a/config/dbstructure.config.php
+++ b/config/dbstructure.config.php
@@ -34,7 +34,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1290);
+ define('DB_UPDATE_VERSION', 1291);
}
return [
@@ -643,6 +643,7 @@ return [
"uid_contactid_created" => ["uid", "contact-id", "created"],
"authorid_created" => ["author-id", "created"],
"ownerid" => ["owner-id"],
+ "contact-id" => ["contact-id"],
"uid_uri" => ["uid", "uri(190)"],
"resource-id" => ["resource-id"],
"deleted_changed" => ["deleted", "changed"],
@@ -894,7 +895,9 @@ return [
"fid" => ["type" => "int unsigned", "not null" => "1", "relation" => ["fcontact" => "id"], "comment" => ""],
],
"indexes" => [
- "PRIMARY" => ["iid", "server"]
+ "PRIMARY" => ["iid", "server"],
+ "cid" => ["cid"],
+ "fid" => ["fid"]
]
],
"pconfig" => [
diff --git a/doc/Install.md b/doc/Install.md
index 275d21b768..dd483095c4 100644
--- a/doc/Install.md
+++ b/doc/Install.md
@@ -248,7 +248,10 @@ Friendica will not work correctly if you cannot perform this step.
If it is not possible to set up a cron job then please activate the "frontend worker" in the administration interface.
-Once you have installed Friendica and created an admin account as part of the process, you can access the admin panel of your installation and do most of the server wide configuration from there
+Once you have installed Friendica and created an admin account as part of the process, you can access the admin panel of your installation and do most of the server wide configuration from there.
+
+At this point it is recommended that you set up logging and logrotation.
+To do so please visit [Settings](help/Settings) and search the 'Logs' section for more information.
### Set up a backup plan
diff --git a/doc/themes.md b/doc/themes.md
index d0d74a92c6..d2e4c59be3 100644
--- a/doc/themes.md
+++ b/doc/themes.md
@@ -181,13 +181,13 @@ Next take the default.php file found in the /view direcotry and exchange the asi
So the central part of the file now looks like this:
-
-
-
+
+
+
-
-
+
+
Finally we need a style.css file, inheriting the definitions from the parent theme and containing out changes for the new theme.
diff --git a/include/api.php b/include/api.php
index f4d7c5f5a6..20b3844cd5 100644
--- a/include/api.php
+++ b/include/api.php
@@ -68,7 +68,7 @@ $called_api = [];
*/
function api_user()
{
- if (x($_SESSION, 'allow_api')) {
+ if (!empty($_SESSION['allow_api'])) {
return local_user();
}
@@ -186,8 +186,8 @@ function api_login(App $a)
}
// workaround for HTTP-auth in CGI mode
- if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
- $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
+ if (!empty($_SERVER['REDIRECT_REMOTE_USER'])) {
+ $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6));
if (strlen($userpass)) {
list($name, $password) = explode(':', $userpass);
$_SERVER['PHP_AUTH_USER'] = $name;
@@ -195,7 +195,7 @@ function api_login(App $a)
}
}
- if (!x($_SERVER, 'PHP_AUTH_USER')) {
+ if (empty($_SERVER['PHP_AUTH_USER'])) {
Logger::log('API_login: ' . print_r($_SERVER, true), Logger::DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
throw new UnauthorizedException("This API requires login");
@@ -396,7 +396,7 @@ function api_call(App $a)
case "json":
header("Content-Type: application/json");
$json = json_encode(end($return));
- if (x($_GET, 'callback')) {
+ if (!empty($_GET['callback'])) {
$json = $_GET['callback'] . "(" . $json . ")";
}
$return = $json;
@@ -550,7 +550,7 @@ function api_get_user(App $a, $contact_id = null)
}
}
- if (is_null($user) && x($_GET, 'user_id')) {
+ if (is_null($user) && !empty($_GET['user_id'])) {
$user = DBA::escape(api_unique_id_to_nurl($_GET['user_id']));
if ($user == "") {
@@ -563,7 +563,7 @@ function api_get_user(App $a, $contact_id = null)
$extra_query .= "AND `contact`.`uid`=" . intval(api_user());
}
}
- if (is_null($user) && x($_GET, 'screen_name')) {
+ if (is_null($user) && !empty($_GET['screen_name'])) {
$user = DBA::escape($_GET['screen_name']);
$extra_query = "AND `contact`.`nick` = '%s' ";
if (api_user() !== false) {
@@ -571,7 +571,7 @@ function api_get_user(App $a, $contact_id = null)
}
}
- if (is_null($user) && x($_GET, 'profileurl')) {
+ if (is_null($user) && !empty($_GET['profileurl'])) {
$user = DBA::escape(Strings::normaliseLink($_GET['profileurl']));
$extra_query = "AND `contact`.`nurl` = '%s' ";
if (api_user() !== false) {
@@ -643,8 +643,6 @@ function api_get_user(App $a, $contact_id = null)
$contact = DBA::selectFirst('contact', [], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
if (DBA::isResult($contact)) {
- $network_name = ContactSelector::networkToName($contact['network'], $contact['url']);
-
// If no nick where given, extract it from the address
if (($contact['nick'] == "") || ($contact['name'] == $contact['nick'])) {
$contact['nick'] = api_get_nick($contact["url"]);
@@ -655,7 +653,7 @@ function api_get_user(App $a, $contact_id = null)
'id_str' => (string) $contact["id"],
'name' => $contact["name"],
'screen_name' => (($contact['nick']) ? $contact['nick'] : $contact['name']),
- 'location' => ($contact["location"] != "") ? $contact["location"] : $network_name,
+ 'location' => ($contact["location"] != "") ? $contact["location"] : ContactSelector::networkToName($contact['network'], $contact['url']),
'description' => $contact["about"],
'profile_image_url' => $contact["micro"],
'profile_image_url_https' => $contact["micro"],
@@ -713,8 +711,6 @@ function api_get_user(App $a, $contact_id = null)
$uinfo[0]['nick'] = api_get_nick($uinfo[0]["url"]);
}
- $network_name = ContactSelector::networkToName($uinfo[0]['network'], $uinfo[0]['url']);
-
$pcontact_id = Contact::getIdForURL($uinfo[0]['url'], 0, true);
if (!empty($profile['about'])) {
@@ -728,7 +724,7 @@ function api_get_user(App $a, $contact_id = null)
} elseif (!empty($uinfo[0]["location"])) {
$location = $uinfo[0]["location"];
} else {
- $location = $network_name;
+ $location = ContactSelector::networkToName($uinfo[0]['network'], $uinfo[0]['url']);
}
$ret = [
@@ -980,7 +976,7 @@ function api_account_verify_credentials($type)
unset($_REQUEST["screen_name"]);
unset($_GET["screen_name"]);
- $skip_status = (x($_REQUEST, 'skip_status')?$_REQUEST['skip_status'] : false);
+ $skip_status = defaults($_REQUEST, 'skip_status', false);
$user_info = api_get_user($a);
@@ -1014,10 +1010,10 @@ api_register_func('api/account/verify_credentials', 'api_account_verify_credenti
*/
function requestdata($k)
{
- if (x($_POST, $k)) {
+ if (!empty($_POST[$k])) {
return $_POST[$k];
}
- if (x($_GET, $k)) {
+ if (!empty($_GET[$k])) {
return $_GET[$k];
}
return null;
@@ -1172,7 +1168,7 @@ function api_statuses_update($type)
}
}
- if (x($_FILES, 'media')) {
+ if (!empty($_FILES['media'])) {
// upload the image if we have one
$picture = wall_upload_post($a, false);
if (is_array($picture)) {
@@ -1199,7 +1195,7 @@ function api_statuses_update($type)
$_REQUEST['api_source'] = true;
- if (!x($_REQUEST, "source")) {
+ if (empty($_REQUEST['source'])) {
$_REQUEST["source"] = api_source();
}
@@ -1231,7 +1227,7 @@ function api_media_upload()
api_get_user($a);
- if (!x($_FILES, 'media')) {
+ if (empty($_FILES['media'])) {
// Output error
throw new BadRequestException("No media.");
}
@@ -1445,7 +1441,7 @@ function api_users_search($type)
$userlist = [];
- if (x($_GET, 'q')) {
+ if (!empty($_GET['q'])) {
$r = q("SELECT id FROM `contact` WHERE `uid` = 0 AND `name` = '%s'", DBA::escape($_GET["q"]));
if (!DBA::isResult($r)) {
@@ -1530,21 +1526,21 @@ function api_search($type)
$data = [];
- if (!x($_REQUEST, 'q')) {
+ if (empty($_REQUEST['q'])) {
throw new BadRequestException("q parameter is required.");
}
- if (x($_REQUEST, 'rpp')) {
+ if (!empty($_REQUEST['rpp'])) {
$count = $_REQUEST['rpp'];
- } elseif (x($_REQUEST, 'count')) {
+ } elseif (!empty($_REQUEST['count'])) {
$count = $_REQUEST['count'];
} else {
$count = 15;
}
- $since_id = (x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0);
- $max_id = (x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0);
- $page = (x($_REQUEST, 'page') ? $_REQUEST['page'] - 1 : 0);
+ $since_id = defaults($_REQUEST, 'since_id', 0);
+ $max_id = defaults($_REQUEST, 'max_id', 0);
+ $page = (!empty($_REQUEST['page']) ? $_REQUEST['page'] - 1 : 0);
$start = $page * $count;
@@ -1598,16 +1594,15 @@ function api_statuses_home_timeline($type)
// get last network messages
// params
- $count = (x($_REQUEST, 'count') ? $_REQUEST['count'] : 20);
- $page = (x($_REQUEST, 'page') ? $_REQUEST['page'] - 1 : 0);
+ $count = defaults($_REQUEST, 'count', 20);
+ $page = (!empty($_REQUEST['page']) ? $_REQUEST['page'] - 1 : 0);
if ($page < 0) {
$page = 0;
}
- $since_id = (x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0);
- $max_id = (x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0);
- //$since_id = 0;//$since_id = (x($_REQUEST, 'since_id')?$_REQUEST['since_id'] : 0);
- $exclude_replies = (x($_REQUEST, 'exclude_replies') ? 1 : 0);
- $conversation_id = (x($_REQUEST, 'conversation_id') ? $_REQUEST['conversation_id'] : 0);
+ $since_id = defaults($_REQUEST, 'since_id', 0);
+ $max_id = defaults($_REQUEST, 'max_id', 0);
+ $exclude_replies = !empty($_REQUEST['exclude_replies']);
+ $conversation_id = defaults($_REQUEST, 'conversation_id', 0);
$start = $page * $count;
@@ -1618,7 +1613,7 @@ function api_statuses_home_timeline($type)
$condition[0] .= " AND `item`.`id` <= ?";
$condition[] = $max_id;
}
- if ($exclude_replies > 0) {
+ if ($exclude_replies) {
$condition[0] .= ' AND `item`.`parent` = `item`.`id`';
}
if ($conversation_id > 0) {
@@ -1681,19 +1676,17 @@ function api_statuses_public_timeline($type)
// get last network messages
// params
- $count = (x($_REQUEST, 'count') ? $_REQUEST['count'] : 20);
- $page = (x($_REQUEST, 'page') ? $_REQUEST['page'] -1 : 0);
+ $count = defaults($_REQUEST, 'count', 20);
+ $page = (!empty($_REQUEST['page']) ? $_REQUEST['page'] -1 : 0);
if ($page < 0) {
$page = 0;
}
- $since_id = (x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0);
- $max_id = (x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0);
- //$since_id = 0;//$since_id = (x($_REQUEST, 'since_id')?$_REQUEST['since_id'] : 0);
- $exclude_replies = (x($_REQUEST, 'exclude_replies') ? 1 : 0);
- $conversation_id = (x($_REQUEST, 'conversation_id') ? $_REQUEST['conversation_id'] : 0);
+ $since_id = defaults($_REQUEST, 'since_id', 0);
+ $max_id = defaults($_REQUEST, 'max_id', 0);
+ $exclude_replies = (!empty($_REQUEST['exclude_replies']) ? 1 : 0);
+ $conversation_id = defaults($_REQUEST, 'conversation_id', 0);
$start = $page * $count;
- $sql_extra = '';
if ($exclude_replies && !$conversation_id) {
$condition = ["`gravity` IN (?, ?) AND `iid` > ? AND NOT `private` AND `wall` AND NOT `user`.`hidewall`",
@@ -1762,12 +1755,12 @@ function api_statuses_networkpublic_timeline($type)
throw new ForbiddenException();
}
- $since_id = x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0;
- $max_id = x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0;
+ $since_id = defaults($_REQUEST, 'since_id', 0);
+ $max_id = defaults($_REQUEST, 'max_id', 0);
// pagination
- $count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 20;
- $page = x($_REQUEST, 'page') ? $_REQUEST['page'] : 1;
+ $count = defaults($_REQUEST, 'count', 20);
+ $page = defaults($_REQUEST, 'page', 1);
if ($page < 1) {
$page = 1;
}
@@ -2001,7 +1994,7 @@ function api_statuses_repeat($type)
$_REQUEST['profile_uid'] = api_user();
$_REQUEST['api_source'] = true;
- if (!x($_REQUEST, "source")) {
+ if (empty($_REQUEST['source'])) {
$_REQUEST["source"] = api_source();
}
@@ -2150,14 +2143,14 @@ function api_statuses_user_timeline($type)
Logger::DEBUG
);
- $since_id = x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0;
- $max_id = x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0;
- $exclude_replies = x($_REQUEST, 'exclude_replies') ? 1 : 0;
- $conversation_id = x($_REQUEST, 'conversation_id') ? $_REQUEST['conversation_id'] : 0;
+ $since_id = defaults($_REQUEST, 'since_id', 0);
+ $max_id = defaults($_REQUEST, 'max_id', 0);
+ $exclude_replies = !empty($_REQUEST['exclude_replies']);
+ $conversation_id = defaults($_REQUEST, 'conversation_id', 0);
// pagination
- $count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 20;
- $page = x($_REQUEST, 'page') ? $_REQUEST['page'] : 1;
+ $count = defaults($_REQUEST, 'count', 20);
+ $page = defaults($_REQUEST, 'page', 1);
if ($page < 1) {
$page = 1;
}
@@ -2170,7 +2163,7 @@ function api_statuses_user_timeline($type)
$condition[0] .= ' AND `item`.`wall` ';
}
- if ($exclude_replies > 0) {
+ if ($exclude_replies) {
$condition[0] .= ' AND `item`.`parent` = `item`.`id`';
}
@@ -2309,10 +2302,10 @@ function api_favorites($type)
$ret = [];
} else {
// params
- $since_id = (x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0);
- $max_id = (x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0);
- $count = (x($_GET, 'count') ? $_GET['count'] : 20);
- $page = (x($_REQUEST, 'page') ? $_REQUEST['page'] -1 : 0);
+ $since_id = defaults($_REQUEST, 'since_id', 0);
+ $max_id = defaults($_REQUEST, 'max_id', 0);
+ $count = defaults($_GET, 'count', 20);
+ $page = (!empty($_REQUEST['page']) ? $_REQUEST['page'] -1 : 0);
if ($page < 0) {
$page = 0;
}
@@ -2390,7 +2383,7 @@ function api_format_messages($item, $recipient, $sender)
}
//don't send title to regular StatusNET requests to avoid confusing these apps
- if (x($_GET, 'getText')) {
+ if (!empty($_GET['getText'])) {
$ret['title'] = $item['title'];
if ($_GET['getText'] == 'html') {
$ret['text'] = BBCode::convert($item['body'], false);
@@ -2400,7 +2393,7 @@ function api_format_messages($item, $recipient, $sender)
} else {
$ret['text'] = $item['title'] . "\n" . HTML::toPlaintext(BBCode::convert(api_clean_plain_items($item['body']), false, 2, true), 0);
}
- if (x($_GET, 'getUserObjects') && $_GET['getUserObjects'] == 'false') {
+ if (!empty($_GET['getUserObjects']) && $_GET['getUserObjects'] == 'false') {
unset($ret['sender']);
unset($ret['recipient']);
}
@@ -2530,7 +2523,7 @@ function api_get_attachments(&$body)
*/
function api_get_entitities(&$text, $bbcode)
{
- $include_entities = strtolower(x($_REQUEST, 'include_entities') ? $_REQUEST['include_entities'] : "false");
+ $include_entities = strtolower(defaults($_REQUEST, 'include_entities', "false"));
if ($include_entities != "true") {
preg_match_all("/\[img](.*?)\[\/img\]/ism", $bbcode, $images);
@@ -3119,15 +3112,15 @@ function api_lists_statuses($type)
}
// params
- $count = (x($_REQUEST, 'count') ? $_REQUEST['count'] : 20);
- $page = (x($_REQUEST, 'page') ? $_REQUEST['page'] - 1 : 0);
+ $count = defaults($_REQUEST, 'count', 20);
+ $page = (!empty($_REQUEST['page']) ? $_REQUEST['page'] - 1 : 0);
if ($page < 0) {
$page = 0;
}
- $since_id = (x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0);
- $max_id = (x($_REQUEST, 'max_id') ? $_REQUEST['max_id'] : 0);
- $exclude_replies = (x($_REQUEST, 'exclude_replies') ? 1 : 0);
- $conversation_id = (x($_REQUEST, 'conversation_id') ? $_REQUEST['conversation_id'] : 0);
+ $since_id = defaults($_REQUEST, 'since_id', 0);
+ $max_id = defaults($_REQUEST, 'max_id', 0);
+ $exclude_replies = (!empty($_REQUEST['exclude_replies']) ? 1 : 0);
+ $conversation_id = defaults($_REQUEST, 'conversation_id', 0);
$start = $page * $count;
@@ -3185,8 +3178,8 @@ function api_statuses_f($qtype)
}
// pagination
- $count = x($_GET, 'count') ? $_GET['count'] : 20;
- $page = x($_GET, 'page') ? $_GET['page'] : 1;
+ $count = defaults($_GET, 'count', 20);
+ $page = defaults($_GET, 'page', 1);
if ($page < 1) {
$page = 1;
}
@@ -3194,7 +3187,7 @@ function api_statuses_f($qtype)
$user_info = api_get_user($a);
- if (x($_GET, 'cursor') && $_GET['cursor'] == 'undefined') {
+ if (!empty($_GET['cursor']) && $_GET['cursor'] == 'undefined') {
/* this is to stop Hotot to load friends multiple times
* I'm not sure if I'm missing return something or
* is a bug in hotot. Workaround, meantime
@@ -3522,7 +3515,7 @@ function api_direct_messages_new($type)
$replyto = '';
$sub = '';
- if (x($_REQUEST, 'replyto')) {
+ if (!empty($_REQUEST['replyto'])) {
$r = q(
'SELECT `parent-uri`, `title` FROM `mail` WHERE `uid`=%d AND `id`=%d',
intval(api_user()),
@@ -3531,7 +3524,7 @@ function api_direct_messages_new($type)
$replyto = $r[0]['parent-uri'];
$sub = $r[0]['title'];
} else {
- if (x($_REQUEST, 'title')) {
+ if (!empty($_REQUEST['title'])) {
$sub = $_REQUEST['title'];
} else {
$sub = ((strlen($_POST['text'])>10) ? substr($_POST['text'], 0, 10)."...":$_POST['text']);
@@ -3583,10 +3576,10 @@ function api_direct_messages_destroy($type)
// params
$user_info = api_get_user($a);
//required
- $id = (x($_REQUEST, 'id') ? $_REQUEST['id'] : 0);
+ $id = defaults($_REQUEST, 'id', 0);
// optional
- $parenturi = (x($_REQUEST, 'friendica_parenturi') ? $_REQUEST['friendica_parenturi'] : "");
- $verbose = (x($_GET, 'friendica_verbose') ? strtolower($_GET['friendica_verbose']) : "false");
+ $parenturi = defaults($_REQUEST, 'friendica_parenturi', "");
+ $verbose = (!empty($_GET['friendica_verbose']) ? strtolower($_GET['friendica_verbose']) : "false");
/// @todo optional parameter 'include_entities' from Twitter API not yet implemented
$uid = $user_info['uid'];
@@ -3647,7 +3640,7 @@ api_register_func('api/direct_messages/destroy', 'api_direct_messages_destroy',
/**
* Unfollow Contact
*
- * @brief unfollow contact
+ * @brief unfollow contact
*
* @param string $type Known types are 'atom', 'rss', 'xml' and 'json'
* @return string|array
@@ -3838,7 +3831,7 @@ function api_direct_messages_box($type, $box, $verbose)
*/
function api_direct_messages_sentbox($type)
{
- $verbose = (x($_GET, 'friendica_verbose') ? strtolower($_GET['friendica_verbose']) : "false");
+ $verbose = !empty($_GET['friendica_verbose']) ? strtolower($_GET['friendica_verbose']) : "false";
return api_direct_messages_box($type, "sentbox", $verbose);
}
@@ -3852,7 +3845,7 @@ function api_direct_messages_sentbox($type)
*/
function api_direct_messages_inbox($type)
{
- $verbose = (x($_GET, 'friendica_verbose') ? strtolower($_GET['friendica_verbose']) : "false");
+ $verbose = !empty($_GET['friendica_verbose']) ? strtolower($_GET['friendica_verbose']) : "false";
return api_direct_messages_box($type, "inbox", $verbose);
}
@@ -3864,7 +3857,7 @@ function api_direct_messages_inbox($type)
*/
function api_direct_messages_all($type)
{
- $verbose = (x($_GET, 'friendica_verbose') ? strtolower($_GET['friendica_verbose']) : "false");
+ $verbose = !empty($_GET['friendica_verbose']) ? strtolower($_GET['friendica_verbose']) : "false";
return api_direct_messages_box($type, "all", $verbose);
}
@@ -3876,7 +3869,7 @@ function api_direct_messages_all($type)
*/
function api_direct_messages_conversation($type)
{
- $verbose = (x($_GET, 'friendica_verbose') ? strtolower($_GET['friendica_verbose']) : "false");
+ $verbose = !empty($_GET['friendica_verbose']) ? strtolower($_GET['friendica_verbose']) : "false";
return api_direct_messages_box($type, "conversation", $verbose);
}
@@ -3940,7 +3933,7 @@ function api_fr_photoalbum_delete($type)
throw new ForbiddenException();
}
// input params
- $album = (x($_REQUEST, 'album') ? $_REQUEST['album'] : "");
+ $album = defaults($_REQUEST, 'album', "");
// we do not allow calls without album string
if ($album == "") {
@@ -3992,8 +3985,8 @@ function api_fr_photoalbum_update($type)
throw new ForbiddenException();
}
// input params
- $album = (x($_REQUEST, 'album') ? $_REQUEST['album'] : "");
- $album_new = (x($_REQUEST, 'album_new') ? $_REQUEST['album_new'] : "");
+ $album = defaults($_REQUEST, 'album', "");
+ $album_new = defaults($_REQUEST, 'album_new', "");
// we do not allow calls without album string
if ($album == "") {
@@ -4077,15 +4070,15 @@ function api_fr_photo_create_update($type)
throw new ForbiddenException();
}
// input params
- $photo_id = (x($_REQUEST, 'photo_id') ? $_REQUEST['photo_id'] : null);
- $desc = (x($_REQUEST, 'desc') ? $_REQUEST['desc'] : (array_key_exists('desc', $_REQUEST) ? "" : null)); // extra check necessary to distinguish between 'not provided' and 'empty string'
- $album = (x($_REQUEST, 'album') ? $_REQUEST['album'] : null);
- $album_new = (x($_REQUEST, 'album_new') ? $_REQUEST['album_new'] : null);
- $allow_cid = (x($_REQUEST, 'allow_cid') ? $_REQUEST['allow_cid'] : (array_key_exists('allow_cid', $_REQUEST) ? " " : null));
- $deny_cid = (x($_REQUEST, 'deny_cid') ? $_REQUEST['deny_cid'] : (array_key_exists('deny_cid', $_REQUEST) ? " " : null));
- $allow_gid = (x($_REQUEST, 'allow_gid') ? $_REQUEST['allow_gid'] : (array_key_exists('allow_gid', $_REQUEST) ? " " : null));
- $deny_gid = (x($_REQUEST, 'deny_gid') ? $_REQUEST['deny_gid'] : (array_key_exists('deny_gid', $_REQUEST) ? " " : null));
- $visibility = (x($_REQUEST, 'visibility') ? (($_REQUEST['visibility'] == "true" || $_REQUEST['visibility'] == 1) ? true : false) : false);
+ $photo_id = defaults($_REQUEST, 'photo_id', null);
+ $desc = defaults($_REQUEST, 'desc', (array_key_exists('desc', $_REQUEST) ? "" : null)) ; // extra check necessary to distinguish between 'not provided' and 'empty string'
+ $album = defaults($_REQUEST, 'album', null);
+ $album_new = defaults($_REQUEST, 'album_new', null);
+ $allow_cid = defaults($_REQUEST, 'allow_cid', (array_key_exists('allow_cid', $_REQUEST) ? " " : null));
+ $deny_cid = defaults($_REQUEST, 'deny_cid' , (array_key_exists('deny_cid' , $_REQUEST) ? " " : null));
+ $allow_gid = defaults($_REQUEST, 'allow_gid', (array_key_exists('allow_gid', $_REQUEST) ? " " : null));
+ $deny_gid = defaults($_REQUEST, 'deny_gid' , (array_key_exists('deny_gid' , $_REQUEST) ? " " : null));
+ $visibility = !empty($_REQUEST['visibility']) && $_REQUEST['visibility'] !== "false";
// do several checks on input parameters
// we do not allow calls without album string
@@ -4097,7 +4090,7 @@ function api_fr_photo_create_update($type)
$mode = "create";
// error if no media posted in create-mode
- if (!x($_FILES, 'media')) {
+ if (empty($_FILES['media'])) {
// Output error
throw new BadRequestException("no media data submitted");
}
@@ -4188,7 +4181,7 @@ function api_fr_photo_create_update($type)
$nothingtodo = true;
}
- if (x($_FILES, 'media')) {
+ if (!empty($_FILES['media'])) {
$nothingtodo = false;
$media = $_FILES['media'];
$data = save_media_to_database("photo", $media, $type, $album, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $desc, 0, $visibility, $photo_id);
@@ -4224,7 +4217,7 @@ function api_fr_photo_delete($type)
throw new ForbiddenException();
}
// input params
- $photo_id = (x($_REQUEST, 'photo_id') ? $_REQUEST['photo_id'] : null);
+ $photo_id = defaults($_REQUEST, 'photo_id', null);
// do several checks on input parameters
// we do not allow calls without photo id
@@ -4275,11 +4268,11 @@ function api_fr_photo_detail($type)
if (api_user() === false) {
throw new ForbiddenException();
}
- if (!x($_REQUEST, 'photo_id')) {
+ if (empty($_REQUEST['photo_id'])) {
throw new BadRequestException("No photo id.");
}
- $scale = (x($_REQUEST, 'scale') ? intval($_REQUEST['scale']) : false);
+ $scale = (!empty($_REQUEST['scale']) ? intval($_REQUEST['scale']) : false);
$photo_id = $_REQUEST['photo_id'];
// prepare json/xml output with data from database for the requested photo
@@ -4308,7 +4301,7 @@ function api_account_update_profile_image($type)
$profile_id = defaults($_REQUEST, 'profile_id', 0);
// error if image data is missing
- if (!x($_FILES, 'image')) {
+ if (empty($_FILES['image'])) {
throw new BadRequestException("no media data submitted");
}
@@ -4326,9 +4319,9 @@ function api_account_update_profile_image($type)
// get mediadata from image or media (Twitter call api/account/update_profile_image provides image)
$media = null;
- if (x($_FILES, 'image')) {
+ if (!empty($_FILES['image'])) {
$media = $_FILES['image'];
- } elseif (x($_FILES, 'media')) {
+ } elseif (!empty($_FILES['media'])) {
$media = $_FILES['media'];
}
// save new profile image
@@ -4788,8 +4781,8 @@ function prepare_photo_data($type, $scale, $photo_id)
*/
function api_friendica_remoteauth()
{
- $url = (x($_GET, 'url') ? $_GET['url'] : '');
- $c_url = (x($_GET, 'c_url') ? $_GET['c_url'] : '');
+ $url = defaults($_GET, 'url', '');
+ $c_url = defaults($_GET, 'c_url', '');
if ($url === '' || $c_url === '') {
throw new BadRequestException("Wrong parameters.");
@@ -4935,6 +4928,7 @@ function api_share_as_retweet(&$item)
}
$reshared_item["body"] = $shared_body;
+ $reshared_item["author-id"] = Contact::getIdForURL($profile, 0, true);
$reshared_item["author-name"] = $author;
$reshared_item["author-link"] = $profile;
$reshared_item["author-avatar"] = $avatar;
@@ -5092,7 +5086,7 @@ function api_in_reply_to($item)
*/
function api_clean_plain_items($text)
{
- $include_entities = strtolower(x($_REQUEST, 'include_entities') ? $_REQUEST['include_entities'] : "false");
+ $include_entities = strtolower(defaults($_REQUEST, 'include_entities', "false"));
$text = BBCode::cleanPictureLinks($text);
$URLSearchString = "^\[\]";
@@ -5224,7 +5218,7 @@ function api_friendica_group_show($type)
// params
$user_info = api_get_user($a);
- $gid = (x($_REQUEST, 'gid') ? $_REQUEST['gid'] : 0);
+ $gid = defaults($_REQUEST, 'gid', 0);
$uid = $user_info['uid'];
// get data of the specified group id or all groups if not specified
@@ -5289,8 +5283,8 @@ function api_friendica_group_delete($type)
// params
$user_info = api_get_user($a);
- $gid = (x($_REQUEST, 'gid') ? $_REQUEST['gid'] : 0);
- $name = (x($_REQUEST, 'name') ? $_REQUEST['name'] : "");
+ $gid = defaults($_REQUEST, 'gid', 0);
+ $name = defaults($_REQUEST, 'name', "");
$uid = $user_info['uid'];
// error if no gid specified
@@ -5351,7 +5345,7 @@ function api_lists_destroy($type)
// params
$user_info = api_get_user($a);
- $gid = (x($_REQUEST, 'list_id') ? $_REQUEST['list_id'] : 0);
+ $gid = defaults($_REQUEST, 'list_id', 0);
$uid = $user_info['uid'];
// error if no gid specified
@@ -5467,7 +5461,7 @@ function api_friendica_group_create($type)
// params
$user_info = api_get_user($a);
- $name = (x($_REQUEST, 'name') ? $_REQUEST['name'] : "");
+ $name = defaults($_REQUEST, 'name', "");
$uid = $user_info['uid'];
$json = json_decode($_POST['json'], true);
$users = $json['user'];
@@ -5496,7 +5490,7 @@ function api_lists_create($type)
// params
$user_info = api_get_user($a);
- $name = (x($_REQUEST, 'name') ? $_REQUEST['name'] : "");
+ $name = defaults($_REQUEST, 'name', "");
$uid = $user_info['uid'];
$success = group_create($name, $uid);
@@ -5531,8 +5525,8 @@ function api_friendica_group_update($type)
// params
$user_info = api_get_user($a);
$uid = $user_info['uid'];
- $gid = (x($_REQUEST, 'gid') ? $_REQUEST['gid'] : 0);
- $name = (x($_REQUEST, 'name') ? $_REQUEST['name'] : "");
+ $gid = defaults($_REQUEST, 'gid', 0);
+ $name = defaults($_REQUEST, 'name', "");
$json = json_decode($_POST['json'], true);
$users = $json['user'];
@@ -5604,8 +5598,8 @@ function api_lists_update($type)
// params
$user_info = api_get_user($a);
- $gid = (x($_REQUEST, 'list_id') ? $_REQUEST['list_id'] : 0);
- $name = (x($_REQUEST, 'name') ? $_REQUEST['name'] : "");
+ $gid = defaults($_REQUEST, 'list_id', 0);
+ $name = defaults($_REQUEST, 'name', "");
$uid = $user_info['uid'];
// error if no gid specified
@@ -5650,7 +5644,7 @@ function api_friendica_activity($type)
$verb = strtolower($a->argv[3]);
$verb = preg_replace("|\..*$|", "", $verb);
- $id = (x($_REQUEST, 'id') ? $_REQUEST['id'] : 0);
+ $id = defaults($_REQUEST, 'id', 0);
$res = Item::performLike($id, $verb);
@@ -5732,7 +5726,7 @@ function api_friendica_notification_seen($type)
throw new BadRequestException("Invalid argument count");
}
- $id = (x($_REQUEST, 'id') ? intval($_REQUEST['id']) : 0);
+ $id = (!empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0);
$nm = new NotificationsManager();
$note = $nm->getByID($id);
@@ -5775,7 +5769,7 @@ function api_friendica_direct_messages_setseen($type)
// params
$user_info = api_get_user($a);
$uid = $user_info['uid'];
- $id = (x($_REQUEST, 'id') ? $_REQUEST['id'] : 0);
+ $id = defaults($_REQUEST, 'id', 0);
// return error if id is zero
if ($id == "") {
@@ -5824,7 +5818,7 @@ function api_friendica_direct_messages_search($type, $box = "")
// params
$user_info = api_get_user($a);
- $searchstring = (x($_REQUEST, 'searchstring') ? $_REQUEST['searchstring'] : "");
+ $searchstring = defaults($_REQUEST, 'searchstring', "");
$uid = $user_info['uid'];
// error if no searchstring specified
@@ -5886,7 +5880,7 @@ function api_friendica_profile_show($type)
}
// input params
- $profile_id = (x($_REQUEST, 'profile_id') ? $_REQUEST['profile_id'] : 0);
+ $profile_id = defaults($_REQUEST, 'profile_id', 0);
// retrieve general information about profiles for user
$multi_profiles = Feature::isEnabled(api_user(), 'multi_profiles');
diff --git a/include/conversation.php b/include/conversation.php
index 023b6c875e..1059941b9e 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -389,7 +389,7 @@ function visible_activity($item) {
* likes (etc.) can apply to other things besides posts. Check if they are post children,
* in which case we handle them specially
*/
- $hidden_activities = [ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE];
+ $hidden_activities = [ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE, ACTIVITY_FOLLOW];
foreach ($hidden_activities as $act) {
if (activity_match($item['verb'], $act)) {
return false;
@@ -462,17 +462,17 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
. "\r\n";
}
@@ -482,7 +482,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
if (!$update) {
$tab = 'posts';
- if (x($_GET, 'tab')) {
+ if (!empty($_GET['tab'])) {
$tab = Strings::escapeTags(trim($_GET['tab']));
}
if ($tab === 'posts') {
@@ -497,7 +497,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
}
}
} elseif ($mode === 'notes') {
- $items = conversation_add_children($items, false, $order, $uid);
+ $items = conversation_add_children($items, false, $order, local_user());
$profile_owner = local_user();
if (!$update) {
@@ -798,7 +798,7 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid)
foreach ($parents AS $parent) {
$condition = ["`item`.`parent-uri` = ? AND `item`.`uid` IN (0, ?) ",
- $parent['uri'], local_user()];
+ $parent['uri'], $uid];
if ($block_authors) {
$condition[0] .= "AND NOT `author`.`hidden`";
}
@@ -951,7 +951,7 @@ function builtin_activity_puller($item, &$conv_responses) {
$url = '' . htmlentities($item['author-name']) . '';
- if (!x($item, 'thr-parent')) {
+ if (empty($item['thr-parent'])) {
$item['thr-parent'] = $item['parent-uri'];
}
@@ -994,6 +994,7 @@ function builtin_activity_puller($item, &$conv_responses) {
function format_like($cnt, array $arr, $type, $id) {
$o = '';
$expanded = '';
+ $phrase = '';
if ($cnt == 1) {
$likers = $arr[0];
@@ -1064,7 +1065,7 @@ function format_like($cnt, array $arr, $type, $id) {
$expanded .= "\t" . '
' . $explikers . EOL . '
';
}
- $phrase .= EOL ;
+ $phrase .= EOL;
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('voting_fakelink.tpl'), [
'$phrase' => $phrase,
'$type' => $type,
@@ -1079,7 +1080,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
{
$o = '';
- $geotag = x($x, 'allow_location') ? Renderer::replaceMacros(Renderer::getMarkupTemplate('jot_geotag.tpl'), []) : '';
+ $geotag = !empty($x['allow_location']) ? Renderer::replaceMacros(Renderer::getMarkupTemplate('jot_geotag.tpl'), []) : '';
$tpl = Renderer::getMarkupTemplate('jot-header.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
@@ -1100,7 +1101,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
// Private/public post links for the non-JS ACL form
$private_post = 1;
- if (x($_REQUEST, 'public')) {
+ if (!empty($_REQUEST['public'])) {
$private_post = 0;
}
@@ -1432,11 +1433,11 @@ function sort_thr_commented(array $a, array $b)
}
function render_location_dummy(array $item) {
- if (x($item, 'location') && !empty($item['location'])) {
+ if (!empty($item['location']) && !empty($item['location'])) {
return $item['location'];
}
- if (x($item, 'coord') && !empty($item['coord'])) {
+ if (!empty($item['coord']) && !empty($item['coord'])) {
return $item['coord'];
}
}
diff --git a/mod/admin.php b/mod/admin.php
index cedd6748ec..eab2e72267 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -58,7 +58,7 @@ function admin_post(App $a)
// do not allow a page manager to access the admin panel at all.
- if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
+ if (!empty($_SESSION['submanage'])) {
return;
}
@@ -167,14 +167,14 @@ function admin_content(App $a)
return Login::form();
}
- if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
+ if (!empty($_SESSION['submanage'])) {
return "";
}
// APC deactivated, since there are problems with PHP 5.5
//if (function_exists("apc_delete")) {
- // $toDelete = new APCIterator('user', APC_ITER_VALUE);
- // apc_delete($toDelete);
+ // $toDelete = new APCIterator('user', APC_ITER_VALUE);
+ // apc_delete($toDelete);
//}
// Header stuff
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/settings_head.tpl'), []);
@@ -321,7 +321,7 @@ function admin_page_tos(App $a)
'$title' => L10n::t('Administration'),
'$page' => L10n::t('Terms of Service'),
'$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.')],
- '$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 EU-GDPR.','https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')],
+ '$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 EU-GDPR.', 'https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')],
'$preview' => L10n::t('Privacy Statement Preview'),
'$privtext' => $tos->privacy_complete,
'$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)
'$submit' => L10n::t('Save Settings'),
]);
}
+
/**
* @brief Process send data from Admin TOS Page
*
@@ -338,13 +339,13 @@ function admin_page_tos_post(App $a)
{
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos');
- if (!x($_POST, "page_tos")) {
+ if (empty($_POST['page_tos'])) {
return;
}
- $displaytos = ((x($_POST, 'displaytos')) ? True : False);
- $displayprivstatement = ((x($_POST, 'displayprivstatement')) ? True : False);
- $tostext = ((x($_POST, 'tostext')) ? strip_tags(trim($_POST['tostext'])) : '');
+ $displaytos = !empty($_POST['displaytos']);
+ $displayprivstatement = !empty($_POST['displayprivstatement']);
+ $tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
Config::set('system', 'tosdisplay', $displaytos);
Config::set('system', 'tosprivstatement', $displayprivstatement);
@@ -354,6 +355,7 @@ function admin_page_tos_post(App $a)
return; // NOTREACHED
}
+
/**
* @brief Subpage to modify the server wide block list via the admin panel.
*
@@ -407,13 +409,13 @@ function admin_page_blocklist(App $a)
*/
function admin_page_blocklist_post(App $a)
{
- if (!x($_POST, "page_blocklist_save") && (!x($_POST['page_blocklist_edit']))) {
+ if (empty($_POST['page_blocklist_save']) && empty($_POST['page_blocklist_edit'])) {
return;
}
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/blocklist', 'admin_blocklist');
- if (x($_POST['page_blocklist_save'])) {
+ if (!empty($_POST['page_blocklist_save'])) {
// Add new item to blocklist
$blocklist = Config::get('system', 'blocklist');
$blocklist[] = [
@@ -429,7 +431,7 @@ function admin_page_blocklist_post(App $a)
// Trimming whitespaces as well as any lingering slashes
$domain = Strings::escapeTags(trim($domain, "\x00..\x1F/"));
$reason = Strings::escapeTags(trim($_POST['reason'][$id]));
- if (!x($_POST['delete'][$id])) {
+ if (empty($_POST['delete'][$id])) {
$blocklist[] = [
'domain' => $domain,
'reason' => $reason
@@ -451,12 +453,12 @@ function admin_page_blocklist_post(App $a)
*/
function admin_page_contactblock_post(App $a)
{
- $contact_url = x($_POST, 'contact_url') ? $_POST['contact_url'] : '';
- $contacts = x($_POST, 'contacts') ? $_POST['contacts'] : [];
+ $contact_url = defaults($_POST, 'contact_url', '');
+ $contacts = defaults($_POST, 'contacts', []);
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/contactblock', 'admin_contactblock');
- if (x($_POST, 'page_contactblock_block')) {
+ if (!empty($_POST['page_contactblock_block'])) {
$contact_id = Contact::getIdForURL($contact_url);
if ($contact_id) {
Contact::block($contact_id);
@@ -465,7 +467,7 @@ function admin_page_contactblock_post(App $a)
notice(L10n::t("Could not find any contact entry for this URL \x28%s\x29", $contact_url));
}
}
- if (x($_POST, 'page_contactblock_unblock')) {
+ if (!empty($_POST['page_contactblock_unblock'])) {
foreach ($contacts as $uid) {
Contact::unblock($uid);
}
@@ -559,13 +561,13 @@ function admin_page_deleteitem(App $a)
*/
function admin_page_deleteitem_post(App $a)
{
- if (!x($_POST['page_deleteitem_submit'])) {
+ if (empty($_POST['page_deleteitem_submit'])) {
return;
}
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/deleteitem/', 'admin_deleteitem');
- if (x($_POST['page_deleteitem_submit'])) {
+ if (!empty($_POST['page_deleteitem_submit'])) {
$guid = trim(Strings::escapeTags($_POST['deleteitemguid']));
// The GUID should not include a "/", so if there is one, we got an URL
// and the last part of it is most likely the GUID.
@@ -838,7 +840,7 @@ function admin_page_workerqueue(App $a, $deferred)
$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.');
}
- $entries = DBA::select('workerqueue', ['id', 'parameter', 'created', 'priority'], $condition, ['order'=> ['priority']]);
+ $entries = DBA::select('workerqueue', ['id', 'parameter', 'created', 'priority'], $condition, ['order' => ['priority']]);
$r = [];
while ($entry = DBA::fetch($entries)) {
@@ -938,7 +940,7 @@ function admin_page_summary(App $a)
$users = 0;
foreach ($r as $u) {
$accounts[$u['page-flags']][1] = $u['count'];
- $users+= $u['count'];
+ $users += $u['count'];
}
Logger::log('accounts: ' . print_r($accounts, true), Logger::DATA);
@@ -962,10 +964,10 @@ function admin_page_summary(App $a)
$max_allowed_packet = (($r) ? $r[0]['Value'] : 0);
$server_settings = ['label' => L10n::t('Server Settings'),
- 'php' => ['upload_max_filesize' => ini_get('upload_max_filesize'),
- 'post_max_size' => ini_get('post_max_size'),
- 'memory_limit' => ini_get('memory_limit')],
- 'mysql' => ['max_allowed_packet' => $max_allowed_packet]];
+ 'php' => ['upload_max_filesize' => ini_get('upload_max_filesize'),
+ 'post_max_size' => ini_get('post_max_size'),
+ 'memory_limit' => ini_get('memory_limit')],
+ 'mysql' => ['max_allowed_packet' => $max_allowed_packet]];
$t = Renderer::getMarkupTemplate('admin/summary.tpl');
return Renderer::replaceMacros($t, [
@@ -1001,17 +1003,17 @@ function admin_page_site_post(App $a)
return;
}
- if (!x($_POST, "page_site")) {
+ if (empty($_POST['page_site'])) {
return;
}
// relocate
- if (x($_POST, 'relocate') && x($_POST, 'relocate_url') && $_POST['relocate_url'] != "") {
+ if (!empty($_POST['relocate']) && !empty($_POST['relocate_url']) && $_POST['relocate_url'] != "") {
$new_url = $_POST['relocate_url'];
$new_url = rtrim($new_url, "/");
$parsed = @parse_url($new_url);
- if (!is_array($parsed) || !x($parsed, 'host') || !x($parsed, 'scheme')) {
+ if (!is_array($parsed) || empty($parsed['host']) || empty($parsed['scheme'])) {
notice(L10n::t("Can not parse base url. Must have at least ://"));
$a->internalRedirect('admin/site');
}
@@ -1046,6 +1048,7 @@ function admin_page_site_post(App $a)
$a->internalRedirect('admin/site');
}
}
+
// update tables
// update profile links in the format "http://server.tld"
update_table($a, "profile", ['photo', 'thumb'], $old_url, $new_url);
@@ -1059,7 +1062,7 @@ function admin_page_site_post(App $a)
update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host);
// update config
- Config::set('system', 'hostname', parse_url($new_url, PHP_URL_HOST));
+ Config::set('system', 'hostname', parse_url($new_url, PHP_URL_HOST));
Config::set('system', 'url', $new_url);
$a->setBaseURL($new_url);
@@ -1076,98 +1079,97 @@ function admin_page_site_post(App $a)
}
// end relocate
- $sitename = ((x($_POST,'sitename')) ? Strings::escapeTags(trim($_POST['sitename'])) : '');
- $hostname = ((x($_POST,'hostname')) ? Strings::escapeTags(trim($_POST['hostname'])) : '');
- $sender_email = ((x($_POST,'sender_email')) ? Strings::escapeTags(trim($_POST['sender_email'])) : '');
- $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
- $shortcut_icon = ((x($_POST,'shortcut_icon')) ? Strings::escapeTags(trim($_POST['shortcut_icon'])) : '');
- $touch_icon = ((x($_POST,'touch_icon')) ? Strings::escapeTags(trim($_POST['touch_icon'])) : '');
- $info = ((x($_POST,'info')) ? trim($_POST['info']) : false);
- $language = ((x($_POST,'language')) ? Strings::escapeTags(trim($_POST['language'])) : '');
- $theme = ((x($_POST,'theme')) ? Strings::escapeTags(trim($_POST['theme'])) : '');
- $theme_mobile = ((x($_POST,'theme_mobile')) ? Strings::escapeTags(trim($_POST['theme_mobile'])) : '');
- $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
- $maximagelength = ((x($_POST,'maximagelength')) ? intval(trim($_POST['maximagelength'])) : MAX_IMAGE_LENGTH);
- $jpegimagequality = ((x($_POST,'jpegimagequality')) ? intval(trim($_POST['jpegimagequality'])) : JPEG_QUALITY);
+ $sitename = (!empty($_POST['sitename']) ? Strings::escapeTags(trim($_POST['sitename'])) : '');
+ $hostname = (!empty($_POST['hostname']) ? Strings::escapeTags(trim($_POST['hostname'])) : '');
+ $sender_email = (!empty($_POST['sender_email']) ? Strings::escapeTags(trim($_POST['sender_email'])) : '');
+ $banner = (!empty($_POST['banner']) ? trim($_POST['banner']) : false);
+ $shortcut_icon = (!empty($_POST['shortcut_icon']) ? Strings::escapeTags(trim($_POST['shortcut_icon'])) : '');
+ $touch_icon = (!empty($_POST['touch_icon']) ? Strings::escapeTags(trim($_POST['touch_icon'])) : '');
+ $info = (!empty($_POST['info']) ? trim($_POST['info']) : false);
+ $language = (!empty($_POST['language']) ? Strings::escapeTags(trim($_POST['language'])) : '');
+ $theme = (!empty($_POST['theme']) ? Strings::escapeTags(trim($_POST['theme'])) : '');
+ $theme_mobile = (!empty($_POST['theme_mobile']) ? Strings::escapeTags(trim($_POST['theme_mobile'])) : '');
+ $maximagesize = (!empty($_POST['maximagesize']) ? intval(trim($_POST['maximagesize'])) : 0);
+ $maximagelength = (!empty($_POST['maximagelength']) ? intval(trim($_POST['maximagelength'])) : MAX_IMAGE_LENGTH);
+ $jpegimagequality = (!empty($_POST['jpegimagequality']) ? intval(trim($_POST['jpegimagequality'])) : JPEG_QUALITY);
+ $register_policy = (!empty($_POST['register_policy']) ? intval(trim($_POST['register_policy'])) : 0);
+ $daily_registrations = (!empty($_POST['max_daily_registrations']) ? intval(trim($_POST['max_daily_registrations'])) : 0);
+ $abandon_days = (!empty($_POST['abandon_days']) ? intval(trim($_POST['abandon_days'])) : 0);
- $register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
- $daily_registrations = ((x($_POST,'max_daily_registrations')) ? intval(trim($_POST['max_daily_registrations'])) :0);
- $abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0);
+ $register_text = (!empty($_POST['register_text']) ? strip_tags(trim($_POST['register_text'])) : '');
- $register_text = ((x($_POST,'register_text')) ? strip_tags(trim($_POST['register_text'])) : '');
+ $allowed_sites = (!empty($_POST['allowed_sites']) ? Strings::escapeTags(trim($_POST['allowed_sites'])) : '');
+ $allowed_email = (!empty($_POST['allowed_email']) ? Strings::escapeTags(trim($_POST['allowed_email'])) : '');
+ $forbidden_nicknames = (!empty($_POST['forbidden_nicknames']) ? strtolower(Strings::escapeTags(trim($_POST['forbidden_nicknames']))) : '');
+ $no_oembed_rich_content = !empty($_POST['no_oembed_rich_content']);
+ $allowed_oembed = (!empty($_POST['allowed_oembed']) ? Strings::escapeTags(trim($_POST['allowed_oembed'])) : '');
+ $block_public = !empty($_POST['block_public']);
+ $force_publish = !empty($_POST['publish_all']);
+ $global_directory = (!empty($_POST['directory']) ? Strings::escapeTags(trim($_POST['directory'])) : '');
+ $newuser_private = !empty($_POST['newuser_private']);
+ $enotify_no_content = !empty($_POST['enotify_no_content']);
+ $private_addons = !empty($_POST['private_addons']);
+ $disable_embedded = !empty($_POST['disable_embedded']);
+ $allow_users_remote_self = !empty($_POST['allow_users_remote_self']);
+ $explicit_content = !empty($_POST['explicit_content']);
- $allowed_sites = ((x($_POST,'allowed_sites')) ? Strings::escapeTags(trim($_POST['allowed_sites'])) : '');
- $allowed_email = ((x($_POST,'allowed_email')) ? Strings::escapeTags(trim($_POST['allowed_email'])) : '');
- $forbidden_nicknames = ((x($_POST,'forbidden_nicknames')) ? strtolower(Strings::escapeTags(trim($_POST['forbidden_nicknames']))) : '');
- $no_oembed_rich_content = x($_POST,'no_oembed_rich_content');
- $allowed_oembed = ((x($_POST,'allowed_oembed')) ? Strings::escapeTags(trim($_POST['allowed_oembed'])) : '');
- $block_public = ((x($_POST,'block_public')) ? True : False);
- $force_publish = ((x($_POST,'publish_all')) ? True : False);
- $global_directory = ((x($_POST,'directory')) ? Strings::escapeTags(trim($_POST['directory'])) : '');
- $newuser_private = ((x($_POST,'newuser_private')) ? True : False);
- $enotify_no_content = ((x($_POST,'enotify_no_content')) ? True : False);
- $private_addons = ((x($_POST,'private_addons')) ? True : False);
- $disable_embedded = ((x($_POST,'disable_embedded')) ? True : False);
- $allow_users_remote_self = ((x($_POST,'allow_users_remote_self')) ? True : False);
- $explicit_content = ((x($_POST,'explicit_content')) ? True : False);
+ $no_multi_reg = !empty($_POST['no_multi_reg']);
+ $no_openid = !empty($_POST['no_openid']);
+ $no_regfullname = !empty($_POST['no_regfullname']);
+ $community_page_style = (!empty($_POST['community_page_style']) ? intval(trim($_POST['community_page_style'])) : 0);
+ $max_author_posts_community_page = (!empty($_POST['max_author_posts_community_page']) ? intval(trim($_POST['max_author_posts_community_page'])) : 0);
- $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
- $no_openid = !((x($_POST,'no_openid')) ? True : False);
- $no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
- $community_page_style = ((x($_POST,'community_page_style')) ? intval(trim($_POST['community_page_style'])) : 0);
- $max_author_posts_community_page = ((x($_POST,'max_author_posts_community_page')) ? intval(trim($_POST['max_author_posts_community_page'])) : 0);
+ $verifyssl = !empty($_POST['verifyssl']);
+ $proxyuser = (!empty($_POST['proxyuser']) ? Strings::escapeTags(trim($_POST['proxyuser'])) : '');
+ $proxy = (!empty($_POST['proxy']) ? Strings::escapeTags(trim($_POST['proxy'])) : '');
+ $timeout = (!empty($_POST['timeout']) ? intval(trim($_POST['timeout'])) : 60);
+ $maxloadavg = (!empty($_POST['maxloadavg']) ? intval(trim($_POST['maxloadavg'])) : 50);
+ $maxloadavg_frontend = (!empty($_POST['maxloadavg_frontend']) ? intval(trim($_POST['maxloadavg_frontend'])) : 50);
+ $min_memory = (!empty($_POST['min_memory']) ? intval(trim($_POST['min_memory'])) : 0);
+ $optimize_max_tablesize = (!empty($_POST['optimize_max_tablesize']) ? intval(trim($_POST['optimize_max_tablesize'])) : 100);
+ $optimize_fragmentation = (!empty($_POST['optimize_fragmentation']) ? intval(trim($_POST['optimize_fragmentation'])) : 30);
+ $poco_completion = (!empty($_POST['poco_completion']) ? intval(trim($_POST['poco_completion'])) : false);
+ $poco_requery_days = (!empty($_POST['poco_requery_days']) ? intval(trim($_POST['poco_requery_days'])) : 7);
+ $poco_discovery = (!empty($_POST['poco_discovery']) ? intval(trim($_POST['poco_discovery'])) : 0);
+ $poco_discovery_since = (!empty($_POST['poco_discovery_since']) ? intval(trim($_POST['poco_discovery_since'])) : 30);
+ $poco_local_search = !empty($_POST['poco_local_search']);
+ $nodeinfo = !empty($_POST['nodeinfo']);
+ $dfrn_only = !empty($_POST['dfrn_only']);
+ $ostatus_disabled = !empty($_POST['ostatus_disabled']);
+ $ostatus_full_threads = !empty($_POST['ostatus_full_threads']);
+ $diaspora_enabled = !empty($_POST['diaspora_enabled']);
+ $ssl_policy = (!empty($_POST['ssl_policy']) ? intval($_POST['ssl_policy']) : 0);
+ $force_ssl = !empty($_POST['force_ssl']);
+ $hide_help = !empty($_POST['hide_help']);
+ $dbclean = !empty($_POST['dbclean']);
+ $dbclean_expire_days = (!empty($_POST['dbclean_expire_days']) ? intval($_POST['dbclean_expire_days']) : 0);
+ $dbclean_unclaimed = (!empty($_POST['dbclean_unclaimed']) ? intval($_POST['dbclean_unclaimed']) : 0);
+ $dbclean_expire_conv = (!empty($_POST['dbclean_expire_conv']) ? intval($_POST['dbclean_expire_conv']) : 0);
+ $suppress_tags = !empty($_POST['suppress_tags']);
+ $itemcache = (!empty($_POST['itemcache']) ? Strings::escapeTags(trim($_POST['itemcache'])) : '');
+ $itemcache_duration = (!empty($_POST['itemcache_duration']) ? intval($_POST['itemcache_duration']) : 0);
+ $max_comments = (!empty($_POST['max_comments']) ? intval($_POST['max_comments']) : 0);
+ $temppath = (!empty($_POST['temppath']) ? Strings::escapeTags(trim($_POST['temppath'])) : '');
+ $basepath = (!empty($_POST['basepath']) ? Strings::escapeTags(trim($_POST['basepath'])) : '');
+ $singleuser = (!empty($_POST['singleuser']) ? Strings::escapeTags(trim($_POST['singleuser'])) : '');
+ $proxy_disabled = !empty($_POST['proxy_disabled']);
+ $only_tag_search = !empty($_POST['only_tag_search']);
+ $rino = (!empty($_POST['rino']) ? intval($_POST['rino']) : 0);
+ $check_new_version_url = (!empty($_POST['check_new_version_url']) ? Strings::escapeTags(trim($_POST['check_new_version_url'])) : 'none');
- $verifyssl = ((x($_POST,'verifyssl')) ? True : False);
- $proxyuser = ((x($_POST,'proxyuser')) ? Strings::escapeTags(trim($_POST['proxyuser'])) : '');
- $proxy = ((x($_POST,'proxy')) ? Strings::escapeTags(trim($_POST['proxy'])) : '');
- $timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
- $maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
- $maxloadavg_frontend = ((x($_POST,'maxloadavg_frontend')) ? intval(trim($_POST['maxloadavg_frontend'])) : 50);
- $min_memory = ((x($_POST,'min_memory')) ? intval(trim($_POST['min_memory'])) : 0);
- $optimize_max_tablesize = ((x($_POST,'optimize_max_tablesize')) ? intval(trim($_POST['optimize_max_tablesize'])): 100);
- $optimize_fragmentation = ((x($_POST,'optimize_fragmentation')) ? intval(trim($_POST['optimize_fragmentation'])): 30);
- $poco_completion = ((x($_POST,'poco_completion')) ? intval(trim($_POST['poco_completion'])) : false);
- $poco_requery_days = ((x($_POST,'poco_requery_days')) ? intval(trim($_POST['poco_requery_days'])) : 7);
- $poco_discovery = ((x($_POST,'poco_discovery')) ? intval(trim($_POST['poco_discovery'])) : 0);
- $poco_discovery_since = ((x($_POST,'poco_discovery_since')) ? intval(trim($_POST['poco_discovery_since'])) : 30);
- $poco_local_search = ((x($_POST,'poco_local_search')) ? intval(trim($_POST['poco_local_search'])) : false);
- $nodeinfo = ((x($_POST,'nodeinfo')) ? intval(trim($_POST['nodeinfo'])) : false);
- $dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
- $ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
- $ostatus_full_threads = ((x($_POST,'ostatus_full_threads')) ? True : False);
- $diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
- $ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
- $force_ssl = ((x($_POST,'force_ssl')) ? True : False);
- $hide_help = ((x($_POST,'hide_help')) ? True : False);
- $dbclean = ((x($_POST,'dbclean')) ? True : False);
- $dbclean_expire_days = ((x($_POST,'dbclean_expire_days')) ? intval($_POST['dbclean_expire_days']) : 0);
- $dbclean_unclaimed = ((x($_POST,'dbclean_unclaimed')) ? intval($_POST['dbclean_unclaimed']) : 0);
- $dbclean_expire_conv = ((x($_POST,'dbclean_expire_conv')) ? intval($_POST['dbclean_expire_conv']) : 0);
- $suppress_tags = ((x($_POST,'suppress_tags')) ? True : False);
- $itemcache = ((x($_POST,'itemcache')) ? Strings::escapeTags(trim($_POST['itemcache'])) : '');
- $itemcache_duration = ((x($_POST,'itemcache_duration')) ? intval($_POST['itemcache_duration']) : 0);
- $max_comments = ((x($_POST,'max_comments')) ? intval($_POST['max_comments']) : 0);
- $temppath = ((x($_POST,'temppath')) ? Strings::escapeTags(trim($_POST['temppath'])) : '');
- $basepath = ((x($_POST,'basepath')) ? Strings::escapeTags(trim($_POST['basepath'])) : '');
- $singleuser = ((x($_POST,'singleuser')) ? Strings::escapeTags(trim($_POST['singleuser'])) : '');
- $proxy_disabled = ((x($_POST,'proxy_disabled')) ? True : False);
- $only_tag_search = ((x($_POST,'only_tag_search')) ? True : False);
- $rino = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0);
- $check_new_version_url = ((x($_POST, 'check_new_version_url')) ? Strings::escapeTags(trim($_POST['check_new_version_url'])) : 'none');
+ $worker_queues = (!empty($_POST['worker_queues']) ? intval($_POST['worker_queues']) : 10);
+ $worker_dont_fork = !empty($_POST['worker_dont_fork']);
+ $worker_fastlane = !empty($_POST['worker_fastlane']);
+ $worker_frontend = !empty($_POST['worker_frontend']);
- $worker_queues = ((x($_POST,'worker_queues')) ? intval($_POST['worker_queues']) : 10);
- $worker_dont_fork = ((x($_POST,'worker_dont_fork')) ? True : False);
- $worker_fastlane = ((x($_POST,'worker_fastlane')) ? True : False);
- $worker_frontend = ((x($_POST,'worker_frontend')) ? True : False);
-
- $relay_directly = ((x($_POST,'relay_directly')) ? True : False);
- $relay_server = ((x($_POST,'relay_server')) ? Strings::escapeTags(trim($_POST['relay_server'])) : '');
- $relay_subscribe = ((x($_POST,'relay_subscribe')) ? True : False);
- $relay_scope = ((x($_POST,'relay_scope')) ? Strings::escapeTags(trim($_POST['relay_scope'])) : '');
- $relay_server_tags = ((x($_POST,'relay_server_tags')) ? Strings::escapeTags(trim($_POST['relay_server_tags'])) : '');
- $relay_user_tags = ((x($_POST,'relay_user_tags')) ? True : False);
- $active_panel = (defaults($_POST, 'active_panel', '') ? "#" . Strings::escapeTags(trim($_POST['active_panel'])) : '');
+ $relay_directly = !empty($_POST['relay_directly']);
+ $relay_server = (!empty($_POST['relay_server']) ? Strings::escapeTags(trim($_POST['relay_server'])) : '');
+ $relay_subscribe = !empty($_POST['relay_subscribe']);
+ $relay_scope = (!empty($_POST['relay_scope']) ? Strings::escapeTags(trim($_POST['relay_scope'])) : '');
+ $relay_server_tags = (!empty($_POST['relay_server_tags']) ? Strings::escapeTags(trim($_POST['relay_server_tags'])) : '');
+ $relay_user_tags = !empty($_POST['relay_user_tags']);
+ $active_panel = (!empty($_POST['active_panel']) ? "#" . Strings::escapeTags(trim($_POST['active_panel'])) : '');
// Has the directory url changed? If yes, then resubmit the existing profiles there
if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
@@ -1217,24 +1219,24 @@ function admin_page_site_post(App $a)
);
}
}
- Config::set('system', 'ssl_policy', $ssl_policy);
- Config::set('system', 'maxloadavg', $maxloadavg);
- Config::set('system', 'maxloadavg_frontend', $maxloadavg_frontend);
- Config::set('system', 'min_memory', $min_memory);
+ Config::set('system', 'ssl_policy' , $ssl_policy);
+ Config::set('system', 'maxloadavg' , $maxloadavg);
+ Config::set('system', 'maxloadavg_frontend' , $maxloadavg_frontend);
+ Config::set('system', 'min_memory' , $min_memory);
Config::set('system', 'optimize_max_tablesize', $optimize_max_tablesize);
Config::set('system', 'optimize_fragmentation', $optimize_fragmentation);
- Config::set('system', 'poco_completion', $poco_completion);
- Config::set('system', 'poco_requery_days', $poco_requery_days);
- Config::set('system', 'poco_discovery', $poco_discovery);
- Config::set('system', 'poco_discovery_since', $poco_discovery_since);
- Config::set('system', 'poco_local_search', $poco_local_search);
- Config::set('system', 'nodeinfo', $nodeinfo);
- Config::set('config', 'sitename', $sitename);
- Config::set('config', 'hostname', $hostname);
- Config::set('config', 'sender_email', $sender_email);
- Config::set('system', 'suppress_tags', $suppress_tags);
- Config::set('system', 'shortcut_icon', $shortcut_icon);
- Config::set('system', 'touch_icon', $touch_icon);
+ Config::set('system', 'poco_completion' , $poco_completion);
+ Config::set('system', 'poco_requery_days' , $poco_requery_days);
+ Config::set('system', 'poco_discovery' , $poco_discovery);
+ Config::set('system', 'poco_discovery_since' , $poco_discovery_since);
+ Config::set('system', 'poco_local_search' , $poco_local_search);
+ Config::set('system', 'nodeinfo' , $nodeinfo);
+ Config::set('config', 'sitename' , $sitename);
+ Config::set('config', 'hostname' , $hostname);
+ Config::set('config', 'sender_email' , $sender_email);
+ Config::set('system', 'suppress_tags' , $suppress_tags);
+ Config::set('system', 'shortcut_icon' , $shortcut_icon);
+ Config::set('system', 'touch_icon' , $touch_icon);
if ($banner == "") {
Config::delete('system', 'banner');
@@ -1261,49 +1263,49 @@ function admin_page_site_post(App $a)
} else {
Config::set('system', 'singleuser', $singleuser);
}
- Config::set('system', 'maximagesize', $maximagesize);
- Config::set('system', 'max_image_length', $maximagelength);
- Config::set('system', 'jpeg_quality', $jpegimagequality);
+ Config::set('system', 'maximagesize' , $maximagesize);
+ Config::set('system', 'max_image_length' , $maximagelength);
+ Config::set('system', 'jpeg_quality' , $jpegimagequality);
- Config::set('config', 'register_policy', $register_policy);
+ Config::set('config', 'register_policy' , $register_policy);
Config::set('system', 'max_daily_registrations', $daily_registrations);
- Config::set('system', 'account_abandon_days', $abandon_days);
- Config::set('config', 'register_text', $register_text);
- Config::set('system', 'allowed_sites', $allowed_sites);
- Config::set('system', 'allowed_email', $allowed_email);
- Config::set('system', 'forbidden_nicknames', $forbidden_nicknames);
- Config::set('system', 'no_oembed_rich_content', $no_oembed_rich_content);
- Config::set('system', 'allowed_oembed', $allowed_oembed);
- Config::set('system', 'block_public', $block_public);
- Config::set('system', 'publish_all', $force_publish);
- Config::set('system', 'newuser_private', $newuser_private);
- Config::set('system', 'enotify_no_content', $enotify_no_content);
- Config::set('system', 'disable_embedded', $disable_embedded);
+ Config::set('system', 'account_abandon_days' , $abandon_days);
+ Config::set('config', 'register_text' , $register_text);
+ Config::set('system', 'allowed_sites' , $allowed_sites);
+ Config::set('system', 'allowed_email' , $allowed_email);
+ Config::set('system', 'forbidden_nicknames' , $forbidden_nicknames);
+ Config::set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
+ Config::set('system', 'allowed_oembed' , $allowed_oembed);
+ Config::set('system', 'block_public' , $block_public);
+ Config::set('system', 'publish_all' , $force_publish);
+ Config::set('system', 'newuser_private' , $newuser_private);
+ Config::set('system', 'enotify_no_content' , $enotify_no_content);
+ Config::set('system', 'disable_embedded' , $disable_embedded);
Config::set('system', 'allow_users_remote_self', $allow_users_remote_self);
- Config::set('system', 'explicit_content', $explicit_content);
- Config::set('system', 'check_new_version_url', $check_new_version_url);
+ Config::set('system', 'explicit_content' , $explicit_content);
+ Config::set('system', 'check_new_version_url' , $check_new_version_url);
Config::set('system', 'block_extended_register', $no_multi_reg);
- Config::set('system', 'no_openid', $no_openid);
- Config::set('system', 'no_regfullname', $no_regfullname);
- Config::set('system', 'community_page_style', $community_page_style);
+ Config::set('system', 'no_openid' , $no_openid);
+ Config::set('system', 'no_regfullname' , $no_regfullname);
+ Config::set('system', 'community_page_style' , $community_page_style);
Config::set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
- Config::set('system', 'verifyssl', $verifyssl);
- Config::set('system', 'proxyuser', $proxyuser);
- Config::set('system', 'proxy', $proxy);
- Config::set('system', 'curl_timeout', $timeout);
- Config::set('system', 'dfrn_only', $dfrn_only);
- Config::set('system', 'ostatus_disabled', $ostatus_disabled);
- Config::set('system', 'ostatus_full_threads', $ostatus_full_threads);
- Config::set('system', 'diaspora_enabled', $diaspora_enabled);
+ Config::set('system', 'verifyssl' , $verifyssl);
+ Config::set('system', 'proxyuser' , $proxyuser);
+ Config::set('system', 'proxy' , $proxy);
+ Config::set('system', 'curl_timeout' , $timeout);
+ Config::set('system', 'dfrn_only' , $dfrn_only);
+ Config::set('system', 'ostatus_disabled' , $ostatus_disabled);
+ Config::set('system', 'ostatus_full_threads' , $ostatus_full_threads);
+ Config::set('system', 'diaspora_enabled' , $diaspora_enabled);
- Config::set('config', 'private_addons', $private_addons);
+ Config::set('config', 'private_addons' , $private_addons);
- Config::set('system', 'force_ssl', $force_ssl);
- Config::set('system', 'hide_help', $hide_help);
+ Config::set('system', 'force_ssl' , $force_ssl);
+ Config::set('system', 'hide_help' , $hide_help);
- Config::set('system', 'dbclean', $dbclean);
- Config::set('system', 'dbclean-expire-days', $dbclean_expire_days);
+ Config::set('system', 'dbclean' , $dbclean);
+ Config::set('system', 'dbclean-expire-days' , $dbclean_expire_days);
Config::set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
if ($dbclean_unclaimed == 0) {
@@ -1330,23 +1332,23 @@ function admin_page_site_post(App $a)
$basepath = App::getRealPath($basepath);
}
- Config::set('system', 'basepath', $basepath);
- Config::set('system', 'proxy_disabled', $proxy_disabled);
- Config::set('system', 'only_tag_search', $only_tag_search);
+ Config::set('system', 'basepath' , $basepath);
+ Config::set('system', 'proxy_disabled' , $proxy_disabled);
+ Config::set('system', 'only_tag_search' , $only_tag_search);
- Config::set('system', 'worker_queues', $worker_queues);
- Config::set('system', 'worker_dont_fork', $worker_dont_fork);
- Config::set('system', 'worker_fastlane', $worker_fastlane);
- Config::set('system', 'frontend_worker', $worker_frontend);
+ Config::set('system', 'worker_queues' , $worker_queues);
+ Config::set('system', 'worker_dont_fork' , $worker_dont_fork);
+ Config::set('system', 'worker_fastlane' , $worker_fastlane);
+ Config::set('system', 'frontend_worker' , $worker_frontend);
- Config::set('system', 'relay_directly', $relay_directly);
- Config::set('system', 'relay_server', $relay_server);
- Config::set('system', 'relay_subscribe', $relay_subscribe);
- Config::set('system', 'relay_scope', $relay_scope);
+ Config::set('system', 'relay_directly' , $relay_directly);
+ Config::set('system', 'relay_server' , $relay_server);
+ Config::set('system', 'relay_subscribe' , $relay_subscribe);
+ Config::set('system', 'relay_scope' , $relay_scope);
Config::set('system', 'relay_server_tags', $relay_server_tags);
- Config::set('system', 'relay_user_tags', $relay_user_tags);
+ Config::set('system', 'relay_user_tags' , $relay_user_tags);
- Config::set('system', 'rino_encrypt', $rino);
+ Config::set('system', 'rino_encrypt' , $rino);
info(L10n::t('Site settings updated.') . EOL);
@@ -1442,9 +1444,7 @@ function admin_page_site(App $a)
$banner = 'Friendica';
}
- $banner = htmlspecialchars($banner);
$info = Config::get('config', 'info');
- $info = htmlspecialchars($info);
// Automatically create temporary paths
get_temppath();
@@ -1484,120 +1484,121 @@ function admin_page_site(App $a)
$t = Renderer::getMarkupTemplate('admin/site.tpl');
return Renderer::replaceMacros($t, [
- '$title' => L10n::t('Administration'),
- '$page' => L10n::t('Site'),
- '$submit' => L10n::t('Save Settings'),
- '$republish' => L10n::t('Republish users to directory'),
- '$registration' => L10n::t('Registration'),
- '$upload' => L10n::t('File upload'),
- '$corporate' => L10n::t('Policies'),
- '$advanced' => L10n::t('Advanced'),
+ '$title' => L10n::t('Administration'),
+ '$page' => L10n::t('Site'),
+ '$submit' => L10n::t('Save Settings'),
+ '$republish' => L10n::t('Republish users to directory'),
+ '$registration' => L10n::t('Registration'),
+ '$upload' => L10n::t('File upload'),
+ '$corporate' => L10n::t('Policies'),
+ '$advanced' => L10n::t('Advanced'),
'$portable_contacts' => L10n::t('Auto Discovered Contact Directory'),
- '$performance' => L10n::t('Performance'),
- '$worker_title' => L10n::t('Worker'),
- '$relay_title' => L10n::t('Message Relay'),
- '$relocate' => L10n::t('Relocate Instance'),
- '$relocate_warning' => L10n::t('Warning! Advanced function. Could make this server unreachable.'),
- '$baseurl' => System::baseUrl(true),
+ '$performance' => L10n::t('Performance'),
+ '$worker_title' => L10n::t('Worker'),
+ '$relay_title' => L10n::t('Message Relay'),
+ '$relocate' => L10n::t('Relocate Instance'),
+ '$relocate_warning' => L10n::t('Warning! Advanced function. Could make this server unreachable.'),
+ '$baseurl' => System::baseUrl(true),
+
// name, label, value, help string, extra data...
- '$sitename' => ['sitename', L10n::t("Site name"), Config::get('config', 'sitename'),''],
- '$hostname' => ['hostname', L10n::t("Host name"), Config::get('config', 'hostname'), ""],
- '$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"],
- '$banner' => ['banner', L10n::t("Banner/Logo"), $banner, ""],
- '$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.")],
- '$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.")],
- '$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())],
- '$language' => ['language', L10n::t("System language"), Config::get('system','language'), "", $lang_choices],
- '$theme' => ['theme', L10n::t("System theme"), Config::get('system','theme'), L10n::t("Default system theme - may be over-ridden by user profiles - change theme settings"), $theme_choices],
- '$theme_mobile' => ['theme_mobile', L10n::t("Mobile system theme"), Config::get('system', 'mobile-theme', '---'), L10n::t("Theme for mobile devices"), $theme_choices_mobile],
- '$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],
- '$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.")],
- '$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.")],
- '$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],
- '$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.")],
- '$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.")],
- '$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.")],
+ '$sitename' => ['sitename', L10n::t("Site name"), Config::get('config', 'sitename'), ''],
+ '$hostname' => ['hostname', L10n::t("Host name"), Config::get('config', 'hostname'), ""],
+ '$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"],
+ '$banner' => ['banner', L10n::t("Banner/Logo"), $banner, ""],
+ '$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.")],
+ '$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.")],
+ '$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())],
+ '$language' => ['language', L10n::t("System language"), Config::get('system', 'language'), "", $lang_choices],
+ '$theme' => ['theme', L10n::t("System theme"), Config::get('system', 'theme'), L10n::t("Default system theme - may be over-ridden by user profiles - change theme settings"), $theme_choices],
+ '$theme_mobile' => ['theme_mobile', L10n::t("Mobile system theme"), Config::get('system', 'mobile-theme', '---'), L10n::t("Theme for mobile devices"), $theme_choices_mobile],
+ '$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],
+ '$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.")],
+ '$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.")],
+ '$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],
+ '$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.")],
+ '$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.")],
+ '$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.")],
- '$register_policy' => ['register_policy', L10n::t("Register policy"), Config::get('config', 'register_policy'), "", $register_choices],
- '$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.")],
- '$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.")],
- '$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.')],
- '$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.')],
- '$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")],
- '$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")],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.") . '' . L10n::t('Enabling this may violate privacy laws like the GDPR') . ''],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.')],
- '$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.')],
- '$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.")],
- '$no_openid' => ['no_openid', L10n::t("OpenID support"), !Config::get('system','no_openid'), L10n::t("OpenID support for registration and logins.")],
- '$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")],
- '$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],
- '$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")],
- '$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.")],
- '$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.")],
- '$ostatus_not_able' => L10n::t("OStatus support can only be enabled if threading is enabled."),
- '$diaspora_able' => $diaspora_able,
- '$diaspora_not_able' => L10n::t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
- '$diaspora_enabled' => ['diaspora_enabled', L10n::t("Enable Diaspora support"), Config::get('system', 'diaspora_enabled', $diaspora_able), L10n::t("Provide built-in Diaspora network compatibility.")],
- '$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.")],
- '$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.")],
- '$proxyuser' => ['proxyuser', L10n::t("Proxy user"), Config::get('system','proxyuser'), ""],
- '$proxy' => ['proxy', L10n::t("Proxy URL"), Config::get('system','proxy'), ""],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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%.")],
+ '$register_policy' => ['register_policy', L10n::t("Register policy"), Config::get('config', 'register_policy'), "", $register_choices],
+ '$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.")],
+ '$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.")],
+ '$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.')],
+ '$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.')],
+ '$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")],
+ '$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")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.") . '' . L10n::t('Enabling this may violate privacy laws like the GDPR') . ''],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.')],
+ '$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.')],
+ '$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.")],
+ '$no_openid' => ['no_openid', L10n::t("Disable OpenID"), Config::get('system', 'no_openid'), L10n::t("Disable OpenID support for registration and logins.")],
+ '$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.")],
+ '$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],
+ '$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")],
+ '$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.")],
+ '$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.")],
+ '$ostatus_not_able' => L10n::t("OStatus support can only be enabled if threading is enabled."),
+ '$diaspora_able' => $diaspora_able,
+ '$diaspora_not_able' => L10n::t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
+ '$diaspora_enabled' => ['diaspora_enabled', L10n::t("Enable Diaspora support"), Config::get('system', 'diaspora_enabled', $diaspora_able), L10n::t("Provide built-in Diaspora network compatibility.")],
+ '$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.")],
+ '$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.")],
+ '$proxyuser' => ['proxyuser', L10n::t("Proxy user"), Config::get('system', 'proxyuser'), ""],
+ '$proxy' => ['proxy', L10n::t("Proxy URL"), Config::get('system', 'proxy'), ""],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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%.")],
- '$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.")],
- '$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.")],
- '$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],
- '$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],
- '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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],
+ '$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],
+ '$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.")],
- '$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 the-federation.info for details.")],
+ '$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 the-federation.info for details.")],
- '$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],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.")],
- '$itemcache' => ['itemcache', L10n::t("Path to item cache"), Config::get('system','itemcache'), L10n::t("The item caches buffers generated bbcode and external images.")],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.")],
- '$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.")],
+ '$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],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$itemcache' => ['itemcache', L10n::t("Path to item cache"), Config::get('system', 'itemcache'), L10n::t("The item caches buffers generated bbcode and external images.")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
+ '$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.")],
- '$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.")],
+ '$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.")],
- '$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")]],
+ '$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")]],
- '$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)],
- '$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.")],
- '$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.")],
- '$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())],
+ '$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)],
+ '$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.")],
+ '$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.")],
+ '$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())],
- '$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.")],
- '$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")],
- '$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")],
- '$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')]],
- '$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.")],
- '$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'.")],
+ '$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.")],
+ '$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")],
+ '$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")],
+ '$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')]],
+ '$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.")],
+ '$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'.")],
- '$form_security_token' => BaseModule::getFormSecurityToken("admin_site"),
- '$relocate_button' => L10n::t('Start Relocation'),
+ '$form_security_token' => BaseModule::getFormSecurityToken("admin_site"),
+ '$relocate_button' => L10n::t('Start Relocation'),
]);
}
@@ -1774,14 +1775,14 @@ function admin_page_users_post(App $a)
'body' => $body]);
}
- if (x($_POST, 'page_users_block')) {
+ if (!empty($_POST['page_users_block'])) {
foreach ($users as $uid) {
q("UPDATE `user` SET `blocked` = 1-`blocked` WHERE `uid` = %s", intval($uid)
);
}
notice(L10n::tt("%s user blocked/unblocked", "%s users blocked/unblocked", count($users)));
}
- if (x($_POST, 'page_users_delete')) {
+ if (!empty($_POST['page_users_delete'])) {
foreach ($users as $uid) {
if (local_user() != $uid) {
User::remove($uid);
@@ -1792,13 +1793,13 @@ function admin_page_users_post(App $a)
notice(L10n::tt("%s user deleted", "%s users deleted", count($users)));
}
- if (x($_POST, 'page_users_approve')) {
+ if (!empty($_POST['page_users_approve'])) {
require_once "mod/regmod.php";
foreach ($pending as $hash) {
user_allow($hash);
}
}
- if (x($_POST, 'page_users_deny')) {
+ if (!empty($_POST['page_users_deny'])) {
require_once "mod/regmod.php";
foreach ($pending as $hash) {
user_deny($hash);
@@ -1872,7 +1873,7 @@ function admin_page_users(App $a)
$order = "contact.name";
$order_direction = "+";
- if (x($_GET, 'o')) {
+ if (!empty($_GET['o'])) {
$new_order = $_GET['o'];
if ($new_order[0] === "-") {
$order_direction = "-";
@@ -1977,7 +1978,7 @@ function admin_page_users(App $a)
'$h_users' => L10n::t('Users'),
'$h_newuser' => L10n::t('New User'),
- '$th_deleted' => [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Delete in')],
+ '$th_deleted' => [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Permanent deletion')],
'$th_users' => $th_users,
'$order_users' => $order,
'$order_direction_users' => $order_direction,
@@ -2098,7 +2099,7 @@ function admin_page_addons(App $a, array $addons_admin)
/*
* List addons
*/
- if (x($_GET, "a") && $_GET['a'] == "r") {
+ if (!empty($_GET['a']) && $_GET['a'] == "r") {
BaseModule::checkFormSecurityTokenRedirectOnError($a->getBaseURL() . '/admin/addons', 'admin_themes', 't');
Addon::reload();
info("Addons reloaded");
@@ -2147,14 +2148,14 @@ function admin_page_addons(App $a, array $addons_admin)
}
/**
- * @param array $themes
+ * @param array $themes
* @param string $th
- * @param int $result
+ * @param int $result
*/
function toggle_theme(&$themes, $th, &$result)
{
$count = count($themes);
- for ($x = 0; $x < $count; $x ++) {
+ for ($x = 0; $x < $count; $x++) {
if ($themes[$x]['name'] === $th) {
if ($themes[$x]['allowed']) {
$themes[$x]['allowed'] = 0;
@@ -2168,14 +2169,14 @@ function toggle_theme(&$themes, $th, &$result)
}
/**
- * @param array $themes
+ * @param array $themes
* @param string $th
* @return int
*/
function theme_status($themes, $th)
{
$count = count($themes);
- for ($x = 0; $x < $count; $x ++) {
+ for ($x = 0; $x < $count; $x++) {
if ($themes[$x]['name'] === $th) {
if ($themes[$x]['allowed']) {
return 1;
@@ -2276,7 +2277,7 @@ function admin_page_themes(App $a)
return '';
}
- if (x($_GET, "a") && $_GET['a'] == "t") {
+ if (!empty($_GET['a']) && $_GET['a'] == "t") {
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/themes', 'admin_themes', 't');
// Toggle theme status
@@ -2364,7 +2365,7 @@ function admin_page_themes(App $a)
}
// reload active themes
- if (x($_GET, "a") && $_GET['a'] == "r") {
+ if (!empty($_GET['a']) && $_GET['a'] == "r") {
BaseModule::checkFormSecurityTokenRedirectOnError(System::baseUrl() . '/admin/themes', 'admin_themes', 't');
foreach ($themes as $th) {
if ($th['allowed']) {
@@ -2409,12 +2410,12 @@ function admin_page_themes(App $a)
*/
function admin_page_logs_post(App $a)
{
- if (x($_POST, "page_logs")) {
+ if (!empty($_POST['page_logs'])) {
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/logs', 'admin_logs');
- $logfile = ((x($_POST,'logfile')) ? Strings::escapeTags(trim($_POST['logfile'])) : '');
- $debugging = ((x($_POST,'debugging')) ? true : false);
- $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
+ $logfile = (!empty($_POST['logfile']) ? Strings::escapeTags(trim($_POST['logfile'])) : '');
+ $debugging = !empty($_POST['debugging']);
+ $loglevel = (!empty($_POST['loglevel']) ? intval(trim($_POST['loglevel'])) : 0);
Config::set('system', 'logfile', $logfile);
Config::set('system', 'debugging', $debugging);
@@ -2555,14 +2556,14 @@ function admin_page_features_post(App $a)
$feature_state = 'feature_' . $feature;
$featurelock = 'featurelock_' . $feature;
- if (x($_POST, $feature_state)) {
+ if (!empty($_POST[$feature_state])) {
$val = intval($_POST[$feature_state]);
} else {
$val = 0;
}
Config::set('feature', $feature, $val);
- if (x($_POST, $featurelock)) {
+ if (!empty($_POST[$featurelock])) {
Config::set('feature_lock', $feature, $val);
} else {
Config::delete('feature_lock', $feature);
diff --git a/mod/allfriends.php b/mod/allfriends.php
index b233a46182..7a39c481db 100644
--- a/mod/allfriends.php
+++ b/mod/allfriends.php
@@ -81,9 +81,9 @@ function allfriends_content(App $a)
$entry = [
'url' => $rr['url'],
'itemurl' => defaults($contact_details, 'addr', $rr['url']),
- 'name' => htmlentities($contact_details['name']),
+ 'name' => $contact_details['name'],
'thumb' => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
- 'img_hover' => htmlentities($contact_details['name']),
+ 'img_hover' => $contact_details['name'],
'details' => $contact_details['location'],
'tags' => $contact_details['keywords'],
'about' => $contact_details['about'],
@@ -100,9 +100,7 @@ function allfriends_content(App $a)
$tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
-
$o .= Renderer::replaceMacros($tpl, [
- //'$title' => L10n::t('Friends of %s', htmlentities($c[0]['name'])),
'$tab_str' => $tab_str,
'$contacts' => $entries,
'$paginate' => $pager->renderFull($total),
diff --git a/mod/api.php b/mod/api.php
index 52ddf37bea..e721462421 100644
--- a/mod/api.php
+++ b/mod/api.php
@@ -38,7 +38,7 @@ function api_post(App $a)
return;
}
- if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) {
+ if (count($a->user) && !empty($a->user['uid']) && $a->user['uid'] != local_user()) {
notice(L10n::t('Permission denied.') . EOL);
return;
}
@@ -62,7 +62,7 @@ function api_content(App $a)
killme();
}
- if (x($_POST, 'oauth_yes')) {
+ if (!empty($_POST['oauth_yes'])) {
$app = oauth_get_client($request);
if (is_null($app)) {
return "Invalid request. Unknown token.";
diff --git a/mod/babel.php b/mod/babel.php
index b9846e4fb4..64c9557767 100644
--- a/mod/babel.php
+++ b/mod/babel.php
@@ -142,7 +142,7 @@ function babel_content()
$tpl = Renderer::getMarkupTemplate('babel.tpl');
$o = Renderer::replaceMacros($tpl, [
- '$text' => ['text', L10n::t('Source text'), htmlentities(defaults($_REQUEST, 'text', '')), ''],
+ '$text' => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
'$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
'$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
'$type_html' => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],
diff --git a/mod/cal.php b/mod/cal.php
index 29095082db..526e33c00c 100644
--- a/mod/cal.php
+++ b/mod/cal.php
@@ -72,7 +72,7 @@ function cal_init(App $a)
$cal_widget = Widget\CalendarExport::getHTML();
- if (!x($a->page, 'aside')) {
+ if (empty($a->page['aside'])) {
$a->page['aside'] = '';
}
@@ -100,7 +100,7 @@ function cal_content(App $a)
$mode = 'view';
$y = 0;
$m = 0;
- $ignored = (x($_REQUEST, 'ignored') ? intval($_REQUEST['ignored']) : 0);
+ $ignored = (!empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0);
$format = 'ical';
if ($a->argc == 4 && $a->argv[2] == 'export') {
@@ -115,7 +115,7 @@ function cal_content(App $a)
$owner_uid = $a->data['user']['uid'];
$nick = $a->data['user']['nickname'];
- if (x($_SESSION, 'remote') && is_array($_SESSION['remote'])) {
+ if (!empty($_SESSION['remote']) && is_array($_SESSION['remote'])) {
foreach ($_SESSION['remote'] as $v) {
if ($v['uid'] == $a->profile['profile_uid']) {
$contact_id = $v['cid'];
@@ -195,11 +195,11 @@ function cal_content(App $a)
if (!empty($a->argv[2]) && ($a->argv[2] === 'json')) {
- if (x($_GET, 'start')) {
+ if (!empty($_GET['start'])) {
$start = $_GET['start'];
}
- if (x($_GET, 'end')) {
+ if (!empty($_GET['end'])) {
$finish = $_GET['end'];
}
}
@@ -233,7 +233,7 @@ function cal_content(App $a)
$r = Event::sortByDate($r);
foreach ($r as $rr) {
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
- if (!x($links, $j)) {
+ if (empty($links[$j])) {
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
}
}
@@ -248,7 +248,7 @@ function cal_content(App $a)
}
// links: array('href', 'text', 'extra css classes', 'title')
- if (x($_GET, 'id')) {
+ if (!empty($_GET['id'])) {
$tpl = Renderer::getMarkupTemplate("event.tpl");
} else {
// if (Config::get('experimentals','new_calendar')==1){
@@ -284,7 +284,7 @@ function cal_content(App $a)
"list" => L10n::t("list"),
]);
- if (x($_GET, 'id')) {
+ if (!empty($_GET['id'])) {
echo $o;
killme();
}
diff --git a/mod/common.php b/mod/common.php
index b335e296db..c93edf3b30 100644
--- a/mod/common.php
+++ b/mod/common.php
@@ -50,12 +50,12 @@ function common_content(App $a)
if (DBA::isResult($contact)) {
$vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate("vcard-widget.tpl"), [
- '$name' => htmlentities($contact['name']),
+ '$name' => $contact['name'],
'$photo' => $contact['photo'],
'url' => 'contact/' . $cid
]);
- if (!x($a->page, 'aside')) {
+ if (empty($a->page['aside'])) {
$a->page['aside'] = '';
}
$a->page['aside'] .= $vcard_widget;
@@ -123,7 +123,7 @@ function common_content(App $a)
'itemurl' => defaults($contact_details, 'addr', $common_friend['url']),
'name' => $contact_details['name'],
'thumb' => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
- 'img_hover' => htmlentities($contact_details['name']),
+ 'img_hover' => $contact_details['name'],
'details' => $contact_details['location'],
'tags' => $contact_details['keywords'],
'about' => $contact_details['about'],
diff --git a/mod/contactgroup.php b/mod/contactgroup.php
index bf34c59d75..753d3a0733 100644
--- a/mod/contactgroup.php
+++ b/mod/contactgroup.php
@@ -40,7 +40,7 @@ function contactgroup_content(App $a)
}
}
- if (x($change)) {
+ if (!empty($change)) {
if (in_array($change, $preselected)) {
Group::removeMember($group['id'], $change);
} else {
diff --git a/mod/credits.php b/mod/credits.php
index cfcc30b3e2..56b7cd6618 100644
--- a/mod/credits.php
+++ b/mod/credits.php
@@ -13,7 +13,7 @@ function credits_content()
{
/* fill the page with credits */
$credits_string = file_get_contents('CREDITS.txt');
- $names = explode("\n", htmlspecialchars($credits_string));
+ $names = explode("\n", $credits_string);
$tpl = Renderer::getMarkupTemplate('credits.tpl');
return Renderer::replaceMacros($tpl, [
'$title' => L10n::t('Credits'),
diff --git a/mod/crepair.php b/mod/crepair.php
index f9ba281d13..91b22dbc92 100644
--- a/mod/crepair.php
+++ b/mod/crepair.php
@@ -25,7 +25,7 @@ function crepair_init(App $a)
$contact = DBA::selectFirst('contact', [], ['uid' => local_user(), 'id' => $a->argv[1]]);
}
- if (!x($a->page, 'aside')) {
+ if (empty($a->page['aside'])) {
$a->page['aside'] = '';
}
@@ -158,8 +158,8 @@ function crepair_content(App $a)
$remote_self_options
],
- '$name' => ['name', L10n::t('Name') , htmlentities($contact['name'])],
- '$nick' => ['nick', L10n::t('Account Nickname'), htmlentities($contact['nick'])],
+ '$name' => ['name', L10n::t('Name') , $contact['name']],
+ '$nick' => ['nick', L10n::t('Account Nickname'), $contact['nick']],
'$attag' => ['attag', L10n::t('@Tagname - overrides Name/Nickname'), $contact['attag']],
'$url' => ['url', L10n::t('Account URL'), $contact['url']],
'$request' => ['request', L10n::t('Friend Request URL'), $contact['request']],
diff --git a/mod/delegate.php b/mod/delegate.php
index c8987ab570..4bfc0e31ba 100644
--- a/mod/delegate.php
+++ b/mod/delegate.php
@@ -27,7 +27,7 @@ function delegate_post(App $a)
return;
}
- if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) {
+ if (count($a->user) && !empty($a->user['uid']) && $a->user['uid'] != local_user()) {
notice(L10n::t('Permission denied.') . EOL);
return;
}
@@ -63,7 +63,7 @@ function delegate_content(App $a)
if ($a->argc > 2 && $a->argv[1] === 'add' && intval($a->argv[2])) {
// delegated admins can view but not change delegation permissions
- if (x($_SESSION, 'submanage')) {
+ if (!empty($_SESSION['submanage'])) {
$a->internalRedirect('delegate');
}
@@ -84,7 +84,7 @@ function delegate_content(App $a)
if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
// delegated admins can view but not change delegation permissions
- if (x($_SESSION, 'submanage')) {
+ if (!empty($_SESSION['submanage'])) {
$a->internalRedirect('delegate');
}
@@ -163,6 +163,8 @@ function delegate_content(App $a)
if (!is_null($parent_user)) {
$parent_password = ['parent_password', L10n::t('Parent Password:'), '', L10n::t('Please enter the password of the parent account to legitimize your request.')];
+ } else {
+ $parent_password = '';
}
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('delegate.tpl'), [
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index 48c8e32e5a..6f365c5315 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -63,7 +63,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
* this being a page type which supports automatic friend acceptance. That is also Scenario 1
* since we are operating on behalf of our registered user to approve a friendship.
*/
- if (!x($_POST, 'source_url')) {
+ if (empty($_POST['source_url'])) {
$uid = defaults($handsfree, 'uid', local_user());
if (!$uid) {
notice(L10n::t('Permission denied.') . EOL);
@@ -417,7 +417,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
* In the section above where the confirming party makes a POST and
* retrieves xml status information, they are communicating with the following code.
*/
- if (x($_POST, 'source_url')) {
+ if (!empty($_POST['source_url'])) {
// We are processing an external confirmation to an introduction created by our user.
$public_key = defaults($_POST, 'public_key', '');
$dfrn_id = hex2bin(defaults($_POST, 'dfrn_id' , ''));
@@ -435,7 +435,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
// If $aes_key is set, both of these items require unpacking from the hex transport encoding.
- if (x($aes_key)) {
+ if (!empty($aes_key)) {
$aes_key = hex2bin($aes_key);
$public_key = hex2bin($public_key);
}
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index 63f53e0606..51576b3b4e 100644
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -39,16 +39,16 @@ function dfrn_notify_post(App $a) {
}
}
- $dfrn_id = ((x($_POST,'dfrn_id')) ? Strings::escapeTags(trim($_POST['dfrn_id'])) : '');
- $dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
- $challenge = ((x($_POST,'challenge')) ? Strings::escapeTags(trim($_POST['challenge'])) : '');
- $data = ((x($_POST,'data')) ? $_POST['data'] : '');
- $key = ((x($_POST,'key')) ? $_POST['key'] : '');
- $rino_remote = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0);
- $dissolve = ((x($_POST,'dissolve')) ? intval($_POST['dissolve']) : 0);
- $perm = ((x($_POST,'perm')) ? Strings::escapeTags(trim($_POST['perm'])) : 'r');
- $ssl_policy = ((x($_POST,'ssl_policy')) ? Strings::escapeTags(trim($_POST['ssl_policy'])): 'none');
- $page = ((x($_POST,'page')) ? intval($_POST['page']) : 0);
+ $dfrn_id = (!empty($_POST['dfrn_id']) ? Strings::escapeTags(trim($_POST['dfrn_id'])) : '');
+ $dfrn_version = (!empty($_POST['dfrn_version']) ? (float) $_POST['dfrn_version'] : 2.0);
+ $challenge = (!empty($_POST['challenge']) ? Strings::escapeTags(trim($_POST['challenge'])) : '');
+ $data = defaults($_POST, 'data', '');
+ $key = defaults($_POST, 'key', '');
+ $rino_remote = (!empty($_POST['rino']) ? intval($_POST['rino']) : 0);
+ $dissolve = (!empty($_POST['dissolve']) ? intval($_POST['dissolve']) : 0);
+ $perm = (!empty($_POST['perm']) ? Strings::escapeTags(trim($_POST['perm'])) : 'r');
+ $ssl_policy = (!empty($_POST['ssl_policy']) ? Strings::escapeTags(trim($_POST['ssl_policy'])): 'none');
+ $page = (!empty($_POST['page']) ? intval($_POST['page']) : 0);
$forum = (($page == 1) ? 1 : 0);
$prv = (($page == 2) ? 1 : 0);
@@ -247,7 +247,7 @@ function dfrn_dispatch_private($user, $postdata)
function dfrn_notify_content(App $a) {
- if (x($_GET,'dfrn_id')) {
+ if (!empty($_GET['dfrn_id'])) {
/*
* initial communication from external contact, $direction is their direction.
@@ -256,7 +256,7 @@ function dfrn_notify_content(App $a) {
$dfrn_id = Strings::escapeTags(trim($_GET['dfrn_id']));
$dfrn_version = (float) $_GET['dfrn_version'];
- $rino_remote = ((x($_GET,'rino')) ? intval($_GET['rino']) : 0);
+ $rino_remote = (!empty($_GET['rino']) ? intval($_GET['rino']) : 0);
$type = "";
$last_update = "";
@@ -370,7 +370,7 @@ function dfrn_notify_content(App $a) {
. "\t" . '' . $perm . '' . "\r\n"
. "\t" . '' . $encrypted_id . '' . "\r\n"
. "\t" . '' . $challenge . '' . "\r\n"
- . '' . "\r\n" ;
+ . '' . "\r\n";
killme();
}
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index ecca0adf7c..acc279be26 100644
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -31,7 +31,7 @@ function dfrn_poll_init(App $a)
$sec = defaults($_GET, 'sec' , '');
$dfrn_version = (float) defaults($_GET, 'dfrn_version' , 2.0);
$perm = defaults($_GET, 'perm' , 'r');
- $quiet = x($_GET, 'quiet');
+ $quiet = !empty($_GET['quiet']);
// Possibly it is an OStatus compatible server that requests a user feed
$user_agent = defaults($_SERVER, 'HTTP_USER_AGENT', '');
@@ -51,7 +51,7 @@ function dfrn_poll_init(App $a)
$hidewall = false;
- if (($dfrn_id === '') && (!x($_POST, 'dfrn_id'))) {
+ if (($dfrn_id === '') && empty($_POST['dfrn_id'])) {
if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
System::httpExit(403);
}
@@ -113,7 +113,7 @@ function dfrn_poll_init(App $a)
if ((int)$xml->status === 1) {
$_SESSION['authenticated'] = 1;
- if (!x($_SESSION, 'remote')) {
+ if (empty($_SESSION['remote'])) {
$_SESSION['remote'] = [];
}
@@ -230,13 +230,13 @@ function dfrn_poll_init(App $a)
function dfrn_poll_post(App $a)
{
- $dfrn_id = x($_POST,'dfrn_id') ? $_POST['dfrn_id'] : '';
- $challenge = x($_POST,'challenge') ? $_POST['challenge'] : '';
- $url = x($_POST,'url') ? $_POST['url'] : '';
- $sec = x($_POST,'sec') ? $_POST['sec'] : '';
- $ptype = x($_POST,'type') ? $_POST['type'] : '';
- $dfrn_version = x($_POST,'dfrn_version') ? (float) $_POST['dfrn_version'] : 2.0;
- $perm = x($_POST,'perm') ? $_POST['perm'] : 'r';
+ $dfrn_id = defaults($_POST, 'dfrn_id' , '');
+ $challenge = defaults($_POST, 'challenge', '');
+ $url = defaults($_POST, 'url' , '');
+ $sec = defaults($_POST, 'sec' , '');
+ $ptype = defaults($_POST, 'type' , '');
+ $perm = defaults($_POST, 'perm' , 'r');
+ $dfrn_version = !empty($_POST['dfrn_version']) ? (float) $_POST['dfrn_version'] : 2.0;
if ($ptype === 'profile-check') {
if (strlen($challenge) && strlen($sec)) {
@@ -399,14 +399,13 @@ function dfrn_poll_post(App $a)
function dfrn_poll_content(App $a)
{
- $dfrn_id = x($_GET,'dfrn_id') ? $_GET['dfrn_id'] : '';
- $type = x($_GET,'type') ? $_GET['type'] : 'data';
- $last_update = x($_GET,'last_update') ? $_GET['last_update'] : '';
- $destination_url = x($_GET,'destination_url') ? $_GET['destination_url'] : '';
- $sec = x($_GET,'sec') ? $_GET['sec'] : '';
- $dfrn_version = x($_GET,'dfrn_version') ? (float) $_GET['dfrn_version'] : 2.0;
- $perm = x($_GET,'perm') ? $_GET['perm'] : 'r';
- $quiet = x($_GET,'quiet') ? true : false;
+ $dfrn_id = defaults($_GET, 'dfrn_id' , '');
+ $type = defaults($_GET, 'type' , 'data');
+ $last_update = defaults($_GET, 'last_update' , '');
+ $destination_url = defaults($_GET, 'destination_url', '');
+ $sec = defaults($_GET, 'sec' , '');
+ $dfrn_version = !empty($_GET['dfrn_version']) ? (float) $_GET['dfrn_version'] : 2.0;
+ $quiet = !empty($_GET['quiet']);
$direction = -1;
if (strpos($dfrn_id, ':') == 1) {
@@ -437,7 +436,7 @@ function dfrn_poll_content(App $a)
switch ($direction) {
case -1:
if ($type === 'profile') {
- $sql_extra = sprintf(" AND ( `dfrn-id` = '%s' OR `issued-id` = '%s' ) ", DBA::escape($dfrn_id), DBA::escape($dfrn_id));
+ $sql_extra = sprintf(" AND (`dfrn-id` = '%s' OR `issued-id` = '%s') ", DBA::escape($dfrn_id), DBA::escape($dfrn_id));
} else {
$sql_extra = sprintf(" AND `issued-id` = '%s' ", DBA::escape($dfrn_id));
}
@@ -524,7 +523,7 @@ function dfrn_poll_content(App $a)
if (((int) $xml->status == 0) && ($xml->challenge == $hash) && ($xml->sec == $sec)) {
$_SESSION['authenticated'] = 1;
- if (!x($_SESSION, 'remote')) {
+ if (empty($_SESSION['remote'])) {
$_SESSION['remote'] = [];
}
@@ -562,11 +561,7 @@ function dfrn_poll_content(App $a)
break;
default:
$appendix = (strstr($destination_url, '?') ? '&f=&redir=1' : '?f=&redir=1');
- if (filter_var($url, FILTER_VALIDATE_URL)) {
- System::externalRedirect($destination_url . $appendix);
- } else {
- $a->internalRedirect($destination_url . $appendix);
- }
+ $a->redirect($destination_url . $appendix);
break;
}
// NOTREACHED
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index 26d7efda52..0e24accc01 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -64,7 +64,7 @@ function dfrn_request_post(App $a)
return;
}
- if (x($_POST, 'cancel')) {
+ if (!empty($_POST['cancel'])) {
$a->internalRedirect();
}
@@ -73,18 +73,18 @@ function dfrn_request_post(App $a)
* to confirm the request, and then we've clicked submit (perhaps after logging in).
* That brings us here:
*/
- if ((x($_POST, 'localconfirm')) && ($_POST['localconfirm'] == 1)) {
+ if (!empty($_POST['localconfirm']) && ($_POST['localconfirm'] == 1)) {
// Ensure this is a valid request
- if (local_user() && ($a->user['nickname'] == $a->argv[1]) && (x($_POST, 'dfrn_url'))) {
- $dfrn_url = Strings::escapeTags(trim($_POST['dfrn_url']));
- $aes_allow = (((x($_POST, 'aes_allow')) && ($_POST['aes_allow'] == 1)) ? 1 : 0);
- $confirm_key = ((x($_POST, 'confirm_key')) ? $_POST['confirm_key'] : "");
- $hidden = ((x($_POST, 'hidden-contact')) ? intval($_POST['hidden-contact']) : 0);
+ if (local_user() && ($a->user['nickname'] == $a->argv[1]) && !empty($_POST['dfrn_url'])) {
+ $dfrn_url = Strings::escapeTags(trim($_POST['dfrn_url']));
+ $aes_allow = !empty($_POST['aes_allow']);
+ $confirm_key = defaults($_POST, 'confirm_key', "");
+ $hidden = (!empty($_POST['hidden-contact']) ? intval($_POST['hidden-contact']) : 0);
$contact_record = null;
- $blocked = 1;
- $pending = 1;
+ $blocked = 1;
+ $pending = 1;
- if (x($dfrn_url)) {
+ if (!empty($dfrn_url)) {
// Lookup the contact based on their URL (which is the only unique thing we have at the moment)
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND NOT `self` LIMIT 1",
intval(local_user()),
@@ -115,10 +115,10 @@ function dfrn_request_post(App $a)
notice(L10n::t('Profile location is not valid or does not contain profile information.') . EOL);
return;
} else {
- if (!x($parms, 'fn')) {
+ if (empty($parms['fn'])) {
notice(L10n::t('Warning: profile location has no identifiable owner name.') . EOL);
}
- if (!x($parms, 'photo')) {
+ if (empty($parms['photo'])) {
notice(L10n::t('Warning: profile location has no profile photo.') . EOL);
}
$invalid = Probe::validDfrn($parms);
@@ -238,7 +238,7 @@ function dfrn_request_post(App $a)
$blocked = 1;
$pending = 1;
- if (x($_POST, 'dfrn_url')) {
+ if (!empty($_POST['dfrn_url'])) {
// Block friend request spam
if ($maxreq) {
$r = q("SELECT * FROM `intro` WHERE `datetime` > '%s' AND `uid` = %d",
@@ -270,7 +270,7 @@ function dfrn_request_post(App $a)
}
}
- $real_name = x($_POST, 'realname') ? Strings::escapeTags(trim($_POST['realname'])) : '';
+ $real_name = !empty($_POST['realname']) ? Strings::escapeTags(trim($_POST['realname'])) : '';
$url = trim($_POST['dfrn_url']);
if (!strlen($url)) {
@@ -356,10 +356,10 @@ function dfrn_request_post(App $a)
notice(L10n::t('Profile location is not valid or does not contain profile information.') . EOL);
$a->internalRedirect($a->cmd);
} else {
- if (!x($parms, 'fn')) {
+ if (empty($parms['fn'])) {
notice(L10n::t('Warning: profile location has no identifiable owner name.') . EOL);
}
- if (!x($parms, 'photo')) {
+ if (empty($parms['photo'])) {
notice(L10n::t('Warning: profile location has no profile photo.') . EOL);
}
$invalid = Probe::validDfrn($parms);
@@ -423,7 +423,7 @@ function dfrn_request_post(App $a)
VALUES ( %d, %d, 1, %d, '%s', '%s', '%s' )",
intval($uid),
intval($contact_record['id']),
- ((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
+ intval(!empty($_POST['knowyou'])),
DBA::escape(Strings::escapeTags(trim(defaults($_POST, 'dfrn-request-message', '')))),
DBA::escape($hash),
DBA::escape(DateTimeFormat::utcNow())
@@ -484,7 +484,7 @@ function dfrn_request_content(App $a)
// "Homecoming". Make sure we're logged in to this site as the correct user. Then offer a confirm button
// to send us to the post section to record the introduction.
- if (x($_GET, 'dfrn_url')) {
+ if (!empty($_GET['dfrn_url'])) {
if (!local_user()) {
info(L10n::t("Please login to confirm introduction.") . EOL);
/* setup the return URL to come back to this page if they use openid */
@@ -499,11 +499,11 @@ function dfrn_request_content(App $a)
}
$dfrn_url = Strings::escapeTags(trim(hex2bin($_GET['dfrn_url'])));
- $aes_allow = x($_GET, 'aes_allow') && $_GET['aes_allow'] == 1 ? 1 : 0;
- $confirm_key = x($_GET, 'confirm_key') ? $_GET['confirm_key'] : "";
+ $aes_allow = !empty($_GET['aes_allow']);
+ $confirm_key = defaults($_GET, 'confirm_key', "");
// Checking fastlane for validity
- if (x($_SESSION, "fastlane") && (Strings::normaliseLink($_SESSION["fastlane"]) == Strings::normaliseLink($dfrn_url))) {
+ if (!empty($_SESSION['fastlane']) && (Strings::normaliseLink($_SESSION["fastlane"]) == Strings::normaliseLink($dfrn_url))) {
$_POST["dfrn_url"] = $dfrn_url;
$_POST["confirm_key"] = $confirm_key;
$_POST["localconfirm"] = 1;
@@ -512,8 +512,7 @@ function dfrn_request_content(App $a)
dfrn_request_post($a);
- killme();
- return; // NOTREACHED
+ exit();
}
$tpl = Renderer::getMarkupTemplate("dfrn_req_confirm.tpl");
@@ -521,7 +520,6 @@ function dfrn_request_content(App $a)
'$dfrn_url' => $dfrn_url,
'$aes_allow' => (($aes_allow) ? '' : "" ),
'$hidethem' => L10n::t('Hide this contact'),
- '$hidechecked' => '',
'$confirm_key' => $confirm_key,
'$welcome' => L10n::t('Welcome home %s.', $a->user['username']),
'$please' => L10n::t('Please confirm your introduction/connection request to %s.', $dfrn_url),
@@ -531,7 +529,7 @@ function dfrn_request_content(App $a)
'dfrn_rawurl' => $_GET['dfrn_url']
]);
return $o;
- } elseif ((x($_GET, 'confirm_key')) && strlen($_GET['confirm_key'])) {
+ } elseif (!empty($_GET['confirm_key'])) {
// we are the requestee and it is now safe to send our user their introduction,
// We could just unblock it, but first we have to jump through a few hoops to
// send an email, or even to find out if we need to send an email.
@@ -607,9 +605,9 @@ function dfrn_request_content(App $a)
// Try to auto-fill the profile address
// At first look if an address was provided
// Otherwise take the local address
- if (x($_GET, 'addr') && ($_GET['addr'] != "")) {
+ if (!empty($_GET['addr'])) {
$myaddr = hex2bin($_GET['addr']);
- } elseif (x($_GET, 'address') && ($_GET['address'] != "")) {
+ } elseif (!empty($_GET['address'])) {
$myaddr = $_GET['address'];
} elseif (local_user()) {
if (strlen($a->getURLPath())) {
diff --git a/mod/directory.php b/mod/directory.php
index e59cf7b820..3fd0aa848b 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -30,7 +30,7 @@ function directory_init(App $a)
function directory_post(App $a)
{
- if (x($_POST, 'search')) {
+ if (!empty($_POST['search'])) {
$a->data['search'] = $_POST['search'];
}
}
@@ -47,10 +47,10 @@ function directory_content(App $a)
$o = '';
Nav::setSelected('directory');
- if (x($a->data, 'search')) {
+ if (!empty($a->data['search'])) {
$search = Strings::escapeTags(trim($a->data['search']));
} else {
- $search = ((x($_GET, 'search')) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : '');
+ $search = (!empty($_GET['search']) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : '');
}
$gdirpath = '';
@@ -138,28 +138,28 @@ function directory_content(App $a)
}
// if(strlen($rr['dob'])) {
// if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
-// $details .= ' ' . L10n::t('Age: ') . $years ;
+// $details .= ' ' . L10n::t('Age: ') . $years;
// }
// if(strlen($rr['gender']))
// $details .= ' ' . L10n::t('Gender: ') . $rr['gender'];
$profile = $rr;
- if ((x($profile, 'address') == 1)
- || (x($profile, 'locality') == 1)
- || (x($profile, 'region') == 1)
- || (x($profile, 'postal-code') == 1)
- || (x($profile, 'country-name') == 1)
+ if (!empty($profile['address'])
+ || !empty($profile['locality'])
+ || !empty($profile['region'])
+ || !empty($profile['postal-code'])
+ || !empty($profile['country-name'])
) {
$location = L10n::t('Location:');
} else {
$location = '';
}
- $gender = ((x($profile, 'gender') == 1) ? L10n::t('Gender:') : false);
- $marital = ((x($profile, 'marital') == 1) ? L10n::t('Status:') : false);
- $homepage = ((x($profile, 'homepage') == 1) ? L10n::t('Homepage:') : false);
- $about = ((x($profile, 'about') == 1) ? L10n::t('About:') : false);
+ $gender = (!empty($profile['gender']) ? L10n::t('Gender:') : false);
+ $marital = (!empty($profile['marital']) ? L10n::t('Status:') : false);
+ $homepage = (!empty($profile['homepage']) ? L10n::t('Homepage:') : false);
+ $about = (!empty($profile['about']) ? L10n::t('About:') : false);
$location_e = $location;
diff --git a/mod/dirfind.php b/mod/dirfind.php
index 7f1a6691f5..909a723165 100644
--- a/mod/dirfind.php
+++ b/mod/dirfind.php
@@ -30,7 +30,7 @@ function dirfind_init(App $a) {
return;
}
- if (! x($a->page,'aside')) {
+ if (empty($a->page['aside'])) {
$a->page['aside'] = '';
}
diff --git a/mod/display.php b/mod/display.php
index 39661cb76f..2a4d2abf43 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -22,9 +22,14 @@ use Friendica\Model\Profile;
use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\DFRN;
use Friendica\Util\Strings;
+use Friendica\Module\Objects;
function display_init(App $a)
{
+ if (ActivityPub::isRequest()) {
+ Objects::rawContent();
+ }
+
if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
return;
}
@@ -47,6 +52,7 @@ function display_init(App $a)
}
$item = null;
+ $item_user = local_user();
$fields = ['id', 'parent', 'author-id', 'body', 'uid', 'guid'];
@@ -60,6 +66,16 @@ function display_init(App $a)
if (DBA::isResult($item)) {
$nick = $a->user["nickname"];
}
+ // Is this item private but could be visible to the remove visitor?
+ } elseif (remote_user()) {
+ $item = Item::selectFirst($fields, ['guid' => $a->argv[1], 'private' => 1]);
+ if (DBA::isResult($item)) {
+ if (!Contact::isFollower(remote_user(), $item['uid'])) {
+ $item = null;
+ } else {
+ $item_user = $item['uid'];
+ }
+ }
}
// Is it an item with uid=0?
@@ -71,9 +87,7 @@ function display_init(App $a)
}
if (!DBA::isResult($item)) {
- $a->error = 404;
- notice(L10n::t('Item not found.') . EOL);
- return;
+ System::httpExit(404);
}
if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
@@ -81,10 +95,6 @@ function display_init(App $a)
displayShowFeed($item["id"], false);
}
- if (ActivityPub::isRequest()) {
- $a->internalRedirect(str_replace('display/', 'objects/', $a->query_string));
- }
-
if ($item["id"] != $item["parent"]) {
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $item["parent"]]);
}
@@ -224,7 +234,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
if ($a->argc == 2) {
$item_parent = 0;
- $fields = ['id', 'parent', 'parent-uri'];
+ $fields = ['id', 'parent', 'parent-uri', 'uid'];
if (local_user()) {
$condition = ['guid' => $a->argv[1], 'uid' => local_user()];
@@ -234,6 +244,13 @@ function display_content(App $a, $update = false, $update_uid = 0)
$item_parent = $item["parent"];
$item_parent_uri = $item['parent-uri'];
}
+ } elseif (remote_user()) {
+ $item = Item::selectFirst($fields, ['guid' => $a->argv[1], 'private' => 1]);
+ if (DBA::isResult($item) && Contact::isFollower(remote_user(), $item['uid'])) {
+ $item_id = $item["id"];
+ $item_parent = $item["parent"];
+ $item_parent_uri = $item['parent-uri'];
+ }
}
if ($item_parent == 0) {
@@ -249,9 +266,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
}
if (!$item_id) {
- $a->error = 404;
- notice(L10n::t('Item not found.').EOL);
- return;
+ System::httpExit(404);
}
// We are displaying an "alternate" link if that post was public. See issue 2864
@@ -270,34 +285,23 @@ function display_content(App $a, $update = false, $update_uid = 0)
'$conversation' => $conversation]);
$groups = [];
-
- $contact = null;
+ $remote_cid = null;
$is_remote_contact = false;
+ $item_uid = local_user();
- $contact_id = 0;
-
- if (x($_SESSION, 'remote') && is_array($_SESSION['remote'])) {
- foreach ($_SESSION['remote'] as $v) {
- if ($v['uid'] == $a->profile['uid']) {
- $contact_id = $v['cid'];
- break;
- }
- }
+ $parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]);
+ if (DBA::isResult($parent)) {
+ $a->profile['uid'] = $parent['uid'];
+ $a->profile['profile_uid'] = $parent['uid'];
+ $is_remote_contact = Contact::isFollower(remote_user(), $a->profile['profile_uid']);
}
- if ($contact_id) {
- $groups = Group::getIdsByContactId($contact_id);
- $remote_contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $a->profile['uid']]);
- if (DBA::isResult($remote_contact)) {
- $contact = $remote_contact;
- $is_remote_contact = true;
- }
- }
-
- if (!$is_remote_contact) {
- if (local_user()) {
- $contact_id = $_SESSION['cid'];
- $contact = $a->contact;
+ if ($is_remote_contact) {
+ $cdata = Contact::getPublicAndUserContacID(remote_user(), $a->profile['profile_uid']);
+ if (!empty($cdata['user'])) {
+ $groups = Group::getIdsByContactId($cdata['user']);
+ $remote_cid = $cdata['user'];
+ $item_uid = $parent['uid'];
}
}
@@ -307,7 +311,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
}
$is_owner = (local_user() && (in_array($a->profile['profile_uid'], [local_user(), 0])) ? true : false);
- if (x($a->profile, 'hidewall') && !$is_owner && !$is_remote_contact) {
+ if (!empty($a->profile['hidewall']) && !$is_owner && !$is_remote_contact) {
notice(L10n::t('Access to this profile has been restricted.') . EOL);
return;
}
@@ -327,10 +331,9 @@ function display_content(App $a, $update = false, $update_uid = 0)
];
$o .= status_editor($a, $x, 0, true);
}
+ $sql_extra = Item::getPermissionsSQLByUserId($a->profile['profile_uid'], $is_remote_contact, $groups, $remote_cid);
- $sql_extra = Item::getPermissionsSQLByUserId($a->profile['uid'], $is_remote_contact, $groups);
-
- if (local_user() && (local_user() == $a->profile['uid'])) {
+ if (local_user() && (local_user() == $a->profile['profile_uid'])) {
$condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
$unseen = Item::exists($condition);
} else {
@@ -341,13 +344,12 @@ function display_content(App $a, $update = false, $update_uid = 0)
return '';
}
- $condition = ["`id` = ? AND `item`.`uid` IN (0, ?) " . $sql_extra, $item_id, local_user()];
+ $condition = ["`id` = ? AND `item`.`uid` IN (0, ?) " . $sql_extra, $item_id, $item_uid];
$fields = ['parent-uri', 'body', 'title', 'author-name', 'author-avatar', 'plink'];
$item = Item::selectFirstForUser(local_user(), $fields, $condition);
if (!DBA::isResult($item)) {
- notice(L10n::t('Item not found.') . EOL);
- return $o;
+ System::httpExit(404);
}
$item['uri'] = $item['parent-uri'];
@@ -361,7 +363,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$o .= "";
}
- $o .= conversation($a, [$item], new Pager($a->query_string), 'display', $update_uid, false, 'commented', local_user());
+ $o .= conversation($a, [$item], new Pager($a->query_string), 'display', $update_uid, false, 'commented', $item_uid);
// Preparing the meta header
$description = trim(HTML::toPlaintext(BBCode::convert($item["body"], false), 0, true));
diff --git a/mod/editpost.php b/mod/editpost.php
index b518588a59..1e53285830 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Core\Addon;
use Friendica\Core\Config;
+use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
@@ -54,8 +55,6 @@ function editpost_content(App $a)
'$nickname' => $a->user['nickname']
]);
- $tpl = Renderer::getMarkupTemplate("jot.tpl");
-
if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
$lockstate = 'lock';
} else {
@@ -84,9 +83,9 @@ function editpost_content(App $a)
}
}
- Addon::callHooks('jot_tool', $jotplugins);
- //Addon::callHooks('jot_networks', $jotnets);
+ Hook::callAll('jot_tool', $jotplugins);
+ $tpl = Renderer::getMarkupTemplate("jot.tpl");
$o .= Renderer::replaceMacros($tpl, [
'$is_edit' => true,
'$return_path' => '/display/' . $item['guid'],
@@ -119,7 +118,7 @@ function editpost_content(App $a)
'$emailcc' => L10n::t('CC: email addresses'),
'$public' => L10n::t('Public post'),
'$jotnets' => $jotnets,
- '$title' => htmlspecialchars($item['title']),
+ '$title' => $item['title'],
'$placeholdertitle' => L10n::t('Set title'),
'$category' => FileTag::fileToList($item['file'], 'category'),
'$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''),
diff --git a/mod/events.php b/mod/events.php
index f147e00545..cb91fae351 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -97,13 +97,23 @@ function events_post(App $a)
// and we'll waste a bunch of time responding to it. Time that
// could've been spent doing something else.
- $summary = Strings::escapeHtml(trim(defaults($_POST, 'summary', '')));
- $desc = Strings::escapeHtml(trim(defaults($_POST, 'desc', '')));
- $location = Strings::escapeHtml(trim(defaults($_POST, 'location', '')));
+ $summary = trim(defaults($_POST, 'summary' , ''));
+ $desc = trim(defaults($_POST, 'desc' , ''));
+ $location = trim(defaults($_POST, 'location', ''));
$type = 'event';
- $action = ($event_id == '') ? 'new' : "event/" . $event_id;
- $onerror_path = "events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish";
+ $params = [
+ 'summary' => $summary,
+ 'description' => $desc,
+ 'location' => $location,
+ 'start' => $start_text,
+ 'finish' => $finish_text,
+ 'adjust' => $adjust,
+ 'nofinish' => $nofinish,
+ ];
+
+ $action = ($event_id == '') ? 'new' : 'event/' . $event_id;
+ $onerror_path = 'events/' . $action . '?' . http_build_query($params, null, null, PHP_QUERY_RFC3986);
if (strcmp($finish, $start) < 0 && !$nofinish) {
notice(L10n::t('Event can not end before it has started.') . EOL);
@@ -137,10 +147,10 @@ function events_post(App $a)
if ($share) {
- $str_group_allow = !empty($_POST['group_allow']) ? perms2str($_POST['group_allow']) : '';
- $str_contact_allow = !empty($_POST['contact_allow']) ? perms2str($_POST['contact_allow']) : '';
- $str_group_deny = !empty($_POST['group_deny']) ? perms2str($_POST['group_deny']) : '';
- $str_contact_deny = !empty($_POST['contact_deny']) ? perms2str($_POST['contact_deny']) : '';
+ $str_group_allow = perms2str(defaults($_POST, 'group_allow' , ''));
+ $str_contact_allow = perms2str(defaults($_POST, 'contact_allow', ''));
+ $str_group_deny = perms2str(defaults($_POST, 'group_deny' , ''));
+ $str_contact_deny = perms2str(defaults($_POST, 'contact_deny' , ''));
// Undo the pseudo-contact of self, since there are real contacts now
if (strpos($str_contact_allow, '<' . $self . '>') !== false) {
@@ -181,7 +191,7 @@ function events_post(App $a)
if (intval($_REQUEST['preview'])) {
$html = Event::getHTML($datarray);
echo $html;
- killme();
+ exit();
}
$item_id = Event::store($datarray);
@@ -364,8 +374,9 @@ function events_content(App $a)
}
if ($a->argc > 1 && $a->argv[1] === 'json') {
+ header('Content-Type: application/json');
echo json_encode($events);
- killme();
+ exit();
}
if (!empty($_GET['id'])) {
diff --git a/mod/fbrowser.php b/mod/fbrowser.php
index cc51d41995..64af908aa6 100644
--- a/mod/fbrowser.php
+++ b/mod/fbrowser.php
@@ -27,7 +27,7 @@ function fbrowser_content(App $a)
$template_file = "filebrowser.tpl";
$mode = "";
- if (x($_GET, 'mode')) {
+ if (!empty($_GET['mode'])) {
$mode = "?mode=".$_GET['mode'];
}
@@ -142,7 +142,7 @@ function fbrowser_content(App $a)
break;
}
- if (x($_GET, 'mode')) {
+ if (!empty($_GET['mode'])) {
return $o;
} else {
echo $o;
diff --git a/mod/fetch.php b/mod/fetch.php
index 9336c14047..5dcedb1aaf 100644
--- a/mod/fetch.php
+++ b/mod/fetch.php
@@ -18,8 +18,7 @@ function fetch_init(App $a)
{
if (($a->argc != 3) || (!in_array($a->argv[1], ["post", "status_message", "reshare"]))) {
- header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
- killme();
+ System::httpExit(404);
}
$guid = $a->argv[2];
@@ -45,15 +44,13 @@ function fetch_init(App $a)
}
}
- header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
- killme();
+ System::httpExit(404);
}
// Fetch some data from the author (We could combine both queries - but I think this is more readable)
$user = User::getOwnerDataById($item["uid"]);
if (!$user) {
- header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
- killme();
+ System::httpExit(404);
}
$status = Diaspora::buildStatus($item, $user);
diff --git a/mod/follow.php b/mod/follow.php
index 1ee61ce9e1..f8e2539d97 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -144,11 +144,8 @@ function follow_content(App $a)
$r[0]['about'] = '';
}
- $header = L10n::t('Connect/Follow');
-
$o = Renderer::replaceMacros($tpl, [
- '$header' => htmlentities($header),
- //'$photo' => ProxyUtils::proxifyUrl($ret['photo'], false, ProxyUtils::SIZE_SMALL),
+ '$header' => L10n::t('Connect/Follow'),
'$desc' => '',
'$pls_answer' => L10n::t('Please answer the following:'),
'$does_know_you' => ['knowyou', L10n::t('Does %s know you?', $ret['name']), false, '', [L10n::t('No'), L10n::t('Yes')]],
@@ -170,13 +167,6 @@ function follow_content(App $a)
'$url_label' => L10n::t('Profile URL'),
'$myaddr' => $myaddr,
'$request' => $request,
- /*
- * @TODO commented out?
- '$location' => Friendica\Content\Text\BBCode::::convert($r[0]['location']),
- '$location_label'=> L10n::t('Location:'),
- '$about' => Friendica\Content\Text\BBCode::::convert($r[0]['about'], false, false),
- '$about_label' => L10n::t('About:'),
- */
'$keywords' => $r[0]['keywords'],
'$keywords_label'=> L10n::t('Tags:')
]);
diff --git a/mod/friendica.php b/mod/friendica.php
index 77adccbfb6..81275df6fb 100644
--- a/mod/friendica.php
+++ b/mod/friendica.php
@@ -22,7 +22,7 @@ function friendica_init(App $a)
}
$sql_extra = '';
- if (x($a->config, 'admin_nickname')) {
+ if (!empty($a->config['admin_nickname'])) {
$sql_extra = sprintf(" AND `nickname` = '%s' ", DBA::escape(Config::get('config', 'admin_nickname')));
}
if (!empty(Config::get('config', 'admin_email'))) {
@@ -41,7 +41,7 @@ function friendica_init(App $a)
Config::load('feature_lock');
$locked_features = [];
- if (!empty($a->config['feature_lock']) && count($a->config['feature_lock'])) {
+ if (!empty($a->config['feature_lock'])) {
foreach ($a->config['feature_lock'] as $k => $v) {
if ($k === 'config_loaded') {
continue;
diff --git a/mod/hcard.php b/mod/hcard.php
index 7e5c2cc08a..c8b6db455c 100644
--- a/mod/hcard.php
+++ b/mod/hcard.php
@@ -29,27 +29,27 @@ function hcard_init(App $a)
Profile::load($a, $which, $profile);
- if ((x($a->profile, 'page-flags')) && ($a->profile['page-flags'] == Contact::PAGE_COMMUNITY)) {
+ if (!empty($a->profile['page-flags']) && ($a->profile['page-flags'] == Contact::PAGE_COMMUNITY)) {
$a->page['htmlhead'] .= '';
}
- if (x($a->profile, 'openidserver')) {
+ if (!empty($a->profile['openidserver'])) {
$a->page['htmlhead'] .= '' . "\r\n";
}
- if (x($a->profile, 'openid')) {
+ if (!empty($a->profile['openid'])) {
$delegate = ((strstr($a->profile['openid'], '://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']);
$a->page['htmlhead'] .= '' . "\r\n";
}
if (!$blocked) {
- $keywords = ((x($a->profile, 'pub_keywords')) ? $a->profile['pub_keywords'] : '');
+ $keywords = defaults($a->profile, 'pub_keywords', '');
$keywords = str_replace([',',' ',',,'], [' ',',',','], $keywords);
if (strlen($keywords)) {
- $a->page['htmlhead'] .= '' . "\r\n" ;
+ $a->page['htmlhead'] .= '' . "\r\n";
}
}
- $a->page['htmlhead'] .= '' . "\r\n" ;
- $a->page['htmlhead'] .= '' . "\r\n" ;
+ $a->page['htmlhead'] .= '' . "\r\n";
+ $a->page['htmlhead'] .= '' . "\r\n";
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . (($a->getURLPath()) ? '/' . $a->getURLPath() : ''));
$a->page['htmlhead'] .= '' . "\r\n";
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
diff --git a/mod/home.php b/mod/home.php
index b375707404..02ec51dc0b 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -29,10 +29,10 @@ function home_init(App $a) {
if(! function_exists('home_content')) {
function home_content(App $a) {
- if (x($_SESSION,'theme')) {
+ if (!empty($_SESSION['theme'])) {
unset($_SESSION['theme']);
}
- if (x($_SESSION,'mobile-theme')) {
+ if (!empty($_SESSION['mobile-theme'])) {
unset($_SESSION['mobile-theme']);
}
diff --git a/mod/hovercard.php b/mod/hovercard.php
index 6160642762..101ebd5af2 100644
--- a/mod/hovercard.php
+++ b/mod/hovercard.php
@@ -96,20 +96,20 @@ function hovercard_content()
// Move the contact data to the profile array so we can deliver it to
$profile = [
- 'name' => $contact['name'],
- 'nick' => $contact['nick'],
- 'addr' => defaults($contact, 'addr', $contact['url']),
- 'thumb' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB),
- 'url' => Contact::magicLink($contact['url']),
- 'nurl' => $contact['nurl'], // We additionally store the nurl as identifier
- 'location' => $contact['location'],
- 'gender' => $contact['gender'],
- 'about' => $contact['about'],
- 'network' => Strings::formatNetworkName($contact['network'], $contact['url']),
- 'tags' => $contact['keywords'],
- 'bd' => $contact['birthday'] <= DBA::NULL_DATE ? '' : $contact['birthday'],
+ 'name' => $contact['name'],
+ 'nick' => $contact['nick'],
+ 'addr' => defaults($contact, 'addr', $contact['url']),
+ 'thumb' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB),
+ 'url' => Contact::magicLink($contact['url']),
+ 'nurl' => $contact['nurl'], // We additionally store the nurl as identifier
+ 'location' => $contact['location'],
+ 'gender' => $contact['gender'],
+ 'about' => $contact['about'],
+ 'network_link' => Strings::formatNetworkName($contact['network'], $contact['url']),
+ 'tags' => $contact['keywords'],
+ 'bd' => $contact['birthday'] <= DBA::NULL_DATE ? '' : $contact['birthday'],
'account_type' => Contact::getAccountType($contact),
- 'actions' => $actions,
+ 'actions' => $actions,
];
if ($datatype == 'html') {
$tpl = Renderer::getMarkupTemplate('hovercard.tpl');
diff --git a/mod/item.php b/mod/item.php
index 5f9173fab8..cc801df57c 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -166,7 +166,7 @@ function item_post(App $a) {
// Now check that valid personal details have been provided
if (!Security::canWriteToUserWall($profile_uid) && !$allow_comment) {
- notice(L10n::t('Permission denied.') . EOL) ;
+ notice(L10n::t('Permission denied.') . EOL);
if (!empty($_REQUEST['return'])) {
$a->internalRedirect($return_path);
@@ -690,7 +690,7 @@ function item_post(App $a) {
}
$json = ['cancel' => 1];
- if (!empty($_REQUEST['jsreload']) && strlen($_REQUEST['jsreload'])) {
+ if (!empty($_REQUEST['jsreload'])) {
$json['reload'] = System::baseUrl() . '/' . $_REQUEST['jsreload'];
}
@@ -869,7 +869,7 @@ function item_post_return($baseurl, $api_source, $return_path)
}
$json = ['success' => 1];
- if (!empty($_REQUEST['jsreload']) && strlen($_REQUEST['jsreload'])) {
+ if (!empty($_REQUEST['jsreload'])) {
$json['reload'] = $baseurl . '/' . $_REQUEST['jsreload'];
}
diff --git a/mod/like.php b/mod/like.php
index 97eaca163b..5ea30a3ffe 100644
--- a/mod/like.php
+++ b/mod/like.php
@@ -27,7 +27,7 @@ function like_content(App $a) {
}
// See if we've been passed a return path to redirect to
- $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
+ $return_path = defaults($_REQUEST, 'return', '');
like_content_return($a, $return_path);
killme(); // NOTREACHED
diff --git a/mod/localtime.php b/mod/localtime.php
index 9a754ac80d..f68c3fba50 100644
--- a/mod/localtime.php
+++ b/mod/localtime.php
@@ -42,7 +42,7 @@ function localtime_content(App $a)
$o .= '
';
$o .= L10n::t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.');
@@ -54,6 +55,7 @@ function newmember_content(App $a)
$o .= '