]> git.mxchange.org Git - friendica.git/commitdiff
And still there are notices that have to be removed ... (#5629)
authorMichael Vogel <icarus@dabo.de>
Sat, 18 Aug 2018 06:20:50 +0000 (08:20 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Sat, 18 Aug 2018 06:20:50 +0000 (08:20 +0200)
* And still there are notices that have to be removed ...

* Notice removed in ACL part

* Fix missing fields for notifications

* Fixes issue 5630

mod/admin.php
mod/lostpass.php
mod/network.php
mod/notifications.php
mod/removeme.php
mod/viewcontacts.php
mod/xrd.php
src/Content/Text/BBCode.php
src/Core/ACL.php
src/Model/Contact.php

index b2f84d07293249be52d48269d521690fc2f01ba8..30073c655b0a3be672799dcaf510e626192f77aa 100644 (file)
@@ -1689,11 +1689,14 @@ function admin_page_users_post(App $a)
                $body = sprintf($body, System::baseUrl(), $user['email'], $result['password'], Config::get('config', 'sitename'));
 
                notification([
-                       'type' => SYSTEM_EMAIL,
+                       'type'     => SYSTEM_EMAIL,
+                       'language' => $user['language'],
+                       'to_name'  => $user['username'],
                        'to_email' => $user['email'],
-                       'subject' => L10n::t('Registration details for %s', Config::get('config', 'sitename')),
+                       'uid'      => $user['uid'],
+                       'subject'  => L10n::t('Registration details for %s', Config::get('config', 'sitename')),
                        'preamble' => $preamble,
-                       'body' => $body]);
+                       'body'     => $body]);
        }
 
        if (x($_POST, 'page_users_block')) {
index f4e8e1de7d6bf90d5f0095964e2649b13bc5b445..166da25fc24b56b494ac60eea109dcf40e8725a0 100644 (file)
@@ -23,7 +23,7 @@ function lostpass_post(App $a)
        }
 
        $condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
