diff --git a/blogger/blogger.php b/blogger/blogger.php index 5c03e760..001224d2 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -126,8 +126,8 @@ function blogger_settings(App $a, &$s) function blogger_settings_post(App $a, array &$b) { if (!empty($_POST['blogger-submit'])) { - PConfig::set(local_user(), 'blogger', 'post', defaults($_POST, 'blogger', false)); - PConfig::set(local_user(), 'blogger', 'post_by_default', defaults($_POST, 'bl_bydefault', false)); + PConfig::set(local_user(), 'blogger', 'post', $_POST['blogger'] ?? false); + PConfig::set(local_user(), 'blogger', 'post_by_default', $_POST['bl_bydefault'] ?? false); PConfig::set(local_user(), 'blogger', 'bl_username', trim($_POST['bl_username'])); PConfig::set(local_user(), 'blogger', 'bl_password', trim($_POST['bl_password'])); PConfig::set(local_user(), 'blogger', 'bl_blog', trim($_POST['bl_blog'])); diff --git a/buffer/buffer.php b/buffer/buffer.php index 4b8c578a..689127cf 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -238,8 +238,8 @@ function buffer_settings_post(App $a, array &$b) PConfig::set(local_user(), 'buffer', 'post' , false); PConfig::set(local_user(), 'buffer', 'post_by_default', false); } else { - PConfig::set(local_user(), 'buffer', 'post' , intval(defaults($_POST, 'buffer', false))); - PConfig::set(local_user(), 'buffer', 'post_by_default', intval(defaults($_POST, 'buffer_bydefault', false))); + PConfig::set(local_user(), 'buffer', 'post' , intval($_POST['buffer'] ?? false)); + PConfig::set(local_user(), 'buffer', 'post_by_default', intval($_POST['buffer_bydefault'] ?? false)); } } } diff --git a/curweather/curweather.php b/curweather/curweather.php index e431491a..df7a701a 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -16,6 +16,7 @@ use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\Renderer; +use Friendica\Core\Session; use Friendica\Util\Network; use Friendica\Util\Proxy as ProxyUtils; @@ -116,7 +117,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 = defaults($_SESSION, 'language', Config::get('system', 'language')); + $lang = Session::get('language', Config::get('system', 'language')); $units = PConfig::get( local_user(), 'curweather', 'curweather_units'); $appid = Config::get('curweather', 'appid'); $cachetime = intval(Config::get('curweather', 'cachetime')); diff --git a/irc/irc.php b/irc/irc.php index aa727e2e..d02b2cbd 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -114,7 +114,7 @@ function irc_content(&$a) { if($autochans) $channels = $autochans; else - $channels = defaults($_GET, 'channels', 'friendica'); + $channels = ($_GET['channels'] ?? '') ?: 'friendica'; /* add the chatroom frame and some html */ $o .= <<< EOT diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index f11e9b11..8f0a1f71 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -480,7 +480,7 @@ function jappixmini_script(App $a) return; } - if (defaults($_GET, "mode", '') == "minimal") { + if (($_GET['mode'] ?? '') == 'minimal') { return; } diff --git a/js_upload/js_upload.php b/js_upload/js_upload.php index 83fb275a..5a6c37c8 100644 --- a/js_upload/js_upload.php +++ b/js_upload/js_upload.php @@ -337,7 +337,7 @@ class qqFileUploader { if (!isset($pathinfo['extension'])) { Logger::warning('extension isn\'t set.', ['filename' => $filename]); } - $ext = defaults($pathinfo, 'extension', ''); + $ext = $pathinfo['extension'] ?? ''; if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){ $these = implode(', ', $this->allowedExtensions); diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 58e54908..af52e668 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -109,8 +109,8 @@ function notifyall_content(&$a) $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('notifyall_form.tpl', 'addon/notifyall/'), [ '$title' => $title, - '$text' => htmlspecialchars(defaults($_REQUEST, 'text', '')), - '$subject' => ['subject', L10n::t('Message subject'), defaults($_REQUEST, 'subject', ''),''], + '$text' => htmlspecialchars($_REQUEST['text'] ?? ''), + '$subject' => ['subject', L10n::t('Message subject'), $_REQUEST['subject'] ?? '',''], '$test' => ['test',L10n::t('Test mode (only send to administrator)'), 0,''], '$submit' => L10n::t('Submit') ]); diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index edea4329..7b33306f 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -215,10 +215,10 @@ function openstreetmap_addon_admin(&$a, &$o) function openstreetmap_addon_admin_post(&$a) { - $urltms = defaults($_POST, 'tmsserver', OSM_TMS); - $urlnom = defaults($_POST, 'nomserver', OSM_NOM); - $zoom = defaults($_POST, 'zoom', OSM_ZOOM); - $marker = defaults($_POST, 'marker', OSM_MARKER); + $urltms = ($_POST['tmsserver'] ?? '') ?: OSM_TMS; + $urlnom = ($_POST['nomserver'] ?? '') ?: OSM_NOM; + $zoom = ($_POST['zoom'] ?? '') ?: OSM_ZOOM; + $marker = ($_POST['marker'] ?? '') ?: OSM_MARKER; Config::set('openstreetmap', 'tmsserver', $urltms); Config::set('openstreetmap', 'nomserver', $urlnom); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 8731e251..537bf280 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -361,13 +361,13 @@ function pumpio_settings_post(App $a, array &$b) $host = trim($host); $host = str_replace(["https://", "http://"], ["", ""], $host); - PConfig::set(local_user(), 'pumpio', 'post' , defaults($_POST, 'pumpio', false)); - PConfig::set(local_user(), 'pumpio', 'import' , defaults($_POST, 'pumpio_import', false)); + PConfig::set(local_user(), 'pumpio', 'post' , $_POST['pumpio'] ?? false); + PConfig::set(local_user(), 'pumpio', 'import' , $_POST['pumpio_import'] ?? false); PConfig::set(local_user(), 'pumpio', 'host' , $host); PConfig::set(local_user(), 'pumpio', 'user' , $user); - PConfig::set(local_user(), 'pumpio', 'public' , defaults($_POST, 'pumpio_public', false)); - PConfig::set(local_user(), 'pumpio', 'mirror' , defaults($_POST, 'pumpio_mirror', false)); - PConfig::set(local_user(), 'pumpio', 'post_by_default', defaults($_POST, 'pumpio_bydefault', false)); + PConfig::set(local_user(), 'pumpio', 'public' , $_POST['pumpio_public'] ?? false); + PConfig::set(local_user(), 'pumpio', 'mirror' , $_POST['pumpio_mirror'] ?? false); + PConfig::set(local_user(), 'pumpio', 'post_by_default', $_POST['pumpio_bydefault'] ?? false); if (!empty($_POST['pumpio_mirror'])) { PConfig::delete(local_user(), 'pumpio', 'lastdate'); diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php index 5af6f512..a54fc489 100644 --- a/rendertime/rendertime.php +++ b/rendertime/rendertime.php @@ -37,7 +37,7 @@ function rendertime_page_end(Friendica\App $a, &$o) $ignored_modules = ["fbrowser"]; $ignored = in_array($a->module, $ignored_modules); - if (is_site_admin() && (defaults($_GET, "mode", '') != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) { + if (is_site_admin() && (($_GET['mode'] ?? '') != 'minimal') && !$a->is_mobile && !$a->is_tablet && !$ignored) { $o = $o . '