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.
* - 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');
}
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;
{
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;
}
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;
}
$a = get_app();
- if (!x($_SESSION, 'sysmsg')) {
+ if (empty($_SESSION['sysmsg'])) {
$_SESSION['sysmsg'] = [];
}
if ($a->interactive) {
return;
}
- if (!x($_SESSION, 'sysmsg_info')) {
+ if (empty($_SESSION['sysmsg_info'])) {
$_SESSION['sysmsg_info'] = [];
}
if ($a->interactive) {
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1290);
+ define('DB_UPDATE_VERSION', 1291);
}
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"],
"fid" => ["type" => "int unsigned", "not null" => "1", "relation" => ["fcontact" => "id"], "comment" => ""],
],
"indexes" => [
- "PRIMARY" => ["iid", "server"]
+ "PRIMARY" => ["iid", "server"],
+ "cid" => ["cid"],
+ "fid" => ["fid"]
]
],
"pconfig" => [
So the central part of the file now looks like this:
<body>
- <?php if(x($page,'nav')) echo $page['nav']; ?>
- <aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></aside>
- <section><?php if(x($page,'content')) echo $page['content']; ?>
+ <?php if(!empty($page['nav'])) echo $page['nav']; ?>
+ <aside><?php if(!empty($page['right_aside'])) echo $page['right_aside']; ?></aside>
+ <section><?php if(!empty($page['content'])) echo $page['content']; ?>
<div id="page-footer"></div>
</section>
- <right_aside><?php if(x($page,'aside')) echo $page['aside']; ?></right_aside>
- <footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
+ <right_aside><?php if(!empty($page['aside'])) echo $page['aside']; ?></right_aside>
+ <footer><?php if(!empty($page['footer'])) echo $page['footer']; ?></footer>
</body>
Finally we need a style.css file, inheriting the definitions from the parent theme and containing out changes for the new theme.
*/
function api_user()
{
- if (x($_SESSION, 'allow_api')) {
+ if (!empty($_SESSION['allow_api'])) {
return local_user();
}
}
// 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;
}
}
- 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");
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;
}
}
- 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 == "") {
$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) {
}
}
- 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) {
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);
*/
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;
}
}
- 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)) {
$_REQUEST['api_source'] = true;
- if (!x($_REQUEST, "source")) {
+ if (empty($_REQUEST['source'])) {
$_REQUEST["source"] = api_source();
}
api_get_user($a);
- if (!x($_FILES, 'media')) {
+ if (empty($_FILES['media'])) {
// Output error
throw new BadRequestException("No media.");
}
$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)) {
$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;
// 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;
$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) {
// 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`",
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;
}
$_REQUEST['profile_uid'] = api_user();
$_REQUEST['api_source'] = true;
- if (!x($_REQUEST, "source")) {
+ if (empty($_REQUEST['source'])) {
$_REQUEST["source"] = api_source();
}
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;
}
$condition[0] .= ' AND `item`.`wall` ';
}
- if ($exclude_replies > 0) {
+ if ($exclude_replies) {
$condition[0] .= ' AND `item`.`parent` = `item`.`id`';
}
$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;
}
}
//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);
} 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']);
}
*/
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);
}
// 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;
}
// 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;
}
$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
$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()),
$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']);
// 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'];
/**
* Unfollow Contact
*
- * @brief unfollow contact
+ * @brief unfollow contact
*
* @param string $type Known types are 'atom', 'rss', 'xml' and 'json'
* @return string|array
*/
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);
}
*/
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);
}
*/
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);
}
*/
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);
}
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 == "") {
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 == "") {
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
$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");
}
$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);
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
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
$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");
}
// 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
*/
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.");
*/
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 = "^\[\]";
// 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
// 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
// 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
// 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'];
// 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);
// 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'];
// 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
$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);
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);
// 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 == "") {
// 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
}
// 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');
. "<script> var profile_uid = " . $_SESSION['uid']
. "; var netargs = '" . substr($a->cmd, 8)
. '?f='
- . ((x($_GET, 'cid')) ? '&cid=' . rawurlencode($_GET['cid']) : '')
- . ((x($_GET, 'search')) ? '&search=' . rawurlencode($_GET['search']) : '')
- . ((x($_GET, 'star')) ? '&star=' . rawurlencode($_GET['star']) : '')
- . ((x($_GET, 'order')) ? '&order=' . rawurlencode($_GET['order']) : '')
- . ((x($_GET, 'bmark')) ? '&bmark=' . rawurlencode($_GET['bmark']) : '')
- . ((x($_GET, 'liked')) ? '&liked=' . rawurlencode($_GET['liked']) : '')
- . ((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['search']) ? '&search=' . rawurlencode($_GET['search']) : '')
+ . (!empty($_GET['star']) ? '&star=' . rawurlencode($_GET['star']) : '')
+ . (!empty($_GET['order']) ? '&order=' . rawurlencode($_GET['order']) : '')
+ . (!empty($_GET['bmark']) ? '&bmark=' . rawurlencode($_GET['bmark']) : '')
+ . (!empty($_GET['liked']) ? '&liked=' . rawurlencode($_GET['liked']) : '')
+ . (!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']) : '')
. "'; var profile_page = " . $pager->getPage() . "; </script>\r\n";
}
if (!$update) {
$tab = 'posts';
- if (x($_GET, 'tab')) {
+ if (!empty($_GET['tab'])) {
$tab = Strings::escapeTags(trim($_GET['tab']));
}
if ($tab === 'posts') {
$url = '<a href="'. $url . '"'. $sparkle .'>' . htmlentities($item['author-name']) . '</a>';
- if (!x($item, 'thr-parent')) {
+ if (empty($item['thr-parent'])) {
$item['thr-parent'] = $item['parent-uri'];
}
$expanded .= "\t" . '<div class="wall-item-' . $type . '-expanded" id="' . $type . 'list-' . $id . '" style="display: none;" >' . $explikers . EOL . '</div>';
}
- $phrase .= EOL ;
+ $phrase .= EOL;
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('voting_fakelink.tpl'), [
'$phrase' => $phrase,
'$type' => $type,
{
$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, [
// Private/public post links for the non-JS ACL form
$private_post = 1;
- if (x($_REQUEST, 'public')) {
+ if (!empty($_REQUEST['public'])) {
$private_post = 0;
}
}
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'];
}
}
// 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;
}
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'), []);
'$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 <a href="%s" target="_blank">EU-GDPR</a>.','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 <a href="%s" target="_blank">EU-GDPR</a>.', '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.')],
'$submit' => L10n::t('Save Settings'),
]);
}
+
/**
* @brief Process send data from Admin TOS Page
*
{
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);
return; // NOTREACHED
}
+
/**
* @brief Subpage to modify the server wide block list via the admin panel.
*
*/
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[] = [
// 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
*/
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);
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);
}
*/
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.
$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)) {
$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);
$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, [
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 <scheme>://<domain>"));
$a->internalRedirect('admin/site');
}
$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);
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);
}
// 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);
-
-
- $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 = ((x($_POST,'register_text')) ? strip_tags(trim($_POST['register_text'])) : '');
-
- $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 = ((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 = ((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 = ((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'])) : '');
+ $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_text = (!empty($_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']);
+
+ $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);
+
+ $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');
+
+ $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']);
+
+ $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 != '')) {
);
}
}
- 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');
} 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('config', 'private_addons', $private_addons);
-
- 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', '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('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_expire_conversation', $dbclean_expire_conv);
if ($dbclean_unclaimed == 0) {
$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);
$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 - <a href='#' id='cnftheme'>change theme settings</a>"), $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.") . '<strong>' . L10n::t('Enabling this may violate privacy laws like the GDPR') . '</strong>'],
- '$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%.")],
-
- '$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 <a href='http://the-federation.info/'>the-federation.info</a> 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.")],
-
- '$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")]],
-
- '$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'.")],
-
- '$form_security_token' => BaseModule::getFormSecurityToken("admin_site"),
- '$relocate_button' => L10n::t('Start Relocation'),
+ '$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 - <a href='#' id='cnftheme'>change theme settings</a>"), $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.") . '<strong>' . L10n::t('Enabling this may violate privacy laws like the GDPR') . '</strong>'],
+ '$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.")],
+
+ '$nodeinfo' => ['nodeinfo', L10n::t("Publish server information"), Config::get('system', 'nodeinfo'), L10n::t("If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See <a href='http://the-federation.info/'>the-federation.info</a> for details.")],
+
+ '$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.")],
+
+ '$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())],
+
+ '$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'),
]);
}
'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);
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);
$order = "contact.name";
$order_direction = "+";
- if (x($_GET, 'o')) {
+ if (!empty($_GET['o'])) {
$new_order = $_GET['o'];
if ($new_order[0] === "-") {
$order_direction = "-";
/*
* 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");
}
/**
- * @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;
}
/**
- * @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;
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
}
// 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']) {
*/
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);
$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);
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;
}
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.";
$cal_widget = Widget\CalendarExport::getHTML();
- if (!x($a->page, 'aside')) {
+ if (empty($a->page['aside'])) {
$a->page['aside'] = '';
}
$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') {
$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'];
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'];
}
}
$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;
}
}
}
// 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){
"list" => L10n::t("list"),
]);
- if (x($_GET, 'id')) {
+ if (!empty($_GET['id'])) {
echo $o;
killme();
}
'url' => 'contact/' . $cid
]);
- if (!x($a->page, 'aside')) {
+ if (empty($a->page['aside'])) {
$a->page['aside'] = '';
}
$a->page['aside'] .= $vcard_widget;
}
}
- if (x($change)) {
+ if (!empty($change)) {
if (in_array($change, $preselected)) {
Group::removeMember($group['id'], $change);
} else {
$contact = DBA::selectFirst('contact', [], ['uid' => local_user(), 'id' => $a->argv[1]]);
}
- if (!x($a->page, 'aside')) {
+ if (empty($a->page['aside'])) {
$a->page['aside'] = '';
}
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;
}
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');
}
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');
}
* 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);
* 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' , ''));
// 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);
}
}
}
- $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);
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.
$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 = "";
. "\t" . '<perm>' . $perm . '</perm>' . "\r\n"
. "\t" . '<dfrn_id>' . $encrypted_id . '</dfrn_id>' . "\r\n"
. "\t" . '<challenge>' . $challenge . '</challenge>' . "\r\n"
- . '</dfrn_notify>' . "\r\n" ;
+ . '</dfrn_notify>' . "\r\n";
killme();
}
$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', '');
$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);
}
if ((int)$xml->status === 1) {
$_SESSION['authenticated'] = 1;
- if (!x($_SESSION, 'remote')) {
+ if (empty($_SESSION['remote'])) {
$_SESSION['remote'] = [];
}
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)) {
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) {
if (((int) $xml->status == 0) && ($xml->challenge == $hash) && ($xml->sec == $sec)) {
$_SESSION['authenticated'] = 1;
- if (!x($_SESSION, 'remote')) {
+ if (empty($_SESSION['remote'])) {
$_SESSION['remote'] = [];
}
return;
}
- if (x($_POST, 'cancel')) {
+ if (!empty($_POST['cancel'])) {
$a->internalRedirect();
}
* 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()),
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);
$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",
}
}
- $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)) {
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);
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())
// "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 */
}
$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;
'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.
// 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())) {
function directory_post(App $a)
{
- if (x($_POST, 'search')) {
+ if (!empty($_POST['search'])) {
$a->data['search'] = $_POST['search'];
}
}
$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 = '';
}
// if(strlen($rr['dob'])) {
// if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
-// $details .= '<br />' . L10n::t('Age: ') . $years ;
+// $details .= '<br />' . L10n::t('Age: ') . $years;
// }
// if(strlen($rr['gender']))
// $details .= '<br />' . 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;
return;
}
- if (! x($a->page,'aside')) {
+ if (empty($a->page['aside'])) {
$a->page['aside'] = '';
}
$contact_id = 0;
- 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['uid']) {
$contact_id = $v['cid'];
}
$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;
}
$template_file = "filebrowser.tpl";
$mode = "";
- if (x($_GET, 'mode')) {
+ if (!empty($_GET['mode'])) {
$mode = "?mode=".$_GET['mode'];
}
break;
}
- if (x($_GET, 'mode')) {
+ if (!empty($_GET['mode'])) {
return $o;
} else {
echo $o;
}
$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'))) {
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;
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'] .= '<meta name="friendica.community" content="true" />';
}
- if (x($a->profile, 'openidserver')) {
+ if (!empty($a->profile['openidserver'])) {
$a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\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'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\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'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n" ;
+ $a->page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n";
}
}
- $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
- $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
+ $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n";
+ $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n";
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . (($a->getURLPath()) ? '/' . $a->getURLPath() : ''));
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
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']);
}
// 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);
}
$json = ['cancel' => 1];
- if (!empty($_REQUEST['jsreload']) && strlen($_REQUEST['jsreload'])) {
+ if (!empty($_REQUEST['jsreload'])) {
$json['reload'] = System::baseUrl() . '/' . $_REQUEST['jsreload'];
}
}
$json = ['success' => 1];
- if (!empty($_REQUEST['jsreload']) && strlen($_REQUEST['jsreload'])) {
+ if (!empty($_REQUEST['jsreload'])) {
$json['reload'] = $baseurl . '/' . $_REQUEST['jsreload'];
}
}
// 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
$o .= '<p>' . L10n::t('Current timezone: %s', $_REQUEST['timezone']) . '</p>';
}
- if (x($a->data, 'mod-localtime')) {
+ if (!empty($a->data['mod-localtime'])) {
$o .= '<p>' . L10n::t('Converted localtime: %s', $a->data['mod-localtime']) . '</p>';
}
$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'])
);
$submanage = $r;
- $identity = (x($_POST['identity']) ? intval($_POST['identity']) : 0);
+ $identity = (!empty($_POST['identity']) ? intval($_POST['identity']) : 0);
if (!$identity) {
return;
}
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']);
}
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;
'$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'])) : '',
+ '$subjtxt' => !empty($_REQUEST['subject']) ? strip_tags($_REQUEST['subject']) : '',
+ '$text' => !empty($_REQUEST['body']) ? Strings::escapeHtml(htmlspecialchars($_REQUEST['body'])) : '',
'$readonly' => '',
'$yourmessage' => L10n::t('Your message:'),
'$select' => $select,
$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();
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]);
}
$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;
}
// 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');
}
}
- if ($sel_nets !== false) {
+ if ($sel_nets) {
$net_args['nets'] = $sel_nets;
}
}
}
- // 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()]);
$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';
}
$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;
$parents_str = implode(', ', $parents_arr);
}
- if (x($_GET, 'offset')) {
+ if (!empty($_GET['offset'])) {
$date_offset = $_GET['offset'];
}
$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',
],
[
'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',
$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',
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',
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',
$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',
];
// 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
]);
exit;
}
- $keywords = ((x($a->profile, 'pub_keywords')) ? $a->profile['pub_keywords'] : '');
+ $keywords = defaults($a->profile, 'pub_keywords', '');
$keywords = str_replace(['#',',',' ',',,'], ['',' ',',',','], $keywords);
$keywords = explode(',', $keywords);
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);
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());
// 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;
if (DBA::isResult($r)) {
foreach ($r as $rr) {
- $res[] = "'" . DBA::escape($rr['rid']) . "'" ;
+ $res[] = "'" . DBA::escape($rr['rid']) . "'";
}
} else {
$a->internalRedirect($_SESSION['photo_return']);
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'])) : '';
$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'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
$arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n");
}
if ($prevlink) {
- $prevlink = [$prevlink, '<div class="icon prev"></div>'] ;
+ $prevlink = [$prevlink, '<div class="icon prev"></div>'];
}
$photo = [
$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' ",
$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']);
}
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')) {
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) {
} 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);
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;
'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;
}
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);
$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']);
]);
- $parent = (x($_GET,'parent') ? intval($_GET['parent']) : '0');
+ $parent = (!empty($_GET['parent']) ? intval($_GET['parent']) : '0');
$verbs = L10n::getPokeVerbs();
$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.
$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;
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) {
// 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) {
$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) {
}
// 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'),
}
}
- 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');
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;
}
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())
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)
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]);
}
}
-
-
-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()) {
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
return dirfind_content($a);
}
- if (x($_GET,'search-option'))
+ if (!empty($_GET['search-option']))
switch($_GET['search-option']) {
case 'fulltext':
break;
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'];
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' , '');
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);
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) {
}
}
- $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;
}
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');
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'];
$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;
}
}
}
- $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'])) : '');
-
- $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);
-
-
- $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);
-
- $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);
+ $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 = (!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 = (!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 = ((!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);
$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']);
}
return Login::form();
}
- if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
+ if (!empty($_SESSION['submanage'])) {
notice(L10n::t('Permission denied.') . EOL);
return;
}
$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'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl().'/ostatus_subscribe?url=' . urlencode($legacy_contact) . '">';
}
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, '?')) {
$post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
$objtype = (($item['resource-id']) ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE );
- $link = XML::escape('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
+ $link = XML::escape('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n");
$body = $item['body'];
$obj = <<< EOT
return;
}
- if (x($_GET,'ignore') && intval($_GET['ignore'])) {
+ if (!empty($_GET['ignore'])) {
// Check if we should do HTML-based delete confirmation
if ($_REQUEST['confirm']) {
// <form> can't take arguments in its "action" parameter
$href = System::baseUrl() . '/display/' . $item['guid'];
}
- $link = XML::escape('<link rel="alternate" type="text/html" href="'. $href . '" />' . "\n") ;
+ $link = XML::escape('<link rel="alternate" type="text/html" href="'. $href . '" />' . "\n");
$body = XML::escape($item['body']);
$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']);
}
}
- 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']);
}
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];
killme();
}
- if (! x($_FILES,'userfile')) {
+ if (empty($_FILES['userfile'])) {
if ($r_json) {
echo json_encode(['error' => L10n::t('Invalid request.')]);
}
if ($r_json) {
echo json_encode(['error' => $msg]);
} else {
- echo $msg . EOL ;
+ echo $msg . EOL;
}
@unlink($src);
killme();
if ($r_json) {
echo json_encode(['error' => $msg]);
} else {
- echo $msg . EOL ;
+ echo $msg . EOL;
}
killme();
}
if ($r_json) {
echo json_encode(['error' => $msg]);
} else {
- echo $msg . EOL ;
+ echo $msg . EOL;
}
killme();
}
{
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`
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.')]);
}
$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];
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)) {
'$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'])) : ''),
+ '$subjtxt' => (!empty($_REQUEST['subject']) ? strip_tags($_REQUEST['subject']) : ''),
+ '$text' => (!empty($_REQUEST['body']) ? Strings::escapeHtml(htmlspecialchars($_REQUEST['body'])) : ''),
'$readonly' => '',
'$yourmessage' => L10n::t('Your message:'),
'$parent' => '',
$o .= '<br /><br />';
- if (x($_GET, 'addr')) {
+ if (!empty($_GET['addr'])) {
$addr = trim($_GET['addr']);
$res = Probe::lrdd($addr);
$o .= '<pre>';
<text x="149" y="1721" style="font:13px Open Sans">($_POST['localconfirm'] == 1)</text>
<text x="149" y="1744" style="font:13px Open Sans">-----------------------------------------------------------------------</text>
<text x="149" y="1767" style="font:13px Open Sans">- if(local_user() && ($a->user['nickname'] == $a-</text>
-<text x="149" y="1790" style="font:13px Open Sans">>argv[1]) && (x($_POST,'dfrn_url')))</text>
+<text x="149" y="1790" style="font:13px Open Sans">>argv[1]) && !empty($_POST['dfrn_url']))</text>
<text x="149" y="1813" style="font:13px Open Sans">-></text>
<text x="149" y="1859" style="font:13px Open Sans">- $confirm_key comes from $_POST</text>
<text x="149" y="1905" style="font:13px Open Sans">- get data for contact Karen (contact table) by </text>
<path d="M866,2206 C861.5820313,2206 858,2209.5820313 858,2214 L858,2444 C858,2448.4179688 861.5820313,2452 866,2452 L1434,2452 C1438.4179688,2452 1442,2448.4179688 1442,2444 L1442,2214 C1442,2209.5820313 1438.4179688,2206 1434,2206 Z" style="fill:rgb(255,255,3);stroke:none" clip-path="url(#clip14)" />
<text x="871" y="2228" style="font:13px Open Sans">http://karenhomepage.com/dfrn_request?confirm_key=”ABC123”</text>
<text x="871" y="2274" style="font:13px Open Sans">dfrn_request_content() -</text>
-<text x="871" y="2297" style="font:13px Open Sans">(elseif((x($_GET,'confirm_key')) && strlen($_GET['confirm_key'])) )</text>
+<text x="871" y="2297" style="font:13px Open Sans">elseif (!empty($_GET['confirm_key']))</text>
<text x="871" y="2320" style="font:13px Open Sans">----------------------------------------------------------------------------------------------</text>
<text x="871" y="2366" style="font:13px Open Sans">- select the intro by confirm_key (intro table) -> get contact id</text>
<text x="871" y="2389" style="font:13px Open Sans">- use the intro contact id to get the contact in the contact table</text>
// 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')))
{
$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() : '' );
}
/**
public static function build(App $a)
{
// Placeholder div for popup panel
- $nav = '<div id="panel" style="display: none;"></div>' ;
+ $nav = '<div id="panel" style="display: none;"></div>';
$nav_info = self::getInfo($a);
// "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()))) {
// 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')];
}
$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;
}
throw new Exception('OEmbed failed for URL: ' . $url);
}
- if (x($title)) {
+ if (!empty($title)) {
$o->title = $title;
}
$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]);
}
$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];
}
$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];
}
$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];
}
$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];
}
*/
$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.
// 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);
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"];
}
}
// If there is some js available we don't need the url
- if (x($contact, 'click')) {
+ if (!empty($contact['click'])) {
$url = '';
}
$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'];
$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();
$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,
'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']),
'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),
public function read($session_id)
{
- if (!x($session_id)) {
+ if (empty($session_id)) {
return '';
}
Lock::release('dbupdate');
}
}
+ } elseif ($force) {
+ DBStructure::update($verbose, true);
}
return '';
}
- 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;
}
* @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');
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);
}
}
- 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 = [];
+ $compacted = [];
+ $counter = [];
- foreach ($commands AS $command) {
- $conditions = $command['conditions'];
- reset($conditions);
- $first_key = key($conditions);
+ foreach ($commands AS $command) {
+ $conditions = $command['conditions'];
+ reset($conditions);
+ $first_key = key($conditions);
- $condition_string = self::buildCondition($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 ((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;
+ if (!self::e($sql, $conditions)) {
+ if ($do_transaction) {
+ self::rollback();
}
-
- $compacted[$key_table][$key_condition][$i][$value] = $value;
- $counter[$key_table][$key_condition] = $i;
+ 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) . ");";
+ }
+ 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);
+ Logger::log(self::replaceParameters($sql, $field_values), Logger::DATA);
- if (!self::e($sql, $field_values)) {
- if ($do_transaction) {
- self::rollback();
- }
- return false;
+ 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;
}
/**
$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;
}
}
$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) {
$url = $data["url"];
if (!$contact_id) {
- DBA::insert('contact', [
+ $fields = [
'uid' => $uid,
'created' => DateTimeFormat::utcNow(),
'url' => $data["url"],
'writable' => 1,
'blocked' => 0,
'readonly' => 0,
- 'pending' => 0]
- );
+ 'pending' => 0];
+
+ $condition = ['nurl' => Strings::normaliseLink($data["url"]), 'uid' => $uid, 'deleted' => false];
- $s = DBA::select('contact', ['id'], ['nurl' => Strings::normaliseLink($data["url"]), 'uid' => $uid], ['order' => ['id'], 'limit' => 2]);
+ 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;
}
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);
}
}
return $result;
}
- if (x($arr['contact'], 'name')) {
+ if (!empty($arr['contact']['name'])) {
$ret = $arr['contact'];
} else {
$ret = Probe::uri($url, $network, $uid, false);
}
// 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) {
}
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;
}
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.
*/
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);
$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);
// 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;
}
$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 = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
}
// Map.
- if (strpos($s, '<div class="map">') !== false && x($item, 'coord')) {
+ if (strpos($s, '<div class="map">') !== false && !empty($item['coord'])) {
$x = Map::byCoordinates(trim($item['coord']));
if ($x) {
$s = preg_replace('/\<div class\=\"map\"\>/', '$0' . $x, $s);
$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();
$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;
// 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()) {
// 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;
}
$firstname = $split_name['first'];
$lastname = $split_name['last'];
- if (x($profile, 'guid')) {
+ if (!empty($profile['guid'])) {
$diaspora = [
'guid' => $profile['guid'],
'podloc' => System::baseUrl(),
}
$tab = false;
- if (x($_GET, 'tab')) {
+ if (!empty($_GET['tab'])) {
$tab = Strings::escapeTags(trim($_GET['tab']));
}
*/
public static function getMyURL()
{
- if (x($_SESSION, 'my_url')) {
+ if (!empty($_SESSION['my_url'])) {
return $_SESSION['my_url'];
}
return null;
*/
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();
}
$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.'));
}
$nets = defaults($_GET, 'nets', '');
- if ($nets == 'all') {
- $nets = '';
- }
- if (!x($a->page, 'aside')) {
+ if (empty($a->page['aside'])) {
$a->page['aside'] = '';
}
{
$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);
{
$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']);
}
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']),
$_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 {
}
}
- 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
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
$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';
$data['name'] = $data['nick'];
}
- if (!x($data, 'name')) {
+ if (empty($data['name'])) {
$data['name'] = $data['url'];
}
}
$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;
$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']) : '';
}
/*
*/
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;
}
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"];
public static function autoRedir(App $a, $contact_nick)
{
// prevent looping
- if (x($_REQUEST, 'redir') && intval($_REQUEST['redir'])) {
+ if (!empty($_REQUEST['redir'])) {
return;
}
*/
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;
}
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);
// 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 . "/"];
}
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";
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");
}
@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"]);
}
// @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,
/// @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);
}
$str_allowed = Config::get('system', 'allowed_email', '');
- if (!x($str_allowed)) {
+ if (empty($str_allowed)) {
return true;
}
$o .= "<td $today>";
$day = str_replace(' ', ' ', sprintf('%2.2d', $d));
if ($started) {
- if (x($links, $d) !== false) {
+ if (isset($links[$d])) {
$o .= "<a href=\"{$links[$d]}\">$day</a>";
} else {
$o .= $day;
$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);
}
$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');
<!DOCTYPE html >
<html itemscope itemtype="http://schema.org/Blog" lang="<?php echo $lang; ?>">
<head>
- <title><?php if(x($page,'title')) echo $page['title'] ?></title>
+ <title><?php if(!empty($page['title'])) echo $page['title'] ?></title>
<script>var baseurl="<?php echo Friendica\Core\System::baseUrl() ?>";</script>
- <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>
+ <?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?>
</head>
<body>
- <?php if(x($page,'nav')) echo $page['nav']; ?>
- <aside><?php if(x($page,'aside')) echo $page['aside']; ?></aside>
+ <?php if(!empty($page['nav'])) echo $page['nav']; ?>
+ <aside><?php if(!empty($page['aside'])) echo $page['aside']; ?></aside>
<section>
- <?php if(x($page,'content')) echo $page['content']; ?>
+ <?php if(!empty($page['content'])) echo $page['content']; ?>
<div id="pause"></div> <!-- The pause/resume Ajax indicator -->
<div id="page-footer"></div>
</section>
- <right_aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></right_aside>
- <footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
+ <right_aside><?php if(!empty($page['right_aside'])) echo $page['right_aside']; ?></right_aside>
+ <footer><?php if(!empty($page['footer'])) echo $page['footer']; ?></footer>
</body>
</html>
<!DOCTYPE html >
<html>
<head>
- <title><?php if(x($page,'title')) echo $page['title'] ?></title>
+ <title><?php if(!empty($page['title'])) echo $page['title'] ?></title>
<script>var baseurl="<?php echo Friendica\Core\System::baseUrl() ?>";</script>
- <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>
+ <?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?>
</head>
<body>
- <section class="minimal" style="margin:0px!important; padding:0px!important; float:none!important;display:block!important;"><?php if(x($page,'content')) echo $page['content']; ?>
+ <section class="minimal" style="margin:0px!important; padding:0px!important; float:none!important;display:block!important;"><?php if(!empty($page['content'])) echo $page['content']; ?>
<div id="page-footer"></div>
</section>
</body>
* only the pure content\r
*/\r
\r
-if(x($page,'content')) echo $page['content'];\r
+if(!empty($page['content'])) echo $page['content'];\r
\r
</ul>
<ul>
- <!-- <li><a href="network/0?nets=all&cid={{$contact_id}}" id="contact-edit-view-recent">{{$lblrecent}}</a></li> -->
+ <!-- <li><a href="network/?cid={{$contact_id}}" id="contact-edit-view-recent">{{$lblrecent}}</a></li> -->
{{if $follow}}<li><div id="contact-edit-follow"><a href="{{$follow}}">{{$follow_text}}</a></div></li>{{/if}}
</ul>
</div> {{* End of contact-edit-status-wrapper *}}
<div id="nets-sidebar" class="widget">
<h3>{{$title}}</h3>
<div id="nets-desc">{{$desc}}</div>
- <a href="{{$base}}?nets=all" class="nets-link{{if $sel_all}} nets-selected{{/if}} nets-all">{{$all}}</a>
+ <a href="{{$base}}" class="nets-link{{if $sel_all}} nets-selected{{/if}} nets-all">{{$all}}</a>
<ul role="menu" class="nets-ul">
{{foreach $nets as $net}}
<li role="menuitem" ><a href="{{$base}}?nets={{$net.ref}}" class="nets-link{{if $net.selected}} nets-selected{{/if}}">{{$net.name}}</a></li>
$s_colorset = Config::get('duepuntozero', 'colorset');
$colorset = PConfig::get($uid, 'duepuntozero', 'colorset');
-if (!x($colorset)) {
+if (empty($colorset)) {
$colorset = $s_colorset;
}
$hsl['L'] = ($hsl['L'] < 0) ? 0:$hsl['L']/100;
} else {
// We need to find out how much to darken
- $hsl['L'] = $hsl['L']/2 ;
+ $hsl['L'] = $hsl['L']/2;
}
return $hsl;
// if the page is an standard page (so we don't have it twice for modals)
//
/// @todo Think about to move js stuff in the footer
- if (!$minimal && x($page, 'htmlhead')) {
+ if (!$minimal && !empty($page['htmlhead'])) {
echo $page['htmlhead'];
}
<body id="top" class="mod-<?php echo $a->module . " " . $is_singleuser_class . " " . $view_mode_class;?>">
<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
<?php
- if (x($page, 'nav') && !$minimal) {
+ if (!empty($page['nav']) && !$minimal) {
echo str_replace(
"~config.sitename~",
Config::get('config', 'sitename'),
if ($minimal) {
?>
<section class="minimal" style="margin:0px!important; padding:0px!important; float:none!important; display:block!important;">
- <?php if (x($page, 'content')) echo $page['content']; ?>
+ <?php if (!empty($page['content'])) echo $page['content']; ?>
<div id="page-footer"></div>
</section>
<?php
<div class="container">
<div class="row">
<?php
- if ((!x($_REQUEST, 'pagename') || $_REQUEST['pagename'] != "lostpass") && ($_SERVER['REQUEST_URI'] != $basepath)) {
+ if ((empty($_REQUEST['pagename']) || $_REQUEST['pagename'] != "lostpass") && ($_SERVER['REQUEST_URI'] != $basepath)) {
echo '
<aside class="col-lg-3 col-md-3 offcanvas-sm offcanvas-xs">';
- if (x($page, 'aside')) {
+ if (!empty($page['aside'])) {
echo $page['aside'];
}
- if (x($page, 'right_aside')) {
+ if (!empty($page['right_aside'])) {
echo $page['right_aside'];
}
<section class="sectiontop ';
echo $a->argv[0];
echo '-content-wrapper">';
- if (x($page, 'content')) {
+ if (!empty($page['content'])) {
echo $page['content'];
}
echo '
} else {
echo '
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="content" style="margin-top:50px;">';
- if (x($page, 'content')) {
+ if (!empty($page['content'])) {
echo $page['content'];
}
echo '
require 'view/theme/frio/none.php';
} else {
$template = 'view/theme/' . $a->getCurrentTheme() . '/'
- . ((x($a->page, 'template')) ? $a->page['template'] : 'default' ) . '.php';
+ . defaults($a->page, 'template', 'default' ) . '.php';
if (file_exists($template)) {
require_once $template;
} else {
<!DOCTYPE html >
<html>
<head>
- <title><?php if(x($page,'title')) echo $page['title'] ?></title>
+ <title><?php if(!empty($page['title'])) echo $page['title'] ?></title>
<meta name="viewport" content="initial-scale=1.0">
<meta request="<?php echo htmlspecialchars($_REQUEST['pagename']) ?>">
<script type="text/javascript">var baseurl="<?php echo Friendica\Core\System::baseUrl() ?>";</script>
<script type="text/javascript">var frio="<?php echo "view/theme/frio"; ?>";</script>
<?php $baseurl = Friendica\Core\System::baseUrl(); ?>
<?php $frio = "view/theme/frio"; ?>
- <?php if(x($page,'htmlhead')) echo $page['htmlhead']; ?>
+ <?php if(!empty($page['htmlhead'])) echo $page['htmlhead']; ?>
</head>
<body id="top">
<?php if($_SERVER['REQUEST_URI'] == "/"){header('Location: /login');} ?>
<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
<?php
- if(x($page,'nav')) {
+ if(!empty($page['nav'])) {
echo str_replace("~config.sitename~",Friendica\Core\Config::get('config','sitename'),
str_replace("~system.banner~",Friendica\Core\Config::get('system','banner'),
$page['nav']
<?php
echo"
<aside class=\"col-lg-3 col-md-3 hidden-sm hidden-xs\">
- "; 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"
</aside>
<section class=\"sectiontop\">
<div class=\"panel "; echo $a->argv[0]; echo "-content-wrapper\">
<div class=\"panel-body\">";
- if(x($page,'content')) echo $page['content']; echo"
+ if(!empty($page['content'])) echo $page['content']; echo"
<div id=\"pause\"></div> <!-- The pause/resume Ajax indicator -->
</div>
</div>
// 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'];
}
</ul>
<ul>
- <!-- <li><a href="network/0?nets=all&cid={{$contact_id}}" id="contact-edit-view-recent">{{$lblrecent|escape}}</a></li> -->
+ <!-- <li><a href="network/?cid={{$contact_id}}" id="contact-edit-view-recent">{{$lblrecent|escape}}</a></li> -->
{{if $follow}}<li><div id="contact-edit-follow"><a href="{{$follow}}">{{$follow_text|escape}}</a></div></li>{{/if}}
</ul>
</div> {{* End of contact-edit-status-wrapper *}}
<h3>{{$title}}</h3>
<div id="nets-desc">{{$desc}}</div>
<ul role="menu" class="nets-ul">
- <li role="menuitem" {{if $sel_all}}class="selected"{{/if}}><a href="{{$base}}?nets=all" class="nets-link{{if $sel_all}} nets-selected{{/if}} nets-all">{{$all}}</a></li>
+ <li role="menuitem" {{if $sel_all}}class="selected"{{/if}}><a href="{{$base}}" class="nets-link{{if $sel_all}} nets-selected{{/if}} nets-all">{{$all}}</a></li>
{{foreach $nets as $net}}
<li role="menuitem" {{if $net.selected}}class="selected"{{/if}}><a href="{{$base}}?nets={{$net.ref}}" class="nets-link{{if $net.selected}} nets-selected{{/if}}">{{$net.name}}</a></li>
{{/foreach}}
*/
function frio_acl_lookup(App $a, &$results)
{
- $nets = x($_GET, 'nets') ? Strings::escapeTags(trim($_GET['nets'])) : '';
+ $nets = !empty($_GET['nets']) ? Strings::escapeTags(trim($_GET['nets'])) : '';
// we introduce a new search type, r should do the same query like it's
// done in /src/Module/Contact.php for connections
<div id="nets-desc">{{$desc}}</div>
<ul class="nets-ul">
- <li class="tool {{if $sel_all}}selected{{/if}}"><a href="{{$base}}?nets=all" class="nets-link nets-all">{{$all}}</a>
+ <li class="tool {{if $sel_all}}selected{{/if}}"><a href="{{$base}}" class="nets-link nets-all">{{$all}}</a>
{{foreach $nets as $net}}
<li class="tool {{if $net.selected}}selected{{/if}}"><a href="{{$base}}?f=&nets={{$net.ref}}" class="nets-link">{{$net.name}}</a></li>
{{/foreach}}
<!DOCTYPE html >
<html>
<head>
- <title><?php if(x($page,'title')) echo $page['title'] ?></title>
+ <title><?php if(!empty($page['title'])) echo $page['title'] ?></title>
<script>var baseurl="<?php echo Friendica\Core\System::baseUrl() ?>";</script>
<script type="text/javascript">
function ScrollToBottom(){
window.scrollTo(0,document.body.scrollHeight);
}
</script>
- <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>
+ <?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?>
</head>
<body>
<header>
- <?php if(x($page, 'header')) echo $page['header']; ?>
+ <?php if(!empty($page['header'])) echo $page['header']; ?>
</header>
- <?php if(x($page,'nav')) echo $page['nav']; ?>
+ <?php if(!empty($page['nav'])) echo $page['nav']; ?>
- <aside><?php if(x($page,'aside')) echo $page['aside']; ?></aside>
+ <aside><?php if(!empty($page['aside'])) echo $page['aside']; ?></aside>
<section>
- <?php if(x($page,'content')) echo $page['content']; ?>
+ <?php if(!empty($page['content'])) echo $page['content']; ?>
<div id="pause"></div> <!-- The pause/resume Ajax indicator -->
<div id="page-footer"></div>
</section>
- <right_aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></right_aside>
+ <right_aside><?php if(!empty($page['right_aside'])) echo $page['right_aside']; ?></right_aside>
<footer id="footer">
- <?php if(x($page, 'footer')) echo $page['footer']; ?>
+ <?php if(!empty($page['footer'])) echo $page['footer']; ?>
</footer>
<tools id="tools">
- <?php if (x($page, 'tools')) echo $page['tools']; ?>
+ <?php if (!empty($page['tools'])) echo $page['tools']; ?>
<div id="scrollup" >
<a class="item-scrollup" href="javascript:scrollTo(0,100000)"><img src="view/theme/smoothly/images/down.png" alt="to bottom" title="to bottom" /></a>
<a class="item-scrollup" href="javascript:scrollTo(0,0)"><img src="view/theme/smoothly/images/up.png" alt="to top" title="to top" /></a>
</div>
</tools>
- <?php if (x($page, 'bottom')) echo $page['bottom']; ?>
+ <?php if (!empty($page['bottom'])) echo $page['bottom']; ?>
</body>
</html>
</ul>
<ul>
- <!-- <li><a href="network/0?nets=all&cid={{$contact_id}}" id="contact-edit-view-recent">{{$lblrecent}}</a></li> -->
+ <!-- <li><a href="network/?cid={{$contact_id}}" id="contact-edit-view-recent">{{$lblrecent}}</a></li> -->
{{if $follow}}<li><div id="contact-edit-follow"><a href="{{$follow}}">{{$follow_text}}</a></div></li>{{/if}}
</ul>
</div> {{* End of contact-edit-status-wrapper *}}
//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;