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" . ''; } - $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 = 'logoFriendica'; } - $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 .= '

' . L10n::t('Current timezone: %s', $_REQUEST['timezone']) . '

'; } - if (x($a->data, 'mod-localtime')) { + if (!empty($a->data['mod-localtime'])) { $o .= '

' . L10n::t('Converted localtime: %s', $a->data['mod-localtime']) . '

'; } diff --git a/mod/manage.php b/mod/manage.php index f92a945490..b42b990aad 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -21,7 +21,7 @@ function manage_post(App $a) { $uid = local_user(); $orig_record = $a->user; - if((x($_SESSION,'submanage')) && intval($_SESSION['submanage'])) { + if(!empty($_SESSION['submanage'])) { $r = q("select * from user where uid = %d limit 1", intval($_SESSION['submanage']) ); @@ -37,7 +37,7 @@ function manage_post(App $a) { $submanage = $r; - $identity = (x($_POST['identity']) ? intval($_POST['identity']) : 0); + $identity = (!empty($_POST['identity']) ? intval($_POST['identity']) : 0); if (!$identity) { return; } @@ -101,13 +101,13 @@ function manage_post(App $a) { unset($_SESSION['mobile-theme']); unset($_SESSION['page_flags']); unset($_SESSION['return_path']); - if (x($_SESSION, 'submanage')) { + if (!empty($_SESSION['submanage'])) { unset($_SESSION['submanage']); } - if (x($_SESSION, 'sysmsg')) { + if (!empty($_SESSION['sysmsg'])) { unset($_SESSION['sysmsg']); } - if (x($_SESSION, 'sysmsg_info')) { + if (!empty($_SESSION['sysmsg_info'])) { unset($_SESSION['sysmsg_info']); } diff --git a/mod/message.php b/mod/message.php index 7491cd1bcc..d0993698b7 100644 --- a/mod/message.php +++ b/mod/message.php @@ -59,10 +59,10 @@ function message_post(App $a) return; } - $replyto = x($_REQUEST, 'replyto') ? Strings::escapeTags(trim($_REQUEST['replyto'])) : ''; - $subject = x($_REQUEST, 'subject') ? Strings::escapeTags(trim($_REQUEST['subject'])) : ''; - $body = x($_REQUEST, 'body') ? Strings::escapeHtml(trim($_REQUEST['body'])) : ''; - $recipient = x($_REQUEST, 'messageto') ? intval($_REQUEST['messageto']) : 0; + $replyto = !empty($_REQUEST['replyto']) ? Strings::escapeTags(trim($_REQUEST['replyto'])) : ''; + $subject = !empty($_REQUEST['subject']) ? Strings::escapeTags(trim($_REQUEST['subject'])) : ''; + $body = !empty($_REQUEST['body']) ? Strings::escapeHtml(trim($_REQUEST['body'])) : ''; + $recipient = !empty($_REQUEST['messageto']) ? intval($_REQUEST['messageto']) : 0; $ret = Mail::send($recipient, $body, $subject, $replyto); $norecip = false; @@ -247,22 +247,22 @@ function message_content(App $a) $tpl = Renderer::getMarkupTemplate('prv_message.tpl'); $o .= Renderer::replaceMacros($tpl, [ - '$header' => L10n::t('Send Private Message'), - '$to' => L10n::t('To:'), + '$header' => L10n::t('Send Private Message'), + '$to' => L10n::t('To:'), '$showinputs' => 'true', - '$prefill' => $prefill, - '$preid' => $preid, - '$subject' => L10n::t('Subject:'), - '$subjtxt' => x($_REQUEST, 'subject') ? strip_tags($_REQUEST['subject']) : '', - '$text' => x($_REQUEST, 'body') ? Strings::escapeHtml(htmlspecialchars($_REQUEST['body'])) : '', - '$readonly' => '', - '$yourmessage' => L10n::t('Your message:'), - '$select' => $select, - '$parent' => '', - '$upload' => L10n::t('Upload photo'), - '$insert' => L10n::t('Insert web link'), - '$wait' => L10n::t('Please wait'), - '$submit' => L10n::t('Submit') + '$prefill' => $prefill, + '$preid' => $preid, + '$subject' => L10n::t('Subject:'), + '$subjtxt' => defaults($_REQUEST, 'subject', ''), + '$text' => defaults($_REQUEST, 'body', ''), + '$readonly' => '', + '$yourmessage'=> L10n::t('Your message:'), + '$select' => $select, + '$parent' => '', + '$upload' => L10n::t('Upload photo'), + '$insert' => L10n::t('Insert web link'), + '$wait' => L10n::t('Please wait'), + '$submit' => L10n::t('Submit') ]); return $o; } @@ -431,24 +431,56 @@ function message_content(App $a) } } -function get_messages($user, $lstart, $lend) +/** + * @param int $uid + * @param int $start + * @param int $limit + * @return array + */ +function get_messages($uid, $start, $limit) { - //TODO: rewritte with a sub-query to get the first message of each private thread with certainty - return q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`, - ANY_VALUE(`mail`.`id`) AS `id`, ANY_VALUE(`mail`.`uid`) AS `uid`, ANY_VALUE(`mail`.`guid`) AS `guid`, - ANY_VALUE(`mail`.`from-name`) AS `from-name`, ANY_VALUE(`mail`.`from-photo`) AS `from-photo`, - ANY_VALUE(`mail`.`from-url`) AS `from-url`, ANY_VALUE(`mail`.`contact-id`) AS `contact-id`, - ANY_VALUE(`mail`.`convid`) AS `convid`, ANY_VALUE(`mail`.`title`) AS `title`, ANY_VALUE(`mail`.`body`) AS `body`, - ANY_VALUE(`mail`.`seen`) AS `seen`, ANY_VALUE(`mail`.`reply`) AS `reply`, ANY_VALUE(`mail`.`replied`) AS `replied`, - ANY_VALUE(`mail`.`unknown`) AS `unknown`, ANY_VALUE(`mail`.`uri`) AS `uri`, - `mail`.`parent-uri`, - ANY_VALUE(`mail`.`created`) AS `created`, ANY_VALUE(`contact`.`name`) AS `name`, ANY_VALUE(`contact`.`url`) AS `url`, - ANY_VALUE(`contact`.`thumb`) AS `thumb`, ANY_VALUE(`contact`.`network`) AS `network`, - count( * ) as `count` - FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` - WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", - intval($user), intval($lstart), intval($lend) - ); + return DBA::toArray(DBA::p('SELECT + m.`id`, + m.`uid`, + m.`guid`, + m.`from-name`, + m.`from-photo`, + m.`from-url`, + m.`contact-id`, + m.`convid`, + m.`title`, + m.`body`, + m.`seen`, + m.`reply`, + m.`replied`, + m.`unknown`, + m.`uri`, + m.`parent-uri`, + m.`created`, + c.`name`, + c.`url`, + c.`thumb`, + c.`network`, + m2.`count`, + m2.`mailcreated`, + m2.`mailseen` + FROM `mail` m + JOIN ( + SELECT + `parent-uri`, + MIN(`id`) AS `id`, + COUNT(*) AS `count`, + MAX(`created`) AS `mailcreated`, + MIN(`seen`) AS `mailseen` + FROM `mail` + WHERE `uid` = ? + GROUP BY `parent-uri` + ) m2 ON m.`parent-uri` = m2.`parent-uri` AND m.`id` = m2.`id` + LEFT JOIN `contact` c ON m.`contact-id` = c.`id` + WHERE m.`uid` = ? + ORDER BY m2.`mailcreated` DESC + LIMIT ?, ?' + , $uid, $uid, $start, $limit)); } function render_messages(array $msg, $t) diff --git a/mod/modexp.php b/mod/modexp.php index 966c111d56..5819268e9d 100644 --- a/mod/modexp.php +++ b/mod/modexp.php @@ -28,7 +28,7 @@ function modexp_init(App $a) { $e = $r[0]->asnData[1]->asnData[0]->asnData[1]->asnData; header("Content-type: application/magic-public-key"); - echo 'RSA' . '.' . $m . '.' . $e ; + echo 'RSA' . '.' . $m . '.' . $e; killme(); diff --git a/mod/network.php b/mod/network.php index 594a557997..6a4413b54e 100644 --- a/mod/network.php +++ b/mod/network.php @@ -42,19 +42,19 @@ function network_init(App $a) Hook::add('head', __FILE__, 'network_infinite_scroll_head'); - $search = (x($_GET, 'search') ? Strings::escapeHtml($_GET['search']) : ''); + $search = (!empty($_GET['search']) ? Strings::escapeHtml($_GET['search']) : ''); if (($search != '') && !empty($_GET['submit'])) { $a->internalRedirect('search?search=' . urlencode($search)); } - if (x($_GET, 'save')) { + if (!empty($_GET['save'])) { $exists = DBA::exists('search', ['uid' => local_user(), 'term' => $search]); if (!$exists) { DBA::insert('search', ['uid' => local_user(), 'term' => $search]); } } - if (x($_GET, 'remove')) { + if (!empty($_GET['remove'])) { DBA::delete('search', ['uid' => local_user(), 'term' => $search]); } @@ -63,9 +63,9 @@ function network_init(App $a) $group_id = (($a->argc > 1 && is_numeric($a->argv[1])) ? intval($a->argv[1]) : 0); $cid = 0; - if (x($_GET, 'cid') && intval($_GET['cid']) != 0) { + if (!empty($_GET['cid'])) { $cid = $_GET['cid']; - $_GET['nets'] = 'all'; + $_GET['nets'] = ''; $group_id = 0; } @@ -86,7 +86,7 @@ function network_init(App $a) // fetch last used network view and redirect if needed if (!$is_a_date_query) { - $sel_nets = defaults($_GET, 'nets', false); + $sel_nets = defaults($_GET, 'nets', ''); $sel_tabs = network_query_get_sel_tab($a); $sel_groups = network_query_get_sel_group($a); $last_sel_tabs = PConfig::get(local_user(), 'network.view', 'tab.selected'); @@ -137,7 +137,7 @@ function network_init(App $a) } } - if ($sel_nets !== false) { + if ($sel_nets) { $net_args['nets'] = $sel_nets; } @@ -151,34 +151,29 @@ function network_init(App $a) } } - // If nets is set to all, unset it - if (x($_GET, 'nets') && $_GET['nets'] === 'all') { - unset($_GET['nets']); - } - - if (!x($a->page, 'aside')) { + if (empty($a->page['aside'])) { $a->page['aside'] = ''; } $a->page['aside'] .= Group::sidebarWidget('network/0', 'network', 'standard', $group_id); $a->page['aside'] .= ForumManager::widget(local_user(), $cid); $a->page['aside'] .= posted_date_widget('network', local_user(), false); - $a->page['aside'] .= Widget::networks('network', (x($_GET, 'nets') ? $_GET['nets'] : '')); + $a->page['aside'] .= Widget::networks('network', defaults($_GET, 'nets', '') ); $a->page['aside'] .= saved_searches($search); - $a->page['aside'] .= Widget::fileAs('network', (x($_GET, 'file') ? $_GET['file'] : '')); + $a->page['aside'] .= Widget::fileAs('network', defaults($_GET, 'file', '') ); } function saved_searches($search) { $srchurl = '/network?f=' - . ((x($_GET, 'cid')) ? '&cid=' . rawurlencode($_GET['cid']) : '') - . ((x($_GET, 'star')) ? '&star=' . rawurlencode($_GET['star']) : '') - . ((x($_GET, 'bmark')) ? '&bmark=' . rawurlencode($_GET['bmark']) : '') - . ((x($_GET, 'conv')) ? '&conv=' . rawurlencode($_GET['conv']) : '') - . ((x($_GET, 'nets')) ? '&nets=' . rawurlencode($_GET['nets']) : '') - . ((x($_GET, 'cmin')) ? '&cmin=' . rawurlencode($_GET['cmin']) : '') - . ((x($_GET, 'cmax')) ? '&cmax=' . rawurlencode($_GET['cmax']) : '') - . ((x($_GET, 'file')) ? '&file=' . rawurlencode($_GET['file']) : ''); + . (!empty($_GET['cid']) ? '&cid=' . rawurlencode($_GET['cid']) : '') + . (!empty($_GET['star']) ? '&star=' . rawurlencode($_GET['star']) : '') + . (!empty($_GET['bmark']) ? '&bmark=' . rawurlencode($_GET['bmark']) : '') + . (!empty($_GET['conv']) ? '&conv=' . rawurlencode($_GET['conv']) : '') + . (!empty($_GET['nets']) ? '&nets=' . rawurlencode($_GET['nets']) : '') + . (!empty($_GET['cmin']) ? '&cmin=' . rawurlencode($_GET['cmin']) : '') + . (!empty($_GET['cmax']) ? '&cmax=' . rawurlencode($_GET['cmax']) : '') + . (!empty($_GET['file']) ? '&file=' . rawurlencode($_GET['file']) : ''); ; $terms = DBA::select('search', ['id', 'term'], ['uid' => local_user()]); @@ -233,15 +228,15 @@ function network_query_get_sel_tab(App $a) $new_active = 'active'; } - if (x($_GET, 'star')) { + if (!empty($_GET['star'])) { $starred_active = 'active'; } - if (x($_GET, 'bmark')) { + if (!empty($_GET['bmark'])) { $bookmarked_active = 'active'; } - if (x($_GET, 'conv')) { + if (!empty($_GET['conv'])) { $conv_active = 'active'; } @@ -249,7 +244,7 @@ function network_query_get_sel_tab(App $a) $no_active = 'active'; } - if ($no_active == 'active' && x($_GET, 'order')) { + if ($no_active == 'active' && !empty($_GET['order'])) { switch($_GET['order']) { case 'post' : $postord_active = 'active'; $no_active=''; break; case 'comment' : $all_active = 'active'; $no_active=''; break; @@ -672,7 +667,7 @@ function networkThreadedView(App $a, $update, $parent) $entries[0] = [ 'id' => 'network', - 'name' => htmlentities($contact['name']), + 'name' => $contact['name'], 'itemurl' => defaults($contact, 'addr', $contact['nurl']), 'thumb' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB), 'details' => $contact['location'], @@ -914,7 +909,7 @@ function networkThreadedView(App $a, $update, $parent) $parents_str = implode(', ', $parents_arr); } - if (x($_GET, 'offset')) { + if (!empty($_GET['offset'])) { $date_offset = $_GET['offset']; } @@ -968,7 +963,7 @@ function network_tabs(App $a) $tabs = [ [ 'label' => L10n::t('Commented Order'), - 'url' => str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), + 'url' => str_replace('/new', '', $cmd) . '?f=&order=comment' . (!empty($_GET['cid']) ? '&cid=' . $_GET['cid'] : ''), 'sel' => $all_active, 'title' => L10n::t('Sort by Comment Date'), 'id' => 'commented-order-tab', @@ -976,7 +971,7 @@ function network_tabs(App $a) ], [ 'label' => L10n::t('Posted Order'), - 'url' => str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), + 'url' => str_replace('/new', '', $cmd) . '?f=&order=post' . (!empty($_GET['cid']) ? '&cid=' . $_GET['cid'] : ''), 'sel' => $postord_active, 'title' => L10n::t('Sort by Post Date'), 'id' => 'posted-order-tab', @@ -986,7 +981,7 @@ function network_tabs(App $a) $tabs[] = [ 'label' => L10n::t('Personal'), - 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1', + 'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1', 'sel' => $conv_active, 'title' => L10n::t('Posts that mention or involve you'), 'id' => 'personal-tab', @@ -996,7 +991,7 @@ function network_tabs(App $a) if (Feature::isEnabled(local_user(), 'new_tab')) { $tabs[] = [ 'label' => L10n::t('New'), - 'url' => 'network/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''), + 'url' => 'network/new' . (!empty($_GET['cid']) ? '/?f=&cid=' . $_GET['cid'] : ''), 'sel' => $new_active, 'title' => L10n::t('Activity Stream - by date'), 'id' => 'activitiy-by-date-tab', @@ -1007,7 +1002,7 @@ function network_tabs(App $a) if (Feature::isEnabled(local_user(), 'link_tab')) { $tabs[] = [ 'label' => L10n::t('Shared Links'), - 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1', + 'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1', 'sel' => $bookmarked_active, 'title' => L10n::t('Interesting Links'), 'id' => 'shared-links-tab', @@ -1017,7 +1012,7 @@ function network_tabs(App $a) $tabs[] = [ 'label' => L10n::t('Starred'), - 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1', + 'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1', 'sel' => $starred_active, 'title' => L10n::t('Favourite Posts'), 'id' => 'starred-posts-tab', @@ -1025,7 +1020,7 @@ function network_tabs(App $a) ]; // save selected tab, but only if not in file mode - if (!x($_GET, 'file')) { + if (empty($_GET['file'])) { PConfig::set(local_user(), 'network.view', 'tab.selected', [ $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active ]); diff --git a/mod/newmember.php b/mod/newmember.php index cd59cc780c..c2ffe6464e 100644 --- a/mod/newmember.php +++ b/mod/newmember.php @@ -8,7 +8,8 @@ use Friendica\Core\L10n; function newmember_content(App $a) { - $o = '

' . L10n::t('Welcome to Friendica') . '

'; + $o = '
'; + $o .= '

' . L10n::t('Welcome to Friendica') . '

'; $o .= '

' . L10n::t('New Member Checklist') . '

'; $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 .= '
  • ' . '' . L10n::t('Go to the Help Section') . '
    ' . L10n::t('Our help pages may be consulted for detail on other program features and resources.') . '
  • ' . EOL; $o .= ''; $o .= '
    '; + $o .= '
    '; return $o; } diff --git a/mod/noscrape.php b/mod/noscrape.php index 87367d5369..e1d51e5a80 100644 --- a/mod/noscrape.php +++ b/mod/noscrape.php @@ -48,7 +48,7 @@ function noscrape_init(App $a) exit; } - $keywords = ((x($a->profile, 'pub_keywords')) ? $a->profile['pub_keywords'] : ''); + $keywords = defaults($a->profile, 'pub_keywords', ''); $keywords = str_replace(['#',',',' ',',,'], ['',' ',',',','], $keywords); $keywords = explode(',', $keywords); diff --git a/mod/notes.php b/mod/notes.php index 01e6e5ab99..90afa16ca5 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -59,7 +59,7 @@ function notes_content(App $a, $update = false) } $condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT, - 'wall' => false, 'contact-id'=> $a->contact['id']]; + 'contact-id'=> $a->contact['id']]; $pager = new Pager($a->query_string, 40); @@ -70,7 +70,7 @@ function notes_content(App $a, $update = false) $count = 0; if (DBA::isResult($r)) { - $notes = DBA::toArray($r); + $notes = Item::inArray($r); $count = count($notes); diff --git a/mod/notifications.php b/mod/notifications.php index 54c54fa222..00c234d157 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -237,7 +237,7 @@ function notifications_content(App $a) $notif_content[] = Renderer::replaceMacros($tpl, [ '$type' => $notif['label'], - '$header' => htmlentities($header), + '$header' => $header, '$str_notifytype' => L10n::t('Notification type:'), '$notify_type' => $notif['notify_type'], '$dfrn_text' => $dfrn_text, diff --git a/mod/oexchange.php b/mod/oexchange.php index 62d0bba078..6d682d6adf 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -33,13 +33,13 @@ function oexchange_content(App $a) { return; } - $url = ((x($_REQUEST,'url') && strlen($_REQUEST['url'])) + $url = ((!empty($_REQUEST['url'])) ? urlencode(Strings::escapeTags(trim($_REQUEST['url']))) : ''); - $title = ((x($_REQUEST,'title') && strlen($_REQUEST['title'])) + $title = ((!empty($_REQUEST['title'])) ? '&title=' . urlencode(Strings::escapeTags(trim($_REQUEST['title']))) : ''); - $description = ((x($_REQUEST,'description') && strlen($_REQUEST['description'])) + $description = ((!empty($_REQUEST['description'])) ? '&description=' . urlencode(Strings::escapeTags(trim($_REQUEST['description']))) : ''); - $tags = ((x($_REQUEST,'tags') && strlen($_REQUEST['tags'])) + $tags = ((!empty($_REQUEST['tags'])) ? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : ''); $s = Network::fetchUrl(System::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags); diff --git a/mod/openid.php b/mod/openid.php index 209960ee58..4e247b384f 100644 --- a/mod/openid.php +++ b/mod/openid.php @@ -20,7 +20,7 @@ function openid_content(App $a) { Logger::log('mod_openid ' . print_r($_REQUEST,true), Logger::DATA); - if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) { + if(!empty($_GET['openid_mode']) && !empty($_SESSION['openid'])) { $openid = new LightOpenID($a->getHostName()); diff --git a/mod/ostatus_subscribe.php b/mod/ostatus_subscribe.php index 5670820623..5d493db32c 100644 --- a/mod/ostatus_subscribe.php +++ b/mod/ostatus_subscribe.php @@ -77,8 +77,8 @@ function ostatus_subscribe_content(App $a) $o .= '

    ' . $counter . '/' . $total . ': ' . $url; - $curlResult = Probe::uri($url); - if ($curlResult['network'] == Protocol::OSTATUS) { + $probed = Probe::uri($url); + if ($probed['network'] == Protocol::OSTATUS) { $result = Contact::createFromProbe($uid, $url, true, Protocol::OSTATUS); if ($result['success']) { $o .= ' - ' . L10n::t('success'); diff --git a/mod/parse_url.php b/mod/parse_url.php index a1bacb0d8f..07f319fdca 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -47,8 +47,8 @@ function parse_url_content(App $a) // Add url scheme if it is missing $arrurl = parse_url($url); - if (!x($arrurl, 'scheme')) { - if (x($arrurl, 'host')) { + if (empty($arrurl['scheme'])) { + if (!empty($arrurl['host'])) { $url = 'http:' . $url; } else { $url = 'http://' . $url; diff --git a/mod/photos.php b/mod/photos.php index 70e0e1882d..d1dffd4d05 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -283,7 +283,7 @@ function photos_post(App $a) if (DBA::isResult($r)) { foreach ($r as $rr) { - $res[] = "'" . DBA::escape($rr['rid']) . "'" ; + $res[] = "'" . DBA::escape($rr['rid']) . "'"; } } else { $a->internalRedirect($_SESSION['photo_return']); @@ -365,10 +365,10 @@ function photos_post(App $a) return; // NOTREACHED } - if ($a->argc > 2 && (!empty($_POST['desc']) || !empty($_POST['newtag']) || !empty($_POST['albname']) !== false)) { + if ($a->argc > 2 && (!empty($_POST['desc']) || !empty($_POST['newtag']) || isset($_POST['albname']))) { $desc = !empty($_POST['desc']) ? Strings::escapeTags(trim($_POST['desc'])) : ''; $rawtags = !empty($_POST['newtag']) ? Strings::escapeTags(trim($_POST['newtag'])) : ''; - $item_id = !empty($_POST['item_id']) ? intval($_POST['item_id']) : 0; + $item_id = !empty($_POST['item_id']) ? intval($_POST['item_id']) : 0; $albname = !empty($_POST['albname']) ? Strings::escapeTags(trim($_POST['albname'])) : ''; $origaname = !empty($_POST['origaname']) ? Strings::escapeTags(trim($_POST['origaname'])) : ''; @@ -681,8 +681,8 @@ function photos_post(App $a) $arr['tag'] = $tagged[4]; $arr['inform'] = $tagged[2]; $arr['origin'] = 1; - $arr['body'] = L10n::t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . L10n::t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ; - $arr['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . '[img]' . System::baseUrl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ; + $arr['body'] = L10n::t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . L10n::t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]'); + $arr['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . '[img]' . System::baseUrl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n"; $arr['object'] = '' . ACTIVITY_OBJ_PERSON . '' . $tagged[0] . '' . $tagged[1] . '/' . $tagged[0] . ''; $arr['object'] .= '' . XML::escape('' . "\n"); @@ -1353,7 +1353,7 @@ function photos_content(App $a) } if ($prevlink) { - $prevlink = [$prevlink, ''] ; + $prevlink = [$prevlink, '']; } $photo = [ diff --git a/mod/ping.php b/mod/ping.php index edc1a11213..40700f36f8 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -188,7 +188,7 @@ function ping_init(App $a) $intro_count = count($intros1) + count($intros2); $intros = $intros1 + $intros2; - $myurl = System::baseUrl() . '/profile/' . $a->user['nickname'] ; + $myurl = System::baseUrl() . '/profile/' . $a->user['nickname']; $mails = q( "SELECT `id`, `from-name`, `from-url`, `from-photo`, `created` FROM `mail` WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ", @@ -373,12 +373,12 @@ function ping_init(App $a) $sysmsgs = []; $sysmsgs_info = []; - if (x($_SESSION, 'sysmsg')) { + if (!empty($_SESSION['sysmsg'])) { $sysmsgs = $_SESSION['sysmsg']; unset($_SESSION['sysmsg']); } - if (x($_SESSION, 'sysmsg_info')) { + if (!empty($_SESSION['sysmsg_info'])) { $sysmsgs_info = $_SESSION['sysmsg_info']; unset($_SESSION['sysmsg_info']); } @@ -483,7 +483,7 @@ function ping_get_notifications($uid) if ($notification["visible"] && !$notification["deleted"] - && !(x($result, $notification["parent"]) && !empty($result[$notification["parent"]])) + && empty($result[$notification["parent"]]) ) { // Should we condense the notifications or show them all? if (PConfig::get(local_user(), 'system', 'detailed_notif')) { diff --git a/mod/poco.php b/mod/poco.php index cc2493c086..3456beb128 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -88,7 +88,7 @@ function poco_init(App $a) { if (!empty($cid)) { $sql_extra = sprintf(" AND `contact`.`id` = %d ", intval($cid)); } - if (x($_GET, 'updatedSince')) { + if (!empty($_GET['updatedSince'])) { $update_limit = date(DateTimeFormat::MYSQL, strtotime($_GET['updatedSince'])); } if ($global) { @@ -122,7 +122,7 @@ function poco_init(App $a) { } else { $startIndex = 0; } - $itemsPerPage = ((x($_GET, 'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults); + $itemsPerPage = ((!empty($_GET['count'])) ? intval($_GET['count']) : $totalResults); if ($global) { Logger::log("Start global query", Logger::DEBUG); @@ -164,13 +164,13 @@ function poco_init(App $a) { Logger::log("Query done", Logger::DEBUG); $ret = []; - if (x($_GET, 'sorted')) { + if (!empty($_GET['sorted'])) { $ret['sorted'] = false; } - if (x($_GET, 'filtered')) { + if (!empty($_GET['filtered'])) { $ret['filtered'] = false; } - if (x($_GET, 'updatedSince') && ! $global) { + if (!empty($_GET['updatedSince']) && ! $global) { $ret['updatedSince'] = false; } $ret['startIndex'] = (int) $startIndex; @@ -196,7 +196,7 @@ function poco_init(App $a) { 'generation' => false ]; - if ((! x($_GET, 'fields')) || ($_GET['fields'] === '@all')) { + if (empty($_GET['fields']) || ($_GET['fields'] === '@all')) { foreach ($fields_ret as $k => $v) { $fields_ret[$k] = true; } diff --git a/mod/poke.php b/mod/poke.php index 6f09b348cc..f1bad7742b 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -54,7 +54,7 @@ function poke_init(App $a) return; } - $parent = (x($_GET,'parent') ? intval($_GET['parent']) : 0); + $parent = (!empty($_GET['parent']) ? intval($_GET['parent']) : 0); Logger::log('poke: verb ' . $verb . ' contact ' . $contact_id, Logger::DEBUG); @@ -86,7 +86,7 @@ function poke_init(App $a) $deny_gid = $item['deny_gid']; } } else { - $private = (x($_GET,'private') ? intval($_GET['private']) : 0); + $private = (!empty($_GET['private']) ? intval($_GET['private']) : 0); $allow_cid = ($private ? '<' . $target['id']. '>' : $a->user['allow_cid']); $allow_gid = ($private ? '' : $a->user['allow_gid']); @@ -169,7 +169,7 @@ function poke_content(App $a) ]); - $parent = (x($_GET,'parent') ? intval($_GET['parent']) : '0'); + $parent = (!empty($_GET['parent']) ? intval($_GET['parent']) : '0'); $verbs = L10n::getPokeVerbs(); diff --git a/mod/probe.php b/mod/probe.php index b448ffd2b2..7c41df8ac5 100644 --- a/mod/probe.php +++ b/mod/probe.php @@ -15,7 +15,8 @@ function probe_content(App $a) killme(); } - $o = '

    Probe Diagnostic

    '; + $o = '
    '; + $o .= '

    Probe Diagnostic

    '; $o .= '
    '; $o .= 'Lookup address: '; @@ -30,6 +31,7 @@ function probe_content(App $a) $o .= str_replace("\n", '
    ', print_r($res, true)); $o .= ''; } + $o .= '
    '; return $o; } diff --git a/mod/profile.php b/mod/profile.php index 3164f173bf..87ad9a9e97 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -33,24 +33,16 @@ function profile_init(App $a) $a->page['aside'] = ''; } - if ($a->argc > 1) { - $which = htmlspecialchars($a->argv[1]); - } else { - $r = q("SELECT `nickname` FROM `user` WHERE `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 ORDER BY RAND() LIMIT 1"); - if (DBA::isResult($r)) { - $a->internalRedirect('profile/' . $r[0]['nickname']); - } else { - Logger::log('profile error: mod_profile ' . $a->query_string, Logger::DEBUG); - notice(L10n::t('Requested profile is not available.') . EOL); - $a->error = 404; - return; - } + if ($a->argc < 2) { + System::httpExit(400); } + $which = filter_var($a->argv[1], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_BACKTICK); + $profile = 0; if (local_user() && $a->argc > 2 && $a->argv[2] === 'view') { $which = $a->user['nickname']; - $profile = htmlspecialchars($a->argv[1]); + $profile = filter_var($a->argv[1], FILTER_SANITIZE_NUMBER_INT); } else { DFRN::autoRedir($a, $which); } @@ -139,6 +131,7 @@ function profile_content(App $a, $update = 0) require_once 'include/items.php'; $groups = []; + $remote_cid = null; $tab = 'posts'; $o = ''; @@ -150,42 +143,18 @@ function profile_content(App $a, $update = 0) Nav::setSelected('home'); } - $contact = null; - $remote_contact = false; - - $contact_id = 0; - - if (!empty($_SESSION['remote'])) { - foreach ($_SESSION['remote'] as $v) { - if ($v['uid'] == $a->profile['profile_uid']) { - $contact_id = $v['cid']; - break; - } - } - } - - if ($contact_id) { - $groups = Group::getIdsByContactId($contact_id); - $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($contact_id), - intval($a->profile['profile_uid']) - ); - if (DBA::isResult($r)) { - $contact = $r[0]; - $remote_contact = true; - } - } - - if (!$remote_contact) { - if (local_user()) { - $contact_id = $_SESSION['cid']; - $contact = $a->contact; - } - } - + $remote_contact = Contact::isFollower(remote_user(), $a->profile['profile_uid']); $is_owner = local_user() == $a->profile['profile_uid']; $last_updated_key = "profile:" . $a->profile['profile_uid'] . ":" . local_user() . ":" . remote_user(); + if ($remote_contact) { + $cdata = Contact::getPublicAndUserContacID(remote_user(), $a->profile['profile_uid']); + if (!empty($cdata['user'])) { + $groups = Group::getIdsByContactId($cdata['user']); + $remote_cid = $cdata['user']; + } + } + if (!empty($a->profile['hidewall']) && !$is_owner && !$remote_contact) { notice(L10n::t('Access to this profile has been restricted.') . EOL); return; @@ -236,13 +205,12 @@ function profile_content(App $a, $update = 0) } } - // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups - $sql_extra = Item::getPermissionsSQLByUserId($a->profile['profile_uid'], $remote_contact, $groups); + $sql_extra = Item::getPermissionsSQLByUserId($a->profile['profile_uid'], $remote_contact, $groups, $remote_cid); $sql_extra2 = ''; if ($update) { - $last_updated = (!empty($_SESSION['last_updated'][$last_updated_key]) ? $_SESSION['last_updated'][$last_updated_key] : 0); + $last_updated = (defaults($_SESSION['last_updated'], $last_updated_key, 0)); // If the page user is the owner of the page we should query for unseen // items. Otherwise use a timestamp of the last succesful update request. @@ -350,7 +318,7 @@ function profile_content(App $a, $update = 0) } } - $o .= conversation($a, $items, $pager, 'profile', $update, false, 'created', local_user()); + $o .= conversation($a, $items, $pager, 'profile', $update, false, 'created', $a->profile['profile_uid']); if (!$update) { $o .= $pager->renderMinimal(count($items)); diff --git a/mod/profiles.php b/mod/profiles.php index fe3b362317..6a32fbee5a 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -251,7 +251,7 @@ function profiles_post(App $a) { $marital = Strings::escapeTags(trim($_POST['marital'])); $howlong = Strings::escapeTags(trim($_POST['howlong'])); - $with = ((x($_POST,'with')) ? Strings::escapeTags(trim($_POST['with'])) : ''); + $with = (!empty($_POST['with']) ? Strings::escapeTags(trim($_POST['with'])) : ''); if (! strlen($howlong)) { $howlong = DBA::NULL_DATETIME; diff --git a/mod/pubsub.php b/mod/pubsub.php index f0a8d463c4..cd2f21dd67 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -7,6 +7,7 @@ use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Protocol\OStatus; use Friendica\Util\Strings; +use Friendica\Core\System; require_once 'include/items.php'; @@ -16,7 +17,7 @@ function hub_return($valid, $body) header($_SERVER["SERVER_PROTOCOL"] . ' 200 OK'); echo $body; } else { - header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found'); + System::httpExit(404); } killme(); } @@ -25,8 +26,7 @@ function hub_return($valid, $body) function hub_post_return() { - header($_SERVER["SERVER_PROTOCOL"] . ' 200 OK'); - killme(); + System::httpExit(200); } function pubsub_init(App $a) diff --git a/mod/pubsubhubbub.php b/mod/pubsubhubbub.php index c9cb54d2e0..11fbf2cf5f 100644 --- a/mod/pubsubhubbub.php +++ b/mod/pubsubhubbub.php @@ -10,7 +10,7 @@ use Friendica\Util\Network; use Friendica\Util\Strings; function post_var($name) { - return (x($_POST, $name)) ? Strings::escapeTags(trim($_POST[$name])) : ''; + return !empty($_POST[$name]) ? Strings::escapeTags(trim($_POST[$name])) : ''; } function pubsubhubbub_init(App $a) { diff --git a/mod/redir.php b/mod/redir.php index 701b85953c..33b7d36f91 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -9,6 +9,7 @@ use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Profile; use Friendica\Util\Strings; +use Friendica\Util\Network; function redir_init(App $a) { @@ -34,8 +35,7 @@ function redir_init(App $a) { $contact_url = $contact['url']; - if ($contact['network'] !== Protocol::DFRN // Authentication isn't supported for non DFRN contacts. - || (!local_user() && !remote_user()) // Visitors (not logged in or not remotes) can't authenticate. + if ((!local_user() && !remote_user()) // Visitors (not logged in or not remotes) can't authenticate. || (!empty($a->contact['id']) && $a->contact['id'] == $cid)) // Local user is already authenticated. { $a->redirect(defaults($url, $contact_url)); @@ -67,7 +67,7 @@ function redir_init(App $a) { // for authentification everytime he/she is visiting a profile page of the local // contact. if ($host == $remotehost - && x($_SESSION, 'remote') + && !empty($_SESSION['remote']) && is_array($_SESSION['remote'])) { foreach ($_SESSION['remote'] as $v) { @@ -81,8 +81,17 @@ function redir_init(App $a) { } } + // When the remote page does support OWA, then we enforce the use of it + $basepath = Contact::getBasepath($contact_url); + if ($basepath == System::baseUrl()) { + $use_magic = true; + } else { + $serverret = Network::curl($basepath . '/magic'); + $use_magic = $serverret->isSuccess(); + } + // Doing remote auth with dfrn. - if (local_user() && (!empty($contact['dfrn-id']) || !empty($contact['issued-id'])) && empty($contact['pending'])) { + if (local_user() && !$use_magic && (!empty($contact['dfrn-id']) || !empty($contact['issued-id'])) && empty($contact['pending'])) { $dfrn_id = $orig_id = (($contact['issued-id']) ? $contact['issued-id'] : $contact['dfrn-id']); if ($contact['duplex'] && $contact['issued-id']) { diff --git a/mod/register.php b/mod/register.php index 2b0d87ca99..03d4cb02f6 100644 --- a/mod/register.php +++ b/mod/register.php @@ -84,7 +84,7 @@ function register_post(App $a) $using_invites = Config::get('system', 'invitation_only'); $num_invites = Config::get('system', 'number_invites'); - $invite_id = ((x($_POST, 'invite_id')) ? Strings::escapeTags(trim($_POST['invite_id'])) : ''); + $invite_id = (!empty($_POST['invite_id']) ? Strings::escapeTags(trim($_POST['invite_id'])) : ''); if (intval(Config::get('config', 'register_policy')) === REGISTER_OPEN) { if ($using_invites && $invite_id) { @@ -93,7 +93,7 @@ function register_post(App $a) } // Only send a password mail when the password wasn't manually provided - if (!x($_POST, 'password1') || !x($_POST, 'confirm')) { + if (empty($_POST['password1']) || empty($_POST['confirm'])) { $res = Model\User::sendRegisterOpenEmail( $user, Config::get('config', 'sitename'), @@ -195,38 +195,33 @@ function register_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']); } - $username = x($_REQUEST, 'username') ? $_REQUEST['username'] : ''; - $email = x($_REQUEST, 'email') ? $_REQUEST['email'] : ''; - $openid_url = x($_REQUEST, 'openid_url') ? $_REQUEST['openid_url'] : ''; - $nickname = x($_REQUEST, 'nickname') ? $_REQUEST['nickname'] : ''; - $photo = x($_REQUEST, 'photo') ? $_REQUEST['photo'] : ''; - $invite_id = x($_REQUEST, 'invite_id') ? $_REQUEST['invite_id'] : ''; + $username = defaults($_REQUEST, 'username' , ''); + $email = defaults($_REQUEST, 'email' , ''); + $openid_url = defaults($_REQUEST, 'openid_url', ''); + $nickname = defaults($_REQUEST, 'nickname' , ''); + $photo = defaults($_REQUEST, 'photo' , ''); + $invite_id = defaults($_REQUEST, 'invite_id' , ''); $noid = Config::get('system', 'no_openid'); if ($noid) { - $oidhtml = ''; $fillwith = ''; $fillext = ''; $oidlabel = ''; } else { - $oidhtml = ''; $fillwith = L10n::t("You may \x28optionally\x29 fill in this form via OpenID by supplying your OpenID and clicking 'Register'."); $fillext = L10n::t('If you are not familiar with OpenID, please leave that field blank and fill in the rest of the items.'); $oidlabel = L10n::t("Your OpenID \x28optional\x29: "); } - // I set this and got even more fake names than before... - $realpeople = ''; // L10n::t('Members of this network prefer to communicate with real people who use their real names.'); - if (Config::get('system', 'publish_all')) { $profile_publish = ''; } else { @@ -244,8 +239,6 @@ function register_content(App $a) $r = q("SELECT COUNT(*) AS `contacts` FROM `contact`"); $passwords = !$r[0]["contacts"]; - $license = ''; - $tpl = Renderer::getMarkupTemplate("register.tpl"); $arr = ['template' => $tpl]; @@ -257,14 +250,12 @@ function register_content(App $a) $tos = new Tos(); $o = Renderer::replaceMacros($tpl, [ - '$oidhtml' => $oidhtml, '$invitations' => Config::get('system', 'invitation_only'), '$permonly' => intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE, '$permonlybox' => ['permonlybox', L10n::t('Note for the admin'), '', L10n::t('Leave a message for the admin, why you want to join this node')], '$invite_desc' => L10n::t('Membership on this site is by invitation only.'), '$invite_label' => L10n::t('Your invitation code: '), '$invite_id' => $invite_id, - '$realpeople' => $realpeople, '$regtitle' => L10n::t('Registration'), '$registertext' => BBCode::convert(Config::get('config', 'register_text', '')), '$fillwith' => $fillwith, @@ -284,7 +275,6 @@ function register_content(App $a) '$username' => $username, '$email' => $email, '$nickname' => $nickname, - '$license' => $license, '$sitename' => $a->getHostName(), '$importh' => L10n::t('Import'), '$importt' => L10n::t('Import your profile to this friendica instance'), diff --git a/mod/removeme.php b/mod/removeme.php index ee0b66db8a..19bf0bc851 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -20,15 +20,15 @@ function removeme_post(App $a) return; } - if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) { + if (!empty($_SESSION['submanage'])) { return; } - if ((!x($_POST, 'qxz_password')) || (!strlen(trim($_POST['qxz_password'])))) { + if (empty($_POST['qxz_password'])) { return; } - if ((!x($_POST, 'verify')) || (!strlen(trim($_POST['verify'])))) { + if (empty($_POST['verify'])) { return; } diff --git a/mod/search.php b/mod/search.php index 2810b23b13..b40fe07157 100644 --- a/mod/search.php +++ b/mod/search.php @@ -24,7 +24,7 @@ require_once 'mod/dirfind.php'; function search_saved_searches() { $o = ''; - $search = ((x($_GET,'search')) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : ''); + $search = (!empty($_GET['search']) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : ''); $r = q("SELECT `id`,`term` FROM `search` WHERE `uid` = %d", intval(local_user()) @@ -60,10 +60,10 @@ function search_saved_searches() { function search_init(App $a) { - $search = ((x($_GET,'search')) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : ''); + $search = (!empty($_GET['search']) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : ''); if (local_user()) { - if (x($_GET,'save') && $search) { + if (!empty($_GET['save']) && $search) { $r = q("SELECT * FROM `search` WHERE `uid` = %d AND `term` = '%s' LIMIT 1", intval(local_user()), DBA::escape($search) @@ -72,7 +72,7 @@ function search_init(App $a) { DBA::insert('search', ['uid' => local_user(), 'term' => $search]); } } - if (x($_GET,'remove') && $search) { + if (!empty($_GET['remove']) && $search) { DBA::delete('search', ['uid' => local_user(), 'term' => $search]); } @@ -92,14 +92,6 @@ function search_init(App $a) { } - - -function search_post(App $a) { - if (x($_POST,'search')) - $a->data['search'] = $_POST['search']; -} - - function search_content(App $a) { if (Config::get('system','block_public') && !local_user() && !remote_user()) { @@ -145,16 +137,12 @@ function search_content(App $a) { Nav::setSelected('search'); - $search = ''; - if (x($a->data,'search')) - $search = Strings::escapeTags(trim($a->data['search'])); - else - $search = ((x($_GET,'search')) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : ''); + $search = (!empty($_REQUEST['search']) ? Strings::escapeTags(trim(rawurldecode($_REQUEST['search']))) : ''); $tag = false; - if (x($_GET,'tag')) { + if (!empty($_GET['tag'])) { $tag = true; - $search = (x($_GET,'tag') ? '#' . Strings::escapeTags(trim(rawurldecode($_GET['tag']))) : ''); + $search = (!empty($_GET['tag']) ? '#' . Strings::escapeTags(trim(rawurldecode($_GET['tag']))) : ''); } // contruct a wrapper for the search header @@ -176,7 +164,7 @@ function search_content(App $a) { return dirfind_content($a); } - if (x($_GET,'search-option')) + if (!empty($_GET['search-option'])) switch($_GET['search-option']) { case 'fulltext': break; diff --git a/mod/settings.php b/mod/settings.php index 8570120480..1ec3725dc3 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -146,18 +146,18 @@ function settings_post(App $a) return; } - if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) { + if (!empty($_SESSION['submanage'])) { 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; } $old_page_flags = $a->user['page-flags']; - if (($a->argc > 1) && ($a->argv[1] === 'oauth') && x($_POST, 'remove')) { + if (($a->argc > 1) && ($a->argv[1] === 'oauth') && !empty($_POST['remove'])) { BaseModule::checkFormSecurityTokenRedirectOnError('/settings/oauth', 'settings_oauth'); $key = $_POST['remove']; @@ -166,7 +166,7 @@ function settings_post(App $a) return; } - if (($a->argc > 2) && ($a->argv[1] === 'oauth') && ($a->argv[2] === 'edit'||($a->argv[2] === 'add')) && x($_POST, 'submit')) { + if (($a->argc > 2) && ($a->argv[1] === 'oauth') && ($a->argv[2] === 'edit'||($a->argv[2] === 'add')) && !empty($_POST['submit'])) { BaseModule::checkFormSecurityTokenRedirectOnError('/settings/oauth', 'settings_oauth'); $name = defaults($_POST, 'name' , ''); @@ -222,23 +222,23 @@ function settings_post(App $a) if (($a->argc > 1) && ($a->argv[1] == 'connectors')) { BaseModule::checkFormSecurityTokenRedirectOnError('/settings/connectors', 'settings_connectors'); - if (x($_POST, 'general-submit')) { + if (!empty($_POST['general-submit'])) { PConfig::set(local_user(), 'system', 'disable_cw', intval($_POST['disable_cw'])); PConfig::set(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening'])); PConfig::set(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow'])); PConfig::set(local_user(), 'ostatus', 'default_group', $_POST['group-selection']); PConfig::set(local_user(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']); - } elseif (x($_POST, 'imap-submit')) { + } elseif (!empty($_POST['imap-submit'])) { - $mail_server = ((x($_POST, 'mail_server')) ? $_POST['mail_server'] : ''); - $mail_port = ((x($_POST, 'mail_port')) ? $_POST['mail_port'] : ''); - $mail_ssl = ((x($_POST, 'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : ''); - $mail_user = ((x($_POST, 'mail_user')) ? $_POST['mail_user'] : ''); - $mail_pass = ((x($_POST, 'mail_pass')) ? trim($_POST['mail_pass']) : ''); - $mail_action = ((x($_POST, 'mail_action')) ? trim($_POST['mail_action']) : ''); - $mail_movetofolder = ((x($_POST, 'mail_movetofolder')) ? trim($_POST['mail_movetofolder']) : ''); - $mail_replyto = ((x($_POST, 'mail_replyto')) ? $_POST['mail_replyto'] : ''); - $mail_pubmail = ((x($_POST, 'mail_pubmail')) ? $_POST['mail_pubmail'] : ''); + $mail_server = defaults($_POST, 'mail_server', ''); + $mail_port = defaults($_POST, 'mail_port', ''); + $mail_ssl = (!empty($_POST['mail_ssl']) ? strtolower(trim($_POST['mail_ssl'])) : ''); + $mail_user = defaults($_POST, 'mail_user', ''); + $mail_pass = (!empty($_POST['mail_pass']) ? trim($_POST['mail_pass']) : ''); + $mail_action = (!empty($_POST['mail_action']) ? trim($_POST['mail_action']) : ''); + $mail_movetofolder = (!empty($_POST['mail_movetofolder']) ? trim($_POST['mail_movetofolder']) : ''); + $mail_replyto = defaults($_POST, 'mail_replyto', ''); + $mail_pubmail = defaults($_POST, 'mail_pubmail', ''); $mail_disabled = ((function_exists('imap_open') && (!Config::get('system', 'imap_disabled'))) ? 0 : 1); @@ -315,17 +315,17 @@ function settings_post(App $a) if (($a->argc > 1) && ($a->argv[1] === 'display')) { BaseModule::checkFormSecurityTokenRedirectOnError('/settings/display', 'settings_display'); - $theme = x($_POST, 'theme') ? Strings::escapeTags(trim($_POST['theme'])) : $a->user['theme']; - $mobile_theme = x($_POST, 'mobile_theme') ? Strings::escapeTags(trim($_POST['mobile_theme'])) : ''; - $nosmile = x($_POST, 'nosmile') ? intval($_POST['nosmile']) : 0; - $first_day_of_week = x($_POST, 'first_day_of_week') ? intval($_POST['first_day_of_week']) : 0; - $noinfo = x($_POST, 'noinfo') ? intval($_POST['noinfo']) : 0; - $infinite_scroll = x($_POST, 'infinite_scroll') ? intval($_POST['infinite_scroll']) : 0; - $no_auto_update = x($_POST, 'no_auto_update') ? intval($_POST['no_auto_update']) : 0; - $bandwidth_saver = x($_POST, 'bandwidth_saver') ? intval($_POST['bandwidth_saver']) : 0; - $smart_threading = x($_POST, 'smart_threading') ? intval($_POST['smart_threading']) : 0; - $nowarn_insecure = x($_POST, 'nowarn_insecure') ? intval($_POST['nowarn_insecure']) : 0; - $browser_update = x($_POST, 'browser_update') ? intval($_POST['browser_update']) : 0; + $theme = !empty($_POST['theme']) ? Strings::escapeTags(trim($_POST['theme'])) : $a->user['theme']; + $mobile_theme = !empty($_POST['mobile_theme']) ? Strings::escapeTags(trim($_POST['mobile_theme'])) : ''; + $nosmile = !empty($_POST['nosmile']) ? intval($_POST['nosmile']) : 0; + $first_day_of_week = !empty($_POST['first_day_of_week']) ? intval($_POST['first_day_of_week']) : 0; + $noinfo = !empty($_POST['noinfo']) ? intval($_POST['noinfo']) : 0; + $infinite_scroll = !empty($_POST['infinite_scroll']) ? intval($_POST['infinite_scroll']) : 0; + $no_auto_update = !empty($_POST['no_auto_update']) ? intval($_POST['no_auto_update']) : 0; + $bandwidth_saver = !empty($_POST['bandwidth_saver']) ? intval($_POST['bandwidth_saver']) : 0; + $smart_threading = !empty($_POST['smart_threading']) ? intval($_POST['smart_threading']) : 0; + $nowarn_insecure = !empty($_POST['nowarn_insecure']) ? intval($_POST['nowarn_insecure']) : 0; + $browser_update = !empty($_POST['browser_update']) ? intval($_POST['browser_update']) : 0; if ($browser_update != -1) { $browser_update = $browser_update * 1000; if ($browser_update < 10000) { @@ -333,11 +333,11 @@ function settings_post(App $a) } } - $itemspage_network = x($_POST, 'itemspage_network') ? intval($_POST['itemspage_network']) : 40; + $itemspage_network = !empty($_POST['itemspage_network']) ? intval($_POST['itemspage_network']) : 40; if ($itemspage_network > 100) { $itemspage_network = 100; } - $itemspage_mobile_network = x($_POST, 'itemspage_mobile_network') ? intval($_POST['itemspage_mobile_network']) : 20; + $itemspage_mobile_network = !empty($_POST['itemspage_mobile_network']) ? intval($_POST['itemspage_mobile_network']) : 20; if ($itemspage_mobile_network > 100) { $itemspage_mobile_network = 100; } @@ -379,7 +379,7 @@ function settings_post(App $a) BaseModule::checkFormSecurityTokenRedirectOnError('/settings', 'settings'); - if (x($_POST,'resend_relocate')) { + if (!empty($_POST['resend_relocate'])) { Worker::add(PRIORITY_HIGH, 'Notifier', 'relocate', local_user()); info(L10n::t("Relocate message has been send to your contacts")); $a->internalRedirect('settings'); @@ -387,7 +387,7 @@ function settings_post(App $a) Addon::callHooks('settings_post', $_POST); - if (x($_POST, 'password') || x($_POST, 'confirm')) { + if (!empty($_POST['password']) || !empty($_POST['confirm'])) { $newpass = $_POST['password']; $confirm = $_POST['confirm']; @@ -397,7 +397,7 @@ function settings_post(App $a) $err = true; } - if (!x($newpass) || !x($confirm)) { + if (empty($newpass) || empty($confirm)) { notice(L10n::t('Empty passwords are not allowed. Password unchanged.') . EOL); $err = true; } @@ -423,35 +423,35 @@ function settings_post(App $a) } } - $username = ((x($_POST, 'username')) ? Strings::escapeTags(trim($_POST['username'])) : ''); - $email = ((x($_POST, 'email')) ? Strings::escapeTags(trim($_POST['email'])) : ''); - $timezone = ((x($_POST, 'timezone')) ? Strings::escapeTags(trim($_POST['timezone'])) : ''); - $language = ((x($_POST, 'language')) ? Strings::escapeTags(trim($_POST['language'])) : ''); + $username = (!empty($_POST['username']) ? Strings::escapeTags(trim($_POST['username'])) : ''); + $email = (!empty($_POST['email']) ? Strings::escapeTags(trim($_POST['email'])) : ''); + $timezone = (!empty($_POST['timezone']) ? Strings::escapeTags(trim($_POST['timezone'])) : ''); + $language = (!empty($_POST['language']) ? Strings::escapeTags(trim($_POST['language'])) : ''); - $defloc = ((x($_POST, 'defloc')) ? Strings::escapeTags(trim($_POST['defloc'])) : ''); - $openid = ((x($_POST, 'openid_url')) ? Strings::escapeTags(trim($_POST['openid_url'])) : ''); - $maxreq = ((x($_POST, 'maxreq')) ? intval($_POST['maxreq']) : 0); - $expire = ((x($_POST, 'expire')) ? intval($_POST['expire']) : 0); - $def_gid = ((x($_POST, 'group-selection')) ? intval($_POST['group-selection']) : 0); + $defloc = (!empty($_POST['defloc']) ? Strings::escapeTags(trim($_POST['defloc'])) : ''); + $openid = (!empty($_POST['openid_url']) ? Strings::escapeTags(trim($_POST['openid_url'])) : ''); + $maxreq = (!empty($_POST['maxreq']) ? intval($_POST['maxreq']) : 0); + $expire = (!empty($_POST['expire']) ? intval($_POST['expire']) : 0); + $def_gid = (!empty($_POST['group-selection']) ? intval($_POST['group-selection']) : 0); - $expire_items = ((x($_POST, 'expire_items')) ? intval($_POST['expire_items']) : 0); - $expire_notes = ((x($_POST, 'expire_notes')) ? intval($_POST['expire_notes']) : 0); - $expire_starred = ((x($_POST, 'expire_starred')) ? intval($_POST['expire_starred']) : 0); - $expire_photos = ((x($_POST, 'expire_photos'))? intval($_POST['expire_photos']) : 0); - $expire_network_only = ((x($_POST, 'expire_network_only'))? intval($_POST['expire_network_only']) : 0); + $expire_items = (!empty($_POST['expire_items']) ? intval($_POST['expire_items']) : 0); + $expire_notes = (!empty($_POST['expire_notes']) ? intval($_POST['expire_notes']) : 0); + $expire_starred = (!empty($_POST['expire_starred']) ? intval($_POST['expire_starred']) : 0); + $expire_photos = (!empty($_POST['expire_photos'])? intval($_POST['expire_photos']) : 0); + $expire_network_only = (!empty($_POST['expire_network_only'])? intval($_POST['expire_network_only']) : 0); - $allow_location = (((x($_POST, 'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0); - $publish = (((x($_POST, 'profile_in_directory')) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0); - $net_publish = (((x($_POST, 'profile_in_netdirectory')) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0); - $old_visibility = (((x($_POST, 'visibility')) && (intval($_POST['visibility']) == 1)) ? 1 : 0); - $account_type = (((x($_POST, 'account-type')) && (intval($_POST['account-type']))) ? intval($_POST['account-type']) : 0); - $page_flags = (((x($_POST, 'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0); - $blockwall = (((x($_POST, 'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted! - $blocktags = (((x($_POST, 'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted! - $unkmail = (((x($_POST, 'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0); - $cntunkmail = ((x($_POST, 'cntunkmail')) ? intval($_POST['cntunkmail']) : 0); - $suggestme = ((x($_POST, 'suggestme')) ? intval($_POST['suggestme']) : 0); + $allow_location = ((!empty($_POST['allow_location']) && (intval($_POST['allow_location']) == 1)) ? 1: 0); + $publish = ((!empty($_POST['profile_in_directory']) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0); + $net_publish = ((!empty($_POST['profile_in_netdirectory']) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0); + $old_visibility = ((!empty($_POST['visibility']) && (intval($_POST['visibility']) == 1)) ? 1 : 0); + $account_type = ((!empty($_POST['account-type']) && (intval($_POST['account-type']))) ? intval($_POST['account-type']) : 0); + $page_flags = ((!empty($_POST['page-flags']) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0); + $blockwall = ((!empty($_POST['blockwall']) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted! + $blocktags = ((!empty($_POST['blocktags']) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted! + $unkmail = ((!empty($_POST['unkmail']) && (intval($_POST['unkmail']) == 1)) ? 1: 0); + $cntunkmail = (!empty($_POST['cntunkmail']) ? intval($_POST['cntunkmail']) : 0); + $suggestme = (!empty($_POST['suggestme']) ? intval($_POST['suggestme']) : 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hidewall = (($_POST['hidewall'] == 1) ? 1: 0); @@ -460,28 +460,28 @@ function settings_post(App $a) $notify = 0; - if (x($_POST, 'notify1')) { + if (!empty($_POST['notify1'])) { $notify += intval($_POST['notify1']); } - if (x($_POST, 'notify2')) { + if (!empty($_POST['notify2'])) { $notify += intval($_POST['notify2']); } - if (x($_POST, 'notify3')) { + if (!empty($_POST['notify3'])) { $notify += intval($_POST['notify3']); } - if (x($_POST, 'notify4')) { + if (!empty($_POST['notify4'])) { $notify += intval($_POST['notify4']); } - if (x($_POST, 'notify5')) { + if (!empty($_POST['notify5'])) { $notify += intval($_POST['notify5']); } - if (x($_POST, 'notify6')) { + if (!empty($_POST['notify6'])) { $notify += intval($_POST['notify6']); } - if (x($_POST, 'notify7')) { + if (!empty($_POST['notify7'])) { $notify += intval($_POST['notify7']); } - if (x($_POST, 'notify8')) { + if (!empty($_POST['notify8'])) { $notify += intval($_POST['notify8']); } @@ -666,7 +666,7 @@ function settings_content(App $a) return Login::form(); } - if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) { + if (!empty($_SESSION['submanage'])) { notice(L10n::t('Permission denied.') . EOL); return; } @@ -796,7 +796,7 @@ function settings_content(App $a) $default_group = PConfig::get(local_user(), 'ostatus', 'default_group'); $legacy_contact = PConfig::get(local_user(), 'ostatus', 'legacy_contact'); - if (x($legacy_contact)) { + if (!empty($legacy_contact)) { /// @todo Isn't it supposed to be a $a->internalRedirect() call? $a->page['htmlhead'] = ''; } diff --git a/mod/starred.php b/mod/starred.php index 9b46b522bb..537f392023 100644 --- a/mod/starred.php +++ b/mod/starred.php @@ -33,7 +33,7 @@ function starred_init(App $a) { Item::update(['starred' => $starred], ['id' => $message_id]); // See if we've been passed a return path to redirect to - $return_path = (x($_REQUEST,'return') ? $_REQUEST['return'] : ''); + $return_path = defaults($_REQUEST, 'return', ''); if ($return_path) { $rand = '_=' . time(); if (strpos($return_path, '?')) { diff --git a/mod/subthread.php b/mod/subthread.php index b287957b23..90ab5a3aab 100644 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -89,7 +89,7 @@ function subthread_content(App $a) { $post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status')); $objtype = (($item['resource-id']) ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE ); - $link = XML::escape('' . "\n") ; + $link = XML::escape('' . "\n"); $body = $item['body']; $obj = <<< EOT diff --git a/mod/suggest.php b/mod/suggest.php index ed9f6e0f21..7f1fe3386c 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -20,7 +20,7 @@ function suggest_init(App $a) return; } - if (x($_GET,'ignore') && intval($_GET['ignore'])) { + if (!empty($_GET['ignore'])) { // Check if we should do HTML-based delete confirmation if ($_REQUEST['confirm']) { // can't take arguments in its "action" parameter diff --git a/mod/tagger.php b/mod/tagger.php index 5a8047414d..f8979ae6ca 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -78,7 +78,7 @@ function tagger_content(App $a) { $href = System::baseUrl() . '/display/' . $item['guid']; } - $link = XML::escape('' . "\n") ; + $link = XML::escape('' . "\n"); $body = XML::escape($item['body']); diff --git a/mod/tagrm.php b/mod/tagrm.php index 3785d8750a..24a41be95c 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -17,7 +17,7 @@ function tagrm_post(App $a) $a->internalRedirect($_SESSION['photo_return']); } - if (x($_POST,'submit') && ($_POST['submit'] === L10n::t('Cancel'))) { + if (!empty($_POST['submit']) && ($_POST['submit'] === L10n::t('Cancel'))) { $a->internalRedirect($_SESSION['photo_return']); } diff --git a/mod/uimport.php b/mod/uimport.php index 5df919d7d6..dfeab8a2f6 100644 --- a/mod/uimport.php +++ b/mod/uimport.php @@ -42,10 +42,10 @@ function uimport_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/unfollow.php b/mod/unfollow.php index 433a4782ff..a66c88aefd 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -114,10 +114,8 @@ function unfollow_content(App $a) // Makes the connection request for friendica contacts easier $_SESSION['fastlane'] = $contact['url']; - $header = L10n::t('Disconnect/Unfollow'); - $o = Renderer::replaceMacros($tpl, [ - '$header' => htmlentities($header), + '$header' => L10n::t('Disconnect/Unfollow'), '$desc' => '', '$pls_answer' => '', '$does_know_you' => '', diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 8b7acffbdc..d36ea96c7d 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -29,18 +29,13 @@ function viewcontacts_init(App $a) Nav::setSelected('home'); - $nick = $a->argv[1]; - $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", - DBA::escape($nick) - ); - - if (!DBA::isResult($r)) { + $user = DBA::selectFirst('user', [], ['nickname' => $a->argv[1], 'blocked' => false]); + if (!DBA::isResult($user)) { System::httpExit(404, ["title" => L10n::t('Page not found.')]); } - $a->data['user'] = $r[0]; - $a->profile_uid = $r[0]['uid']; - $is_owner = (local_user() && (local_user() == $a->profile_uid)); + $a->data['user'] = $user; + $a->profile_uid = $user['uid']; Profile::load($a, $a->argv[1]); } @@ -54,82 +49,69 @@ function viewcontacts_content(App $a) $is_owner = $a->profile['profile_uid'] == local_user(); - $o = ""; - // tabs - $o .= Profile::getTabs($a, $is_owner, $a->data['user']['nickname']); + $o = Profile::getTabs($a, $is_owner, $a->data['user']['nickname']); if (!count($a->profile) || $a->profile['hide-friends']) { notice(L10n::t('Permission denied.') . EOL); return $o; } - $total = 0; - $r = q("SELECT COUNT(*) AS `total` FROM `contact` - WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` - AND NOT `hidden` AND NOT `archive` - AND `network` IN ('%s', '%s', '%s', '%s')", - intval($a->profile['uid']), - DBA::escape(Protocol::ACTIVITYPUB), - DBA::escape(Protocol::DFRN), - DBA::escape(Protocol::DIASPORA), - DBA::escape(Protocol::OSTATUS) - ); - if (DBA::isResult($r)) { - $total = $r[0]['total']; - } + $condition = [ + 'uid' => $a->profile['uid'], + 'blocked' => false, + 'pending' => false, + 'hidden' => false, + 'archive' => false, + 'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS] + ]; + + $total = DBA::count('count', $condition); + $pager = new Pager($a->query_string); - $r = q("SELECT * FROM `contact` - WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` - AND NOT `hidden` AND NOT `archive` - AND `network` IN ('%s', '%s', '%s', '%s') - ORDER BY `name` ASC LIMIT %d, %d", - intval($a->profile['uid']), - DBA::escape(Protocol::ACTIVITYPUB), - DBA::escape(Protocol::DFRN), - DBA::escape(Protocol::DIASPORA), - DBA::escape(Protocol::OSTATUS), - $pager->getStart(), - $pager->getItemsPerPage() - ); - if (!DBA::isResult($r)) { - info(L10n::t('No contacts.').EOL); + $params = ['order' => ['name' => false], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]]; + + $contacts_stmt = DBA::select('contact', [], $condition, $params); + + if (!DBA::isResult($contacts_stmt)) { + info(L10n::t('No contacts.') . EOL); return $o; } $contacts = []; - foreach ($r as $rr) { + while ($contact = DBA::fetch($contacts_stmt)) { /// @TODO This triggers an E_NOTICE if 'self' is not there - if ($rr['self']) { + if ($contact['self']) { continue; } - $contact_details = Contact::getDetailsByURL($rr['url'], $a->profile['uid'], $rr); + $contact_details = Contact::getDetailsByURL($contact['url'], $a->profile['uid'], $contact); $contacts[] = [ - 'id' => $rr['id'], - 'img_hover' => L10n::t('Visit %s\'s profile [%s]', $contact_details['name'], $rr['url']), - 'photo_menu' => Contact::photoMenu($rr), - 'thumb' => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB), - 'name' => htmlentities(substr($contact_details['name'], 0, 20)), - 'username' => htmlentities($contact_details['name']), - 'details' => $contact_details['location'], - 'tags' => $contact_details['keywords'], - 'about' => $contact_details['about'], - 'account_type' => Contact::getAccountType($contact_details), - 'url' => Contact::magicLink($rr['url']), - 'sparkle' => '', - 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']), - 'network' => ContactSelector::networkToName($rr['network'], $rr['url']), + 'id' => $contact['id'], + 'img_hover' => L10n::t('Visit %s\'s profile [%s]', $contact_details['name'], $contact['url']), + 'photo_menu' => Contact::photoMenu($contact), + 'thumb' => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB), + 'name' => substr($contact_details['name'], 0, 20), + 'username' => $contact_details['name'], + 'details' => $contact_details['location'], + 'tags' => $contact_details['keywords'], + 'about' => $contact_details['about'], + 'account_type' => Contact::getAccountType($contact_details), + 'url' => Contact::magicLink($contact['url']), + 'sparkle' => '', + 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $contact['url']), + 'network' => ContactSelector::networkToName($contact['network'], $contact['url']), ]; } + DBA::close($contacts_stmt); $tpl = Renderer::getMarkupTemplate("viewcontact_template.tpl"); $o .= Renderer::replaceMacros($tpl, [ - '$title' => L10n::t('Contacts'), + '$title' => L10n::t('Contacts'), '$contacts' => $contacts, '$paginate' => $pager->renderFull($total), ]); diff --git a/mod/wall_attach.php b/mod/wall_attach.php index b4254ba64a..ba1a8205c5 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -15,7 +15,7 @@ use Friendica\Util\Strings; function wall_attach_post(App $a) { - $r_json = (x($_GET,'response') && $_GET['response']=='json'); + $r_json = (!empty($_GET['response']) && $_GET['response']=='json'); if ($a->argc > 1) { $nick = $a->argv[1]; @@ -85,7 +85,7 @@ function wall_attach_post(App $a) { killme(); } - if (! x($_FILES,'userfile')) { + if (empty($_FILES['userfile'])) { if ($r_json) { echo json_encode(['error' => L10n::t('Invalid request.')]); } @@ -120,7 +120,7 @@ function wall_attach_post(App $a) { if ($r_json) { echo json_encode(['error' => $msg]); } else { - echo $msg . EOL ; + echo $msg . EOL; } @unlink($src); killme(); @@ -144,7 +144,7 @@ function wall_attach_post(App $a) { if ($r_json) { echo json_encode(['error' => $msg]); } else { - echo $msg . EOL ; + echo $msg . EOL; } killme(); } @@ -160,7 +160,7 @@ function wall_attach_post(App $a) { if ($r_json) { echo json_encode(['error' => $msg]); } else { - echo $msg . EOL ; + echo $msg . EOL; } killme(); } diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 3358433da1..89655981ea 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -23,11 +23,11 @@ function wall_upload_post(App $a, $desktopmode = true) { Logger::log("wall upload: starting new upload", Logger::DEBUG); - $r_json = (x($_GET, 'response') && $_GET['response'] == 'json'); - $album = (x($_GET, 'album') ? Strings::escapeTags(trim($_GET['album'])) : ''); + $r_json = (!empty($_GET['response']) && $_GET['response'] == 'json'); + $album = (!empty($_GET['album']) ? Strings::escapeTags(trim($_GET['album'])) : ''); if ($a->argc > 1) { - if (!x($_FILES, 'media')) { + if (empty($_FILES['media'])) { $nick = $a->argv[1]; $r = q("SELECT `user`.*, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid` @@ -110,7 +110,7 @@ function wall_upload_post(App $a, $desktopmode = true) killme(); } - if (!x($_FILES, 'userfile') && !x($_FILES, 'media')) { + if (empty($_FILES['userfile']) && empty($_FILES['media'])) { if ($r_json) { echo json_encode(['error' => L10n::t('Invalid request.')]); } @@ -121,13 +121,13 @@ function wall_upload_post(App $a, $desktopmode = true) $filename = ''; $filesize = 0; $filetype = ''; - if (x($_FILES, 'userfile')) { + if (!empty($_FILES['userfile'])) { $src = $_FILES['userfile']['tmp_name']; $filename = basename($_FILES['userfile']['name']); $filesize = intval($_FILES['userfile']['size']); $filetype = $_FILES['userfile']['type']; - } elseif (x($_FILES, 'media')) { + } elseif (!empty($_FILES['media'])) { if (!empty($_FILES['media']['tmp_name'])) { if (is_array($_FILES['media']['tmp_name'])) { $src = $_FILES['media']['tmp_name'][0]; diff --git a/mod/wallmessage.php b/mod/wallmessage.php index b7a62b3ad4..780230b8c7 100644 --- a/mod/wallmessage.php +++ b/mod/wallmessage.php @@ -20,8 +20,8 @@ function wallmessage_post(App $a) { return; } - $subject = ((x($_REQUEST,'subject')) ? Strings::escapeTags(trim($_REQUEST['subject'])) : ''); - $body = ((x($_REQUEST,'body')) ? Strings::escapeHtml(trim($_REQUEST['body'])) : ''); + $subject = (!empty($_REQUEST['subject']) ? Strings::escapeTags(trim($_REQUEST['subject'])) : ''); + $body = (!empty($_REQUEST['body']) ? Strings::escapeHtml(trim($_REQUEST['body'])) : ''); $recipient = (($a->argc > 1) ? Strings::escapeTags($a->argv[1]) : ''); if ((! $recipient) || (! $body)) { @@ -125,20 +125,20 @@ function wallmessage_content(App $a) { $tpl = Renderer::getMarkupTemplate('wallmessage.tpl'); $o = Renderer::replaceMacros($tpl, [ - '$header' => L10n::t('Send Private Message'), - '$subheader' => L10n::t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.', $user['username']), - '$to' => L10n::t('To:'), - '$subject' => L10n::t('Subject:'), - '$recipname' => $user['username'], - '$nickname' => $user['nickname'], - '$subjtxt' => ((x($_REQUEST, 'subject')) ? strip_tags($_REQUEST['subject']) : ''), - '$text' => ((x($_REQUEST, 'body')) ? Strings::escapeHtml(htmlspecialchars($_REQUEST['body'])) : ''), - '$readonly' => '', - '$yourmessage' => L10n::t('Your message:'), - '$parent' => '', - '$upload' => L10n::t('Upload photo'), - '$insert' => L10n::t('Insert web link'), - '$wait' => L10n::t('Please wait') + '$header' => L10n::t('Send Private Message'), + '$subheader' => L10n::t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.', $user['username']), + '$to' => L10n::t('To:'), + '$subject' => L10n::t('Subject:'), + '$recipname' => $user['username'], + '$nickname' => $user['nickname'], + '$subjtxt' => defaults($_REQUEST, 'subject', ''), + '$text' => defaults($_REQUEST, 'body', ''), + '$readonly' => '', + '$yourmessage'=> L10n::t('Your message:'), + '$parent' => '', + '$upload' => L10n::t('Upload photo'), + '$insert' => L10n::t('Insert web link'), + '$wait' => L10n::t('Please wait') ]); return $o; diff --git a/mod/webfinger.php b/mod/webfinger.php index 4f23db6d8f..a48d2dba6b 100644 --- a/mod/webfinger.php +++ b/mod/webfinger.php @@ -20,7 +20,8 @@ function webfinger_content(App $a) killme(); } - $o = '

    Webfinger Diagnostic

    '; + $o = '
    '; + $o .= '

    Webfinger Diagnostic

    '; $o .= ''; $o .= 'Lookup address: '; @@ -28,12 +29,14 @@ function webfinger_content(App $a) $o .= '

    '; - if (x($_GET, 'addr')) { + if (!empty($_GET['addr'])) { $addr = trim($_GET['addr']); $res = Probe::lrdd($addr); $o .= '
    ';
     		$o .= str_replace("\n", '
    ', print_r($res, true)); $o .= '
    '; } + $o .= '
    '; + return $o; } diff --git a/mods/sample-nginx.config b/mods/sample-nginx.config index d6afe71746..71d3785516 100644 --- a/mods/sample-nginx.config +++ b/mods/sample-nginx.config @@ -91,7 +91,7 @@ server { # by denying dot files and rewrite request to the front controller location ^~ /.well-known/ { allow all; - try_files $uri /index.php?pagename=$uri&$args; + rewrite ^ /index.php?pagename=$uri; } include mime.types; diff --git a/spec/dfrn2_contact_request.svg b/spec/dfrn2_contact_request.svg index 34de340f33..d32718271b 100644 --- a/spec/dfrn2_contact_request.svg +++ b/spec/dfrn2_contact_request.svg @@ -80,7 +80,7 @@ text { font:12px Dialog; } ($_POST['localconfirm'] == 1) ----------------------------------------------------------------------- - if(local_user() && ($a->user['nickname'] == $a- ->argv[1]) && (x($_POST,'dfrn_url'))) +>argv[1]) && !empty($_POST['dfrn_url'])) -> - $confirm_key comes from $_POST - get data for contact Karen (contact table) by @@ -104,7 +104,7 @@ text { font:12px Dialog; } http://karenhomepage.com/dfrn_request?confirm_key=”ABC123” dfrn_request_content() - -(elseif((x($_GET,'confirm_key')) && strlen($_GET['confirm_key'])) ) +elseif (!empty($_GET['confirm_key'])) ---------------------------------------------------------------------------------------------- - select the intro by confirm_key (intro table) -> get contact id - use the intro contact id to get the contact in the contact table diff --git a/src/App.php b/src/App.php index 845560a4d6..261c3e74cb 100644 --- a/src/App.php +++ b/src/App.php @@ -523,7 +523,7 @@ class App if (!empty($relative_script_path)) { // Module if (!empty($_SERVER['QUERY_STRING'])) { - $path = trim(dirname($relative_script_path, substr_count(trim($_SERVER['QUERY_STRING'], '/'), '/') + 1), '/'); + $path = trim(rdirname($relative_script_path, substr_count(trim($_SERVER['QUERY_STRING'], '/'), '/') + 1), '/'); } else { // Root page $path = trim($relative_script_path, '/'); @@ -549,7 +549,7 @@ class App // Use environment variables for mysql if they are set beforehand if (!empty(getenv('MYSQL_HOST')) - && (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER'))) + && !empty(getenv('MYSQL_USERNAME') || !empty(getenv('MYSQL_USER'))) && getenv('MYSQL_PASSWORD') !== false && !empty(getenv('MYSQL_DATABASE'))) { @@ -668,7 +668,7 @@ class App $this->hostname = Core\Config::get('config', 'hostname'); } - return $scheme . '://' . $this->hostname . (!empty($this->getURLPath()) ? '/' . $this->getURLPath() : '' ); + return $scheme . '://' . $this->hostname . !empty($this->getURLPath() ? '/' . $this->getURLPath() : '' ); } /** @@ -1880,7 +1880,7 @@ class App */ public function internalRedirect($toUrl = '', $ssl = false) { - if (filter_var($toUrl, FILTER_VALIDATE_URL)) { + if (!empty(parse_url($toUrl, PHP_URL_SCHEME))) { throw new InternalServerErrorException("'$toUrl is not a relative path, please use System::externalRedirectTo"); } @@ -1897,7 +1897,7 @@ class App */ public function redirect($toUrl) { - if (filter_var($toUrl, FILTER_VALIDATE_URL)) { + if (!empty(parse_url($toUrl, PHP_URL_SCHEME))) { Core\System::externalRedirect($toUrl); } else { $this->internalRedirect($toUrl); diff --git a/src/Content/Nav.php b/src/Content/Nav.php index b8691e9340..5166d5848e 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -58,7 +58,7 @@ class Nav public static function build(App $a) { // Placeholder div for popup panel - $nav = '' ; + $nav = ''; $nav_info = self::getInfo($a); @@ -170,7 +170,7 @@ class Nav // "Home" should also take you home from an authenticated remote profile connection $homelink = Profile::getMyURL(); if (! $homelink) { - $homelink = ((x($_SESSION, 'visitor_home')) ? $_SESSION['visitor_home'] : ''); + $homelink = defaults($_SESSION, 'visitor_home', ''); } if (($a->module != 'home') && (! (local_user()))) { @@ -234,7 +234,7 @@ class Nav // The following nav links are only show to logged in users if (local_user()) { $nav['network'] = ['network', L10n::t('Network'), '', L10n::t('Conversations from your friends')]; - $nav['net_reset'] = ['network/0?f=&order=comment&nets=all', L10n::t('Network Reset'), '', L10n::t('Load Network page with no filters')]; + $nav['net_reset'] = ['network/?f=', L10n::t('Network Reset'), '', L10n::t('Load Network page with no filters')]; $nav['home'] = ['profile/' . $a->user['nickname'], L10n::t('Home'), '', L10n::t('Your posts and conversations')]; diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index c37e36f607..6eb11c7b3b 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -308,12 +308,12 @@ class OEmbed } $domain = parse_url($url, PHP_URL_HOST); - if (!x($domain)) { + if (empty($domain)) { return false; } $str_allowed = Config::get('system', 'allowed_oembed', ''); - if (!x($str_allowed)) { + if (empty($str_allowed)) { return false; } @@ -334,7 +334,7 @@ class OEmbed throw new Exception('OEmbed failed for URL: ' . $url); } - if (x($title)) { + if (!empty($title)) { $o->title = $title; } diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index cb375dcd21..6d2b152ee8 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -130,12 +130,12 @@ class BBCode extends BaseObject $type = ""; preg_match("/type='(.*?)'/ism", $attributes, $matches); - if (x($matches, 1)) { + if (!empty($matches[1])) { $type = strtolower($matches[1]); } preg_match('/type="(.*?)"/ism', $attributes, $matches); - if (x($matches, 1)) { + if (!empty($matches[1])) { $type = strtolower($matches[1]); } @@ -153,12 +153,12 @@ class BBCode extends BaseObject $url = ""; preg_match("/url='(.*?)'/ism", $attributes, $matches); - if (x($matches, 1)) { + if (!empty($matches[1])) { $url = $matches[1]; } preg_match('/url="(.*?)"/ism', $attributes, $matches); - if (x($matches, 1)) { + if (!empty($matches[1])) { $url = $matches[1]; } @@ -168,12 +168,12 @@ class BBCode extends BaseObject $title = ""; preg_match("/title='(.*?)'/ism", $attributes, $matches); - if (x($matches, 1)) { + if (!empty($matches[1])) { $title = $matches[1]; } preg_match('/title="(.*?)"/ism', $attributes, $matches); - if (x($matches, 1)) { + if (!empty($matches[1])) { $title = $matches[1]; } @@ -186,12 +186,12 @@ class BBCode extends BaseObject $image = ""; preg_match("/image='(.*?)'/ism", $attributes, $matches); - if (x($matches, 1)) { + if (!empty($matches[1])) { $image = $matches[1]; } preg_match('/image="(.*?)"/ism', $attributes, $matches); - if (x($matches, 1)) { + if (!empty($matches[1])) { $image = $matches[1]; } @@ -201,12 +201,12 @@ class BBCode extends BaseObject $preview = ""; preg_match("/preview='(.*?)'/ism", $attributes, $matches); - if (x($matches, 1)) { + if (!empty($matches[1])) { $preview = $matches[1]; } preg_match('/preview="(.*?)"/ism', $attributes, $matches); - if (x($matches, 1)) { + if (!empty($matches[1])) { $preview = $matches[1]; } @@ -234,7 +234,7 @@ class BBCode extends BaseObject */ $has_title = !empty($item['title']); - $plink = (!empty($item['plink']) ? $item['plink'] : ''); + $plink = defaults($item, 'plink', ''); $post = self::getAttachmentData($body); // if nothing is found, it maybe having an image. @@ -626,7 +626,7 @@ class BBCode extends BaseObject $data["title"] = $data["url"]; } - if (($data["text"] == "") && ($data["title"] != "") && ($data["url"] == "")) { + if (empty($data["text"]) && !empty($data["title"]) && empty($data["url"])) { return $data["title"] . $data["after"]; } @@ -1662,7 +1662,7 @@ class BBCode extends BaseObject // Summary (e.g. title) is required, earlier revisions only required description (in addition to // start which is always required). Allow desc with a missing summary for compatibility. - if ((x($ev, 'desc') || x($ev, 'summary')) && x($ev, 'start')) { + if ((!empty($ev['desc']) || !empty($ev['summary'])) && !empty($ev['start'])) { $sub = Event::getHTML($ev, $simple_html); $text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism", '', $text); diff --git a/src/Content/Text/HTML.php b/src/Content/Text/HTML.php index 6451b74faa..276094a8f9 100644 --- a/src/Content/Text/HTML.php +++ b/src/Content/Text/HTML.php @@ -908,7 +908,7 @@ class HTML public static function micropro($contact, $redirect = false, $class = '', $textmode = false) { // Use the contact URL if no address is available - if (!x($contact, "addr")) { + if (empty($contact['addr'])) { $contact["addr"] = $contact["url"]; } @@ -924,7 +924,7 @@ class HTML } // If there is some js available we don't need the url - if (x($contact, 'click')) { + if (!empty($contact['click'])) { $url = ''; } @@ -961,7 +961,7 @@ class HTML $save_label = $mode === 'text' ? L10n::t('Save') : L10n::t('Follow'); $values = [ - '$s' => htmlspecialchars($s), + '$s' => $s, '$id' => $id, '$action_url' => $url, '$search_label' => L10n::t('Search'), diff --git a/src/Core/Authentication.php b/src/Core/Authentication.php index 50825c525e..ca5ec3fd08 100644 --- a/src/Core/Authentication.php +++ b/src/Core/Authentication.php @@ -106,7 +106,7 @@ class Authentication extends BaseObject $masterUid = $user_record['uid']; - if ((x($_SESSION, 'submanage')) && intval($_SESSION['submanage'])) { + if (!empty($_SESSION['submanage'])) { $user = DBA::selectFirst('user', ['uid'], ['uid' => $_SESSION['submanage']]); if (DBA::isResult($user)) { $masterUid = $user['uid']; diff --git a/src/Core/Console/AutomaticInstallation.php b/src/Core/Console/AutomaticInstallation.php index 150b7e52a7..e6065dfb87 100644 --- a/src/Core/Console/AutomaticInstallation.php +++ b/src/Core/Console/AutomaticInstallation.php @@ -119,11 +119,11 @@ HELP; $db_data = $this->getOption(['d', 'dbdata'], ($save_db) ? getenv('MYSQL_DATABASE') : ''); $db_user = $this->getOption(['U', 'dbuser'], ($save_db) ? getenv('MYSQL_USER') . getenv('MYSQL_USERNAME') : ''); $db_pass = $this->getOption(['P', 'dbpass'], ($save_db) ? getenv('MYSQL_PASSWORD') : ''); - $url_path = $this->getOption(['u', 'urlpath'], (!empty('FRIENDICA_URL_PATH')) ? getenv('FRIENDICA_URL_PATH') : null); - $php_path = $this->getOption(['b', 'phppath'], (!empty('FRIENDICA_PHP_PATH')) ? getenv('FRIENDICA_PHP_PATH') : null); - $admin_mail = $this->getOption(['A', 'admin'], (!empty('FRIENDICA_ADMIN_MAIL')) ? getenv('FRIENDICA_ADMIN_MAIL') : ''); - $tz = $this->getOption(['T', 'tz'], (!empty('FRIENDICA_TZ')) ? getenv('FRIENDICA_TZ') : ''); - $lang = $this->getOption(['L', 'lang'], (!empty('FRIENDICA_LANG')) ? getenv('FRIENDICA_LANG') : ''); + $url_path = $this->getOption(['u', 'urlpath'], !empty('FRIENDICA_URL_PATH') ? getenv('FRIENDICA_URL_PATH') : null); + $php_path = $this->getOption(['b', 'phppath'], !empty('FRIENDICA_PHP_PATH') ? getenv('FRIENDICA_PHP_PATH') : null); + $admin_mail = $this->getOption(['A', 'admin'], !empty('FRIENDICA_ADMIN_MAIL') ? getenv('FRIENDICA_ADMIN_MAIL') : ''); + $tz = $this->getOption(['T', 'tz'], !empty('FRIENDICA_TZ') ? getenv('FRIENDICA_TZ') : ''); + $lang = $this->getOption(['L', 'lang'], !empty('FRIENDICA_LANG') ? getenv('FRIENDICA_LANG') : ''); if (empty($php_path)) { $php_path = $installer->getPHPPath(); @@ -132,7 +132,7 @@ HELP; $installer->createConfig( $php_path, $url_path, - ((!empty($db_port)) ? $db_host . ':' . $db_port : $db_host), + (!empty($db_port) ? $db_host . ':' . $db_port : $db_host), $db_user, $db_pass, $db_data, diff --git a/src/Core/Installer.php b/src/Core/Installer.php index 2fd04523d9..4c30c94b04 100644 --- a/src/Core/Installer.php +++ b/src/Core/Installer.php @@ -440,6 +440,13 @@ class Installer ); $returnVal = $returnVal ? $status : false; + $status = $this->checkFunction('json_encode', + L10n::t('JSON PHP module'), + L10n::t('Error: JSON PHP module required but not installed.'), + true + ); + $returnVal = $returnVal ? $status : false; + return $returnVal; } diff --git a/src/Core/NotificationsManager.php b/src/Core/NotificationsManager.php index 19aae2b823..d11fea03a1 100644 --- a/src/Core/NotificationsManager.php +++ b/src/Core/NotificationsManager.php @@ -643,7 +643,7 @@ class NotificationsManager extends BaseObject 'madeby_zrl' => Contact::magicLink($it['url']), 'madeby_addr' => $it['addr'], 'contact_id' => $it['contact-id'], - 'photo' => ((x($it, 'fphoto')) ? ProxyUtils::proxifyUrl($it['fphoto'], false, ProxyUtils::SIZE_SMALL) : "images/person-300.jpg"), + 'photo' => (!empty($it['fphoto']) ? ProxyUtils::proxifyUrl($it['fphoto'], false, ProxyUtils::SIZE_SMALL) : "images/person-300.jpg"), 'name' => $it['fname'], 'url' => $it['furl'], 'zrl' => Contact::magicLink($it['furl']), @@ -675,7 +675,7 @@ class NotificationsManager extends BaseObject 'uid' => $_SESSION['uid'], 'intro_id' => $it['intro_id'], 'contact_id' => $it['contact-id'], - 'photo' => ((x($it, 'photo')) ? ProxyUtils::proxifyUrl($it['photo'], false, ProxyUtils::SIZE_SMALL) : "images/person-300.jpg"), + 'photo' => (!empty($it['photo']) ? ProxyUtils::proxifyUrl($it['photo'], false, ProxyUtils::SIZE_SMALL) : "images/person-300.jpg"), 'name' => $it['name'], 'location' => BBCode::convert($it['glocation'], false), 'about' => BBCode::convert($it['gabout'], false), diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php index 44b56fcba3..2ca91b4b6c 100644 --- a/src/Core/Renderer.php +++ b/src/Core/Renderer.php @@ -48,29 +48,29 @@ class Renderer extends BaseObject 'internal' => '', 'smarty3' => '}}' ]; - - /** - * @brief This is our template processor - * - * @param string|FriendicaSmarty $s The string requiring macro substitution or an instance of FriendicaSmarty - * @param array $r key value pairs (search => replace) - * - * @return string substituted string - */ - public static function replaceMacros($s, $r) + + /** + * @brief This is our template processor + * + * @param string|FriendicaSmarty $s The string requiring macro substitution or an instance of FriendicaSmarty + * @param array $vars key value pairs (search => replace) + * + * @return string substituted string + */ + public static function replaceMacros($s, $vars) { $stamp1 = microtime(true); $a = self::getApp(); // pass $baseurl to all templates - $r['$baseurl'] = System::baseUrl(); + $vars['$baseurl'] = System::baseUrl(); $t = self::getTemplateEngine(); try { - $output = $t->replaceMacros($s, $r); + $output = $t->replaceMacros($s, $vars); } catch (Exception $e) { echo "
    " . __FUNCTION__ . ": " . $e->getMessage() . "
    "; - killme(); + exit(); } $a->saveTimestamp($stamp1, "rendering"); diff --git a/src/Core/Session/DatabaseSessionHandler.php b/src/Core/Session/DatabaseSessionHandler.php index 91788588fa..c4f23b1bfc 100644 --- a/src/Core/Session/DatabaseSessionHandler.php +++ b/src/Core/Session/DatabaseSessionHandler.php @@ -26,7 +26,7 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa public function read($session_id) { - if (!x($session_id)) { + if (empty($session_id)) { return ''; } diff --git a/src/Core/System.php b/src/Core/System.php index d24581e996..3bd06bc191 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -126,9 +126,33 @@ class System extends BaseObject { $err = ''; if ($val >= 400) { - $err = 'Error'; - if (!isset($description["title"])) { - $description["title"] = $err." ".$val; + if (!empty($description['title'])) { + $err = $description['title']; + } else { + $title = [ + '400' => L10n::t('Error 400 - Bad Request'), + '401' => L10n::t('Error 401 - Unauthorized'), + '403' => L10n::t('Error 403 - Forbidden'), + '404' => L10n::t('Error 404 - Not Found'), + '500' => L10n::t('Error 500 - Internal Server Error'), + '503' => L10n::t('Error 503 - Service Unavailable'), + ]; + $err = defaults($title, $val, 'Error ' . $val); + $description['title'] = $err; + } + if (empty($description['description'])) { + // Explanations are taken from https://en.wikipedia.org/wiki/List_of_HTTP_status_codes + $explanation = [ + '400' => L10n::t('The server cannot or will not process the request due to an apparent client error.'), + '401' => L10n::t('Authentication is required and has failed or has not yet been provided.'), + '403' => L10n::t('The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource, or may need an account.'), + '404' => L10n::t('The requested resource could not be found but may be available in the future.'), + '500' => L10n::t('An unexpected condition was encountered and no more specific message is suitable.'), + '503' => L10n::t('The server is currently unavailable (because it is overloaded or down for maintenance). Please try again later.'), + ]; + if (!empty($explanation[$val])) { + $description['description'] = $explanation[$val]; + } } } @@ -248,7 +272,7 @@ class System extends BaseObject */ public static function externalRedirect($url) { - if (!filter_var($url, FILTER_VALIDATE_URL)) { + if (empty(parse_url($url, PHP_URL_SCHEME))) { throw new InternalServerErrorException("'$url' is not a fully qualified URL, please use App->internalRedirect() instead"); } diff --git a/src/Core/Update.php b/src/Core/Update.php index 252ea8ef31..7b2624cb9c 100644 --- a/src/Core/Update.php +++ b/src/Core/Update.php @@ -18,6 +18,10 @@ class Update */ public static function check($via_worker) { + if (!DBA::connected()) { + return; + } + $build = Config::get('system', 'build'); if (empty($build)) { @@ -118,6 +122,8 @@ class Update Lock::release('dbupdate'); } } + } elseif ($force) { + DBStructure::update($verbose, true); } return ''; diff --git a/src/Core/UserImport.php b/src/Core/UserImport.php index 1e2693a944..70d93b0cc0 100644 --- a/src/Core/UserImport.php +++ b/src/Core/UserImport.php @@ -105,7 +105,7 @@ class UserImport } - if (!x($account, 'version')) { + if (empty($account['version'])) { notice(L10n::t("Error! No version data in file! This is not a Friendica account file?")); return; } diff --git a/src/Database/DBA.php b/src/Database/DBA.php index bf3004ead4..af0c25d0dd 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -1044,12 +1044,11 @@ class DBA * @param array $options * - cascade: If true we delete records in other tables that depend on the one we're deleting through * relations (default: true) - * @param boolean $in_process Internal use: Only do a commit after the last delete * @param array $callstack Internal use: prevent endless loops * - * @return boolean|array was the delete successful? When $in_process is set: deletion data + * @return boolean was the delete successful? */ - public static function delete($table, array $conditions, array $options = [], $in_process = false, array &$callstack = []) + public static function delete($table, array $conditions, array $options = [], array &$callstack = []) { if (empty($table) || empty($conditions)) { Logger::log('Table and conditions have to be set'); @@ -1098,22 +1097,18 @@ class DBA if ((count($conditions) == 1) && ($field == array_keys($conditions)[0])) { foreach ($rel_def AS $rel_table => $rel_fields) { foreach ($rel_fields AS $rel_field) { - $retval = self::delete($rel_table, [$rel_field => array_values($conditions)[0]], $options, true, $callstack); - $commands = array_merge($commands, $retval); + $retval = self::delete($rel_table, [$rel_field => array_values($conditions)[0]], $options, $callstack); } } // We quit when this key already exists in the callstack. } elseif (!isset($callstack[$qkey])) { - $callstack[$qkey] = true; // Fetch all rows that are to be deleted $data = self::select($table, [$field], $conditions); while ($row = self::fetch($data)) { - // Now we accumulate the delete commands - $retval = self::delete($table, [$field => $row[$field]], $options, true, $callstack); - $commands = array_merge($commands, $retval); + self::delete($table, [$field => $row[$field]], $options, $callstack); } self::close($data); @@ -1123,74 +1118,70 @@ class DBA } } - if (!$in_process) { - // Now we finalize the process - $do_transaction = !self::$in_transaction; + // Now we finalize the process + $do_transaction = !self::$in_transaction; - if ($do_transaction) { - self::transaction(); + if ($do_transaction) { + self::transaction(); + } + + $compacted = []; + $counter = []; + + foreach ($commands AS $command) { + $conditions = $command['conditions']; + reset($conditions); + $first_key = key($conditions); + + $condition_string = self::buildCondition($conditions); + + if ((count($command['conditions']) > 1) || is_int($first_key)) { + $sql = "DELETE FROM `" . $command['table'] . "`" . $condition_string; + Logger::log(self::replaceParameters($sql, $conditions), Logger::DATA); + + if (!self::e($sql, $conditions)) { + if ($do_transaction) { + self::rollback(); + } + return false; + } + } else { + $key_table = $command['table']; + $key_condition = array_keys($command['conditions'])[0]; + $value = array_values($command['conditions'])[0]; + + // Split the SQL queries in chunks of 100 values + // We do the $i stuff here to make the code better readable + $i = isset($counter[$key_table][$key_condition]) ? $counter[$key_table][$key_condition] : 0; + if (isset($compacted[$key_table][$key_condition][$i]) && count($compacted[$key_table][$key_condition][$i]) > 100) { + ++$i; + } + + $compacted[$key_table][$key_condition][$i][$value] = $value; + $counter[$key_table][$key_condition] = $i; } + } + foreach ($compacted AS $table => $values) { + foreach ($values AS $field => $field_value_list) { + foreach ($field_value_list AS $field_values) { + $sql = "DELETE FROM `" . $table . "` WHERE `" . $field . "` IN (" . + substr(str_repeat("?, ", count($field_values)), 0, -2) . ");"; - $compacted = []; - $counter = []; + Logger::log(self::replaceParameters($sql, $field_values), Logger::DATA); - foreach ($commands AS $command) { - $conditions = $command['conditions']; - reset($conditions); - $first_key = key($conditions); - - $condition_string = self::buildCondition($conditions); - - if ((count($command['conditions']) > 1) || is_int($first_key)) { - $sql = "DELETE FROM `" . $command['table'] . "`" . $condition_string; - Logger::log(self::replaceParameters($sql, $conditions), Logger::DATA); - - if (!self::e($sql, $conditions)) { + if (!self::e($sql, $field_values)) { if ($do_transaction) { self::rollback(); } return false; } - } else { - $key_table = $command['table']; - $key_condition = array_keys($command['conditions'])[0]; - $value = array_values($command['conditions'])[0]; - - // Split the SQL queries in chunks of 100 values - // We do the $i stuff here to make the code better readable - $i = isset($counter[$key_table][$key_condition]) ? $counter[$key_table][$key_condition] : 0; - if (isset($compacted[$key_table][$key_condition][$i]) && count($compacted[$key_table][$key_condition][$i]) > 100) { - ++$i; - } - - $compacted[$key_table][$key_condition][$i][$value] = $value; - $counter[$key_table][$key_condition] = $i; } } - foreach ($compacted AS $table => $values) { - foreach ($values AS $field => $field_value_list) { - foreach ($field_value_list AS $field_values) { - $sql = "DELETE FROM `" . $table . "` WHERE `" . $field . "` IN (" . - substr(str_repeat("?, ", count($field_values)), 0, -2) . ");"; - - Logger::log(self::replaceParameters($sql, $field_values), Logger::DATA); - - if (!self::e($sql, $field_values)) { - if ($do_transaction) { - self::rollback(); - } - return false; - } - } - } - } - if ($do_transaction) { - self::commit(); - } - return true; } - - return $commands; + if ($do_transaction) { + self::commit(); + } + return true; } /** diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index b5e444020a..92666edb89 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -538,7 +538,7 @@ class DBStructure $primary_keys = []; foreach ($structure["fields"] AS $fieldname => $field) { $sql_rows[] = "`".DBA::escape($fieldname)."` ".self::FieldCommand($field); - if (x($field,'primary') && $field['primary']!='') { + if (!empty($field['primary'])) { $primary_keys[] = $fieldname; } } diff --git a/src/Model/Contact.php b/src/Model/Contact.php index bb6fc25851..5894814ea6 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -98,6 +98,48 @@ class Contact extends BaseObject * @} */ + /** + * @brief Tests if the given contact is a follower + * + * @param int $cid Either public contact id or user's contact id + * @param int $uid User ID + * + * @return boolean is the contact id a follower? + */ + public static function isFollower($cid, $uid) + { + if (self::isBlockedByUser($cid, $uid)) { + return false; + } + + $cdata = self::getPublicAndUserContacID($cid, $uid); + if (empty($cdata['user'])) { + return false; + } + + $condition = ['id' => $cdata['user'], 'rel' => [self::FOLLOWER, self::FRIEND]]; + return DBA::exists('contact', $condition); + } + + /** + * @brief Get the basepath for a given contact link + * @todo Add functionality to store this value in the contact table + * + * @param string $url The contact link + * + * @return string basepath + */ + public static function getBasepath($url) + { + $data = Probe::uri($url); + if (!empty($data['baseurl'])) { + return $data['baseurl']; + } + + // When we can't probe the server, we use some ugly function that does some pattern matching + return PortableContact::detectServer($url); + } + /** * @brief Returns the contact id for the user and the public contact id for a given contact id * @@ -106,7 +148,7 @@ class Contact extends BaseObject * * @return array with public and user's contact id */ - private static function getPublicAndUserContacID($cid, $uid) + public static function getPublicAndUserContacID($cid, $uid) { if (empty($uid) || empty($cid)) { return []; @@ -418,7 +460,8 @@ class Contact extends BaseObject public static function updateSelfFromUserID($uid, $update_avatar = false) { $fields = ['id', 'name', 'nick', 'location', 'about', 'keywords', 'gender', 'avatar', - 'xmpp', 'contact-type', 'forum', 'prv', 'avatar-date', 'nurl']; + 'xmpp', 'contact-type', 'forum', 'prv', 'avatar-date', 'url', 'nurl', + 'photo', 'thumb', 'micro', 'addr', 'request', 'notify', 'poll', 'confirm', 'poco']; $self = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]); if (!DBA::isResult($self)) { return; @@ -481,15 +524,15 @@ class Contact extends BaseObject $fields['nurl'] = Strings::normaliseLink($fields['url']); $fields['addr'] = $user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3); $fields['request'] = System::baseUrl() . '/dfrn_request/' . $user['nickname']; - $fields['notify'] = System::baseUrl() . '/dfrn_notify/' . $user['nickname']; - $fields['poll'] = System::baseUrl() . '/dfrn_poll/' . $user['nickname']; + $fields['notify'] = System::baseUrl() . '/dfrn_notify/' . $user['nickname']; + $fields['poll'] = System::baseUrl() . '/dfrn_poll/'. $user['nickname']; $fields['confirm'] = System::baseUrl() . '/dfrn_confirm/' . $user['nickname']; - $fields['poco'] = System::baseUrl() . '/poco/' . $user['nickname']; + $fields['poco'] = System::baseUrl() . '/poco/' . $user['nickname']; $update = false; foreach ($fields as $field => $content) { - if (isset($self[$field]) && $self[$field] != $content) { + if ($self[$field] != $content) { $update = true; } } @@ -1061,7 +1104,7 @@ class Contact extends BaseObject $update_contact = ($contact['avatar-date'] < DateTimeFormat::utc('now -7 days')); // We force the update if the avatar is empty - if (!x($contact, 'avatar')) { + if (empty($contact['avatar'])) { $update_contact = true; } if (!$update_contact || $no_update) { @@ -1147,7 +1190,7 @@ class Contact extends BaseObject $url = $data["url"]; if (!$contact_id) { - DBA::insert('contact', [ + $fields = [ 'uid' => $uid, 'created' => DateTimeFormat::utcNow(), 'url' => $data["url"], @@ -1176,10 +1219,13 @@ class Contact extends BaseObject 'writable' => 1, 'blocked' => 0, 'readonly' => 0, - 'pending' => 0] - ); + 'pending' => 0]; - $s = DBA::select('contact', ['id'], ['nurl' => Strings::normaliseLink($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]); + $condition = ['nurl' => Strings::normaliseLink($data["url"]), 'uid' => $uid, 'deleted' => false]; + + DBA::update('contact', $fields, $condition, true); + + $s = DBA::select('contact', ['id'], $condition, ['order' => ['id'], 'limit' => 2]); $contacts = DBA::toArray($s); if (!DBA::isResult($contacts)) { return 0; @@ -1204,8 +1250,10 @@ class Contact extends BaseObject } if (count($contacts) > 1 && $uid == 0 && $contact_id != 0 && $data["url"] != "") { - DBA::delete('contact', ["`nurl` = ? AND `uid` = 0 AND `id` != ? AND NOT `self`", - Strings::normaliseLink($data["url"]), $contact_id]); + $condition = ["`nurl` = ? AND `uid` = ? AND `id` != ? AND NOT `self`", + Strings::normaliseLink($data["url"]), 0, $contact_id]; + Logger::log('Deleting duplicate contact ' . json_encode($condition), Logger::DEBUG); + DBA::delete('contact', $condition); } } @@ -1618,7 +1666,7 @@ class Contact extends BaseObject return $result; } - if (x($arr['contact'], 'name')) { + if (!empty($arr['contact']['name'])) { $ret = $arr['contact']; } else { $ret = Probe::uri($url, $network, $uid, false); @@ -1664,16 +1712,15 @@ class Contact extends BaseObject } // do we have enough information? - - if (!((x($ret, 'name')) && (x($ret, 'poll')) && ((x($ret, 'url')) || (x($ret, 'addr'))))) { + if (empty($ret['name']) || empty($ret['poll']) || (empty($ret['url']) && empty($ret['addr']))) { $result['message'] .= L10n::t('The profile address specified does not provide adequate information.') . EOL; - if (!x($ret, 'poll')) { + if (empty($ret['poll'])) { $result['message'] .= L10n::t('No compatible communication protocols or feeds were discovered.') . EOL; } - if (!x($ret, 'name')) { + if (empty($ret['name'])) { $result['message'] .= L10n::t('An author or name was not found.') . EOL; } - if (!x($ret, 'url')) { + if (empty($ret['url'])) { $result['message'] .= L10n::t('No browser URL could be matched to this address.') . EOL; } if (strpos($url, '@') !== false) { @@ -2031,6 +2078,10 @@ class Contact extends BaseObject */ public static function magicLink($contact_url, $url = '') { + if (!local_user()) { + return $url ?: $contact_url; // Equivalent to: ($url != '') ? $url : $contact_url; + } + $cid = self::getIdForURL($contact_url, 0, true); if (empty($cid)) { return $url ?: $contact_url; // Equivalent to: ($url != '') ? $url : $contact_url; @@ -2064,7 +2115,7 @@ class Contact extends BaseObject */ public static function magicLinkbyContact($contact, $url = '') { - if ($contact['network'] != Protocol::DFRN) { + if (!local_user() || ($contact['network'] != Protocol::DFRN)) { return $url ?: $contact['url']; // Equivalent to ($url != '') ? $url : $contact['url']; } diff --git a/src/Model/Event.php b/src/Model/Event.php index 886f124153..d25f2a151a 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -14,9 +14,9 @@ use Friendica\Core\PConfig; use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; -use Friendica\Model\Contact; use Friendica\Util\DateTimeFormat; use Friendica\Util\Map; +use Friendica\Util\Strings; use Friendica\Util\XML; require_once 'boot.php'; @@ -53,11 +53,11 @@ class Event extends BaseObject if ($simple) { if (!empty($event['summary'])) { - $o = "

    " . BBCode::convert($event['summary'], false, $simple) . "

    "; + $o = "

    " . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . "

    "; } if (!empty($event['desc'])) { - $o .= "
    " . BBCode::convert($event['desc'], false, $simple) . "
    "; + $o .= "
    " . BBCode::convert(Strings::escapeHtml($event['desc']), false, $simple) . "
    "; } $o .= "

    " . L10n::t('Starts:') . "

    " . $event_start . "

    "; @@ -67,7 +67,7 @@ class Event extends BaseObject } if (!empty($event['location'])) { - $o .= "

    " . L10n::t('Location:') . "

    " . BBCode::convert($event['location'], false, $simple) . "

    "; + $o .= "

    " . L10n::t('Location:') . "

    " . BBCode::convert(Strings::escapeHtml($event['location']), false, $simple) . "

    "; } return $o; @@ -75,7 +75,7 @@ class Event extends BaseObject $o = '
    ' . "\r\n"; - $o .= '
    ' . BBCode::convert($event['summary'], false, $simple) . '
    ' . "\r\n"; + $o .= '
    ' . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . '
    ' . "\r\n"; $o .= '
    ' . L10n::t('Starts:') . ' ' . BBCode::convert($event['desc'], false, $simple) . '
    ' . "\r\n"; + $o .= '
    ' . BBCode::convert(Strings::escapeHtml($event['desc']), false, $simple) . '
    ' . "\r\n"; } if (!empty($event['location'])) { $o .= '
    ' . L10n::t('Location:') . ' ' - . BBCode::convert($event['location'], false, $simple) + . BBCode::convert(Strings::escapeHtml($event['location']), false, $simple) . '
    ' . "\r\n"; // Include a map of the location if the [map] BBCode is used. @@ -592,10 +592,9 @@ class Event extends BaseObject $drop = [System::baseUrl() . '/events/drop/' . $event['id'] , L10n::t('Delete event') , '', '']; } - $title = strip_tags(html_entity_decode(BBCode::convert($event['summary']), ENT_QUOTES, 'UTF-8')); + $title = BBCode::convert(Strings::escapeHtml($event['summary'])); if (!$title) { - list($title, $_trash) = explode(" $event['id'], 'start' => $start, diff --git a/src/Model/FileTag.php b/src/Model/FileTag.php index 06040403a9..4ba4e3ca7c 100644 --- a/src/Model/FileTag.php +++ b/src/Model/FileTag.php @@ -276,10 +276,10 @@ class FileTag } if ($cat == true) { - $pattern = '<' . self::encode($file) . '>' ; + $pattern = '<' . self::encode($file) . '>'; $termtype = TERM_CATEGORY; } else { - $pattern = '[' . self::encode($file) . ']' ; + $pattern = '[' . self::encode($file) . ']'; $termtype = TERM_FILE; } diff --git a/src/Model/GContact.php b/src/Model/GContact.php index 3acffb059d..44d1edecd7 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -966,8 +966,8 @@ class GContact $statistics = json_decode($curlResult->getBody()); - if (!empty($statistics->config)) { - if ($statistics->config->instance_with_ssl) { + if (!empty($statistics->config->instance_address)) { + if (!empty($statistics->config->instance_with_ssl)) { $server = "https://"; } else { $server = "http://"; @@ -976,8 +976,8 @@ class GContact $server .= $statistics->config->instance_address; $hostname = $statistics->config->instance_address; - } elseif (!empty($statistics)) { - if ($statistics->instance_with_ssl) { + } elseif (!empty($statistics->instance_address)) { + if (!empty($statistics->instance_with_ssl)) { $server = "https://"; } else { $server = "http://"; diff --git a/src/Model/Group.php b/src/Model/Group.php index 1640cb87b1..5424b77dcf 100644 --- a/src/Model/Group.php +++ b/src/Model/Group.php @@ -33,7 +33,7 @@ class Group extends BaseObject public static function create($uid, $name) { $return = false; - if (x($uid) && x($name)) { + if (!empty($uid) && !empty($name)) { $gid = self::getIdByName($uid, $name); // check for dupes if ($gid !== false) { // This could be a problem. @@ -202,7 +202,7 @@ class Group extends BaseObject */ public static function removeByName($uid, $name) { $return = false; - if (x($uid) && x($name)) { + if (!empty($uid) && !empty($name)) { $gid = self::getIdByName($uid, $name); $return = self::remove($gid); @@ -400,8 +400,8 @@ class Group extends BaseObject ]; } - // Don't show the groups when there is only one - if (count($display_groups) <= 2) { + // Don't show the groups on the network page when there is only one + if ((count($display_groups) <= 2) && ($each == 'network')) { return ''; } diff --git a/src/Model/Item.php b/src/Model/Item.php index 0c420550b8..9acff3bfa8 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1359,15 +1359,15 @@ class Item extends BaseObject $item['owner-name'] = trim(defaults($item, 'owner-name', '')); $item['owner-link'] = trim(defaults($item, 'owner-link', '')); $item['owner-avatar'] = trim(defaults($item, 'owner-avatar', '')); - $item['received'] = ((x($item, 'received') !== false) ? DateTimeFormat::utc($item['received']) : DateTimeFormat::utcNow()); - $item['created'] = ((x($item, 'created') !== false) ? DateTimeFormat::utc($item['created']) : $item['received']); - $item['edited'] = ((x($item, 'edited') !== false) ? DateTimeFormat::utc($item['edited']) : $item['created']); - $item['changed'] = ((x($item, 'changed') !== false) ? DateTimeFormat::utc($item['changed']) : $item['created']); - $item['commented'] = ((x($item, 'commented') !== false) ? DateTimeFormat::utc($item['commented']) : $item['created']); + $item['received'] = (isset($item['received']) ? DateTimeFormat::utc($item['received']) : DateTimeFormat::utcNow()); + $item['created'] = (isset($item['created']) ? DateTimeFormat::utc($item['created']) : $item['received']); + $item['edited'] = (isset($item['edited']) ? DateTimeFormat::utc($item['edited']) : $item['created']); + $item['changed'] = (isset($item['changed']) ? DateTimeFormat::utc($item['changed']) : $item['created']); + $item['commented'] = (isset($item['commented']) ? DateTimeFormat::utc($item['commented']) : $item['created']); $item['title'] = trim(defaults($item, 'title', '')); $item['location'] = trim(defaults($item, 'location', '')); $item['coord'] = trim(defaults($item, 'coord', '')); - $item['visible'] = ((x($item, 'visible') !== false) ? intval($item['visible']) : 1); + $item['visible'] = (isset($item['visible']) ? intval($item['visible']) : 1); $item['deleted'] = 0; $item['parent-uri'] = trim(defaults($item, 'parent-uri', $item['uri'])); $item['post-type'] = defaults($item, 'post-type', self::PT_ARTICLE); @@ -1626,7 +1626,7 @@ class Item extends BaseObject // It is mainly used in the "post_local" hook. unset($item['api_source']); - if (x($item, 'cancel')) { + if (!empty($item['cancel'])) { Logger::log('post cancelled by addon.'); return 0; } @@ -3214,7 +3214,7 @@ class Item extends BaseObject } } - public static function getPermissionsSQLByUserId($owner_id, $remote_verified = false, $groups = null) + public static function getPermissionsSQLByUserId($owner_id, $remote_verified = false, $groups = null, $remote_cid = null) { $local_user = local_user(); $remote_user = remote_user(); @@ -3237,7 +3237,7 @@ class Item extends BaseObject * If pre-verified, the caller is expected to have already * done this and passed the groups into this function. */ - $set = PermissionSet::get($owner_id, $remote_user, $groups); + $set = PermissionSet::get($owner_id, $remote_cid, $groups); if (!empty($set)) { $sql_set = " OR (`item`.`private` IN (1,2) AND `item`.`wall` AND `item`.`psid` IN (" . implode(',', $set) . "))"; @@ -3443,7 +3443,7 @@ class Item extends BaseObject $filesubtype = 'unkn'; } - $title = Strings::escapeHtml(trim(!empty($mtch[4]) ? $mtch[4] : $mtch[1])); + $title = Strings::escapeHtml(trim(defaults($mtch, 4, $mtch[1]))); $title .= ' ' . $mtch[2] . ' ' . L10n::t('bytes'); $icon = '
    '; @@ -3455,7 +3455,7 @@ class Item extends BaseObject } // Map. - if (strpos($s, '
    ') !== false && x($item, 'coord')) { + if (strpos($s, '
    ') !== false && !empty($item['coord'])) { $x = Map::byCoordinates(trim($item['coord'])); if ($x) { $s = preg_replace('/\
    /', '$0' . $x, $s); diff --git a/src/Model/ItemURI.php b/src/Model/ItemURI.php index 559babb762..452f7e57c8 100644 --- a/src/Model/ItemURI.php +++ b/src/Model/ItemURI.php @@ -22,11 +22,14 @@ class ItemURI extends BaseObject */ public static function insert($fields) { - if (!DBA::exists('item-uri', ['uri' => $fields['uri']])) { + // If the URI gets too long we only take the first parts and hope for best + $uri = substr($fields['uri'], 0, 255); + + if (!DBA::exists('item-uri', ['uri' => $uri])) { DBA::insert('item-uri', $fields, true); } - $itemuri = DBA::selectFirst('item-uri', ['id'], ['uri' => $fields['uri']]); + $itemuri = DBA::selectFirst('item-uri', ['id'], ['uri' => $uri]); if (!DBA::isResult($itemuri)) { // This shouldn't happen @@ -45,6 +48,9 @@ class ItemURI extends BaseObject */ public static function getIdByURI($uri) { + // If the URI gets too long we only take the first parts and hope for best + $uri = substr($uri, 0, 255); + $itemuri = DBA::selectFirst('item-uri', ['id'], ['uri' => $uri]); if (!DBA::isResult($itemuri)) { diff --git a/src/Model/Photo.php b/src/Model/Photo.php index a9b4c0fb73..a87730087f 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -97,7 +97,7 @@ class Photo $photo = DBA::selectFirst( 'photo', ['resource-id'], ['uid' => $uid, 'contact-id' => $cid, 'scale' => 4, 'album' => 'Contact Photos'] ); - if (x($photo['resource-id'])) { + if (!empty($photo['resource-id'])) { $hash = $photo['resource-id']; } else { $hash = self::newResource(); diff --git a/src/Model/Profile.php b/src/Model/Profile.php index 61357ef77a..132f9f3344 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -99,7 +99,7 @@ class Profile * load a lot of theme-specific content * * @brief Loads a profile into the page sidebar. - * @param object $a App + * @param App $a * @param string $nickname string * @param int $profile int * @param array $profiledata array @@ -288,7 +288,7 @@ class Profile $location = false; // This function can also use contact information in $profile - $is_contact = x($profile, 'cid'); + $is_contact = !empty($profile['cid']); if (!is_array($profile) && !count($profile)) { return $o; @@ -297,9 +297,9 @@ class Profile $profile['picdate'] = urlencode(defaults($profile, 'picdate', '')); if (($profile['network'] != '') && ($profile['network'] != Protocol::DFRN)) { - $profile['network_name'] = Strings::formatNetworkName($profile['network'], $profile['url']); + $profile['network_link'] = Strings::formatNetworkName($profile['network'], $profile['url']); } else { - $profile['network_name'] = ''; + $profile['network_link'] = ''; } Addon::callHooks('profile_sidebar_enter', $profile); @@ -337,6 +337,11 @@ class Profile } } + // Is the remote user already connected to that user? + if ($connect && Contact::isFollower(remote_user(), $profile['uid'])) { + $connect = false; + } + if ($connect && ($profile['network'] != Protocol::DFRN) && !isset($profile['remoteconnect'])) { $connect = false; } @@ -357,7 +362,7 @@ class Profile // See issue https://github.com/friendica/friendica/issues/3838 // Either we remove the message link for remote users or we enable creating messages from remote users - if (remote_user() || (self::getMyURL() && x($profile, 'unkmail') && ($profile['uid'] != local_user()))) { + if (remote_user() || (self::getMyURL() && !empty($profile['unkmail']) && ($profile['uid'] != local_user()))) { $wallmessage = L10n::t('Message'); if (remote_user()) { @@ -424,23 +429,23 @@ class Profile // Fetch the account type $account_type = Contact::getAccountType($profile); - if (x($profile, 'address') - || x($profile, 'location') - || x($profile, 'locality') - || x($profile, 'region') - || x($profile, 'postal-code') - || x($profile, 'country-name') + if (!empty($profile['address']) + || !empty($profile['location']) + || !empty($profile['locality']) + || !empty($profile['region']) + || !empty($profile['postal-code']) + || !empty($profile['country-name']) ) { $location = L10n::t('Location:'); } - $gender = x($profile, 'gender') ? L10n::t('Gender:') : false; - $marital = x($profile, 'marital') ? L10n::t('Status:') : false; - $homepage = x($profile, 'homepage') ? L10n::t('Homepage:') : false; - $about = x($profile, 'about') ? L10n::t('About:') : false; - $xmpp = x($profile, 'xmpp') ? L10n::t('XMPP:') : 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; + $xmpp = !empty($profile['xmpp']) ? L10n::t('XMPP:') : false; - if ((x($profile, 'hidewall') || $block) && !local_user() && !remote_user()) { + if ((!empty($profile['hidewall']) || $block) && !local_user() && !remote_user()) { $location = $gender = $marital = $homepage = $about = false; } @@ -448,7 +453,7 @@ class Profile $firstname = $split_name['first']; $lastname = $split_name['last']; - if (x($profile, 'guid')) { + if (!empty($profile['guid'])) { $diaspora = [ 'guid' => $profile['guid'], 'podloc' => System::baseUrl(), @@ -507,10 +512,8 @@ class Profile $p['about'] = BBCode::convert($p['about']); } - if (isset($p['address'])) { - $p['address'] = BBCode::convert($p['address']); - } elseif (isset($p['location'])) { - $p['address'] = BBCode::convert($p['location']); + if (empty($p['address']) && !empty($p['location'])) { + $p['address'] = $p['location']; } if (isset($p['photo'])) { @@ -890,7 +893,7 @@ class Profile } $tab = false; - if (x($_GET, 'tab')) { + if (!empty($_GET['tab'])) { $tab = Strings::escapeTags(trim($_GET['tab'])); } @@ -1001,7 +1004,7 @@ class Profile */ public static function getMyURL() { - if (x($_SESSION, 'my_url')) { + if (!empty($_SESSION['my_url'])) { return $_SESSION['my_url']; } return null; @@ -1118,6 +1121,17 @@ class Profile $_SESSION['visitor_home'] = $visitor['url']; $_SESSION['my_url'] = $visitor['url']; + /// @todo replace this and the query for this variable with some cleaner functionality + $_SESSION['remote'] = []; + + $remote_contacts = DBA::select('contact', ['id', 'uid'], ['nurl' => $visitor['nurl'], 'rel' => [Contact::FOLLOWER, Contact::FRIEND]]); + while ($contact = DBA::fetch($remote_contacts)) { + if (($contact['uid'] == 0) || Contact::isBlockedByUser($visitor['id'], $contact['uid'])) { + continue; + } + + $_SESSION['remote'][] = ['cid' => $contact['id'], 'uid' => $contact['uid'], 'url' => $visitor['url']]; + } $arr = [ 'visitor' => $visitor, 'url' => $a->query_string @@ -1173,7 +1187,7 @@ class Profile */ public static function getThemeUid() { - $uid = ((!empty($_REQUEST['puid'])) ? intval($_REQUEST['puid']) : 0); + $uid = (!empty($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0); if ((local_user()) && ((PConfig::get(local_user(), 'system', 'always_my_theme')) || (!$uid))) { return local_user(); } diff --git a/src/Model/Term.php b/src/Model/Term.php index 3718887122..0d44acd2c9 100644 --- a/src/Model/Term.php +++ b/src/Model/Term.php @@ -156,7 +156,7 @@ class Term $link = ''; } - if (DBA::exists('term', ['uid' => $message['uid'], 'otype' => TERM_OBJ_POST, 'oid' => $itemid, 'url' => $link])) { + if (DBA::exists('term', ['uid' => $message['uid'], 'otype' => TERM_OBJ_POST, 'oid' => $itemid, 'term' => $term])) { continue; } diff --git a/src/Model/User.php b/src/Model/User.php index aef4bcbfc2..a6a9fc9525 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -98,6 +98,19 @@ class User if (!DBA::isResult($r)) { return false; } + + if (empty($r['nickname'])) { + return false; + } + + // Check if the returned data is valid, otherwise fix it. See issue #6122 + $url = System::baseUrl() . '/profile/' . $r['nickname']; + $addr = $r['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3); + + if (($addr != $r['addr']) || ($r['url'] != $url) || ($r['nurl'] != Strings::normaliseLink($r['url']))) { + Contact::updateSelfFromUserID($uid); + } + return $r; } @@ -412,12 +425,12 @@ class User $password = !empty($data['password']) ? trim($data['password']) : ''; $password1 = !empty($data['password1']) ? trim($data['password1']) : ''; $confirm = !empty($data['confirm']) ? trim($data['confirm']) : ''; - $blocked = !empty($data['blocked']) ? intval($data['blocked']) : 0; - $verified = !empty($data['verified']) ? intval($data['verified']) : 0; + $blocked = !empty($data['blocked']); + $verified = !empty($data['verified']); $language = !empty($data['language']) ? Strings::escapeTags(trim($data['language'])) : 'en'; - $publish = !empty($data['profile_publish_reg']) && intval($data['profile_publish_reg']) ? 1 : 0; - $netpublish = strlen(Config::get('system', 'directory')) ? $publish : 0; + $publish = !empty($data['profile_publish_reg']); + $netpublish = $publish && Config::get('system', 'directory'); if ($password1 != $confirm) { throw new Exception(L10n::t('Passwords do not match. Password unchanged.')); diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 66e8c97fdf..410f5878bb 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -40,11 +40,8 @@ class Contact extends BaseModule } $nets = defaults($_GET, 'nets', ''); - if ($nets == 'all') { - $nets = ''; - } - if (!x($a->page, 'aside')) { + if (empty($a->page['aside'])) { $a->page['aside'] = ''; } @@ -78,18 +75,17 @@ class Contact extends BaseModule $a->data['contact'] = $contact; if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) { - $networkname = Strings::formatNetworkName($contact['network'], $contact['url']); + $network_link = Strings::formatNetworkName($contact['network'], $contact['url']); } else { - $networkname = ''; + $network_link = ''; } - /// @TODO Add nice spaces $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('vcard-widget.tpl'), [ '$name' => $contact['name'], '$photo' => $contact['photo'], '$url' => Model\Contact::MagicLink($contact['url']), '$addr' => defaults($contact, 'addr', ''), - '$network_name' => $networkname, + '$network_link' => $network_link, '$network' => L10n::t('Network:'), '$account_type' => Model\Contact::getAccountType($contact) ]); @@ -514,7 +510,7 @@ class Contact extends BaseModule $relation_text = ''; } - $relation_text = sprintf($relation_text, htmlentities($contact['name'])); + $relation_text = sprintf($relation_text, $contact['name']); $url = Model\Contact::magicLink($contact['url']); if (strpos($url, 'redir/') === 0) { @@ -646,7 +642,7 @@ class Contact extends BaseModule '$profileurllabel'=> L10n::t('Profile URL'), '$profileurl' => $contact['url'], '$account_type' => Model\Contact::getAccountType($contact), - '$location' => BBCode::convert($contact['location']), + '$location' => $contact['location'], '$location_label' => L10n::t('Location:'), '$xmpp' => BBCode::convert($contact['xmpp']), '$xmpp_label' => L10n::t('XMPP:'), diff --git a/src/Module/Feed.php b/src/Module/Feed.php index 9e44612717..e5ebe2a4d6 100644 --- a/src/Module/Feed.php +++ b/src/Module/Feed.php @@ -28,8 +28,8 @@ class Feed extends BaseModule { $a = self::getApp(); - $last_update = x($_GET, 'last_update') ? $_GET['last_update'] : ''; - $nocache = x($_GET, 'nocache') && local_user(); + $last_update = defaults($_GET, 'last_update', ''); + $nocache = !empty($_GET['nocache']) && local_user(); if ($a->argc < 2) { System::httpExit(400); @@ -44,6 +44,7 @@ class Feed extends BaseModule case 'posts': case 'comments': case 'activity': + // Correct type names, no change needed break; case 'replies': $type = 'comments'; @@ -53,8 +54,8 @@ class Feed extends BaseModule } $nickname = $a->argv[1]; - header("Content-type: application/atom+xml"); + header("Content-type: application/atom+xml; charset=utf-8"); echo OStatus::feed($nickname, $last_update, 10, $type, $nocache, true); - killme(); + exit(); } } diff --git a/src/Module/Inbox.php b/src/Module/Inbox.php index 25312bdf3a..692e4043ad 100644 --- a/src/Module/Inbox.php +++ b/src/Module/Inbox.php @@ -9,6 +9,7 @@ use Friendica\Protocol\ActivityPub; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Util\HTTPSignature; +use Friendica\Core\Logger; /** * ActivityPub Inbox diff --git a/src/Module/Itemsource.php b/src/Module/Itemsource.php index 2da679eeef..4d85ef15ce 100644 --- a/src/Module/Itemsource.php +++ b/src/Module/Itemsource.php @@ -25,12 +25,12 @@ class Itemsource extends \Friendica\BaseModule $conversation = Model\Conversation::getByItemUri($item['uri']); $item_uri = $item['uri']; - $source = htmlspecialchars($conversation['source']); + $source = $conversation['source']; } $tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl'); $o = Renderer::replaceMacros($tpl, [ - '$guid' => ['guid', L10n::t('Item Guid'), htmlentities(defaults($_REQUEST, 'guid', '')), ''], + '$guid' => ['guid', L10n::t('Item Guid'), defaults($_REQUEST, 'guid', ''), ''], '$source' => $source, '$item_uri' => $item_uri ]); diff --git a/src/Module/Login.php b/src/Module/Login.php index 330988df50..82d7049828 100644 --- a/src/Module/Login.php +++ b/src/Module/Login.php @@ -34,11 +34,11 @@ class Login extends BaseModule { $a = self::getApp(); - 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']); } @@ -68,7 +68,7 @@ class Login extends BaseModule self::openIdAuthentication($openid_url, !empty($_POST['remember'])); } - if (x($_POST, 'auth-params') && $_POST['auth-params'] === 'login') { + if (!empty($_POST['auth-params']) && $_POST['auth-params'] === 'login') { self::passwordAuthentication( trim($_POST['username']), trim($_POST['password']), @@ -163,7 +163,7 @@ class Login extends BaseModule $_SESSION['last_login_date'] = DateTimeFormat::utcNow(); Authentication::setAuthenticatedSessionForUser($record, true, true); - if (x($_SESSION, 'return_path')) { + if (!empty($_SESSION['return_path'])) { $return_path = $_SESSION['return_path']; unset($_SESSION['return_path']); } else { @@ -221,15 +221,15 @@ class Login extends BaseModule } } - if (isset($_SESSION) && x($_SESSION, 'authenticated')) { - if (x($_SESSION, 'visitor_id') && !x($_SESSION, 'uid')) { + if (!empty($_SESSION['authenticated'])) { + if (!empty($_SESSION['visitor_id']) && empty($_SESSION['uid'])) { $contact = DBA::selectFirst('contact', [], ['id' => $_SESSION['visitor_id']]); if (DBA::isResult($contact)) { self::getApp()->contact = $contact; } } - if (x($_SESSION, 'uid')) { + if (!empty($_SESSION['uid'])) { // already logged in user returning $check = Config::get('system', 'paranoia'); // extra paranoia - if the IP changed, log them out diff --git a/src/Module/Magic.php b/src/Module/Magic.php index ecfe18e596..f0be114e3d 100644 --- a/src/Module/Magic.php +++ b/src/Module/Magic.php @@ -28,10 +28,10 @@ class Magic extends BaseModule Logger::log('args: ' . print_r($_REQUEST, true), Logger::DATA); - $addr = ((x($_REQUEST, 'addr')) ? $_REQUEST['addr'] : ''); - $dest = ((x($_REQUEST, 'dest')) ? $_REQUEST['dest'] : ''); - $test = ((x($_REQUEST, 'test')) ? intval($_REQUEST['test']) : 0); - $owa = ((x($_REQUEST, 'owa')) ? intval($_REQUEST['owa']) : 0); + $addr = defaults($_REQUEST, 'addr', ''); + $dest = defaults($_REQUEST, 'dest', ''); + $test = (!empty($_REQUEST['test']) ? intval($_REQUEST['test']) : 0); + $owa = (!empty($_REQUEST['owa']) ? intval($_REQUEST['owa']) : 0); // NOTE: I guess $dest isn't just the profile url (could be also // other profile pages e.g. photo). We need to find a solution @@ -43,7 +43,7 @@ class Magic extends BaseModule } if (!$cid) { - Logger::log('No contact record found: ' . print_r($_REQUEST, true), Logger::DEBUG); + Logger::log('No contact record found: ' . json_encode($_REQUEST), Logger::DEBUG); // @TODO Finding a more elegant possibility to redirect to either internal or external URL $a->redirect($dest); } diff --git a/src/Network/CurlResult.php b/src/Network/CurlResult.php index b2587799d1..1aafbfa9b8 100644 --- a/src/Network/CurlResult.php +++ b/src/Network/CurlResult.php @@ -161,11 +161,21 @@ class CurlResult if ($this->returnCode == 301 || $this->returnCode == 302 || $this->returnCode == 303 || $this->returnCode== 307) { $redirect_parts = parse_url(defaults($this->info, 'redirect_url', '')); + if (empty($redirect_parts)) { + $redirect_parts = []; + } + if (preg_match('/(Location:|URI:)(.*?)\n/i', $this->header, $matches)) { - $redirect_parts = array_merge($redirect_parts, parse_url(trim(array_pop($matches)))); + $redirect_parts2 = parse_url(trim(array_pop($matches))); + if (!empty($redirect_parts2)) { + $redirect_parts = array_merge($redirect_parts, $redirect_parts2); + } } $parts = parse_url(defaults($this->info, 'url', '')); + if (empty($parts)) { + $parts = []; + } /// @todo Checking the corresponding RFC which parts of a redirect can be ommitted. $components = ['scheme', 'host', 'path', 'query', 'fragment']; @@ -177,7 +187,7 @@ class CurlResult $this->redirectUrl = Network::unparseURL($redirect_parts); - $this->isRedirectUrl = filter_var($this->redirectUrl, FILTER_VALIDATE_URL) !== false; + $this->isRedirectUrl = true; } else { $this->isRedirectUrl = false; } diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 9c57d624f8..b4e297afa2 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -164,7 +164,7 @@ class Probe } } - self::$baseurl = "http://".$host; + self::$baseurl = $host_url; Logger::log("Probing successful for ".$host, Logger::DEBUG); @@ -347,7 +347,7 @@ class Probe $data['url'] = $uri; } - if (x($data, 'photo')) { + if (!empty($data['photo'])) { $data['baseurl'] = Network::getUrlMatch(Strings::normaliseLink(defaults($data, 'baseurl', '')), Strings::normaliseLink($data['photo'])); } else { $data['photo'] = System::baseUrl() . '/images/person-300.jpg'; @@ -358,7 +358,7 @@ class Probe $data['name'] = $data['nick']; } - if (!x($data, 'name')) { + if (empty($data['name'])) { $data['name'] = $data['url']; } } @@ -1317,7 +1317,7 @@ class Probe if ($curlResult->isTimeout()) { return false; } - $pubkey = $curlResult['body']; + $pubkey = $curlResult->getBody(); } $key = explode(".", $pubkey); diff --git a/src/Object/OEmbed.php b/src/Object/OEmbed.php index bd336f7583..d787e2ee98 100644 --- a/src/Object/OEmbed.php +++ b/src/Object/OEmbed.php @@ -45,6 +45,8 @@ class OEmbed if (in_array($key, ['thumbnail_width', 'thumbnail_height', 'width', 'height'])) { // These values should be numbers, so ensure that they really are numbers. $value = (int)$value; + } elseif (is_array($value)) { + // Ignoring arrays. } elseif ($key != 'html') { // Avoid being able to inject some ugly stuff through these fields. $value = htmlentities($value); diff --git a/src/Object/Post.php b/src/Object/Post.php index 50d903f025..1ca1e222eb 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -67,7 +67,7 @@ class Post extends BaseObject $this->setTemplate('wall'); $this->toplevel = $this->getId() == $this->getDataValue('parent'); - if (x($_SESSION, 'remote') && is_array($_SESSION['remote'])) { + if (!empty($_SESSION['remote']) && is_array($_SESSION['remote'])) { foreach ($_SESSION['remote'] as $visitor) { if ($visitor['cid'] == $this->getDataValue('contact-id')) { $this->visiting = true; @@ -253,7 +253,7 @@ class Post extends BaseObject $responses = get_responses($conv_responses, $response_verbs, $this, $item); foreach ($response_verbs as $value => $verbs) { - $responses[$verbs]['output'] = x($conv_responses[$verbs], $item['uri']) ? format_like($conv_responses[$verbs][$item['uri']], $conv_responses[$verbs][$item['uri'] . '-l'], $verbs, $item['uri']) : ''; + $responses[$verbs]['output'] = !empty($conv_responses[$verbs][$item['uri']]) ? format_like($conv_responses[$verbs][$item['uri']], $conv_responses[$verbs][$item['uri'] . '-l'], $verbs, $item['uri']) : ''; } /* @@ -678,7 +678,7 @@ class Post extends BaseObject */ private function setTemplate($name) { - if (!x($this->available_templates, $name)) { + if (empty($this->available_templates[$name])) { Logger::log('[ERROR] Item::setTemplate : Template not available ("' . $name . '").', Logger::DEBUG); return false; } diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index bff8767f38..d2f5b3b2d5 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -209,20 +209,20 @@ class Processor */ public static function createEvent($activity, $item) { - $event['summary'] = $activity['name']; - $event['desc'] = $activity['content']; - $event['start'] = $activity['start-time']; - $event['finish'] = $activity['end-time']; + $event['summary'] = HTML::toBBCode($activity['name']); + $event['desc'] = HTML::toBBCode($activity['content']); + $event['start'] = $activity['start-time']; + $event['finish'] = $activity['end-time']; $event['nofinish'] = empty($event['finish']); $event['location'] = $activity['location']; - $event['adjust'] = true; - $event['cid'] = $item['contact-id']; - $event['uid'] = $item['uid']; - $event['uri'] = $item['uri']; - $event['edited'] = $item['edited']; - $event['private'] = $item['private']; - $event['guid'] = $item['guid']; - $event['plink'] = $item['plink']; + $event['adjust'] = true; + $event['cid'] = $item['contact-id']; + $event['uid'] = $item['uid']; + $event['uri'] = $item['uri']; + $event['edited'] = $item['edited']; + $event['private'] = $item['private']; + $event['guid'] = $item['guid']; + $event['plink'] = $item['plink']; $condition = ['uri' => $item['uri'], 'uid' => $item['uid']]; $ev = DBA::selectFirst('event', ['id'], $condition); diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index c074e49f6c..7fe1f128f4 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -599,6 +599,7 @@ class Receiver $photo = defaults($profile, 'photo', null); unset($profile['photo']); unset($profile['baseurl']); + unset($profile['guid']); $profile['nurl'] = Strings::normaliseLink($profile['url']); DBA::update('contact', $profile, ['id' => $cid]); diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 22c8a3518e..e70e618477 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -643,7 +643,7 @@ class Transmitter $data['object'] = $item['thr-parent']; } - $owner = User::getOwnerDataById($item['uid']); + $owner = User::getOwnerDataById($item['contact-uid']); if (!$object_mode) { return LDSignature::sign($data, $owner); diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index b67b7c021f..7c807b921e 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -2637,7 +2637,7 @@ class DFRN if (($item["object-type"] == ACTIVITY_OBJ_EVENT) && !$owner_unknown) { Logger::log("Item ".$item["uri"]." seems to contain an event.", Logger::DEBUG); $ev = Event::fromBBCode($item["body"]); - if ((x($ev, "desc") || x($ev, "summary")) && x($ev, "start")) { + if ((!empty($ev['desc']) || !empty($ev['summary'])) && !empty($ev['start'])) { Logger::log("Event in item ".$item["uri"]." was found.", Logger::DEBUG); $ev["cid"] = $importer["id"]; $ev["uid"] = $importer["importer_uid"]; @@ -2925,7 +2925,7 @@ class DFRN public static function autoRedir(App $a, $contact_nick) { // prevent looping - if (x($_REQUEST, 'redir') && intval($_REQUEST['redir'])) { + if (!empty($_REQUEST['redir'])) { return; } @@ -3077,10 +3077,10 @@ class DFRN */ private static function isEditedTimestampNewer($existing, $update) { - if (!x($existing, 'edited') || !$existing['edited']) { + if (empty($existing['edited'])) { return true; } - if (!x($update, 'edited') || !$update['edited']) { + if (empty($update['edited'])) { return false; } diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index d59eb7a0ad..38d9deb7f8 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -3727,12 +3727,12 @@ class Diaspora } elseif (in_array($item["verb"], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) { $message = self::constructLike($item, $owner); $type = "like"; - } else { + } elseif (!in_array($item["verb"], [ACTIVITY_FOLLOW])) { $message = self::constructComment($item, $owner); $type = "comment"; } - if (!$message) { + if (empty($message)) { return false; } diff --git a/src/Protocol/Email.php b/src/Protocol/Email.php index ba8c311901..358ff27db0 100644 --- a/src/Protocol/Email.php +++ b/src/Protocol/Email.php @@ -117,7 +117,7 @@ class Email return $ret; } - if (!$struc->parts) { + if (empty($struc->parts)) { $ret['body'] = self::messageGetPart($mbox, $uid, $struc, 0, 'html'); $html = $ret['body']; @@ -482,13 +482,11 @@ class Email '[\r\n]\s*-----BEGIN PGP SIGNATURE-----\s*[\r\n].*'. '[\r\n]\s*-----END PGP SIGNATURE-----(.*)/is'; - preg_match($pattern, $message, $result); + if (preg_match($pattern, $message, $result)) { + $cleaned = trim($result[1].$result[2].$result[3]); - $cleaned = trim($result[1].$result[2].$result[3]); - - $cleaned = str_replace(["\n- --\n", "\n- -"], ["\n-- \n", "\n-"], $cleaned); - - if ($cleaned == '') { + $cleaned = str_replace(["\n- --\n", "\n- -"], ["\n-- \n", "\n-"], $cleaned); + } else { $cleaned = $message; } diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 45000d7700..361d333b40 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -1543,8 +1543,10 @@ class OStatus */ private static function constructObjecttype(array $item) { - if (in_array($item['object-type'], [ACTIVITY_OBJ_NOTE, ACTIVITY_OBJ_COMMENT])) + if (!empty($item['object-type']) && in_array($item['object-type'], [ACTIVITY_OBJ_NOTE, ACTIVITY_OBJ_COMMENT])) { return $item['object-type']; + } + return ACTIVITY_OBJ_NOTE; } diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php index 0f4ef12f9d..fb7b9d7bab 100644 --- a/src/Protocol/PortableContact.php +++ b/src/Protocol/PortableContact.php @@ -84,7 +84,7 @@ class PortableContact return; } - $url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation') ; + $url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation'); Logger::log('load: ' . $url, Logger::DEBUG); @@ -734,7 +734,7 @@ class PortableContact } } - if (is_array($nodeinfo['metadata']) && isset($nodeinfo['metadata']['nodeName'])) { + if (isset($nodeinfo['metadata']['nodeName'])) { $server['site_name'] = $nodeinfo['metadata']['nodeName']; } @@ -817,7 +817,7 @@ class PortableContact } } - if (is_array($nodeinfo['metadata']) && isset($nodeinfo['metadata']['nodeName'])) { + if (isset($nodeinfo['metadata']['nodeName'])) { $server['site_name'] = $nodeinfo['metadata']['nodeName']; } @@ -1375,15 +1375,15 @@ class PortableContact $site_name = $data['site_name']; } - $info = $data['info']; + $info = defaults($data, 'info', ''); $register_policy = defaults($data, 'register_policy', REGISTER_CLOSED); if (in_array($register_policy, ['REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'])) { - $register_policy = constant($data['register_policy']); + $register_policy = constant($register_policy); } else { Logger::log("Register policy '$register_policy' from $server_url is invalid."); $register_policy = REGISTER_CLOSED; // set a default value } - $platform = $data['platform']; + $platform = defaults($data, 'platform', ''); } } } @@ -1778,7 +1778,7 @@ class PortableContact $curlResult = Network::curl($url); if ($curlResult->isSuccess()) { - $data = json_decode($curlResult["body"], true); + $data = json_decode($curlResult->getBody(), true); if (!empty($data)) { self::discoverServer($data, 3); diff --git a/src/Render/FriendicaSmarty.php b/src/Render/FriendicaSmarty.php index e544a76d1b..413d746dcf 100644 --- a/src/Render/FriendicaSmarty.php +++ b/src/Render/FriendicaSmarty.php @@ -28,7 +28,7 @@ class FriendicaSmarty extends Smarty // setTemplateDir can be set to an array, which Smarty will parse in order. // The order is thus very important here $template_dirs = ['theme' => "view/theme/$theme/" . self::SMARTY3_TEMPLATE_FOLDER . "/"]; - if (x($a->theme_info, "extends")) { + if (!empty($a->theme_info['extends'])) { $template_dirs = $template_dirs + ['extends' => "view/theme/" . $a->theme_info["extends"] . "/" . self::SMARTY3_TEMPLATE_FOLDER . "/"]; } @@ -42,6 +42,8 @@ class FriendicaSmarty extends Smarty $this->left_delimiter = Renderer::getTemplateLeftDelimiter('smarty3'); $this->right_delimiter = Renderer::getTemplateRightDelimiter('smarty3'); + $this->escape_html = true; + // Don't report errors so verbosely $this->error_reporting = E_ALL & ~E_NOTICE; } diff --git a/src/Render/FriendicaSmartyEngine.php b/src/Render/FriendicaSmartyEngine.php index 1053ab08e0..2b6d7a877b 100644 --- a/src/Render/FriendicaSmartyEngine.php +++ b/src/Render/FriendicaSmartyEngine.php @@ -67,7 +67,7 @@ class FriendicaSmartyEngine implements ITemplateEngine if (file_exists("{$root}view/theme/$theme/$filename")) { $template_file = "{$root}view/theme/$theme/$filename"; - } elseif (x($a->theme_info, 'extends') && file_exists(sprintf('%sview/theme/%s}/%s', $root, $a->theme_info['extends'], $filename))) { + } elseif (!empty($a->theme_info['extends']) && file_exists(sprintf('%sview/theme/%s}/%s', $root, $a->theme_info['extends'], $filename))) { $template_file = sprintf('%sview/theme/%s}/%s', $root, $a->theme_info['extends'], $filename); } elseif (file_exists("{$root}/$filename")) { $template_file = "{$root}/$filename"; diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index 42aab8f5f3..b291076cc0 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -36,7 +36,7 @@ class Emailer Addon::callHooks('emailer_send_prepare', $params); $email_textonly = false; - if (x($params, "uid")) { + if (!empty($params['uid'])) { $email_textonly = PConfig::get($params['uid'], "system", "email_textonly"); } diff --git a/src/Util/HTTPSignature.php b/src/Util/HTTPSignature.php index 956d6ff372..07ff5e805d 100644 --- a/src/Util/HTTPSignature.php +++ b/src/Util/HTTPSignature.php @@ -204,6 +204,8 @@ class HTTPSignature if (preg_match('/algorithm="(.*?)"/ism', $header, $matches)) { $ret['algorithm'] = $matches[1]; + } else { + $ret['algorithm'] = 'rsa-sha256'; } if (preg_match('/headers="(.*?)"/ism', $header, $matches)) { diff --git a/src/Util/JsonLD.php b/src/Util/JsonLD.php index 78d81816e2..cd3a6ec270 100644 --- a/src/Util/JsonLD.php +++ b/src/Util/JsonLD.php @@ -93,8 +93,13 @@ class JsonLD 'dc' => (object)['@id' => 'http://purl.org/dc/terms/', '@type' => '@id'], 'toot' => (object)['@id' => 'http://joinmastodon.org/ns#', '@type' => '@id']]; - $jsonobj = json_decode(json_encode($json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); + // Trying to avoid memory problems with large content fields + if (!empty($json['object']['source']['content'])) { + $content = $json['object']['source']['content']; + $json['object']['source']['content'] = ''; + } + $jsonobj = json_decode(json_encode($json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); try { $compacted = jsonld_compact($jsonobj, $context); @@ -104,7 +109,13 @@ class JsonLD Logger::log('compacting error:' . print_r($e, true), Logger::DEBUG); } - return json_decode(json_encode($compacted, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), true); + $json = json_decode(json_encode($compacted, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), true); + + if (isset($json['as:object']['as:source']['as:content']) && !empty($content)) { + $json['as:object']['as:source']['as:content'] = $content; + } + + return $json; } /** diff --git a/src/Util/LDSignature.php b/src/Util/LDSignature.php index c9fde441fd..5acdfd9013 100644 --- a/src/Util/LDSignature.php +++ b/src/Util/LDSignature.php @@ -27,7 +27,7 @@ class LDSignature } $actor = JsonLD::fetchElement($data, 'actor', 'id'); - if (empty($actor)) { + if (empty($actor) || !is_string($actor)) { return false; } diff --git a/src/Util/Network.php b/src/Util/Network.php index 0ac0f2aeb7..ab0958d642 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -121,7 +121,7 @@ class Network @curl_setopt($ch, CURLOPT_HEADER, true); - if (x($opts, "cookiejar")) { + if (!empty($opts['cookiejar'])) { curl_setopt($ch, CURLOPT_COOKIEJAR, $opts["cookiejar"]); curl_setopt($ch, CURLOPT_COOKIEFILE, $opts["cookiejar"]); } @@ -130,7 +130,7 @@ class Network // @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // @curl_setopt($ch, CURLOPT_MAXREDIRS, 5); - if (x($opts, 'accept_content')) { + if (!empty($opts['accept_content'])) { curl_setopt( $ch, CURLOPT_HTTPHEADER, @@ -156,15 +156,15 @@ class Network /// @todo We could possibly set this value to "gzip" or something similar curl_setopt($ch, CURLOPT_ENCODING, ''); - if (x($opts, 'headers')) { + if (!empty($opts['headers'])) { @curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']); } - if (x($opts, 'nobody')) { + if (!empty($opts['nobody'])) { @curl_setopt($ch, CURLOPT_NOBODY, $opts['nobody']); } - if (x($opts, 'timeout')) { + if (!empty($opts['timeout'])) { @curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']); } else { $curl_time = Config::get('system', 'curl_timeout', 60); @@ -362,7 +362,7 @@ class Network /// @TODO Really suppress function outcomes? Why not find them + debug them? $h = @parse_url($url); - if ((is_array($h)) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { + if (!empty($h['host']) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { return $url; } @@ -489,7 +489,7 @@ class Network } $str_allowed = Config::get('system', 'allowed_email', ''); - if (!x($str_allowed)) { + if (empty($str_allowed)) { return true; } diff --git a/src/Util/Strings.php b/src/Util/Strings.php index 48e580d678..473774b71d 100644 --- a/src/Util/Strings.php +++ b/src/Util/Strings.php @@ -140,18 +140,18 @@ class Strings } /** - * @brief translate and format the networkname of a contact + * @brief Translate and format the network name of a contact * - * @param string $network Networkname of the contact (e.g. dfrn, rss and so on) - * @param string $url The contact url + * @param string $network Network name of the contact (e.g. dfrn, rss and so on) + * @param string $url The contact url * - * @return string Formatted network name + * @return string Formatted network name */ - public static function formatNetworkName($network, $url = 0) + public static function formatNetworkName($network, $url = '') { - if ($network != "") { - if ($url != "") { - $network_name = '' . ContactSelector::networkToName($network, $url) . ""; + if ($network != '') { + if ($url != '') { + $network_name = '' . ContactSelector::networkToName($network, $url) . ''; } else { $network_name = ContactSelector::networkToName($network); } @@ -161,7 +161,7 @@ class Strings } /** - * @brief Remove intentation from a text + * @brief Remove indentation from a text * * @param string $text String to be transformed. * @param string $chr Optional. Indentation tag. Default tab (\t). diff --git a/src/Util/Temporal.php b/src/Util/Temporal.php index 140d3db37a..44b9601164 100644 --- a/src/Util/Temporal.php +++ b/src/Util/Temporal.php @@ -481,7 +481,7 @@ class Temporal $o .= ""; $day = str_replace(' ', ' ', sprintf('%2.2d', $d)); if ($started) { - if (x($links, $d) !== false) { + if (isset($links[$d])) { $o .= "$day"; } else { $o .= $day; diff --git a/src/Worker/CronJobs.php b/src/Worker/CronJobs.php index 0c565daa73..164b1cf4d2 100644 --- a/src/Worker/CronJobs.php +++ b/src/Worker/CronJobs.php @@ -119,7 +119,7 @@ class CronJobs } // delete user records for recently removed accounts - $users = DBA::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY"]); + $users = DBA::select('user', ['uid'], ["`account_removed` AND `account_expires_on` < UTC_TIMESTAMP() "]); while ($user = DBA::fetch($users)) { // Delete the contacts of this user $self = DBA::selectFirst('contact', ['nurl'], ['self' => true, 'uid' => $user['uid']]); diff --git a/src/Worker/GProbe.php b/src/Worker/GProbe.php index 4f51db2dfb..49638c7c94 100644 --- a/src/Worker/GProbe.php +++ b/src/Worker/GProbe.php @@ -35,7 +35,7 @@ class GProbe { $result = Cache::get("gprobe:".$urlparts["host"]); if (!is_null($result)) { if (in_array($result["network"], [Protocol::FEED, Protocol::PHANTOM])) { - Logger::log("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), Logger::DEBUG); + Logger::log("DDoS attempt detected for ".$urlparts["host"]." by ".defaults($_SERVER, "REMOTE_ADDR", '').". server data: ".print_r($_SERVER, true), Logger::DEBUG); return; } } diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index e0108ddcfe..00ad1543d6 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -106,7 +106,7 @@ class Notifier $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser(0); foreach ($inboxes as $inbox) { Logger::log('Account removal for user ' . $item_id . ' to ' . $inbox .' via ActivityPub', Logger::DEBUG); - Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true], + Worker::add(['priority' => PRIORITY_NEGLIGIBLE, 'created' => $a->queue['created'], 'dont_fork' => true], 'APDelivery', Delivery::REMOVAL, '', $inbox, $item_id); } diff --git a/src/Worker/OnePoll.php b/src/Worker/OnePoll.php index 22fbf700a2..f254596720 100644 --- a/src/Worker/OnePoll.php +++ b/src/Worker/OnePoll.php @@ -201,7 +201,7 @@ class OnePoll $url = $contact['poll'] . '?dfrn_id=' . $idtosend . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=data&last_update=' . $last_update - . '&perm=' . $perm ; + . '&perm=' . $perm; $curlResult = Network::curl($url); diff --git a/tests/src/Core/Console/AutomaticInstallationConsoleTest.php b/tests/src/Core/Console/AutomaticInstallationConsoleTest.php index 29a0e907e5..813277ebbd 100644 --- a/tests/src/Core/Console/AutomaticInstallationConsoleTest.php +++ b/tests/src/Core/Console/AutomaticInstallationConsoleTest.php @@ -47,7 +47,7 @@ class AutomaticInstallationConsoleTest extends ConsoleTest } $this->db_host = getenv('MYSQL_HOST'); - $this->db_port = (!empty(getenv('MYSQL_PORT'))) ? getenv('MYSQL_PORT') : null; + $this->db_port = !empty(getenv('MYSQL_PORT')) ? getenv('MYSQL_PORT') : null; $this->db_data = getenv('MYSQL_DATABASE'); $this->db_user = getenv('MYSQL_USERNAME') . getenv('MYSQL_USER'); $this->db_pass = getenv('MYSQL_PASSWORD'); diff --git a/tests/src/Core/InstallerTest.php b/tests/src/Core/InstallerTest.php index 32a80a77e0..3d7effe52b 100644 --- a/tests/src/Core/InstallerTest.php +++ b/tests/src/Core/InstallerTest.php @@ -43,6 +43,8 @@ class InstallerTest extends MockedTest $this->mockL10nT('Error: iconv PHP module required but not installed.', 1); $this->mockL10nT('POSIX PHP module', 1); $this->mockL10nT('Error: POSIX PHP module required but not installed.', 1); + $this->mockL10nT('JSON PHP module', 1); + $this->mockL10nT('Error: JSON PHP module required but not installed.', 1); } private function assertCheckExist($position, $title, $help, $status, $required, $assertionArray) @@ -177,6 +179,17 @@ class InstallerTest extends MockedTest true, $install->getChecks()); + $this->mockFunctionL10TCalls(); + $this->setFunctions(['json_encode' => false]); + $install = new Installer(); + $this->assertFalse($install->checkFunctions()); + $this->assertCheckExist(9, + 'JSON PHP module', + 'Error: JSON PHP module required but not installed.', + false, + true, + $install->getChecks()); + $this->mockFunctionL10TCalls(); $this->setFunctions([ 'curl_init' => true, @@ -184,7 +197,8 @@ class InstallerTest extends MockedTest 'openssl_public_encrypt' => true, 'mb_strlen' => true, 'iconv_strlen' => true, - 'posix_kill' => true + 'posix_kill' => true, + 'json_encode' => true ]); $install = new Installer(); $this->assertTrue($install->checkFunctions()); diff --git a/view/php/default.php b/view/php/default.php index 29a21ff33a..dc124a8454 100644 --- a/view/php/default.php +++ b/view/php/default.php @@ -1,19 +1,19 @@ - <?php if(x($page,'title')) echo $page['title'] ?> + <?php if(!empty($page['title'])) echo $page['title'] ?> - + - - + +
    - +
    - -
    + +
    diff --git a/view/php/minimal.php b/view/php/minimal.php index 0b1a4b8b77..dabd422dbb 100644 --- a/view/php/minimal.php +++ b/view/php/minimal.php @@ -1,12 +1,12 @@ - <?php if(x($page,'title')) echo $page['title'] ?> + <?php if(!empty($page['title'])) echo $page['title'] ?> - + -
    +
    diff --git a/view/php/none.php b/view/php/none.php index 5b96e282e3..7026204198 100644 --- a/view/php/none.php +++ b/view/php/none.php @@ -7,5 +7,5 @@ * only the pure content */ -if(x($page,'content')) echo $page['content']; +if(!empty($page['content'])) echo $page['content']; diff --git a/view/templates/acl_selector.tpl b/view/templates/acl_selector.tpl index 7c68a73064..48706535f4 100644 --- a/view/templates/acl_selector.tpl +++ b/view/templates/acl_selector.tpl @@ -17,10 +17,10 @@ {{if $networks}}
    -
    {{$emailcc}}
    +
    {{$emailcc}}
    {{if $jotnets}} -{{$jotnets}} +{{$jotnets nofilter}} {{/if}}{{/if}}

    {{$title}} - {{$page}}

    -

    {{$description}}

    +

    {{$description nofilter}}

    @@ -32,19 +32,19 @@ {{foreach $contacts as $contact}} - {{$contact.nickname|escape}} - {{$contact.name|escape}} - {{$contact.addr|escape}} - {{$contact.url}} + {{$contact.nickname}} + {{$contact.name}} + {{$contact.addr}} + {{$contact.url}} {{/foreach}}

    {{$select_all}} | {{$select_none}}

    - {{$paginate}} -
    + {{$paginate nofilter}} +
    {{else}} -

    {{$no_data|escape:'html'}}

    +

    {{$no_data}}

    {{/if}} @@ -58,6 +58,6 @@ -
    +
    diff --git a/view/templates/admin/logs.tpl b/view/templates/admin/logs.tpl index b2e6357a9a..a218a38f56 100644 --- a/view/templates/admin/logs.tpl +++ b/view/templates/admin/logs.tpl @@ -2,13 +2,13 @@

    {{$title}} - {{$page}}

    - + {{include file="field_checkbox.tpl" field=$debugging}} {{include file="field_input.tpl" field=$logfile}} {{include file="field_select.tpl" field=$loglevel}} -
    +
    diff --git a/view/templates/admin/settings_features.tpl b/view/templates/admin/settings_features.tpl index 1ca0708bfc..f0b696fae4 100644 --- a/view/templates/admin/settings_features.tpl +++ b/view/templates/admin/settings_features.tpl @@ -17,7 +17,7 @@ {{/foreach}}
    - +
    {{/foreach}} diff --git a/view/templates/admin/site.tpl b/view/templates/admin/site.tpl index 34b1e3b1b2..dd40654b51 100644 --- a/view/templates/admin/site.tpl +++ b/view/templates/admin/site.tpl @@ -39,7 +39,7 @@ });
    -

    {{$title|escape}} - {{$page|escape}}

    +

    {{$title}} - {{$page}}

    @@ -58,7 +58,7 @@ {{if $ssl_policy.2 == 1}}{{include file="field_checkbox.tpl" field=$force_ssl}}{{/if}} {{include file="field_checkbox.tpl" field=$hide_help}} {{include file="field_select.tpl" field=$singleuser}} -
    +

    {{$registration}}

    {{include file="field_input.tpl" field=$register_text}} @@ -67,13 +67,13 @@ {{include file="field_checkbox.tpl" field=$no_multi_reg}} {{include file="field_checkbox.tpl" field=$no_openid}} {{include file="field_checkbox.tpl" field=$no_regfullname}} -
    +

    {{$upload}}

    {{include file="field_input.tpl" field=$maximagesize}} {{include file="field_input.tpl" field=$maximagelength}} {{include file="field_input.tpl" field=$jpegimagequality}} -
    +

    {{$corporate}}

    {{include file="field_input.tpl" field=$allowed_sites}} @@ -99,14 +99,14 @@ {{/if}} {{include file="field_checkbox.tpl" field=$dfrn_only}} {{include file="field_input.tpl" field=$global_directory}} -
    +
    {{include file="field_checkbox.tpl" field=$newuser_private}} {{include file="field_checkbox.tpl" field=$enotify_no_content}} {{include file="field_checkbox.tpl" field=$private_addons}} {{include file="field_checkbox.tpl" field=$disable_embedded}} {{include file="field_checkbox.tpl" field=$allow_users_remote_self}} {{include file="field_checkbox.tpl" field=$explicit_content}} -
    +

    {{$advanced}}

    {{include file="field_select.tpl" field=$rino}} @@ -123,7 +123,7 @@ {{include file="field_checkbox.tpl" field=$suppress_tags}} {{include file="field_checkbox.tpl" field=$nodeinfo}} {{include file="field_select.tpl" field=$check_new_version_url}} -
    +

    {{$portable_contacts}}

    {{include file="field_checkbox.tpl" field=$poco_completion}} @@ -131,7 +131,7 @@ {{include file="field_select.tpl" field=$poco_discovery}} {{include file="field_select.tpl" field=$poco_discovery_since}} {{include file="field_checkbox.tpl" field=$poco_local_search}} -
    +

    {{$performance}}

    {{include file="field_checkbox.tpl" field=$only_tag_search}} @@ -143,9 +143,9 @@ {{include file="field_input.tpl" field=$dbclean_expire_days}} {{include file="field_input.tpl" field=$dbclean_unclaimed}} {{include file="field_input.tpl" field=$dbclean_expire_conv}} -
    +
    -

    {{$worker_title|escape}}

    +

    {{$worker_title}}

    {{include file="field_input.tpl" field=$maxloadavg}} {{include file="field_input.tpl" field=$min_memory}} {{include file="field_input.tpl" field=$worker_queues}} @@ -153,9 +153,9 @@ {{include file="field_checkbox.tpl" field=$worker_fastlane}} {{include file="field_checkbox.tpl" field=$worker_frontend}} -
    +
    -

    {{$relay_title|escape}}

    +

    {{$relay_title}}

    {{include file="field_checkbox.tpl" field=$relay_subscribe}} {{include file="field_input.tpl" field=$relay_server}} {{include file="field_checkbox.tpl" field=$relay_directly}} @@ -163,7 +163,7 @@ {{include file="field_input.tpl" field=$relay_server_tags}} {{include file="field_checkbox.tpl" field=$relay_user_tags}} -
    +
    @@ -173,8 +173,8 @@

    {{$relocate}}

    {{$relocate_warning}} {{include file="field_input.tpl" field=$relocate_url}} - -
    + +
    diff --git a/view/templates/admin/tos.tpl b/view/templates/admin/tos.tpl index 75244924bd..d4e1bcb48e 100644 --- a/view/templates/admin/tos.tpl +++ b/view/templates/admin/tos.tpl @@ -6,11 +6,11 @@ {{include file="field_checkbox.tpl" field=$displaytos}} {{include file="field_checkbox.tpl" field=$displayprivstatement}} {{include file="field_textarea.tpl" field=$tostext}} -
    +

    {{$preview}}

    {{for $i=1 to 3}} -

    {{$privtext[$i]}}

    +

    {{$privtext[$i] nofilter}}

    {{/for}}
    diff --git a/view/templates/admin/users.tpl b/view/templates/admin/users.tpl index f06b0f9734..88feb6136a 100644 --- a/view/templates/admin/users.tpl +++ b/view/templates/admin/users.tpl @@ -35,8 +35,8 @@ {{$u.email}} - - + + @@ -46,7 +46,7 @@ -
    +
    {{else}}

    {{$no_pending}}

    {{/if}} @@ -79,8 +79,8 @@ {{foreach $users as $u}} - {{$u.nickname|escape}} - {{$u.name}} + {{$u.nickname}} + {{$u.name}} {{$u.email}} {{$u.register_date}} {{$u.login_date}} @@ -94,8 +94,8 @@ {{/if}} {{if $u.is_deletable}} - - + + {{else}}   {{/if}} @@ -105,7 +105,7 @@ -
    +
    {{else}} NO USERS?!? {{/if}} @@ -122,8 +122,8 @@ {{foreach $deleted as $u}} - {{$u.nickname|escape}} - {{$u.name}} + {{$u.nickname}} + {{$u.name}} {{$u.email}} {{$u.register_date}} {{$u.login_date}} @@ -150,6 +150,6 @@ -
    +
    diff --git a/view/templates/album_edit.tpl b/view/templates/album_edit.tpl index 3d1d7573d7..72aedd8b70 100644 --- a/view/templates/album_edit.tpl +++ b/view/templates/album_edit.tpl @@ -4,12 +4,12 @@ - +
    - - + +
    diff --git a/view/templates/apps.tpl b/view/templates/apps.tpl index 1efd6fdcba..55303b3d74 100644 --- a/view/templates/apps.tpl +++ b/view/templates/apps.tpl @@ -3,6 +3,6 @@
      {{foreach $apps as $ap}} -
    • {{$ap}}
    • +
    • {{$ap nofilter}}
    • {{/foreach}}
    diff --git a/view/templates/auto_request.tpl b/view/templates/auto_request.tpl index c7e10482ef..ffc7b19d09 100644 --- a/view/templates/auto_request.tpl +++ b/view/templates/auto_request.tpl @@ -13,7 +13,7 @@ {{$invite_desc}}

    -{{$desc}} +{{$desc nofilter}}

    {{/if}} @@ -30,18 +30,18 @@ {{if $url}}
    {{$url_label}}
    {{$url}}
    {{/if}} {{if $location}}
    {{$location_label}}
    {{$location}}
    {{/if}} {{if $keywords}}
    {{$keywords_label}}
    {{$keywords}}
    {{/if}} -{{if $about}}
    {{$about_label}}
    {{$about}}
    {{/if}} +{{if $about}}
    {{$about_label}}
    {{$about nofilter}}
    {{/if}}
    {{if $myaddr}} {{$myaddr}} - + {{else}} - + {{/if}} {{if $url}} - + {{/if}}
    @@ -53,8 +53,8 @@
    {{if $submit}} - + {{/if}} - +
    diff --git a/view/templates/babel.tpl b/view/templates/babel.tpl index 659864af36..caa829621a 100644 --- a/view/templates/babel.tpl +++ b/view/templates/babel.tpl @@ -21,7 +21,7 @@

    {{$result.title}}

    - {{$result.content}} + {{$result.content nofilter}}
    {{/foreach}} diff --git a/view/templates/birthdays_reminder.tpl b/view/templates/birthdays_reminder.tpl index 9261ff8d32..6aa51d4702 100644 --- a/view/templates/birthdays_reminder.tpl +++ b/view/templates/birthdays_reminder.tpl @@ -1,10 +1,10 @@ {{if $count}} -{{* End of contact-edit-links *}} @@ -100,7 +100,7 @@ {{/if}} - + {{/if}}
    diff --git a/view/templates/contact_template.tpl b/view/templates/contact_template.tpl index 6845c62562..06918533ca 100644 --- a/view/templates/contact_template.tpl +++ b/view/templates/contact_template.tpl @@ -5,7 +5,7 @@ onmouseover="if (typeof t{{$contact.id}} != 'undefined') clearTimeout(t{{$contact.id}}); openMenu('contact-photo-menu-button-{{$contact.id}}')" onmouseout="t{{$contact.id}}=setTimeout('closeMenu(\'contact-photo-menu-button-{{$contact.id}}\'); closeMenu(\'contact-photo-menu-{{$contact.id}}\');',200)" > - {{$contact.name|escape}} + {{$contact.name}} {{if $multiselect}} @@ -31,7 +31,7 @@
    - {{$contact.name|escape}} + {{$contact.name}} {{if $contact.account_type}} ({{$contact.account_type}}){{/if}}
    {{if $contact.alt_text}}
    {{$contact.alt_text}}
    {{/if}} diff --git a/view/templates/contacts-template.tpl b/view/templates/contacts-template.tpl index d85fcfb5af..b320b0d050 100644 --- a/view/templates/contacts-template.tpl +++ b/view/templates/contacts-template.tpl @@ -5,14 +5,14 @@
    -{{$desc}} - - +{{$desc nofilter}} + +
    -{{$tabs}} +{{$tabs nofilter}}
    {{foreach $contacts as $contact}} @@ -21,7 +21,7 @@
    {{foreach $batch_actions as $n=>$l}} - + {{/foreach}}
    @@ -53,7 +53,7 @@ }); -{{$paginate}} +{{$paginate nofilter}} diff --git a/view/templates/contacts-widget-sidebar.tpl b/view/templates/contacts-widget-sidebar.tpl index 5b0610fcbd..af578acdaa 100644 --- a/view/templates/contacts-widget-sidebar.tpl +++ b/view/templates/contacts-widget-sidebar.tpl @@ -1,7 +1,7 @@ -{{$vcard_widget}} -{{$findpeople_widget}} -{{$follow_widget}} -{{$groups_widget}} -{{$networks_widget}} +{{$vcard_widget nofilter}} +{{$findpeople_widget nofilter}} +{{$follow_widget nofilter}} +{{$groups_widget nofilter}} +{{$networks_widget nofilter}} diff --git a/view/templates/content_wrapper.tpl b/view/templates/content_wrapper.tpl index e323b12e1b..ae2ad56657 100644 --- a/view/templates/content_wrapper.tpl +++ b/view/templates/content_wrapper.tpl @@ -8,5 +8,6 @@ {{/if}} {{* output the content *}} - {{$content}} + {{$content nofilter}} +
    diff --git a/view/templates/conversation.tpl b/view/templates/conversation.tpl index e46cd1395e..5a4ca2d634 100644 --- a/view/templates/conversation.tpl +++ b/view/templates/conversation.tpl @@ -1,5 +1,5 @@ -{{$live_update}} +{{$live_update nofilter}} {{foreach $threads as $thread}}
    diff --git a/view/templates/crepair.tpl b/view/templates/crepair.tpl index 72528bd261..bb24e096ea 100644 --- a/view/templates/crepair.tpl +++ b/view/templates/crepair.tpl @@ -1,10 +1,10 @@ {{include file="section_title.tpl"}} -{{$tab_str}} +{{$tab_str nofilter}} -
    {{$warning}}

    +
    {{$warning nofilter}}

    - {{$info}}
    + {{$info nofilter}}

    @@ -43,6 +43,6 @@ {{include file="field_select.tpl" field=$remote_self}} {{/if}} - + diff --git a/view/templates/cropbody.tpl b/view/templates/cropbody.tpl index 144277310e..8378e5067e 100644 --- a/view/templates/cropbody.tpl +++ b/view/templates/cropbody.tpl @@ -1,6 +1,6 @@

    {{$title}}

    - {{$desc}} + {{$desc nofilter}}

    @@ -48,7 +48,7 @@
    - +
    diff --git a/view/templates/delegate.tpl b/view/templates/delegate.tpl index 0cb6e7e3ec..0a875515d6 100644 --- a/view/templates/delegate.tpl +++ b/view/templates/delegate.tpl @@ -8,14 +8,14 @@ {{include file="field_select.tpl" field=$parent_user}} {{include file="field_password.tpl" field=$parent_password}} -
    +
    {{/if}}

    {{$delegates_header}}

    -
    {{$desc}}
    +
    {{$desc nofilter}}

    {{$head_delegates}}

    diff --git a/view/templates/dfrn_req_confirm.tpl b/view/templates/dfrn_req_confirm.tpl index d49b5bbf2d..693f8cbf92 100644 --- a/view/templates/dfrn_req_confirm.tpl +++ b/view/templates/dfrn_req_confirm.tpl @@ -10,13 +10,13 @@ -{{$aes_allow}} +{{$aes_allow nofilter}} - +
    - +
    \ No newline at end of file diff --git a/view/templates/dfrn_request.tpl b/view/templates/dfrn_request.tpl index 8e686c33dc..39fa295deb 100644 --- a/view/templates/dfrn_request.tpl +++ b/view/templates/dfrn_request.tpl @@ -12,7 +12,7 @@ {{$invite_desc}}

    -{{$desc}} +{{$desc nofilter}}

    {{/if}} @@ -29,18 +29,18 @@ {{if $url}}
    {{$url_label}}
    {{$url}}
    {{/if}} {{if $location}}
    {{$location_label}}
    {{$location}}
    {{/if}} {{if $keywords}}
    {{$keywords_label}}
    {{$keywords}}
    {{/if}} -{{if $about}}
    {{$about_label}}
    {{$about}}
    {{/if}} +{{if $about}}
    {{$about_label}}
    {{$about nofilter}}
    {{/if}}
    {{if $myaddr}} {{$myaddr}} - + {{else}} - + {{/if}} {{if $url}} - + {{/if}}
    @@ -83,8 +83,8 @@
    {{if $submit}} - + {{/if}} - +
    diff --git a/view/templates/directory_header.tpl b/view/templates/directory_header.tpl index 46f17de40e..4c9fe1298e 100644 --- a/view/templates/directory_header.tpl +++ b/view/templates/directory_header.tpl @@ -10,9 +10,9 @@
    - {{$desc}} - - + {{$desc nofilter}} + +
    @@ -28,4 +28,4 @@
    -{{$paginate}} +{{$paginate nofilter}} diff --git a/view/templates/email_notify_html.tpl b/view/templates/email_notify_html.tpl index 94fac74471..d9eeb841fd 100644 --- a/view/templates/email_notify_html.tpl +++ b/view/templates/email_notify_html.tpl @@ -1,4 +1,3 @@ - @@ -6,28 +5,33 @@ - +
    - + + + + - - - - {{if $content_allowed}} +{{if $content_allowed}} {{if $source_photo}} - - - {{/if}} - - - {{/if}} - - - - + + + + + {{/if}} + + +{{/if}} + + + + -
    {{$product}}
    + +
    {{$product}}
    +
    +
    {{$preamble nofilter}}
    {{$preamble}}
    {{$source_name}}
    {{$title}}
    {{$htmlversion}}
    {{$hsitelink}}
    {{$hitemlink}}
    {{$thanks}}
    {{$site_admin}}
    {{$source_name}}
    {{$title}}
    {{$htmlversion nofilter}}
    {{$hsitelink nofilter}}
    {{$hitemlink nofilter}}
    {{$thanks}}
    {{$site_admin}}
    + - diff --git a/view/templates/event.tpl b/view/templates/event.tpl index 495cf2eb18..f1d2bf102b 100644 --- a/view/templates/event.tpl +++ b/view/templates/event.tpl @@ -3,7 +3,7 @@
    {{if $event.item.author_name}}{{$event.item.author_name}}{{/if}} - {{$event.html}} + {{$event.html nofilter}} {{if $event.item.plink}}{{/if}} {{if $event.edit}}{{/if}} {{if $event.copy}}{{/if}} diff --git a/view/templates/event_form.tpl b/view/templates/event_form.tpl index de8de44e88..0527c69905 100644 --- a/view/templates/event_form.tpl +++ b/view/templates/event_form.tpl @@ -2,7 +2,7 @@

    {{$title}}

    -{{$desc}} +{{$desc nofilter}}

    @@ -12,9 +12,9 @@ -{{$s_dsel}} +{{$s_dsel nofilter}} -{{$f_dsel}} +{{$f_dsel nofilter}} {{include file="field_checkbox.tpl" field=$nofinish}} @@ -36,10 +36,9 @@ {{include file="field_checkbox.tpl" field=$share}} {{/if}} -{{$acl}} +{{$acl nofilter}}
    - - + +
    - diff --git a/view/templates/event_stream_item.tpl b/view/templates/event_stream_item.tpl index af9a554942..3480228c10 100644 --- a/view/templates/event_stream_item.tpl +++ b/view/templates/event_stream_item.tpl @@ -1,30 +1,30 @@
    -
    {{$title|escape}}
    +
    {{$title}}
    {{$dtstart_label}}  - {{$dtstart_dt}} + {{$dtstart_dt}}
    {{if $finish}}
    {{$dtend_label}}  - {{$dtend_dt}} + {{$dtend_dt}}
    {{/if}} {{if $description}} -
    {{$description}}
    +
    {{$description nofilter}}
    {{/if}} {{if $location}}
    {{$location_label}}  {{if $location.name}} - {{$location.name}} + {{$location.name nofilter}} {{/if}} - {{if $location.map}}{{$location.map}}{{/if}} + {{if $location.map}}{{$location.map nofilter}}{{/if}}
    {{/if}} diff --git a/view/templates/events.tpl b/view/templates/events.tpl index f723cb44c4..cae7b32822 100644 --- a/view/templates/events.tpl +++ b/view/templates/events.tpl @@ -1,5 +1,5 @@ -{{$tabs}} +{{$tabs nofilter}} {{include file="section_title.tpl"}} @@ -16,7 +16,7 @@
    {{if $event.is_first}}
    {{$event.d}}
    {{/if}} {{if $event.item.author_name}}{{$event.item.author_name}}{{/if}} - {{$event.html}} + {{$event.html nofilter}} {{if $event.item.plink}}{{/if}} {{if $event.edit}}{{/if}}
    diff --git a/view/templates/events_js.tpl b/view/templates/events_js.tpl index ed9354bdef..ab375401a2 100644 --- a/view/templates/events_js.tpl +++ b/view/templates/events_js.tpl @@ -1,5 +1,5 @@ -{{$tabs}} +{{$tabs nofilter}}

    {{$title}}

    diff --git a/view/templates/events_reminder.tpl b/view/templates/events_reminder.tpl index 08278954c3..2fcb1908d7 100644 --- a/view/templates/events_reminder.tpl +++ b/view/templates/events_reminder.tpl @@ -1,10 +1,10 @@ {{if $count}} - diff --git a/view/templates/field_custom.tpl b/view/templates/field_custom.tpl index 6649b0ff94..8dcad3ded7 100644 --- a/view/templates/field_custom.tpl +++ b/view/templates/field_custom.tpl @@ -2,8 +2,8 @@
    - {{$field.2}} + {{$field.2 nofilter}} {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/field_input.tpl b/view/templates/field_input.tpl index 850656bb8c..efe2c77c1b 100644 --- a/view/templates/field_input.tpl +++ b/view/templates/field_input.tpl @@ -1,8 +1,8 @@
    - + {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/field_intcheckbox.tpl b/view/templates/field_intcheckbox.tpl index 9c5f04e796..0bb6ef2c54 100644 --- a/view/templates/field_intcheckbox.tpl +++ b/view/templates/field_intcheckbox.tpl @@ -2,8 +2,8 @@
    - + {{if $field.4}} - {{$field.4}} + {{$field.4 nofilter}} {{/if}}
    diff --git a/view/templates/field_openid.tpl b/view/templates/field_openid.tpl index 9a18bbc13c..5faa8c7e96 100644 --- a/view/templates/field_openid.tpl +++ b/view/templates/field_openid.tpl @@ -1,8 +1,8 @@
    - + {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/field_password.tpl b/view/templates/field_password.tpl index 4b4d4f2b2e..26522fbc78 100644 --- a/view/templates/field_password.tpl +++ b/view/templates/field_password.tpl @@ -1,8 +1,8 @@
    - + {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/field_radio.tpl b/view/templates/field_radio.tpl index 1e1d8e0b10..7fe96a3dd8 100644 --- a/view/templates/field_radio.tpl +++ b/view/templates/field_radio.tpl @@ -1,7 +1,7 @@
    - + {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/field_richtext.tpl b/view/templates/field_richtext.tpl index bc346ddb0b..1e1fa15b65 100644 --- a/view/templates/field_richtext.tpl +++ b/view/templates/field_richtext.tpl @@ -2,8 +2,8 @@
    - + {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/field_select.tpl b/view/templates/field_select.tpl index 87a2ab9ff8..2016a0bb7e 100644 --- a/view/templates/field_select.tpl +++ b/view/templates/field_select.tpl @@ -3,9 +3,9 @@
    {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/field_select_raw.tpl b/view/templates/field_select_raw.tpl index 147c028eff..1f4630e995 100644 --- a/view/templates/field_select_raw.tpl +++ b/view/templates/field_select_raw.tpl @@ -3,9 +3,9 @@
    {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/field_textarea.tpl b/view/templates/field_textarea.tpl index 60594a2666..2ee145b0c4 100644 --- a/view/templates/field_textarea.tpl +++ b/view/templates/field_textarea.tpl @@ -2,8 +2,8 @@
    - + {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/field_themeselect.tpl b/view/templates/field_themeselect.tpl index 5f56c187ef..6242cc6711 100644 --- a/view/templates/field_themeselect.tpl +++ b/view/templates/field_themeselect.tpl @@ -3,10 +3,10 @@
    {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}} {{if $field.5}}
    {{/if}}
    diff --git a/view/templates/field_yesno.tpl b/view/templates/field_yesno.tpl index 7e7c3cc4ee..182efcf18d 100644 --- a/view/templates/field_yesno.tpl +++ b/view/templates/field_yesno.tpl @@ -2,7 +2,7 @@
    {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/templates/fileas_widget.tpl b/view/templates/fileas_widget.tpl index 1ba459bd3a..a55c90bc93 100644 --- a/view/templates/fileas_widget.tpl +++ b/view/templates/fileas_widget.tpl @@ -1,7 +1,7 @@

    {{$title}}

    -
    {{$desc}}
    +
    {{$desc nofilter}}
    • {{$all}}
    • diff --git a/view/templates/filebrowser.tpl b/view/templates/filebrowser.tpl index 27a73d0398..f1417c12db 100644 --- a/view/templates/filebrowser.tpl +++ b/view/templates/filebrowser.tpl @@ -40,7 +40,7 @@
    - +
    diff --git a/view/templates/filer_dialog.tpl b/view/templates/filer_dialog.tpl index 27aa9b2f5b..77f48e8aee 100644 --- a/view/templates/filer_dialog.tpl +++ b/view/templates/filer_dialog.tpl @@ -1,5 +1,5 @@ {{include file="field_combobox.tpl"}}
    - +
    diff --git a/view/templates/files.tpl b/view/templates/files.tpl index b622bb3e1d..07e64d89c9 100644 --- a/view/templates/files.tpl +++ b/view/templates/files.tpl @@ -1,4 +1,4 @@ {{foreach $items as $item }} -

    {{$item.title|escape}} ({{$item.mime|escape}}) ({{$item.filename|escape}})

    +

    {{$item.title}} ({{$item.mime}}) ({{$item.filename}})

    {{/foreach}} {{include "paginate.tpl"}} diff --git a/view/templates/follow.tpl b/view/templates/follow.tpl index ece5ed17b8..12a5621235 100644 --- a/view/templates/follow.tpl +++ b/view/templates/follow.tpl @@ -1,9 +1,9 @@

    {{$connect}}

    -
    {{$desc}}
    +
    {{$desc nofilter}}
    - +
    diff --git a/view/templates/generic_links_widget.tpl b/view/templates/generic_links_widget.tpl index 124079a1d9..57f4098958 100644 --- a/view/templates/generic_links_widget.tpl +++ b/view/templates/generic_links_widget.tpl @@ -1,7 +1,7 @@
    {{if $title}}

    {{$title}}

    {{/if}} - {{if $desc}}
    {{$desc}}
    {{/if}} + {{if $desc}}
    {{$desc nofilter}}
    {{/if}}
      {{foreach $items as $item}} diff --git a/view/templates/group_edit.tpl b/view/templates/group_edit.tpl index cb9f4198b4..cc12bc736c 100644 --- a/view/templates/group_edit.tpl +++ b/view/templates/group_edit.tpl @@ -8,9 +8,9 @@ {{include file="field_input.tpl" field=$gname}} - {{if $drop}}{{$drop}}{{/if}} + {{if $drop}}{{$drop nofilter}}{{/if}}
      - +
      @@ -23,4 +23,4 @@ {{include file="groupeditor.tpl"}}
    {{/if}} -{{if $desc}}
    {{$desc}}
    {{/if}} +{{if $desc}}
    {{$desc nofilter}}
    {{/if}} diff --git a/view/templates/head.tpl b/view/templates/head.tpl index f1983d7dc6..e76b97b8b9 100644 --- a/view/templates/head.tpl +++ b/view/templates/head.tpl @@ -9,7 +9,7 @@ {{foreach $stylesheets as $stylesheetUrl}} - + {{/foreach}} diff --git a/view/templates/home.tpl b/view/templates/home.tpl index 6e50a75306..eb3f402fc6 100644 --- a/view/templates/home.tpl +++ b/view/templates/home.tpl @@ -1,14 +1,14 @@ {{* custom content from hook will replace everything. *}} {{if $content != '' }} - {{$content}} + {{$content nofilter}} {{else}} {{if $customhome != false }} {{include file="$customhome"}} {{else}} - {{$defaultheader}} + {{$defaultheader nofilter}} {{/if}} - {{$login}} + {{$login nofilter}} {{/if}} diff --git a/view/templates/hovercard.tpl b/view/templates/hovercard.tpl index ec87591b9f..a688f57b20 100644 --- a/view/templates/hovercard.tpl +++ b/view/templates/hovercard.tpl @@ -3,31 +3,31 @@
    - {{$profile.name|escape}} + {{$profile.name}}
    -

    {{$profile.name|escape}}

    {{if $profile.account_type}}{{$profile.account_type}}{{/if}} +

    {{$profile.name}}

    {{if $profile.account_type}}{{$profile.account_type}}{{/if}}
    - {{$profile.addr|escape}} - {{if $profile.network}} ({{$profile.network}}){{/if}} + {{$profile.addr}} + {{if $profile.network_link}}({{$profile.network_link nofilter}}){{/if}}
    - {{*{{if $profile.about}}
    {{$profile.about}}
    {{/if}}*}} + {{*{{if $profile.about}}
    {{$profile.about nofilter}}
    {{/if}}*}}
    {{* here are the differnt actions like privat message, poke, delete and so on *}} {{* @todo we have two different photo menus one for contacts and one for items at the network stream. We currently use the contact photo menu, so the items options are missing We need to move them *}}
    - {{if $profile.actions.pm}}{{/if}} - {{if $profile.actions.poke}}{{/if}} + {{if $profile.actions.pm}}{{/if}} + {{if $profile.actions.poke}}{{/if}}
    - {{if $profile.actions.network}}{{/if}} - {{if $profile.actions.edit}}{{/if}} - {{if $profile.actions.follow}}{{/if}} + {{if $profile.actions.network}}{{/if}} + {{if $profile.actions.edit}}{{/if}} + {{if $profile.actions.follow}}{{/if}}
    diff --git a/view/templates/http_status.tpl b/view/templates/http_status.tpl index 55cc133ff0..6b366d6f04 100644 --- a/view/templates/http_status.tpl +++ b/view/templates/http_status.tpl @@ -4,6 +4,6 @@

    {{$title}}

    -

    {{$description}}

    +

    {{$description nofilter}}

    diff --git a/view/templates/install_checks.tpl b/view/templates/install_checks.tpl index f960729111..151b78dec2 100644 --- a/view/templates/install_checks.tpl +++ b/view/templates/install_checks.tpl @@ -4,7 +4,7 @@
    {{foreach $checks as $check}} - {{if $check.help}}
    {{$check.title}} +
    {{$check.title nofilter}} {{if $check.status}} Ok {{else}} @@ -17,7 +17,7 @@ {{if $check.required}}(required){{/if}}
    -
    {{$check.help}}
    +
    {{$check.help nofilter}}
    {{if $check.error_msg}}
    {{$check.error_msg.head}}
    {{$check.error_msg.url}}
    {{$check.error_msg.msg}}
    @@ -28,14 +28,14 @@
    {{if $phpath}} - + {{/if}} {{if $passed}} - + {{else}} - + {{/if}}
    diff --git a/view/templates/install_db.tpl b/view/templates/install_db.tpl index 6c018db722..a4fa430247 100644 --- a/view/templates/install_db.tpl +++ b/view/templates/install_db.tpl @@ -1,13 +1,10 @@ - -

    {{$title}}

    {{$pass}}

    -

    -{{$info_01}}
    -{{$info_02}}
    -{{$info_03}} + {{$info_01}}
    + {{$info_02}}
    + {{$info_03}}

    @@ -21,16 +18,14 @@ - - + + -{{include file="field_input.tpl" field=$dbhost}} -{{include file="field_input.tpl" field=$dbuser}} -{{include file="field_password.tpl" field=$dbpass}} -{{include file="field_input.tpl" field=$dbdata}} + {{include file="field_input.tpl" field=$dbhost}} + {{include file="field_input.tpl" field=$dbuser}} + {{include file="field_password.tpl" field=$dbpass}} + {{include file="field_input.tpl" field=$dbdata}} - - + - diff --git a/view/templates/install_finished.tpl b/view/templates/install_finished.tpl index 5c8d765e31..8e643b7a1b 100644 --- a/view/templates/install_finished.tpl +++ b/view/templates/install_finished.tpl @@ -1,13 +1,10 @@ - -

    {{$title}}

    {{$pass}}

    - {{foreach $checks as $check}} Requirement not satisfied -{{$check.title}} - +{{$check.title nofilter}} + {{/foreach}} -{{$text}} +{{$text nofilter}} diff --git a/view/templates/install_settings.tpl b/view/templates/install_settings.tpl index 55e5ea34b1..a7e4886ae7 100644 --- a/view/templates/install_settings.tpl +++ b/view/templates/install_settings.tpl @@ -6,18 +6,18 @@ - - - - - + + + + + {{include file="field_input.tpl" field=$adminmail}} -{{$timezone}} +{{$timezone nofilter}} {{include file="field_select.tpl" field=$language}} - + diff --git a/view/templates/intros.tpl b/view/templates/intros.tpl index 9ebd256db8..049e482f23 100644 --- a/view/templates/intros.tpl +++ b/view/templates/intros.tpl @@ -3,18 +3,18 @@

    {{$str_notifytype}} {{$notify_type}}

    -{{$fullname|escape:'html'}} +{{$fullname}}
    {{$lbl_url}}
    {{$url}}
    {{if $location}}
    {{$lbl_location}}
    {{$location}}
    {{/if}} {{if $gender}}
    {{$lbl_gender}}
    {{$gender}}
    {{/if}} {{if $keywords}}
    {{$lbl_keywords}}
    {{$keywords}}
    {{/if}} -{{if $about}}
    {{$lbl_about}}
    {{$about}}
    {{/if}} +{{if $about}}
    {{$lbl_about}}
    {{$about nofilter}}
    {{/if}}
    {{$lbl_knowyou}} {{$knowyou}}
    {{$note}}
    - -{{if $discard}}{{/if}} + +{{if $discard}}{{/if}}
    @@ -24,9 +24,9 @@ -{{$dfrn_text}} +{{$dfrn_text nofilter}} - +
    diff --git a/view/templates/invite.tpl b/view/templates/invite.tpl index 2087635e4f..6f161fd4f5 100644 --- a/view/templates/invite.tpl +++ b/view/templates/invite.tpl @@ -11,7 +11,7 @@ {{include file="field_textarea.tpl" field=$message}}
    - +
    diff --git a/view/templates/jot.tpl b/view/templates/jot.tpl index ca6d506ac6..c0f463e48a 100644 --- a/view/templates/jot.tpl +++ b/view/templates/jot.tpl @@ -9,8 +9,8 @@ - - + + @@ -18,64 +18,64 @@ {{if $notes_cid}} {{/if}} -
    +
    {{if $placeholdercategory}} -
    +
    {{/if}}
    - +
    - +
    -
    +
    -
    +
    - +
    - +
    - +
    - {{$bang}} + {{$bang}}
    - {{if $preview}}{{/if}} + {{if $preview}}{{/if}}
    - {{$jotplugins}} + {{$jotplugins nofilter}}
    - +
    - {{$acl}} + {{$acl nofilter}}
    diff --git a/view/templates/login.tpl b/view/templates/login.tpl index 029ebb0343..19db6afc7c 100644 --- a/view/templates/login.tpl +++ b/view/templates/login.tpl @@ -10,7 +10,7 @@ {{include file="field_input.tpl" field=$lname}} {{include file="field_password.tpl" field=$lpassword}}
    @@ -21,13 +21,13 @@ {{/if}}
    - +
    {{include file="field_checkbox.tpl" field=$lremember}} {{foreach $hiddens as $k=>$v}} - + {{/foreach}} @@ -35,8 +35,8 @@ {{if $register}} {{/if}} diff --git a/view/templates/logout.tpl b/view/templates/logout.tpl index 343088d558..ba66f831cc 100644 --- a/view/templates/logout.tpl +++ b/view/templates/logout.tpl @@ -2,6 +2,6 @@
    - +
    diff --git a/view/templates/lostpass.tpl b/view/templates/lostpass.tpl index 3dfbb7a237..3c4f422197 100644 --- a/view/templates/lostpass.tpl +++ b/view/templates/lostpass.tpl @@ -2,7 +2,7 @@

    {{$title}}

    -{{$desc}} +{{$desc nofilter}}

    @@ -12,7 +12,7 @@
    - +
    diff --git a/view/templates/mail_conv.tpl b/view/templates/mail_conv.tpl index 9ad7fec345..905bf36254 100644 --- a/view/templates/mail_conv.tpl +++ b/view/templates/mail_conv.tpl @@ -7,7 +7,7 @@
    {{$mail.from_name}}
    {{$mail.date}}
    {{$mail.subject}}
    -
    {{$mail.body}}
    +
    {{$mail.body nofilter}}
    diff --git a/view/templates/mail_head.tpl b/view/templates/mail_head.tpl index 289b93648f..d54bfc5bfb 100644 --- a/view/templates/mail_head.tpl +++ b/view/templates/mail_head.tpl @@ -1,4 +1,2 @@

    {{$messages}}

    - -{{$tab_content}} diff --git a/view/templates/manage.tpl b/view/templates/manage.tpl index dd27092e9b..d881e5fb62 100644 --- a/view/templates/manage.tpl +++ b/view/templates/manage.tpl @@ -1,6 +1,6 @@

    {{$title}}

    -
    {{$desc}}
    +
    {{$desc nofilter}}
    {{$choose}}

    {{$authorize}}

    -
    +
    diff --git a/view/templates/peoplefind.tpl b/view/templates/peoplefind.tpl index 67f7a8086b..d4d99c2dac 100644 --- a/view/templates/peoplefind.tpl +++ b/view/templates/peoplefind.tpl @@ -3,7 +3,7 @@

    {{$nv.findpeople}}

    {{$nv.desc}}
    - + diff --git a/view/templates/photo_album.tpl b/view/templates/photo_album.tpl index 08df8f7567..cae3b868af 100644 --- a/view/templates/photo_album.tpl +++ b/view/templates/photo_album.tpl @@ -10,12 +10,12 @@ {{foreach $photos as $photo}}
    {{/foreach}} -{{$paginate}} +{{$paginate nofilter}} diff --git a/view/templates/photo_edit.tpl b/view/templates/photo_edit.tpl index 8bad963020..8b22dfb44c 100644 --- a/view/templates/photo_edit.tpl +++ b/view/templates/photo_edit.tpl @@ -21,14 +21,14 @@
    - {{$aclselect}} + {{$aclselect nofilter}}
    - - + +
    diff --git a/view/templates/photo_top.tpl b/view/templates/photo_top.tpl index 0dd8c4e996..902f742327 100644 --- a/view/templates/photo_top.tpl +++ b/view/templates/photo_top.tpl @@ -1,7 +1,7 @@ diff --git a/view/templates/photo_view.tpl b/view/templates/photo_view.tpl index 8fa3de61d2..4f5be40fc5 100644 --- a/view/templates/photo_view.tpl +++ b/view/templates/photo_view.tpl @@ -12,27 +12,27 @@ {{if $prevlink}}{{/if}} -
    +
    {{if $nextlink}}{{/if}}
    -
    {{$desc}}
    +
    {{$desc nofilter}}
    {{if $tags}}
    {{$tags.0}}
    {{$tags.1}}
    {{/if}} {{if $tags.2}}{{/if}} -{{if $edit}}{{$edit}}{{/if}} +{{if $edit}}{{$edit nofilter}}{{/if}} {{if $likebuttons}}
    - {{$likebuttons}} - {{$like}} - {{$dislike}} + {{$likebuttons nofilter}} + {{$like nofilter}} + {{$dislike nofilter}}
    {{/if}} -{{$comments}} +{{$comments nofilter}} -{{$paginate}} +{{$paginate nofilter}} diff --git a/view/templates/photos_default_uploader_submit.tpl b/view/templates/photos_default_uploader_submit.tpl index 91444e2d55..e178e977a7 100644 --- a/view/templates/photos_default_uploader_submit.tpl +++ b/view/templates/photos_default_uploader_submit.tpl @@ -1,4 +1,4 @@
    - +
    diff --git a/view/templates/photos_recent.tpl b/view/templates/photos_recent.tpl index 19456187bc..b75c5a41a4 100644 --- a/view/templates/photos_recent.tpl +++ b/view/templates/photos_recent.tpl @@ -11,4 +11,4 @@
    -{{$paginate}} +{{$paginate nofilter}} diff --git a/view/templates/photos_upload.tpl b/view/templates/photos_upload.tpl index aeb6e5957b..9e606242ed 100644 --- a/view/templates/photos_upload.tpl +++ b/view/templates/photos_upload.tpl @@ -34,16 +34,16 @@
    - {{$aclselect}} + {{$aclselect nofilter}}
    - {{$alt_uploader}} + {{$alt_uploader nofilter}} - {{$default_upload_box}} - {{$default_upload_submit}} + {{$default_upload_box nofilter}} + {{$default_upload_submit nofilter}}
    diff --git a/view/templates/poke_content.tpl b/view/templates/poke_content.tpl index 18191de03f..91aadcdd8c 100644 --- a/view/templates/poke_content.tpl +++ b/view/templates/poke_content.tpl @@ -1,7 +1,7 @@

    {{$title}}

    -
    {{$desc}}
    +
    {{$desc nofilter}}
    @@ -9,7 +9,7 @@
    {{$clabel}}
    - +
    @@ -28,7 +28,7 @@
    - + diff --git a/view/templates/profile-hide-wall.tpl b/view/templates/profile-hide-wall.tpl index e61c4dd963..ff106fa29f 100644 --- a/view/templates/profile-hide-wall.tpl +++ b/view/templates/profile-hide-wall.tpl @@ -1,6 +1,6 @@

    -{{$desc}} +{{$desc nofilter}}

    diff --git a/view/templates/profile-in-directory.tpl b/view/templates/profile-in-directory.tpl index 942c2e3e89..bfc13e85eb 100644 --- a/view/templates/profile-in-directory.tpl +++ b/view/templates/profile-in-directory.tpl @@ -1,6 +1,6 @@

    -{{$desc}} +{{$desc nofilter}}

    diff --git a/view/templates/profile-in-netdir.tpl b/view/templates/profile-in-netdir.tpl index 559caed342..c91601bce8 100644 --- a/view/templates/profile-in-netdir.tpl +++ b/view/templates/profile-in-netdir.tpl @@ -1,6 +1,6 @@

    -{{$desc}} +{{$desc nofilter}}

    diff --git a/view/templates/profile_advanced.tpl b/view/templates/profile_advanced.tpl index 19d4490eaf..83685d86e5 100644 --- a/view/templates/profile_advanced.tpl +++ b/view/templates/profile_advanced.tpl @@ -58,7 +58,7 @@ {{if $profile.homepage}}
    {{$profile.homepage.0}}
    -
    {{$profile.homepage.1}}
    +
    {{$profile.homepage.1 nofilter}}
    {{/if}} @@ -86,35 +86,35 @@ {{if $profile.about}}
    {{$profile.about.0}}
    -
    {{$profile.about.1}}
    +
    {{$profile.about.1 nofilter}}
    {{/if}} {{if $profile.interest}}
    {{$profile.interest.0}}
    -
    {{$profile.interest.1}}
    +
    {{$profile.interest.1 nofilter}}
    {{/if}} {{if $profile.likes}}
    {{$profile.likes.0}}
    -
    {{$profile.likes.1}}
    +
    {{$profile.likes.1 nofilter}}
    {{/if}} {{if $profile.dislikes}}
    {{$profile.dislikes.0}}
    -
    {{$profile.dislikes.1}}
    +
    {{$profile.dislikes.1 nofilter}}
    {{/if}} {{if $profile.contact}}
    {{$profile.contact.0}}
    -
    {{$profile.contact.1}}
    +
    {{$profile.contact.1 nofilter}}
    {{/if}} @@ -122,7 +122,7 @@ {{if $profile.music}}
    {{$profile.music.0}}
    -
    {{$profile.music.1}}
    +
    {{$profile.music.1 nofilter}}
    {{/if}} @@ -130,7 +130,7 @@ {{if $profile.book}}
    {{$profile.book.0}}
    -
    {{$profile.book.1}}
    +
    {{$profile.book.1 nofilter}}
    {{/if}} @@ -138,7 +138,7 @@ {{if $profile.tv}}
    {{$profile.tv.0}}
    -
    {{$profile.tv.1}}
    +
    {{$profile.tv.1 nofilter}}
    {{/if}} @@ -146,7 +146,7 @@ {{if $profile.film}}
    {{$profile.film.0}}
    -
    {{$profile.film.1}}
    +
    {{$profile.film.1 nofilter}}
    {{/if}} @@ -154,7 +154,7 @@ {{if $profile.romance}}
    {{$profile.romance.0}}
    -
    {{$profile.romance.1}}
    +
    {{$profile.romance.1 nofilter}}
    {{/if}} @@ -162,14 +162,14 @@ {{if $profile.work}}
    {{$profile.work.0}}
    -
    {{$profile.work.1}}
    +
    {{$profile.work.1 nofilter}}
    {{/if}} {{if $profile.education}}
    {{$profile.education.0}}
    -
    {{$profile.education.1}}
    +
    {{$profile.education.1 nofilter}}
    {{/if}} @@ -177,7 +177,7 @@ {{if $profile.forumlist}}
    {{$profile.forumlist.0}}
    -
    {{$profile.forumlist.1}}
    +
    {{$profile.forumlist.1 nofilter}}
    {{/if}} diff --git a/view/templates/profile_edit.tpl b/view/templates/profile_edit.tpl index 2363bd3f06..08e833f10a 100644 --- a/view/templates/profile_edit.tpl +++ b/view/templates/profile_edit.tpl @@ -1,15 +1,15 @@ -{{$default}} +{{$default nofilter}}

    {{$banner}}

    @@ -25,35 +25,35 @@ {{include file="field_yesno.tpl" field=$details}}
    -
    *
    +
    *
    - +
    - +
    -{{$gender}} +{{$gender nofilter}}
    -{{$dob}} +{{$dob nofilter}}
    -{{$hide_friends}} +{{$hide_friends nofilter}}
    @@ -63,20 +63,20 @@
    - +
    - +
    - +
    @@ -100,7 +100,7 @@
    - +
    @@ -110,19 +110,19 @@
    - -{{$marital}} + +{{$marital nofilter}}
    - +
    -{{$sexual}} +{{$sexual nofilter}}
    @@ -130,38 +130,38 @@
    - +
    - +
    {{$xmpp.3}}
    - +
    - +
    - +
    {{$pub_keywords.3}}
    - +
    {{$prv_keywords.3}}
    @@ -330,60 +330,60 @@ {{/if}}
    -
    *
    +
    *
    - +
    {{if $personal_account}}
    -{{$gender}} +{{$gender nofilter}}
    -{{$dob}} +{{$dob nofilter}}
    {{/if}}
    - +
    - +
    {{$xmpp.3}}
    -{{$hide_friends}} +{{$hide_friends nofilter}}
    - +
    - +
    - +
    @@ -407,13 +407,13 @@
    - +
    {{$pub_keywords.3}}
    - +
    {{$prv_keywords.3}}
    diff --git a/view/templates/profile_entry.tpl b/view/templates/profile_entry.tpl index 69b39b9b33..e7c3a31dda 100644 --- a/view/templates/profile_entry.tpl +++ b/view/templates/profile_entry.tpl @@ -7,6 +7,6 @@ -
    {{$visible}}
    +
    {{$visible nofilter}}
    diff --git a/view/templates/profile_listing_header.tpl b/view/templates/profile_listing_header.tpl index 88514c554a..65f38f3a64 100644 --- a/view/templates/profile_listing_header.tpl +++ b/view/templates/profile_listing_header.tpl @@ -10,5 +10,5 @@
    - {{$profiles}} + {{$profiles nofilter}}
    diff --git a/view/templates/profile_photo.tpl b/view/templates/profile_photo.tpl index 1695d01e27..e7c6b89608 100644 --- a/view/templates/profile_photo.tpl +++ b/view/templates/profile_photo.tpl @@ -17,11 +17,11 @@
    - +
    \ No newline at end of file diff --git a/view/templates/profile_vcard.tpl b/view/templates/profile_vcard.tpl index 14e1a03736..124fca154f 100644 --- a/view/templates/profile_vcard.tpl +++ b/view/templates/profile_vcard.tpl @@ -1,19 +1,19 @@
    -
    {{$profile.name|escape}}
    +
    {{$profile.name}}
    - {{if $profile.addr}}
    {{$profile.addr|escape}}
    {{/if}} + {{if $profile.addr}}
    {{$profile.addr}}
    {{/if}} {{if $profile.pdesc}}
    {{$profile.pdesc}}
    {{/if}} {{if $profile.picdate}} -
    {{$profile.name|escape}}
    +
    {{$profile.name}}
    {{else}} -
    {{$profile.name|escape}}
    +
    {{$profile.name}}
    {{/if}} {{if $account_type}}{{/if}} - {{if $profile.network_name}}
    {{$network}}
    {{$profile.network_name}}
    {{/if}} + {{if $profile.network_link}}
    {{$network}}
    {{$profile.network_link nofilter}}
    {{/if}} {{if $location}}
    {{$location}}
    @@ -47,7 +47,7 @@ {{if $homepage}}
    {{$homepage}}
    {{$profile.homepage}}
    {{/if}} - {{if $about}}
    {{$about}}
    {{$profile.about}}
    {{/if}} + {{if $about}}
    {{$about}}
    {{$profile.about nofilter}}
    {{/if}} {{include file="diaspora_vcard.tpl"}} @@ -70,6 +70,6 @@
    -{{$contact_block}} +{{$contact_block nofilter}} diff --git a/view/templates/prv_message.tpl b/view/templates/prv_message.tpl index 654671af0e..087d08dbbc 100644 --- a/view/templates/prv_message.tpl +++ b/view/templates/prv_message.tpl @@ -5,10 +5,10 @@
    -{{$parent}} +{{$parent nofilter}}
    {{$to}}
    -{{$select}} +{{$select nofilter}}
    {{$subject}}
    @@ -18,15 +18,15 @@
    - +
    -
    +
    - +
    diff --git a/view/templates/register.tpl b/view/templates/register.tpl index 2e5588ae71..2b23934b79 100644 --- a/view/templates/register.tpl +++ b/view/templates/register.tpl @@ -5,44 +5,39 @@ - {{if $registertext != ""}}
    {{$registertext}}
    {{/if}} + {{if $registertext != ""}}
    {{$registertext nofilter}}
    {{/if}} {{if $explicit_content}}

    {{$explicit_content_note}}

    {{/if}} -

    {{$realpeople}}

    -

    {{$fillwith}}

    {{$fillext}}

    {{if $oidlabel}}
    - +
    {{/if}} {{if $invitations}} -

    {{$invite_desc}}

    - {{/if}} -
    - +
    - +
    @@ -55,7 +50,7 @@
    -
    @{{$sitename}}
    +
    @{{$sitename}}
    @@ -63,29 +58,25 @@ {{include file="field_textarea.tpl" field=$permonlybox}} {{/if}} - {{$publish}} + {{$publish nofilter}} - {{if $showtoslink}} +{{if $showtoslink}}

    {{$tostext}}

    - {{/if}} - {{if $showprivstatement}} +{{/if}} +{{if $showprivstatement}}

    {{$privstatement.0}}

    {{for $i=1 to 3}} -

    {{$privstatement[$i]}}

    +

    {{$privstatement[$i] nofilter}}

    {{/for}} - {{/if}} +{{/if}}
    - +
    -

    {{$importh}}

    +

    {{$importh}}

    - -{{$license}} - - diff --git a/view/templates/remote_friends_common.tpl b/view/templates/remote_friends_common.tpl index f5f43360a7..4ae682f436 100644 --- a/view/templates/remote_friends_common.tpl +++ b/view/templates/remote_friends_common.tpl @@ -1,17 +1,17 @@
    -
    {{$desc}}      {{if $linkmore}}{{$more}}{{/if}}
    +
    {{$desc nofilter}}      {{if $linkmore}}{{$more}}{{/if}}
    {{if $items}} {{foreach $items as $item}} diff --git a/view/templates/removeme.tpl b/view/templates/removeme.tpl index 4acfb9ff1a..1e52bfa4e5 100644 --- a/view/templates/removeme.tpl +++ b/view/templates/removeme.tpl @@ -3,7 +3,7 @@
    -
    {{$desc}}
    +
    {{$desc nofilter}}
    @@ -14,7 +14,7 @@
    - +
    diff --git a/view/templates/saved_searches_aside.tpl b/view/templates/saved_searches_aside.tpl index 28a7ed58aa..5000e4acb1 100644 --- a/view/templates/saved_searches_aside.tpl +++ b/view/templates/saved_searches_aside.tpl @@ -1,7 +1,7 @@
    - {{$searchbox}} + {{$searchbox nofilter}}
    -
    {{$item.title|escape}}
    +
    {{$item.title}}
    -
    {{$item.body}}
    +
    {{$item.body nofilter}}
    {{if $item.has_cats}}
    {{$item.txt_cats}} {{foreach $item.categories as $cat}}{{$cat.name}}{{if $cat.removeurl}} [{{$remove}}]{{/if}} {{if $cat.last}}{{else}}, {{/if}}{{/foreach}}
    @@ -54,7 +54,7 @@
    {{if $item.conv}} - {{$item.conv.title|escape}} + {{$item.conv.title}} {{/if}}
    diff --git a/view/templates/settings/addons.tpl b/view/templates/settings/addons.tpl index 32ec5a0484..567ac81b7f 100644 --- a/view/templates/settings/addons.tpl +++ b/view/templates/settings/addons.tpl @@ -5,7 +5,7 @@
    -{{$settings_addons}} +{{$settings_addons nofilter}} diff --git a/view/templates/settings/connectors.tpl b/view/templates/settings/connectors.tpl index a237917682..e275e68ce3 100644 --- a/view/templates/settings/connectors.tpl +++ b/view/templates/settings/connectors.tpl @@ -14,7 +14,7 @@ {{include file="field_checkbox.tpl" field=$disable_cw}} {{include file="field_checkbox.tpl" field=$no_intelligent_shortening}} {{include file="field_checkbox.tpl" field=$ostatus_autofriend}} - {{$default_group}} + {{$default_group nofilter}} {{include file="field_input.tpl" field=$legacy_contact}}

    {{$repair_ostatus_text}}

    @@ -23,7 +23,7 @@
    -{{$settings_connectors}} +{{$settings_connectors nofilter}} {{if $mail_disabled}} @@ -35,7 +35,7 @@

    {{$h_imap}}

    -

    {{$imap_desc}}

    +

    {{$imap_desc nofilter}}

    {{include file="field_custom.tpl" field=$imap_lastcheck}} {{include file="field_input.tpl" field=$mail_server}} {{include file="field_input.tpl" field=$mail_port}} @@ -48,7 +48,7 @@ {{include file="field_input.tpl" field=$mail_movetofolder}}
    - +
    {{/if}} diff --git a/view/templates/settings/display.tpl b/view/templates/settings/display.tpl index e1a0123804..4b769d421b 100644 --- a/view/templates/settings/display.tpl +++ b/view/templates/settings/display.tpl @@ -21,17 +21,17 @@ {{include file="field_checkbox.tpl" field=$infinite_scroll}} {{include file="field_checkbox.tpl" field=$bandwidth_saver}} {{include file="field_checkbox.tpl" field=$smart_threading}} -

    {{$calendar_title|escape}}

    +

    {{$calendar_title}}

    {{include file="field_select.tpl" field=$first_day_of_week}}
    - +
    {{if $theme_config}}

    {{$stitle}}

    -{{$theme_config}} +{{$theme_config nofilter}} {{/if}} diff --git a/view/templates/settings/features.tpl b/view/templates/settings/features.tpl index eb3f67f813..2793e477b1 100644 --- a/view/templates/settings/features.tpl +++ b/view/templates/settings/features.tpl @@ -13,7 +13,7 @@ {{include file="field_yesno.tpl" field=$fcat}} {{/foreach}}
    - +
    {{/foreach}} diff --git a/view/templates/settings/nick_set.tpl b/view/templates/settings/nick_set.tpl index 8decc2dd4f..a6dc4d74ca 100644 --- a/view/templates/settings/nick_set.tpl +++ b/view/templates/settings/nick_set.tpl @@ -1,6 +1,5 @@ - -
    -
    {{$desc}}
    +
    +
    {{$desc nofilter}}
    diff --git a/view/templates/settings/oauth.tpl b/view/templates/settings/oauth.tpl index 164930ecba..edb0ff63ec 100644 --- a/view/templates/settings/oauth.tpl +++ b/view/templates/settings/oauth.tpl @@ -23,8 +23,8 @@ {{/if}} {{/if}} {{if $app.my}} -   -   +   +   {{/if}}
    {{/foreach}} diff --git a/view/templates/settings/oauth_edit.tpl b/view/templates/settings/oauth_edit.tpl index 9019981542..eed9f6ea33 100644 --- a/view/templates/settings/oauth_edit.tpl +++ b/view/templates/settings/oauth_edit.tpl @@ -11,7 +11,7 @@ {{include file="field_input.tpl" field=$icon}}
    - +
    diff --git a/view/templates/settings/settings.tpl b/view/templates/settings/settings.tpl index d017367fef..c95c0b1430 100644 --- a/view/templates/settings/settings.tpl +++ b/view/templates/settings/settings.tpl @@ -1,6 +1,6 @@

    {{$ptitle}}

    -{{$nickname_block}} +{{$nickname_block nofilter}} @@ -16,7 +16,7 @@ {{/if}}
    - +
    @@ -33,7 +33,7 @@
    - +
    @@ -45,21 +45,21 @@ {{include file="field_input.tpl" field=$maxreq}} -{{$profile_in_dir}} +{{$profile_in_dir nofilter}} -{{$profile_in_net_dir}} +{{$profile_in_net_dir nofilter}} -{{$hide_friends}} +{{$hide_friends nofilter}} -{{$hide_wall}} +{{$hide_wall nofilter}} -{{$blockwall}} +{{$blockwall nofilter}} -{{$blocktags}} +{{$blocktags nofilter}} -{{$suggestme}} +{{$suggestme nofilter}} -{{$unkmail}} +{{$unkmail nofilter}} {{include file="field_input.tpl" field=$cntunkmail}} @@ -90,7 +90,7 @@
    - {{$aclselect}} + {{$aclselect nofilter}}
    @@ -99,11 +99,11 @@
    -{{$group_select}} +{{$group_select nofilter}}
    - +
    @@ -130,13 +130,6 @@ {{include file="field_checkbox.tpl" field=$email_textonly}} {{include file="field_checkbox.tpl" field=$detailed_notif}} - - {{include file="field_yesno.tpl" field=$desktop_notifications}} - + Skip to main content - "; if(x($page,'aside')) echo $page['aside']; echo" - "; if(x($page,'right_aside')) echo $page['right_aside']; echo" + "; if(!empty($page['aside'])) echo $page['aside']; echo" + "; if(!empty($page['right_aside'])) echo $page['right_aside']; echo" "; include('includes/photo_side.php'); echo" @@ -42,7 +42,7 @@
    argv[0]; echo "-content-wrapper\">
    "; - if(x($page,'content')) echo $page['content']; echo" + if(!empty($page['content'])) echo $page['content']; echo"
    diff --git a/view/theme/frio/style.php b/view/theme/frio/style.php index e0f65960f6..7570ae0e57 100644 --- a/view/theme/frio/style.php +++ b/view/theme/frio/style.php @@ -63,7 +63,7 @@ if ($a->module !== 'install') { // Setting $scheme to '' wasn't working for some reason, so we'll check it's // not --- like the mobile theme does instead. // Allow layouts to over-ride the scheme. -if (x($_REQUEST, 'scheme')) { +if (!empty($_REQUEST['scheme'])) { $scheme = $_REQUEST['scheme']; } diff --git a/view/theme/frio/templates/acl_selector.tpl b/view/theme/frio/templates/acl_selector.tpl index 9ccd5326c1..6a9e38eb37 100644 --- a/view/theme/frio/templates/acl_selector.tpl +++ b/view/theme/frio/templates/acl_selector.tpl @@ -20,12 +20,12 @@
    - +
    {{if $jotnets}} -{{$jotnets}} +{{$jotnets nofilter}} {{/if}}{{/if}} -{{$tabs}} +{{$tabs nofilter}}
    @@ -17,7 +17,7 @@
    @@ -31,7 +31,7 @@ {{* we put here a hidden input element. This is needed to transmit the batch actions with javascript*}} - + {{* We put the contact batch actions in a dropdown menu *}}
    diff --git a/view/theme/frio/templates/credits.tpl b/view/theme/frio/templates/credits.tpl index 75ab272df8..5e5aeecc25 100644 --- a/view/theme/frio/templates/credits.tpl +++ b/view/theme/frio/templates/credits.tpl @@ -1,10 +1,10 @@
    {{include file="section_title.tpl"}} -

    {{$thanks|escape}}

    +

    {{$thanks}}

      {{foreach $names as $name}} -
    • {{$name|escape}}
    • +
    • {{$name}}
    • {{/foreach}}
    diff --git a/view/theme/frio/templates/crepair.tpl b/view/theme/frio/templates/crepair.tpl index d4cdec5018..6695682e0b 100644 --- a/view/theme/frio/templates/crepair.tpl +++ b/view/theme/frio/templates/crepair.tpl @@ -2,18 +2,18 @@
    {{include file="section_title.tpl"}} - {{$tab_str}} + {{$tab_str nofilter}} -
    {{$warning}}

    +
    {{$warning nofilter}}

    - {{$info}}
    + {{$info nofilter}}

    - +
    {{if $update_profile}} @@ -46,7 +46,7 @@ {{/if}}
    - +
    diff --git a/view/theme/frio/templates/dfrn_request.tpl b/view/theme/frio/templates/dfrn_request.tpl new file mode 100644 index 0000000000..2f363f5653 --- /dev/null +++ b/view/theme/frio/templates/dfrn_request.tpl @@ -0,0 +1,92 @@ +
    +

    {{$header}}

    + +{{if $myaddr}} +{{else}} +

    +{{$page_desc}}
    +

    +{{$invite_desc}} +

    +

    +{{$desc}} +

    +{{/if}} + +{{if $request}} + +{{else}} + +{{/if}} + +{{if $photo}} + +{{/if}} + +{{if $url}}
    {{$url_label}}
    {{$url}}
    {{/if}} +{{if $location}}
    {{$location_label}}
    {{$location}}
    {{/if}} +{{if $keywords}}
    {{$keywords_label}}
    {{$keywords}}
    {{/if}} +{{if $about}}
    {{$about_label}}
    {{$about}}
    {{/if}} + +
    + + {{if $myaddr}} + {{$myaddr}} + + {{else}} + + {{/if}} + {{if $url}} + + {{/if}} +
    +
    + +

    +{{$pls_answer}} +

    + +
    + +{{include file="field_yesno.tpl" field=$does_know_you}} + + +

    +{{$add_note}} +

    +
    + +
    + + +
    + +
    + {{if $submit}} + + {{/if}} + +
    + +
    \ No newline at end of file diff --git a/view/theme/frio/templates/directory_header.tpl b/view/theme/frio/templates/directory_header.tpl index 4bb739e78c..98ec3f5e2f 100644 --- a/view/theme/frio/templates/directory_header.tpl +++ b/view/theme/frio/templates/directory_header.tpl @@ -15,7 +15,7 @@
    @@ -37,4 +37,4 @@
    -{{$paginate}} +{{$paginate nofilter}} diff --git a/view/theme/frio/templates/event.tpl b/view/theme/frio/templates/event.tpl index 82ed1de092..39695819af 100644 --- a/view/theme/frio/templates/event.tpl +++ b/view/theme/frio/templates/event.tpl @@ -6,19 +6,19 @@
    {{if $event.item.author_name}} - {{$event.item.author_name|escape}} + {{$event.item.author_name}} {{/if}}
    - {{$event.html}} + {{$event.html nofilter}}
    - {{if $event.edit}}{{/if}} - {{if $event.copy}}{{/if}} - {{if $event.drop}}{{/if}} - {{if $event.item.plink}}{{/if}} + {{if $event.edit}}{{/if}} + {{if $event.copy}}{{/if}} + {{if $event.drop}}{{/if}} + {{if $event.item.plink}}{{/if}}
    diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl index 41b11c5bb7..661bdecb26 100644 --- a/view/theme/frio/templates/event_form.tpl +++ b/view/theme/frio/templates/event_form.tpl @@ -45,10 +45,10 @@
    {{* The field for event starting time *}} - {{$s_dsel}} + {{$s_dsel nofilter}} {{* The field for event finish time *}} - {{$f_dsel}} + {{$f_dsel nofilter}} {{* checkbox if the the event doesn't have a finish time *}} {{include file="field_checkbox.tpl" field=$nofinish}} @@ -64,7 +64,7 @@ {{* The submit button - saves the event *}}
    - +
    @@ -79,39 +79,39 @@
    -
    {{$title}}
    +
    {{$title nofilter}}
    + {{* If there is a map, we insert a button for showing/hiding the map *}} {{if $location.map}}{{/if}}
    - {{$start_short}} - {{if $finish}} - {{if $same_date}}{{$end_time}}{{else}}{{$end_short}}{{/if}}{{/if}} + {{$start_short}} + {{if $finish}} - {{if $same_date}}{{$end_time}}{{else}}{{$end_short}}{{/if}}{{/if}} {{if $location.name}} - {{$location.name|escape}} + {{$location.name nofilter}} {{/if}}
    - {{$author_name|escape}} + {{$author_name}}
    {{if $location.map}} -
    {{$location.map}}
    +
    {{$location.map nofilter}}
    {{/if}}
    @@ -41,7 +42,7 @@ {{* The content of the event description *}} {{if $description}}
    - {{$description}} + {{$description nofilter}}
    {{/if}} diff --git a/view/theme/frio/templates/events_js.tpl b/view/theme/frio/templates/events_js.tpl index 3866282a33..f233866f0b 100644 --- a/view/theme/frio/templates/events_js.tpl +++ b/view/theme/frio/templates/events_js.tpl @@ -1,11 +1,11 @@
    - {{$tabs}} + {{$tabs nofilter}} {{include file="section_title.tpl" title=$title pullright=1}} {{* The link to create a new event *}} {{if $new_event.0}} @@ -40,9 +40,9 @@ {{* The buttons to change the month/weeks/days *}}
    - - - + + +
    {{* The title (e.g. name of the mont/week/day) *}} diff --git a/view/theme/frio/templates/field_checkbox.tpl b/view/theme/frio/templates/field_checkbox.tpl index 1fde3634ab..5dc8916666 100644 --- a/view/theme/frio/templates/field_checkbox.tpl +++ b/view/theme/frio/templates/field_checkbox.tpl @@ -5,7 +5,7 @@
    diff --git a/view/theme/frio/templates/field_colorinput.tpl b/view/theme/frio/templates/field_colorinput.tpl index 704db346d2..285501ef3b 100644 --- a/view/theme/frio/templates/field_colorinput.tpl +++ b/view/theme/frio/templates/field_colorinput.tpl @@ -2,12 +2,12 @@
    - + {{if $field.4}}{{$field.4}}{{/if}}
    {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/field_custom.tpl b/view/theme/frio/templates/field_custom.tpl index 158073a64e..5b5c907791 100644 --- a/view/theme/frio/templates/field_custom.tpl +++ b/view/theme/frio/templates/field_custom.tpl @@ -1,8 +1,8 @@
    - {{$field.2}} + {{$field.2 nofilter}} {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/field_fileinput.tpl b/view/theme/frio/templates/field_fileinput.tpl index c5f8ac86d2..143aa19e0f 100644 --- a/view/theme/frio/templates/field_fileinput.tpl +++ b/view/theme/frio/templates/field_fileinput.tpl @@ -2,12 +2,12 @@
    - + {{if $field.4}}{{$field.4}}{{/if}}
    {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/field_input.tpl b/view/theme/frio/templates/field_input.tpl index 6ea3923b92..ef55203a05 100644 --- a/view/theme/frio/templates/field_input.tpl +++ b/view/theme/frio/templates/field_input.tpl @@ -3,9 +3,9 @@ {{if !isset($label) || $label != false }} {{/if}} - + {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/field_intcheckbox.tpl b/view/theme/frio/templates/field_intcheckbox.tpl index f898c87faf..18a2ea6ca5 100644 --- a/view/theme/frio/templates/field_intcheckbox.tpl +++ b/view/theme/frio/templates/field_intcheckbox.tpl @@ -1,9 +1,9 @@
    - + {{if $field.4}} - {{$field.4}} + {{$field.4 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/field_openid.tpl b/view/theme/frio/templates/field_openid.tpl index 66f8c9e809..b05270de31 100644 --- a/view/theme/frio/templates/field_openid.tpl +++ b/view/theme/frio/templates/field_openid.tpl @@ -1,9 +1,9 @@
    - + {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/field_password.tpl b/view/theme/frio/templates/field_password.tpl index 7bef420a18..92c98a44c1 100644 --- a/view/theme/frio/templates/field_password.tpl +++ b/view/theme/frio/templates/field_password.tpl @@ -1,9 +1,9 @@
    - + {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/field_radio.tpl b/view/theme/frio/templates/field_radio.tpl index 725e1c96af..35f99c9d61 100644 --- a/view/theme/frio/templates/field_radio.tpl +++ b/view/theme/frio/templates/field_radio.tpl @@ -5,7 +5,7 @@ diff --git a/view/theme/frio/templates/field_select.tpl b/view/theme/frio/templates/field_select.tpl index 594b91002e..2a609ed71d 100644 --- a/view/theme/frio/templates/field_select.tpl +++ b/view/theme/frio/templates/field_select.tpl @@ -2,9 +2,9 @@
    {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/field_select_raw.tpl b/view/theme/frio/templates/field_select_raw.tpl index 52b63079c1..bbd8368f26 100644 --- a/view/theme/frio/templates/field_select_raw.tpl +++ b/view/theme/frio/templates/field_select_raw.tpl @@ -2,9 +2,9 @@
    {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/field_textarea.tpl b/view/theme/frio/templates/field_textarea.tpl index 1aea484de7..baf2e84487 100644 --- a/view/theme/frio/templates/field_textarea.tpl +++ b/view/theme/frio/templates/field_textarea.tpl @@ -3,7 +3,7 @@ {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/field_themeselect.tpl b/view/theme/frio/templates/field_themeselect.tpl index fc1f7243af..78c179436b 100644 --- a/view/theme/frio/templates/field_themeselect.tpl +++ b/view/theme/frio/templates/field_themeselect.tpl @@ -6,7 +6,7 @@ {{foreach $field.4 as $opt=>$val}}{{/foreach}} {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}} {{if $field.5=="preview"}}
    {{/if}} diff --git a/view/theme/frio/templates/field_yesno.tpl b/view/theme/frio/templates/field_yesno.tpl index 47649fe676..22ef4461e4 100644 --- a/view/theme/frio/templates/field_yesno.tpl +++ b/view/theme/frio/templates/field_yesno.tpl @@ -4,7 +4,7 @@
    - + @@ -15,7 +15,7 @@
    {{if $field.3}} - {{$field.3}} + {{$field.3 nofilter}} {{/if}}
    diff --git a/view/theme/frio/templates/fileas_widget.tpl b/view/theme/frio/templates/fileas_widget.tpl index a4645841f1..b7d867e82a 100644 --- a/view/theme/frio/templates/fileas_widget.tpl +++ b/view/theme/frio/templates/fileas_widget.tpl @@ -1,7 +1,7 @@

    {{$title}}

    -
    {{$desc}}
    +
    {{$desc nofilter}}
    • {{$all}}
    • diff --git a/view/theme/frio/templates/filebrowser.tpl b/view/theme/frio/templates/filebrowser.tpl index ce58ef0b98..d452810c88 100644 --- a/view/theme/frio/templates/filebrowser.tpl +++ b/view/theme/frio/templates/filebrowser.tpl @@ -9,8 +9,8 @@
      - - + + diff --git a/view/theme/frio/templates/generic_links_widget.tpl b/view/theme/frio/templates/generic_links_widget.tpl index 5510eae917..e03e46fe1a 100644 --- a/view/theme/frio/templates/generic_links_widget.tpl +++ b/view/theme/frio/templates/generic_links_widget.tpl @@ -1,7 +1,7 @@
      {{if $title}}

      {{$title}}

      {{/if}} - {{if $desc}}
      {{$desc}}
      {{/if}} + {{if $desc}}
      {{$desc nofilter}}
      {{/if}}
        {{foreach $items as $item}} diff --git a/view/theme/frio/templates/group_edit.tpl b/view/theme/frio/templates/group_edit.tpl index 9d663b3edd..1a30dae879 100644 --- a/view/theme/frio/templates/group_edit.tpl +++ b/view/theme/frio/templates/group_edit.tpl @@ -1,4 +1,3 @@ - {{* This template is for the "group" module. It provides the user the possibility to modify a specific contact group (remove contact group, edit contact group name, add or remove contacts to the contact group. @@ -13,7 +12,7 @@ - {{if $drop}}{{$drop}}{{/if}} + {{if $drop}}{{$drop nofilter}}{{/if}}
      {{/if}} @@ -32,8 +31,8 @@ {{include file="field_input.tpl" field=$gname label=false}}
      -
      diff --git a/view/theme/frio/templates/head.tpl b/view/theme/frio/templates/head.tpl index c8d30c0b50..d8f8b1d82d 100644 --- a/view/theme/frio/templates/head.tpl +++ b/view/theme/frio/templates/head.tpl @@ -26,7 +26,7 @@ {{foreach $stylesheets as $stylesheetUrl}} - + {{/foreach}} {{* own css files *}} diff --git a/view/theme/frio/templates/home.tpl b/view/theme/frio/templates/home.tpl index dd53a1eae4..8552f25830 100644 --- a/view/theme/frio/templates/home.tpl +++ b/view/theme/frio/templates/home.tpl @@ -5,7 +5,7 @@
      @@ -15,11 +15,11 @@ {{if $customhome != false }} {{include file="$customhome"}} {{else}} - {{$defaultheader}} + {{$defaultheader nofilter}} {{/if}}
      {{/if}}
    \ No newline at end of file diff --git a/view/theme/frio/templates/intros.tpl b/view/theme/frio/templates/intros.tpl index 9b34afcd9e..cea74d2fae 100644 --- a/view/theme/frio/templates/intros.tpl +++ b/view/theme/frio/templates/intros.tpl @@ -5,20 +5,20 @@ {{* Contact Photo *}}
    {{* The intro actions like approve, ignore, discard intro*}} - +
    {{$str_notifytype}} {{$notify_type}}
    {{* if the contact was suggestested by another contact, the contact who made the suggestion is displayed*}} {{if $madeby}}
    {{$lbl_madeby}} {{$madeby}}
    {{/if}} @@ -30,7 +30,7 @@ {{if $location}}
    {{$lbl_location}} {{$location}}
    {{/if}} {{if $gender}}
    {{$lbl_gender}} {{$gender}}
    {{/if}} {{if $keywords}}
    {{$lbl_keywords}} {{$keywords}}
    {{/if}} - {{if $about}}
    {{$lbl_about}} {{$about}}
    {{/if}} + {{if $about}}
    {{$lbl_about}} {{$about nofilter}}
    {{/if}}
    {{$lbl_knowyou}}{{$knowyou}}
    {{$note}}
    @@ -42,7 +42,7 @@ {{if $location}}
    {{$lbl_location}}{{$location}}
    {{/if}} {{if $gender}}
    {{$lbl_gender}}{{$gender}}
    {{/if}} {{if $keywords}}
    {{$lbl_keywords}}{{$keywords}}
    {{/if}} - {{if $about}}
    {{$lbl_about}}{{$about}}
    {{/if}} + {{if $about}}
    {{$lbl_about}}{{$about nofilter}}
    {{/if}}
    {{$lbl_knowyou}}{{$knowyou}}
    {{$note}}
    @@ -51,7 +51,7 @@ a bootstrap modal in the case of approval *}} diff --git a/view/theme/frio/templates/jot.tpl b/view/theme/frio/templates/jot.tpl index 13e4d2ec1d..d5ba1bcc45 100644 --- a/view/theme/frio/templates/jot.tpl +++ b/view/theme/frio/templates/jot.tpl @@ -89,7 +89,7 @@ {{* The jot text field in which the post text is inserted *}}
    - +
    diff --git a/view/theme/frio/templates/like_noshare.tpl b/view/theme/frio/templates/like_noshare.tpl index f58a7698ba..deb2383f4b 100644 --- a/view/theme/frio/templates/like_noshare.tpl +++ b/view/theme/frio/templates/like_noshare.tpl @@ -9,5 +9,5 @@ {{/if}} - + diff --git a/view/theme/frio/templates/login.tpl b/view/theme/frio/templates/login.tpl index ae586a3e6a..ebbdeee410 100644 --- a/view/theme/frio/templates/login.tpl +++ b/view/theme/frio/templates/login.tpl @@ -9,7 +9,7 @@ {{include file="field_input.tpl" field=$lname}} {{include file="field_password.tpl" field=$lpassword}}
    @@ -24,13 +24,13 @@
    - +
    {{foreach $hiddens as $k=>$v}} - + {{/foreach}}
    @@ -39,8 +39,8 @@ {{if $register}} {{/if}} diff --git a/view/theme/frio/templates/mail_conv.tpl b/view/theme/frio/templates/mail_conv.tpl index b5154aa4c0..80f5e7547b 100644 --- a/view/theme/frio/templates/mail_conv.tpl +++ b/view/theme/frio/templates/mail_conv.tpl @@ -2,16 +2,16 @@
    {{$mail.date}}
    -

    {{$mail.from_name|escape}}

    +

    {{$mail.from_name}}

    - {{$mail.body}} + {{$mail.body nofilter}}
    {{*× *}}
    diff --git a/view/theme/frio/templates/mail_head.tpl b/view/theme/frio/templates/mail_head.tpl index fa4f46cf8c..70182b5e7c 100644 --- a/view/theme/frio/templates/mail_head.tpl +++ b/view/theme/frio/templates/mail_head.tpl @@ -16,4 +16,3 @@
    -{{$tab_content}} diff --git a/view/theme/frio/templates/mail_list.tpl b/view/theme/frio/templates/mail_list.tpl index e6a024f11c..4a797d47c0 100644 --- a/view/theme/frio/templates/mail_list.tpl +++ b/view/theme/frio/templates/mail_list.tpl @@ -5,13 +5,13 @@
    {{$ago}}
    -

    {{$from_name|escape}}

    +

    {{$from_name}}

    diff --git a/view/theme/frio/templates/message_side.tpl b/view/theme/frio/templates/message_side.tpl index 214bfd7f1a..de1d68b0ad 100644 --- a/view/theme/frio/templates/message_side.tpl +++ b/view/theme/frio/templates/message_side.tpl @@ -2,7 +2,7 @@ {{if $tabs}}
      - {{$tabs}} + {{$tabs nofilter}}
    {{/if}} diff --git a/view/theme/frio/templates/nav.tpl b/view/theme/frio/templates/nav.tpl index 6f20c247c4..d64eae9c49 100644 --- a/view/theme/frio/templates/nav.tpl +++ b/view/theme/frio/templates/nav.tpl @@ -40,37 +40,37 @@
    diff --git a/view/theme/frio/templates/peoplefind.tpl b/view/theme/frio/templates/peoplefind.tpl index 21b3e47e83..fc5d249b4b 100644 --- a/view/theme/frio/templates/peoplefind.tpl +++ b/view/theme/frio/templates/peoplefind.tpl @@ -5,8 +5,8 @@ {{* The search field *}} diff --git a/view/theme/frio/templates/photo_album.tpl b/view/theme/frio/templates/photo_album.tpl index 235b9c46db..a34e8ea861 100644 --- a/view/theme/frio/templates/photo_album.tpl +++ b/view/theme/frio/templates/photo_album.tpl @@ -37,7 +37,7 @@
    - {{$paginate}} + {{$paginate nofilter}} diff --git a/view/theme/frio/templates/photo_item.tpl b/view/theme/frio/templates/photo_item.tpl index 8267fd6315..935e6288b3 100644 --- a/view/theme/frio/templates/photo_item.tpl +++ b/view/theme/frio/templates/photo_item.tpl @@ -23,7 +23,7 @@ diff --git a/view/theme/frio/templates/photo_top.tpl b/view/theme/frio/templates/photo_top.tpl index c64f9b89b5..a86aa7f809 100644 --- a/view/theme/frio/templates/photo_top.tpl +++ b/view/theme/frio/templates/photo_top.tpl @@ -1,4 +1,4 @@ - - {{if $photo.album.name}}{{$photo.album.name|escape}}{{elseif $photo.desc}}{{$photo.desc|escape}}{{elseif $photo.alt}}{{$photo.alt|escape}}{{else}}{{$photo.unknown|escape}}{{/if}} + + {{if $photo.album.name}}{{$photo.album.name}}{{elseif $photo.desc}}{{$photo.desc}}{{elseif $photo.alt}}{{$photo.alt}}{{else}}{{$photo.unknown}}{{/if}} diff --git a/view/theme/frio/templates/photo_view.tpl b/view/theme/frio/templates/photo_view.tpl index e540a03f90..359c426696 100644 --- a/view/theme/frio/templates/photo_view.tpl +++ b/view/theme/frio/templates/photo_view.tpl @@ -5,24 +5,24 @@
    {{/if}} @@ -63,7 +63,7 @@
    diff --git a/view/theme/frio/templates/poke_content.tpl b/view/theme/frio/templates/poke_content.tpl index 6fb3b399b1..b015c4447f 100644 --- a/view/theme/frio/templates/poke_content.tpl +++ b/view/theme/frio/templates/poke_content.tpl @@ -2,7 +2,7 @@

    {{$title}}

    -
    {{$desc}}
    +
    {{$desc nofilter}}
    @@ -11,7 +11,7 @@ {{* The input field with the recipient name*}}
    - +
    @@ -37,7 +37,7 @@
    - +
    diff --git a/view/theme/frio/templates/profile_advanced.tpl b/view/theme/frio/templates/profile_advanced.tpl index 256a4138a4..a35955c170 100644 --- a/view/theme/frio/templates/profile_advanced.tpl +++ b/view/theme/frio/templates/profile_advanced.tpl @@ -82,7 +82,7 @@

    {{$profile.homepage.0}}
    -
    {{$profile.homepage.1}}
    +
    {{$profile.homepage.1 nofilter}}
    {{/if}} @@ -90,7 +90,7 @@

    {{$profile.about.0}}
    -
    {{$profile.about.1}}
    +
    {{$profile.about.1 nofilter}}
    {{/if}} @@ -133,7 +133,7 @@

    {{$profile.interest.0}}
    -
    {{$profile.interest.1}}
    +
    {{$profile.interest.1 nofilter}}
    {{/if}} @@ -141,7 +141,7 @@

    {{$profile.likes.0}}
    -
    {{$profile.likes.1}}
    +
    {{$profile.likes.1 nofilter}}
    {{/if}} @@ -149,7 +149,7 @@

    {{$profile.dislikes.0}}
    -
    {{$profile.dislikes.1}}
    +
    {{$profile.dislikes.1 nofilter}}
    {{/if}} @@ -157,16 +157,15 @@

    {{$profile.contact.0}}
    -
    {{$profile.contact.1}}
    +
    {{$profile.contact.1 nofilter}}
    {{/if}} - {{if $profile.music}}

    {{$profile.music.0}}
    -
    {{$profile.music.1}}
    +
    {{$profile.music.1 nofilter}}
    {{/if}} @@ -175,7 +174,7 @@

    {{$profile.book.0}}
    -
    {{$profile.book.1}}
    +
    {{$profile.book.1 nofilter}}
    {{/if}} @@ -184,7 +183,7 @@

    {{$profile.tv.0}}
    -
    {{$profile.tv.1}}
    +
    {{$profile.tv.1 nofilter}}
    {{/if}} @@ -193,7 +192,7 @@

    {{$profile.film.0}}
    -
    {{$profile.film.1}}
    +
    {{$profile.film.1 nofilter}}
    {{/if}} @@ -202,7 +201,7 @@

    {{$profile.romance.0}}
    -
    {{$profile.romance.1}}
    +
    {{$profile.romance.1 nofilter}}
    {{/if}} @@ -211,7 +210,7 @@

    {{$profile.work.0}}
    -
    {{$profile.work.1}}
    +
    {{$profile.work.1 nofilter}}
    {{/if}} @@ -219,7 +218,7 @@

    {{$profile.education.0}}
    -
    {{$profile.education.1}}
    +
    {{$profile.education.1 nofilter}}
    {{/if}} @@ -227,7 +226,7 @@

    {{$profile.forumlist.0}}
    -
    {{$profile.forumlist.1}}
    +
    {{$profile.forumlist.1 nofilter}}
    {{/if}}
    diff --git a/view/theme/frio/templates/profile_edit.tpl b/view/theme/frio/templates/profile_edit.tpl index 89353e1a6c..946443cf11 100644 --- a/view/theme/frio/templates/profile_edit.tpl +++ b/view/theme/frio/templates/profile_edit.tpl @@ -10,22 +10,22 @@  {{$profile_action}} @@ -65,7 +65,7 @@ {{* Some hints to characteristics of the current profile (if available) *}} {{if $is_default}} - + {{/if}} {{* friendica differs in $detailled_profile (all fields available and a short Version if this is variable false *}} @@ -91,16 +91,15 @@ {{include file="field_input.tpl" field=$pdesc}} -
    - {{$gender}} + {{$gender nofilter}}
    - {{$dob}} + {{$dob nofilter}} - {{$hide_friends}} + {{$hide_friends nofilter}}
    @@ -168,8 +167,8 @@
    - - {{$marital.selector}} + + {{$marital.selector nofilter}}
    @@ -179,7 +178,7 @@
    - {{$sexual.selector}} + {{$sexual.selector nofilter}}
    @@ -261,11 +260,11 @@ {{if $personal_account}}
    - {{$gender}} + {{$gender nofilter}}
    - {{$dob}} + {{$dob nofilter}} {{/if}} @@ -273,7 +272,7 @@ {{include file="field_input.tpl" field=$xmpp}} - {{$hide_friends}} + {{$hide_friends nofilter}} {{include file="field_input.tpl" field=$address}} diff --git a/view/theme/frio/templates/profile_entry.tpl b/view/theme/frio/templates/profile_entry.tpl index 1ee9eda85c..fb5436fb52 100644 --- a/view/theme/frio/templates/profile_entry.tpl +++ b/view/theme/frio/templates/profile_entry.tpl @@ -1,7 +1,7 @@
    - {{$alt|escape}} + {{$alt}}
    diff --git a/view/theme/frio/templates/profile_listing_header.tpl b/view/theme/frio/templates/profile_listing_header.tpl index 1e6ae0dbf9..3419c41049 100644 --- a/view/theme/frio/templates/profile_listing_header.tpl +++ b/view/theme/frio/templates/profile_listing_header.tpl @@ -10,7 +10,7 @@
    - {{$profiles}} + {{$profiles nofilter}}
    diff --git a/view/theme/frio/templates/profile_vcard.tpl b/view/theme/frio/templates/profile_vcard.tpl index 793fec753a..0649f8a551 100644 --- a/view/theme/frio/templates/profile_vcard.tpl +++ b/view/theme/frio/templates/profile_vcard.tpl @@ -2,19 +2,19 @@
    {{if $profile.picdate}} - {{$profile.name|escape}} + {{$profile.name}} {{else}} - {{$profile.name|escape}} + {{$profile.name}} {{/if}}
    {{if $profile.edit}}
    - +
    {{else}} {{if $profile.menu}} -
    +
    {{/if}} {{/if}}
    @@ -25,23 +25,23 @@
    -

    {{$profile.name|escape}}

    +

    {{$profile.name}}

    - {{if $profile.addr}}
    {{$profile.addr|escape}}
    {{/if}} + {{if $profile.addr}}
    {{$profile.addr}}
    {{/if}} - {{if $profile.pdesc}}
    {{$profile.pdesc|escape}}
    {{/if}} + {{if $profile.pdesc}}
    {{$profile.pdesc}}
    {{/if}}
    @@ -129,6 +129,6 @@ {{if $contact_block}}
    - {{$contact_block}} + {{$contact_block nofilter}}
    {{/if}} diff --git a/view/theme/frio/templates/prv_message.tpl b/view/theme/frio/templates/prv_message.tpl index 9077c4d4c1..68db2568a2 100644 --- a/view/theme/frio/templates/prv_message.tpl +++ b/view/theme/frio/templates/prv_message.tpl @@ -6,7 +6,7 @@

    {{$header}}

    *}} - {{$parent}} + {{$parent nofilter}} {{* The To: form-group which contains the message recipient *}}
    @@ -15,7 +15,7 @@ {{else}} - {{$select}} + {{$select nofilter}} {{/if}}
    @@ -33,38 +33,38 @@
    diff --git a/view/theme/frio/templates/removeme.tpl b/view/theme/frio/templates/removeme.tpl index 2e599a0dab..2410363d5e 100644 --- a/view/theme/frio/templates/removeme.tpl +++ b/view/theme/frio/templates/removeme.tpl @@ -3,7 +3,7 @@ {{include file="section_title.tpl" title=$title }}
    -
    {{$desc}}
    +
    {{$desc nofilter}}
    @@ -15,7 +15,7 @@
    - +
    diff --git a/view/theme/frio/templates/search_item.tpl b/view/theme/frio/templates/search_item.tpl index f31b7b7a44..b668229e8a 100644 --- a/view/theme/frio/templates/search_item.tpl +++ b/view/theme/frio/templates/search_item.tpl @@ -1,7 +1,7 @@ @@ -12,7 +12,7 @@ {{* Put additional actions in a top-right dropdown menu *}}
    @@ -166,7 +166,7 @@
    @@ -175,14 +175,14 @@ {{* Buttons for like and dislike *}} {{if $item.vote}} {{if $item.vote.like}} - + {{/if}} {{if $item.vote.like AND $item.vote.dislike}} {{/if}} {{if $item.vote.dislike}} - + {{/if}} {{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}} @@ -191,7 +191,7 @@ {{* Button to open the comment text field *}} {{if $item.comment}} - + {{/if}} {{* Button for sharing the item *}} @@ -200,10 +200,10 @@ {{if $item.vote.like OR $item.vote.dislike OR $item.comment}} {{/if}} - + {{/if}} {{/if}} - +
    @@ -211,15 +211,15 @@ {{* Event attendance buttons *}} {{if $item.isevent}}
    - - - + + +
    {{/if}}
    {{if $item.drop.pagedrop}} - + {{/if}}
    @@ -231,14 +231,14 @@ {{if $item.responses}}
    {{foreach $item.responses as $verb=>$response}} -
    {{$response.output}}
    +
    {{$response.output nofilter}}
    {{/foreach}}
    {{/if}}
    {{if $item.conv}} - {{$item.conv.title|escape}} + {{$item.conv.title}} {{/if}}
    diff --git a/view/theme/frio/templates/settings/addons.tpl b/view/theme/frio/templates/settings/addons.tpl index e8824b91a4..b14552381d 100644 --- a/view/theme/frio/templates/settings/addons.tpl +++ b/view/theme/frio/templates/settings/addons.tpl @@ -3,9 +3,9 @@ {{include file="section_title.tpl" title=$title}}
    - + - {{$settings_addons}} + {{$settings_addons nofilter}} diff --git a/view/theme/frio/templates/settings/connectors.tpl b/view/theme/frio/templates/settings/connectors.tpl index 7a18c46f77..bf8de450c4 100644 --- a/view/theme/frio/templates/settings/connectors.tpl +++ b/view/theme/frio/templates/settings/connectors.tpl @@ -21,15 +21,19 @@
    {{include file="field_checkbox.tpl" field=$disable_cw}} + {{include file="field_checkbox.tpl" field=$no_intelligent_shortening}} + {{include file="field_checkbox.tpl" field=$ostatus_autofriend}} - {{$default_group}} + + {{$default_group nofilter}} + {{include file="field_input.tpl" field=$legacy_contact}}

    {{$repair_ostatus_text}}

    - +
    @@ -37,33 +41,32 @@
    - {{$settings_connectors}} + {{$settings_connectors nofilter}} -{{if $mail_disabled}} - -{{else}} +{{if !$mail_disabled}}

    {{$h_imap}}

    {{/if}} diff --git a/view/theme/frio/templates/settings/display.tpl b/view/theme/frio/templates/settings/display.tpl index 70307c440c..6e2bc9089c 100644 --- a/view/theme/frio/templates/settings/display.tpl +++ b/view/theme/frio/templates/settings/display.tpl @@ -28,7 +28,7 @@ {{/if}}
    - +
    @@ -47,9 +47,9 @@
    - {{if $theme_config}} - {{$theme_config}} - {{/if}} + {{if $theme_config}} + {{$theme_config nofilter}} + {{/if}}
    @@ -78,7 +78,7 @@ {{include file="field_checkbox.tpl" field=$smart_threading}}
    - +
    @@ -89,7 +89,7 @@ @@ -99,7 +99,7 @@ {{include file="field_select.tpl" field=$first_day_of_week}}
    - +
    diff --git a/view/theme/frio/templates/settings/features.tpl b/view/theme/frio/templates/settings/features.tpl index c811b8cf3e..e5f8ce065a 100644 --- a/view/theme/frio/templates/settings/features.tpl +++ b/view/theme/frio/templates/settings/features.tpl @@ -23,7 +23,7 @@ {{/foreach}}
    - +
    diff --git a/view/theme/frio/templates/settings/oauth.tpl b/view/theme/frio/templates/settings/oauth.tpl index ffd40f2ab6..c6103cbc82 100644 --- a/view/theme/frio/templates/settings/oauth.tpl +++ b/view/theme/frio/templates/settings/oauth.tpl @@ -34,8 +34,8 @@ {{/if}} {{/if}} {{if $app.my}} -   - +   + {{/if}} {{/foreach}} diff --git a/view/theme/frio/templates/settings/oauth_edit.tpl b/view/theme/frio/templates/settings/oauth_edit.tpl index 91dfa04551..419e1b203f 100644 --- a/view/theme/frio/templates/settings/oauth_edit.tpl +++ b/view/theme/frio/templates/settings/oauth_edit.tpl @@ -1,4 +1,4 @@ - +

    {{$title}}

    @@ -11,8 +11,9 @@ {{include file="field_input.tpl" field=$icon}}
    - +
    +
    \ No newline at end of file diff --git a/view/theme/frio/templates/settings/settings.tpl b/view/theme/frio/templates/settings/settings.tpl index 40b0497a08..81db6a0af8 100644 --- a/view/theme/frio/templates/settings/settings.tpl +++ b/view/theme/frio/templates/settings/settings.tpl @@ -2,7 +2,7 @@ {{* include the title template for the settings title *}} {{include file="section_title.tpl" title=$ptitle }} - {{$nickname_block}} + {{$nickname_block nofilter}}
    @@ -29,7 +29,7 @@ {{/if}}
    - +
    @@ -57,7 +57,7 @@ {{include file="field_checkbox.tpl" field=$allowloc}}
    - +
    @@ -80,28 +80,26 @@ {{include file="field_input.tpl" field=$maxreq}} - {{$profile_in_dir}} + {{$profile_in_dir nofilter}} - {{$profile_in_net_dir}} + {{$profile_in_net_dir nofilter}} - {{$hide_friends}} + {{$hide_friends nofilter}} - {{$hide_wall}} + {{$hide_wall nofilter}} - {{$blockwall}} + {{$blockwall nofilter}} - {{$blocktags}} + {{$blocktags nofilter}} - {{$suggestme}} - - {{$unkmail}} + {{$suggestme nofilter}} + {{$unkmail nofilter}} {{include file="field_input.tpl" field=$cntunkmail}} {{include file="field_input.tpl" field=$expire.days}} -
    {{$expire.label}} @@ -138,7 +136,7 @@
    @@ -147,11 +145,10 @@
    - {{$group_select}} - + {{$group_select nofilter}}
    - +
    @@ -241,7 +238,7 @@
    - +
    @@ -262,10 +259,10 @@
    {{$h_descadvn}}
    - {{$pagetype}} + {{$pagetype nofilter}}
    - +
    @@ -288,7 +285,7 @@
    - +
    diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index 9b8322a85d..50a8934d1b 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -25,7 +25,7 @@ {{if $background_image}}{{include file="field_fileinput.tpl" field=$background_image}}{{/if}}
    {{if $item.lock}}
    {{$item.lock}}
    @@ -29,12 +29,12 @@
    -
    {{$item.title|escape}}
    +
    {{$item.title}}
    -
    {{$item.body}}
    +
    {{$item.body nofilter}}
    @@ -45,7 +45,7 @@
    {{if $item.conv}} - {{$item.conv.title|escape}} + {{$item.conv.title}} {{/if}}
    diff --git a/view/theme/smoothly/templates/wall_thread.tpl b/view/theme/smoothly/templates/wall_thread.tpl index 616c20f4dc..a7e0f20109 100644 --- a/view/theme/smoothly/templates/wall_thread.tpl +++ b/view/theme/smoothly/templates/wall_thread.tpl @@ -14,26 +14,26 @@
    {{if $item.owner_url}}
    {{$item.wall}}
    {{/if}}
    - - {{$item.name|escape}} + + {{$item.name}} menu
      - {{$item.item_photo_menu}} + {{$item.item_photo_menu nofilter}}
    -
    {{if $item.location}}{{$item.location}} {{/if}}
    +
    {{if $item.location}}{{$item.location nofilter}} {{/if}}
    {{if $item.lock}} @@ -46,8 +46,8 @@
    - - {{$item.name|escape}} + + {{$item.name}}
    @@ -56,9 +56,9 @@

    -
    {{$item.title|escape}}
    +
    {{$item.title}}
    -
    {{$item.body}} +
    {{$item.body nofilter}}
    {{if !$item.suppress_tags}} {{foreach $item.tags as $tag}} @@ -99,7 +99,7 @@ {{if $item.plink}} {{/if}} @@ -136,13 +136,13 @@
    - -
    {{$item.dislike}}
    + +
    {{$item.dislike nofilter}}
    {{if $item.threaded}} {{if $item.comment}}
    - {{$item.comment}} + {{$item.comment nofilter}}
    {{/if}} {{/if}} @@ -156,7 +156,7 @@ {{if $item.flatten}}
    - {{$item.comment}} + {{$item.comment nofilter}}
    {{/if}}
    diff --git a/view/theme/vier/templates/ch_connectors.tpl b/view/theme/vier/templates/ch_connectors.tpl index 9aa81740b9..2ca114807b 100644 --- a/view/theme/vier/templates/ch_connectors.tpl +++ b/view/theme/vier/templates/ch_connectors.tpl @@ -1,2 +1,2 @@ -{{$alt_text|escape}} +{{$alt_text}} diff --git a/view/theme/vier/templates/ch_directory_item.tpl b/view/theme/vier/templates/ch_directory_item.tpl index 9d25b3294b..6813e1186e 100644 --- a/view/theme/vier/templates/ch_directory_item.tpl +++ b/view/theme/vier/templates/ch_directory_item.tpl @@ -4,7 +4,7 @@ diff --git a/view/theme/vier/templates/comment_item.tpl b/view/theme/vier/templates/comment_item.tpl index af8fa4c9d1..3e72df6dc6 100644 --- a/view/theme/vier/templates/comment_item.tpl +++ b/view/theme/vier/templates/comment_item.tpl @@ -14,7 +14,7 @@
    - {{$mytitle|escape}} + {{$mytitle}}
    @@ -31,14 +31,14 @@ @@ -44,10 +44,10 @@ {{if $lastusers_title}}
    -

    {{$lastusers_title|escape}}

    +

    {{$lastusers_title}}

    {{foreach $lastusers_items as $i}} - {{$i}} + {{$i nofilter}} {{/foreach}}
    @@ -55,10 +55,10 @@ {{/if}} {{if $activeusers_title}} -

    {{$activeusers_title|escape}}

    +

    {{$activeusers_title}}

    {{foreach $activeusers_items as $i}} - {{$i}} + {{$i nofilter}} {{/foreach}}
    {{/if}} diff --git a/view/theme/vier/templates/contact_edit.tpl b/view/theme/vier/templates/contact_edit.tpl index 9014be1d25..2f52f82f81 100644 --- a/view/theme/vier/templates/contact_edit.tpl +++ b/view/theme/vier/templates/contact_edit.tpl @@ -2,7 +2,7 @@
    {{* Insert Tab-Nav *}} - {{$tab_str}} + {{$tab_str nofilter}}
    @@ -33,7 +33,7 @@ {{if $poll_enabled}}
  • {{$lastupdtext}} {{$last_update}}
    {{if $poll_interval}} - {{$updpub}} {{$poll_interval}} + {{$updpub}} {{$poll_interval nofilter}} {{/if}}
  • {{/if}} @@ -47,7 +47,7 @@
    {{* End of contact-edit-status-wrapper *}} @@ -57,7 +57,7 @@ {{if $location}}
    {{$location_label}}
    {{$location}}
    {{/if}} {{if $xmpp}}
    {{$xmpp_label}}
    {{$xmpp}}
    {{/if}} {{if $keywords}}
    {{$keywords_label}}
    {{$keywords}}
    {{/if}} - {{if $about}}
    {{$about_label}}
    {{$about}}
    {{/if}} + {{if $about}}
    {{$about_label}}
    {{$about nofilter}}
    {{/if}}
    {{* End of contact-edit-links *}} @@ -100,7 +100,7 @@
    {{/if}}
    - + {{/if}}
    diff --git a/view/theme/vier/templates/contact_template.tpl b/view/theme/vier/templates/contact_template.tpl index f36995e9c2..c4ed99caa4 100644 --- a/view/theme/vier/templates/contact_template.tpl +++ b/view/theme/vier/templates/contact_template.tpl @@ -5,8 +5,8 @@ - - {{$contact.name|escape}} + + {{$contact.name}} {{if $multiselect}} @@ -32,7 +32,7 @@
    - {{$contact.name|escape}} + {{$contact.name}} {{if $contact.account_type}} ({{$contact.account_type}}){{/if}}
    {{if $contact.alt_text}}
    {{$contact.alt_text}}
    {{/if}} diff --git a/view/theme/vier/templates/event_form.tpl b/view/theme/vier/templates/event_form.tpl index 35e05c02d5..e2090e3c65 100644 --- a/view/theme/vier/templates/event_form.tpl +++ b/view/theme/vier/templates/event_form.tpl @@ -3,7 +3,7 @@

    {{$title}}

    -{{$desc}} +{{$desc nofilter}}

    @@ -13,9 +13,9 @@ -{{$s_dsel}} +{{$s_dsel nofilter}} -{{$f_dsel}} +{{$f_dsel nofilter}} {{include file="field_checkbox.tpl" field=$nofinish}} @@ -56,11 +56,9 @@ {{include file="field_checkbox.tpl" field=$share}} {{/if}} -{{$acl}} +{{$acl nofilter}}
    - - + + - - diff --git a/view/theme/vier/templates/nav.tpl b/view/theme/vier/templates/nav.tpl index 70dee37550..777df44cd2 100644 --- a/view/theme/vier/templates/nav.tpl +++ b/view/theme/vier/templates/nav.tpl @@ -3,7 +3,7 @@ {{* {{$langselector}} *}}
    {{$sitelocation}}
    - +
    - - {{if $conv}}{{/if}} + + {{if $conv}}{{/if}}
    @@ -40,31 +40,31 @@
    {{if $drop.pagedrop}} - + {{/if}} {{if $drop.dropping}} - {{$drop.delete}} + {{$drop.delete}} {{/if}} {{if $edpost}} - + {{/if}}
    @@ -72,7 +72,7 @@
    - -
    {{$dislike}}
    + +
    {{$dislike nofilter}}
    diff --git a/view/theme/vier/templates/photo_view.tpl b/view/theme/vier/templates/photo_view.tpl index 5a6613dd1e..aa3f7aadd5 100644 --- a/view/theme/vier/templates/photo_view.tpl +++ b/view/theme/vier/templates/photo_view.tpl @@ -8,33 +8,33 @@ | {{$tools.profile.1}} {{/if}} -{{if $lock}} | {{$lock|escape}} {{/if}} +{{if $lock}} | {{$lock}} {{/if}}
    {{if $prevlink}}{{/if}} -
    +
    {{if $nextlink}}{{/if}}
    -
    {{$desc}}
    +
    {{$desc nofilter}}
    {{if $tags}}
    {{$tags.0}}
    {{$tags.1}}
    {{/if}} {{if $tags.2}}{{/if}} -{{if $edit}}{{$edit}}{{/if}} +{{if $edit}}{{$edit nofilter}}{{/if}} {{if $likebuttons}}
    - {{$likebuttons}} - {{$like}} - {{$dislike}} + {{$likebuttons nofilter}} + {{$like nofilter}} + {{$dislike nofilter}}
    {{/if}}
    -{{$comments}} + {{$comments nofilter}}
    -{{$paginate}} +{{$paginate nofilter}} diff --git a/view/theme/vier/templates/profile_advanced.tpl b/view/theme/vier/templates/profile_advanced.tpl index 702fba8f26..20c4e84b13 100644 --- a/view/theme/vier/templates/profile_advanced.tpl +++ b/view/theme/vier/templates/profile_advanced.tpl @@ -63,7 +63,7 @@ {{if $profile.homepage}}
    {{$profile.homepage.0}}
    -
    {{$profile.homepage.1}}
    +
    {{$profile.homepage.1 nofilter}}
    {{/if}} @@ -91,35 +91,35 @@ {{if $profile.about}}
    {{$profile.about.0}}
    -
    {{$profile.about.1}}
    +
    {{$profile.about.1 nofilter}}
    {{/if}} {{if $profile.interest}}
    {{$profile.interest.0}}
    -
    {{$profile.interest.1}}
    +
    {{$profile.interest.1 nofilter}}
    {{/if}} {{if $profile.likes}}
    {{$profile.likes.0}}
    -
    {{$profile.likes.1}}
    +
    {{$profile.likes.1 nofilter}}
    {{/if}} {{if $profile.dislikes}}
    {{$profile.dislikes.0}}
    -
    {{$profile.dislikes.1}}
    +
    {{$profile.dislikes.1 nofilter}}
    {{/if}} {{if $profile.contact}}
    {{$profile.contact.0}}
    -
    {{$profile.contact.1}}
    +
    {{$profile.contact.1 nofilter}}
    {{/if}} @@ -127,7 +127,7 @@ {{if $profile.music}}
    {{$profile.music.0}}
    -
    {{$profile.music.1}}
    +
    {{$profile.music.1 nofilter}}
    {{/if}} @@ -135,7 +135,7 @@ {{if $profile.book}}
    {{$profile.book.0}}
    -
    {{$profile.book.1}}
    +
    {{$profile.book.1 nofilter}}
    {{/if}} @@ -143,7 +143,7 @@ {{if $profile.tv}}
    {{$profile.tv.0}}
    -
    {{$profile.tv.1}}
    +
    {{$profile.tv.1 nofilter}}
    {{/if}} @@ -151,7 +151,7 @@ {{if $profile.film}}
    {{$profile.film.0}}
    -
    {{$profile.film.1}}
    +
    {{$profile.film.1 nofilter}}
    {{/if}} @@ -159,7 +159,7 @@ {{if $profile.romance}}
    {{$profile.romance.0}}
    -
    {{$profile.romance.1}}
    +
    {{$profile.romance.1 nofilter}}
    {{/if}} @@ -167,20 +167,20 @@ {{if $profile.work}}
    {{$profile.work.0}}
    -
    {{$profile.work.1}}
    +
    {{$profile.work.1 nofilter}}
    {{/if}} {{if $profile.education}}
    {{$profile.education.0}}
    -
    {{$profile.education.1}}
    +
    {{$profile.education.1 nofilter}}
    {{/if}} {{if $profile.forumlist}}
    {{$profile.forumlist.0}}
    -
    {{$profile.forumlist.1}}
    +
    {{$profile.forumlist.1 nofilter}}
    {{/if}} diff --git a/view/theme/vier/templates/profile_edit.tpl b/view/theme/vier/templates/profile_edit.tpl index 0951847b0a..066b2566f6 100644 --- a/view/theme/vier/templates/profile_edit.tpl +++ b/view/theme/vier/templates/profile_edit.tpl @@ -23,7 +23,7 @@
    -{{$default}} +{{$default nofilter}}
    @@ -83,7 +83,7 @@
    - {{$gender}} + {{$gender nofilter}}
    @@ -107,11 +107,11 @@
    - {{$dob}} + {{$dob nofilter}}
    - {{$hide_friends}} + {{$hide_friends nofilter}}
    {{$about.1}}
    @@ -200,7 +200,7 @@
    - {{$sexual}} + {{$sexual nofilter}}
    @@ -242,8 +242,8 @@
    -{{$hide_friends}} +{{$hide_friends nofilter}}
    - +
    - +
    - +
    @@ -402,13 +402,13 @@
    - +
    {{$pub_keywords.3}}
    - +
    {{$prv_keywords.3}}
    diff --git a/view/theme/vier/templates/profile_vcard.tpl b/view/theme/vier/templates/profile_vcard.tpl index a464416959..b37f5d2591 100644 --- a/view/theme/vier/templates/profile_vcard.tpl +++ b/view/theme/vier/templates/profile_vcard.tpl @@ -1,7 +1,7 @@
    -
    {{$profile.name|escape}}
    +
    {{$profile.name}}
    {{if $profile.edit}}
    {{$profile.edit.1}} @@ -13,18 +13,18 @@ {{/if}}
    - {{if $profile.addr}}
    {{$profile.addr|escape}}
    {{/if}} + {{if $profile.addr}}
    {{$profile.addr}}
    {{/if}} {{if $profile.pdesc}}
    {{$profile.pdesc}}
    {{/if}} {{if $profile.picdate}} -
    {{$profile.name|escape}}
    +
    {{$profile.name}}
    {{else}} -
    {{$profile.name|escape}}
    +
    {{$profile.name}}
    {{/if}} {{if $account_type}}{{/if}} - {{if $profile.network_name}}
    {{$network}}
    {{$profile.network_name}}
    {{/if}} + {{if $profile.network_link}}
    {{$network}}
    {{$profile.network_link nofilter}}
    {{/if}} {{if $location}}
    {{$location}}
    @@ -58,7 +58,7 @@ {{if $homepage}}
    {{$homepage}}
    {{$profile.homepage}}
    {{/if}} - {{if $about}}
    {{$about}}
    {{$profile.about}}
    {{/if}} + {{if $about}}
    {{$about}}
    {{$profile.about nofilter}}
    {{/if}} {{include file="diaspora_vcard.tpl"}} @@ -81,4 +81,4 @@
    -{{$contact_block}} +{{$contact_block nofilter}} diff --git a/view/theme/vier/templates/search_item.tpl b/view/theme/vier/templates/search_item.tpl index c274ca3e38..bce28962ec 100644 --- a/view/theme/vier/templates/search_item.tpl +++ b/view/theme/vier/templates/search_item.tpl @@ -1,9 +1,9 @@
    - {{if $item.star}}{{$item.star.starred|escape}}{{/if}} - {{if $item.lock}}{{$item.lock|escape}}{{/if}} - + {{if $item.star}}{{$item.star.starred}}{{/if}} + {{if $item.lock}}{{$item.lock}}{{/if}} +
    @@ -12,25 +12,25 @@
    - - {{$item.name|escape}} + + {{$item.name}}
    - {{$item.name|escape}} + {{$item.name}} - {{if $item.plink}}{{$item.ago}}{{else}} {{$item.ago}} {{/if}} + {{if $item.plink}}{{$item.ago}}{{else}} {{$item.ago}} {{/if}} {{if $item.lock}}{{$item.lock}} {{/if}}
    {{if $item.title}}

    {{$item.title}}

    {{/if}} -
    {{$item.body}}
    +
    {{$item.body nofilter}}
    @@ -39,47 +39,47 @@
    {{if !$item.suppress_tags}} {{foreach $item.tags as $tag}} - {{$tag}} + {{$tag nofilter}} {{/foreach}} {{/if}}
    - - {{if $item.conv}}{{/if}} + + {{if $item.conv}}{{/if}}
    -
    {{$item.location}} 
    +
    {{$item.location nofilter}} 
    {{if $item.drop.pagedrop}} - + {{/if}} {{if $item.drop.dropping}} - {{$item.drop.delete|escape}} + {{$item.drop.delete}} {{/if}} {{if $item.edpost}} - + {{/if}}
    @@ -87,7 +87,7 @@
    - -
    {{$item.dislike}}
    + +
    {{$item.dislike nofilter}}
    diff --git a/view/theme/vier/templates/threaded_conversation.tpl b/view/theme/vier/templates/threaded_conversation.tpl index 3553a5dcbc..885a508fa9 100644 --- a/view/theme/vier/templates/threaded_conversation.tpl +++ b/view/theme/vier/templates/threaded_conversation.tpl @@ -1,4 +1,4 @@ -{{$live_update}} +{{$live_update nofilter}} {{foreach $threads as $thread}}
    diff --git a/view/theme/vier/templates/wall_item_tag.tpl b/view/theme/vier/templates/wall_item_tag.tpl index 2c02036a0e..49fb26a83c 100644 --- a/view/theme/vier/templates/wall_item_tag.tpl +++ b/view/theme/vier/templates/wall_item_tag.tpl @@ -27,24 +27,24 @@
    - - {{$item.name|escape}} + + {{$item.name}}
    -
    {{$item.location}}
    +
    {{$item.location nofilter}}
    - {{$item.ago}} {{$item.body}} + {{$item.ago}} {{$item.body nofilter}}
    {{if $item.drop.pagedrop}} - + {{/if}} {{if $item.drop.dropping}} - {{$item.drop.delete}} + {{$item.drop.delete}} {{/if}}
    @@ -59,9 +59,9 @@ {{* top thread comment box *}} {{if $item.threaded}}{{if $item.comment}}{{if $item.thread_level==1}} -
    {{$item.comment}}
    +
    {{$item.comment nofilter}}
    {{/if}}{{/if}}{{/if}} {{if $item.flatten}} -
    {{$item.comment}}
    +
    {{$item.comment nofilter}}
    {{/if}} diff --git a/view/theme/vier/templates/wall_thread.tpl b/view/theme/vier/templates/wall_thread.tpl index d99061798a..8a857bcb7d 100644 --- a/view/theme/vier/templates/wall_thread.tpl +++ b/view/theme/vier/templates/wall_thread.tpl @@ -19,7 +19,7 @@ {{if $item.thread_level!=1}}
    {{/if}} {{if $item.thread_level<7}} @@ -36,37 +36,37 @@
    - - {{$item.name|escape}} + + {{$item.name}}
    {{if $item.owner_url}} {{/if}}
    - {{$item.name|escape}} - {{if $item.owner_url}}{{$item.via}} {{$item.owner_name|escape}}{{/if}} + {{$item.name}} + {{if $item.owner_url}}{{$item.via}} {{$item.owner_name}}{{/if}} - {{if $item.plink}}{{else}} {{/if}} + {{if $item.plink}}{{else}} {{/if}} - {{if $item.lock}}{{$item.lock}}{{/if}} - + {{if $item.lock}}{{$item.lock}}{{/if}} + {{$item.network_name}}
    - {{if $item.title}}

    {{$item.title|escape}}

    {{/if}} - {{$item.body}} + {{if $item.title}}

    {{$item.title}}

    {{/if}} + {{$item.body nofilter}}
    @@ -75,66 +75,66 @@
    {{if !$item.suppress_tags}} {{foreach $item.hashtags as $tag}} - {{$tag}} + {{$tag nofilter}} {{/foreach}} {{foreach $item.mentions as $tag}} - {{$tag}} + {{$tag nofilter}} {{/foreach}} {{/if}} {{foreach $item.folders as $cat}} - {{$cat.name|escape}}{{if $cat.removeurl}} (x) {{/if}} + {{$cat.name}}{{if $cat.removeurl}} (x) {{/if}} {{/foreach}} {{foreach $item.categories as $cat}} - {{$cat.name|escape}}{{if $cat.removeurl}} (x) {{/if}} + {{$cat.name}}{{if $cat.removeurl}} (x) {{/if}} {{/foreach}}
    {{if $item.threaded}} {{/if}} {{if $item.comment}} - {{$item.switchcomment}} + {{$item.switchcomment}} {{/if}} {{if $item.isevent}} - {{$item.attend.0}} - {{$item.attend.1}} - {{$item.attend.2}} + {{$item.attend.0}} + {{$item.attend.1}} + {{$item.attend.2}} {{/if}} {{if $item.vote}} {{if $item.vote.like}} - {{$item.vote.like.0}} + {{$item.vote.like.0}} {{/if}}{{if $item.vote.dislike}} - {{$item.vote.dislike.0}} + {{$item.vote.dislike.0}} {{/if}} {{if $item.vote.share}} - {{$item.vote.share.0}} + {{$item.vote.share.0}} {{/if}} {{/if}} {{if $item.star}} - {{$item.star.do}} - {{$item.star.undo}} + {{$item.star.do}} + {{$item.star.undo}} {{/if}} {{if $item.ignore}} - {{$item.ignore.do}} - {{$item.ignore.undo}} + {{$item.ignore.do}} + {{$item.ignore.undo}} {{/if}} {{if $item.tagger}} - {{$item.tagger.add}} + {{$item.tagger.add}} {{/if}} {{if $item.filer}} - {{$item.filer}} + {{$item.filer}} {{/if}}
    -
    {{$item.location}} {{$item.postopts}}
    +
    {{$item.location nofilter}} {{$item.postopts}}
    @@ -142,13 +142,13 @@
    {{if $item.drop.pagedrop}} - + {{/if}} {{if $item.drop.dropping}} - {{$item.drop.delete}} + {{$item.drop.delete}} {{/if}} {{if $item.edpost}} - {{$item.edpost.1}} + {{$item.edpost.1}} {{/if}}
    @@ -159,7 +159,7 @@
    {{if $item.responses}} {{foreach $item.responses as $verb=>$response}} -
    {{$response.output}}
    +
    {{$response.output nofilter}}
    {{/foreach}} {{/if}} @@ -170,7 +170,7 @@
    {{/if}}{{/if}} @@ -195,18 +195,18 @@ {{if $item.total_comments_num}} {{if $item.threaded}}{{if $item.comment}}{{if $item.thread_level==1}} -
    {{$item.comment}}
    +
    {{$item.comment nofilter}}
    {{/if}}{{/if}}{{/if}} {{if $item.flatten}} -
    {{$item.comment}}
    +
    {{$item.comment nofilter}}
    {{/if}} {{else}} {{if $item.threaded}}{{if $item.comment}}{{if $item.thread_level==1}} - + {{/if}}{{/if}}{{/if}} {{if $item.flatten}} - + {{/if}} {{/if}} diff --git a/view/theme/vier/templates/widget_forumlist_right.tpl b/view/theme/vier/templates/widget_forumlist_right.tpl index 8b2700e01b..fe72ffcaf6 100644 --- a/view/theme/vier/templates/widget_forumlist_right.tpl +++ b/view/theme/vier/templates/widget_forumlist_right.tpl @@ -21,20 +21,20 @@ function showHideForumlist() { {{if $forum.id <= $visible_forums}} {{/if}} {{if $forum.id > $visible_forums}} {{/if}} {{/foreach}} diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index 9427f1f23b..89fea650ba 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -214,10 +214,7 @@ function vier_community_info() //Community_Pages at right_aside if ($show_pages && local_user()) { - $cid = null; - if (x($_GET, 'cid') && intval($_GET['cid']) != 0) { - $cid = $_GET['cid']; - } + $cid = defaults($_GET, 'cid', null); //sort by last updated item $lastitem = true;