Move mod Contacts to /src/Module

This commit is contained in:
Jonny Tischbein 2018-10-11 23:14:12 +02:00
parent 735a5980bd
commit 80ea86113d
8 changed files with 1153 additions and 20 deletions

View File

@ -12,9 +12,9 @@ use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Module\Contacts;
require_once 'include/dba.php'; require_once 'include/dba.php';
require_once 'mod/contacts.php';
function allfriends_content(App $a) function allfriends_content(App $a)
{ {
@ -96,7 +96,7 @@ function allfriends_content(App $a)
$entries[] = $entry; $entries[] = $entry;
} }
$tab_str = contacts_tab($a, $contact, 4); $tab_str = Contacts::contacts_tab($a, $contact, 4);
$tpl = get_markup_template('viewcontact_template.tpl'); $tpl = get_markup_template('viewcontact_template.tpl');

View File

@ -11,9 +11,9 @@ use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Module\Contacts;
require_once 'include/dba.php'; require_once 'include/dba.php';
require_once 'mod/contacts.php';
function common_content(App $a) function common_content(App $a)
{ {
@ -137,7 +137,7 @@ function common_content(App $a)
$title = ''; $title = '';
$tab_str = ''; $tab_str = '';
if ($cmd === 'loc' && $cid && local_user() == $uid) { if ($cmd === 'loc' && $cid && local_user() == $uid) {
$tab_str = contacts_tab($a, $contact, 4); $tab_str = Contacts::contacts_tab($a, $contact, 4);
} else { } else {
$title = L10n::t('Common Friends'); $title = L10n::t('Common Friends');
} }

View File

@ -10,6 +10,7 @@ use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Module\Contacts;
require_once 'mod/contacts.php'; require_once 'mod/contacts.php';
@ -135,7 +136,7 @@ function crepair_content(App $a)
$update_profile = in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]); $update_profile = in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]);
$tab_str = contacts_tab($a, $contact, 5); $tab_str = Contacts::contacts_tab($a, $contact, 5);
$tpl = get_markup_template('crepair.tpl'); $tpl = get_markup_template('crepair.tpl');
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [

View File

@ -18,8 +18,7 @@ use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact; use Friendica\Protocol\PortableContact;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Module\Contacts;
require_once 'mod/contacts.php';
function dirfind_init(App $a) { function dirfind_init(App $a) {
@ -211,7 +210,7 @@ function dirfind_content(App $a, $prefix = "") {
$contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]); $contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
if (DBA::isResult($contact)) { if (DBA::isResult($contact)) {
$photo_menu = Contact::photoMenu($contact); $photo_menu = Contact::photoMenu($contact);
$details = _contact_detail_for_template($contact); $details = Contacts::_contact_detail_for_template($contact);
$alt_text = $details['alt_text']; $alt_text = $details['alt_text'];
} else { } else {
$photo_menu = []; $photo_menu = [];

View File

@ -13,6 +13,7 @@ use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Group; use Friendica\Model\Group;
use Friendica\Module\Contacts;
function group_init(App $a) { function group_init(App $a) {
if (local_user()) { if (local_user()) {
@ -116,8 +117,6 @@ function group_content(App $a) {
$nogroup = false; $nogroup = false;
if (($a->argc == 2) && ($a->argv[1] === 'none')) { if (($a->argc == 2) && ($a->argv[1] === 'none')) {
require_once 'mod/contacts.php';
$id = -1; $id = -1;
$nogroup = true; $nogroup = true;
$group = [ $group = [
@ -176,8 +175,6 @@ function group_content(App $a) {
} }
if (($a->argc > 1) && intval($a->argv[1])) { if (($a->argc > 1) && intval($a->argv[1])) {
require_once 'mod/contacts.php';
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1", $r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
@ -253,7 +250,7 @@ function group_content(App $a) {
// Format the data of the group members // Format the data of the group members
foreach ($members as $member) { foreach ($members as $member) {
if ($member['url']) { if ($member['url']) {
$entry = _contact_detail_for_template($member); $entry = Contacts::_contact_detail_for_template($member);
$entry['label'] = 'members'; $entry['label'] = 'members';
$entry['photo_menu'] = ''; $entry['photo_menu'] = '';
$entry['change_member'] = [ $entry['change_member'] = [
@ -282,7 +279,7 @@ function group_content(App $a) {
// Format the data of the contacts who aren't in the contact group // Format the data of the contacts who aren't in the contact group
foreach ($r as $member) { foreach ($r as $member) {
if (!in_array($member['id'], $preselected)) { if (!in_array($member['id'], $preselected)) {
$entry = _contact_detail_for_template($member); $entry = Contacts::_contact_detail_for_template($member);
$entry['label'] = 'contacts'; $entry['label'] = 'contacts';
if (!$nogroup) if (!$nogroup)
$entry['photo_menu'] = []; $entry['photo_menu'] = [];

View File

@ -5,8 +5,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Module\Contacts;
require_once 'mod/contacts.php';
function update_contacts_content(App $a) function update_contacts_content(App $a)
{ {
@ -15,7 +14,7 @@ function update_contacts_content(App $a)
echo "<section>"; echo "<section>";
if ($_GET["force"] == 1) { if ($_GET["force"] == 1) {
$text = contacts_content($a, true); $text = Contacts::contacts_content($a, true);
} else { } else {
$text = ''; $text = '';
} }

1138
src/Module/Contacts.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Module\Contacts;
$frio = 'view/theme/frio'; $frio = 'view/theme/frio';
@ -297,8 +298,6 @@ function frio_remote_nav($a, &$nav)
*/ */
function frio_acl_lookup(App $a, &$results) function frio_acl_lookup(App $a, &$results)
{ {
require_once 'mod/contacts.php';
$nets = x($_GET, 'nets') ? notags(trim($_GET['nets'])) : ''; $nets = x($_GET, 'nets') ? notags(trim($_GET['nets'])) : '';
// we introduce a new search type, r should do the same query like it's // we introduce a new search type, r should do the same query like it's
@ -334,7 +333,7 @@ function frio_acl_lookup(App $a, &$results)
if (DBA::isResult($r)) { if (DBA::isResult($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
$contacts[] = _contact_detail_for_template($rr); $contacts[] = Contacts::_contact_detail_for_template($rr);
} }
} }