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

View File

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

View File

@ -10,6 +10,7 @@ use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Module\Contacts;
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]);
$tab_str = contacts_tab($a, $contact, 5);
$tab_str = Contacts::contacts_tab($a, $contact, 5);
$tpl = get_markup_template('crepair.tpl');
$o = replace_macros($tpl, [

View File

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

View File

@ -13,6 +13,7 @@ use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Module\Contacts;
function group_init(App $a) {
if (local_user()) {
@ -116,8 +117,6 @@ function group_content(App $a) {
$nogroup = false;
if (($a->argc == 2) && ($a->argv[1] === 'none')) {
require_once 'mod/contacts.php';
$id = -1;
$nogroup = true;
$group = [
@ -176,8 +175,6 @@ function group_content(App $a) {
}
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",
intval($a->argv[1]),
intval(local_user())
@ -253,7 +250,7 @@ function group_content(App $a) {
// Format the data of the group members
foreach ($members as $member) {
if ($member['url']) {
$entry = _contact_detail_for_template($member);
$entry = Contacts::_contact_detail_for_template($member);
$entry['label'] = 'members';
$entry['photo_menu'] = '';
$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
foreach ($r as $member) {
if (!in_array($member['id'], $preselected)) {
$entry = _contact_detail_for_template($member);
$entry = Contacts::_contact_detail_for_template($member);
$entry['label'] = 'contacts';
if (!$nogroup)
$entry['photo_menu'] = [];

View File

@ -5,8 +5,7 @@
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
require_once 'mod/contacts.php';
use Friendica\Module\Contacts;
function update_contacts_content(App $a)
{
@ -15,7 +14,7 @@ function update_contacts_content(App $a)
echo "<section>";
if ($_GET["force"] == 1) {
$text = contacts_content($a, true);
$text = Contacts::contacts_content($a, true);
} else {
$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\Database\DBA;
use Friendica\Model\Profile;
use Friendica\Module\Contacts;
$frio = 'view/theme/frio';
@ -297,8 +298,6 @@ function frio_remote_nav($a, &$nav)
*/
function frio_acl_lookup(App $a, &$results)
{
require_once 'mod/contacts.php';
$nets = x($_GET, 'nets') ? notags(trim($_GET['nets'])) : '';
// 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)) {
foreach ($r as $rr) {
$contacts[] = _contact_detail_for_template($rr);
$contacts[] = Contacts::_contact_detail_for_template($rr);
}
}