And still there are notices that have to be removed ... (#5629)

* And still there are notices that have to be removed ...

* Notice removed in ACL part

* Fix missing fields for notifications

* Fixes issue 5630
This commit is contained in:
Michael Vogel 2018-08-18 08:20:50 +02:00 committed by Tobias Diekershoff
parent 4eaeea7889
commit 060e887a31
10 changed files with 41 additions and 21 deletions

View File

@ -1690,7 +1690,10 @@ function admin_page_users_post(App $a)
notification([
'type' => SYSTEM_EMAIL,
'language' => $user['language'],
'to_name' => $user['username'],
'to_email' => $user['email'],
'uid' => $user['uid'],
'subject' => L10n::t('Registration details for %s', Config::get('config', 'sitename')),
'preamble' => $preamble,
'body' => $body]);

View 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),

View 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) ? '!' : ''),

View 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');

View 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

View 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];

View 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';

View 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)

View 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 [];
}

View 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