-       $user = DBA::selectFirst('user', ['uid', 'username', 'email'], $condition);
+       $user = DBA::selectFirst('user', ['uid', 'username', 'email', 'language'], $condition);
        if (!DBA::isResult($user)) {
                notice(L10n::t('No valid account found.') . EOL);
                goaway(System::baseUrl());
@@ -69,6 +69,8 @@ function lostpass_post(App $a)
 
        notification([
                'type'     => SYSTEM_EMAIL,
+               'language' => $user['language'],
+               'to_name'  => $user['username'],
                'to_email' => $user['email'],
                'uid'      => $user['uid'],
                'subject'  => L10n::t('Password reset requested at %s', $sitename),
@@ -85,7 +87,7 @@ function lostpass_content(App $a)
        if ($a->argc > 1) {
                $pwdreset_token = $a->argv[1];
 
-               $user = DBA::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]);
+               $user = DBA::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time', 'language'], ['pwdreset' => $pwdreset_token]);
                if (!DBA::isResult($user)) {
                        notice(L10n::t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
 
@@ -165,6 +167,8 @@ function lostpass_generate_password($user)
 
                notification([
                        'type'     => SYSTEM_EMAIL,
+                       'language' => $user['language'],
+                       'to_name'  => $user['username'],
                        'to_email' => $user['email'],
                        'uid'      => $user['uid'],
                        'subject'  => L10n::t('Your password has been changed at %s', $sitename),
index b99b4a2593b59ed843000a496c238b4ebd7a59b0..bda4ae610758227829f03506933146ceb3962e2c 100644 (file)
@@ -418,9 +418,9 @@ function networkFlatView(App $a, $update = 0)
                        'allow_location' => $a->user['allow_location'],
                        'default_location' => $a->user['default-location'],
                        'nickname' => $a->user['nickname'],
-                       'lockstate' => (((is_array($a->user) &&
-                       ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) ||
-                       (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
+                       'lockstate' => (is_array($a->user) &&
+                       (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) ||
+                       strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
                        'default_perms' => ACL::getDefaultUserPermissions($a->user),
                        'acl' => ACL::getFullSelectorHTML($a->user, true),
                        'bang' => '',
@@ -574,9 +574,9 @@ function networkThreadedView(App $a, $update, $parent)
                        'allow_location' => $a->user['allow_location'],
                        'default_location' => $a->user['default-location'],
                        'nickname' => $a->user['nickname'],
-                       'lockstate' => ((($gid) || ($cid) || ($nets) || (is_array($a->user) &&
-                       ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) ||
-                       (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
+                       'lockstate' => ($gid || $cid || $nets || (is_array($a->user) &&
+                       (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) ||
+                       strlen($a->user['deny_cid']) || strlen($a->user['deny_gid']))) ? 'lock' : 'unlock'),
                        'default_perms' => ACL::getDefaultUserPermissions($a->user),
                        'acl' => ACL::getFullSelectorHTML($a->user, true, $default_permissions),
                        'bang' => (($gid || $cid || $nets) ? '!' : ''),
index 52521b017a43cf7a02e41c2bd71432052b711eeb..145c38435017b0d9a5c1003ffa6fa65e2016a4d6 100644 (file)
@@ -133,6 +133,10 @@ function notifications_content(App $a)
 
        $notif_tpl = get_markup_template('notifications.tpl');
 
+       if (!isset($notifs['ident'])) {
+               logger('Missing data in notifs: ' . System::callstack(20), LOGGER_DEBUG);
+       }
+
        // Process the data for template creation
        if ($notifs['ident'] === 'introductions') {
                $sugg = get_markup_template('suggestions.tpl');
index 26853a38e767e6d5c49eac9b56fde78cc8798229..b386ec12f5ccabd09280900a32fc0a3b1139c7d1 100644 (file)
@@ -38,7 +38,7 @@ function removeme_post(App $a)
        // send email to admins
        $admin_mails = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
        foreach ($admin_mails as $mail) {
-               $admin = DBA::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]);
+               $admin = DBA::selectFirst('user', ['uid', 'language', 'email', 'username'], ['email' => $mail]);
                if (!DBA::isResult($admin)) {
                        continue;
                }
@@ -48,6 +48,7 @@ function removeme_post(App $a)
                        'preamble'     => L10n::t('On your Friendica node an user deleted their account. Please ensure that their data is removed from the backups.'),
                        'body'         => L10n::t('The user id is %d', local_user()),
                        'to_email'     => $admin['email'],
+                       'to_name'      => $admin['username'],
                        'uid'          => $admin['uid'],
                        'language'     => $admin['language'] ? $admin['language'] : 'en',
                        'show_in_notification_page' => false
index 9219f49d9bfaa18fe5312b0b0c2c90bc43907e58..9446470e1b03df21f2e9eeb649e4235504d21337 100644 (file)
@@ -17,7 +17,7 @@ use Friendica\Core\System;
 function viewcontacts_init(App $a)
 {
        if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
-               return;
+               System::httpExit(403, ["title" => L10n::t('Access denied.')]);
        }
 
        if ($a->argc < 2) {
@@ -32,7 +32,7 @@ function viewcontacts_init(App $a)
        );
 
        if (!DBA::isResult($r)) {
-               return;
+               System::httpExit(404, ["title" => L10n::t('Page not found.')]);
        }
 
        $a->data['user'] = $r[0];
index 0cc5dba45b51fde179bfaff2c8e5d957ef44618f..61505f29966e99d2ea4f66f27d2cb091a8bf16cc 100644 (file)
@@ -12,6 +12,10 @@ use Friendica\Protocol\Salmon;
 function xrd_init(App $a)
 {
        if ($a->argv[0] == 'xrd') {
+               if (empty($_GET['uri'])) {
+                       killme();
+               }
+
                $uri = urldecode(notags(trim($_GET['uri'])));
                if (defaults($_SERVER, 'HTTP_ACCEPT', '') == 'application/jrd+json') {
                        $mode = 'json';
@@ -19,6 +23,10 @@ function xrd_init(App $a)
                        $mode = 'xml';
                }
        } else {
+               if (empty($_GET['resource'])) {
+                       killme();
+               }
+
                $uri = urldecode(notags(trim($_GET['resource'])));
                if (defaults($_SERVER, 'HTTP_ACCEPT', '') == 'application/xrd+xml') {
                        $mode = 'xml';
index b5654a2d5b93021f429f4e4f8ffd8d94fd054b80..41f89e65dc84e8f35518e4e37da6fe4f36303f7c 100644 (file)
@@ -599,7 +599,7 @@ class BBCode extends BaseObject
                        }
                }
 
-               return trim($data["text"] . ' ' . $return . ' ' . $data["after"]);
+               return trim(defaults($data, 'text', '') . ' ' . $return . ' ' . defaults($data, 'after', ''));
        }
 
        public static function removeShareInformation($Text, $plaintext = false, $nolink = false)
index 20db2908772b2ec4be0cfa095033677d3f4bc954..164333aae49366e8614cd8da2cb924c4a83818f9 100644 (file)
@@ -296,10 +296,10 @@ class ACL extends BaseObject
                        '$showall' => L10n::t('Visible to everybody'),
                        '$show' => L10n::t('show'),
                        '$hide' => L10n::t('don\'t show'),
-                       '$allowcid' => json_encode($default_permissions['allow_cid']),
-                       '$allowgid' => json_encode($default_permissions['allow_gid']),
-                       '$denycid' => json_encode($default_permissions['deny_cid']),
-                       '$denygid' => json_encode($default_permissions['deny_gid']),
+                       '$allowcid' => json_encode(defaults($default_permissions, 'allow_cid', '')),
+                       '$allowgid' => json_encode(defaults($default_permissions, 'allow_gid', '')),
+                       '$denycid' => json_encode(defaults($default_permissions, 'deny_cid', '')),
+                       '$denygid' => json_encode(defaults($default_permissions, 'deny_gid', '')),
                        '$networks' => $show_jotnets,
                        '$emailcc' => L10n::t('CC: email addresses'),
                        '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
@@ -324,7 +324,7 @@ class ACL extends BaseObject
         */
        public static function contactAutocomplete($search, $mode)
        {
-               if ((Config::get('system', 'block_public')) && (!local_user()) && (!remote_user())) {
+               if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
                        return [];
                }
 
index ddca508561ccda383ef80b3090d1a1621906d226..0d3f7e8789b40bbf2c4f502ab49e037aebd13229 100644 (file)
@@ -366,7 +366,7 @@ class Contact extends BaseObject
        {
 
                if (!isset($contact['url'])) {
-                       logger('Empty contact. ' . System::callstack(10), LOGGER_DEBUG);
+                       logger('Empty contact: ' . json_encode($contact) . ' - ' . System::callstack(20), LOGGER_DEBUG);
                }
 
                // Contact already archived or "self" contact? => nothing to do