diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index 74728c04..ce5da9c3 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -34,6 +34,7 @@ */ use Friendica\App; +use Friendica\BaseModule; use Friendica\Content\Text\Markdown; use Friendica\Core\Addon; use Friendica\Core\Cache; @@ -46,6 +47,7 @@ use Friendica\Model\Term; use Friendica\Module\Login; use Friendica\Network\HTTPException; use Friendica\Util\DateTimeFormat; +use Friendica\Util\Security; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Symfony\Component\ExpressionLanguage; @@ -53,7 +55,6 @@ use Symfony\Component\ExpressionLanguage; require_once 'boot.php'; require_once 'include/conversation.php'; require_once 'include/dba.php'; -require_once 'include/security.php'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; @@ -234,7 +235,7 @@ function advancedcontentfilter_content(App $a) ], '$current_theme' => $a->getCurrentTheme(), '$rules' => advancedcontentfilter_get_rules(), - '$form_security_token' => get_form_security_token() + '$form_security_token' => BaseModule::getFormSecurityToken() ]); } } @@ -322,7 +323,7 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request) throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this method')); } - if (!check_form_security_token()) { + if (!BaseModule::checkFormSecurityToken()) { throw new HTTPException\BadRequestException(L10n::t('Invalid form security token, please refresh the page.')); } @@ -356,7 +357,7 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this method')); } - if (!check_form_security_token()) { + if (!BaseModule::checkFormSecurityToken()) { throw new HTTPException\BadRequestException(L10n::t('Invalid form security token, please refresh the page.')); } @@ -385,7 +386,7 @@ function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request, throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this method')); } - if (!check_form_security_token()) { + if (!BaseModule::checkFormSecurityToken()) { throw new HTTPException\BadRequestException(L10n::t('Invalid form security token, please refresh the page.')); } diff --git a/buffer/bufferapp.php b/buffer/bufferapp.php index a9aeb49e..a222b23e 100644 --- a/buffer/bufferapp.php +++ b/buffer/bufferapp.php @@ -45,7 +45,6 @@ '403' => 'Permission denied.', '404' => 'Endpoint not found.', '405' => 'Method not allowed.', - '504' => 'Gateway timeout server response timeout.', '1000' => 'An unknown error occurred.', '1001' => 'Access token required.', '1002' => 'Not within application scope.', diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 9dc48753..24ec46f3 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -495,9 +495,8 @@ function fromgplus_fetch($a, $uid) { case "note": $post = fromgplus_html2bbcode($item->object->content); - if (!empty($item->object->attachments)) { + if (is_array($item->object->attachments)) $post .= fromgplus_handleattachments($a, $uid, $item, $item->object->content, false); - } $coord = ""; $location = ""; @@ -527,12 +526,12 @@ function fromgplus_fetch($a, $uid) { if (function_exists("share_header")) $post .= share_header($item->object->actor->displayName, $item->object->actor->url, $item->object->actor->image->url, "", - DateTimeFormat::utc($item->published),$item->object->url); + DateTimeFormat::utc($item->object->published),$item->object->url); else $post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName). "' profile='".$item->object->actor->url. "' avatar='".$item->object->actor->image->url. - "' posted='".DateTimeFormat::utc($item->published). + "' posted='".DateTimeFormat::utc($item->object->published). "' link='".$item->object->url."']"; $post .= fromgplus_html2bbcode($item->object->content); diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index 00d8e5b3..9a23edfe 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -7,10 +7,12 @@ */ use Friendica\App; +use Friendica\BaseModule; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Database\DBA; +use Friendica\Util\Security; /** * Installs the addon hook @@ -103,7 +105,7 @@ function gravatar_addon_admin (&$a, &$o) { } // output Gravatar settings - $o .= ''; + $o .= ''; $o .= replace_macros( $t, [ '$submit' => L10n::t('Save Settings'), '$default_avatar' => ['avatar', L10n::t('Default avatar image'), $default_avatar, L10n::t('Select default avatar image if none was found at Gravatar. See README'), $default_avatars], @@ -115,7 +117,7 @@ function gravatar_addon_admin (&$a, &$o) { * Save admin settings */ function gravatar_addon_admin_post (&$a) { - check_form_security_token('gravatarsave'); + BaseModule::checkFormSecurityToken('gravatarsave'); $default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon'); $rating = ((x($_POST, 'rating')) ? notags(trim($_POST['rating'])) : 'g'); diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index ee283f0c..bc671548 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -7,10 +7,12 @@ */ use Friendica\App; +use Friendica\BaseModule; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Database\DBA; +use Friendica\Util\Security; /** * Installs the addon hook @@ -106,7 +108,7 @@ function libravatar_addon_admin(&$a, &$o) } // output Libravatar settings - $o .= ''; + $o .= ''; $o .= replace_macros( $t, [ '$submit' => L10n::t('Save Settings'), '$default_avatar' => ['avatar', L10n::t('Default avatar image'), $default_avatar, L10n::t('Select default avatar image if none was found. See README'), $default_avatars], @@ -118,7 +120,7 @@ function libravatar_addon_admin(&$a, &$o) */ function libravatar_addon_admin_post(&$a) { - check_form_security_token('libravatarrsave'); + BaseModule::checkFormSecurityToken('libravatarrsave'); $default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon'); Config::set('libravatar', 'default_avatar', $default_avatar); diff --git a/mastodoncustomemojis/mastodoncustomemojis.php b/mastodoncustomemojis/mastodoncustomemojis.php index 0ce63013..7df31112 100644 --- a/mastodoncustomemojis/mastodoncustomemojis.php +++ b/mastodoncustomemojis/mastodoncustomemojis.php @@ -96,10 +96,8 @@ function mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url) if (is_array($emojis_array) && count($emojis_array)) { foreach ($emojis_array as $emoji) { - if (!empty($emoji['shortcode']) && !empty($emoji['static_url'])) { - $return['texts'][] = ':' . $emoji['shortcode'] . ':'; - $return['icons'][] = ''; - } + $return['texts'][] = ':' . $emoji['shortcode'] . ':'; + $return['icons'][] = ''; } } } diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 824e306b..a0193039 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -28,7 +28,7 @@ function notifyall_module() {} function notifyall_addon_admin(App $a, &$o) { - $o = '
' . L10n::t('Send email to all members') . ''; + $o = ' ' . L10n::t('Send email to all members') . ''; } diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 8255b940..0420591e 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -155,7 +155,7 @@ function openstreetmap_generate_map(&$a, &$b) { $tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS); - if (strpos($a->getBaseURL(true), 'https:') !== false) { + if (strpos(z_root(), 'https:') !== false) { $tmsserver = str_replace('http:','https:',$tmsserver); } diff --git a/public_server/public_server.php b/public_server/public_server.php index 64f9d5d2..4d552951 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -6,11 +6,13 @@ * Author: Keith Fernie