aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2025-04-23 18:17:23 +0000
committerMario <mario@mariovavti.com>2025-04-23 18:17:23 +0000
commit7c59dd9fd71424f1592615dd4dcc58cadb08af7a (patch)
tree3d51569ab1931b35746c59cc7656158b7d6340eb
parent118a223ee14c197c951a4ba985fa7e3445e40c4d (diff)
downloadvolse-hubzilla-7c59dd9fd71424f1592615dd4dcc58cadb08af7a.tar.gz
volse-hubzilla-7c59dd9fd71424f1592615dd4dcc58cadb08af7a.tar.bz2
volse-hubzilla-7c59dd9fd71424f1592615dd4dcc58cadb08af7a.zip
more deprecate x()
-rw-r--r--Zotlabs/Lib/Activity.php6
-rw-r--r--Zotlabs/Module/Acl.php16
-rw-r--r--Zotlabs/Module/Hq.php2
-rw-r--r--Zotlabs/Render/SmartyInterface.php2
-rw-r--r--Zotlabs/Render/Theme.php6
-rw-r--r--Zotlabs/Web/Router.php2
-rw-r--r--Zotlabs/Web/WebServer.php2
-rw-r--r--boot.php40
-rw-r--r--include/auth.php13
-rw-r--r--include/bbcode.php22
-rw-r--r--include/conversation.php77
-rw-r--r--include/items.php146
-rw-r--r--include/language.php13
-rw-r--r--include/nav.php2
-rw-r--r--include/network.php32
-rw-r--r--include/security.php10
-rw-r--r--view/php/default.php20
17 files changed, 190 insertions, 221 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index ffa84d65f..b5c2da6b1 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -69,10 +69,10 @@ class Activity {
if ($j) {
xchan_query($j, true);
$items = fetch_post_tags($j);
- }
- if ($items) {
- return self::encode_item(array_shift($items));
+ if ($items) {
+ return self::encode_item(array_shift($items));
+ }
}
return null;
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index 1de7a3d02..cf9278f5e 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -29,11 +29,11 @@ class Acl extends \Zotlabs\Web\Controller {
// logger('mod_acl: ' . print_r($_GET,true),LOGGER_DATA);
- $start = (x($_REQUEST,'start') ? $_REQUEST['start'] : 0);
- $count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 500);
- $search = (x($_REQUEST,'search') ? $_REQUEST['search'] : '');
- $type = (x($_REQUEST,'type') ? $_REQUEST['type'] : '');
- $noforums = (x($_REQUEST,'n') ? $_REQUEST['n'] : false);
+ $start = (!empty($_REQUEST['start']) ? $_REQUEST['start'] : 0);
+ $count = (!empty($_REQUEST['count']) ? $_REQUEST['count'] : 500);
+ $search = (!empty($_REQUEST['search']) ? $_REQUEST['search'] : '');
+ $type = (!empty($_REQUEST['type']) ? $_REQUEST['type'] : '');
+ $noforums = (!empty($_REQUEST['n']) ? $_REQUEST['n'] : false);
// $type =
@@ -53,7 +53,7 @@ class Acl extends \Zotlabs\Web\Controller {
// List of channels whose connections to also suggest,
// e.g. currently viewed channel or channels mentioned in a post
- $extra_channels = (x($_REQUEST,'extra_channels') ? $_REQUEST['extra_channels'] : array());
+ $extra_channels = (!empty($_REQUEST['extra_channels']) ? $_REQUEST['extra_channels'] : []);
// The different autocomplete libraries use different names for the search text
// parameter. Internally we'll use $search to represent the search text no matter
@@ -416,7 +416,7 @@ class Acl extends \Zotlabs\Web\Controller {
}
$dirmode = intval(Config::Get('system','directory_mode'));
- $search = ((x($_REQUEST,'search')) ? htmlentities($_REQUEST['search'],ENT_COMPAT,'UTF-8',false) : '');
+ $search = ((!empty($_REQUEST['search'])) ? htmlentities($_REQUEST['search'], ENT_COMPAT, 'UTF-8', false) : '');
if(! $search || mb_strlen($search) < 2)
return array();
@@ -446,7 +446,7 @@ class Acl extends \Zotlabs\Web\Controller {
$token = Config::Get('system','realm_token');
- $count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 100);
+ $count = (!empty($_REQUEST['count']) ? $_REQUEST['count'] : 100);
if($url) {
$query = $url . '?f=' . (($token) ? '&t=' . urlencode($token) : '');
$query .= '&name=' . urlencode($search) . "&limit=$count" . (($address) ? '&address=' . urlencode(punify($search)) : '');
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 51caa179c..3a6eb7e69 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -129,7 +129,7 @@ class Hq extends \Zotlabs\Web\Controller {
'$nouveau' => '0',
'$wall' => '0',
'$page' => '1',
- '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0),
+ '$list' => ((!empty($_REQUEST['list'])) ? intval($_REQUEST['list']) : 0),
'$search' => '',
'$xchan' => '',
'$order' => '',
diff --git a/Zotlabs/Render/SmartyInterface.php b/Zotlabs/Render/SmartyInterface.php
index a319a4881..003262939 100644
--- a/Zotlabs/Render/SmartyInterface.php
+++ b/Zotlabs/Render/SmartyInterface.php
@@ -19,7 +19,7 @@ class SmartyInterface extends Smarty {
// The order is thus very important here
$template_dirs = array('theme' => "view/theme/$thname/tpl/");
- if ( x(App::$theme_info,"extends") ) {
+ if (!empty(App::$theme_info['extends'])) {
$template_dirs = $template_dirs + array('extends' => "view/theme/" . App::$theme_info["extends"] . "/tpl/");
}
$template_dirs = $template_dirs + array('base' => 'view/tpl/');
diff --git a/Zotlabs/Render/Theme.php b/Zotlabs/Render/Theme.php
index a42b65e03..9403d21a3 100644
--- a/Zotlabs/Render/Theme.php
+++ b/Zotlabs/Render/Theme.php
@@ -26,9 +26,9 @@ class Theme {
*/
static public function current() {
- self::$system_theme = ((isset(App::$config['system']['theme']))
+ self::$system_theme = ((!empty(App::$config['system']['theme']))
? App::$config['system']['theme'] : '');
- self::$session_theme = ((isset($_SESSION) && x($_SESSION, 'theme'))
+ self::$session_theme = ((!empty($_SESSION['theme']))
? $_SESSION['theme'] : self::$system_theme);
$page_theme = null;
@@ -111,7 +111,7 @@ class Theme {
$opts = '';
$opts = (($uid) ? '?puid=' . $uid : '');
- $schema_str = ((x(App::$layout,'schema')) ? '&schema=' . App::$layout['schema'] : '');
+ $schema_str = ((!empty(App::$layout['schema'])) ? '&schema=' . App::$layout['schema'] : '');
if(($s) && (! $schema_str))
$schema_str = '&schema=' . $s;
diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php
index ad7d37677..9f4cb4b4a 100644
--- a/Zotlabs/Web/Router.php
+++ b/Zotlabs/Web/Router.php
@@ -51,7 +51,7 @@ class Router {
$module = App::$module;
$modname = "Zotlabs\\Module\\" . ucfirst($module);
- if(strlen($module)) {
+ if(!empty($module)) {
/*
* We will always have a module name.
diff --git a/Zotlabs/Web/WebServer.php b/Zotlabs/Web/WebServer.php
index beb923fb4..a59a509f2 100644
--- a/Zotlabs/Web/WebServer.php
+++ b/Zotlabs/Web/WebServer.php
@@ -54,7 +54,7 @@ class WebServer {
unset($_SESSION['language']);
}
- if ((x($_SESSION, 'language')) && ($_SESSION['language'] !== App::$language)) {
+ if ((!empty($_SESSION['language'])) && ($_SESSION['language'] !== App::$language)) {
App::$language = $_SESSION['language'];
load_translation_table(\App::$language);
}
diff --git a/boot.php b/boot.php
index cdac1e916..41a3ed855 100644
--- a/boot.php
+++ b/boot.php
@@ -1301,7 +1301,7 @@ class App {
public static function register_template_engine($class, $name = '') {
if (!$name) {
$v = get_class_vars($class);
- if (x($v, "name")) {
+ if (!empty($v['name'])) {
$name = $v['name'];
}
}
@@ -1327,7 +1327,7 @@ class App {
}
else {
$template_engine = 'smarty3';
- if (x(self::$theme, 'template_engine')) {
+ if (!empty(self::$theme['template_engine'])) {
$template_engine = self::$theme['template_engine'];
}
}
@@ -2132,40 +2132,6 @@ function load_contact_links($uid) {
/**
- * @brief Returns querystring as string from a mapped array.
- *
- * @param array $params mapped array with query parameters
- * @param string $name of parameter, default null
- *
- * @return string
- */
-function build_querystring($params, $name = null) {
- $ret = '';
- foreach ($params as $key => $val) {
- if (is_array($val)) {
- if ($name === null) {
- $ret .= build_querystring($val, $key);
- }
- else {
- $ret .= build_querystring($val, $name . "[$key]");
- }
- }
- else {
- $val = urlencode($val);
- if ($name != null) {
- $ret .= $name . "[$key]" . "=$val&";
- }
- else {
- $ret .= "$key=$val&";
- }
- }
- }
-
- return $ret;
-}
-
-
-/**
* @brief Much better way of dealing with c-style args.
*/
function argc() {
@@ -2322,7 +2288,7 @@ function construct_page() {
nav($navbar);
}
- $current_theme = Zotlabs\Render\Theme::current();
+ $current_theme = Theme::current();
// logger('current_theme: ' . print_r($current_theme,true));
// Zotlabs\Render\Theme::debug();
diff --git a/include/auth.php b/include/auth.php
index 1fc2cc556..439f064e4 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -216,12 +216,11 @@ function requires_mfa_check(int $account_id, string $module, string $arg): bool
* also handles logout
*/
-if((isset($_SESSION)) && (x($_SESSION, 'authenticated')) &&
- ((! (x($_POST, 'auth-params'))) || ($_POST['auth-params'] !== 'login'))) {
+if(!empty($_SESSION['authenticated']) && (empty($_POST['auth-params']) || $_POST['auth-params'] !== 'login')) {
// process a logout request
- if(((x($_POST, 'auth-params')) && ($_POST['auth-params'] === 'logout')) || (App::$module === 'logout')) {
+ if((!empty($_POST['auth-params']) && $_POST['auth-params'] === 'logout') || App::$module === 'logout') {
// process logout request
$args = array('channel_id' => local_channel());
call_hooks('logging_out', $args);
@@ -241,7 +240,7 @@ if((isset($_SESSION)) && (x($_SESSION, 'authenticated')) &&
// re-validate a visitor, optionally invoke "su" if permitted to do so
- if(x($_SESSION, 'visitor_id') && (! x($_SESSION, 'uid'))) {
+ if(!empty($_SESSION['visitor_id']) && empty($_SESSION['uid'])) {
// if our authenticated guest is allowed to take control of the admin channel, make it so.
$admins = Config::Get('system', 'remote_admin');
if($admins && is_array($admins) && in_array($_SESSION['visitor_id'], $admins)) {
@@ -281,7 +280,7 @@ if((isset($_SESSION)) && (x($_SESSION, 'authenticated')) &&
// already logged in user returning
- if(x($_SESSION, 'uid') || x($_SESSION, 'account_id')) {
+ if(!empty($_SESSION['uid']) || !empty($_SESSION['account_id'])) {
App::$session->return_check();
@@ -292,7 +291,7 @@ if((isset($_SESSION)) && (x($_SESSION, 'authenticated')) &&
if(($r) && (($r[0]['account_flags'] == ACCOUNT_OK) || ($r[0]['account_flags'] == ACCOUNT_UNVERIFIED))) {
App::$account = $r[0];
$login_refresh = false;
- if(! x($_SESSION,'last_login_date')) {
+ if(empty($_SESSION['last_login_date'])) {
$_SESSION['last_login_date'] = datetime_convert('UTC','UTC');
}
if(strcmp(datetime_convert('UTC','UTC','now - 12 hours'), $_SESSION['last_login_date']) > 0 ) {
@@ -331,7 +330,7 @@ else {
if($password)
$encrypted = hash('whirlpool', trim($password));
- if((x($_POST, 'auth-params')) && $_POST['auth-params'] === 'login') {
+ if(!empty($_POST['auth-params']) && $_POST['auth-params'] === 'login') {
$atoken = null;
$account = null;
diff --git a/include/bbcode.php b/include/bbcode.php
index c152d45cb..2c8ef3f20 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -420,12 +420,12 @@ function getAttachmentData($body) {
$type = "";
preg_match("/type='(.*?)'/ism", $attributes, $matches);
- if (x($matches, 1)) {
+ if (!empty($matches[1])) {
$type = strtolower($matches[1]);
}
preg_match('/type=\&quot\;(.*?)\&quot\;/ism', $attributes, $matches);
- if (x($matches, 1)) {
+ if (!empty($matches[1])) {
$type = strtolower($matches[1]);
}
@@ -442,12 +442,12 @@ function getAttachmentData($body) {
}
$url = "";
preg_match("/url='(.*?)'/ism", $attributes, $matches);
- if (x($matches, 1)) {
+ if (!empty($matches[1])) {
$url = $matches[1];
}
preg_match('/url=\&quot\;(.*?)\&quot\;/ism', $attributes, $matches);
- if (x($matches, 1)) {
+ if (!empty($matches[1])) {
$url = $matches[1];
}
@@ -457,12 +457,12 @@ function getAttachmentData($body) {
$title = "";
preg_match("/title='(.*?)'/ism", $attributes, $matches);
- if (x($matches, 1)) {
+ if (!empty($matches[1])) {
$title = $matches[1];
}
preg_match('/title=\&quot\;(.*?)\&quot\;/ism', $attributes, $matches);
- if (x($matches, 1)) {
+ if (!empty($matches[1])) {
$title = $matches[1];
}
if ($title != "") {
@@ -473,12 +473,12 @@ function getAttachmentData($body) {
$image = "";
preg_match("/image='(.*?)'/ism", $attributes, $matches);
- if (x($matches, 1)) {
+ if (!empty($matches[1])) {
$image = $matches[1];
}
preg_match('/image=\&quot\;(.*?)\&quot\;/ism', $attributes, $matches);
- if (x($matches, 1)) {
+ if (!empty($matches[1])) {
$image = $matches[1];
}
@@ -488,12 +488,12 @@ function getAttachmentData($body) {
$preview = "";
preg_match("/preview='(.*?)'/ism", $attributes, $matches);
- if (x($matches, 1)) {
+ if (!empty($matches[1])) {
$preview = $matches[1];
}
preg_match('/preview=\&quot\;(.*?)\&quot\;/ism', $attributes, $matches);
- if (x($matches, 1)) {
+ if (!empty($matches[1])) {
$preview = $matches[1];
}
if ($preview != "") {
@@ -1761,7 +1761,7 @@ function bbcode($text, $options = []) {
// 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,'dtstart')) {
+ if ((!empty($ev['desc']) || !empty($ev['summary'])) && !empty($ev['dtstart'])) {
$sub = format_event_html($ev);
diff --git a/include/conversation.php b/include/conversation.php
index b365fdb32..2f1de770b 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -565,8 +565,13 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$likebuttons = false;
$shareable = false;
+ if (!isset($item['sig'])) {
+ hz_syslog(print_r($item,true));
+ bt_syslog('nosig');
+ }
+
$verified = (intval($item['item_verified']) ? t('Message signature validated') : '');
- $forged = ((($item['sig']) && (! intval($item['item_verified']))) ? t('Message signature incorrect') : '');
+ $forged = ((!empty($item['sig']) && !intval($item['item_verified'])) ? t('Message signature incorrect') : '');
$unverified = '';
@@ -781,7 +786,7 @@ function best_link_url($item) {
$clean_url = isset($item['author-link']) ? normalise_link($item['author-link']) : '';
if($clean_url && local_channel() && (local_channel() == $item['uid'])) {
- if(isset(App::$contacts) && x(App::$contacts, $clean_url)) {
+ if(isset(App::$contacts) && !empty(App::$contacts[$clean_url])) {
if(App::$contacts[$clean_url]['network'] === NETWORK_DFRN) {
$best_url = z_root() . '/redir/' . App::$contacts[$clean_url]['id'];
$sparkle = true;
@@ -1108,48 +1113,48 @@ function hz_status_editor($x, $popup = false) {
if($c && $c['channel_moved'])
return;
- $webpage = ((x($x,'webpage')) ? $x['webpage'] : '');
+ $webpage = ((!empty($x['webpage'])) ? $x['webpage'] : '');
$plaintext = true;
$feature_nocomment = feature_enabled($x['profile_uid'], 'disable_comments');
- if(x($x, 'disable_comments'))
+ if(!empty($x['disable_comments']))
$feature_nocomment = false;
$feature_expire = ((feature_enabled($x['profile_uid'], 'content_expire') && (! $webpage)) ? true : false);
- if(x($x, 'hide_expire'))
+ if(!empty($x['hide_expire']))
$feature_expire = false;
$feature_future = ((feature_enabled($x['profile_uid'], 'delayed_posting') && (! $webpage)) ? true : false);
- if(x($x, 'hide_future'))
+ if(!empty($x['hide_future']))
$feature_future = false;
$geotag = ((isset($x['allow_location']) && $x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
$setloc = t('Set your location');
$clearloc = ((get_pconfig($x['profile_uid'], 'system', 'use_browser_location')) ? t('Clear browser location') : '');
- if(x($x, 'hide_location'))
+ if(!empty($x['hide_location']))
$geotag = $setloc = $clearloc = '';
- $mimetype = ((x($x,'mimetype')) ? $x['mimetype'] : 'text/bbcode');
+ $mimetype = ((!empty($x['mimetype'])) ? $x['mimetype'] : 'text/bbcode');
- $mimeselect = ((x($x,'mimeselect')) ? $x['mimeselect'] : false);
+ $mimeselect = ((!empty($x['mimeselect'])) ? $x['mimeselect'] : false);
if($mimeselect)
$mimeselect = mimetype_select($x['profile_uid'], $mimetype);
else
$mimeselect = '<input type="hidden" name="mimetype" value="' . $mimetype . '" />';
$weblink = (($mimetype === 'text/bbcode') ? t('Insert web link') : false);
- if(x($x, 'hide_weblink'))
+ if(!empty($x['hide_weblink']))
$weblink = false;
$embedPhotos = t('Embed (existing) photo from your photo albums');
$writefiles = (($mimetype === 'text/bbcode') ? perm_is_allowed($x['profile_uid'], get_observer_hash(), 'write_storage') : false);
- if(x($x, 'hide_attach'))
+ if(!empty($x['hide_attach']))
$writefiles = false;
- $layout = ((x($x,'layout')) ? $x['layout'] : '');
+ $layout = ((!empty($x['layout'])) ? $x['layout'] : '');
- $layoutselect = ((x($x,'layoutselect')) ? $x['layoutselect'] : false);
+ $layoutselect = ((!empty($x['layoutselect'])) ? $x['layoutselect'] : false);
if($layoutselect)
$layoutselect = layout_select($x['profile_uid'], $layout);
else
@@ -1162,7 +1167,7 @@ function hz_status_editor($x, $popup = false) {
else
$id_select = '';
- $reset = ((x($x,'reset')) ? $x['reset'] : '');
+ $reset = ((!empty($x['reset'])) ? $x['reset'] : '');
$feature_auto_save_draft = ((feature_enabled($x['profile_uid'], 'auto_save_draft')) ? "true" : "false");
@@ -1171,14 +1176,14 @@ function hz_status_editor($x, $popup = false) {
$tplmacros = [
'$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
- '$pretext' => ((x($x,'pretext')) ? $x['pretext'] : ''),
+ '$pretext' => ((!empty($x['pretext'])) ? $x['pretext'] : ''),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
'$linkurl' => t('Please enter a link URL:'),
'$term' => t('Tag term:'),
'$whereareu' => t('Where are you right now?'),
- '$editor_autocomplete'=> ((x($x,'editor_autocomplete')) ? $x['editor_autocomplete'] : ''),
- '$bbco_autocomplete'=> ((x($x,'bbco_autocomplete')) ? $x['bbco_autocomplete'] : ''),
+ '$editor_autocomplete'=> ((!empty($x['editor_autocomplete'])) ? $x['editor_autocomplete'] : ''),
+ '$bbco_autocomplete'=> ((!empty($x['bbco_autocomplete'])) ? $x['bbco_autocomplete'] : ''),
'$modalchooseimages' => t('Choose images to embed'),
'$modalchoosealbum' => t('Choose an album'),
'$modaldiffalbum' => t('Choose a different album...'),
@@ -1205,7 +1210,7 @@ function hz_status_editor($x, $popup = false) {
$tpl = get_markup_template('jot.tpl');
$preview = t('Preview');
- if(x($x, 'hide_preview'))
+ if(!empty($x['hide_preview']))
$preview = '';
$defexpire = ((($z = get_pconfig($x['profile_uid'], 'system', 'default_post_expire')) && (! $webpage)) ? $z : '');
@@ -1233,21 +1238,21 @@ function hz_status_editor($x, $popup = false) {
call_hooks('jot_tool', $jotplugins);
$jotnets = '';
- if(x($x,'jotnets')) {
+ if(!empty($x['jotnets'])) {
call_hooks('jot_networks', $jotnets);
}
- $sharebutton = (x($x,'button') ? $x['button'] : t('Share'));
- $placeholdtext = (x($x,'content_label') ? $x['content_label'] : $sharebutton);
+ $sharebutton = (!empty($x['button']) ? $x['button'] : t('Share'));
+ $placeholdtext = (!empty($x['content_label']) ? $x['content_label'] : $sharebutton);
$tplmacros = [
- '$return_path' => ((x($x, 'return_path')) ? $x['return_path'] : App::$query_string),
+ '$return_path' => ((!empty($x['return_path'])) ? $x['return_path'] : App::$query_string),
'$action' => z_root() . '/item',
'$share' => $sharebutton,
'$placeholdtext' => $placeholdtext,
'$webpage' => $webpage,
- '$placeholdpagetitle' => ((x($x,'ptlabel')) ? $x['ptlabel'] : t('Page link name')),
- '$pagetitle' => (x($x,'pagetitle') ? $x['pagetitle'] : ''),
+ '$placeholdpagetitle' => ((!empty($x['ptlabel'])) ? $x['ptlabel'] : t('Page link name')),
+ '$pagetitle' => (!empty($x['pagetitle']) ? $x['pagetitle'] : ''),
'$id_select' => $id_select,
'$id_seltext' => t('Post as'),
'$writefiles' => $writefiles,
@@ -1276,18 +1281,18 @@ function hz_status_editor($x, $popup = false) {
'$feature_nocomment' => $feature_nocomment,
'$nocomment' => ((array_key_exists('item',$x)) ? $x['item']['item_nocomment'] : 0),
'$clearloc' => $clearloc,
- '$title' => ((x($x, 'title')) ? htmlspecialchars($x['title'], ENT_COMPAT,'UTF-8') : ''),
- '$summary' => ((x($x, 'summary')) ? htmlspecialchars($x['summary'], ENT_COMPAT,'UTF-8') : ''),
- '$placeholdertitle' => ((x($x, 'placeholdertitle')) ? $x['placeholdertitle'] : t('Title (optional)')),
- '$placeholdersummary' => ((x($x, 'placeholdersummary')) ? $x['placeholdersummary'] : t('Summary (optional)')),
+ '$title' => ((!empty($x['title'])) ? htmlspecialchars($x['title'], ENT_COMPAT,'UTF-8') : ''),
+ '$summary' => ((!empty($x['summary'])) ? htmlspecialchars($x['summary'], ENT_COMPAT,'UTF-8') : ''),
+ '$placeholdertitle' => ((!empty($x['placeholdertitle'])) ? $x['placeholdertitle'] : t('Title (optional)')),
+ '$placeholdersummary' => ((!empty($x['placeholdersummary'])) ? $x['placeholdersummary'] : t('Summary (optional)')),
'$catsenabled' => $catsenabled,
- '$category' => ((x($x, 'category')) ? $x['category'] : ''),
+ '$category' => ((!empty($x['category'])) ? $x['category'] : ''),
'$placeholdercategory' => t('Categories (optional, comma-separated list)'),
'$permset' => t('Permission settings'),
- '$ptyp' => ((x($x, 'ptyp')) ? $x['ptyp'] : ''),
- '$content' => ((x($x,'body')) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8') : ''),
- '$attachment' => ((x($x, 'attachment')) ? $x['attachment'] : ''),
- '$post_id' => ((x($x, 'post_id')) ? $x['post_id'] : ''),
+ '$ptyp' => ((!empty($x['ptyp'])) ? $x['ptyp'] : ''),
+ '$content' => ((!empty($x['body'])) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8') : ''),
+ '$attachment' => ((!empty($x['attachment'])) ? $x['attachment'] : ''),
+ '$post_id' => ((!empty($x['post_id'])) ? $x['post_id'] : ''),
'$defloc' => $x['default_location'] ?? '',
'$visitor' => $x['visitor'] ?? '',
'$lockstate' => $x['lockstate'] ?? '',
@@ -1302,7 +1307,7 @@ function hz_status_editor($x, $popup = false) {
'$bang' => $x['bang'] ?? '',
'$profile_uid' => $x['profile_uid'],
'$preview' => $preview,
- '$source' => ((x($x, 'source')) ? $x['source'] : ''),
+ '$source' => ((!empty($x['source'])) ? $x['source'] : ''),
'$jotplugins' => $jotplugins,
'$jotnets' => $jotnets,
'$jotnets_label' => t('Other networks and post services'),
@@ -1317,8 +1322,8 @@ function hz_status_editor($x, $popup = false) {
'$cipher' => $cipher,
'$expiryModalOK' => t('OK'),
'$expiryModalCANCEL' => t('Cancel'),
- '$expanded' => ((x($x, 'expanded')) ? $x['expanded'] : false),
- '$bbcode' => ((x($x, 'bbcode')) ? $x['bbcode'] : false),
+ '$expanded' => ((!empty($x['expanded'])) ? $x['expanded'] : false),
+ '$bbcode' => ((!empty($x['bbcode'])) ? $x['bbcode'] : false),
'$parent' => ((array_key_exists('parent',$x) && $x['parent']) ? $x['parent'] : 0),
'$reset' => $reset,
'$is_owner' => ((local_channel() && (local_channel() == $x['profile_uid'])) ? true : false),
diff --git a/include/items.php b/include/items.php
index 92b9db556..0016e3ec0 100644
--- a/include/items.php
+++ b/include/items.php
@@ -474,8 +474,8 @@ function post_activity_item($arr, $allow_code = false, $deliver = true, $channel
$observer = App::get_observer();
}
- $arr['aid'] = ((x($arr,'aid')) ? $arr['aid'] : $channel['channel_account_id']);
- $arr['uid'] = ((x($arr,'uid')) ? $arr['uid'] : $channel['channel_id']);
+ $arr['aid'] = ((!empty($arr['aid'])) ? $arr['aid'] : $channel['channel_account_id']);
+ $arr['uid'] = ((!empty($arr['uid'])) ? $arr['uid'] : $channel['channel_id']);
if(! perm_is_allowed($arr['uid'],$observer['xchan_hash'],(($is_comment) ? 'post_comments' : 'post_wall'))) {
$ret['message'] = t('Permission denied');
@@ -492,17 +492,17 @@ function post_activity_item($arr, $allow_code = false, $deliver = true, $channel
if(empty($arr['mid'])) {
- $arr['uuid'] = ((x($arr,'uuid')) ? $arr['uuid'] : new_uuid());
+ $arr['uuid'] = ((!empty($arr['uuid'])) ? $arr['uuid'] : new_uuid());
}
- $arr['mid'] = ((x($arr,'mid')) ? $arr['mid'] : z_root() . '/item/' . $arr['uuid']);
- $arr['parent_mid'] = ((x($arr,'parent_mid')) ? $arr['parent_mid'] : $arr['mid']);
- $arr['thr_parent'] = ((x($arr,'thr_parent')) ? $arr['thr_parent'] : $arr['mid']);
+ $arr['mid'] = ((!empty($arr['mid'])) ? $arr['mid'] : z_root() . '/item/' . $arr['uuid']);
+ $arr['parent_mid'] = ((!empty($arr['parent_mid'])) ? $arr['parent_mid'] : $arr['mid']);
+ $arr['thr_parent'] = ((!empty($arr['thr_parent'])) ? $arr['thr_parent'] : $arr['mid']);
- $arr['owner_xchan'] = ((x($arr,'owner_xchan')) ? $arr['owner_xchan'] : $channel['channel_hash']);
- $arr['author_xchan'] = ((x($arr,'author_xchan')) ? $arr['author_xchan'] : $observer['xchan_hash']);
+ $arr['owner_xchan'] = ((!empty($arr['owner_xchan'])) ? $arr['owner_xchan'] : $channel['channel_hash']);
+ $arr['author_xchan'] = ((!empty($arr['author_xchan'])) ? $arr['author_xchan'] : $observer['xchan_hash']);
- $arr['verb'] = ((x($arr,'verb')) ? $arr['verb'] : 'Create');
- $arr['obj_type'] = ((x($arr,'obj_type')) ? $arr['obj_type'] : 'Note');
+ $arr['verb'] = ((!empty($arr['verb'])) ? $arr['verb'] : 'Create');
+ $arr['obj_type'] = ((!empty($arr['obj_type'])) ? $arr['obj_type'] : 'Note');
if(! ( array_key_exists('allow_cid',$arr) || array_key_exists('allow_gid',$arr)
|| array_key_exists('deny_cid',$arr) || array_key_exists('deny_gid',$arr))) {
@@ -537,7 +537,7 @@ function post_activity_item($arr, $allow_code = false, $deliver = true, $channel
*/
call_hooks('post_local', $arr);
- if(x($arr, 'cancel')) {
+ if (!empty($arr['cancel'])) {
logger('Post cancelled by plugin.');
return $ret;
}
@@ -727,14 +727,14 @@ function get_item_elements($x,$allow_code = false) {
if($arr['edited'] > datetime_convert())
$arr['edited'] = datetime_convert();
- $arr['expires'] = ((x($x,'expires') && $x['expires'])
+ $arr['expires'] = ((!empty($x['expires']) && $x['expires'])
? datetime_convert('UTC','UTC',$x['expires'])
: NULL_DATE);
- $arr['commented'] = ((x($x,'commented') && $x['commented'])
+ $arr['commented'] = ((!empty($x['commented']) && $x['commented'])
? datetime_convert('UTC','UTC',$x['commented'])
: $arr['created']);
- $arr['comments_closed'] = ((x($x,'comments_closed') && $x['comments_closed'])
+ $arr['comments_closed'] = ((!empty($x['comments_closed']) && $x['comments_closed'])
? datetime_convert('UTC','UTC',$x['comments_closed'])
: NULL_DATE);
@@ -1679,7 +1679,7 @@ function item_store($arr, $allow_exec = false, $deliver = true, $addAndSync = tr
if(array_key_exists('parent',$arr))
unset($arr['parent']);
- $arr['mimetype'] = ((x($arr,'mimetype')) ? notags(trim($arr['mimetype'])) : 'text/bbcode');
+ $arr['mimetype'] = ((!empty($arr['mimetype'])) ? notags(trim($arr['mimetype'])) : 'text/bbcode');
if(($arr['mimetype'] == 'application/x-php') && (! $allow_exec)) {
logger('item_store: php mimetype but allow_exec is denied.');
@@ -1691,19 +1691,19 @@ function item_store($arr, $allow_exec = false, $deliver = true, $addAndSync = tr
$arr['summary'] = ((array_key_exists('summary',$arr) && $arr['summary']) ? trim($arr['summary']) : '');
$arr['body'] = ((array_key_exists('body',$arr) && $arr['body']) ? trim($arr['body']) : '');
- $arr['allow_cid'] = ((x($arr,'allow_cid')) ? trim($arr['allow_cid']) : '');
- $arr['allow_gid'] = ((x($arr,'allow_gid')) ? trim($arr['allow_gid']) : '');
- $arr['deny_cid'] = ((x($arr,'deny_cid')) ? trim($arr['deny_cid']) : '');
- $arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : '');
- $arr['postopts'] = ((x($arr,'postopts')) ? trim($arr['postopts']) : '');
- $arr['route'] = ((x($arr,'route')) ? trim($arr['route']) : '');
- $arr['uuid'] = ((x($arr,'uuid')) ? trim($arr['uuid']) : '');
- $arr['item_private'] = ((x($arr,'item_private')) ? intval($arr['item_private']) : 0 );
- $arr['item_wall'] = ((x($arr,'item_wall')) ? intval($arr['item_wall']) : 0 );
- $arr['item_type'] = ((x($arr,'item_type')) ? intval($arr['item_type']) : 0 );
+ $arr['allow_cid'] = ((!empty($arr['allow_cid'])) ? trim($arr['allow_cid']) : '');
+ $arr['allow_gid'] = ((!empty($arr['allow_gid'])) ? trim($arr['allow_gid']) : '');
+ $arr['deny_cid'] = ((!empty($arr['deny_cid'])) ? trim($arr['deny_cid']) : '');
+ $arr['deny_gid'] = ((!empty($arr['deny_gid'])) ? trim($arr['deny_gid']) : '');
+ $arr['postopts'] = ((!empty($arr['postopts'])) ? trim($arr['postopts']) : '');
+ $arr['route'] = ((!empty($arr['route'])) ? trim($arr['route']) : '');
+ $arr['uuid'] = ((!empty($arr['uuid'])) ? trim($arr['uuid']) : '');
+ $arr['item_private'] = ((!empty($arr['item_private'])) ? intval($arr['item_private']) : 0 );
+ $arr['item_wall'] = ((!empty($arr['item_wall'])) ? intval($arr['item_wall']) : 0 );
+ $arr['item_type'] = ((!empty($arr['item_type'])) ? intval($arr['item_type']) : 0 );
// obsolete, but needed so as not to throw not-null constraints on some database driveres
- $arr['item_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : 0 );
+ $arr['item_flags'] = ((!empty($arr['item_flags'])) ? intval($arr['item_flags']) : 0 );
$arr['lang'] = detect_language($arr['body']);
@@ -1744,32 +1744,32 @@ function item_store($arr, $allow_exec = false, $deliver = true, $addAndSync = tr
$arr = $translate['item'];
}
- if((x($arr,'obj')) && is_array($arr['obj'])) {
+ if((!empty($arr['obj'])) && is_array($arr['obj'])) {
activity_sanitise($arr['obj']);
$arr['obj'] = json_encode($arr['obj']);
}
- if((x($arr,'target')) && is_array($arr['target'])) {
+ if((!empty($arr['target'])) && is_array($arr['target'])) {
activity_sanitise($arr['target']);
$arr['target'] = json_encode($arr['target']);
}
- if((x($arr,'attach')) && is_array($arr['attach'])) {
+ if((!empty($arr['attach'])) && is_array($arr['attach'])) {
activity_sanitise($arr['attach']);
$arr['attach'] = json_encode($arr['attach']);
}
- $arr['aid'] = ((x($arr,'aid')) ? intval($arr['aid']) : 0);
- $arr['mid'] = ((x($arr,'mid')) ? notags(trim($arr['mid'])) : random_string());
- $arr['revision'] = ((x($arr,'revision') && intval($arr['revision']) > 0) ? intval($arr['revision']) : 0);
+ $arr['aid'] = ((!empty($arr['aid'])) ? intval($arr['aid']) : 0);
+ $arr['mid'] = ((!empty($arr['mid'])) ? notags(trim($arr['mid'])) : random_string());
+ $arr['revision'] = ((!empty($arr['revision']) && intval($arr['revision']) > 0) ? intval($arr['revision']) : 0);
- $arr['author_xchan'] = ((x($arr,'author_xchan')) ? notags(trim($arr['author_xchan'])) : '');
- $arr['owner_xchan'] = ((x($arr,'owner_xchan')) ? notags(trim($arr['owner_xchan'])) : '');
- $arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
- $arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
- $arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : NULL_DATE);
- $arr['commented'] = ((x($arr,'commented') !== false) ? datetime_convert('UTC','UTC',$arr['commented']) : datetime_convert());
- $arr['comments_closed'] = ((x($arr,'comments_closed') !== false) ? datetime_convert('UTC','UTC',$arr['comments_closed']) : NULL_DATE);
+ $arr['author_xchan'] = ((!empty($arr['author_xchan'])) ? notags(trim($arr['author_xchan'])) : '');
+ $arr['owner_xchan'] = ((!empty($arr['owner_xchan'])) ? notags(trim($arr['owner_xchan'])) : '');
+ $arr['created'] = ((!empty($arr['created']) !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
+ $arr['edited'] = ((!empty($arr['edited']) !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
+ $arr['expires'] = ((!empty($arr['expires']) !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : NULL_DATE);
+ $arr['commented'] = ((!empty($arr['commented']) !== false) ? datetime_convert('UTC','UTC',$arr['commented']) : datetime_convert());
+ $arr['comments_closed'] = ((!empty($arr['comments_closed']) !== false) ? datetime_convert('UTC','UTC',$arr['comments_closed']) : NULL_DATE);
$arr['html'] = ((array_key_exists('html',$arr)) ? $arr['html'] : '');
if($deliver) {
@@ -1783,26 +1783,26 @@ function item_store($arr, $allow_exec = false, $deliver = true, $addAndSync = tr
// will still take place through backdoor methods. Since these fields are rarely used
// otherwise, just preserve the original timestamp.
- $arr['received'] = ((x($arr,'received') !== false) ? datetime_convert('UTC','UTC',$arr['received']) : datetime_convert());
- $arr['changed'] = ((x($arr,'changed') !== false) ? datetime_convert('UTC','UTC',$arr['changed']) : datetime_convert());
+ $arr['received'] = ((!empty($arr['received']) !== false) ? datetime_convert('UTC','UTC',$arr['received']) : datetime_convert());
+ $arr['changed'] = ((!empty($arr['changed']) !== false) ? datetime_convert('UTC','UTC',$arr['changed']) : datetime_convert());
}
- $arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : '');
- $arr['coord'] = ((x($arr,'coord')) ? notags(trim($arr['coord'])) : '');
- $arr['parent_mid'] = ((x($arr,'parent_mid')) ? notags(trim($arr['parent_mid'])) : '');
- $arr['thr_parent'] = ((x($arr,'thr_parent')) ? notags(trim($arr['thr_parent'])) : $arr['parent_mid']);
- $arr['verb'] = ((x($arr,'verb')) ? notags(trim($arr['verb'])) : 'Create');
- $arr['obj_type'] = ((x($arr,'obj_type')) ? notags(trim($arr['obj_type'])) : 'Note');
- $arr['obj'] = ((x($arr,'obj')) ? trim($arr['obj']) : '');
- $arr['tgt_type'] = ((x($arr,'tgt_type')) ? notags(trim($arr['tgt_type'])) : '');
- $arr['target'] = ((x($arr,'target')) ? trim($arr['target']) : '');
- $arr['plink'] = ((x($arr,'plink')) ? notags(trim($arr['plink'])) : '');
- $arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : '');
- $arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : '');
+ $arr['location'] = ((!empty($arr['location'])) ? notags(trim($arr['location'])) : '');
+ $arr['coord'] = ((!empty($arr['coord'])) ? notags(trim($arr['coord'])) : '');
+ $arr['parent_mid'] = ((!empty($arr['parent_mid'])) ? notags(trim($arr['parent_mid'])) : '');
+ $arr['thr_parent'] = ((!empty($arr['thr_parent'])) ? notags(trim($arr['thr_parent'])) : $arr['parent_mid']);
+ $arr['verb'] = ((!empty($arr['verb'])) ? notags(trim($arr['verb'])) : 'Create');
+ $arr['obj_type'] = ((!empty($arr['obj_type'])) ? notags(trim($arr['obj_type'])) : 'Note');
+ $arr['obj'] = ((!empty($arr['obj'])) ? trim($arr['obj']) : '');
+ $arr['tgt_type'] = ((!empty($arr['tgt_type'])) ? notags(trim($arr['tgt_type'])) : '');
+ $arr['target'] = ((!empty($arr['target'])) ? trim($arr['target']) : '');
+ $arr['plink'] = ((!empty($arr['plink'])) ? notags(trim($arr['plink'])) : '');
+ $arr['attach'] = ((!empty($arr['attach'])) ? notags(trim($arr['attach'])) : '');
+ $arr['app'] = ((!empty($arr['app'])) ? notags(trim($arr['app'])) : '');
- $arr['public_policy'] = ((x($arr,'public_policy')) ? notags(trim($arr['public_policy'])) : '' );
+ $arr['public_policy'] = ((!empty($arr['public_policy'])) ? notags(trim($arr['public_policy'])) : '' );
- $arr['comment_policy'] = ((x($arr,'comment_policy')) ? notags(trim($arr['comment_policy'])) : 'contacts' );
+ $arr['comment_policy'] = ((!empty($arr['comment_policy'])) ? notags(trim($arr['comment_policy'])) : 'contacts' );
if(! array_key_exists('item_unseen',$arr))
$arr['item_unseen'] = 1;
@@ -1946,7 +1946,7 @@ function item_store($arr, $allow_exec = false, $deliver = true, $addAndSync = tr
*/
call_hooks('post_remote', $arr);
- if(x($arr, 'cancel')) {
+ if(!empty($arr['cancel'])) {
logger('Post cancelled by plugin.');
$ret['message'] = 'cancelled.';
return $ret;
@@ -2163,7 +2163,7 @@ function item_store_update($arr, $allow_exec = false, $deliver = true, $addAndSy
if(array_key_exists('edit',$arr))
unset($arr['edit']);
- $arr['mimetype'] = ((x($arr,'mimetype')) ? notags(trim($arr['mimetype'])) : 'text/bbcode');
+ $arr['mimetype'] = ((!empty($arr['mimetype'])) ? notags(trim($arr['mimetype'])) : 'text/bbcode');
if(($arr['mimetype'] == 'application/x-php') && (! $allow_exec)) {
logger('item_store: php mimetype but allow_exec is denied.');
@@ -2234,10 +2234,10 @@ function item_store_update($arr, $allow_exec = false, $deliver = true, $addAndSy
unset($arr['thr_parent']);
unset($arr['llink']);
- $arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
- $arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : $orig[0]['expires']);
+ $arr['edited'] = ((!empty($arr['edited'])) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
+ $arr['expires'] = ((!empty($arr['expires'])) ? datetime_convert('UTC','UTC',$arr['expires']) : $orig[0]['expires']);
- $arr['revision'] = ((x($arr,'revision') && $arr['revision'] > 0) ? intval($arr['revision']) : 0);
+ $arr['revision'] = ((!empty($arr['revision'])) ? intval($arr['revision']) : 0);
if(array_key_exists('comments_closed',$arr))
$arr['comments_closed'] = datetime_convert('UTC','UTC',$arr['comments_closed']);
@@ -2251,15 +2251,15 @@ function item_store_update($arr, $allow_exec = false, $deliver = true, $addAndSy
$arr['route'] = ((array_key_exists('route',$arr)) ? trim($arr['route']) : $orig[0]['route']);
- $arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : $orig[0]['location']);
- $arr['uuid'] = ((x($arr,'uuid')) ? notags(trim($arr['uuid'])) : $orig[0]['uuid']);
- $arr['coord'] = ((x($arr,'coord')) ? notags(trim($arr['coord'])) : $orig[0]['coord']);
- $arr['verb'] = ((x($arr,'verb')) ? notags(trim($arr['verb'])) : $orig[0]['verb']);
- $arr['obj_type'] = ((x($arr,'obj_type')) ? notags(trim($arr['obj_type'])) : $orig[0]['obj_type']);
- $arr['obj'] = ((x($arr,'obj')) ? trim($arr['obj']) : $orig[0]['obj']);
- $arr['tgt_type'] = ((x($arr,'tgt_type')) ? notags(trim($arr['tgt_type'])) : $orig[0]['tgt_type']);
- $arr['target'] = ((x($arr,'target')) ? trim($arr['target']) : $orig[0]['target']);
- $arr['plink'] = ((x($arr,'plink')) ? notags(trim($arr['plink'])) : $orig[0]['plink']);
+ $arr['location'] = ((!empty($arr['location'])) ? notags(trim($arr['location'])) : $orig[0]['location']);
+ $arr['uuid'] = ((!empty($arr['uuid'])) ? notags(trim($arr['uuid'])) : $orig[0]['uuid']);
+ $arr['coord'] = ((!empty($arr['coord'])) ? notags(trim($arr['coord'])) : $orig[0]['coord']);
+ $arr['verb'] = ((!empty($arr['verb'])) ? notags(trim($arr['verb'])) : $orig[0]['verb']);
+ $arr['obj_type'] = ((!empty($arr['obj_type'])) ? notags(trim($arr['obj_type'])) : $orig[0]['obj_type']);
+ $arr['obj'] = ((!empty($arr['obj'])) ? trim($arr['obj']) : $orig[0]['obj']);
+ $arr['tgt_type'] = ((!empty($arr['tgt_type'])) ? notags(trim($arr['tgt_type'])) : $orig[0]['tgt_type']);
+ $arr['target'] = ((!empty($arr['target'])) ? trim($arr['target']) : $orig[0]['target']);
+ $arr['plink'] = ((!empty($arr['plink'])) ? notags(trim($arr['plink'])) : $orig[0]['plink']);
$arr['allow_cid'] = ((array_key_exists('allow_cid',$arr)) ? trim($arr['allow_cid']) : $orig[0]['allow_cid']);
$arr['allow_gid'] = ((array_key_exists('allow_gid',$arr)) ? trim($arr['allow_gid']) : $orig[0]['allow_gid']);
@@ -2298,11 +2298,11 @@ function item_store_update($arr, $allow_exec = false, $deliver = true, $addAndSy
$arr['item_pending_remove'] = ((array_key_exists('item_pending_remove',$arr)) ? intval($arr['item_pending_remove']) : $orig[0]['item_pending_remove'] );
$arr['item_blocked'] = ((array_key_exists('item_blocked',$arr)) ? intval($arr['item_blocked']) : $orig[0]['item_blocked'] );
- $arr['sig'] = ((x($arr,'sig')) ? $arr['sig'] : '');
+ $arr['sig'] = ((!empty($arr['sig'])) ? $arr['sig'] : '');
$arr['layout_mid'] = ((array_key_exists('layout_mid',$arr)) ? dbesc($arr['layout_mid']) : $orig[0]['layout_mid'] );
- $arr['public_policy'] = ((x($arr,'public_policy')) ? notags(trim($arr['public_policy'])) : $orig[0]['public_policy'] );
- $arr['comment_policy'] = ((x($arr,'comment_policy')) ? notags(trim($arr['comment_policy'])) : $orig[0]['comment_policy'] );
+ $arr['public_policy'] = ((!empty($arr['public_policy'])) ? notags(trim($arr['public_policy'])) : $orig[0]['public_policy'] );
+ $arr['comment_policy'] = ((!empty($arr['comment_policy'])) ? notags(trim($arr['comment_policy'])) : $orig[0]['comment_policy'] );
/**
* @hooks post_remote_update
@@ -2310,7 +2310,7 @@ function item_store_update($arr, $allow_exec = false, $deliver = true, $addAndSy
*/
call_hooks('post_remote_update', $arr);
- if(x($arr, 'cancel')) {
+ if(!empty($arr['cancel'])) {
logger('Post cancelled by plugin.');
$ret['message'] = 'cancelled.';
return $ret;
diff --git a/include/language.php b/include/language.php
index 44b3419d5..9b68717f8 100644
--- a/include/language.php
+++ b/include/language.php
@@ -29,7 +29,7 @@ function get_browser_language() {
$langs = [];
$lang_parse = [];
- if (x($_SERVER, 'HTTP_ACCEPT_LANGUAGE')) {
+ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
// break up string into pieces (languages and q factors)
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
$_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
@@ -204,7 +204,7 @@ function load_translation_table($lang, $install = false) {
function t($s, $ctx = ''): string {
$cs = $ctx ? '__ctx:' . $ctx . '__ ' . $s : $s;
- if (x(App::$strings, $cs)) {
+ if (!empty(App::$strings[$cs])) {
$t = App::$strings[$cs];
return ((is_array($t)) ? translate_projectname($t[0]) : translate_projectname($t));
@@ -219,7 +219,7 @@ function t($s, $ctx = ''): string {
*/
function translate_projectname($s) {
- if(strpos($s,'rojectname') !== false) {
+ if(str_contains($s,'rojectname')) {
return str_replace(array('$projectname','$Projectname'),array(Zotlabs\Lib\System::get_platform_name(),ucfirst(Zotlabs\Lib\System::get_platform_name())),$s);
}
return $s;
@@ -239,7 +239,7 @@ function translate_projectname($s) {
function tt($singular, $plural, $count, $ctx = ''){
$cs = $ctx ? "__ctx:" . $ctx . "__ " . $singular : $singular;
- if (x(App::$strings,$cs)) {
+ if (!empty(App::$strings[$cs])) {
$t = App::$strings[$cs];
$f = 'string_plural_select_' . str_replace('-', '_', App::$language);
if (! function_exists($f))
@@ -282,9 +282,8 @@ function ta($k){
*/
function tf() {
-
- $s = "plural_function_code";
- return (x(App::$strings, $s) ? App::$strings[$s] : "0");
+ $s = "plural_function_code";
+ return (!empty(App::$strings[$s]) ? App::$strings[$s] : "0");
}
/**
diff --git a/include/nav.php b/include/nav.php
index 1bee5a2db..3426db5f2 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -366,7 +366,7 @@ function nav($template = 'default') {
'$form_security_token' => get_form_security_token('pconfig')
]);
- if (x($_SESSION, 'reload_avatar') && $observer) {
+ if (!empty($_SESSION['reload_avatar']) && $observer) {
// The avatar has been changed on the server but the browser doesn't know that,
// force the browser to reload the image from the server instead of its cache.
$tpl = get_markup_template('force_image_reload.tpl');
diff --git a/include/network.php b/include/network.php
index 55eecac84..cb5027922 100644
--- a/include/network.php
+++ b/include/network.php
@@ -73,21 +73,21 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
if($ciphers)
@curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers);
- if(x($opts,'filep')) {
+ if(!empty($opts['filep'])) {
@curl_setopt($ch, CURLOPT_FILE, $opts['filep']);
@curl_setopt($ch, CURLOPT_HEADER, false);
}
- if(x($opts,'upload'))
+ if(!empty($opts['upload']))
@curl_setopt($ch, CURLOPT_UPLOAD, $opts['upload']);
- if(x($opts,'infile'))
+ if(!empty($opts['infile']))
@curl_setopt($ch, CURLOPT_INFILE, $opts['infile']);
- if(x($opts,'infilesize'))
+ if(!empty($opts['infilesize']))
@curl_setopt($ch, CURLOPT_INFILESIZE, $opts['infilesize']);
- if(x($opts,'readfunc'))
+ if(!empty($opts['readfunc']))
@curl_setopt($ch, CURLOPT_READFUNCTION, $opts['readfunc']);
// When using the session option and fetching from our own site,
@@ -97,7 +97,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
$instance_headers = ((array_key_exists('headers',$opts) && is_array($opts['headers'])) ? $opts['headers'] : []);
- if(x($opts,'session')) {
+ if(!empty($opts['session'])) {
if(strpos($url,z_root()) === 0) {
$instance_headers[] = 'Cookie: PHPSESSID=' . session_id();
}
@@ -106,13 +106,13 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_HTTPHEADER, $instance_headers);
- if(x($opts,'nobody'))
+ if(!empty($opts['nobody']))
@curl_setopt($ch, CURLOPT_NOBODY, $opts['nobody']);
- if(x($opts,'custom'))
+ if(!empty($opts['custom']))
@curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $opts['custom']);
- if(x($opts,'timeout') && intval($opts['timeout'])) {
+ if(!empty($opts['timeout'])) {
@curl_setopt($ch, CURLOPT_TIMEOUT, intval($opts['timeout']));
}
else {
@@ -120,7 +120,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== 0) ? $curl_time : 60));
}
- if(x($opts,'connecttimeout') && intval($opts['connecttimeout'])) {
+ if(!empty($opts['connecttimeout'])) {
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, intval($opts['connecttimeout']));
}
else {
@@ -128,7 +128,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (($curl_contime !== 0) ? $curl_contime : 30));
}
- if(x($opts,'http_auth')) {
+ if(!empty($opts['http_auth'])) {
// "username" . ':' . "password"
@curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']);
}
@@ -136,16 +136,16 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
if(array_key_exists('http_version',$opts))
@curl_setopt($ch,CURLOPT_HTTP_VERSION,$opts['http_version']);
- if(x($opts,'cookiejar'))
+ if(!empty($opts['cookiejar']))
@curl_setopt($ch, CURLOPT_COOKIEJAR, $opts['cookiejar']);
- if(x($opts,'cookiefile'))
+ if(!empty($opts['cookiefile']))
@curl_setopt($ch, CURLOPT_COOKIEFILE, $opts['cookiefile']);
- if(x($opts,'cookie'))
+ if(!empty($opts['cookie']))
@curl_setopt($ch, CURLOPT_COOKIE, $opts['cookie']);
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
- ((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true));
+ ((!empty($opts['novalidate'])) ? false : true));
$prx = @Config::Get('system','proxy');
if(strlen($prx)) {
@@ -205,7 +205,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
$ret['header'] = $header;
$ret['request_target'] = $opts['request_target'];
- if(x($opts,'debug')) {
+ if(!empty($opts['debug'])) {
$ret['debug'] = $curl_info;
}
diff --git a/include/security.php b/include/security.php
index 4b072cf92..2e0497498 100644
--- a/include/security.php
+++ b/include/security.php
@@ -22,7 +22,7 @@ function authenticate_success($user_record, $channel = null, $login_initial = fa
$lastlog_updated = false;
$uid_to_load = null;
- if (x($user_record, 'account_id')) {
+ if (!empty($user_record['account_id'])) {
App::$account = $user_record;
$_SESSION['account_id'] = $user_record['account_id'];
$_SESSION['authenticated'] = 1;
@@ -31,7 +31,7 @@ function authenticate_success($user_record, $channel = null, $login_initial = fa
$uid_to_load = $channel['channel_id'];
if (!$uid_to_load) {
- $uid_to_load = (((x($_SESSION, 'uid')) && (intval($_SESSION['uid'])))
+ $uid_to_load = ((!empty($_SESSION['uid']))
? intval($_SESSION['uid'])
: intval(App::$account['account_default_channel'])
);
@@ -60,12 +60,12 @@ function authenticate_success($user_record, $channel = null, $login_initial = fa
// might want to log success here
}
- if ($return || x($_SESSION, 'workflow')) {
+ if ($return || isset($_SESSION['workflow'])) {
unset($_SESSION['workflow']);
return;
}
- if ((App::$module !== 'home') && x($_SESSION, 'login_return_url') && strlen($_SESSION['login_return_url'])) {
+ if (App::$module !== 'home' && !empty($_SESSION['login_return_url'])) {
$return_url = $_SESSION['login_return_url'];
// don't let members get redirected to a raw ajax page update - this can happen
@@ -614,7 +614,7 @@ function get_form_security_token($typename = '') {
}
function check_form_security_token($typename = '', $formname = 'form_security_token') {
- if (!x($_REQUEST, $formname)) return false;
+ if (empty($_REQUEST[$formname])) return false;
$hash = $_REQUEST[$formname];
$max_livetime = 10800; // 3 hours
diff --git a/view/php/default.php b/view/php/default.php
index 8d2c092a3..324981dff 100644
--- a/view/php/default.php
+++ b/view/php/default.php
@@ -11,28 +11,28 @@
*/
?>
<!DOCTYPE html >
-<html prefix="og: http://ogp.me/ns#" <?php if(x($page,'color_mode')) echo $page['color_mode'] ?>>
+<html prefix="og: http://ogp.me/ns#" <?php if(!empty($page['color_mode'])) echo $page['color_mode'] ?>>
<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 z_root() ?>";</script>
- <?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>
+ <?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?>
</head>
<body <?php if($page['direction']) echo 'dir="rtl"' ?> >
- <?php if(x($page,'banner')) echo $page['banner']; ?>
- <header><?php if(x($page,'header')) echo $page['header']; ?></header>
- <?php if(x($page,'nav')) echo $page['nav']; ?>
+ <?php if(!empty($page['banner'])) echo $page['banner']; ?>
+ <header><?php if(!empty($page['header'])) echo $page['header']; ?></header>
+ <?php if(!empty($page['nav'])) echo $page['nav']; ?>
<main>
<div class="content">
<div class="columns">
- <aside id="region_1" class="d-none d-lg-block"><div class="aside_spacer_top_left"></div><div class="aside_spacer_left"><div id="left_aside_wrapper" class="aside_wrapper"><?php if(x($page,'aside')) echo $page['aside']; ?></div></div></aside>
- <section id="region_2"><?php if(x($page,'content')) echo $page['content']; ?>
+ <aside id="region_1" class="d-none d-lg-block"><div class="aside_spacer_top_left"></div><div class="aside_spacer_left"><div id="left_aside_wrapper" class="aside_wrapper"><?php if(!empty($page['aside'])) echo $page['aside']; ?></div></div></aside>
+ <section id="region_2"><?php if(!empty($page['content'])) echo $page['content']; ?>
<div id="page-footer"></div>
<div id="pause"></div>
</section>
- <aside id="region_3" class="d-none d-xl-block"><div class="aside_spacer_top_right"></div><div class="aside_spacer_right"><div id="right_aside_wrapper" class="aside_wrapper"><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></div></div></aside>
+ <aside id="region_3" class="d-none d-xl-block"><div class="aside_spacer_top_right"></div><div class="aside_spacer_right"><div id="right_aside_wrapper" class="aside_wrapper"><?php if(!empty($page['right_aside'])) echo $page['right_aside']; ?></div></div></aside>
</div>
</div>
</main>
- <footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
+ <footer><?php if(!empty($page['footer'])) echo $page['footer']; ?></footer>
</body>
</html>