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

@ -1689,11 +1689,14 @@ function admin_page_users_post(App $a)
$body = sprintf($body, System::baseUrl(), $user['email'], $result['password'], Config::get('config', 'sitename')); $body = sprintf($body, System::baseUrl(), $user['email'], $result['password'], Config::get('config', 'sitename'));
notification([ notification([
'type' => SYSTEM_EMAIL, 'type' => SYSTEM_EMAIL,
'language' => $user['language'],
'to_name' => $user['username'],
'to_email' => $user['email'], '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, 'preamble' => $preamble,
'body' => $body]); 'body' => $body]);
} }
if (x($_POST, 'page_users_block')) { if (x($_POST, 'page_users_block')) {

View file

@ -23,7 +23,7 @@ function lostpass_post(App $a)
} }
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame]; $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)) { if (!DBA::isResult($user)) {
notice(L10n::t('No valid account found.') . EOL); notice(L10n::t('No valid account found.') . EOL);
goaway(System::baseUrl()); goaway(System::baseUrl());
@ -69,6 +69,8 @@ function lostpass_post(App $a)
notification([ notification([
'type' => SYSTEM_EMAIL, 'type' => SYSTEM_EMAIL,
'language' => $user['language'],
'to_name' => $user['username'],
'to_email' => $user['email'], 'to_email' => $user['email'],
'uid' => $user['uid'], 'uid' => $user['uid'],
'subject' => L10n::t('Password reset requested at %s', $sitename), 'subject' => L10n::t('Password reset requested at %s', $sitename),
@ -85,7 +87,7 @@ function lostpass_content(App $a)
if ($a->argc > 1) { if ($a->argc > 1) {
$pwdreset_token = $a->argv[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)) { if (!DBA::isResult($user)) {
notice(L10n::t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed.")); 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([ notification([
'type' => SYSTEM_EMAIL, 'type' => SYSTEM_EMAIL,
'language' => $user['language'],
'to_name' => $user['username'],
'to_email' => $user['email'], 'to_email' => $user['email'],
'uid' => $user['uid'], 'uid' => $user['uid'],
'subject' => L10n::t('Your password has been changed at %s', $sitename), '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'], 'allow_location' => $a->user['allow_location'],
'default_location' => $a->user['default-location'], 'default_location' => $a->user['default-location'],
'nickname' => $a->user['nickname'], 'nickname' => $a->user['nickname'],
'lockstate' => (((is_array($a->user) && 'lockstate' => (is_array($a->user) &&
((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) ||
(strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'), strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
'default_perms' => ACL::getDefaultUserPermissions($a->user), 'default_perms' => ACL::getDefaultUserPermissions($a->user),
'acl' => ACL::getFullSelectorHTML($a->user, true), 'acl' => ACL::getFullSelectorHTML($a->user, true),
'bang' => '', 'bang' => '',
@ -574,9 +574,9 @@ function networkThreadedView(App $a, $update, $parent)
'allow_location' => $a->user['allow_location'], 'allow_location' => $a->user['allow_location'],
'default_location' => $a->user['default-location'], 'default_location' => $a->user['default-location'],
'nickname' => $a->user['nickname'], 'nickname' => $a->user['nickname'],
'lockstate' => ((($gid) || ($cid) || ($nets) || (is_array($a->user) && 'lockstate' => ($gid || $cid || $nets || (is_array($a->user) &&
((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) ||
(strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'), strlen($a->user['deny_cid']) || strlen($a->user['deny_gid']))) ? 'lock' : 'unlock'),
'default_perms' => ACL::getDefaultUserPermissions($a->user), 'default_perms' => ACL::getDefaultUserPermissions($a->user),
'acl' => ACL::getFullSelectorHTML($a->user, true, $default_permissions), 'acl' => ACL::getFullSelectorHTML($a->user, true, $default_permissions),
'bang' => (($gid || $cid || $nets) ? '!' : ''), 'bang' => (($gid || $cid || $nets) ? '!' : ''),

View file

@ -133,6 +133,10 @@ function notifications_content(App $a)
$notif_tpl = get_markup_template('notifications.tpl'); $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 // Process the data for template creation
if ($notifs['ident'] === 'introductions') { if ($notifs['ident'] === 'introductions') {
$sugg = get_markup_template('suggestions.tpl'); $sugg = get_markup_template('suggestions.tpl');

View file

@ -38,7 +38,7 @@ function removeme_post(App $a)
// send email to admins // send email to admins
$admin_mails = explode(",", str_replace(" ", "", Config::get('config', 'admin_email'))); $admin_mails = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
foreach ($admin_mails as $mail) { 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)) { if (!DBA::isResult($admin)) {
continue; 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.'), '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()), 'body' => L10n::t('The user id is %d', local_user()),
'to_email' => $admin['email'], 'to_email' => $admin['email'],
'to_name' => $admin['username'],
'uid' => $admin['uid'], 'uid' => $admin['uid'],
'language' => $admin['language'] ? $admin['language'] : 'en', 'language' => $admin['language'] ? $admin['language'] : 'en',
'show_in_notification_page' => false 'show_in_notification_page' => false

View file

@ -17,7 +17,7 @@ use Friendica\Core\System;
function viewcontacts_init(App $a) function viewcontacts_init(App $a)
{ {
if (Config::get('system', 'block_public') && !local_user() && !remote_user()) { if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
return; System::httpExit(403, ["title" => L10n::t('Access denied.')]);
} }
if ($a->argc < 2) { if ($a->argc < 2) {
@ -32,7 +32,7 @@ function viewcontacts_init(App $a)
); );
if (!DBA::isResult($r)) { if (!DBA::isResult($r)) {
return; System::httpExit(404, ["title" => L10n::t('Page not found.')]);
} }
$a->data['user'] = $r[0]; $a->data['user'] = $r[0];

View file

@ -12,6 +12,10 @@ use Friendica\Protocol\Salmon;
function xrd_init(App $a) function xrd_init(App $a)
{ {
if ($a->argv[0] == 'xrd') { if ($a->argv[0] == 'xrd') {
if (empty($_GET['uri'])) {
killme();
}
$uri = urldecode(notags(trim($_GET['uri']))); $uri = urldecode(notags(trim($_GET['uri'])));
if (defaults($_SERVER, 'HTTP_ACCEPT', '') == 'application/jrd+json') { if (defaults($_SERVER, 'HTTP_ACCEPT', '') == 'application/jrd+json') {
$mode = 'json'; $mode = 'json';
@ -19,6 +23,10 @@ function xrd_init(App $a)
$mode = 'xml'; $mode = 'xml';
} }
} else { } else {
if (empty($_GET['resource'])) {
killme();
}
$uri = urldecode(notags(trim($_GET['resource']))); $uri = urldecode(notags(trim($_GET['resource'])));
if (defaults($_SERVER, 'HTTP_ACCEPT', '') == 'application/xrd+xml') { if (defaults($_SERVER, 'HTTP_ACCEPT', '') == 'application/xrd+xml') {
$mode = '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) 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'), '$showall' => L10n::t('Visible to everybody'),
'$show' => L10n::t('show'), '$show' => L10n::t('show'),
'$hide' => L10n::t('don\'t show'), '$hide' => L10n::t('don\'t show'),
'$allowcid' => json_encode($default_permissions['allow_cid']), '$allowcid' => json_encode(defaults($default_permissions, 'allow_cid', '')),
'$allowgid' => json_encode($default_permissions['allow_gid']), '$allowgid' => json_encode(defaults($default_permissions, 'allow_gid', '')),
'$denycid' => json_encode($default_permissions['deny_cid']), '$denycid' => json_encode(defaults($default_permissions, 'deny_cid', '')),
'$denygid' => json_encode($default_permissions['deny_gid']), '$denygid' => json_encode(defaults($default_permissions, 'deny_gid', '')),
'$networks' => $show_jotnets, '$networks' => $show_jotnets,
'$emailcc' => L10n::t('CC: email addresses'), '$emailcc' => L10n::t('CC: email addresses'),
'$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'), '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
@ -324,7 +324,7 @@ class ACL extends BaseObject
*/ */
public static function contactAutocomplete($search, $mode) 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 []; return [];
} }

View file

@ -366,7 +366,7 @@ class Contact extends BaseObject
{ {
if (!isset($contact['url'])) { 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 // Contact already archived or "self" contact? => nothing to do