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

- Remove extraneous parentheses around !empty()
This commit is contained in:
Hypolite Petovan 2018-11-30 09:11:56 -05:00
parent 074493a29e
commit d836593a3b
42 changed files with 80 additions and 80 deletions

View file

@ -165,7 +165,7 @@ function blogger_post_local(App $a, array &$b)
$bl_post = intval(PConfig::get(local_user(), 'blogger', 'post'));
$bl_enable = (($bl_post && x($_REQUEST, 'blogger_enable')) ? intval($_REQUEST['blogger_enable']) : 0);
$bl_enable = (($bl_post && !empty($_REQUEST['blogger_enable'])) ? intval($_REQUEST['blogger_enable']) : 0);
if ($b['api_source'] && intval(PConfig::get(local_user(), 'blogger', 'post_by_default'))) {
$bl_enable = 1;

View file

@ -86,8 +86,8 @@ function buffer_addon_admin(App $a, &$o)
function buffer_addon_admin_post(App $a)
{
$client_id = ((!empty($_POST['client_id'])) ? Strings::escapeTags(trim($_POST['client_id'])) : '');
$client_secret = ((!empty($_POST['client_secret'])) ? Strings::escapeTags(trim($_POST['client_secret'])) : '');
$client_id = (!empty($_POST['client_id']) ? Strings::escapeTags(trim($_POST['client_id'])) : '');
$client_secret = (!empty($_POST['client_secret']) ? Strings::escapeTags(trim($_POST['client_secret'])) : '');
Config::set('buffer', 'client_id' , $client_id);
Config::set('buffer', 'client_secret', $client_secret);

View file

@ -118,7 +118,7 @@ function curweather_network_mod_init(App $a, &$b)
$rpt = PConfig::get(local_user(), 'curweather', 'curweather_loc');
// Set the language to the browsers language or default and use metric units
$lang = (!empty($_SESSION['language']) ? $_SESSION['language'] : Config::get('system', 'language'));
$lang = defaults($_SESSION, 'language', Config::get('system', 'language'));
$units = PConfig::get( local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather', 'appid');
$cachetime = intval(Config::get('curweather', 'cachetime'));

View file

@ -136,7 +136,7 @@ class Diaspora_Connection {
} elseif (!empty($m[1])) {
$token = $m[1];
}
return (!empty($token)) ? $token : false;
return !empty($token) ? $token : false;
}
private function readJsonResponse($response) {
@ -165,14 +165,14 @@ class Diaspora_Connection {
$this->doHttpRequest('/bookmarklet');
$m = [];
preg_match('/"aspects"\:(\[.+?\])/', $this->last_http_result->response, $m);
return (!empty($m[1])) ? json_decode($m[1]) : false;
return !empty($m[1]) ? json_decode($m[1]) : false;
}
public function getServices() {
$this->doHttpRequest('/bookmarklet');
$m = [];
preg_match('/"configured_services"\:(\[.+?\])/', $this->last_http_result->response, $m);
return (!empty($m[1])) ? json_decode($m[1]) : false;
return !empty($m[1]) ? json_decode($m[1]) : false;
}
public function getNotifications($notification_type = '', $show = '') {

View file

@ -286,7 +286,7 @@ function diaspora_post_local(App $a, array &$b)
$diaspora_post = intval(PConfig::get(local_user(),'diaspora','post'));
$diaspora_enable = (($diaspora_post && x($_REQUEST,'diaspora_enable')) ? intval($_REQUEST['diaspora_enable']) : 0);
$diaspora_enable = (($diaspora_post && !empty($_REQUEST['diaspora_enable'])) ? intval($_REQUEST['diaspora_enable']) : 0);
if ($b['api_source'] && intval(PConfig::get(local_user(),'diaspora','post_by_default'))) {
$diaspora_enable = 1;

View file

@ -137,7 +137,7 @@ function dwpost_post_local(App $a, array &$b)
$dw_post = intval(PConfig::get(local_user(),'dwpost','post'));
$dw_enable = (($dw_post && x($_REQUEST,'dwpost_enable')) ? intval($_REQUEST['dwpost_enable']) : 0);
$dw_enable = (($dw_post && !empty($_REQUEST['dwpost_enable'])) ? intval($_REQUEST['dwpost_enable']) : 0);
if ($b['api_source'] && intval(PConfig::get(local_user(),'dwpost','post_by_default'))) {
$dw_enable = 1;

View file

@ -75,7 +75,7 @@ function forumdirectory_content(App $a)
if (!empty($a->data['search'])) {
$search = Strings::escapeTags(trim($a->data['search']));
} else {
$search = ((!empty($_GET['search'])) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : '');
$search = (!empty($_GET['search']) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : '');
}
$tpl = Renderer::getMarkupTemplate('directory_header.tpl');

View file

@ -30,7 +30,7 @@ function fromapp_uninstall()
function fromapp_settings_post($a, $post)
{
if (!local_user() || (! x($_POST, 'fromapp-submit'))) {
if (!local_user() || empty($_POST['fromapp-submit'])) {
return;
}

View file

@ -89,9 +89,9 @@ function fromgplus_addon_settings_post(&$a,&$b) {
if (!empty($_POST['fromgplus-submit'])) {
PConfig::set(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
$enable = (x($_POST,'fromgplus-enable') ? intval($_POST['fromgplus-enable']) : 0);
$enable = (!empty($_POST['fromgplus-enable']) ? intval($_POST['fromgplus-enable']) : 0);
PConfig::set(local_user(),'fromgplus','enable', $enable);
$keywords = (x($_POST, 'fromgplus-keywords') ? intval($_POST['fromgplus-keywords']) : 0);
$keywords = (!empty($_POST['fromgplus-keywords']) ? intval($_POST['fromgplus-keywords']) : 0);
PConfig::set(local_user(),'fromgplus', 'keywords', $keywords);
if (!$enable)
@ -113,7 +113,7 @@ function fromgplus_addon_admin(&$a, &$o)
function fromgplus_addon_admin_post(&$a)
{
$key = ((x($_POST, 'key')) ? trim($_POST['key']) : '');
$key = (!empty($_POST['key']) ? trim($_POST['key']) : '');
Config::set('fromgplus', 'key', $key);
info(L10n::t('Settings updated.'). EOL);
}

View file

@ -100,10 +100,10 @@ function geocoordinates_addon_admin(&$a, &$o)
function geocoordinates_addon_admin_post(&$a)
{
$api_key = ((x($_POST, 'api_key')) ? Strings::escapeTags(trim($_POST['api_key'])) : '');
$api_key = (!empty($_POST['api_key']) ? Strings::escapeTags(trim($_POST['api_key'])) : '');
Config::set('geocoordinates', 'api_key', $api_key);
$language = ((x($_POST, 'language')) ? Strings::escapeTags(trim($_POST['language'])) : '');
$language = (!empty($_POST['language']) ? Strings::escapeTags(trim($_POST['language'])) : '');
Config::set('geocoordinates', 'language', $language);
info(L10n::t('Settings updated.'). EOL);
}

View file

@ -150,7 +150,7 @@ function geonames_post_hook($a, &$item) {
*/
function geonames_addon_admin_post($a,$post) {
if(! local_user() || (! x($_POST,'geonames-submit')))
if(! local_user() || empty($_POST['geonames-submit']))
return;
PConfig::set(local_user(),'geonames','enable',intval($_POST['geonames']));

View file

@ -44,7 +44,7 @@ function gnot_uninstall() {
*/
function gnot_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'gnot-submit')))
if(! local_user() || empty($_POST['gnot-submit']))
return;
PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot']));

View file

@ -122,8 +122,8 @@ function gravatar_addon_admin (&$a, &$o) {
function gravatar_addon_admin_post (&$a) {
BaseModule::checkFormSecurityToken('gravatarsave');
$default_avatar = ((x($_POST, 'avatar')) ? Strings::escapeTags(trim($_POST['avatar'])) : 'identicon');
$rating = ((x($_POST, 'rating')) ? Strings::escapeTags(trim($_POST['rating'])) : 'g');
$default_avatar = (!empty($_POST['avatar']) ? Strings::escapeTags(trim($_POST['avatar'])) : 'identicon');
$rating = (!empty($_POST['rating']) ? Strings::escapeTags(trim($_POST['rating'])) : 'g');
Config::set('gravatar', 'default_avatar', $default_avatar);
Config::set('gravatar', 'rating', $rating);
info(L10n::t('Gravatar settings updated.') .EOL);

View file

@ -40,7 +40,7 @@ function group_text_uninstall() {
*/
function group_text_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'group_text-submit')))
if(! local_user() || empty($_POST['group_text-submit']))
return;
PConfig::set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));

View file

@ -90,7 +90,7 @@ function ifttt_settings(App $a, &$s)
function ifttt_settings_post()
{
if (x($_POST, 'ifttt-submit') && isset($_POST['ifttt-rekey'])) {
if (!empty($_POST['ifttt-submit']) && isset($_POST['ifttt-rekey'])) {
PConfig::delete(local_user(), 'ifttt', 'key');
}
}

View file

@ -108,7 +108,7 @@ function ijpost_settings(&$a, &$s)
function ijpost_settings_post(&$a, &$b)
{
if (x($_POST, 'ijpost-submit')) {
if (!empty($_POST['ijpost-submit'])) {
PConfig::set(local_user(), 'ijpost', 'post', intval($_POST['ijpost']));
PConfig::set(local_user(), 'ijpost', 'post_by_default', intval($_POST['ij_bydefault']));
PConfig::set(local_user(), 'ijpost', 'ij_username', trim($_POST['ij_username']));
@ -134,7 +134,7 @@ function ijpost_post_local(&$a, &$b)
$ij_post = intval(PConfig::get(local_user(), 'ijpost', 'post'));
$ij_enable = (($ij_post && x($_REQUEST, 'ijpost_enable')) ? intval($_REQUEST['ijpost_enable']) : 0);
$ij_enable = (($ij_post && !empty($_REQUEST['ijpost_enable'])) ? intval($_REQUEST['ijpost_enable']) : 0);
if ($b['api_source'] && intval(PConfig::get(local_user(), 'ijpost', 'post_by_default'))) {
$ij_enable = 1;

View file

@ -87,12 +87,12 @@ function impressum_show($a,&$b) {
}
function impressum_addon_admin_post (&$a) {
$owner = ((x($_POST, 'owner')) ? Strings::escapeTags(trim($_POST['owner'])) : '');
$ownerprofile = ((x($_POST, 'ownerprofile')) ? Strings::escapeTags(trim($_POST['ownerprofile'])) : '');
$postal = ((x($_POST, 'postal')) ? (trim($_POST['postal'])) : '');
$notes = ((x($_POST, 'notes')) ? (trim($_POST['notes'])) : '');
$email = ((x($_POST, 'email')) ? Strings::escapeTags(trim($_POST['email'])) : '');
$footer_text = ((x($_POST, 'footer_text')) ? (trim($_POST['footer_text'])) : '');
$owner = (!empty($_POST['owner']) ? Strings::escapeTags(trim($_POST['owner'])) : '');
$ownerprofile = (!empty($_POST['ownerprofile']) ? Strings::escapeTags(trim($_POST['ownerprofile'])) : '');
$postal = (!empty($_POST['postal']) ? (trim($_POST['postal'])) : '');
$notes = (!empty($_POST['notes']) ? (trim($_POST['notes'])) : '');
$email = (!empty($_POST['email']) ? Strings::escapeTags(trim($_POST['email'])) : '');
$footer_text = (!empty($_POST['footer_text']) ? (trim($_POST['footer_text'])) : '');
Config::set('impressum','owner',strip_tags($owner));
Config::set('impressum','ownerprofile',strip_tags($ownerprofile));
Config::set('impressum','postal',strip_tags($postal));

View file

@ -109,7 +109,7 @@ function irc_content(&$a) {
if($autochans)
$channels = $autochans;
else
$channels = ((x($_GET,'channels')) ? $_GET['channels'] : 'friendica');
$channels = defaults($_GET, 'channels', 'friendica');
/* add the chatroom frame and some html */
$o .= <<< EOT

View file

@ -183,7 +183,7 @@ function js_upload_post_file(&$a,&$b) {
function js_upload_post_end(&$a,&$b) {
Logger::log('upload_post_end');
if(x($a->data,'upload_jsonresponse')) {
if(!empty($a->data['upload_jsonresponse'])) {
echo $a->data['upload_jsonresponse'];
killme();
}

View file

@ -79,7 +79,7 @@ function langfilter_addon_settings_post(App $a, &$b)
if (!empty($_POST['langfilter-settings-submit'])) {
PConfig::set(local_user(), 'langfilter', 'languages', trim($_POST['langfilter_languages']));
$enable = (x($_POST, 'langfilter_enable') ? intval($_POST['langfilter_enable']) : 0);
$enable = (!empty($_POST['langfilter_enable']) ? intval($_POST['langfilter_enable']) : 0);
$disable = 1 - $enable;
PConfig::set(local_user(), 'langfilter', 'disable', $disable);
$minconfidence = 0 + $_POST['langfilter_minconfidence'];

View file

@ -111,7 +111,7 @@ function libertree_settings(&$a,&$s) {
function libertree_settings_post(&$a,&$b) {
if(x($_POST,'libertree-submit')) {
if(!empty($_POST['libertree-submit'])) {
PConfig::set(local_user(),'libertree','post',intval($_POST['libertree']));
PConfig::set(local_user(),'libertree','post_by_default',intval($_POST['libertree_bydefault']));
@ -155,7 +155,7 @@ function libertree_post_local(&$a,&$b) {
$ltree_post = intval(PConfig::get(local_user(),'libertree','post'));
$ltree_enable = (($ltree_post && x($_REQUEST,'libertree_enable')) ? intval($_REQUEST['libertree_enable']) : 0);
$ltree_enable = (($ltree_post && !empty($_REQUEST['libertree_enable'])) ? intval($_REQUEST['libertree_enable']) : 0);
if ($b['api_source'] && intval(PConfig::get(local_user(),'libertree','post_by_default'))) {
$ltree_enable = 1;

View file

@ -125,7 +125,7 @@ function libravatar_addon_admin_post(&$a)
{
BaseModule::checkFormSecurityToken('libravatarrsave');
$default_avatar = ((x($_POST, 'avatar')) ? Strings::escapeTags(trim($_POST['avatar'])) : 'identicon');
$default_avatar = (!empty($_POST['avatar']) ? Strings::escapeTags(trim($_POST['avatar'])) : 'identicon');
Config::set('libravatar', 'default_avatar', $default_avatar);
info(L10n::t('Libravatar settings updated.') .EOL);
}

View file

@ -105,7 +105,7 @@ function ljpost_settings(&$a,&$s) {
function ljpost_settings_post(&$a,&$b) {
if(x($_POST,'ljpost-submit')) {
if(!empty($_POST['ljpost-submit'])) {
PConfig::set(local_user(),'ljpost','post',intval($_POST['ljpost']));
PConfig::set(local_user(),'ljpost','post_by_default',intval($_POST['lj_bydefault']));
@ -131,7 +131,7 @@ function ljpost_post_local(&$a,&$b) {
$lj_post = intval(PConfig::get(local_user(),'ljpost','post'));
$lj_enable = (($lj_post && x($_REQUEST,'ljpost_enable')) ? intval($_REQUEST['ljpost_enable']) : 0);
$lj_enable = (($lj_post && !empty($_REQUEST['ljpost_enable'])) ? intval($_REQUEST['ljpost_enable']) : 0);
if($b['api_source'] && intval(PConfig::get(local_user(),'ljpost','post_by_default')))
$lj_enable = 1;

View file

@ -86,7 +86,7 @@ function mailstream_addon_admin(&$a,&$o) {
}
function mailstream_addon_admin_post ($a) {
if (x($_POST, 'frommail')) {
if (!empty($_POST['frommail'])) {
Config::set('mailstream', 'frommail', $_POST['frommail']);
}
}

View file

@ -54,8 +54,8 @@ function newmemberwidget_network_mod_init ($a, $b)
function newmemberwidget_addon_admin_post(&$a)
{
$ft = ((x($_POST, 'freetext')) ? trim($_POST['freetext']) : "");
$lsn = ((x($_POST, 'localsupportname')) ? Strings::escapeTags(trim($_POST['localsupportname'])) : "");
$ft = (!empty($_POST['freetext']) ? trim($_POST['freetext']) : "");
$lsn = (!empty($_POST['localsupportname']) ? Strings::escapeTags(trim($_POST['localsupportname'])) : "");
$gs = intval($_POST['linkglobalsupport']);
$ls = intval($_POST['linklocalsupport']);
Config::set('newmemberwidget', 'freetext', trim($ft));

View file

@ -54,7 +54,7 @@ function notifyall_post(App $a)
$sender_name = '"' . L10n::t('%1$s, %2$s Administrator', Config::get('config', 'admin_name'), $sitename) . '"';
}
if (! x(Config::get('config', 'sender_email'))) {
if (!Config::get('config', 'sender_email')) {
$sender_email = 'noreply@' . $a->getHostName();
} else {
$sender_email = Config::get('config', 'sender_email');

View file

@ -25,7 +25,7 @@ function notimeline_uninstall()
function notimeline_settings_post($a, $post)
{
if (!local_user() || (!x($_POST, 'notimeline-submit'))) {
if (!local_user() || empty($_POST['notimeline-submit'])) {
return;
}

View file

@ -103,7 +103,7 @@ function nsfw_addon_settings_post(&$a, &$b)
if (!empty($_POST['nsfw-submit'])) {
PConfig::set(local_user(), 'nsfw', 'words', trim($_POST['nsfw-words']));
$enable = (x($_POST, 'nsfw-enable') ? intval($_POST['nsfw-enable']) : 0);
$enable = (!empty($_POST['nsfw-enable']) ? intval($_POST['nsfw-enable']) : 0);
$disable = 1 - $enable;
PConfig::set(local_user(), 'nsfw', 'disable', $disable);
info(L10n::t('NSFW Settings saved.') . EOL);

View file

@ -37,7 +37,7 @@ function numfriends_uninstall() {
*
*/
function numfriends_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'numfriends-submit')))
if(! local_user() || empty($_POST['numfriends-submit']))
return;
PConfig::set(local_user(),'system','display_friend_count',intval($_POST['numfriends']));

View file

@ -108,10 +108,10 @@ function piwik_addon_admin (&$a, &$o) {
]);
}
function piwik_addon_admin_post (&$a) {
$url = ((x($_POST, 'baseurl')) ? Strings::escapeTags(trim($_POST['baseurl'])) : '');
$id = ((x($_POST, 'siteid')) ? trim($_POST['siteid']) : '');
$optout = ((x($_POST, 'optout')) ? trim($_POST['optout']) : '');
$async = ((x($_POST, 'async')) ? trim($_POST['async']) : '');
$url = (!empty($_POST['baseurl']) ? Strings::escapeTags(trim($_POST['baseurl'])) : '');
$id = (!empty($_POST['siteid']) ? trim($_POST['siteid']) : '');
$optout = (!empty($_POST['optout']) ? trim($_POST['optout']) : '');
$async = (!empty($_POST['async']) ? trim($_POST['async']) : '');
Config::set('piwik', 'baseurl', $url);
Config::set('piwik', 'siteid', $id);
Config::set('piwik', 'optout', $optout);

View file

@ -124,8 +124,8 @@ function public_server_cron($a, $b)
function public_server_enotify(&$a, &$b)
{
if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM
&& x($b['params'], 'system_type') && $b['params']['system_type'] === 'public_server_expire') {
if (!empty($b['params']) && $b['params']['type'] == NOTIFY_SYSTEM
&& !empty($b['params']['system_type']) && $b['params']['system_type'] === 'public_server_expire') {
$b['itemlink'] = $a->getBaseURL();
$b['epreamble'] = $b['preamble'] = L10n::t('Your account on %s will expire in a few days.', Config::get('system', 'sitename'));
$b['subject'] = L10n::t('Your Friendica account is about to expire.');
@ -148,12 +148,12 @@ function public_server_login($a, $b)
function public_server_addon_admin_post(&$a)
{
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/addons/publicserver', 'publicserver');
$expiredays = (x($_POST, 'expiredays') ? Strings::escapeTags(trim($_POST['expiredays'])) : '');
$expireposts = (x($_POST, 'expireposts') ? Strings::escapeTags(trim($_POST['expireposts'])) : '');
$nologin = (x($_POST, 'nologin') ? Strings::escapeTags(trim($_POST['nologin'])) : '');
$flagusers = (x($_POST, 'flagusers') ? Strings::escapeTags(trim($_POST['flagusers'])) : '');
$flagposts = (x($_POST, 'flagposts') ? Strings::escapeTags(trim($_POST['flagposts'])) : '');
$flagpostsexpire = (x($_POST, 'flagpostsexpire') ? Strings::escapeTags(trim($_POST['flagpostsexpire'])) : '');
$expiredays = (!empty($_POST['expiredays']) ? Strings::escapeTags(trim($_POST['expiredays'])) : '');
$expireposts = (!empty($_POST['expireposts']) ? Strings::escapeTags(trim($_POST['expireposts'])) : '');
$nologin = (!empty($_POST['nologin']) ? Strings::escapeTags(trim($_POST['nologin'])) : '');
$flagusers = (!empty($_POST['flagusers']) ? Strings::escapeTags(trim($_POST['flagusers'])) : '');
$flagposts = (!empty($_POST['flagposts']) ? Strings::escapeTags(trim($_POST['flagposts'])) : '');
$flagpostsexpire = (!empty($_POST['flagpostsexpire']) ? Strings::escapeTags(trim($_POST['flagpostsexpire'])) : '');
Config::set('public_server', 'expiredays', $expiredays);
Config::set('public_server', 'expireposts', $expireposts);
Config::set('public_server', 'nologin', $nologin);

View file

@ -58,7 +58,7 @@ function remote_permissions_settings(&$a,&$o) {
}
function remote_permissions_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'remote-perms-submit')))
if(! local_user() || empty($_POST['remote-perms-submit']))
return;
PConfig::set(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
@ -207,7 +207,7 @@ function remote_permissions_addon_admin(&$a, &$o){
}
function remote_permissions_addon_admin_post(&$a){
$choice = ((x($_POST,'remotepermschoice')) ? Strings::escapeTags(trim($_POST['remotepermschoice'])) : '');
$choice = (!empty($_POST['remotepermschoice']) ? Strings::escapeTags(trim($_POST['remotepermschoice'])) : '');
Config::set('remote_perms','global',($choice == 1 ? 1 : 0));
info(L10n::t('Settings updated.'). EOL);
}

View file

@ -92,7 +92,7 @@ function securemail_settings_post(App &$a, array &$b){
if ($_POST['securemail-submit']) {
PConfig::set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
$enable = ((x($_POST, 'securemail-enable')) ? 1 : 0);
$enable = (!empty($_POST['securemail-enable']) ? 1 : 0);
PConfig::set(local_user(), 'securemail', 'enable', $enable);
info(L10n::t('Secure Mail Settings saved.') . EOL);
@ -150,7 +150,7 @@ function securemail_settings_post(App &$a, array &$b){
* @see App
*/
function securemail_emailer_send_prepare(App &$a, array &$b) {
if (!x($b, 'uid')) {
if (empty($b['uid'])) {
return;
}
@ -164,7 +164,7 @@ function securemail_emailer_send_prepare(App &$a, array &$b) {
$public_key_ascii = PConfig::get($uid, 'securemail', 'pkey');
preg_match('/-----BEGIN ([A-Za-z ]+)-----/', $public_key_ascii, $matches);
$marker = (empty($matches[1])) ? 'MESSAGE' : $matches[1];
$marker = empty($matches[1]) ? 'MESSAGE' : $matches[1];
$public_key = OpenPGP::unarmor($public_key_ascii, $marker);
$key = OpenPGP_Message::parse($public_key);

View file

@ -71,7 +71,7 @@ function showmore_addon_settings_post(&$a, &$b)
if (!empty($_POST['showmore-submit'])) {
PConfig::set(local_user(), 'showmore', 'chars', trim($_POST['showmore-chars']));
$enable = (x($_POST, 'showmore-enable') ? intval($_POST['showmore-enable']) : 0);
$enable = (!empty($_POST['showmore-enable']) ? intval($_POST['showmore-enable']) : 0);
$disable = 1-$enable;
PConfig::set(local_user(), 'showmore', 'disable', $disable);
info(L10n::t('Show More Settings saved.') . EOL);

View file

@ -123,7 +123,7 @@ function statusnet_settings_post(App $a, $post)
return;
}
// don't check GNU Social settings if GNU Social submit button is not clicked
if (!x($_POST, 'statusnet-submit')) {
if (empty($_POST['statusnet-submit'])) {
return;
}
@ -447,7 +447,7 @@ function statusnet_post_local(App $a, &$b)
}
$statusnet_post = PConfig::get(local_user(), 'statusnet', 'post');
$statusnet_enable = (($statusnet_post && x($_REQUEST, 'statusnet_enable')) ? intval($_REQUEST['statusnet_enable']) : 0);
$statusnet_enable = (($statusnet_post && !empty($_REQUEST['statusnet_enable'])) ? intval($_REQUEST['statusnet_enable']) : 0);
// if API is used, default to the chosen settings
if ($b['api_source'] && intval(PConfig::get(local_user(), 'statusnet', 'post_by_default'))) {
@ -667,12 +667,12 @@ function statusnet_addon_admin_post(App $a)
}
$secret = trim($_POST['secret'][$id]);
$key = trim($_POST['key'][$id]);
//$applicationname = ((x($_POST, 'applicationname')) ? Strings::escapeTags(trim($_POST['applicationname'][$id])):'');
//$applicationname = (!empty($_POST['applicationname']) ? Strings::escapeTags(trim($_POST['applicationname'][$id])):'');
if ($sitename != "" &&
$apiurl != "" &&
$secret != "" &&
$key != "" &&
!x($_POST['delete'][$id])) {
empty($_POST['delete'][$id])) {
$sites[] = [
'sitename' => $sitename,

View file

@ -97,8 +97,8 @@ function testdrive_cron($a,$b) {
}
function testdrive_enotify(&$a, &$b) {
if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM
&& x($b['params'], 'system_type') && $b['params']['system_type'] === 'testdrive_expire') {
if (!empty($b['params']) && $b['params']['type'] == NOTIFY_SYSTEM
&& !empty($b['params']['system_type']) && $b['params']['system_type'] === 'testdrive_expire') {
$b['itemlink'] = $a->getBaseURL();
$b['epreamble'] = $b['preamble'] = L10n::t('Your account on %s will expire in a few days.', Config::get('system', 'sitename'));
$b['subject'] = L10n::t('Your Friendica test account is about to expire.');

View file

@ -86,8 +86,8 @@ function tumblr_addon_admin(App $a, &$o)
function tumblr_addon_admin_post(App $a)
{
$consumer_key = ((!empty($_POST['consumer_key'])) ? Strings::escapeTags(trim($_POST['consumer_key'])) : '');
$consumer_secret = ((!empty($_POST['consumer_secret'])) ? Strings::escapeTags(trim($_POST['consumer_secret'])): '');
$consumer_key = (!empty($_POST['consumer_key']) ? Strings::escapeTags(trim($_POST['consumer_key'])) : '');
$consumer_secret = (!empty($_POST['consumer_secret']) ? Strings::escapeTags(trim($_POST['consumer_secret'])): '');
Config::set('tumblr', 'consumer_key',$consumer_key);
Config::set('tumblr', 'consumer_secret',$consumer_secret);

View file

@ -446,7 +446,7 @@ function twitter_post_local(App $a, array &$b)
}
$twitter_post = intval(PConfig::get(local_user(), 'twitter', 'post'));
$twitter_enable = (($twitter_post && x($_REQUEST, 'twitter_enable')) ? intval($_REQUEST['twitter_enable']) : 0);
$twitter_enable = (($twitter_post && !empty($_REQUEST['twitter_enable'])) ? intval($_REQUEST['twitter_enable']) : 0);
// if API is used, default to the chosen settings
if ($b['api_source'] && intval(PConfig::get(local_user(), 'twitter', 'post_by_default'))) {
@ -703,8 +703,8 @@ function twitter_post_hook(App $a, array &$b)
function twitter_addon_admin_post(App $a)
{
$consumerkey = x($_POST, 'consumerkey') ? Strings::escapeTags(trim($_POST['consumerkey'])) : '';
$consumersecret = x($_POST, 'consumersecret') ? Strings::escapeTags(trim($_POST['consumersecret'])) : '';
$consumerkey = !empty($_POST['consumerkey']) ? Strings::escapeTags(trim($_POST['consumerkey'])) : '';
$consumersecret = !empty($_POST['consumersecret']) ? Strings::escapeTags(trim($_POST['consumersecret'])) : '';
Config::set('twitter', 'consumerkey', $consumerkey);
Config::set('twitter', 'consumersecret', $consumersecret);
info(L10n::t('Settings updated.') . EOL);

View file

@ -33,7 +33,7 @@ function webrtc_addon_admin (&$a, &$o) {
]);
}
function webrtc_addon_admin_post (&$a) {
$url = ((x($_POST, 'webrtcurl')) ? Strings::escapeTags(trim($_POST['webrtcurl'])) : '');
$url = (!empty($_POST['webrtcurl']) ? Strings::escapeTags(trim($_POST['webrtcurl'])) : '');
Config::set('webrtc', 'webrtcurl', $url);
info(L10n::t('Settings updated.'). EOL);
}

View file

@ -82,7 +82,7 @@ function windowsphonepush_module()
*/
function windowsphonepush_settings_post($a, $post)
{
if (!local_user() || (!x($_POST, 'windowsphonepush-submit'))) {
if (!local_user() || empty($_POST['windowsphonepush-submit'])) {
return;
}
$enable = intval($_POST['windowsphonepush']);

View file

@ -147,7 +147,7 @@ function wppost_settings(&$a,&$s) {
function wppost_settings_post(&$a,&$b) {
if(x($_POST,'wppost-submit')) {
if(!empty($_POST['wppost-submit'])) {
PConfig::set(local_user(),'wppost','post',intval($_POST['wppost']));
PConfig::set(local_user(),'wppost','post_by_default',intval($_POST['wp_bydefault']));
@ -198,7 +198,7 @@ function wppost_post_local(&$a, &$b) {
$wp_post = intval(PConfig::get(local_user(),'wppost','post'));
$wp_enable = (($wp_post && x($_REQUEST,'wppost_enable')) ? intval($_REQUEST['wppost_enable']) : 0);
$wp_enable = (($wp_post && !empty($_REQUEST['wppost_enable'])) ? intval($_REQUEST['wppost_enable']) : 0);
if ($b['api_source'] && intval(PConfig::get(local_user(),'wppost','post_by_default'))) {
$wp_enable = 1;

View file

@ -117,8 +117,8 @@ function xmpp_addon_admin(App $a, &$o)
function xmpp_addon_admin_post()
{
$bosh_proxy = ((!empty($_POST['bosh_proxy'])) ? trim($_POST['bosh_proxy']) : '');
$central_userbase = ((!empty($_POST['central_userbase'])) ? intval($_POST['central_userbase']) : false);
$bosh_proxy = (!empty($_POST['bosh_proxy']) ? trim($_POST['bosh_proxy']) : '');
$central_userbase = (!empty($_POST['central_userbase']) ? intval($_POST['central_userbase']) : false);
Config::set('xmpp', 'bosh_proxy', $bosh_proxy);
Config::set('xmpp', 'central_userbase', $central_userbase);