]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #5920 from MrPetovan/bug/remove-password-from-register
authorMichael Vogel <icarus@dabo.de>
Wed, 17 Oct 2018 19:04:11 +0000 (21:04 +0200)
committerGitHub <noreply@github.com>
Wed, 17 Oct 2018 19:04:11 +0000 (21:04 +0200)
Avoid storing plaintext password in register table

51 files changed:
INSTALL.txt
boot.php
config/dbstructure.json
database.sql
doc/Install.md
doc/de/Install.md
include/api.php
include/conversation.php
include/enotify.php
mod/admin.php
mod/allfriends.php
mod/babel.php
mod/common.php
mod/contacts.php [deleted file]
mod/crepair.php
mod/dfrn_confirm.php
mod/dfrn_request.php
mod/dirfind.php
mod/editpost.php
mod/group.php
mod/newmember.php
mod/parse_url.php
mod/update_contacts.php
src/Content/Nav.php
src/Content/Text/BBCode.php
src/Core/Worker.php
src/Database/DBStructure.php
src/Model/Contact.php
src/Model/Group.php
src/Model/Item.php
src/Model/Profile.php
src/Module/Contact.php [new file with mode: 0644]
src/Network/Probe.php
src/Object/Post.php
src/Protocol/ActivityPub/Processor.php
src/Protocol/ActivityPub/Receiver.php
src/Protocol/Diaspora.php
src/Util/ParseUrl.php
src/Util/Temporal.php
src/Worker/Delivery.php
src/Worker/OnePoll.php
update.php
util/messages.po
view/templates/contact_edit.tpl
view/templates/contacts-template.tpl
view/templates/crepair.tpl
view/theme/frio/templates/contact_edit.tpl
view/theme/frio/templates/contacts-template.tpl
view/theme/frio/templates/crepair.tpl
view/theme/frio/theme.php
view/theme/vier/templates/contact_edit.tpl

index 705eb8fed2fe90a6f944b615394044b90d944bbe..2f0613fb7d222843883293ce7473e8266bc41b5f 100644 (file)
@@ -56,6 +56,13 @@ you wish to communicate with the Diaspora network.
        - For alternative server configurations (such as Nginx server and MariaDB
        database engine), refer to the wiki at https://github.com/friendica/friendica/wiki
 
