diff --git a/include/api.php b/include/api.php
index 01cb93a3b8..ff763e9885 100644
--- a/include/api.php
+++ b/include/api.php
@@ -761,7 +761,7 @@ function api_get_user(App $a, $contact_id = null)
'statusnet_blocking' => false,
'notifications' => false,
/// @TODO old way?
- //'statusnet_profile_url' => System::baseUrl()."/contacts/".$uinfo[0]['cid'],
+ //'statusnet_profile_url' => System::baseUrl()."/contact/".$uinfo[0]['cid'],
'statusnet_profile_url' => $uinfo[0]['url'],
'uid' => intval($uinfo[0]['uid']),
'cid' => intval($uinfo[0]['cid']),
diff --git a/mod/crepair.php b/mod/crepair.php
index e5fb1e3347..14ed89afbc 100644
--- a/mod/crepair.php
+++ b/mod/crepair.php
@@ -11,8 +11,6 @@ use Friendica\Database\DBA;
use Friendica\Model;
use Friendica\Module\Contact;
-require_once 'mod/contacts.php';
-
function crepair_init(App $a)
{
if (!local_user()) {
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index 969e2286c8..48ce3c6aa6 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -400,7 +400,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
// Let's send our user to the contact editor in case they want to
// do anything special with this new friend.
if ($handsfree === null) {
- goaway(System::baseUrl() . '/contacts/' . intval($contact_id));
+ goaway(System::baseUrl() . '/contact/' . intval($contact_id));
} else {
return;
}
@@ -604,7 +604,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
'to_name' => $combined['username'],
'to_email' => $combined['email'],
'uid' => $combined['uid'],
- 'link' => System::baseUrl() . '/contacts/' . $dfrn_record,
+ 'link' => System::baseUrl() . '/contact/' . $dfrn_record,
'source_name' => ((strlen(stripslashes($combined['name']))) ? stripslashes($combined['name']) : L10n::t('[Name Withheld]')),
'source_link' => $combined['url'],
'source_photo' => $combined['photo'],
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index e611458281..67db2c6285 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -173,9 +173,9 @@ function dfrn_request_post(App $a)
Contact::updateAvatar($photo, local_user(), $r[0]["id"], true);
}
- $forwardurl = System::baseUrl() . "/contacts/" . $r[0]['id'];
+ $forwardurl = System::baseUrl() . "/contact/" . $r[0]['id'];
} else {
- $forwardurl = System::baseUrl() . "/contacts";
+ $forwardurl = System::baseUrl() . "/contact";
}
// Allow the blocked remote notification to complete
diff --git a/mod/group.php b/mod/group.php
index ec4ee4da2b..962697c24f 100644
--- a/mod/group.php
+++ b/mod/group.php
@@ -54,7 +54,7 @@ function group_post(App $a) {
);
if (!DBA::isResult($r)) {
notice(L10n::t('Group not found.') . EOL);
- goaway(System::baseUrl() . '/contacts');
+ goaway(System::baseUrl() . '/contact');
return; // NOTREACHED
}
$group = $r[0];
@@ -181,7 +181,7 @@ function group_content(App $a) {
if (!DBA::isResult($r)) {
notice(L10n::t('Group not found.') . EOL);
- goaway(System::baseUrl() . '/contacts');
+ goaway(System::baseUrl() . '/contact');
}
$group = $r[0];
diff --git a/mod/newmember.php b/mod/newmember.php
index b3bf310d5b..cd59cc780c 100644
--- a/mod/newmember.php
+++ b/mod/newmember.php
@@ -36,13 +36,13 @@ function newmember_content(App $a)
$o .= '
' . '' . L10n::t('Importing Emails') . '
' . L10n::t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '' . EOL;
}
- $o .= '' . '' . L10n::t('Go to Your Contacts Page') . '
' . L10n::t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the Add New Contact dialog.') . '' . EOL;
+ $o .= '' . '' . L10n::t('Go to Your Contacts Page') . '
' . L10n::t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the Add New Contact dialog.') . '' . EOL;
$o .= '' . '' . L10n::t("Go to Your Site's Directory") . '
' . L10n::t('The Directory page lets you find other people in this network or other federated sites. Look for a Connect or Follow link on their profile page. Provide your own Identity Address if requested.') . '' . EOL;
- $o .= '' . '' . L10n::t('Finding New People') . '
' . L10n::t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '' . EOL;
+ $o .= '' . '' . L10n::t('Finding New People') . '
' . L10n::t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '' . EOL;
$o .= '';
$o .= '' . L10n::t('Groups') . '
';
$o .= '';
- $o .= '- ' . '' . L10n::t('Group Your Contacts') . '
' . L10n::t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . ' ' . EOL;
+ $o .= '- ' . '' . L10n::t('Group Your Contacts') . '
' . L10n::t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . ' ' . EOL;
if (Config::get('system', 'newuser_private')) {
$o .= '- ' . '' . L10n::t("Why Aren't My Posts Public?") . '
' . L10n::t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . ' ' . EOL;
diff --git a/src/Content/Nav.php b/src/Content/Nav.php
index 7a1a149a2f..4f6f4ae0b9 100644
--- a/src/Content/Nav.php
+++ b/src/Content/Nav.php
@@ -210,7 +210,7 @@ class Nav
$nav['profiles'] = ['profiles', L10n::t('Profiles'), '', L10n::t('Manage/Edit Profiles')];
}
- $nav['contacts'] = ['contacts', L10n::t('Contacts'), '', L10n::t('Manage/edit friends and contacts')];
+ $nav['contacts'] = ['contact', L10n::t('Contacts'), '', L10n::t('Manage/edit friends and contacts')];
}
// Show the link to the admin configuration page if user is admin
diff --git a/src/Model/Contact.php b/src/Model/Contact.php
index 23c31d0b17..1dd84e0037 100644
--- a/src/Model/Contact.php
+++ b/src/Model/Contact.php
@@ -923,12 +923,12 @@ class Contact extends BaseObject
$poke_link = System::baseUrl() . '/poke/?f=&c=' . $contact['id'];
}
- $contact_url = System::baseUrl() . '/contacts/' . $contact['id'];
+ $contact_url = System::baseUrl() . '/contact/' . $contact['id'];
- $posts_link = System::baseUrl() . '/contacts/' . $contact['id'] . '/conversations';
+ $posts_link = System::baseUrl() . '/contact/' . $contact['id'] . '/conversations';
if (!$contact['self']) {
- $contact_drop_link = System::baseUrl() . '/contacts/' . $contact['id'] . '/drop?confirm=1';
+ $contact_drop_link = System::baseUrl() . '/contact/' . $contact['id'] . '/drop?confirm=1';
}
/**
diff --git a/src/Module/Contact.php b/src/Module/Contact.php
index eb21b3b3e1..07b7c907da 100644
--- a/src/Module/Contact.php
+++ b/src/Module/Contact.php
@@ -14,10 +14,7 @@ use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
-use Friendica\Model\Contact;
-use Friendica\Model\GContact;
-use Friendica\Model\Group;
-use Friendica\Model\Profile;
+use Friendica\Model;
use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
@@ -85,11 +82,11 @@ class Contact extends BaseModule
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
'$name' => htmlentities($a->data['contact']['name']),
'$photo' => $a->data['contact']['photo'],
- '$url' => Contact::MagicLink($a->data['contact']['url']),
+ '$url' => Model\Contact::MagicLink($a->data['contact']['url']),
'$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""),
'$network_name' => $networkname,
'$network' => L10n::t('Network:'),
- '$account_type' => Contact::getAccountType($a->data['contact'])
+ '$account_type' => Model\Contact::getAccountType($a->data['contact'])
]);
$findpeople_widget = '';
@@ -108,7 +105,7 @@ class Contact extends BaseModule
}
if ($contact['uid'] != 0) {
- $groups_widget = Group::sidebarWidget('contacts', 'group', 'full', 'everyone', $contact_id);
+ $groups_widget = Model\Group::sidebarWidget('contacts', 'group', 'full', 'everyone', $contact_id);
} else {
$groups_widget = null;
}
@@ -121,7 +118,7 @@ class Contact extends BaseModule
'$networks_widget' => $networks_widget
]);
- $base = System::baseUrl();
+ $base = $a->getBaseURL();
$tpl = get_markup_template("contacts-head.tpl");
$a->page['htmlhead'] .= replace_macros($tpl, [
'$baseurl' => System::baseUrl(true),
@@ -137,33 +134,31 @@ class Contact extends BaseModule
$contacts_id = $_POST['contact_batch'];
- $orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0",
- implode(",", $contacts_id),
- intval(local_user())
- );
-
+ $stmt = DBA::select('contact', ['id'], ['id' => $contacts_id, 'id' => local_user(), 'self' => false]);
+ $orig_records = DBA::toArray($stmt);
+
$count_actions = 0;
foreach ($orig_records as $orig_record) {
$contact_id = $orig_record['id'];
- if (x($_POST, 'contacts_batch_update')) {
+ if (defaults($_POST, 'contacts_batch_update')) {
self::updateContactFromPoll($contact_id);
$count_actions++;
}
- if (x($_POST, 'contacts_batch_block')) {
+ if (defaults($_POST, 'contacts_batch_block')) {
self::blockContact($contact_id);
$count_actions++;
}
- if (x($_POST, 'contacts_batch_ignore')) {
+ if (defaults($_POST, 'contacts_batch_ignore')) {
self::ignoreContact($contact_id);
$count_actions++;
}
- if (x($_POST, 'contacts_batch_archive')) {
+ if (defaults($_POST, 'contacts_batch_archive')) {
$r = self::archiveContact($contact_id, $orig_record);
if ($r) {
$count_actions++;
}
}
- if (x($_POST, 'contacts_batch_drop')) {
+ if (defaults($_POST, 'contacts_batch_drop')) {
self::dropContact($orig_record);
$count_actions++;
}
@@ -172,7 +167,7 @@ class Contact extends BaseModule
info(L10n::tt("%d contact edited.", "%d contacts edited.", $count_actions));
}
- goaway('contacts');
+ goaway('contact');
}
public static function post()
@@ -209,9 +204,9 @@ class Contact extends BaseModule
}
}
- $hidden = intval($_POST['hidden']);
+ $hidden = defaults($_POST['hidden']);
- $notify = intval($_POST['notify']);
+ $notify = defaults($_POST['notify']);
$fetch_further_information = intval(defaults($_POST, 'fetch_further_information', 0));
@@ -224,19 +219,16 @@ class Contact extends BaseModule
$info = escape_tags(trim($_POST['info']));
- $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
- `hidden` = %d, `notify_new_posts` = %d, `fetch_further_information` = %d,
- `ffi_keyword_blacklist` = '%s' WHERE `id` = %d AND `uid` = %d",
- intval($profile_id),
- intval($priority),
- DBA::escape($info),
- intval($hidden),
- intval($notify),
- intval($fetch_further_information),
- DBA::escape($ffi_keyword_blacklist),
- intval($contact_id),
- intval(local_user())
- );
+ $r = DBA::update('contact',
+ ['profile-id' => $profile_id,
+ 'priority' => $priority,
+ 'info' => $info,
+ 'hidden' => $hidden,
+ 'notify_new_posts' => $notify,
+ 'fetch_further_information' => $fetch_further_information,
+ 'ffi_keyword_blacklist' => $ffi_keyword_blacklist],
+ ['id' => $contact_id, 'uid' => local_user()]);
+
if (DBA::isResult($r)) {
info(L10n::t('Contact updated.') . EOL);
} else {
@@ -263,10 +255,10 @@ class Contact extends BaseModule
$uid = $contact["uid"];
if ($contact["network"] == Protocol::OSTATUS) {
- $result = Contact::createFromProbe($uid, $contact["url"], false, $contact["network"]);
+ $result = Model\Contact::createFromProbe($uid, $contact["url"], false, $contact["network"]);
if ($result['success']) {
- q("UPDATE `contact` SET `subhub` = 1 WHERE `id` = %d", intval($contact_id));
+ DBA::update('contact', ['subhub' => 1], ['id' => $contact_id]);
}
} else {
// pull feed and consume it, which should subscribe to the hub.
@@ -295,7 +287,7 @@ class Contact extends BaseModule
$update = [];
if ($data["network"] == Protocol::OSTATUS) {
- $result = Contact::createFromProbe($uid, $data["url"], false);
+ $result = Model\Contact::createFromProbe($uid, $data["url"], false);
if ($result['success']) {
$update["subhub"] = true;
@@ -313,7 +305,7 @@ class Contact extends BaseModule
$query = "";
if (isset($data["priority"]) && ($data["priority"] != 0)) {
- $query = "`priority` = " . intval($data["priority"]);
+ $query = "'priority' => '" . intval($data["priority"]) . "'";
}
foreach ($update AS $key => $value) {
@@ -321,45 +313,39 @@ class Contact extends BaseModule
$query .= ", ";
}
- $query .= "`" . $key . "` = '" . DBA::escape($value) . "'";
+ $query .= "'" . $key . "' => '" . DBA::escape($value) . "'";
}
if ($query == "") {
return;
}
- $r = q("UPDATE `contact` SET $query WHERE `id` = %d AND `uid` = %d",
- intval($contact_id),
- intval(local_user())
- );
+ $r = DBA::update('contact', $query, ['id' => $contact_id, 'uid' => local_user()]);
// Update the entry in the contact table
- Contact::updateAvatar($data['photo'], local_user(), $contact_id, true);
+ Model\Contact::updateAvatar($data['photo'], local_user(), $contact_id, true);
// Update the entry in the gcontact table
- GContact::updateFromProbe($data["url"]);
+ Model\GContact::updateFromProbe($data["url"]);
}
private static function blockContact($contact_id)
{
- $blocked = !Contact::isBlockedByUser($contact_id, local_user());
- Contact::setBlockedForUser($contact_id, local_user(), $blocked);
+ $blocked = !Model\Contact::isBlockedByUser($contact_id, local_user());
+ Model\Contact::setBlockedForUser($contact_id, local_user(), $blocked);
}
private static function ignoreContact($contact_id)
{
- $ignored = !Contact::isIgnoredByUser($contact_id, local_user());
- Contact::setIgnoredForUser($contact_id, local_user(), $ignored);
+ $ignored = !Model\Contact::isIgnoredByUser($contact_id, local_user());
+ Model\Contact::setIgnoredForUser($contact_id, local_user(), $ignored);
}
private static function archiveContact($contact_id, $orig_record)
{
$archived = (($orig_record['archive']) ? 0 : 1);
- $r = q("UPDATE `contact` SET `archive` = %d WHERE `id` = %d AND `uid` = %d",
- intval($archived),
- intval($contact_id),
- intval(local_user())
- );
+ $r = DBA::update('contact', ['archive' => $archived], ['id' => $contact_id, 'uid' => local_user()]);
+
return DBA::isResult($r);
}
@@ -375,8 +361,8 @@ class Contact extends BaseModule
return;
}
- Contact::terminateFriendship($r[0], $orig_record, true);
- Contact::remove($orig_record['id']);
+ Model\Contact::terminateFriendship($r[0], $orig_record, true);
+ Model\Contact::remove($orig_record['id']);
}
public static function content($update = 0)
@@ -421,7 +407,7 @@ class Contact extends BaseModule
if ($cmd === 'block') {
self::blockContact($contact_id);
- $blocked = Contact::isBlockedByUser($contact_id, local_user());
+ $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);
@@ -431,7 +417,7 @@ class Contact extends BaseModule
if ($cmd === 'ignore') {
self::ignoreContact($contact_id);
- $ignored = Contact::isIgnoredByUser($contact_id, local_user());
+ $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);
@@ -451,7 +437,7 @@ class Contact extends BaseModule
if ($cmd === 'drop' && ($orig_record['uid'] != 0)) {
// Check if we should do HTML-based delete confirmation
- if (x($_REQUEST, 'confirm')) {
+ if (defaults($_REQUEST, 'confirm')) {
//