Browse Source

code standards + fixing navigation links to /contact/...

pull/5891/head
Jonny Tischbein 3 years ago
parent
commit
5fd4402074
  1. 6
      mod/allfriends.php
  2. 22
      mod/common.php
  3. 6
      mod/crepair.php
  4. 8
      mod/dirfind.php
  5. 6
      mod/group.php
  6. 18
      src/Module/Contact.php
  7. 4
      view/theme/frio/theme.php

6
mod/allfriends.php

@ -8,8 +8,8 @@ use Friendica\Content\ContactSelector;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model;\
use Friendica\Module\Contact;
use Friendica\Model;
use Friendica\Module;
use Friendica\Util\Proxy as ProxyUtils;
@ -95,7 +95,7 @@ function allfriends_content(App $a)
$entries[] = $entry;
}
$tab_str = Contact::getTabsHTML($a, $contact, 4);
$tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
$tpl = get_markup_template('viewcontact_template.tpl');

22
mod/common.php

@ -8,7 +8,7 @@ use Friendica\Content\ContactSelector;
use Friendica\Core\L10n;
use Friendica\Database\DBA;
use Friendica\Model;
use Friendica\Module\Contact;
use Friendica\Module;
use Friendica\Util\Proxy as ProxyUtils;
@ -41,7 +41,7 @@ function common_content(App $a)
if (DBA::isResult($contact)) {
$a->page['aside'] = "";
Model\Profile::load($a, "", 0,Model\Contact::getDetailsByURL($contact["url"]));
Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
}
} else {
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]);
@ -64,7 +64,7 @@ function common_content(App $a)
return;
}
if (!$cid &&Model\Profile::getMyURL()) {
if (!$cid && Model\Profile::getMyURL()) {
$contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Model\Profile::getMyURL()), 'uid' => $uid]);
if (DBA::isResult($contact)) {
$cid = $contact['id'];
@ -81,9 +81,9 @@ function common_content(App $a)
}
if ($cid) {
$t =Model\GContact::countCommonFriends($uid, $cid);
$t = Model\GContact::countCommonFriends($uid, $cid);
} else {
$t =Model\GContact::countCommonFriendsZcid($uid, $zcid);
$t = Model\GContact::countCommonFriendsZcid($uid, $zcid);
}
if ($t > 0) {
@ -94,9 +94,9 @@ function common_content(App $a)
}
if ($cid) {
$r =Model\GContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
$r = Model\GContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
} else {
$r =Model\GContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
$r = Model\GContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
}
if (!DBA::isResult($r)) {
@ -108,13 +108,13 @@ function common_content(App $a)
$entries = [];
foreach ($r as $rr) {
//get further details of the contact
$contact_details =Model\Contact::getDetailsByURL($rr['url'], $uid);
$contact_details = Model\Contact::getDetailsByURL($rr['url'], $uid);
// $rr['id'] is needed to use contact_photo_menu()
/// @TODO Adding '/" here avoids E_NOTICE on missing constants
$rr['id'] = $rr['cid'];
$photo_menu =Model\Contact::photoMenu($rr);
$photo_menu = Model\Contact::photoMenu($rr);
$entry = [
'url' => $rr['url'],
@ -125,7 +125,7 @@ function common_content(App $a)
'details' => $contact_details['location'],
'tags' => $contact_details['keywords'],
'about' => $contact_details['about'],
'account_type' =>Model\Contact::getAccountType($contact_details),
'account_type' => Model\Contact::getAccountType($contact_details),
'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
'photo_menu' => $photo_menu,
'id' => ++$id,
@ -136,7 +136,7 @@ function common_content(App $a)
$title = '';
$tab_str = '';
if ($cmd === 'loc' && $cid && local_user() == $uid) {
$tab_str = Contact::getTabsHTML($a, $contact, 4);
$tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
} else {
$title = L10n::t('Common Friends');
}

6
mod/crepair.php

@ -9,7 +9,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model;
use Friendica\Module\Contact;
use Friendica\Module;
function crepair_init(App $a)
{
@ -28,7 +28,7 @@ function crepair_init(App $a)
if (DBA::isResult($contact)) {
$a->data['contact'] = $contact;
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
Profile::load($a, "", 0, Module\Contact::getDetailsByURL($contact["url"]));
}
}
@ -133,7 +133,7 @@ function crepair_content(App $a)
$update_profile = in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]);
$tab_str = Contact::getTabsHTML($a, $contact, 5);
$tab_str = Module\Contact::getTabsHTML($a, $contact, 5);
$tpl = get_markup_template('crepair.tpl');
$o = replace_macros($tpl, [

8
mod/dirfind.php

@ -13,7 +13,7 @@ use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model;
use Friendica\Module\Contact;
use Friendica\Module;
use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact;
use Friendica\Util\Network;
@ -209,8 +209,8 @@ function dirfind_content(App $a, $prefix = "") {
$conntxt = "";
$contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
if (DBA::isResult($contact)) {
$photo_menu =Model\Contact::photoMenu($contact);
$details = Contact::getContactTemplateVars($contact);
$photo_menu = Model\Contact::photoMenu($contact);
$details = Module\Contact::getContactTemplateVars($contact);
$alt_text = $details['alt_text'];
} else {
$photo_menu = [];
@ -226,7 +226,7 @@ function dirfind_content(App $a, $prefix = "") {
$photo_menu = [];
}
$photo_menu['profile'] = [L10n::t("View Profile"), Contact::magicLink($jj->url)];
$photo_menu['profile'] = [L10n::t("View Profile"), Module\Contact::magicLink($jj->url)];
$photo_menu['follow'] = [L10n::t("Connect/Follow"), $connlnk];
}

6
mod/group.php

@ -12,7 +12,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model;
use Friendica\Module\Contact;
use Friendica\Module;
function group_init(App $a) {
if (local_user()) {
@ -249,7 +249,7 @@ function group_content(App $a) {
// Format the data of the group members
foreach ($members as $member) {
if ($member['url']) {
$entry = Contact::getContactTemplateVars($member);
$entry = Module\Contact::getContactTemplateVars($member);
$entry['label'] = 'members';
$entry['photo_menu'] = '';
$entry['change_member'] = [
@ -278,7 +278,7 @@ function group_content(App $a) {
// Format the data of the contacts who aren't in the contact group
foreach ($r as $member) {
if (!in_array($member['id'], $preselected)) {
$entry = Contact::getContactTemplateVars($member);
$entry = Module\Contact::getContactTemplateVars($member);
$entry['label'] = 'contacts';
if (!$nogroup)
$entry['photo_menu'] = [];

18
src/Module/Contact.php

@ -190,7 +190,7 @@ class Contact extends BaseModule
if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
notice(L10n::t('Could not access contact record.') . EOL);
goaway('contacts');
goaway('contact');
return; // NOTREACHED
}
@ -370,7 +370,7 @@ class Contact extends BaseModule
$a = self::getApp();
$sort_type = 0;
$o = '';
Nav::setSelected('contacts');
Nav::setSelected('contact');
if (!local_user()) {
notice(L10n::t('Permission denied.') . EOL);
@ -388,13 +388,13 @@ class Contact extends BaseModule
$orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'self' => false]);
if (!DBA::isResult($orig_record)) {
notice(L10n::t('Could not access contact record.') . EOL);
goaway('contacts');
goaway('contact');
return; // NOTREACHED
}
if ($cmd === 'update' && ($orig_record['uid'] != 0)) {
self::updateContactFromPoll($contact_id);
goaway('contacts/' . $contact_id);
goaway('contact/' . $contact_id);
// NOTREACHED
}
@ -410,7 +410,7 @@ class Contact extends BaseModule
$blocked = Model\Contact::isBlockedByUser($contact_id, local_user());
info(($blocked ? L10n::t('Contact has been blocked') : L10n::t('Contact has been unblocked')) . EOL);
goaway('contacts/' . $contact_id);
goaway('contact/' . $contact_id);
return; // NOTREACHED
}
@ -420,7 +420,7 @@ class Contact extends BaseModule
$ignored = Model\Contact::isIgnoredByUser($contact_id, local_user());
info(($ignored ? L10n::t('Contact has been ignored') : L10n::t('Contact has been unignored')) . EOL);
goaway('contacts/' . $contact_id);
goaway('contact/' . $contact_id);
return; // NOTREACHED
}
@ -431,7 +431,7 @@ class Contact extends BaseModule
info((($archived) ? L10n::t('Contact has been archived') : L10n::t('Contact has been unarchived')) . EOL);
}
goaway('contacts/' . $contact_id);
goaway('contact/' . $contact_id);
return; // NOTREACHED
}
@ -465,13 +465,13 @@ class Contact extends BaseModule
}
// Now check how the user responded to the confirmation query
if (defaults($_REQUEST, 'canceled')) {
goaway('contacts');
goaway('contact');
}
self::dropContact($orig_record);
info(L10n::t('Contact has been removed.') . EOL);
goaway('contacts');
goaway('contact');
return; // NOTREACHED
}
if ($cmd === 'posts') {

4
view/theme/frio/theme.php

@ -17,7 +17,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model;
use Friendica\Module\Contact;
use Friendica\Module;
$frio = 'view/theme/frio';
@ -333,7 +333,7 @@ function frio_acl_lookup(App $a, &$results)
if (DBA::isResult($r)) {
foreach ($r as $rr) {
$contacts[] = Model\Contact::getContactTemplateVars($rr);
$contacts[] = Module\Contact::getContactTemplateVars($rr);
}
}

Loading…
Cancel
Save