X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FContact.php;h=020e3906a0297edf7e741bdc9cc20a666babe285;hb=8632c903276c44d575076ac3167e3bc7ea64bd31;hp=f7c6680ed4592ccccb2356e378e0aa695175471b;hpb=e944d7bed6b971494bff82396960d280e6a82cca;p=friendica.git diff --git a/src/Module/Contact.php b/src/Module/Contact.php index f7c6680ed4..020e3906a0 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -11,10 +11,8 @@ use Friendica\Content\Text\BBCode; use Friendica\Content\Widget; use Friendica\Core\ACL; use Friendica\Core\Hook; -use Friendica\Core\L10n; use Friendica\Core\Protocol; use Friendica\Core\Renderer; -use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; @@ -28,8 +26,6 @@ use Friendica\Util\Strings; /** * Manages and show Contacts and their content - * - * @brief manages contacts */ class Contact extends BaseModule { @@ -70,7 +66,7 @@ class Contact extends BaseModule } } if ($count_actions > 0) { - info(L10n::tt('%d contact edited.', '%d contacts edited.', $count_actions)); + info(DI::l10n()->tt('%d contact edited.', '%d contacts edited.', $count_actions)); } DI::baseUrl()->redirect('contact'); @@ -97,21 +93,13 @@ class Contact extends BaseModule } if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false])) { - notice(L10n::t('Could not access contact record.') . EOL); + notice(DI::l10n()->t('Could not access contact record.') . EOL); DI::baseUrl()->redirect('contact'); return; // NOTREACHED } Hook::callAll('contact_edit_post', $_POST); - $profile_id = intval($_POST['profile-assign'] ?? 0); - if ($profile_id) { - if (!DBA::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) { - notice(L10n::t('Could not locate selected profile.') . EOL); - return; - } - } - $hidden = !empty($_POST['hidden']); $notify = !empty($_POST['notify']); @@ -128,7 +116,6 @@ class Contact extends BaseModule $info = Strings::escapeHtml(trim($_POST['info'] ?? '')); $r = DBA::update('contact', [ - 'profile-id' => $profile_id, 'priority' => $priority, 'info' => $info, 'hidden' => $hidden, @@ -139,9 +126,9 @@ class Contact extends BaseModule ); if (DBA::isResult($r)) { - info(L10n::t('Contact updated.') . EOL); + info(DI::l10n()->t('Contact updated.') . EOL); } else { - notice(L10n::t('Failed to update contact record.') . EOL); + notice(DI::l10n()->t('Failed to update contact record.') . EOL); } $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false]); @@ -249,11 +236,13 @@ class Contact extends BaseModule $a = DI::app(); - $nets = $_GET['nets'] ?? ''; - $rel = $_GET['rel'] ?? ''; + $search = Strings::escapeTags(trim($_GET['search'] ?? '')); + $nets = Strings::escapeTags(trim($_GET['nets'] ?? '')); + $rel = Strings::escapeTags(trim($_GET['rel'] ?? '')); + $group = Strings::escapeTags(trim($_GET['group'] ?? '')); - if (empty($a->page['aside'])) { - $a->page['aside'] = ''; + if (empty(DI::page()['aside'])) { + DI::page()['aside'] = ''; } $contact_id = null; @@ -281,7 +270,7 @@ class Contact extends BaseModule if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) { DI::baseUrl()->redirect('profile/' . $contact['nick']); } else { - DI::baseUrl()->redirect('profile/' . $contact['nick'] . '?tab=profile'); + DI::baseUrl()->redirect('profile/' . $contact['nick'] . '/profile'); } } @@ -314,13 +303,13 @@ class Contact extends BaseModule '$url' => Model\Contact::magicLinkByContact($contact, $contact['url']), '$addr' => $contact['addr'] ?? '', '$network_link' => $network_link, - '$network' => L10n::t('Network:'), + '$network' => DI::l10n()->t('Network:'), '$account_type' => Model\Contact::getAccountType($contact), - '$follow' => L10n::t('Follow'), + '$follow' => DI::l10n()->t('Follow'), '$follow_link' => $follow_link, - '$unfollow' => L10n::t('Unfollow'), + '$unfollow' => DI::l10n()->t('Unfollow'), '$unfollow_link' => $unfollow_link, - '$wallmessage' => L10n::t('Message'), + '$wallmessage' => DI::l10n()->t('Message'), '$wallmessage_link' => $wallmessage_link, ]); @@ -328,6 +317,12 @@ class Contact extends BaseModule $follow_widget = ''; $networks_widget = ''; $rel_widget = ''; + + if ($contact['uid'] != 0) { + $groups_widget = Model\Group::sidebarWidget('contact', 'group', 'full', 'everyone', $contact_id); + } else { + $groups_widget = ''; + } } else { $vcard_widget = ''; $findpeople_widget = Widget::findPeople(); @@ -339,27 +334,21 @@ class Contact extends BaseModule $networks_widget = Widget::networks($_SERVER['REQUEST_URI'], $nets); $rel_widget = Widget::contactRels($_SERVER['REQUEST_URI'], $rel); + $groups_widget = Widget::groups($_SERVER['REQUEST_URI'], $group); } - if ($contact['uid'] != 0) { - $groups_widget = Model\Group::sidebarWidget('contact', 'group', 'full', 'everyone', $contact_id); - } else { - $groups_widget = null; - } - - $a->page['aside'] .= $vcard_widget . $findpeople_widget . $follow_widget . $groups_widget . $networks_widget . $rel_widget; + DI::page()['aside'] .= $vcard_widget . $findpeople_widget . $follow_widget . $groups_widget . $networks_widget . $rel_widget; $tpl = Renderer::getMarkupTemplate('contacts-head.tpl'); - $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ + DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => DI::baseUrl()->get(true), ]); - $sort_type = 0; $o = ''; Nav::setSelected('contact'); if (!local_user()) { - notice(L10n::t('Permission denied.') . EOL); + notice(DI::l10n()->t('Permission denied.') . EOL); return Login::form(); } @@ -374,7 +363,7 @@ class Contact extends BaseModule $orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'self' => false, 'deleted' => false]); if (!DBA::isResult($orig_record)) { - throw new NotFoundException(L10n::t('Contact not found')); + throw new NotFoundException(DI::l10n()->t('Contact not found')); } if ($cmd === 'update' && ($orig_record['uid'] != 0)) { @@ -385,7 +374,7 @@ class Contact extends BaseModule if ($cmd === 'updateprofile' && ($orig_record['uid'] != 0)) { self::updateContactFromProbe($contact_id); - DI::baseUrl()->redirect('crepair/' . $contact_id); + DI::baseUrl()->redirect('contact/' . $contact_id . '/advanced/'); // NOTREACHED } @@ -393,7 +382,7 @@ class Contact extends BaseModule self::blockContact($contact_id); $blocked = Model\Contact::isBlockedByUser($contact_id, local_user()); - info(($blocked ? L10n::t('Contact has been blocked') : L10n::t('Contact has been unblocked')) . EOL); + info(($blocked ? DI::l10n()->t('Contact has been blocked') : DI::l10n()->t('Contact has been unblocked')) . EOL); DI::baseUrl()->redirect('contact/' . $contact_id); // NOTREACHED @@ -403,7 +392,7 @@ class Contact extends BaseModule self::ignoreContact($contact_id); $ignored = Model\Contact::isIgnoredByUser($contact_id, local_user()); - info(($ignored ? L10n::t('Contact has been ignored') : L10n::t('Contact has been unignored')) . EOL); + info(($ignored ? DI::l10n()->t('Contact has been ignored') : DI::l10n()->t('Contact has been unignored')) . EOL); DI::baseUrl()->redirect('contact/' . $contact_id); // NOTREACHED @@ -413,7 +402,7 @@ class Contact extends BaseModule $r = self::archiveContact($contact_id, $orig_record); if ($r) { $archived = (($orig_record['archive']) ? 0 : 1); - info((($archived) ? L10n::t('Contact has been archived') : L10n::t('Contact has been unarchived')) . EOL); + info((($archived) ? DI::l10n()->t('Contact has been archived') : DI::l10n()->t('Contact has been unarchived')) . EOL); } DI::baseUrl()->redirect('contact/' . $contact_id); @@ -425,7 +414,7 @@ class Contact extends BaseModule if (!empty($_REQUEST['confirm'])) { //