+This guide will walk you through the manual installation process of Friendica.
+If this is nothing for you, you might be interested in
+
+* the Friendica Docker image (https://github.com/friendica/docker) or
+* how install Friendica with YunoHost (https://github.com/YunoHost-Apps/friendica_ynh).
+
+
 2. Unpack the Friendica files into the root of your web server document area.
 
        - If you copy the directory tree to your webserver, make sure
index 2433143ddbd5224a88b2370d98dedbc619398b0b..acbc737658c2a8d4aef307aee52092abc74c7008 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -41,7 +41,7 @@ define('FRIENDICA_PLATFORM',     'Friendica');
 define('FRIENDICA_CODENAME',     'The Tazmans Flax-lily');
 define('FRIENDICA_VERSION',      '2018.12-dev');
 define('DFRN_PROTOCOL_VERSION',  '2.23');
-define('DB_UPDATE_VERSION',      1284);
+define('DB_UPDATE_VERSION',      1288);
 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
 
 /**
index 8f676861569d3fd89e67c8b851fc31b28227d26c..da1da7a66b1a295242db1cf7aaa4ff2af39765c2 100644 (file)
                        "hidden": {"type": "boolean", "not null": "1", "default": "0", "comment": ""},
                        "archive": {"type": "boolean", "not null": "1", "default": "0", "comment": ""},
                        "pending": {"type": "boolean", "not null": "1", "default": "1", "comment": ""},
+                       "deleted": {"type": "boolean", "not null": "1", "default": "0", "comment": "Contact has been deleted"},
                        "rating": {"type": "tinyint", "not null": "1", "default": "0", "comment": ""},
                        "reason": {"type": "text", "comment": ""},
                        "closeness": {"type": "tinyint unsigned", "not null": "1", "default": "99", "comment": ""},
                        "received": ["received"]
                }
        },
+       "diaspora-interaction": {
+               "comment": "Signed Diaspora Interaction",
+               "fields": {
+                       "uri-id": {"type": "int unsigned", "not null": "1", "primary": "1", "relation": {"item-uri": "id"}, "comment": "Id of the item-uri table entry that contains the item uri"},
+                       "interaction": {"type": "mediumtext", "comment": "The Diaspora interaction"}
+               },
+               "indexes": {
+                       "PRIMARY": ["uri-id"]
+               }
+       },
        "event": {
                "comment": "Events",
                "fields": {
                "indexes": {
                        "PRIMARY": ["id"],
                        "uri-hash": ["UNIQUE", "uri-hash"],
-                       "uri": ["uri(191)"]
+                       "uri": ["uri(191)"],
+                       "uri-id": ["uri-id"]
                }
        },
        "item-content": {
                "indexes": {
                        "PRIMARY": ["id"],
                        "uri-plink-hash": ["UNIQUE", "uri-plink-hash"],
-                       "uri": ["uri(191)"]
+                       "uri": ["uri(191)"],
+                       "uri-id": ["uri-id"]
                }
        },
        "item-delivery-data": {
                        "created": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": "Creation date"},
                        "pid": {"type": "int unsigned", "not null": "1", "default": "0", "comment": "Process id of the worker"},
                        "executed": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": "Execution date"},
+                       "next_try": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": "Next retrial date"},
+                       "retrial": {"type": "tinyint", "not null": "1", "default": "0", "comment": "Retrial counter"},
                        "done": {"type": "boolean", "not null": "1", "default": "0", "comment": "Marked 1 when the task was done - will be deleted later"}
                },
                "indexes": {
                        "PRIMARY": ["id"],
                        "pid": ["pid"],
                        "parameter": ["parameter(64)"],
-                       "priority_created": ["priority", "created"],
-                       "done_executed": ["done", "executed"]
+                       "priority_created_next_try": ["priority", "created", "next_try"],
+                       "done_executed_next_try": ["done", "executed", "next_try"]
                }
        }
 }
index a797c8df361b260e2f512a0bb2c7eb6120f34fcb..2f67a341cccda89eec4d1bea3d507abc93ba141a 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2018.12-dev (The Tazmans Flax-lily)
--- DB_UPDATE_VERSION 1284
+-- DB_UPDATE_VERSION 1287
 -- ------------------------------------------
 
 
@@ -189,6 +189,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
        `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
        `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
        `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
+       `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'Contact has been deleted',
        `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
        `reason` text COMMENT '',
        `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
@@ -246,6 +247,15 @@ CREATE TABLE IF NOT EXISTS `conversation` (
         INDEX `received` (`received`)
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
 
+--
+-- TABLE diaspora-interaction
+--
+CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
+       `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
+       `interaction` mediumtext COMMENT 'The Diaspora interaction',
+        PRIMARY KEY(`uri-id`)
+) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
+
 --
 -- TABLE event
 --
@@ -1241,12 +1251,14 @@ CREATE TABLE IF NOT EXISTS `workerqueue` (
        `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
        `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
        `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
+       `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
+       `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
        `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
         PRIMARY KEY(`id`),
         INDEX `pid` (`pid`),
         INDEX `parameter` (`parameter`(64)),
-        INDEX `priority_created` (`priority`,`created`),
-        INDEX `done_executed` (`done`,`executed`)
+        INDEX `priority_created_next_try` (`priority`,`created`,`next_try`),
+        INDEX `done_executed_next_try` (`done`,`executed`,`next_try`)
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
 
 
index 427299c3ea6dbd07197263d6850dd3e7cb4f4267..e6d1d40645a5386e0ef94f2dd218855cd2bc776e 100644 (file)
@@ -40,6 +40,14 @@ Requirements
 Installation procedure
 ---
 
+### Alternative Installation Methods
+
+This guide will walk you through the manual installation process of Friendica.
+If this is nothing for you, you might be interested in
+
+* the [Friendica Docker image](https://github.com/friendica/docker) or
+* how [install Friendica with YunoHost](https://github.com/YunoHost-Apps/friendica_ynh).
+
 ### Get Friendica
 
 Unpack the Friendica files into the root of your web server document area.
index 84d9a0d48ef49773d5479f38ae2a740e339c9790..132fbc19041a13fd4227d31df45818c243268dee 100644 (file)
@@ -40,6 +40,14 @@ Requirements
 Installation
 ---
 
+### Alternative Wege um Friendica zu Installieren
+
+Diese Anleitung wird dir Schritt-für-Schritt zeigen wie du Friendica auf deinem Server installieren kannst.
+Falls du an automatischen Möglichkeiten interesse hast, wirf doch einen Blick auf
+
+* das [Docker image für Friendica](https://github.com/friendica/docker) oder
+* die [Installation von Friendica auf YunoHost](https://github.com/YunoHost-Apps/friendica_ynh).
+
 ### Friendica
 
 Entpacke die Friendica-Daten in das Quellverzeichnis (root) des Dokumentenbereichs deines Webservers.
index 01cb93a3b8226f5f7940733a6502ac74e6470b8a..ff763e98855c36bb0199fbc86ab7ce67b992a0c0 100644 (file)
@@ -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']),
index 43854bb40f7b7e8d1486edb47d41e3a092fa7063..31920c2fcb163e4e7864cace513afa8148ce4cfe 100644 (file)
@@ -853,8 +853,8 @@ function item_photo_menu($item) {
 
        if ($cid && !$item['self']) {
                $poke_link = 'poke/?f=&c=' . $cid;
-               $contact_url = 'contacts/' . $cid;
-               $posts_link = 'contacts/' . $cid . '/posts';
+               $contact_url = 'contact/' . $cid;
+               $posts_link = 'contact/' . $cid . '/posts';
 
                if (in_array($network, [Protocol::DFRN, Protocol::DIASPORA])) {
                        $pm_url = 'message/new/' . $cid;
index 882227e941d0d98f68239035ce8f42602ec8faad..6d8cef87947194eea4f23aeb15e68be772cf0d99 100644 (file)
@@ -42,9 +42,9 @@ function notification($params)
        }
 
        $params['notify_flags'] = defaults($params, 'notify_flags', $user['notify-flags']);
-       $params['language'] = defaults($params, 'language', $user['language']);
-       $params['to_name'] = defaults($params, 'to_name', $user['username']);
-       $params['to_email'] = defaults($params, 'to_email', $user['email']);
+       $params['language']     = defaults($params, 'language'    , $user['language']);
+       $params['to_name']      = defaults($params, 'to_name'     , $user['username']);
+       $params['to_email']     = defaults($params, 'to_email'    , $user['email']);
 
        // from here on everything is in the recipients language
        L10n::pushLang($params['language']);
index 6189c4cb770bfc32eeea2672986abc3bbf5d7636..b0fb6d47262a23024e8d0df63c464a2cd438f4c5 100644 (file)
@@ -1918,7 +1918,7 @@ function admin_page_users(App $a)
 
                '$h_users' => L10n::t('Users'),
                '$h_newuser' => L10n::t('New User'),
-               '$th_deleted' => [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Deleted since')],
+               '$th_deleted' => [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Delete in')],
                '$th_users' => $th_users,
                '$order_users' => $order,
                '$order_direction_users' => $order_direction,
index b41d0c891be7ec7feceb100b80404882f5c7cbe4..cee067e97acf1ab9791a667a89f4bea89c175209 100644 (file)
@@ -8,13 +8,12 @@ use Friendica\Content\ContactSelector;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
-use Friendica\Model\Contact;
-use Friendica\Model\GContact;
-use Friendica\Model\Profile;
+use Friendica\Model;
+use Friendica\Module;
 use Friendica\Util\Proxy as ProxyUtils;
 
+
 require_once 'include/dba.php';
-require_once 'mod/contacts.php';
 
 function allfriends_content(App $a)
 {
@@ -42,13 +41,13 @@ function allfriends_content(App $a)
        }
 
        $a->page['aside'] = "";
-       Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
+       Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
 
-       $total = GContact::countAllFriends(local_user(), $cid);
+       $total = Model\GContact::countAllFriends(local_user(), $cid);
 
        $a->setPagerTotal($total);
 
-       $r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
+       $r = Model\GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
        if (!DBA::isResult($r)) {
                $o .= L10n::t('No friends to display.');
                return $o;
@@ -59,7 +58,7 @@ function allfriends_content(App $a)
        $entries = [];
        foreach ($r as $rr) {
                //get further details of the contact
-               $contact_details = Contact::getDetailsByURL($rr['url'], $uid, $rr);
+               $contact_details = Model\Contact::getDetailsByURL($rr['url'], $uid, $rr);
 
                $photo_menu = '';
 
@@ -68,11 +67,11 @@ function allfriends_content(App $a)
                // If the contact is not common to the user, Connect/Follow' will be added to the photo menu
                if ($rr['cid']) {
                        $rr['id'] = $rr['cid'];
-                       $photo_menu = Contact::photoMenu($rr);
+                       $photo_menu = Model\Contact::photoMenu($rr);
                } else {
                        $connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
                        $photo_menu = [
-                               'profile' => [L10n::t("View Profile"), Contact::magicLink($rr['url'])],
+                               'profile' => [L10n::t("View Profile"), Model\Contact::magicLink($rr['url'])],
                                'follow' => [L10n::t("Connect/Follow"), $connlnk]
                        ];
                }
@@ -86,7 +85,7 @@ function allfriends_content(App $a)
                        'details'      => $contact_details['location'],
                        'tags'         => $contact_details['keywords'],
                        'about'        => $contact_details['about'],
-                       'account_type' => Contact::getAccountType($contact_details),
+                       'account_type' => Model\Contact::getAccountType($contact_details),
                        'network'      => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
                        'photo_menu'   => $photo_menu,
                        'conntxt'      => L10n::t('Connect'),
@@ -96,7 +95,7 @@ function allfriends_content(App $a)
                $entries[] = $entry;
        }
 
-       $tab_str = contacts_tab($a, $contact, 4);
+       $tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
 
        $tpl = get_markup_template('viewcontact_template.tpl');
 
index e5ae96be70489556dd683a3ce3340b469d7a6b6b..65287b9f2b590eeeabdf66c36d797998170edb59 100644 (file)
@@ -114,6 +114,17 @@ function babel_content()
                                        'content' => visible_whitespace($bbcode)
                                ];
 
+                               $html2 = Text\BBCode::convert($bbcode);
+                               $results[] = [
+                                       'title' => L10n::t('HTML::toBBCode => BBCode::convert'),
+                                       'content' => $html2
+                               ];
+
+                               $results[] = [
+                                       'title' => L10n::t('HTML::toBBCode => BBCode::convert (raw HTML)'),
+                                       'content' => htmlspecialchars($html2)
+                               ];
+
                                $markdown = Text\HTML::toMarkdown($html);
                                $results[] = [
                                        'title' => L10n::t('HTML::toMarkdown'),
index d694527b8600979c4c74817e1663c39d07b8e4b2..25a6aef17a5cc602833514148f2be7e20639af88 100644 (file)
@@ -7,13 +7,12 @@ use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Core\L10n;
 use Friendica\Database\DBA;
-use Friendica\Model\Contact;
-use Friendica\Model\GContact;
-use Friendica\Model\Profile;
+use Friendica\Model;
+use Friendica\Module;
 use Friendica\Util\Proxy as ProxyUtils;
 
+
 require_once 'include/dba.php';
-require_once 'mod/contacts.php';
 
 function common_content(App $a)
 {
@@ -42,7 +41,7 @@ function common_content(App $a)
 
                if (DBA::isResult($contact)) {
                        $a->page['aside'] = "";
-                       Profile::load($a, "", 0, 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]);
@@ -65,12 +64,12 @@ function common_content(App $a)
                return;
        }
 
-       if (!$cid && Profile::getMyURL()) {
-               $contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $uid]);
+       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'];
                } else {
-                       $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
+                       $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Model\Profile::getMyURL())]);
                        if (DBA::isResult($gcontact)) {
                                $zcid = $gcontact['id'];
                        }
@@ -82,9 +81,9 @@ function common_content(App $a)
        }
 
        if ($cid) {
-               $t = GContact::countCommonFriends($uid, $cid);
+               $t = Model\GContact::countCommonFriends($uid, $cid);
        } else {
-               $t = GContact::countCommonFriendsZcid($uid, $zcid);
+               $t = Model\GContact::countCommonFriendsZcid($uid, $zcid);
        }
 
        if ($t > 0) {
@@ -95,9 +94,9 @@ function common_content(App $a)
        }
 
        if ($cid) {
-               $r = GContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
+               $r = Model\GContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
        } else {
-               $r = 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)) {
@@ -109,13 +108,13 @@ function common_content(App $a)
        $entries = [];
        foreach ($r as $rr) {
                //get further details of the contact
-               $contact_details = 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 = Contact::photoMenu($rr);
+               $photo_menu = Model\Contact::photoMenu($rr);
 
                $entry = [
                        'url'          => $rr['url'],
@@ -126,7 +125,7 @@ function common_content(App $a)
                        'details'      => $contact_details['location'],
                        'tags'         => $contact_details['keywords'],
                        'about'        => $contact_details['about'],
-                       'account_type' => 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,
@@ -137,7 +136,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 = Module\Contact::getTabsHTML($a, $contact, 4);
        } else {
                $title = L10n::t('Common Friends');
        }
diff --git a/mod/contacts.php b/mod/contacts.php
deleted file mode 100644 (file)
index 4e149ab..0000000
+++ /dev/null
@@ -1,1123 +0,0 @@
-<?php
-/**
- * @file mod/contacts.php
- */
-
-use Friendica\App;
-use Friendica\Content\ContactSelector;
-use Friendica\Content\Nav;
-use Friendica\Content\Text\BBCode;
-use Friendica\Content\Widget;
-use Friendica\Core\Addon;
-use Friendica\Core\L10n;
-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\Network\Probe;
-use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Proxy as ProxyUtils;
-use Friendica\Core\ACL;
-use Friendica\Module\Login;
-
-function contacts_init(App $a)
-{
-       if (!local_user()) {
-               return;
-       }
-
-       $nets = defaults($_GET, 'nets', '');
-       if ($nets == "all") {
-               $nets = "";
-       }
-
-       if (!x($a->page, 'aside')) {
-               $a->page['aside'] = '';
-       }
-
-       $contact_id = null;
-       $contact = null;
-       if ((($a->argc == 2) && intval($a->argv[1])) || (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations']))) {
-               $contact_id = intval($a->argv[1]);
-               $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
-
-               if (!DBA::isResult($contact)) {
-                       $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => 0]);
-               }
-
-               // Don't display contacts that are about to be deleted
-               if ($contact['network'] == Protocol::PHANTOM) {
-                       $contact = false;
-               }
-       }
-
-       if (DBA::isResult($contact)) {
-               if ($contact['self']) {
-                       if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) {
-                               goaway('profile/' . $contact['nick']);
-                       } else {
-                               goaway('profile/' . $contact['nick'] . '?tab=profile');
-                       }
-               }
-
-               $a->data['contact'] = $contact;
-
-               if (($a->data['contact']['network'] != "") && ($a->data['contact']['network'] != Protocol::DFRN)) {
-                       $networkname = format_network_name($a->data['contact']['network'], $a->data['contact']['url']);
-               } else {
-                       $networkname = '';
-               }
-
-               /// @TODO Add nice spaces
-               $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']),
-                       '$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""),
-                       '$network_name' => $networkname,
-                       '$network' => L10n::t('Network:'),
-                       '$account_type' => Contact::getAccountType($a->data['contact'])
-               ]);
-
-               $findpeople_widget = '';
-               $follow_widget = '';
-               $networks_widget = '';
-       } else {
-               $vcard_widget = '';
-               $networks_widget = Widget::networks('contacts', $nets);
-               if (isset($_GET['add'])) {
-                       $follow_widget = Widget::follow($_GET['add']);
-               } else {
-                       $follow_widget = Widget::follow();
-               }
-
-               $findpeople_widget = Widget::findPeople();
-       }
-
-       if ($contact['uid'] != 0) {
-               $groups_widget = Group::sidebarWidget('contacts', 'group', 'full', 'everyone', $contact_id);
-       } else {
-               $groups_widget = null;
-       }
-
-       $a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"), [
-               '$vcard_widget' => $vcard_widget,
-               '$findpeople_widget' => $findpeople_widget,
-               '$follow_widget' => $follow_widget,
-               '$groups_widget' => $groups_widget,
-               '$networks_widget' => $networks_widget
-       ]);
-
-       $base = System::baseUrl();
-       $tpl = get_markup_template("contacts-head.tpl");
-       $a->page['htmlhead'] .= replace_macros($tpl, [
-               '$baseurl' => System::baseUrl(true),
-               '$base' => $base
-       ]);
-}
-
-function contacts_batch_actions(App $a)
-{
-       if (empty($_POST['contact_batch']) || !is_array($_POST['contact_batch'])) {
-               return;
-       }
-
-       $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())
-       );
-
-       $count_actions = 0;
-       foreach ($orig_records as $orig_record) {
-               $contact_id = $orig_record['id'];
-               if (x($_POST, 'contacts_batch_update')) {
-                       _contact_update($contact_id);
-                       $count_actions++;
-               }
-               if (x($_POST, 'contacts_batch_block')) {
-                       _contact_block($contact_id);
-                       $count_actions++;
-               }
-               if (x($_POST, 'contacts_batch_ignore')) {
-                       _contact_ignore($contact_id);
-                       $count_actions++;
-               }
-               if (x($_POST, 'contacts_batch_archive')) {
-                       $r = _contact_archive($contact_id, $orig_record);
-                       if ($r) {
-                               $count_actions++;
-                       }
-               }
-               if (x($_POST, 'contacts_batch_drop')) {
-                       _contact_drop($orig_record);
-                       $count_actions++;
-               }
-       }
-       if ($count_actions > 0) {
-               info(L10n::tt("%d contact edited.", "%d contacts edited.", $count_actions));
-       }
-
-       goaway('contacts');
-}
-
-function contacts_post(App $a)
-{
-       if (!local_user()) {
-               return;
-       }
-
-       if ($a->argv[1] === "batch") {
-               contacts_batch_actions($a);
-               return;
-       }
-
-       $contact_id = intval($a->argv[1]);
-       if (!$contact_id) {
-               return;
-       }
-
-       if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
-               notice(L10n::t('Could not access contact record.') . EOL);
-               goaway('contacts');
-               return; // NOTREACHED
-       }
-
-       Addon::callHooks('contact_edit_post', $_POST);
-
-       $profile_id = intval(defaults($_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 = intval($_POST['hidden']);
-
-       $notify = intval($_POST['notify']);
-
-       $fetch_further_information = intval(defaults($_POST, 'fetch_further_information', 0));
-
-       $ffi_keyword_blacklist = escape_tags(trim(defaults($_POST, 'ffi_keyword_blacklist', '')));
-
-       $priority = intval(defaults($_POST, 'poll', 0));
-       if ($priority > 5 || $priority < 0) {
-               $priority = 0;
-       }
-
-       $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())
-       );
-       if (DBA::isResult($r)) {
-               info(L10n::t('Contact updated.') . EOL);
-       } else {
-               notice(L10n::t('Failed to update contact record.') . EOL);
-       }
-
-       $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
-       if (DBA::isResult($contact)) {
-               $a->data['contact'] = $contact;
-       }
-
-       return;
-}
-
-/* contact actions */
-
-function _contact_update($contact_id)
-{
-       $contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
-       if (!DBA::isResult($contact)) {
-               return;
-       }
-
-       $uid = $contact["uid"];
-
-       if ($contact["network"] == Protocol::OSTATUS) {
-               $result = Contact::createFromProbe($uid, $contact["url"], false, $contact["network"]);
-
-               if ($result['success']) {
-                       q("UPDATE `contact` SET `subhub` = 1 WHERE `id` = %d", intval($contact_id));
-               }
-       } else {
-               // pull feed and consume it, which should subscribe to the hub.
-               Worker::add(PRIORITY_HIGH, "OnePoll", $contact_id, "force");
-       }
-}
-
-function _contact_update_profile($contact_id)
-{
-       $contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
-       if (!DBA::isResult($contact)) {
-               return;
-       }
-
-       $uid = $contact["uid"];
-
-       $data = Probe::uri($contact["url"], "", 0, false);
-
-       // "Feed" or "Unknown" is mostly a sign of communication problems
-       if ((in_array($data["network"], [Protocol::FEED, Protocol::PHANTOM])) && ($data["network"] != $contact["network"])) {
-               return;
-       }
-
-       $updatefields = ["name", "nick", "url", "addr", "batch", "notify", "poll", "request", "confirm",
-               "poco", "network", "alias"];
-       $update = [];
-
-       if ($data["network"] == Protocol::OSTATUS) {
-               $result = Contact::createFromProbe($uid, $data["url"], false);
-
-               if ($result['success']) {
-                       $update["subhub"] = true;
-               }
-       }
-
-       foreach ($updatefields AS $field) {
-               if (isset($data[$field]) && ($data[$field] != "")) {
-                       $update[$field] = $data[$field];
-               }
-       }
-
-       $update["nurl"] = normalise_link($data["url"]);
-
-       $query = "";
-
-       if (isset($data["priority"]) && ($data["priority"] != 0)) {
-               $query = "`priority` = " . intval($data["priority"]);
-       }
-
-       foreach ($update AS $key => $value) {
-               if ($query != "") {
-                       $query .= ", ";
-               }
-
-               $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())
-       );
-
-       // Update the entry in the contact table
-       Contact::updateAvatar($data['photo'], local_user(), $contact_id, true);
-
-       // Update the entry in the gcontact table
-       GContact::updateFromProbe($data["url"]);
-}
-
-function _contact_block($contact_id)
-{
-       $blocked = !Contact::isBlockedByUser($contact_id, local_user());
-       Contact::setBlockedForUser($contact_id, local_user(), $blocked);
-}
-
-function _contact_ignore($contact_id)
-{
-       $ignored = !Contact::isIgnoredByUser($contact_id, local_user());
-       Contact::setIgnoredForUser($contact_id, local_user(), $ignored);
-}
-
-function _contact_archive($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())
-       );
-       return DBA::isResult($r);
-}
-
-function _contact_drop($orig_record)
-{
-       $a = get_app();
-
-       $r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid`
-               WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
-               intval($a->user['uid'])
-       );
-       if (!DBA::isResult($r)) {
-               return;
-       }
-
-       Contact::terminateFriendship($r[0], $orig_record, true);
-       Contact::remove($orig_record['id']);
-}
-
-function contacts_content(App $a, $update = 0)
-{
-       $sort_type = 0;
-       $o = '';
-       Nav::setSelected('contacts');
-
-       if (!local_user()) {
-               notice(L10n::t('Permission denied.') . EOL);
-               return Login::form();
-       }
-
-       if ($a->argc == 3) {
-               $contact_id = intval($a->argv[1]);
-               if (!$contact_id) {
-                       return;
-               }
-
-               $cmd = $a->argv[2];
-
-               $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');
-                       return; // NOTREACHED
-               }
-
-               if ($cmd === 'update' && ($orig_record['uid'] != 0)) {
-                       _contact_update($contact_id);
-                       goaway('contacts/' . $contact_id);
-                       // NOTREACHED
-               }
-
-               if ($cmd === 'updateprofile' && ($orig_record['uid'] != 0)) {
-                       _contact_update_profile($contact_id);
-                       goaway('crepair/' . $contact_id);
-                       // NOTREACHED
-               }
-
-               if ($cmd === 'block') {
-                       _contact_block($contact_id);
-
-                       $blocked = 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);
-                       return; // NOTREACHED
-               }
-
-               if ($cmd === 'ignore') {
-                       _contact_ignore($contact_id);
-
-                       $ignored = 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);
-                       return; // NOTREACHED
-               }
-
-               if ($cmd === 'archive' && ($orig_record['uid'] != 0)) {
-                       $r = _contact_archive($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);
-                       }
-
-                       goaway('contacts/' . $contact_id);
-                       return; // NOTREACHED
-               }
-
-               if ($cmd === 'drop' && ($orig_record['uid'] != 0)) {
-                       // Check if we should do HTML-based delete confirmation
-                       if (x($_REQUEST, 'confirm')) {
-                               // <form> can't take arguments in its "action" parameter
-                               // so add any arguments as hidden inputs
-                               $query = explode_querystring($a->query_string);
-                               $inputs = [];
-                               foreach ($query['args'] as $arg) {
-                                       if (strpos($arg, 'confirm=') === false) {
-                                               $arg_parts = explode('=', $arg);
-                                               $inputs[] = ['name' => $arg_parts[0], 'value' => $arg_parts[1]];
-                                       }
-                               }
-
-                               $a->page['aside'] = '';
-
-                               return replace_macros(get_markup_template('contact_drop_confirm.tpl'), [
-                                       '$header' => L10n::t('Drop contact'),
-                                       '$contact' => _contact_detail_for_template($orig_record),
-                                       '$method' => 'get',
-                                       '$message' => L10n::t('Do you really want to delete this contact?'),
-                                       '$extra_inputs' => $inputs,
-                                       '$confirm' => L10n::t('Yes'),
-                                       '$confirm_url' => $query['base'],
-                                       '$confirm_name' => 'confirmed',
-                                       '$cancel' => L10n::t('Cancel'),
-                               ]);
-                       }
-                       // Now check how the user responded to the confirmation query
-                       if (x($_REQUEST, 'canceled')) {
-                               goaway('contacts');
-                       }
-
-                       _contact_drop($orig_record);
-                       info(L10n::t('Contact has been removed.') . EOL);
-
-                       goaway('contacts');
-                       return; // NOTREACHED
-               }
-               if ($cmd === 'posts') {
-                       return contact_posts($a, $contact_id);
-               }
-               if ($cmd === 'conversations') {
-                       return contact_conversations($a, $contact_id, $update);
-               }
-       }
-
-       $_SESSION['return_url'] = $a->query_string;
-
-       if ((x($a->data, 'contact')) && (is_array($a->data['contact']))) {
-               $contact_id = $a->data['contact']['id'];
-               $contact = $a->data['contact'];
-
-               $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), [
-                       '$baseurl' => System::baseUrl(true),
-               ]);
-
-               $contact['blocked'] = Contact::isBlockedByUser($contact['id'], local_user());
-               $contact['readonly'] = Contact::isIgnoredByUser($contact['id'], local_user());
-
-               $dir_icon = '';
-               $relation_text = '';
-               switch ($contact['rel']) {
-                       case Contact::FRIEND:
-                               $dir_icon = 'images/lrarrow.gif';
-                               $relation_text = L10n::t('You are mutual friends with %s');
-                               break;
-
-                       case Contact::FOLLOWER;
-                               $dir_icon = 'images/larrow.gif';
-                               $relation_text = L10n::t('You are sharing with %s');
-                               break;
-
-                       case Contact::SHARING;
-                               $dir_icon = 'images/rarrow.gif';
-                               $relation_text = L10n::t('%s is sharing with you');
-                               break;
-
-                       default:
-                               break;
-               }
-
-               if ($contact['uid'] == 0) {
-                       $relation_text = '';
-               }
-
-               if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
-                       $relation_text = "";
-               }
-
-               $relation_text = sprintf($relation_text, htmlentities($contact['name']));
-
-               $url = Contact::magicLink($contact['url']);
-               if (strpos($url, 'redir/') === 0) {
-                       $sparkle = ' class="sparkle" ';
-               } else {
-                       $sparkle = '';
-               }
-
-               $insecure = L10n::t('Private communications are not available for this contact.');
-
-               $last_update = (($contact['last-update'] <= NULL_DATE) ? L10n::t('Never') : DateTimeFormat::local($contact['last-update'], 'D, j M Y, g:i A'));
-
-               if ($contact['last-update'] > NULL_DATE) {
-                       $last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? L10n::t("\x28Update was successful\x29") : L10n::t("\x28Update was not successful\x29"));
-               }
-               $lblsuggest = (($contact['network'] === Protocol::DFRN) ? L10n::t('Suggest friends') : '');
-
-               $poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
-
-               $nettype = L10n::t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact["url"]));
-
-               // tabs
-               $tab_str = contacts_tab($a, $contact, 3);
-
-               $lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < DateTimeFormat::utcNow()) ? L10n::t('Communications lost with this contact!') : '');
-
-               $fetch_further_information = null;
-               if ($contact['network'] == Protocol::FEED) {
-                       $fetch_further_information = [
-                               'fetch_further_information',
-                               L10n::t('Fetch further information for feeds'),
-                               $contact['fetch_further_information'],
-                               L10n::t("Fetch information like preview pictures, title and teaser from the feed item. You can activate this if the feed doesn't contain much text. Keywords are taken from the meta header in the feed item and are posted as hash tags."),
-                               ['0' => L10n::t('Disabled'),
-                                       '1' => L10n::t('Fetch information'),
-                                       '3' => L10n::t('Fetch keywords'),
-                                       '2' => L10n::t('Fetch information and keywords')
-                               ]
-                       ];
-               }
-
-               $poll_interval = null;
-               if (in_array($contact['network'], [Protocol::FEED, Protocol::MAIL])) {
-                       $poll_interval = ContactSelector::pollInterval($contact['priority'], (!$poll_enabled));
-               }
-
-               $profile_select = null;
-               if ($contact['network'] == Protocol::DFRN) {
-                       $profile_select = ContactSelector::profileAssign($contact['profile-id'], (($contact['network'] !== Protocol::DFRN) ? true : false));
-               }
-
-               /// @todo Only show the following link with DFRN when the remote version supports it
-               $follow = '';
-               $follow_text = '';
-               if (in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
-                       if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
-                               $follow = System::baseUrl(true) . "/unfollow?url=" . urlencode($contact["url"]);
-                               $follow_text = L10n::t("Disconnect/Unfollow");
-                       }
-               } else {
-                       $follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]);
-                       $follow_text = L10n::t("Connect/Follow");
-               }
-
-               // Load contactact related actions like hide, suggest, delete and others
-               $contact_actions = contact_actions($contact);
-
-               if ($contact['uid'] != 0) {
-                       $lbl_vis1 = L10n::t('Profile Visibility');
-                       $lbl_info1 = L10n::t('Contact Information / Notes');
-                       $contact_settings_label = L10n::t('Contact Settings');
-               } else {
-                       $lbl_vis1 = null;
-                       $lbl_info1 = null;
-                       $contact_settings_label = null;
-               }
-
-               $tpl = get_markup_template("contact_edit.tpl");
-               $o .= replace_macros($tpl, [
-                       '$header' => L10n::t("Contact"),
-                       '$tab_str' => $tab_str,
-                       '$submit' => L10n::t('Submit'),
-                       '$lbl_vis1' => $lbl_vis1,
-                       '$lbl_vis2' => L10n::t('Please choose the profile you would like to display to %s when viewing your profile securely.', $contact['name']),
-                       '$lbl_info1' => $lbl_info1,
-                       '$lbl_info2' => L10n::t('Their personal note'),
-                       '$reason' => trim(notags($contact['reason'])),
-                       '$infedit' => L10n::t('Edit contact notes'),
-                       '$common_link' => 'common/loc/' . local_user() . '/' . $contact['id'],
-                       '$relation_text' => $relation_text,
-                       '$visit' => L10n::t('Visit %s\'s profile [%s]', $contact['name'], $contact['url']),
-                       '$blockunblock' => L10n::t('Block/Unblock contact'),
-                       '$ignorecont' => L10n::t('Ignore contact'),
-                       '$lblcrepair' => L10n::t("Repair URL settings"),
-                       '$lblrecent' => L10n::t('View conversations'),
-                       '$lblsuggest' => $lblsuggest,
-                       '$nettype' => $nettype,
-                       '$poll_interval' => $poll_interval,
-                       '$poll_enabled' => $poll_enabled,
-                       '$lastupdtext' => L10n::t('Last update:'),
-                       '$lost_contact' => $lost_contact,
-                       '$updpub' => L10n::t('Update public posts'),
-                       '$last_update' => $last_update,
-                       '$udnow' => L10n::t('Update now'),
-                       '$follow' => $follow,
-                       '$follow_text' => $follow_text,
-                       '$profile_select' => $profile_select,
-                       '$contact_id' => $contact['id'],
-                       '$block_text' => ($contact['blocked'] ? L10n::t('Unblock') : L10n::t('Block')),
-                       '$ignore_text' => ($contact['readonly'] ? L10n::t('Unignore') : L10n::t('Ignore')),
-                       '$insecure' => (in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA]) ? '' : $insecure),
-                       '$info' => $contact['info'],
-                       '$cinfo' => ['info', '', $contact['info'], ''],
-                       '$blocked' => ($contact['blocked'] ? L10n::t('Currently blocked') : ''),
-                       '$ignored' => ($contact['readonly'] ? L10n::t('Currently ignored') : ''),
-                       '$archived' => ($contact['archive'] ? L10n::t('Currently archived') : ''),
-                       '$pending' => ($contact['pending'] ? L10n::t('Awaiting connection acknowledge') : ''),
-                       '$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($contact['hidden'] == 1), L10n::t('Replies/likes to your public posts <strong>may</strong> still be visible')],
-                       '$notify' => ['notify', L10n::t('Notification for new posts'), ($contact['notify_new_posts'] == 1), L10n::t('Send a notification of every new post of this contact')],
-                       '$fetch_further_information' => $fetch_further_information,
-                       '$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'],
-                       '$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', L10n::t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], L10n::t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')],
-                       '$photo' => $contact['photo'],
-                       '$name' => htmlentities($contact['name']),
-                       '$dir_icon' => $dir_icon,
-                       '$sparkle' => $sparkle,
-                       '$url' => $url,
-                       '$profileurllabel' => L10n::t('Profile URL'),
-                       '$profileurl' => $contact['url'],
-                       '$account_type' => Contact::getAccountType($contact),
-                       '$location' => BBCode::convert($contact["location"]),
-                       '$location_label' => L10n::t("Location:"),
-                       '$xmpp' => BBCode::convert($contact["xmpp"]),
-                       '$xmpp_label' => L10n::t("XMPP:"),
-                       '$about' => BBCode::convert($contact["about"], false),
-                       '$about_label' => L10n::t("About:"),
-                       '$keywords' => $contact["keywords"],
-                       '$keywords_label' => L10n::t("Tags:"),
-                       '$contact_action_button' => L10n::t("Actions"),
-                       '$contact_actions' => $contact_actions,
-                       '$contact_status' => L10n::t("Status"),
-                       '$contact_settings_label' => $contact_settings_label,
-                       '$contact_profile_label' => L10n::t("Profile"),
-               ]);
-
-               $arr = ['contact' => $contact, 'output' => $o];
-
-               Addon::callHooks('contact_edit', $arr);
-
-               return $arr['output'];
-       }
-
-       $blocked = false;
-       $hidden = false;
-       $ignored = false;
-       $archived = false;
-       $all = false;
-
-       if (($a->argc == 2) && ($a->argv[1] === 'all')) {
-               $sql_extra = '';
-               $all = true;
-       } elseif (($a->argc == 2) && ($a->argv[1] === 'blocked')) {
-               $sql_extra = " AND `blocked` = 1 ";
-               $blocked = true;
-       } elseif (($a->argc == 2) && ($a->argv[1] === 'hidden')) {
-               $sql_extra = " AND `hidden` = 1 ";
-               $hidden = true;
-       } elseif (($a->argc == 2) && ($a->argv[1] === 'ignored')) {
-               $sql_extra = " AND `readonly` = 1 ";
-               $ignored = true;
-       } elseif (($a->argc == 2) && ($a->argv[1] === 'archived')) {
-               $sql_extra = " AND `archive` = 1 ";
-               $archived = true;
-       } else {
-               $sql_extra = " AND `blocked` = 0 ";
-       }
-
-       $sql_extra .= sprintf(" AND `network` != '%s' ", Protocol::PHANTOM);
-
-       $search = x($_GET, 'search') ? notags(trim($_GET['search'])) : '';
-       $nets   = x($_GET, 'nets'  ) ? notags(trim($_GET['nets']))   : '';
-
-       $tabs = [
-               [
-                       'label' => L10n::t('Suggestions'),
-                       'url'   => 'suggest',
-                       'sel'   => '',
-                       'title' => L10n::t('Suggest potential friends'),
-                       'id'    => 'suggestions-tab',
-                       'accesskey' => 'g',
-               ],
-               [
-                       'label' => L10n::t('All Contacts'),
-                       'url'   => 'contacts/all',
-                       'sel'   => ($all) ? 'active' : '',
-                       'title' => L10n::t('Show all contacts'),
-                       'id'    => 'showall-tab',
-                       'accesskey' => 'l',
-               ],
-               [
-                       'label' => L10n::t('Unblocked'),
-                       'url'   => 'contacts',
-                       'sel'   => ((!$all) && (!$blocked) && (!$hidden) && (!$search) && (!$nets) && (!$ignored) && (!$archived)) ? 'active' : '',
-                       'title' => L10n::t('Only show unblocked contacts'),
-                       'id'    => 'showunblocked-tab',
-                       'accesskey' => 'o',
-               ],
-               [
-                       'label' => L10n::t('Blocked'),
-                       'url'   => 'contacts/blocked',
-                       'sel'   => ($blocked) ? 'active' : '',
-                       'title' => L10n::t('Only show blocked contacts'),
-                       'id'    => 'showblocked-tab',
-                       'accesskey' => 'b',
-               ],
-               [
-                       'label' => L10n::t('Ignored'),
-                       'url'   => 'contacts/ignored',
-                       'sel'   => ($ignored) ? 'active' : '',
-                       'title' => L10n::t('Only show ignored contacts'),
-                       'id'    => 'showignored-tab',
-                       'accesskey' => 'i',
-               ],
-               [
-                       'label' => L10n::t('Archived'),
-                       'url'   => 'contacts/archived',
-                       'sel'   => ($archived) ? 'active' : '',
-                       'title' => L10n::t('Only show archived contacts'),
-                       'id'    => 'showarchived-tab',
-                       'accesskey' => 'y',
-               ],
-               [
-                       'label' => L10n::t('Hidden'),
-                       'url'   => 'contacts/hidden',
-                       'sel'   => ($hidden) ? 'active' : '',
-                       'title' => L10n::t('Only show hidden contacts'),
-                       'id'    => 'showhidden-tab',
-                       'accesskey' => 'h',
-               ],
-       ];
-
-       $tab_tpl = get_markup_template('common_tabs.tpl');
-       $t = replace_macros($tab_tpl, ['$tabs' => $tabs]);
-
-       $total = 0;
-       $searching = false;
-       $search_hdr = null;
-       if ($search) {
-               $searching = true;
-               $search_hdr = $search;
-               $search_txt = DBA::escape(protect_sprintf(preg_quote($search)));
-               $sql_extra .= " AND (name REGEXP '$search_txt' OR url REGEXP '$search_txt'  OR nick REGEXP '$search_txt') ";
-       }
-
-       if ($nets) {
-               $sql_extra .= sprintf(" AND network = '%s' ", DBA::escape($nets));
-       }
-
-       $sql_extra2 = ((($sort_type > 0) && ($sort_type <= Contact::FRIEND)) ? sprintf(" AND `rel` = %d ", intval($sort_type)) : '');
-
-       $r = q("SELECT COUNT(*) AS `total` FROM `contact`
-               WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
-               intval($_SESSION['uid'])
-       );
-       if (DBA::isResult($r)) {
-               $a->setPagerTotal($r[0]['total']);
-               $total = $r[0]['total'];
-       }
-
-       $sql_extra3 = Widget::unavailableNetworks();
-
-       $contacts = [];
-
-       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 $sql_extra3 ORDER BY `name` ASC LIMIT %d , %d ",
-               intval($_SESSION['uid']),
-               intval($a->pager['start']),
-               intval($a->pager['itemspage'])
-       );
-       if (DBA::isResult($r)) {
-               foreach ($r as $rr) {
-                       $rr['blocked'] = Contact::isBlockedByUser($rr['id'], local_user());
-                       $rr['readonly'] = Contact::isIgnoredByUser($rr['id'], local_user());
-                       $contacts[] = _contact_detail_for_template($rr);
-               }
-       }
-
-       $tpl = get_markup_template("contacts-template.tpl");
-       $o .= replace_macros($tpl, [
-               '$baseurl' => System::baseUrl(),
-               '$header' => L10n::t('Contacts') . (($nets) ? ' - ' . ContactSelector::networkToName($nets) : ''),
-               '$tabs' => $t,
-               '$total' => $total,
-               '$search' => $search_hdr,
-               '$desc' => L10n::t('Search your contacts'),
-               '$finding' => $searching ? L10n::t('Results for: %s', $search) : "",
-               '$submit' => L10n::t('Find'),
-               '$cmd' => $a->cmd,
-               '$contacts' => $contacts,
-               '$contact_drop_confirm' => L10n::t('Do you really want to delete this contact?'),
-               'multiselect' => 1,
-               '$batch_actions' => [
-                       'contacts_batch_update'  => L10n::t('Update'),
-                       'contacts_batch_block'   => L10n::t('Block') . "/" . L10n::t("Unblock"),
-                       "contacts_batch_ignore"  => L10n::t('Ignore') . "/" . L10n::t("Unignore"),
-                       "contacts_batch_archive" => L10n::t('Archive') . "/" . L10n::t("Unarchive"),
-                       "contacts_batch_drop"    => L10n::t('Delete'),
-               ],
-               '$h_batch_actions' => L10n::t('Batch Actions'),
-               '$paginate' => paginate($a),
-       ]);
-
-       return $o;
-}
-
-/**
- * @brief List of pages for the Contact TabBar
- *
- * Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
- *
- * @param App $a
- * @param array $contact The contact array
- * @param int $active_tab 1 if tab should be marked as active
- *
- * @return string
- */
-function contacts_tab($a, $contact, $active_tab)
-{
-       // tabs
-       $tabs = [
-               [
-                       'label' => L10n::t('Status'),
-                       'url'   => "contacts/" . $contact['id'] . "/conversations",
-                       'sel'   => (($active_tab == 1) ? 'active' : ''),
-                       'title' => L10n::t('Conversations started by this contact'),
-                       'id'    => 'status-tab',
-                       'accesskey' => 'm',
-               ],
-               [
-                       'label' => L10n::t('Posts and Comments'),
-                       'url'   => "contacts/" . $contact['id'] . "/posts",
-                       'sel'   => (($active_tab == 2) ? 'active' : ''),
-                       'title' => L10n::t('Status Messages and Posts'),
-                       'id'    => 'posts-tab',
-                       'accesskey' => 'p',
-               ],
-               [
-                       'label' => L10n::t('Profile'),
-                       'url'   => "contacts/" . $contact['id'],
-                       'sel'   => (($active_tab == 3) ? 'active' : ''),
-                       'title' => L10n::t('Profile Details'),
-                       'id'    => 'profile-tab',
-                       'accesskey' => 'o',
-               ]
-       ];
-
-       // Show this tab only if there is visible friend list
-       $x = GContact::countAllFriends(local_user(), $contact['id']);
-       if ($x) {
-               $tabs[] = ['label' => L10n::t('Contacts'),
-                       'url'   => "allfriends/" . $contact['id'],
-                       'sel'   => (($active_tab == 4) ? 'active' : ''),
-                       'title' => L10n::t('View all contacts'),
-                       'id'    => 'allfriends-tab',
-                       'accesskey' => 't'];
-       }
-
-       // Show this tab only if there is visible common friend list
-       $common = GContact::countCommonFriends(local_user(), $contact['id']);
-       if ($common) {
-               $tabs[] = ['label' => L10n::t('Common Friends'),
-                       'url'   => "common/loc/" . local_user() . "/" . $contact['id'],
-                       'sel'   => (($active_tab == 5) ? 'active' : ''),
-                       'title' => L10n::t('View all common friends'),
-                       'id'    => 'common-loc-tab',
-                       'accesskey' => 'd'
-               ];
-       }
-
-       if (!empty($contact['uid'])) {
-               $tabs[] = ['label' => L10n::t('Advanced'),
-                       'url'   => 'crepair/' . $contact['id'],
-                       'sel'   => (($active_tab == 6) ? 'active' : ''),
-                       'title' => L10n::t('Advanced Contact Settings'),
-                       'id'    => 'advanced-tab',
-                       'accesskey' => 'r'
-               ];
-       }
-
-       $tab_tpl = get_markup_template('common_tabs.tpl');
-       $tab_str = replace_macros($tab_tpl, ['$tabs' => $tabs]);
-
-       return $tab_str;
-}
-
-function contact_conversations(App $a, $contact_id, $update)
-{
-       $o = '';
-
-       if (!$update) {
-               // We need the editor here to be able to reshare an item.
-               if (local_user()) {
-                       $x = [
-                               'is_owner' => true,
-                               'allow_location' => $a->user['allow_location'],
-                               'default_location' => $a->user['default-location'],
-                               'nickname' => $a->user['nickname'],
-                               'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
-                               'acl' => ACL::getFullSelectorHTML($a->user, true),
-                               'bang' => '',
-                               'visitor' => 'block',
-                               'profile_uid' => local_user(),
-                       ];
-                       $o = status_editor($a, $x, 0, true);
-               }
-       }
-
-       $contact = DBA::selectFirst('contact', ['uid', 'url', 'id'], ['id' => $contact_id]);
-
-       if (!$update) {
-               $o .= contacts_tab($a, $contact, 1);
-       }
-
-       if (DBA::isResult($contact)) {
-               $a->page['aside'] = "";
-
-               $profiledata = Contact::getDetailsByURL($contact["url"]);
-
-               if (local_user()) {
-                       if (in_array($profiledata["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
-                               $profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]);
-                       }
-               }
-
-               Profile::load($a, "", 0, $profiledata, true);
-               $o .= Contact::getPostsFromUrl($contact["url"], true, $update);
-       }
-
-       return $o;
-}
-
-function contact_posts(App $a, $contact_id)
-{
-       $contact = DBA::selectFirst('contact', ['uid', 'url', 'id'], ['id' => $contact_id]);
-
-       $o = contacts_tab($a, $contact, 2);
-
-       if (DBA::isResult($contact)) {
-               $a->page['aside'] = "";
-
-               $profiledata = Contact::getDetailsByURL($contact["url"]);
-
-               if (local_user()) {
-                       if (in_array($profiledata["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
-                               $profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]);
-                       }
-               }
-
-               Profile::load($a, "", 0, $profiledata, true);
-               $o .= Contact::getPostsFromUrl($contact["url"]);
-       }
-
-       return $o;
-}
-
-function _contact_detail_for_template(array $rr)
-{
-       $dir_icon = '';
-       $alt_text = '';
-
-       switch ($rr['rel']) {
-               case Contact::FRIEND:
-                       $dir_icon = 'images/lrarrow.gif';
-                       $alt_text = L10n::t('Mutual Friendship');
-                       break;
-
-               case Contact::FOLLOWER;
-                       $dir_icon = 'images/larrow.gif';
-                       $alt_text = L10n::t('is a fan of yours');
-                       break;
-
-               case Contact::SHARING;
-                       $dir_icon = 'images/rarrow.gif';
-                       $alt_text = L10n::t('you are a fan of');
-                       break;
-
-               default:
-                       break;
-       }
-
-       $url = Contact::magicLink($rr['url']);
-
-       if (strpos($url, 'redir/') === 0) {
-               $sparkle = ' class="sparkle" ';
-       } else {
-               $sparkle = '';
-       }
-
-       if ($rr['self']) {
-               $dir_icon = 'images/larrow.gif';
-               $alt_text = L10n::t('This is you');
-               $url = $rr['url'];
-               $sparkle = '';
-       }
-
-       return [
-               'img_hover' => L10n::t('Visit %s\'s profile [%s]', $rr['name'], $rr['url']),
-               'edit_hover' => L10n::t('Edit contact'),
-               'photo_menu' => Contact::photoMenu($rr),
-               'id' => $rr['id'],
-               'alt_text' => $alt_text,
-               'dir_icon' => $dir_icon,
-               'thumb' => ProxyUtils::proxifyUrl($rr['thumb'], false, ProxyUtils::SIZE_THUMB),
-               'name' => htmlentities($rr['name']),
-               'username' => htmlentities($rr['name']),
-               'account_type' => Contact::getAccountType($rr),
-               'sparkle' => $sparkle,
-               'itemurl' => (($rr['addr'] != "") ? $rr['addr'] : $rr['url']),
-               'url' => $url,
-               'network' => ContactSelector::networkToName($rr['network'], $rr['url']),
-               'nick' => htmlentities($rr['nick']),
-       ];
-}
-
-/**
- * @brief Gives a array with actions which can performed to a given contact
- *
- * This includes actions like e.g. 'block', 'hide', 'archive', 'delete' and others
- *
- * @param array $contact Data about the Contact
- * @return array with contact related actions
- */
-function contact_actions($contact)
-{
-       $poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
-       $contact_actions = [];
-
-       // Provide friend suggestion only for Friendica contacts
-       if ($contact['network'] === Protocol::DFRN) {
-               $contact_actions['suggest'] = [
-                       'label' => L10n::t('Suggest friends'),
-                       'url'   => 'fsuggest/' . $contact['id'],
-                       'title' => '',
-                       'sel'   => '',
-                       'id'    => 'suggest',
-               ];
-       }
-
-       if ($poll_enabled) {
-               $contact_actions['update'] = [
-                       'label' => L10n::t('Update now'),
-                       'url'   => 'contacts/' . $contact['id'] . '/update',
-                       'title' => '',
-                       'sel'   => '',
-                       'id'    => 'update',
-               ];
-       }
-
-       $contact_actions['block'] = [
-               'label' => (intval($contact['blocked']) ? L10n::t('Unblock') : L10n::t('Block')),
-               'url'   => 'contacts/' . $contact['id'] . '/block',
-               'title' => L10n::t('Toggle Blocked status'),
-               'sel'   => (intval($contact['blocked']) ? 'active' : ''),
-               'id'    => 'toggle-block',
-       ];
-
-       $contact_actions['ignore'] = [
-               'label' => (intval($contact['readonly']) ? L10n::t('Unignore') : L10n::t('Ignore')),
-               'url'   => 'contacts/' . $contact['id'] . '/ignore',
-               'title' => L10n::t('Toggle Ignored status'),
-               'sel'   => (intval($contact['readonly']) ? 'active' : ''),
-               'id'    => 'toggle-ignore',
-       ];
-
-       if ($contact['uid'] != 0) {
-               $contact_actions['archive'] = [
-                       'label' => (intval($contact['archive']) ? L10n::t('Unarchive') : L10n::t('Archive')),
-                       'url'   => 'contacts/' . $contact['id'] . '/archive',
-                       'title' => L10n::t('Toggle Archive status'),
-                       'sel'   => (intval($contact['archive']) ? 'active' : ''),
-                       'id'    => 'toggle-archive',
-               ];
-
-               $contact_actions['delete'] = [
-                       'label' => L10n::t('Delete'),
-                       'url'   => 'contacts/' . $contact['id'] . '/drop',
-                       'title' => L10n::t('Delete contact'),
-                       'sel'   => '',
-                       'id'    => 'delete',
-               ];
-       }
-
-       return $contact_actions;
-}
index d8c6b35f5ad03d69e80dc76327a5109d128c172e..13885cb49106adc94b44a2f1d60dd4a50c5e9cdd 100644 (file)
@@ -8,10 +8,8 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
-use Friendica\Model\Contact;
-use Friendica\Model\Profile;
-
-require_once 'mod/contacts.php';
+use Friendica\Model;
+use Friendica\Module;
 
 function crepair_init(App $a)
 {
@@ -30,7 +28,7 @@ function crepair_init(App $a)
 
        if (DBA::isResult($contact)) {
                $a->data['contact'] = $contact;
-               Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
+               Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
        }
 }
 
@@ -82,7 +80,7 @@ function crepair_post(App $a)
        if ($photo) {
                logger('mod-crepair: updating photo from ' . $photo);
 
-               Contact::updateAvatar($photo, local_user(), $contact['id']);
+               Model\Contact::updateAvatar($photo, local_user(), $contact['id']);
        }
 
        if ($r) {
@@ -135,7 +133,7 @@ function crepair_content(App $a)
 
        $update_profile = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]);
 
-       $tab_str = contacts_tab($a, $contact, 5);
+       $tab_str = Module\Contact::getTabsHTML($a, $contact, 5);
 
        $tpl = get_markup_template('crepair.tpl');
        $o = replace_macros($tpl, [
index 969e2286c864076a8b5770300612c6f7f3dd6857..48ce3c6aa65684bfe6b47e7ba1794e8709327fb6 100644 (file)
@@ -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'],
index e611458281e8e64759882786ae7ec0233651f76d..67db2c6285cdd1776657f8e7174203da8c2510e4 100644 (file)
@@ -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
index 5fe9ae13af32adacf7b8d0e8c34fb25b10fcf1bf..3e5aa83a7208df0f14c3cddc6b523b4bcc927afc 100644 (file)
@@ -12,14 +12,13 @@ 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;
+use Friendica\Module;
 use Friendica\Network\Probe;
 use Friendica\Protocol\PortableContact;
 use Friendica\Util\Network;
 use Friendica\Util\Proxy as ProxyUtils;
 
-require_once 'mod/contacts.php';
 
 function dirfind_init(App $a) {
 
@@ -83,7 +82,7 @@ function dirfind_content(App $a, $prefix = "") {
                        $objresult->tags = "";
                        $objresult->network = $user_data["network"];
 
-                       $contact = Contact::getDetailsByURL($user_data["url"], local_user());
+                       $contact = Model\Contact::getDetailsByURL($user_data["url"], local_user());
                        $objresult->cid = $contact["cid"];
                        $objresult->pcid = $contact["zid"];
 
@@ -91,7 +90,7 @@ function dirfind_content(App $a, $prefix = "") {
 
                        // Add the contact to the global contacts if it isn't already in our system
                        if (($contact["cid"] == 0) && ($contact["zid"] == 0) && ($contact["gid"] == 0)) {
-                               GContact::update($user_data);
+                               Model\GContact::update($user_data);
                        }
                } elseif ($local) {
 
@@ -156,7 +155,7 @@ function dirfind_content(App $a, $prefix = "") {
                                        continue;
                                }
 
-                               $result = Contact::getDetailsByURL($result["nurl"], local_user());
+                               $result = Model\Contact::getDetailsByURL($result["nurl"], local_user());
 
                                if ($result["name"] == "") {
                                        $result["name"] = end(explode("/", $urlparts["path"]));
@@ -200,7 +199,7 @@ function dirfind_content(App $a, $prefix = "") {
 
                                $alt_text = "";
 
-                               $contact_details = Contact::getDetailsByURL($jj->url, local_user());
+                               $contact_details = Model\Contact::getDetailsByURL($jj->url, local_user());
 
                                $itemurl = (($contact_details["addr"] != "") ? $contact_details["addr"] : $jj->url);
 
@@ -210,8 +209,8 @@ function dirfind_content(App $a, $prefix = "") {
                                        $conntxt = "";
                                        $contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
                                        if (DBA::isResult($contact)) {
-                                               $photo_menu = Contact::photoMenu($contact);
-                                               $details = _contact_detail_for_template($contact);
+                                               $photo_menu = Model\Contact::photoMenu($contact);
+                                               $details = Module\Contact::getContactTemplateVars($contact);
                                                $alt_text = $details['alt_text'];
                                        } else {
                                                $photo_menu = [];
@@ -222,12 +221,12 @@ function dirfind_content(App $a, $prefix = "") {
 
                                        $contact = DBA::selectFirst('contact', [], ['id' => $jj->pcid]);
                                        if (DBA::isResult($contact)) {
-                                               $photo_menu = Contact::photoMenu($contact);
+                                               $photo_menu = Model\Contact::photoMenu($contact);
                                        } else {
                                                $photo_menu = [];
                                        }
 
-                                       $photo_menu['profile'] = [L10n::t("View Profile"), Contact::magicLink($jj->url)];
+                                       $photo_menu['profile'] = [L10n::t("View Profile"), Model\Contact::magicLink($jj->url)];
                                        $photo_menu['follow'] = [L10n::t("Connect/Follow"), $connlnk];
                                }
 
@@ -235,7 +234,7 @@ function dirfind_content(App $a, $prefix = "") {
 
                                $entry = [
                                        'alt_text' => $alt_text,
-                                       'url' => Contact::magicLink($jj->url),
+                                       'url' => Model\Contact::magicLink($jj->url),
                                        'itemurl' => $itemurl,
                                        'name' => htmlentities($jj->name),
                                        'thumb' => ProxyUtils::proxifyUrl($jj->photo, false, ProxyUtils::SIZE_THUMB),
@@ -246,7 +245,7 @@ function dirfind_content(App $a, $prefix = "") {
                                        'details'       => $contact_details['location'],
                                        'tags'          => $contact_details['keywords'],
                                        'about'         => $contact_details['about'],
-                                       'account_type'  => Contact::getAccountType($contact_details),
+                                       'account_type'  => Model\Contact::getAccountType($contact_details),
                                        'network' => ContactSelector::networkToName($jj->network, $jj->url),
                                        'id' => ++$id,
                                ];
index d6493b3c0c1a8aa34f4d9c547ca1688fe3ca8759..780145ed3f72d885791cc6f6be7c1a3bfbe574d3 100644 (file)
@@ -21,20 +21,14 @@ function editpost_content(App $a)
        }
 
        $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
-       $return_url = (($a->argc > 2) ? base64_decode($a->argv[2]) : '');
 
        if (!$post_id) {
                notice(L10n::t('Item not found') . EOL);
                return;
        }
 
-       // Fallback to SESSION return_path
-       if (empty($return_url)) {
-               $return_url = $_SESSION['return_url'];
-       }
-
        $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
-               'type', 'body', 'title', 'file', 'wall', 'post-type'];
+               'type', 'body', 'title', 'file', 'wall', 'post-type', 'guid'];
 
        $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
 
@@ -92,7 +86,7 @@ function editpost_content(App $a)
 
        $o .= replace_macros($tpl, [
                '$is_edit' => true,
-               '$return_path' => $return_url,
+               '$return_path' => '/display/' . $item['guid'],
                '$action' => 'item',
                '$share' => L10n::t('Save'),
                '$upload' => L10n::t('Upload photo'),
index 8f65eb643dbfd4bf951b803ffeeb269b3e5584d7..f8fefc78f9e96cf91ac481f713ea956b8568df77 100644 (file)
@@ -11,12 +11,12 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
-use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model;
+use Friendica\Module;
 
 function group_init(App $a) {
        if (local_user()) {
-               $a->page['aside'] = Group::sidebarWidget('contacts', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone'));
+               $a->page['aside'] = Model\Group::sidebarWidget('contacts', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone'));
        }
 }
 
@@ -31,10 +31,10 @@ function group_post(App $a) {
                check_form_security_token_redirectOnErr('/group/new', 'group_edit');
 
                $name = notags(trim($_POST['groupname']));
-               $r = Group::create(local_user(), $name);
+               $r = Model\Group::create(local_user(), $name);
                if ($r) {
                        info(L10n::t('Group created.') . EOL);
-                       $r = Group::getIdByName(local_user(), $name);
+                       $r = Model\Group::getIdByName(local_user(), $name);
                        if ($r) {
                                goaway(System::baseUrl() . '/group/' . $r);
                        }
@@ -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];
@@ -71,7 +71,7 @@ function group_post(App $a) {
                        }
                }
 
-               $a->page['aside'] = Group::sidebarWidget();
+               $a->page['aside'] = Model\Group::sidebarWidget();
        }
        return;
 }
@@ -116,8 +116,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 = [
@@ -150,7 +148,7 @@ function group_content(App $a) {
                        $result = null;
 
                        if (DBA::isResult($r)) {
-                               $result = Group::removeByName(local_user(), $r[0]['name']);
+                               $result = Model\Group::removeByName(local_user(), $r[0]['name']);
                        }
 
                        if ($result) {
@@ -176,8 +174,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())
@@ -185,11 +181,11 @@ 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];
-               $members = Contact::getByGroupId($group['id']);
+               $members = Model\Contact::getByGroupId($group['id']);
                $preselected = [];
                $entry = [];
                $id = 0;
@@ -202,12 +198,12 @@ function group_content(App $a) {
 
                if ($change) {
                        if (in_array($change, $preselected)) {
-                               Group::removeMember($group['id'], $change);
+                               Model\Group::removeMember($group['id'], $change);
                        } else {
-                               Group::addMember($group['id'], $change);
+                               Model\Group::addMember($group['id'], $change);
                        }
 
-                       $members = Contact::getByGroupId($group['id']);
+                       $members = Model\Contact::getByGroupId($group['id']);
                        $preselected = [];
                        if (count($members)) {
                                foreach ($members as $member) {
@@ -253,7 +249,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 = Module\Contact::getContactTemplateVars($member);
                        $entry['label'] = 'members';
                        $entry['photo_menu'] = '';
                        $entry['change_member'] = [
@@ -265,12 +261,12 @@ function group_content(App $a) {
 
                        $groupeditor['members'][] = $entry;
                } else {
-                       Group::removeMember($group['id'], $member['id']);
+                       Model\Group::removeMember($group['id'], $member['id']);
                }
        }
 
        if ($nogroup) {
-               $r = Contact::getUngroupedList(local_user());
+               $r = Model\Contact::getUngroupedList(local_user());
        } else {
                $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `self` ORDER BY `name` ASC",
                        intval(local_user())
@@ -282,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_detail_for_template($member);
+                               $entry = Module\Contact::getContactTemplateVars($member);
                                $entry['label'] = 'contacts';
                                if (!$nogroup)
                                        $entry['photo_menu'] = [];
index b3bf310d5bb8515f938bbd0a39771513d82a83d4..cd59cc780c23ccf7116cf90091ff49d3558b2d55 100644 (file)
@@ -36,13 +36,13 @@ function newmember_content(App $a)
                $o .= '<li>' . '<a target="newmember" href="settings/connectors">' . L10n::t('Importing Emails') . '</a><br />' . 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') . '</li>' . EOL;
        }
 
-       $o .= '<li>' . '<a target="newmember" href="contacts">' . L10n::t('Go to Your Contacts Page') . '</a><br />' . 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 <em>Add New Contact</em> dialog.') . '</li>' . EOL;
+       $o .= '<li>' . '<a target="newmember" href="contact">' . L10n::t('Go to Your Contacts Page') . '</a><br />' . 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 <em>Add New Contact</em> dialog.') . '</li>' . EOL;
        $o .= '<li>' . '<a target="newmember" href="directory">' . L10n::t("Go to Your Site's Directory") . '</a><br />' . L10n::t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</li>' . EOL;
-       $o .= '<li>' . '<a target="newmember" href="contacts">' . L10n::t('Finding New People') . '</a><br />' . 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.") . '</li>' . EOL;
+       $o .= '<li>' . '<a target="newmember" href="contact">' . L10n::t('Finding New People') . '</a><br />' . 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.") . '</li>' . EOL;
        $o .= '</ul>';
        $o .= '<h4>' . L10n::t('Groups') . '</h4>';
        $o .= '<ul>';
-       $o .= '<li>' . '<a target="newmember" href="contacts">' . L10n::t('Group Your Contacts') . '</a><br />' . 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.') . '</li>' . EOL;
+       $o .= '<li>' . '<a target="newmember" href="contact">' . L10n::t('Group Your Contacts') . '</a><br />' . 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.') . '</li>' . EOL;
 
        if (Config::get('system', 'newuser_private')) {
                $o .= '<li>' . '<a target="newmember" href="help/Groups-and-Privacy">' . L10n::t("Why Aren't My Posts Public?") . '</a><br />' . 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.") . '</li>' . EOL;
index 40eddc3bdd5053afcd93e1581048d4f13f9baf1f..a14379e7096da14cbb13b86fb022c71dbd7a79b3 100644 (file)
@@ -73,6 +73,7 @@ function parse_url_content(App $a)
                                $hdrs[$k] = $v;
                        }
                }
+               $type = null;
                if (array_key_exists('Content-Type', $hdrs)) {
                        $type = $hdrs['Content-Type'];
                }
index 863542e66667eb5e0de64efb435b0f2494d0c529..1144ed1427128fe1c3214c769361ac8abbc75d3f 100644 (file)
@@ -5,8 +5,7 @@
 use Friendica\App;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
-
-require_once 'mod/contacts.php';
+use Friendica\Module\Contact;
 
 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 = Contact::content($a, true);
        } else {
                $text = '';
        }
index 7a1a149a2fffd0a88540da451ee37be1f4daa18e..4f6f4ae0b905adc3832da6e8abf56db386922ff3 100644 (file)
@@ -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
index 66f4190b287eca731fe8b465dea18da5504b0feb..c903ee6945790fcd96e85c476af168c4ff124c91 100644 (file)
@@ -1265,9 +1265,6 @@ class BBCode extends BaseObject
                $text = preg_replace("/\s?\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "[share$1]$2[/share]", $text);
                $text = preg_replace("/\s?\[quote(.*?)\]\s?(.*?)\s?\[\/quote\]\s?/ism", "[quote$1]$2[/quote]", $text);
 
-               $text = preg_replace("/\n\[code\]/ism", "[code]", $text);
-               $text = preg_replace("/\[\/code\]\n/ism", "[/code]", $text);
-
                // when the content is meant exporting to other systems then remove the avatar picture since this doesn't really look good on these systems
                if (!$try_oembed) {
                        $text = preg_replace("/\[share(.*?)avatar\s?=\s?'.*?'\s?(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "\n[share$1$2]$3[/share]", $text);
@@ -1717,18 +1714,6 @@ class BBCode extends BaseObject
                        $text = Smilies::replace($text, false, true);
                }
 
-               // Replace inline code blocks
-               $text = preg_replace_callback("|(?!<br[^>]*>)<code>([^<]*)</code>(?!<br[^>]*>)|ism",
-                       function ($match) use ($simple_html) {
-                               $return = '<key>' . $match[1] . '</key>';
-                               // Use <code> for Diaspora inline code blocks
-                               if ($simple_html === 3) {
-                                       $return = '<code>' . $match[1] . '</code>';
-                               }
-                               return $return;
-                       }
-               , $text);
-
                // Unhide all [noparse] contained bbtags unspacefying them
                // and triming the [noparse] tag.
 
index bf7e9f3bc895943a6f31c4d9c48c02893416552f..723cd809da44d3230721afd1eb4e06cf5a17ffb7 100644 (file)
@@ -8,6 +8,7 @@ use Friendica\Database\DBA;
 use Friendica\Model\Process;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
+use Friendica\BaseObject;
 
 require_once 'include/dba.php';
 
@@ -152,7 +153,8 @@ class Worker
         */
        private static function totalEntries()
        {
-               return DBA::count('workerqueue', ["`executed` <= ? AND NOT `done`", NULL_DATE]);
+               return DBA::count('workerqueue', ["`executed` <= ? AND NOT `done` AND `next_try` < ?",
+                       NULL_DATE, DateTimeFormat::utcNow()]);
        }
 
        /**
@@ -162,7 +164,7 @@ class Worker
         */
        private static function highestPriority()
        {
-               $condition = ["`executed` <= ? AND NOT `done`", NULL_DATE];
+               $condition = ["`executed` <= ? AND NOT `done` AND `next_try` < ?", NULL_DATE, DateTimeFormat::utcNow()];
                $workerqueue = DBA::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
                if (DBA::isResult($workerqueue)) {
                        return $workerqueue["priority"];
@@ -180,7 +182,8 @@ class Worker
         */
        private static function processWithPriorityActive($priority)
        {
-               $condition = ["`priority` <= ? AND `executed` > ? AND NOT `done`", $priority, NULL_DATE];
+               $condition = ["`priority` <= ? AND `executed` > ? AND NOT `done` AND `next_try` < ?",
+                       $priority, NULL_DATE, DateTimeFormat::utcNow()];
                return DBA::exists('workerqueue', $condition);
        }
 
@@ -240,7 +243,7 @@ class Worker
                        self::execFunction($queue, $include, $argv, true);
 
                        $stamp = (float)microtime(true);
-                       if (DBA::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
+                       if (DBA::update('workerqueue', ['done' => true], ['id' => $queue['id']])) {
                                Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow());
                        }
                        self::$db_duration = (microtime(true) - $stamp);
@@ -805,7 +808,8 @@ class Worker
                        $result = DBA::select(
                                'workerqueue',
                                ['id'],
-                               ["`executed` <= ? AND `priority` < ? AND NOT `done`", NULL_DATE, $highest_priority],
+                               ["`executed` <= ? AND `priority` < ? AND NOT `done` AND `next_try` < ?",
+                               NULL_DATE, $highest_priority, DateTimeFormat::utcNow()],
                                ['limit' => $limit, 'order' => ['priority', 'created']]
                        );
 
@@ -821,7 +825,8 @@ class Worker
                                $result = DBA::select(
                                        'workerqueue',
                                        ['id'],
-                                       ["`executed` <= ? AND `priority` > ? AND NOT `done`", NULL_DATE, $highest_priority],
+                                       ["`executed` <= ? AND `priority` > ? AND NOT `done` AND `next_try` < ?",
+                                       NULL_DATE, $highest_priority, DateTimeFormat::utcNow()],
                                        ['limit' => $limit, 'order' => ['priority', 'created']]
                                );
 
@@ -840,7 +845,8 @@ class Worker
                        $result = DBA::select(
                                'workerqueue',
                                ['id'],
-                               ["`executed` <= ? AND NOT `done`", NULL_DATE],
+                               ["`executed` <= ? AND NOT `done` AND `next_try` < ?",
+                               NULL_DATE, DateTimeFormat::utcNow()],
                                ['limit' => $limit, 'order' => ['priority', 'created']]
                        );
 
@@ -1116,6 +1122,35 @@ class Worker
                return true;
        }
 
+       /**
+        * Defers the current worker entry
+        */
+       public static function defer()
+       {
+               if (empty(BaseObject::getApp()->queue)) {
+                       return;
+               }
+
+               $queue = BaseObject::getApp()->queue;
+
+               $retrial = $queue['retrial'];
+               $id = $queue['id'];
+
+               if ($retrial > 14) {
+                       logger('Id ' . $id . ' had been tried 14 times, it will be deleted now.', LOGGER_DEBUG);
+                       DBA::delete('workerqueue', ['id' => $id]);
+               }
+
+               // Calculate the delay until the next trial
+               $delay = (($retrial + 3) ** 4) + (rand(1, 30) * ($retrial + 1));
+               $next = DateTimeFormat::utc('now + ' . $delay . ' seconds');
+
+               logger('Defer execution ' . $retrial . ' of id ' . $id . ' to ' . $next, LOGGER_DEBUG);
+
+               $fields = ['retrial' => $retrial + 1, 'next_try' => $next, 'executed' => NULL_DATE, 'pid' => 0];
+               DBA::update('workerqueue', $fields, ['id' => $id]);
+       }
+
        /**
         * Log active processes into the "process" table
         *
index 0472d753ddba2620a831ce6618fe85ed1fd57954..f8fc1651c140ece8dffd8385f65097bdf1561638 100644 (file)
@@ -83,10 +83,11 @@ class DBStructure
                        $body = sprintf($body, $error_message);
 
                        notification([
-                               'type' => SYSTEM_EMAIL,
+                               'uid'      => $admin['uid'],
+                               'type'     => SYSTEM_EMAIL,
                                'to_email' => $admin['email'],
                                'preamble' => $preamble,
-                               'body' => $body,
+                               'body'     => $body,
                                'language' => $lang]
                        );
                }
index 23c31d0b17c40fb20962208a05dc6327c335058f..4588bb7129d3e4f2f4ad8936e177f5d133422f29 100644 (file)
@@ -521,7 +521,7 @@ class Contact extends BaseObject
                }
 
                // Archive the contact
-               DBA::update('contact', ['archive' => true, 'network' => Protocol::PHANTOM], ['id' => $id]);
+               DBA::update('contact', ['archive' => true, 'network' => Protocol::PHANTOM, 'deleted' => true], ['id' => $id]);
 
                // Delete it in the background
                Worker::add(PRIORITY_LOW, 'RemoveContact', $id);
@@ -825,7 +825,7 @@ class Contact extends BaseObject
                // Fetch contact data from the contact table for the given user
                $r = q("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
                        `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, `self`
-                       FROM `contact` WHERE `addr` = '%s' AND `uid` = %d",
+                       FROM `contact` WHERE `addr` = '%s' AND `uid` = %d AND NOT `deleted`",
                        DBA::escape($addr),
                        intval($uid)
                );
@@ -833,7 +833,7 @@ class Contact extends BaseObject
                if (!DBA::isResult($r)) {
                        $r = q("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
                                `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
-                               FROM `contact` WHERE `addr` = '%s' AND `uid` = 0",
+                               FROM `contact` WHERE `addr` = '%s' AND `uid` = 0 AND NOT `deleted`",
                                DBA::escape($addr)
                        );
                }
@@ -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';
                }
 
                /**
@@ -1036,18 +1036,18 @@ class Contact extends BaseObject
 
                /// @todo Verify if we can't use Contact::getDetailsByUrl instead of the following
                // We first try the nurl (http://server.tld/nick), most common case
-               $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
+               $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid, 'deleted' => false]);
 
                // Then the addr (nick@server.tld)
                if (!DBA::isResult($contact)) {
-                       $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
+                       $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['addr' => $url, 'uid' => $uid, 'deleted' => false]);
                }
 
                // Then the alias (which could be anything)
                if (!DBA::isResult($contact)) {
                        // The link could be provided as http although we stored it as https
                        $ssl_url = str_replace('http://', 'https://', $url);
-                       $condition = ['`alias` IN (?, ?, ?) AND `uid` = ?', $url, normalise_link($url), $ssl_url, $uid];
+                       $condition = ['`alias` IN (?, ?, ?) AND `uid` = ? AND NOT `deleted`', $url, normalise_link($url), $ssl_url, $uid];
                        $contact = DBA::selectFirst('contact', ['id', 'avatar', 'avatar-date'], $condition);
                }
 
@@ -1515,7 +1515,7 @@ class Contact extends BaseObject
                $ret = Probe::uri($contact["url"], $network);
 
                // If Probe::uri fails the network code will be different
-               if (($ret["network"] != $contact["network"]) && ($ret["network"] != $network)) {
+               if (($ret["network"] != $contact["network"]) && !in_array($ret["network"], [Protocol::ACTIVITYPUB, $network])) {
                        return false;
                }
 
index 71f794118940f2032bdf59fac3e1cb44c2c7043b..e313842e4143677afceb1f143dddb18eff3a0c31 100644 (file)
@@ -349,7 +349,7 @@ class Group extends BaseObject
         * @param int $cid
         * @return string
         */
-       public static function sidebarWidget($every = 'contacts', $each = 'group', $editmode = 'standard', $group_id = '', $cid = 0)
+       public static function sidebarWidget($every = 'contact', $each = 'group', $editmode = 'standard', $group_id = '', $cid = 0)
        {
                $o = '';
 
@@ -404,7 +404,7 @@ class Group extends BaseObject
                        'newgroup' => $editmode == 'extended' || $editmode == 'full' ? 1 : '',
                        'grouppage' => 'group/',
                        '$edittext' => L10n::t('Edit group'),
-                       '$ungrouped' => $every === 'contacts' ? L10n::t('Contacts not in any group') : '',
+                       '$ungrouped' => $every === 'contact' ? L10n::t('Contacts not in any group') : '',
                        '$ungrouped_selected' => (($group_id === 'none') ? 'group-selected' : ''),
                        '$createtext' => L10n::t('Create a new group'),
                        '$creategroup' => L10n::t('Group Name: '),
index ed80f4e9e802acf735b6adf4e47225afd6a33f86..097baa658f9bf95642ad169648af266da3955e28 100644 (file)
@@ -231,6 +231,10 @@ class Item extends BaseObject
                        }
                }
 
+               if (array_key_exists('signed_text', $row) && array_key_exists('interaction', $row) && !is_null($row['interaction'])) {
+                       $row['signed_text'] = $row['interaction'];
+               }
+
                if (array_key_exists('ignored', $row) && array_key_exists('internal-user-ignored', $row) && !is_null($row['internal-user-ignored'])) {
                        $row['ignored'] = $row['internal-user-ignored'];
                }
@@ -242,6 +246,7 @@ class Item extends BaseObject
                unset($row['internal-iaid']);
                unset($row['internal-icid']);
                unset($row['internal-user-ignored']);
+               unset($row['interaction']);
 
                return $row;
        }
@@ -375,7 +380,7 @@ class Item extends BaseObject
                        $usermode = true;
                }
 
-               $fields = self::fieldlist($selected, $usermode);
+               $fields = self::fieldlist($usermode);
 
                $select_fields = self::constructSelectFields($fields, $selected);
 
@@ -482,7 +487,7 @@ class Item extends BaseObject
                        $usermode = true;
                }
 
-               $fields = self::fieldlist($selected, $usermode);
+               $fields = self::fieldlist($usermode);
 
                $fields['thread'] = ['mention', 'ignored', 'iid'];
 
@@ -518,7 +523,7 @@ class Item extends BaseObject
         *
         * @return array field list
         */
-       private static function fieldlist($selected, $usermode)
+       private static function fieldlist($usermode)
        {
                $fields = [];
 
@@ -567,6 +572,8 @@ class Item extends BaseObject
 
                $fields['sign'] = ['signed_text', 'signature', 'signer'];
 
+               $fields['diaspora-interaction'] = ['interaction'];
+
                return $fields;
        }
 
@@ -653,12 +660,16 @@ class Item extends BaseObject
                        $joins .= " LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id`";
                }
 
+               if (strpos($sql_commands, "`diaspora-interaction`.") !== false) {
+                       $joins .= " LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `item`.`uri-id`";
+               }
+
                if (strpos($sql_commands, "`item-activity`.") !== false) {
-                       $joins .= " LEFT JOIN `item-activity` ON `item-activity`.`id` = `item`.`iaid`";
+                       $joins .= " LEFT JOIN `item-activity` ON `item-activity`.`uri-id` = `item`.`uri-id`";
                }
 
                if (strpos($sql_commands, "`item-content`.") !== false) {
-                       $joins .= " LEFT JOIN `item-content` ON `item-content`.`id` = `item`.`icid`";
+                       $joins .= " LEFT JOIN `item-content` ON `item-content`.`uri-id` = `item`.`uri-id`";
                }
 
                if (strpos($sql_commands, "`item-delivery-data`.") !== false) {
@@ -705,6 +716,10 @@ class Item extends BaseObject
                        $selected[] = 'internal-user-ignored';
                }
 
+               if (in_array('signed_text', $selected)) {
+                       $selected[] = 'interaction';
+               }
+
                $selection = [];
                foreach ($fields as $table => $table_fields) {
                        foreach ($table_fields as $field => $select) {
@@ -1487,7 +1502,6 @@ class Item extends BaseObject
                $deny_gid  = '';
 
                if ($item['parent-uri'] === $item['uri']) {
-                       $diaspora_signed_text = '';
                        $parent_id = 0;
                        $parent_deleted = 0;
                        $allow_cid = $item['allow_cid'];
@@ -1534,10 +1548,6 @@ class Item extends BaseObject
                                $item['wall']    = $parent['wall'];
                                $notify_type    = 'comment-new';
 
-                               if (!$parent['origin']) {
-                                       $diaspora_signed_text = '';
-                               }
-
                                /*
                                 * If the parent is private, force privacy for the entire conversation
                                 * This differs from the above settings as it subtly allows comments from
@@ -1578,7 +1588,6 @@ class Item extends BaseObject
                                        $parent_id = 0;
                                        $item['parent-uri'] = $item['uri'];
                                        $item['gravity'] = GRAVITY_PARENT;
-                                       $diaspora_signed_text = '';
                                } else {
                                        logger('item parent '.$item['parent-uri'].' for '.$item['uid'].' was not found - ignoring item');
                                        return 0;
@@ -1803,14 +1812,17 @@ class Item extends BaseObject
                                logger("Repaired double encoded signature from handle ".$dsprsig->signer, LOGGER_DEBUG);
                        }
 
-                       DBA::insert('sign', ['iid' => $current_post, 'signed_text' => $dsprsig->signed_text,
-                                               'signature' => $dsprsig->signature, 'signer' => $dsprsig->signer]);
+                       if (!empty($dsprsig->signed_text) && empty($dsprsig->signature) && empty($dsprsig->signer)) {
+                               DBA::insert('diaspora-interaction', ['uri-id' => $item['uri-id'], 'interaction' => $dsprsig->signed_text], true);
+                       } else {
+                               // The other fields are used by very old Friendica servers, so we currently store them differently
+                               DBA::insert('sign', ['iid' => $current_post, 'signed_text' => $dsprsig->signed_text,
+                                       'signature' => $dsprsig->signature, 'signer' => $dsprsig->signer]);
+                       }
                }
 
                if (!empty($diaspora_signed_text)) {
-                       // Formerly we stored the signed text, the signature and the author in different fields.
-                       // We now store the raw data so that we are more flexible.
-                       DBA::insert('sign', ['iid' => $current_post, 'signed_text' => $diaspora_signed_text]);
+                       DBA::insert('diaspora-interaction', ['uri-id' => $item['uri-id'], 'interaction' => $diaspora_signed_text], true);
                }
 
                $deleted = self::tagDeliver($item['uid'], $current_post);
index 28736750bdd9638d80b24cf961f431fc7afca291..1f0773cd18c5998d6aac26b945a98071d6826967 100644 (file)
@@ -1010,56 +1010,59 @@ class Profile
                $my_url = self::getMyURL();
                $my_url = Network::isUrlValid($my_url);
 
-               if ($my_url) {
-                       if (!local_user()) {
-                               // Is it a DDoS attempt?
-                               // The check fetches the cached value from gprobe to reduce the load for this system
-                               $urlparts = parse_url($my_url);
-
-                               $result = Cache::get('gprobe:' . $urlparts['host']);
-                               if ((!is_null($result)) && (in_array($result['network'], [Protocol::FEED, Protocol::PHANTOM]))) {
-                                       logger('DDoS attempt detected for ' . $urlparts['host'] . ' by ' . $_SERVER['REMOTE_ADDR'] . '. server data: ' . print_r($_SERVER, true), LOGGER_DEBUG);
-                                       return;
-                               }
+               if (empty($my_url) || local_user()) {
+                       return;
+               }
 
-                               Worker::add(PRIORITY_LOW, 'GProbe', $my_url);
-                               $arr = ['zrl' => $my_url, 'url' => $a->cmd];
-                               Addon::callHooks('zrl_init', $arr);
+               $arr = ['zrl' => $my_url, 'url' => $a->cmd];
+               Addon::callHooks('zrl_init', $arr);
 
-                               // Try to find the public contact entry of the visitor.
-                               $cid = Contact::getIdForURL($my_url);
-                               if (!$cid) {
-                                       logger('No contact record found for ' . $my_url, LOGGER_DEBUG);
-                                       return;
-                               }
+               // Try to find the public contact entry of the visitor.
+               $cid = Contact::getIdForURL($my_url);
+               if (!$cid) {
+                       logger('No contact record found for ' . $my_url, LOGGER_DEBUG);
+                       return;
+               }
 
-                               $contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
+               $contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
 
-                               if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) {
-                                       // The visitor is already authenticated.
-                                       return;
-                               }
+               if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) {
+                       logger('The visitor ' . $my_url . ' is already authenticated', LOGGER_DEBUG);
+                       return;
+               }
 
-                               logger('Not authenticated. Invoking reverse magic-auth for ' . $my_url, LOGGER_DEBUG);
+               // Avoid endless loops
+               $cachekey = 'zrlInit:' . $my_url;
+               if (Cache::get($cachekey)) {
+                       logger('URL ' . $my_url . ' already tried to authenticate.', LOGGER_DEBUG);
+                       return;
+               } else {
+                       Cache::set($cachekey, true, CACHE_MINUTE);
+               }
 
-                               // Try to avoid recursion - but send them home to do a proper magic auth.
-                               $query = str_replace(array('?zrl=', '&zid='), array('?rzrl=', '&rzrl='), $a->query_string);
-                               // The other instance needs to know where to redirect.
-                               $dest = urlencode(System::baseUrl() . '/' . $query);
+               logger('Not authenticated. Invoking reverse magic-auth for ' . $my_url, LOGGER_DEBUG);
 
-                               // We need to extract the basebath from the profile url
-                               // to redirect the visitors '/magic' module.
-                               // Note: We should have the basepath of a contact also in the contact table.
-                               $urlarr = explode('/profile/', $contact['url']);
-                               $basepath = $urlarr[0];
+               Worker::add(PRIORITY_LOW, 'GProbe', $my_url);
 
-                               if ($basepath != System::baseUrl() && !strstr($dest, '/magic') && !strstr($dest, '/rmagic')) {
-                                       $magic_path = $basepath . '/magic' . '?f=&owa=1&dest=' . $dest;
-                                       $serverret = Network::curl($magic_path);
-                                       if ($serverret->isSuccess()) {
-                                               goaway($magic_path);
-                                       }
-                               }
+               // Try to avoid recursion - but send them home to do a proper magic auth.
+               $query = str_replace(array('?zrl=', '&zid='), array('?rzrl=', '&rzrl='), $a->query_string);
+               // The other instance needs to know where to redirect.
+               $dest = urlencode(System::baseUrl() . '/' . $query);
+
+               // We need to extract the basebath from the profile url
+               // to redirect the visitors '/magic' module.
+               // Note: We should have the basepath of a contact also in the contact table.
+               $urlarr = explode('/profile/', $contact['url']);
+               $basepath = $urlarr[0];
+
+               if ($basepath != System::baseUrl() && !strstr($dest, '/magic') && !strstr($dest, '/rmagic')) {
+                       $magic_path = $basepath . '/magic' . '?f=&owa=1&dest=' . $dest;
+
+                       // We have to check if the remote server does understand /magic without invoking something
+                       $serverret = Network::curl($basepath . '/magic');
+                       if ($serverret->isSuccess()) {
+                               logger('Doing magic auth for visitor ' . $my_url . ' to ' . $magic_path, LOGGER_DEBUG);
+                               goaway($magic_path);
                        }
                }
        }
diff --git a/src/Module/Contact.php b/src/Module/Contact.php
new file mode 100644 (file)
index 0000000..0eb912e
--- /dev/null
@@ -0,0 +1,1106 @@
+<?php
+
+namespace Friendica\Module;
+
+use Friendica\App;
+use Friendica\BaseModule;
+use Friendica\Content\ContactSelector;
+use Friendica\Content\Nav;
+use Friendica\Content\Text\BBCode;
+use Friendica\Content\Widget;
+use Friendica\Core\Addon;
+use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
+use Friendica\Core\System;
+use Friendica\Core\Worker;
+use Friendica\Database\DBA;
+use Friendica\Model;
+use Friendica\Network\Probe;
+use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Proxy as ProxyUtils;
+use Friendica\Core\ACL;
+use Friendica\Module\Login;
+
+/**
+ *  Manages and show Contacts and their content
+ *
+ *  @brief manages contacts
+ */
+class Contact extends BaseModule
+{
+       public static function init()
+       {
+               $a = self::getApp();
+
+               if (!local_user()) {
+                       return;
+               }
+
+               $nets = defaults($_GET, 'nets', '');
+               if ($nets == 'all') {
+                       $nets = '';
+               }
+
+               if (!x($a->page, 'aside')) {
+                       $a->page['aside'] = '';
+               }
+
+               $contact_id = null;
+               $contact = null;
+               if ($a->argc == 2 && intval($a->argv[1])
+                       || $a->argc == 3 && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])
+               ) {
+                       $contact_id = intval($a->argv[1]);
+                       $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
+
+                       if (!DBA::isResult($contact)) {
+                               $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => 0]);
+                       }
+
+                       // Don't display contacts that are about to be deleted
+                       if ($contact['network'] == Protocol::PHANTOM) {
+                               $contact = false;
+                       }
+               }
+
+               if (DBA::isResult($contact)) {
+                       if ($contact['self']) {
+                               if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) {
+                                       goaway('profile/' . $contact['nick']);
+                               } else {
+                                       goaway('profile/' . $contact['nick'] . '?tab=profile');
+                               }
+                       }
+
+                       $a->data['contact'] = $contact;
+
+                       if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) {
+                               $networkname = format_network_name($contact['network'], $contact['url']);
+                       } else {
+                               $networkname = '';
+                       }
+
+                       /// @TODO Add nice spaces
+                       $vcard_widget = replace_macros(get_markup_template('vcard-widget.tpl'), [
+                               '$name'         => htmlentities($contact['name']),
+                               '$photo'        => $contact['photo'],
+                               '$url'          => Model\Contact::MagicLink($contact['url']),
+                               '$addr'         => defaults($contact, 'addr', ''),
+                               '$network_name' => $networkname,
+                               '$network'      => L10n::t('Network:'),
+                               '$account_type' => Model\Contact::getAccountType($contact)
+                       ]);
+
+                       $findpeople_widget = '';
+                       $follow_widget = '';
+                       $networks_widget = '';
+               } else {
+                       $vcard_widget = '';
+                       $networks_widget = Widget::networks('contact', $nets);
+                       if (isset($_GET['add'])) {
+                               $follow_widget = Widget::follow($_GET['add']);
+                       } else {
+                               $follow_widget = Widget::follow();
+                       }
+
+                       $findpeople_widget = Widget::findPeople();
+               }
+
+               if ($contact['uid'] != 0) {
+                       $groups_widget = Model\Group::sidebarWidget('contact', 'group', 'full', 'everyone', $contact_id);
+               } else {
+                       $groups_widget = null;
+               }
+
+               $a->page['aside'] .= replace_macros(get_markup_template('contacts-widget-sidebar.tpl'), [
+                       '$vcard_widget'      => $vcard_widget,
+                       '$findpeople_widget' => $findpeople_widget,
+                       '$follow_widget'     => $follow_widget,
+                       '$groups_widget'     => $groups_widget,
+                       '$networks_widget'   => $networks_widget
+               ]);
+
+               $base = $a->getBaseURL();
+               $tpl = get_markup_template('contacts-head.tpl');
+               $a->page['htmlhead'] .= replace_macros($tpl, [
+                       '$baseurl' => System::baseUrl(true),
+                       '$base' => $base
+               ]);
+       }
+
+       private static function batchActions(App $a)
+       {
+               if (empty($_POST['contact_batch']) || !is_array($_POST['contact_batch'])) {
+                       return;
+               }
+
+               $contacts_id = $_POST['contact_batch'];
+
+               $stmt = DBA::select('contact', ['id'], ['id' => $contacts_id, 'uid' => local_user(), 'self' => false]);
+               $orig_records = DBA::toArray($stmt);
+
+               $count_actions = 0;
+               foreach ($orig_records as $orig_record) {
+                       $contact_id = $orig_record['id'];
+                       if (!empty($_POST['contacts_batch_update'])) {
+                               self::updateContactFromPoll($contact_id);
+                               $count_actions++;
+                       }
+                       if (!empty($_POST['contacts_batch_block'])) {
+                               self::blockContact($contact_id);
+                               $count_actions++;
+                       }
+                       if (!empty($_POST['contacts_batch_ignore'])) {
+                               self::ignoreContact($contact_id);
+                               $count_actions++;
+                       }
+                       if (!empty($_POST['contacts_batch_archive'])
+                               && self::archiveContact($contact_id, $orig_record)
+                       ) {
+                               $count_actions++;
+                       }
+                       if (!empty($_POST['contacts_batch_drop'])) {
+                               self::dropContact($orig_record);
+                               $count_actions++;
+                       }
+               }
+               if ($count_actions > 0) {
+                       info(L10n::tt('%d contact edited.', '%d contacts edited.', $count_actions));
+               }
+
+               goaway('contact');
+       }
+
+       public static function post()
+       {
+               $a = self::getApp();
+
+               if (!local_user()) {
+                       return;
+               }
+
+               if ($a->argv[1] === 'batch') {
+                       self::batchActions($a);
+                       return;
+               }
+
+               $contact_id = intval($a->argv[1]);
+               if (!$contact_id) {
+                       return;
+               }
+
+               if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
+                       notice(L10n::t('Could not access contact record.') . EOL);
+                       goaway('contact');
+                       return; // NOTREACHED
+               }
+
+               Addon::callHooks('contact_edit_post', $_POST);
+
+               $profile_id = intval(defaults($_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']);
+
+               $fetch_further_information = intval(defaults($_POST, 'fetch_further_information', 0));
+
+               $ffi_keyword_blacklist = escape_tags(trim(defaults($_POST, 'ffi_keyword_blacklist', '')));
+
+               $priority = intval(defaults($_POST, 'poll', 0));
+               if ($priority > 5 || $priority < 0) {
+                       $priority = 0;
+               }
+
+               $info = escape_tags(trim($_POST['info']));
+
+               $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 {
+                       notice(L10n::t('Failed to update contact record.') . EOL);
+               }
+
+               $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
+               if (DBA::isResult($contact)) {
+                       $a->data['contact'] = $contact;
+               }
+
+               return;
+       }
+
+       /* contact actions */
+
+       private static function updateContactFromPoll($contact_id)
+       {
+               $contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
+               if (!DBA::isResult($contact)) {
+                       return;
+               }
+
+               $uid = $contact['uid'];
+
+               if ($contact['network'] == Protocol::OSTATUS) {
+                       $result = Model\Contact::createFromProbe($uid, $contact['url'], false, $contact['network']);
+
+                       if ($result['success']) {
+                               DBA::update('contact', ['subhub' => 1], ['id' => $contact_id]);
+                       }
+               } else {
+                       // pull feed and consume it, which should subscribe to the hub.
+                       Worker::add(PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
+               }
+       }
+
+       private static function updateContactFromProbe($contact_id)
+       {
+               $contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
+               if (!DBA::isResult($contact)) {
+                       return;
+               }
+
+               $uid = $contact['uid'];
+
+               $data = Probe::uri($contact['url'], '', 0, false);
+
+               // 'Feed' or 'Unknown' is mostly a sign of communication problems
+               if ((in_array($data['network'], [Protocol::FEED, Protocol::PHANTOM])) && ($data['network'] != $contact['network'])) {
+                       return;
+               }
+
+               $updatefields = ['name', 'nick', 'url', 'addr', 'batch', 'notify', 'poll', 'request', 'confirm', 'poco', 'network', 'alias'];
+               $fields = [];
+
+               if ($data['network'] == Protocol::OSTATUS) {
+                       $result = Model\Contact::createFromProbe($uid, $data['url'], false);
+
+                       if ($result['success']) {
+                               $fields['subhub'] = true;
+                       }
+               }
+
+               foreach ($updatefields AS $field) {
+                       if (!empty($data[$field])) {
+                               $fields[$field] = $data[$field];
+                       }
+               }
+
+               $fields['nurl'] = normalise_link($data['url']);
+
+               if (!empty($data['priority'])) {
+                       $fields['priority'] = intval($data['priority']);
+               }
+
+               if (empty($fields)) {
+                       return;
+               }
+
+               $r = DBA::update('contact', $fields, ['id' => $contact_id, 'uid' => local_user()]);
+
+               // Update the entry in the contact table
+               Model\Contact::updateAvatar($data['photo'], local_user(), $contact_id, true);
+
+               // Update the entry in the gcontact table
+               Model\GContact::updateFromProbe($data['url']);
+       }
+
+       private static function blockContact($contact_id)
+       {
+               $blocked = !Model\Contact::isBlockedByUser($contact_id, local_user());
+               Model\Contact::setBlockedForUser($contact_id, local_user(), $blocked);
+       }
+
+       private static function ignoreContact($contact_id)
+       {
+               $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 = DBA::update('contact', ['archive' => $archived], ['id' => $contact_id, 'uid' => local_user()]);
+
+               return DBA::isResult($r);
+       }
+
+       private static function dropContact($orig_record)
+       {
+               $owner = Model\User::getOwnerDataById(local_user());
+               if (!DBA::isResult($owner)) {
+                       return;
+               }
+
+               Model\Contact::terminateFriendship($owner, $orig_record, true);
+               Model\Contact::remove($orig_record['id']);
+       }
+
+       public static function content($update = 0)
+       {
+               $a = self::getApp();
+               $sort_type = 0;
+               $o = '';
+               Nav::setSelected('contact');
+
+               if (!local_user()) {
+                       notice(L10n::t('Permission denied.') . EOL);
+                       return Login::form();
+               }
+
+               if ($a->argc == 3) {
+                       $contact_id = intval($a->argv[1]);
+                       if (!$contact_id) {
+                               return;
+                       }
+
+                       $cmd = $a->argv[2];
+
+                       $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('contact');
+                               return; // NOTREACHED
+                       }
+
+                       if ($cmd === 'update' && ($orig_record['uid'] != 0)) {
+                               self::updateContactFromPoll($contact_id);
+                               goaway('contact/' . $contact_id);
+                               // NOTREACHED
+                       }
+
+                       if ($cmd === 'updateprofile' && ($orig_record['uid'] != 0)) {
+                               self::updateContactFromProbe($contact_id);
+                               goaway('crepair/' . $contact_id);
+                               // NOTREACHED
+                       }
+
+                       if ($cmd === 'block') {
+                               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);
+
+                               goaway('contact/' . $contact_id);
+                               return; // NOTREACHED
+                       }
+
+                       if ($cmd === 'ignore') {
+                               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);
+
+                               goaway('contact/' . $contact_id);
+                               return; // NOTREACHED
+                       }
+
+                       if ($cmd === 'archive' && ($orig_record['uid'] != 0)) {
+                               $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);
+                               }
+
+                               goaway('contact/' . $contact_id);
+                               return; // NOTREACHED
+                       }
+
+                       if ($cmd === 'drop' && ($orig_record['uid'] != 0)) {
+                               // Check if we should do HTML-based delete confirmation
+                               if (!empty($_REQUEST['confirm'])) {
+                                       // <form> can't take arguments in its 'action' parameter
+                                       // so add any arguments as hidden inputs
+                                       $query = explode_querystring($a->query_string);
+                                       $inputs = [];
+                                       foreach ($query['args'] as $arg) {
+                                               if (strpos($arg, 'confirm=') === false) {
+                                                       $arg_parts = explode('=', $arg);
+                                                       $inputs[] = ['name' => $arg_parts[0], 'value' => $arg_parts[1]];
+                                               }
+                                       }
+
+                                       $a->page['aside'] = '';
+
+                                       return replace_macros(get_markup_template('contact_drop_confirm.tpl'), [
+                                               '$header' => L10n::t('Drop contact'),
+                                               '$contact' => self::getContactTemplateVars($orig_record),
+                                               '$method' => 'get',
+                                               '$message' => L10n::t('Do you really want to delete this contact?'),
+                                               '$extra_inputs' => $inputs,
+                                               '$confirm' => L10n::t('Yes'),
+                                               '$confirm_url' => $query['base'],
+                                               '$confirm_name' => 'confirmed',
+                                               '$cancel' => L10n::t('Cancel'),
+                                       ]);
+                               }
+                               // Now check how the user responded to the confirmation query
+                               if (!empty($_REQUEST['canceled'])) {
+                                       goaway('contact');
+                               }
+
+                               self::dropContact($orig_record);
+                               info(L10n::t('Contact has been removed.') . EOL);
+
+                               goaway('contact');
+                               return; // NOTREACHED
+                       }
+                       if ($cmd === 'posts') {
+                               return self::getPostsHTML($a, $contact_id);
+                       }
+                       if ($cmd === 'conversations') {
+                               return self::getConversationsHMTL($a, $contact_id, $update);
+                       }
+               }
+
+               $_SESSION['return_url'] = $a->query_string;
+
+               if (!empty($a->data['contact']) && is_array($a->data['contact'])) {
+                       $contact_id = $a->data['contact']['id'];
+                       $contact = $a->data['contact'];
+
+                       $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), [
+                               '$baseurl' => $a->getBaseURL(true),
+                       ]);
+
+                       $contact['blocked']  = Model\Contact::isBlockedByUser($contact['id'], local_user());
+                       $contact['readonly'] = Model\Contact::isIgnoredByUser($contact['id'], local_user());
+
+                       $dir_icon = '';
+                       $relation_text = '';
+                       switch ($contact['rel']) {
+                               case Model\Contact::FRIEND:
+                                       $dir_icon = 'images/lrarrow.gif';
+                                       $relation_text = L10n::t('You are mutual friends with %s');
+                                       break;
+
+                               case Model\Contact::FOLLOWER;
+                                       $dir_icon = 'images/larrow.gif';
+                                       $relation_text = L10n::t('You are sharing with %s');
+                                       break;
+
+                               case Model\Contact::SHARING;
+                                       $dir_icon = 'images/rarrow.gif';
+                                       $relation_text = L10n::t('%s is sharing with you');
+                                       break;
+
+                               default:
+                                       break;
+                       }
+
+                       if ($contact['uid'] == 0) {
+                               $relation_text = '';
+                       }
+
+                       if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
+                               $relation_text = '';
+                       }
+
+                       $relation_text = sprintf($relation_text, htmlentities($contact['name']));
+
+                       $url = Model\Contact::magicLink($contact['url']);
+                       if (strpos($url, 'redir/') === 0) {
+                               $sparkle = ' class="sparkle" ';
+                       } else {
+                               $sparkle = '';
+                       }
+
+                       $insecure = L10n::t('Private communications are not available for this contact.');
+
+                       $last_update = (($contact['last-update'] <= NULL_DATE) ? L10n::t('Never') : DateTimeFormat::local($contact['last-update'], 'D, j M Y, g:i A'));
+
+                       if ($contact['last-update'] > NULL_DATE) {
+                               $last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? L10n::t('(Update was successful)') : L10n::t('(Update was not successful)'));
+                       }
+                       $lblsuggest = (($contact['network'] === Protocol::DFRN) ? L10n::t('Suggest friends') : '');
+
+                       $poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
+
+                       $nettype = L10n::t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact['url']));
+
+                       // tabs
+                       $tab_str = self::getTabsHTML($a, $contact, 3);
+
+                       $lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < DateTimeFormat::utcNow()) ? L10n::t('Communications lost with this contact!') : '');
+
+                       $fetch_further_information = null;
+                       if ($contact['network'] == Protocol::FEED) {
+                               $fetch_further_information = [
+                                       'fetch_further_information',
+                                       L10n::t('Fetch further information for feeds'),
+                                       $contact['fetch_further_information'],
+                                       L10n::t('Fetch information like preview pictures, title and teaser from the feed item. You can activate this if the feed doesn\'t contain much text. Keywords are taken from the meta header in the feed item and are posted as hash tags.'),
+                                       [
+                                               '0' => L10n::t('Disabled'),
+                                               '1' => L10n::t('Fetch information'),
+                                               '3' => L10n::t('Fetch keywords'),
+                                               '2' => L10n::t('Fetch information and keywords')
+                                       ]
+                               ];
+                       }
+
+                       $poll_interval = null;
+                       if (in_array($contact['network'], [Protocol::FEED, Protocol::MAIL])) {
+                               $poll_interval = ContactSelector::pollInterval($contact['priority'], !$poll_enabled);
+                       }
+
+                       $profile_select = null;
+                       if ($contact['network'] == Protocol::DFRN) {
+                               $profile_select = ContactSelector::profileAssign($contact['profile-id'], $contact['network'] !== Protocol::DFRN);
+                       }
+
+                       /// @todo Only show the following link with DFRN when the remote version supports it
+                       $follow = '';
+                       $follow_text = '';
+                       if (in_array($contact['rel'], [Model\Contact::FRIEND, Model\Contact::SHARING])) {
+                               if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
+                                       $follow = $a->getBaseURL(true) . '/unfollow?url=' . urlencode($contact['url']);
+                                       $follow_text = L10n::t('Disconnect/Unfollow');
+                               }
+                       } else {
+                               $follow = $a->getBaseURL(true) . '/follow?url=' . urlencode($contact['url']);
+                               $follow_text = L10n::t('Connect/Follow');
+                       }
+
+                       // Load contactact related actions like hide, suggest, delete and others
+                       $contact_actions = self::getContactActions($contact);
+
+                       if ($contact['uid'] != 0) {
+                               $lbl_vis1 = L10n::t('Profile Visibility');
+                               $lbl_info1 = L10n::t('Contact Information / Notes');
+                               $contact_settings_label = L10n::t('Contact Settings');
+                       } else {
+                               $lbl_vis1 = null;
+                               $lbl_info1 = null;
+                               $contact_settings_label = null;
+                       }
+
+                       $tpl = get_markup_template('contact_edit.tpl');
+                       $o .= replace_macros($tpl, [
+                               '$header'         => L10n::t('Contact'),
+                               '$tab_str'        => $tab_str,
+                               '$submit'         => L10n::t('Submit'),
+                               '$lbl_vis1'       => $lbl_vis1,
+                               '$lbl_vis2'       => L10n::t('Please choose the profile you would like to display to %s when viewing your profile securely.', $contact['name']),
+                               '$lbl_info1'      => $lbl_info1,
+                               '$lbl_info2'      => L10n::t('Their personal note'),
+                               '$reason'         => trim(notags($contact['reason'])),
+                               '$infedit'        => L10n::t('Edit contact notes'),
+                               '$common_link'    => 'common/loc/' . local_user() . '/' . $contact['id'],
+                               '$relation_text'  => $relation_text,
+                               '$visit'          => L10n::t('Visit %s\'s profile [%s]', $contact['name'], $contact['url']),
+                               '$blockunblock'   => L10n::t('Block/Unblock contact'),
+                               '$ignorecont'     => L10n::t('Ignore contact'),
+                               '$lblcrepair'     => L10n::t('Repair URL settings'),
+                               '$lblrecent'      => L10n::t('View conversations'),
+                               '$lblsuggest'     => $lblsuggest,
+                               '$nettype'        => $nettype,
+                               '$poll_interval'  => $poll_interval,
+                               '$poll_enabled'   => $poll_enabled,
+                               '$lastupdtext'    => L10n::t('Last update:'),
+                               '$lost_contact'   => $lost_contact,
+                               '$updpub'         => L10n::t('Update public posts'),
+                               '$last_update'    => $last_update,
+                               '$udnow'          => L10n::t('Update now'),
+                               '$follow'         => $follow,
+                               '$follow_text'    => $follow_text,
+                               '$profile_select' => $profile_select,
+                               '$contact_id'     => $contact['id'],
+                               '$block_text'     => ($contact['blocked'] ? L10n::t('Unblock') : L10n::t('Block')),
+                               '$ignore_text'    => ($contact['readonly'] ? L10n::t('Unignore') : L10n::t('Ignore')),
+                               '$insecure'       => (in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA]) ? '' : $insecure),
+                               '$info'           => $contact['info'],
+                               '$cinfo'          => ['info', '', $contact['info'], ''],
+                               '$blocked'        => ($contact['blocked'] ? L10n::t('Currently blocked') : ''),
+                               '$ignored'        => ($contact['readonly'] ? L10n::t('Currently ignored') : ''),
+                               '$archived'       => ($contact['archive'] ? L10n::t('Currently archived') : ''),
+                               '$pending'        => ($contact['pending'] ? L10n::t('Awaiting connection acknowledge') : ''),
+                               '$hidden'         => ['hidden', L10n::t('Hide this contact from others'), ($contact['hidden'] == 1), L10n::t('Replies/likes to your public posts <strong>may</strong> still be visible')],
+                               '$notify'         => ['notify', L10n::t('Notification for new posts'), ($contact['notify_new_posts'] == 1), L10n::t('Send a notification of every new post of this contact')],
+                               '$fetch_further_information' => $fetch_further_information,
+                               '$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'],
+                               '$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', L10n::t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], L10n::t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')],
+                               '$photo'          => $contact['photo'],
+                               '$name'           => htmlentities($contact['name']),
+                               '$dir_icon'       => $dir_icon,
+                               '$sparkle'        => $sparkle,
+                               '$url'            => $url,
+                               '$profileurllabel'=> L10n::t('Profile URL'),
+                               '$profileurl'     => $contact['url'],
+                               '$account_type'   => Model\Contact::getAccountType($contact),
+                               '$location'       => BBCode::convert($contact['location']),
+                               '$location_label' => L10n::t('Location:'),
+                               '$xmpp'           => BBCode::convert($contact['xmpp']),
+                               '$xmpp_label'     => L10n::t('XMPP:'),
+                               '$about'          => BBCode::convert($contact['about'], false),
+                               '$about_label'    => L10n::t('About:'),
+                               '$keywords'       => $contact['keywords'],
+                               '$keywords_label' => L10n::t('Tags:'),
+                               '$contact_action_button' => L10n::t('Actions'),
+                               '$contact_actions'=> $contact_actions,
+                               '$contact_status' => L10n::t('Status'),
+                               '$contact_settings_label' => $contact_settings_label,
+                               '$contact_profile_label' => L10n::t('Profile'),
+                       ]);
+
+                       $arr = ['contact' => $contact, 'output' => $o];
+
+                       Addon::callHooks('contact_edit', $arr);
+
+                       return $arr['output'];
+               }
+
+               $blocked = false;
+               $hidden = false;
+               $ignored = false;
+               $archived = false;
+               $all = false;
+
+               if (($a->argc == 2) && ($a->argv[1] === 'all')) {
+                       $sql_extra = '';
+                       $all = true;
+               } elseif (($a->argc == 2) && ($a->argv[1] === 'blocked')) {
+                       $sql_extra = " AND `blocked` = 1 ";
+                       $blocked = true;
+               } elseif (($a->argc == 2) && ($a->argv[1] === 'hidden')) {
+                       $sql_extra = " AND `hidden` = 1 ";
+                       $hidden = true;
+               } elseif (($a->argc == 2) && ($a->argv[1] === 'ignored')) {
+                       $sql_extra = " AND `readonly` = 1 ";
+                       $ignored = true;
+               } elseif (($a->argc == 2) && ($a->argv[1] === 'archived')) {
+                       $sql_extra = " AND `archive` = 1 ";
+                       $archived = true;
+               } else {
+                       $sql_extra = " AND `blocked` = 0 ";
+               }
+
+               $sql_extra .= sprintf(" AND `network` != '%s' ", Protocol::PHANTOM);
+
+               $search = notags(trim(defaults($_GET, 'search', '')));
+               $nets   = notags(trim(defaults($_GET, 'nets'  , '')));
+
+               $tabs = [
+                       [
+                               'label' => L10n::t('Suggestions'),
+                               'url'   => 'suggest',
+                               'sel'   => '',
+                               'title' => L10n::t('Suggest potential friends'),
+                               'id'    => 'suggestions-tab',
+                               'accesskey' => 'g',
+                       ],
+                       [
+                               'label' => L10n::t('All Contacts'),
+                               'url'   => 'contact/all',
+                               'sel'   => ($all) ? 'active' : '',
+                               'title' => L10n::t('Show all contacts'),
+                               'id'    => 'showall-tab',
+                               'accesskey' => 'l',
+                       ],
+                       [
+                               'label' => L10n::t('Unblocked'),
+                               'url'   => 'contact',
+                               'sel'   => ((!$all) && (!$blocked) && (!$hidden) && (!$search) && (!$nets) && (!$ignored) && (!$archived)) ? 'active' : '',
+                               'title' => L10n::t('Only show unblocked contacts'),
+                               'id'    => 'showunblocked-tab',
+                               'accesskey' => 'o',
+                       ],
+                       [
+                               'label' => L10n::t('Blocked'),
+                               'url'   => 'contact/blocked',
+                               'sel'   => ($blocked) ? 'active' : '',
+                               'title' => L10n::t('Only show blocked contacts'),
+                               'id'    => 'showblocked-tab',
+                               'accesskey' => 'b',
+                       ],
+                       [
+                               'label' => L10n::t('Ignored'),
+                               'url'   => 'contact/ignored',
+                               'sel'   => ($ignored) ? 'active' : '',
+                               'title' => L10n::t('Only show ignored contacts'),
+                               'id'    => 'showignored-tab',
+                               'accesskey' => 'i',
+                       ],
+                       [
+                               'label' => L10n::t('Archived'),
+                               'url'   => 'contact/archived',
+                               'sel'   => ($archived) ? 'active' : '',
+                               'title' => L10n::t('Only show archived contacts'),
+                               'id'    => 'showarchived-tab',
+                               'accesskey' => 'y',
+                       ],
+                       [
+                               'label' => L10n::t('Hidden'),
+                               'url'   => 'contact/hidden',
+                               'sel'   => ($hidden) ? 'active' : '',
+                               'title' => L10n::t('Only show hidden contacts'),
+                               'id'    => 'showhidden-tab',
+                               'accesskey' => 'h',
+                       ],
+               ];
+
+               $tab_tpl = get_markup_template('common_tabs.tpl');
+               $t = replace_macros($tab_tpl, ['$tabs' => $tabs]);
+
+               $total = 0;
+               $searching = false;
+               $search_hdr = null;
+               if ($search) {
+                       $searching = true;
+                       $search_hdr = $search;
+                       $search_txt = DBA::escape(protect_sprintf(preg_quote($search)));
+                       $sql_extra .= " AND (name REGEXP '$search_txt' OR url REGEXP '$search_txt'  OR nick REGEXP '$search_txt') ";
+               }
+
+               if ($nets) {
+                       $sql_extra .= sprintf(" AND network = '%s' ", DBA::escape($nets));
+               }
+
+               $sql_extra2 = ((($sort_type > 0) && ($sort_type <= Model\Contact::FRIEND)) ? sprintf(" AND `rel` = %d ", intval($sort_type)) : '');
+
+               $r = q("SELECT COUNT(*) AS `total` FROM `contact`
+                       WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
+                       intval($_SESSION['uid'])
+               );
+               if (DBA::isResult($r)) {
+                       $a->setPagerTotal($r[0]['total']);
+                       $total = $r[0]['total'];
+               }
+
+               $sql_extra3 = Widget::unavailableNetworks();
+
+               $contacts = [];
+
+               $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 $sql_extra3 ORDER BY `name` ASC LIMIT %d , %d ",
+                       intval($_SESSION['uid']),
+                       intval($a->pager['start']),
+                       intval($a->pager['itemspage'])
+               );
+               if (DBA::isResult($r)) {
+                       foreach ($r as $rr) {
+                               $rr['blocked'] = Model\Contact::isBlockedByUser($rr['id'], local_user());
+                               $rr['readonly'] = Model\Contact::isIgnoredByUser($rr['id'], local_user());
+                               $contacts[] = self::getContactTemplateVars($rr);
+                       }
+               }
+
+               $tpl = get_markup_template('contacts-template.tpl');
+               $o .= replace_macros($tpl, [
+                       '$baseurl'    => System::baseUrl(),
+                       '$header'     => L10n::t('Contacts') . (($nets) ? ' - ' . ContactSelector::networkToName($nets) : ''),
+                       '$tabs'       => $t,
+                       '$total'      => $total,
+                       '$search'     => $search_hdr,
+                       '$desc'       => L10n::t('Search your contacts'),
+                       '$finding'    => $searching ? L10n::t('Results for: %s', $search) : '',
+                       '$submit'     => L10n::t('Find'),
+                       '$cmd'        => $a->cmd,
+                       '$contacts'   => $contacts,
+                       '$contact_drop_confirm' => L10n::t('Do you really want to delete this contact?'),
+                       'multiselect' => 1,
+                       '$batch_actions' => [
+                               'contacts_batch_update'  => L10n::t('Update'),
+                               'contacts_batch_block'   => L10n::t('Block') . '/' . L10n::t('Unblock'),
+                               'contacts_batch_ignore'  => L10n::t('Ignore') . '/' . L10n::t('Unignore'),
+                               'contacts_batch_archive' => L10n::t('Archive') . '/' . L10n::t('Unarchive'),
+                               'contacts_batch_drop'    => L10n::t('Delete'),
+                       ],
+                       '$h_batch_actions' => L10n::t('Batch Actions'),
+                       '$paginate'   => paginate($a),
+               ]);
+
+               return $o;
+       }
+
+       /**
+        * @brief List of pages for the Contact TabBar
+        *
+        * Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
+        *
+        * @param App $a
+        * @param array $contact The contact array
+        * @param int $active_tab 1 if tab should be marked as active
+        *
+        * @return string | HTML string of the contact page tabs buttons.
+
+        */
+       public static function getTabsHTML($a, $contact, $active_tab)
+       {
+               // tabs
+               $tabs = [
+                       [
+                               'label' => L10n::t('Status'),
+                               'url'   => "contact/" . $contact['id'] . "/conversations",
+                               'sel'   => (($active_tab == 1) ? 'active' : ''),
+                               'title' => L10n::t('Conversations started by this contact'),
+                               'id'    => 'status-tab',
+                               'accesskey' => 'm',
+                       ],
+                       [
+                               'label' => L10n::t('Posts and Comments'),
+                               'url'   => "contact/" . $contact['id'] . "/posts",
+                               'sel'   => (($active_tab == 2) ? 'active' : ''),
+                               'title' => L10n::t('Status Messages and Posts'),
+                               'id'    => 'posts-tab',
+                               'accesskey' => 'p',
+                       ],
+                       [
+                               'label' => L10n::t('Profile'),
+                               'url'   => "contact/" . $contact['id'],
+                               'sel'   => (($active_tab == 3) ? 'active' : ''),
+                               'title' => L10n::t('Profile Details'),
+                               'id'    => 'profile-tab',
+                               'accesskey' => 'o',
+                       ]
+               ];
+
+               // Show this tab only if there is visible friend list
+               $x = Model\GContact::countAllFriends(local_user(), $contact['id']);
+               if ($x) {
+                       $tabs[] = ['label' => L10n::t('Contacts'),
+                               'url'   => "allfriends/" . $contact['id'],
+                               'sel'   => (($active_tab == 4) ? 'active' : ''),
+                               'title' => L10n::t('View all contacts'),
+                               'id'    => 'allfriends-tab',
+                               'accesskey' => 't'];
+               }
+
+               // Show this tab only if there is visible common friend list
+               $common = Model\GContact::countCommonFriends(local_user(), $contact['id']);
+               if ($common) {
+                       $tabs[] = ['label' => L10n::t('Common Friends'),
+                               'url'   => "common/loc/" . local_user() . "/" . $contact['id'],
+                               'sel'   => (($active_tab == 5) ? 'active' : ''),
+                               'title' => L10n::t('View all common friends'),
+                               'id'    => 'common-loc-tab',
+                               'accesskey' => 'd'
+                       ];
+               }
+
+               if (!empty($contact['uid'])) {
+                       $tabs[] = ['label' => L10n::t('Advanced'),
+                               'url'   => 'crepair/' . $contact['id'],
+                               'sel'   => (($active_tab == 6) ? 'active' : ''),
+                               'title' => L10n::t('Advanced Contact Settings'),
+                               'id'    => 'advanced-tab',
+                               'accesskey' => 'r'
+                       ];
+               }
+
+               $tab_tpl = get_markup_template('common_tabs.tpl');
+               $tab_str = replace_macros($tab_tpl, ['$tabs' => $tabs]);
+
+               return $tab_str;
+       }
+
+       private static function getConversationsHMTL($a, $contact_id, $update)
+       {
+               $o = '';
+
+               if (!$update) {
+                       // We need the editor here to be able to reshare an item.
+                       if (local_user()) {
+                               $x = [
+                                       'is_owner' => true,
+                                       'allow_location' => $a->user['allow_location'],
+                                       'default_location' => $a->user['default-location'],
+                                       'nickname' => $a->user['nickname'],
+                                       'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
+                                       'acl' => ACL::getFullSelectorHTML($a->user, true),
+                                       'bang' => '',
+                                       'visitor' => 'block',
+                                       'profile_uid' => local_user(),
+                               ];
+                               $o = status_editor($a, $x, 0, true);
+                       }
+               }
+
+               $contact = DBA::selectFirst('contact', ['uid', 'url', 'id'], ['id' => $contact_id]);
+
+               if (!$update) {
+                       $o .= self::getTabsHTML($a, $contact, 1);
+               }
+
+               if (DBA::isResult($contact)) {
+                       $a->page['aside'] = '';
+
+                       $profiledata = Model\Contact::getDetailsByURL($contact['url']);
+
+                       if (local_user() && in_array($profiledata['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
+                               $profiledata['remoteconnect'] = System::baseUrl() . '/follow?url=' . urlencode($profiledata['url']);
+                       }
+
+                       Model\Profile::load($a, '', 0, $profiledata, true);
+                       $o .= Model\Contact::getPostsFromUrl($contact['url'], true, $update);
+               }
+
+               return $o;
+       }
+
+       private static function getPostsHTML($a, $contact_id)
+       {
+               $contact = DBA::selectFirst('contact', ['uid', 'url', 'id'], ['id' => $contact_id]);
+
+               $o = self::getTabsHTML($a, $contact, 2);
+
+               if (DBA::isResult($contact)) {
+                       $a->page['aside'] = '';
+
+                       $profiledata = Model\Contact::getDetailsByURL($contact['url']);
+
+                       if (local_user() && in_array($profiledata['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
+                               $profiledata['remoteconnect'] = System::baseUrl() . '/follow?url=' . urlencode($profiledata['url']);
+                       }
+
+                       Model\Profile::load($a, '', 0, $profiledata, true);
+                       $o .= Model\Contact::getPostsFromUrl($contact['url']);
+               }
+
+               return $o;
+       }
+
+       public static function getContactTemplateVars(array $rr)
+       {
+               $dir_icon = '';
+               $alt_text = '';
+
+               switch ($rr['rel']) {
+                       case Model\Contact::FRIEND:
+                               $dir_icon = 'images/lrarrow.gif';
+                               $alt_text = L10n::t('Mutual Friendship');
+                               break;
+
+                       case Model\Contact::FOLLOWER;
+                               $dir_icon = 'images/larrow.gif';
+                               $alt_text = L10n::t('is a fan of yours');
+                               break;
+
+                       case Model\Contact::SHARING;
+                               $dir_icon = 'images/rarrow.gif';
+                               $alt_text = L10n::t('you are a fan of');
+                               break;
+
+                       default:
+                               break;
+               }
+
+               $url = Model\Contact::magicLink($rr['url']);
+
+               if (strpos($url, 'redir/') === 0) {
+                       $sparkle = ' class="sparkle" ';
+               } else {
+                       $sparkle = '';
+               }
+
+               if ($rr['self']) {
+                       $dir_icon = 'images/larrow.gif';
+                       $alt_text = L10n::t('This is you');
+                       $url = $rr['url'];
+                       $sparkle = '';
+               }
+
+               return [
+                       'img_hover' => L10n::t('Visit %s\'s profile [%s]', $rr['name'], $rr['url']),
+                       'edit_hover'=> L10n::t('Edit contact'),
+                       'photo_menu'=> Model\Contact::photoMenu($rr),
+                       'id'        => $rr['id'],
+                       'alt_text'  => $alt_text,
+                       'dir_icon'  => $dir_icon,
+                       'thumb'     => ProxyUtils::proxifyUrl($rr['thumb'], false, ProxyUtils::SIZE_THUMB),
+                       'name'      => htmlentities($rr['name']),
+                       'username'  => htmlentities($rr['name']),
+                       'account_type' => Model\Contact::getAccountType($rr),
+                       'sparkle'   => $sparkle,
+                       'itemurl'   => defaults($rr, 'addr', $rr['url']),
+                       'url'       => $url,
+                       'network'   => ContactSelector::networkToName($rr['network'], $rr['url']),
+                       'nick'      => htmlentities($rr['nick']),
+               ];
+       }
+
+       /**
+        * @brief Gives a array with actions which can performed to a given contact
+        *
+        * This includes actions like e.g. 'block', 'hide', 'archive', 'delete' and others
+        *
+        * @param array $contact Data about the Contact
+        * @return array with contact related actions
+        */
+       private static function getContactActions($contact)
+       {
+               $poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
+               $contact_actions = [];
+
+               // Provide friend suggestion only for Friendica contacts
+               if ($contact['network'] === Protocol::DFRN) {
+                       $contact_actions['suggest'] = [
+                               'label' => L10n::t('Suggest friends'),
+                               'url'   => 'fsuggest/' . $contact['id'],
+                               'title' => '',
+                               'sel'   => '',
+                               'id'    => 'suggest',
+                       ];
+               }
+
+               if ($poll_enabled) {
+                       $contact_actions['update'] = [
+                               'label' => L10n::t('Update now'),
+                               'url'   => 'contact/' . $contact['id'] . '/update',
+                               'title' => '',
+                               'sel'   => '',
+                               'id'    => 'update',
+                       ];
+               }
+
+               $contact_actions['block'] = [
+                       'label' => (intval($contact['blocked']) ? L10n::t('Unblock') : L10n::t('Block')),
+                       'url'   => 'contact/' . $contact['id'] . '/block',
+                       'title' => L10n::t('Toggle Blocked status'),
+                       'sel'   => (intval($contact['blocked']) ? 'active' : ''),
+                       'id'    => 'toggle-block',
+               ];
+
+               $contact_actions['ignore'] = [
+                       'label' => (intval($contact['readonly']) ? L10n::t('Unignore') : L10n::t('Ignore')),
+                       'url'   => 'contact/' . $contact['id'] . '/ignore',
+                       'title' => L10n::t('Toggle Ignored status'),
+                       'sel'   => (intval($contact['readonly']) ? 'active' : ''),
+                       'id'    => 'toggle-ignore',
+               ];
+
+               if ($contact['uid'] != 0) {
+                       $contact_actions['archive'] = [
+                               'label' => (intval($contact['archive']) ? L10n::t('Unarchive') : L10n::t('Archive')),
+                               'url'   => 'contact/' . $contact['id'] . '/archive',
+                               'title' => L10n::t('Toggle Archive status'),
+                               'sel'   => (intval($contact['archive']) ? 'active' : ''),
+                               'id'    => 'toggle-archive',
+                       ];
+
+                       $contact_actions['delete'] = [
+                               'label' => L10n::t('Delete'),
+                               'url'   => 'contact/' . $contact['id'] . '/drop',
+                               'title' => L10n::t('Delete contact'),
+                               'sel'   => '',
+                               'id'    => 'delete',
+                       ];
+               }
+
+               return $contact_actions;
+       }
+}
index 2c42643b44a07fae9389c4ac738aa3ebac54c82c..23b97a5cd060346da07652fc810e74d9cb9377fd 100644 (file)
@@ -953,13 +953,13 @@ class Probe
 
                $prof_data["addr"]         = $data["addr"];
                $prof_data["nick"]         = $data["nick"];
-               $prof_data["dfrn-request"] = $data["request"];
-               $prof_data["dfrn-confirm"] = $data["confirm"];
-               $prof_data["dfrn-notify"]  = $data["notify"];
-               $prof_data["dfrn-poll"]    = $data["poll"];
-               $prof_data["photo"]        = $data["photo"];
-               $prof_data["fn"]           = $data["name"];
-               $prof_data["key"]          = $data["pubkey"];
+               $prof_data["dfrn-request"] = defaults($data, 'request', null);
+               $prof_data["dfrn-confirm"] = defaults($data, 'confirm', null);
+               $prof_data["dfrn-notify"]  = defaults($data, 'notify' , null);
+               $prof_data["dfrn-poll"]    = defaults($data, 'poll'   , null);
+               $prof_data["photo"]        = defaults($data, 'photo'  , null);
+               $prof_data["fn"]           = defaults($data, 'name'   , null);
+               $prof_data["key"]          = defaults($data, 'pubkey' , null);
 
                logger("Result for profile ".$profile_link.": ".print_r($prof_data, true), LOGGER_DEBUG);
 
index 48ffe65b74ed16b1b59fc8cd381d75a0604bfd2c..34a5f8138af27f1eb7deb9899652ddf9247a2f4b 100644 (file)
@@ -157,7 +157,7 @@ class Post extends BaseObject
                        if ($item["event-id"] != 0) {
                                $edpost = ["events/event/" . $item['event-id'], L10n::t("Edit")];
                        } else {
-                               $edpost = ["editpost/" . $item['id'] . "/" . base64_encode($a->cmd), L10n::t("Edit")];
+                               $edpost = ["editpost/" . $item['id'], L10n::t("Edit")];
                        }
                        $dropping = in_array($item['uid'], [0, local_user()]);
                } else {
index d77a0277fbd4b4b12f3fded4ddbec2b044a94f80..c481423a675c495349ad2d27c7d56f8009cbd5a9 100644 (file)
@@ -211,6 +211,11 @@ class Processor
                $item['title'] = HTML::toBBCode($activity['name']);
                $item['content-warning'] = HTML::toBBCode($activity['summary']);
                $item['body'] = self::convertMentions(HTML::toBBCode($activity['content']));
+
+               if (($activity['object_type'] == 'as:Video') && !empty($activity['alternate-url'])) {
+                       $item['body'] .= "\n[video]" . $activity['alternate-url'] . '[/video]';
+               }
+
                $item['location'] = $activity['location'];
 
                if (!empty($item['latitude']) && !empty($item['longitude'])) {
@@ -303,6 +308,9 @@ class Processor
                $item = ['author-id' => Contact::getIdForURL($activity['actor']),
                        'author-link' => $activity['actor']];
 
+               // Ensure that the contact has got the right network type
+               self::switchContact($item['author-id']);
+
                Contact::addRelationship($owner, $contact, $item);
                $cid = Contact::getIdForURL($activity['actor'], $uid);
                if (empty($cid)) {
index cde197b0c41e421044e3ac238bf8dd927c24de8b..a5ba0763db56a05bd83dd9abdce5b3e5c45921e1 100644 (file)
@@ -452,7 +452,7 @@ class Receiver
         * @param integer $uid User ID
         * @param string $url Profile URL
         */
-       private static function switchContact($cid, $uid, $url)
+       public static function switchContact($cid, $uid, $url)
        {
                $profile = ActivityPub::probeProfile($url);
                if (empty($profile)) {
@@ -461,7 +461,7 @@ class Receiver
 
                logger('Switch contact ' . $cid . ' (' . $profile['url'] . ') for user ' . $uid . ' to ActivityPub');
 
-               $photo = $profile['photo'];
+               $photo = defaults($profile, 'photo', null);
                unset($profile['photo']);
                unset($profile['baseurl']);
 
@@ -478,7 +478,7 @@ class Receiver
        }
 
        /**
-        * 
+        *
         *
         * @param $receivers
         * @param $actor
@@ -503,12 +503,12 @@ class Receiver
        }
 
        /**
-        * 
+        *
         *
         * @param $object_data
         * @param array $activity
         *
-        * @return 
+        * @return
         */
        private static function addActivityFields($object_data, $activity)
        {
@@ -698,10 +698,10 @@ class Receiver
 
                // Special treatment for Hubzilla links
                if (is_array($object_data['alternate-url'])) {
-                       if (!empty($object['as:url'])) {
+                       $object_data['alternate-url'] = JsonLD::fetchElement($object_data['alternate-url'], 'as:href');
+
+                       if (!is_string($object_data['alternate-url'])) {
                                $object_data['alternate-url'] = JsonLD::fetchElement($object['as:url'], 'as:href');
-                       } else {
-                               $object_data['alternate-url'] = null;
                        }
                }
 
index eb52c05037d1f6db0c1d897f01105dc248d2a061..0c3a52b2d3810ede4ce05e3348773486d8fda19a 100644 (file)
@@ -949,6 +949,7 @@ class Diaspora
                                $person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
                                if (!DBA::isResult($person)) {
                                        $person = $r;
+                                       $person['id'] = 0;
                                }
                        }
                }
@@ -3429,12 +3430,9 @@ class Diaspora
                /// @todo - establish "all day" events in Friendica
                $eventdata["all_day"] = "false";
 
-               if (!$event['adjust']) {
+               $eventdata['timezone'] = 'UTC';
+               if (!$event['adjust'] && $user['timezone']) {
                        $eventdata['timezone'] = $user['timezone'];
-
-                       if ($eventdata['timezone'] == "") {
-                               $eventdata['timezone'] = 'UTC';
-                       }
                }
 
                if ($event['start']) {
@@ -3749,13 +3747,13 @@ class Diaspora
         *
         * @return string The message
         */
-       private static function messageFromSignature(array $item, array $signature)
+       private static function messageFromSignature(array $item)
        {
                // Split the signed text
-               $signed_parts = explode(";", $signature['signed_text']);
+               $signed_parts = explode(";", $item['signed_text']);
 
                if ($item["deleted"]) {
-                       $message = ["author" => $signature['signer'],
+                       $message = ["author" => $item['signer'],
                                        "target_guid" => $signed_parts[0],
                                        "target_type" => $signed_parts[1]];
                } elseif (in_array($item["verb"], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
@@ -3764,7 +3762,7 @@ class Diaspora
                                        "parent_guid" => $signed_parts[3],
                                        "parent_type" => $signed_parts[2],
                                        "positive" => $signed_parts[0],
-                                       "author_signature" => $signature['signature'],
+                                       "author_signature" => $item['signature'],
                                        "parent_author_signature" => ""];
                } else {
                        // Remove the comment guid
@@ -3783,7 +3781,7 @@ class Diaspora
                                        "guid" => $guid,
                                        "parent_guid" => $parent_guid,
                                        "text" => implode(";", $signed_parts),
-                                       "author_signature" => $signature['signature'],
+                                       "author_signature" => $item['signature'],
                                        "parent_author_signature" => ""];
                }
                return $message;
@@ -3811,20 +3809,12 @@ class Diaspora
 
                logger("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG);
 
-               // fetch the original signature
-               $fields = ['signed_text', 'signature', 'signer'];
-               $signature = DBA::selectFirst('sign', $fields, ['iid' => $item["id"]]);
-               if (!DBA::isResult($signature)) {
-                       logger("Couldn't fetch signatur for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG);
-                       return false;
-               }
-
                // Old way - is used by the internal Friendica functions
                /// @todo Change all signatur storing functions to the new format
-               if ($signature['signed_text'] && $signature['signature'] && $signature['signer']) {
-                       $message = self::messageFromSignature($item, $signature);
+               if ($item['signed_text'] && $item['signature'] && $item['signer']) {
+                       $message = self::messageFromSignature($item);
                } else {// New way
-                       $msg = json_decode($signature['signed_text'], true);
+                       $msg = json_decode($item['signed_text'], true);
 
                        $message = [];
                        if (is_array($msg)) {
@@ -3841,7 +3831,7 @@ class Diaspora
                                        $message[$field] = $data;
                                }
                        } else {
-                               logger("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$signature['signed_text'], LOGGER_DEBUG);
+                               logger("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], LOGGER_DEBUG);
                        }
                }
 
index f2a5eccd395247956c9e39a4e22c037d9c0567fa..24089b9cbd2a92bb33c22fe4e41ee3b501987cff 100644 (file)
@@ -141,7 +141,7 @@ class ParseUrl
                }
 
                // If the file is too large then exit
-               if ($curlResult->getInfo()['download_content_length'] > 1000000) {
+               if (defaults($curlResult->getInfo(), 'download_content_length', 0) > 1000000) {
                        return $siteinfo;
                }
 
index 46bd8bba50871deafc49449891feb330de8ebe70..696721e458c2d906f978f33fecda176fbe6d7938 100644 (file)
@@ -294,12 +294,18 @@ class Temporal
                        return L10n::t('never');
                }
 
+               $isfuture = false;
                $etime = time() - $abs;
 
-               if ($etime < 1) {
+               if ($etime < 1 && $etime >= 0) {
                        return L10n::t('less than a second ago');
                }
 
+               if ($etime < 0){
+                       $etime = -$etime;
+                       $isfuture = true;
+               }
+
                $a = [12 * 30 * 24 * 60 * 60 => [L10n::t('year'), L10n::t('years')],
                        30 * 24 * 60 * 60 => [L10n::t('month'), L10n::t('months')],
                        7 * 24 * 60 * 60 => [L10n::t('week'), L10n::t('weeks')],
@@ -315,7 +321,12 @@ class Temporal
                                $r = round($d);
                                // translators - e.g. 22 hours ago, 1 minute ago
                                if (!$format) {
-                                       $format = L10n::t('%1$d %2$s ago');
+                                       if($isfuture){
+                                               $format = L10n::t('in %1$d %2$s');
+                                       }
+                                       else {
+                                               $format = L10n::t('%1$d %2$s ago');
+                                       }
                                }
 
                                return sprintf($format, $r, (($r == 1) ? $str[0] : $str[1]));
index f2951cce1ff2bf13deb7aec6e112f16bfcb655f8..1c353fb6327e8da4e3621e8344f7eaea51bb96d1 100644 (file)
@@ -39,13 +39,13 @@ class Delivery extends BaseObject
                $followup = false;
                $public_message = false;
 
+               $items = [];
                if ($cmd == self::MAIL) {
                        $target_item = DBA::selectFirst('mail', [], ['id' => $item_id]);
                        if (!DBA::isResult($target_item)) {
                                return;
                        }
                        $uid = $target_item['uid'];
-                       $items = [];
                } elseif ($cmd == self::SUGGESTION) {
                        $target_item = DBA::selectFirst('fsuggest', [], ['id' => $item_id]);
                        if (!DBA::isResult($target_item)) {
@@ -65,7 +65,6 @@ class Delivery extends BaseObject
                        $params = ['order' => ['id']];
                        $itemdata = Item::select([], $condition, $params);
 
-                       $items = [];
                        while ($item = Item::fetch($itemdata)) {
                                if ($item['id'] == $parent_id) {
                                        $parent = $item;
index a68ad1336d3aca7bdc5463b5c45d77a7bdc7a25e..0066a04aedd06c7136576506d1e6695c3cd445f1 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
 use Friendica\Protocol\Email;
+use Friendica\Protocol\ActivityPub;
 use Friendica\Protocol\PortableContact;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
@@ -55,6 +56,17 @@ class OnePoll
 
                $importer_uid = $contact['uid'];
 
+               // Possibly switch the remote contact to AP
+               if ($contact['network'] === Protocol::OSTATUS) {
+                       ActivityPub\Receiver::switchContact($contact['id'], $importer_uid, $contact['url']);
+                       $contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
+               }
+
+               // We currently don't do anything with AP here
+               if ($contact['network'] === Protocol::ACTIVITYPUB) {
+                       return;
+               }
+
                // load current friends if possible.
                if (($contact['poco'] != "") && ($contact['success_update'] > $contact['failure_update'])) {
                        $r = q("SELECT count(*) AS total FROM glink
@@ -321,7 +333,7 @@ class OnePoll
                        $curlResult = Network::curl($contact['poll'], false, $redirects, ['cookiejar' => $cookiejar]);
                        unlink($cookiejar);
 
-                       if (!$curlResult->isTimeout()) {
+                       if ($curlResult->isTimeout()) {
                                // set the last-update so we don't keep polling
                                DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                Contact::markForArchival($contact);
index 56f285f2df9037f8f2dc405258f7bd51f495554b..d889e241e22061f56b549857a82995ce023c8957 100644 (file)
@@ -246,3 +246,12 @@ function update_1278() {
 
        return UPDATE_SUCCESS;
 }
+
+function update_1288() {
+       // Updates missing `uri-id` values
+
+       DBA::e("UPDATE `item-activity` INNER JOIN `item` ON `item`.`iaid` = `item-activity`.`id` SET `item-activity`.`uri-id` = `item`.`uri-id` WHERE `item-activity`.`uri-id` IS NULL OR `item-activity`.`uri-id` = 0");
+       DBA::e("UPDATE `item-content` INNER JOIN `item` ON `item`.`icid` = `item-content`.`id` SET `item-content`.`uri-id` = `item`.`uri-id` WHERE `item-content`.`uri-id` IS NULL OR `item-content`.`uri-id` = 0");
+
+       return UPDATE_SUCCESS;
+}
index c27fb25627bf58611e4c12f336219ac59dd773ed..6365f6cc0df864aa297cfbdb6c2e54ff2bedb098 100644 (file)
@@ -51,7 +51,7 @@ msgstr ""
 #: mod/profile_photo.php:198 mod/wall_attach.php:80 mod/wall_attach.php:83
 #: mod/item.php:166 mod/uimport.php:15 mod/cal.php:306 mod/regmod.php:108
 #: mod/editpost.php:19 mod/fsuggest.php:80 mod/allfriends.php:23
-#: mod/contacts.php:387 mod/events.php:195 mod/follow.php:54 mod/follow.php:118
+#: mod/contact.php:387 mod/events.php:195 mod/follow.php:54 mod/follow.php:118
 #: mod/attach.php:39 mod/poke.php:144 mod/invite.php:21 mod/invite.php:112
 #: mod/notes.php:32 mod/profiles.php:179 mod/profiles.php:511
 #: mod/photos.php:183 mod/photos.php:1067
@@ -94,7 +94,7 @@ msgstr ""
 #: view/theme/vier/config.php:119 view/theme/frio/config.php:118
 #: mod/crepair.php:150 mod/install.php:204 mod/install.php:242
 #: mod/manage.php:184 mod/message.php:264 mod/message.php:430
-#: mod/fsuggest.php:114 mod/contacts.php:631 mod/events.php:560
+#: mod/fsuggest.php:114 mod/contact.php:631 mod/events.php:560
 #: mod/localtime.php:56 mod/poke.php:194 mod/invite.php:155
 #: mod/profiles.php:577 mod/photos.php:1096 mod/photos.php:1182
 #: mod/photos.php:1454 mod/photos.php:1499 mod/photos.php:1538
@@ -186,7 +186,7 @@ msgstr ""
 
 #: view/theme/vier/theme.php:199 include/conversation.php:881
 #: mod/dirfind.php:231 mod/match.php:90 mod/suggest.php:86
-#: mod/allfriends.php:76 mod/contacts.php:611 mod/follow.php:143
+#: mod/allfriends.php:76 mod/contact.php:611 mod/follow.php:143
 #: src/Model/Contact.php:944 src/Content/Widget.php:61
 msgid "Connect/Follow"
 msgstr ""
@@ -195,7 +195,7 @@ msgstr ""
 msgid "Examples: Robert Morgenstein, Fishing"
 msgstr ""
 
-#: view/theme/vier/theme.php:201 mod/directory.php:214 mod/contacts.php:845
+#: view/theme/vier/theme.php:201 mod/directory.php:214 mod/contact.php:845
 #: src/Content/Widget.php:63
 msgid "Find"
 msgstr ""
@@ -320,7 +320,7 @@ msgstr ""
 msgid "End this session"
 msgstr ""
 
-#: view/theme/frio/theme.php:269 mod/contacts.php:690 mod/contacts.php:880
+#: view/theme/frio/theme.php:269 mod/contact.php:690 mod/contact.php:880
 #: src/Model/Profile.php:888 src/Content/Nav.php:100
 msgid "Status"
 msgstr ""
@@ -331,7 +331,7 @@ msgid "Your posts and conversations"
 msgstr ""
 
 #: view/theme/frio/theme.php:270 mod/newmember.php:24 mod/profperm.php:116
-#: mod/contacts.php:692 mod/contacts.php:896 src/Model/Profile.php:730
+#: mod/contact.php:692 mod/contact.php:896 src/Model/Profile.php:730
 #: src/Model/Profile.php:863 src/Model/Profile.php:896 src/Content/Nav.php:101
 msgid "Profile"
 msgstr ""
@@ -400,7 +400,7 @@ msgid "Account settings"
 msgstr ""
 
 #: view/theme/frio/theme.php:280 include/text.php:906 mod/viewcontacts.php:125
-#: mod/contacts.php:839 mod/contacts.php:908 src/Model/Profile.php:967
+#: mod/contact.php:839 mod/contact.php:908 src/Model/Profile.php:967
 #: src/Model/Profile.php:970 src/Content/Nav.php:147 src/Content/Nav.php:213
 msgid "Contacts"
 msgstr ""
@@ -475,7 +475,7 @@ msgstr ""
 #: mod/settings.php:1153 mod/settings.php:1154 mod/settings.php:1155
 #: mod/settings.php:1156 mod/settings.php:1157 mod/register.php:237
 #: mod/message.php:154 mod/suggest.php:40 mod/dfrn_request.php:645
-#: mod/api.php:110 mod/contacts.php:471 mod/follow.php:150 mod/profiles.php:541
+#: mod/api.php:110 mod/contact.php:471 mod/follow.php:150 mod/profiles.php:541
 #: mod/profiles.php:544 mod/profiles.php:566
 msgid "Yes"
 msgstr ""
@@ -483,7 +483,7 @@ msgstr ""
 #: include/items.php:399 include/conversation.php:1179 mod/videos.php:146
 #: mod/settings.php:676 mod/settings.php:702 mod/unfollow.php:130
 #: mod/message.php:157 mod/tagrm.php:19 mod/tagrm.php:91 mod/suggest.php:43
-#: mod/dfrn_request.php:655 mod/editpost.php:146 mod/contacts.php:474
+#: mod/dfrn_request.php:655 mod/editpost.php:146 mod/contact.php:474
 #: mod/follow.php:161 mod/fbrowser.php:104 mod/fbrowser.php:135
 #: mod/photos.php:255 mod/photos.php:327
 msgid "Cancel"
@@ -586,7 +586,7 @@ msgid "Select"
 msgstr ""
 
 #: include/conversation.php:627 mod/settings.php:736 mod/admin.php:1906
-#: mod/contacts.php:855 mod/contacts.php:1133 mod/photos.php:1567
+#: mod/contact.php:855 mod/contact.php:1133 mod/photos.php:1567
 msgid "Delete"
 msgstr ""
 
@@ -2014,7 +2014,7 @@ msgstr ""
 msgid "Only logged in users are permitted to perform a probing."
 msgstr ""
 
-#: mod/directory.php:151 mod/notifications.php:248 mod/contacts.php:681
+#: mod/directory.php:151 mod/notifications.php:248 mod/contact.php:681
 #: mod/events.php:548 src/Model/Event.php:67 src/Model/Event.php:94
 #: src/Model/Event.php:431 src/Model/Event.php:922 src/Model/Profile.php:430
 msgid "Location:"
@@ -2033,7 +2033,7 @@ msgstr ""
 msgid "Homepage:"
 msgstr ""
 
-#: mod/directory.php:159 mod/notifications.php:250 mod/contacts.php:685
+#: mod/directory.php:159 mod/notifications.php:250 mod/contact.php:685
 #: src/Model/Profile.php:436 src/Model/Profile.php:806
 msgid "About:"
 msgstr ""
@@ -2114,7 +2114,7 @@ msgstr ""
 msgid "Missing some important data!"
 msgstr ""
 
-#: mod/settings.php:176 mod/settings.php:701 mod/contacts.php:851
+#: mod/settings.php:176 mod/settings.php:701 mod/contact.php:851
 msgid "Update"
 msgstr ""
 
@@ -3006,7 +3006,7 @@ msgstr ""
 msgid "Items tagged with: %s"
 msgstr ""
 
-#: mod/search.php:248 mod/contacts.php:844
+#: mod/search.php:248 mod/contact.php:844
 #, php-format
 msgid "Results for: %s"
 msgstr ""
@@ -3015,7 +3015,7 @@ msgstr ""
 msgid "No contacts in common."
 msgstr ""
 
-#: mod/common.php:142 mod/contacts.php:919
+#: mod/common.php:142 mod/contact.php:919
 msgid "Common Friends"
 msgstr ""
 
@@ -3177,7 +3177,7 @@ msgstr ""
 msgid "Members"
 msgstr ""
 
-#: mod/group.php:246 mod/contacts.php:742
+#: mod/group.php:246 mod/contact.php:742
 msgid "All Contacts"
 msgstr ""
 
@@ -3301,7 +3301,7 @@ msgstr ""
 msgid "No contacts."
 msgstr ""
 
-#: mod/viewcontacts.php:106 mod/contacts.php:640 mod/contacts.php:1055
+#: mod/viewcontacts.php:106 mod/contact.php:640 mod/contact.php:1055
 #, php-format
 msgid "Visit %s's profile [%s]"
 msgstr ""
@@ -3318,7 +3318,7 @@ msgstr ""
 msgid "Contact unfollowed"
 msgstr ""
 
-#: mod/unfollow.php:113 mod/contacts.php:607
+#: mod/unfollow.php:113 mod/contact.php:607
 msgid "Disconnect/Unfollow"
 msgstr ""
 
@@ -3331,11 +3331,11 @@ msgid "Submit Request"
 msgstr ""
 
 #: mod/unfollow.php:135 mod/notifications.php:174 mod/notifications.php:258
-#: mod/admin.php:500 mod/admin.php:510 mod/contacts.php:677 mod/follow.php:166
+#: mod/admin.php:500 mod/admin.php:510 mod/contact.php:677 mod/follow.php:166
 msgid "Profile URL"
 msgstr ""
 
-#: mod/unfollow.php:145 mod/contacts.php:891 mod/follow.php:189
+#: mod/unfollow.php:145 mod/contact.php:891 mod/follow.php:189
 #: src/Model/Profile.php:891
 msgid "Status Messages and Posts"
 msgstr ""
@@ -3472,7 +3472,7 @@ msgid "Discard"
 msgstr ""
 
 #: mod/notifications.php:57 mod/notifications.php:181 mod/notifications.php:266
-#: mod/contacts.php:659 mod/contacts.php:853 mod/contacts.php:1116
+#: mod/contact.php:659 mod/contact.php:853 mod/contact.php:1116
 msgid "Ignore"
 msgstr ""
 
@@ -3520,7 +3520,7 @@ msgstr ""
 msgid "Suggested by:"
 msgstr ""
 
-#: mod/notifications.php:176 mod/notifications.php:255 mod/contacts.php:667
+#: mod/notifications.php:176 mod/notifications.php:255 mod/contact.php:667
 msgid "Hide this contact from others"
 msgstr ""
 
@@ -3577,12 +3577,12 @@ msgstr ""
 msgid "Subscriber"
 msgstr ""
 
-#: mod/notifications.php:252 mod/contacts.php:687 mod/follow.php:177
+#: mod/notifications.php:252 mod/contact.php:687 mod/follow.php:177
 #: src/Model/Profile.php:794
 msgid "Tags:"
 msgstr ""
 
-#: mod/notifications.php:261 mod/contacts.php:81 src/Model/Profile.php:533
+#: mod/notifications.php:261 mod/contact.php:81 src/Model/Profile.php:533
 msgid "Network:"
 msgstr ""
 
@@ -4500,13 +4500,13 @@ msgstr ""
 msgid "select none"
 msgstr ""
 
-#: mod/admin.php:494 mod/admin.php:1907 mod/contacts.php:658
-#: mod/contacts.php:852 mod/contacts.php:1108
+#: mod/admin.php:494 mod/admin.php:1907 mod/contact.php:658
+#: mod/contact.php:852 mod/contact.php:1108
 msgid "Block"
 msgstr ""
 
-#: mod/admin.php:495 mod/admin.php:1909 mod/contacts.php:658
-#: mod/contacts.php:852 mod/contacts.php:1108
+#: mod/admin.php:495 mod/admin.php:1909 mod/contact.php:658
+#: mod/contact.php:852 mod/contact.php:1108
 msgid "Unblock"
 msgstr ""
 
@@ -4769,7 +4769,7 @@ msgid "Public postings from local users and the federated network"
 msgstr ""
 
 #: mod/admin.php:1353 mod/admin.php:1520 mod/admin.php:1530
-#: mod/contacts.php:583
+#: mod/contact.php:583
 msgid "Disabled"
 msgstr ""
 
@@ -4849,7 +4849,7 @@ msgstr ""
 msgid "Policies"
 msgstr ""
 
-#: mod/admin.php:1431 mod/contacts.php:929 mod/events.php:562
+#: mod/admin.php:1431 mod/contact.php:929 mod/events.php:562
 #: src/Model/Profile.php:865
 msgid "Advanced"
 msgstr ""
@@ -6143,7 +6143,7 @@ msgstr ""
 msgid "Disallowed profile URL."
 msgstr ""
 
-#: mod/dfrn_request.php:412 mod/contacts.php:241
+#: mod/dfrn_request.php:412 mod/contact.php:241
 msgid "Failed to update contact record."
 msgstr ""
 
@@ -6552,364 +6552,364 @@ msgstr ""
 msgid "No friends to display."
 msgstr ""
 
-#: mod/contacts.php:168
+#: mod/contact.php:168
 #, php-format
 msgid "%d contact edited."
 msgid_plural "%d contacts edited."
 msgstr[0] ""
 msgstr[1] ""
 
-#: mod/contacts.php:195 mod/contacts.php:401
+#: mod/contact.php:195 mod/contact.php:401
 msgid "Could not access contact record."
 msgstr ""
 
-#: mod/contacts.php:205
+#: mod/contact.php:205
 msgid "Could not locate selected profile."
 msgstr ""
 
-#: mod/contacts.php:239
+#: mod/contact.php:239
 msgid "Contact updated."
 msgstr ""
 
-#: mod/contacts.php:422
+#: mod/contact.php:422
 msgid "Contact has been blocked"
 msgstr ""
 
-#: mod/contacts.php:422
+#: mod/contact.php:422
 msgid "Contact has been unblocked"
 msgstr ""
 
-#: mod/contacts.php:432
+#: mod/contact.php:432
 msgid "Contact has been ignored"
 msgstr ""
 
-#: mod/contacts.php:432
+#: mod/contact.php:432
 msgid "Contact has been unignored"
 msgstr ""
 
-#: mod/contacts.php:442
+#: mod/contact.php:442
 msgid "Contact has been archived"
 msgstr ""
 
-#: mod/contacts.php:442
+#: mod/contact.php:442
 msgid "Contact has been unarchived"
 msgstr ""
 
-#: mod/contacts.php:466
+#: mod/contact.php:466
 msgid "Drop contact"
 msgstr ""
 
-#: mod/contacts.php:469 mod/contacts.php:848
+#: mod/contact.php:469 mod/contact.php:848
 msgid "Do you really want to delete this contact?"
 msgstr ""
 
-#: mod/contacts.php:487
+#: mod/contact.php:487
 msgid "Contact has been removed."
 msgstr ""
 
-#: mod/contacts.php:524
+#: mod/contact.php:524
 #, php-format
 msgid "You are mutual friends with %s"
 msgstr ""
 
-#: mod/contacts.php:529
+#: mod/contact.php:529
 #, php-format
 msgid "You are sharing with %s"
 msgstr ""
 
-#: mod/contacts.php:534
+#: mod/contact.php:534
 #, php-format
 msgid "%s is sharing with you"
 msgstr ""
 
-#: mod/contacts.php:558
+#: mod/contact.php:558
 msgid "Private communications are not available for this contact."
 msgstr ""
 
-#: mod/contacts.php:560
+#: mod/contact.php:560
 msgid "Never"
 msgstr ""
 
-#: mod/contacts.php:563
+#: mod/contact.php:563
 msgid "(Update was successful)"
 msgstr ""
 
-#: mod/contacts.php:563
+#: mod/contact.php:563
 msgid "(Update was not successful)"
 msgstr ""
 
-#: mod/contacts.php:565 mod/contacts.php:1089
+#: mod/contact.php:565 mod/contact.php:1089
 msgid "Suggest friends"
 msgstr ""
 
-#: mod/contacts.php:569
+#: mod/contact.php:569
 #, php-format
 msgid "Network type: %s"
 msgstr ""
 
-#: mod/contacts.php:574
+#: mod/contact.php:574
 msgid "Communications lost with this contact!"
 msgstr ""
 
-#: mod/contacts.php:580
+#: mod/contact.php:580
 msgid "Fetch further information for feeds"
 msgstr ""
 
-#: mod/contacts.php:582
+#: mod/contact.php:582
 msgid ""
 "Fetch information like preview pictures, title and teaser from the feed "
 "item. You can activate this if the feed doesn't contain much text. Keywords "
 "are taken from the meta header in the feed item and are posted as hash tags."
 msgstr ""
 
-#: mod/contacts.php:584
+#: mod/contact.php:584
 msgid "Fetch information"
 msgstr ""
 
-#: mod/contacts.php:585
+#: mod/contact.php:585
 msgid "Fetch keywords"
 msgstr ""
 
-#: mod/contacts.php:586
+#: mod/contact.php:586
 msgid "Fetch information and keywords"
 msgstr ""
 
-#: mod/contacts.php:618
+#: mod/contact.php:618
 msgid "Profile Visibility"
 msgstr ""
 
-#: mod/contacts.php:619
+#: mod/contact.php:619
 msgid "Contact Information / Notes"
 msgstr ""
 
-#: mod/contacts.php:620
+#: mod/contact.php:620
 msgid "Contact Settings"
 msgstr ""
 
-#: mod/contacts.php:629
+#: mod/contact.php:629
 msgid "Contact"
 msgstr ""
 
-#: mod/contacts.php:633
+#: mod/contact.php:633
 #, php-format
 msgid ""
 "Please choose the profile you would like to display to %s when viewing your "
 "profile securely."
 msgstr ""
 
-#: mod/contacts.php:635
+#: mod/contact.php:635
 msgid "Their personal note"
 msgstr ""
 
-#: mod/contacts.php:637
+#: mod/contact.php:637
 msgid "Edit contact notes"
 msgstr ""
 
-#: mod/contacts.php:641
+#: mod/contact.php:641
 msgid "Block/Unblock contact"
 msgstr ""
 
-#: mod/contacts.php:642
+#: mod/contact.php:642
 msgid "Ignore contact"
 msgstr ""
 
-#: mod/contacts.php:643
+#: mod/contact.php:643
 msgid "Repair URL settings"
 msgstr ""
 
-#: mod/contacts.php:644
+#: mod/contact.php:644
 msgid "View conversations"
 msgstr ""
 
-#: mod/contacts.php:649
+#: mod/contact.php:649
 msgid "Last update:"
 msgstr ""
 
-#: mod/contacts.php:651
+#: mod/contact.php:651
 msgid "Update public posts"
 msgstr ""
 
-#: mod/contacts.php:653 mod/contacts.php:1099
+#: mod/contact.php:653 mod/contact.php:1099
 msgid "Update now"
 msgstr ""
 
-#: mod/contacts.php:659 mod/contacts.php:853 mod/contacts.php:1116
+#: mod/contact.php:659 mod/contact.php:853 mod/contact.php:1116
 msgid "Unignore"
 msgstr ""
 
-#: mod/contacts.php:663
+#: mod/contact.php:663
 msgid "Currently blocked"
 msgstr ""
 
-#: mod/contacts.php:664
+#: mod/contact.php:664
 msgid "Currently ignored"
 msgstr ""
 
-#: mod/contacts.php:665
+#: mod/contact.php:665
 msgid "Currently archived"
 msgstr ""
 
-#: mod/contacts.php:666
+#: mod/contact.php:666
 msgid "Awaiting connection acknowledge"
 msgstr ""
 
-#: mod/contacts.php:667
+#: mod/contact.php:667
 msgid ""
 "Replies/likes to your public posts <strong>may</strong> still be visible"
 msgstr ""
 
-#: mod/contacts.php:668
+#: mod/contact.php:668
 msgid "Notification for new posts"
 msgstr ""
 
-#: mod/contacts.php:668
+#: mod/contact.php:668
 msgid "Send a notification of every new post of this contact"
 msgstr ""
 
-#: mod/contacts.php:671
+#: mod/contact.php:671
 msgid "Blacklisted keywords"
 msgstr ""
 
-#: mod/contacts.php:671
+#: mod/contact.php:671
 msgid ""
 "Comma separated list of keywords that should not be converted to hashtags, "
 "when \"Fetch information and keywords\" is selected"
 msgstr ""
 
-#: mod/contacts.php:683 src/Model/Profile.php:437
+#: mod/contact.php:683 src/Model/Profile.php:437
 msgid "XMPP:"
 msgstr ""
 
-#: mod/contacts.php:688
+#: mod/contact.php:688
 msgid "Actions"
 msgstr ""
 
-#: mod/contacts.php:734
+#: mod/contact.php:734
 msgid "Suggestions"
 msgstr ""
 
-#: mod/contacts.php:737
+#: mod/contact.php:737
 msgid "Suggest potential friends"
 msgstr ""
 
-#: mod/contacts.php:745
+#: mod/contact.php:745
 msgid "Show all contacts"
 msgstr ""
 
-#: mod/contacts.php:750
+#: mod/contact.php:750
 msgid "Unblocked"
 msgstr ""
 
-#: mod/contacts.php:753
+#: mod/contact.php:753
 msgid "Only show unblocked contacts"
 msgstr ""
 
-#: mod/contacts.php:758
+#: mod/contact.php:758
 msgid "Blocked"
 msgstr ""
 
-#: mod/contacts.php:761
+#: mod/contact.php:761
 msgid "Only show blocked contacts"
 msgstr ""
 
-#: mod/contacts.php:766
+#: mod/contact.php:766
 msgid "Ignored"
 msgstr ""
 
-#: mod/contacts.php:769
+#: mod/contact.php:769
 msgid "Only show ignored contacts"
 msgstr ""
 
-#: mod/contacts.php:774
+#: mod/contact.php:774
 msgid "Archived"
 msgstr ""
 
-#: mod/contacts.php:777
+#: mod/contact.php:777
 msgid "Only show archived contacts"
 msgstr ""
 
-#: mod/contacts.php:782
+#: mod/contact.php:782
 msgid "Hidden"
 msgstr ""
 
-#: mod/contacts.php:785
+#: mod/contact.php:785
 msgid "Only show hidden contacts"
 msgstr ""
 
-#: mod/contacts.php:843
+#: mod/contact.php:843
 msgid "Search your contacts"
 msgstr ""
 
-#: mod/contacts.php:854 mod/contacts.php:1125
+#: mod/contact.php:854 mod/contact.php:1125
 msgid "Archive"
 msgstr ""
 
-#: mod/contacts.php:854 mod/contacts.php:1125
+#: mod/contact.php:854 mod/contact.php:1125
 msgid "Unarchive"
 msgstr ""
 
-#: mod/contacts.php:857
+#: mod/contact.php:857
 msgid "Batch Actions"
 msgstr ""
 
-#: mod/contacts.php:883
+#: mod/contact.php:883
 msgid "Conversations started by this contact"
 msgstr ""
 
-#: mod/contacts.php:888
+#: mod/contact.php:888
 msgid "Posts and Comments"
 msgstr ""
 
-#: mod/contacts.php:899 src/Model/Profile.php:899
+#: mod/contact.php:899 src/Model/Profile.php:899
 msgid "Profile Details"
 msgstr ""
 
-#: mod/contacts.php:911
+#: mod/contact.php:911
 msgid "View all contacts"
 msgstr ""
 
-#: mod/contacts.php:922
+#: mod/contact.php:922
 msgid "View all common friends"
 msgstr ""
 
-#: mod/contacts.php:932
+#: mod/contact.php:932
 msgid "Advanced Contact Settings"
 msgstr ""
 
-#: mod/contacts.php:1022
+#: mod/contact.php:1022
 msgid "Mutual Friendship"
 msgstr ""
 
-#: mod/contacts.php:1027
+#: mod/contact.php:1027
 msgid "is a fan of yours"
 msgstr ""
 
-#: mod/contacts.php:1032
+#: mod/contact.php:1032
 msgid "you are a fan of"
 msgstr ""
 
-#: mod/contacts.php:1049 mod/photos.php:1496 mod/photos.php:1535
+#: mod/contact.php:1049 mod/photos.php:1496 mod/photos.php:1535
 #: mod/photos.php:1595 src/Object/Post.php:792
 msgid "This is you"
 msgstr ""
 
-#: mod/contacts.php:1056
+#: mod/contact.php:1056
 msgid "Edit contact"
 msgstr ""
 
-#: mod/contacts.php:1110
+#: mod/contact.php:1110
 msgid "Toggle Blocked status"
 msgstr ""
 
-#: mod/contacts.php:1118
+#: mod/contact.php:1118
 msgid "Toggle Ignored status"
 msgstr ""
 
-#: mod/contacts.php:1127
+#: mod/contact.php:1127
 msgid "Toggle Archive status"
 msgstr ""
 
-#: mod/contacts.php:1135
+#: mod/contact.php:1135
 msgid "Delete contact"
 msgstr ""
 
index 344ee296a2056f244c3992c2341b38957cda5fd5..b4c34f74e2ca3a08f7ca52207837f963f0143856 100644 (file)
@@ -5,7 +5,7 @@
 
 
        <div id="contact-edit-nav-wrapper" >
-               <form action="contacts/{{$contact_id}}" method="post" >
+               <form action="contact/{{$contact_id}}" method="post" >
                        <div id="contact-edit-links">
                                <div id="contact-edit-status-wrapper">
                                        <span id="contact-edit-contact-status">{{$contact_status}}</span>
index bec295924ee51952fca8fe2761367e72a8127fb8..d85fcfb5af41460c698b20a0c4a8ea57d2eea377 100644 (file)
@@ -14,7 +14,7 @@
 
 {{$tabs}}
 
-<form action="{{$baseurl}}/contacts/batch/" method="POST">
+<form action="{{$baseurl}}/contact/batch/" method="POST">
 {{foreach $contacts as $contact}}
        {{include file="contact_template.tpl"}}
 {{/foreach}}
index ba04073b602d3df8245478db12166e31b73fa83f..72528bd26193246ff80c4684dc73e3e549ed4904 100644 (file)
@@ -15,7 +15,7 @@
 
        <div id="contact-update-profile-wrapper">
        {{if $update_profile}}
-               <span id="contact-update-profile-now" class="button"><a href="contacts/{{$contact_id}}/updateprofile" >{{$udprofilenow}}</a></span>
+               <span id="contact-update-profile-now" class="button"><a href="contact/{{$contact_id}}/updateprofile" >{{$udprofilenow}}</a></span>
        {{/if}}
        </div>
 
index 3db3fde0320483b153ac275c52b84a3ad82277d3..04426eeb12aa5b799d2cc2af2e1b1ae141d0c245 100644 (file)
@@ -9,7 +9,7 @@
 
 
                <div id="contact-edit-content-wrapper">
-                       <form action="contacts/{{$contact_id}}" method="post" >
+                       <form action="contact/{{$contact_id}}" method="post" >
 
                                {{* This is the Action menu where contact related actions like 'ignore', 'hide' can be performed *}}
                                <ul id="contact-edit-actions" class="nav nav-pills preferences">
@@ -45,7 +45,7 @@
                                                {{if $poll_enabled}}
                                                        <li><div id="contact-edit-last-update-text">{{$lastupdtext}} <span id="contact-edit-last-updated">{{$last_update}}</span></div>
                                                        {{if $poll_interval}}
-                                                               <form id="contact-edit-poll-form" action="/contacts/{{$contact_id}}" method="post"> 
+                                                               <form id="contact-edit-poll-form" action="/contact/{{$contact_id}}" method="post"> 
                                                                        <span id="contact-edit-poll-text">{{$updpub}}</span> {{$poll_interval}}
                                                                        <input class="btn btn-primary" type="submit" name="submit" value="{{$submit|escape:'html'}}" />
                                                                </form>
index 6f64224015fa062eb863a73b740f29f699cbcafa..705e377ed358ebc9e19d17c9b0bcb4eebe25a5e3 100644 (file)
@@ -28,7 +28,7 @@
        <div id="contacts-search-end"></div>
 
        {{* we need the form container to make batch actions work *}}
-       <form name="batch_actions_submit" action="{{$baseurl}}/contacts/batch/" method="POST">
+       <form name="batch_actions_submit" action="{{$baseurl}}/contact/batch/" method="POST">
 
                {{* we put here a hidden input element. This is needed to transmit the batch actions with javascript*}}
                <input type="hidden" class="batch-action no-input fakelist" name="batch_submit" value="{{$l|escape:'html'}}">
index 22605bb7a5101b912077a097f6b35aa6c46b6e43..3d45c6ddcaea9d2a11de3b839297a139a989968a 100644 (file)
@@ -17,7 +17,7 @@
 
                <div id="contact-update-profile-wrapper">
                {{if $update_profile}}
-                       <span id="contact-update-profile-now" class="button"><a href="contacts/{{$contact_id}}/updateprofile" >{{$udprofilenow}}</a></span>
+                       <span id="contact-update-profile-now" class="button"><a href="contact/{{$contact_id}}/updateprofile" >{{$udprofilenow}}</a></span>
                {{/if}}
                </div>
 
index 18fb98cc9d158b1f9700c69946770208d447db4f..f46b42788fe9253da7355c6e9285f695cff474f2 100644 (file)
@@ -16,7 +16,8 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
-use Friendica\Model\Profile;
+use Friendica\Model;
+use Friendica\Module;
 
 $frio = 'view/theme/frio';
 
@@ -208,7 +209,7 @@ function frio_contact_photo_menu(App $a, &$args)
 function frio_remote_nav($a, &$nav)
 {
        // get the homelink from $_XSESSION
-       $homelink = Profile::getMyURL();
+       $homelink = Model\Profile::getMyURL();
        if (!$homelink) {
                $homelink = defaults($_SESSION, 'visitor_home', '');
        }
@@ -246,7 +247,7 @@ function frio_remote_nav($a, &$nav)
        } elseif (!local_user() && remote_user()) {
                $r = q("SELECT `name`, `nick`, `micro` AS `photo` FROM `contact` WHERE `id` = %d", intval(remote_user()));
                $nav['remote'] = L10n::t('Guest');
-       } elseif (Profile::getMyURL()) {
+       } elseif (Model\Profile::getMyURL()) {
                $r = q("SELECT `name`, `nick`, `photo` FROM `gcontact`
                                WHERE `addr` = '%s' AND `network` = 'dfrn'",
                        DBA::escape($webbie));
@@ -277,7 +278,7 @@ function frio_remote_nav($a, &$nav)
                $nav['events'] = [$server_url . '/events', L10n::t('Events'), '', L10n::t('Events and Calendar')];
                $nav['messages'] = [$server_url . '/message', L10n::t('Messages'), '', L10n::t('Private mail')];
                $nav['settings'] = [$server_url . '/settings', L10n::t('Settings'), '', L10n::t('Account settings')];
-               $nav['contacts'] = [$server_url . '/contacts', L10n::t('Contacts'), '', L10n::t('Manage/edit friends and contacts')];
+               $nav['contacts'] = [$server_url . '/contact', L10n::t('Contacts'), '', L10n::t('Manage/edit friends and contacts')];
                $nav['sitename'] = Config::get('config', 'sitename');
        }
 }
@@ -286,7 +287,7 @@ function frio_remote_nav($a, &$nav)
  * @brief: Search for contacts
  *
  * This function search for a users contacts. The code is copied from contact search
- * in /mod/contacts.php. With this function the contacts will permitted to acl_lookup()
+ * in /src/Module/Contact.php. With this function the contacts will permitted to acl_lookup()
  * and can grabbed as json. For this we use the type="r". This is usful to to let js
  * grab the contact data.
  * We use this to give the data to textcomplete and have a filter function at the
@@ -297,12 +298,10 @@ 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
-       // done in /mod/contacts for connections
+       // done in /src/Module/Contact.php for connections
        if ($results['type'] !== 'r') {
                return;
        }
@@ -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[] = Module\Contact::getContactTemplateVars($rr);
                }
        }
 
index 63069a772138a48ecddaf8cd9bcae3496bd45938..9014be1d252356f5ee5d435ec8548d3cb98fbf6b 100644 (file)
@@ -6,7 +6,7 @@
 
 
        <div id="contact-edit-nav-wrapper" >
-               <form action="contacts/{{$contact_id}}" method="post" >
+               <form action="contact/{{$contact_id}}" method="post" >
                        <div id="contact-edit-links">
                                <div id="contact-edit-status-wrapper">
                                        <span id="contact-edit-contact-status">{{$contact_status}}</span>