GlobalContact created
Moved DirSearch and GlobalContact related functions to Friendica\Model namespace
This commit is contained in:
parent
5f25ef55d2
commit
47db624105
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file include/DirSearch.php
|
||||
* @brief This file includes the DirSearch class with directory related functions
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
/**
|
||||
* @brief This class handels directory related functions
|
||||
*/
|
||||
class DirSearch {
|
||||
|
||||
/**
|
||||
* @brief Search global contact table by nick or name
|
||||
*
|
||||
* @param string $search Name or nick
|
||||
* @param string $mode Search mode (e.g. "community")
|
||||
* @return array with search results
|
||||
*/
|
||||
public static function global_search_by_name($search, $mode = '') {
|
||||
|
||||
if($search) {
|
||||
// check supported networks
|
||||
if (Config::get('system','diaspora_enabled'))
|
||||
$diaspora = NETWORK_DIASPORA;
|
||||
else
|
||||
$diaspora = NETWORK_DFRN;
|
||||
|
||||
if (!Config::get('system','ostatus_disabled'))
|
||||
$ostatus = NETWORK_OSTATUS;
|
||||
else
|
||||
$ostatus = NETWORK_DFRN;
|
||||
|
||||
// check if we search only communities or every contact
|
||||
if($mode === "community")
|
||||
$extra_sql = " AND `community`";
|
||||
else
|
||||
$extra_sql = "";
|
||||
|
||||
$search .= "%";
|
||||
|
||||
$results = q("SELECT `contact`.`id` AS `cid`, `gcontact`.`url`, `gcontact`.`name`, `gcontact`.`nick`, `gcontact`.`photo`,
|
||||
`gcontact`.`network`, `gcontact`.`keywords`, `gcontact`.`addr`, `gcontact`.`community`
|
||||
FROM `gcontact`
|
||||
LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`
|
||||
AND `contact`.`uid` = %d AND NOT `contact`.`blocked`
|
||||
AND NOT `contact`.`pending` AND `contact`.`rel` IN ('%s', '%s')
|
||||
WHERE (`contact`.`id` > 0 OR (NOT `gcontact`.`hide` AND `gcontact`.`network` IN ('%s', '%s', '%s') AND
|
||||
((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`)))) AND
|
||||
(`gcontact`.`addr` LIKE '%s' OR `gcontact`.`name` LIKE '%s' OR `gcontact`.`nick` LIKE '%s') $extra_sql
|
||||
GROUP BY `gcontact`.`nurl`
|
||||
ORDER BY `gcontact`.`nurl` DESC
|
||||
LIMIT 1000",
|
||||
intval(local_user()), dbesc(CONTACT_IS_SHARING), dbesc(CONTACT_IS_FRIEND),
|
||||
dbesc(NETWORK_DFRN), dbesc($ostatus), dbesc($diaspora),
|
||||
dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)));
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -7,10 +7,10 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
|
||||
require_once "include/contact_selectors.php";
|
||||
require_once "include/contact_widgets.php";
|
||||
require_once "include/DirSearch.php";
|
||||
require_once "include/features.php";
|
||||
require_once "mod/proxy.php";
|
||||
|
||||
|
@ -59,10 +59,9 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
|
|||
return $o;
|
||||
}
|
||||
|
||||
/// @TODO after an optional parameter, no mandadory parameter can follow
|
||||
/// @TODO find proper type-hints
|
||||
function contact_selector($selname, $selclass, $preselected = false, $options) {
|
||||
|
||||
function contact_selector($selname, $selclass, $options, $preselected = false)
|
||||
{
|
||||
$a = get_app();
|
||||
|
||||
$mutual = false;
|
||||
|
@ -779,7 +778,7 @@ function navbar_complete(App $a) {
|
|||
}
|
||||
|
||||
if ($localsearch) {
|
||||
$x = DirSearch::global_search_by_name($search, $mode);
|
||||
$x = GlobalContact::searchByName($search, $mode);
|
||||
return $x;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
|
||||
require_once 'include/contact_selectors.php';
|
||||
|
||||
|
@ -248,31 +249,28 @@ function common_friends_visitor_widget($profile_uid) {
|
|||
return;
|
||||
}
|
||||
|
||||
require_once 'include/socgraph.php';
|
||||
|
||||
if ($cid) {
|
||||
$t = count_common_friends($profile_uid, $cid);
|
||||
$t = GlobalContact::countCommonFriends($profile_uid, $cid);
|
||||
} else {
|
||||
$t = count_common_friends_zcid($profile_uid, $zcid);
|
||||
$t = GlobalContact::countCommonFriendsZcid($profile_uid, $zcid);
|
||||
}
|
||||
if (! $t) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($cid) {
|
||||
$r = common_friends($profile_uid, $cid, 0, 5, true);
|
||||
$r = GlobalContact::commonFriends($profile_uid, $cid, 0, 5, true);
|
||||
} else {
|
||||
$r = common_friends_zcid($profile_uid, $zcid, 0, 5, true);
|
||||
$r = GlobalContact::commonFriendsZcid($profile_uid, $zcid, 0, 5, true);
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
|
||||
'$desc' => sprintf( tt("%d contact in common", "%d contacts in common", $t), $t),
|
||||
'$desc' => sprintf(tt("%d contact in common", "%d contacts in common", $t), $t),
|
||||
'$base' => System::baseUrl(),
|
||||
'$uid' => $profile_uid,
|
||||
'$cid' => (($cid) ? $cid : '0'),
|
||||
'$linkmore' => (($t > 5) ? 'true' : ''),
|
||||
'$more' => t('show more'),
|
||||
'$items' => $r
|
||||
));
|
||||
|
||||
};
|
||||
'$items' => $r)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file include cronjobs.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Network\Probe;
|
||||
|
||||
function cronjobs_run(&$argv, &$argc){
|
||||
|
@ -266,7 +269,7 @@ function cron_repair_database() {
|
|||
$r = q("SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`");
|
||||
if (DBM::is_result($r)) {
|
||||
foreach ($r AS $user) {
|
||||
update_gcontact_for_user($user["uid"]);
|
||||
GlobalContact::updateForUser($user["uid"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* @file include/discover_poco.php
|
||||
*/
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
|
||||
require_once 'include/socgraph.php';
|
||||
require_once 'include/datetime.php';
|
||||
|
||||
function discover_poco_run(&$argv, &$argc) {
|
||||
|
||||
function discover_poco_run(&$argv, &$argc)
|
||||
{
|
||||
/*
|
||||
This function can be called in these ways:
|
||||
- dirsearch <search pattern>: Searches for "search pattern" in the directory. "search pattern" is url encoded.
|
||||
|
@ -18,7 +22,7 @@ function discover_poco_run(&$argv, &$argc) {
|
|||
- server <poco url>: Searches for the poco server list. "poco url" is base64 encoded.
|
||||
- update_server: Frequently check the first 250 servers for vitality.
|
||||
- update_server_directory: Discover the given server id for their contacts
|
||||
- poco_load: Load POCO data from a given POCO address
|
||||
- PortableContact::load: Load POCO data from a given POCO address
|
||||
- check_profile: Update remote profile data
|
||||
*/
|
||||
|
||||
|
@ -35,7 +39,7 @@ function discover_poco_run(&$argv, &$argc) {
|
|||
$mode = 5;
|
||||
} elseif (($argc == 3) && ($argv[1] == "update_server_directory")) {
|
||||
$mode = 6;
|
||||
} elseif (($argc > 5) && ($argv[1] == "poco_load")) {
|
||||
} elseif (($argc > 5) && ($argv[1] == "load")) {
|
||||
$mode = 7;
|
||||
} elseif (($argc == 3) && ($argv[1] == "check_profile")) {
|
||||
$mode = 8;
|
||||
|
@ -43,7 +47,8 @@ function discover_poco_run(&$argv, &$argc) {
|
|||
$search = "";
|
||||
$mode = 0;
|
||||
} else {
|
||||
die("Unknown or missing parameter ".$argv[1]."\n");
|
||||
logger("Unknown or missing parameter ".$argv[1]."\n");
|
||||
return;
|
||||
}
|
||||
|
||||
logger('start '.$search);
|
||||
|
@ -58,7 +63,7 @@ function discover_poco_run(&$argv, &$argc) {
|
|||
} else {
|
||||
$url = '';
|
||||
}
|
||||
poco_load_worker(intval($argv[2]), intval($argv[3]), intval($argv[4]), $url);
|
||||
PortableContact::load(intval($argv[2]), intval($argv[3]), intval($argv[4]), $url);
|
||||
} elseif ($mode == 6) {
|
||||
poco_discover_single_server(intval($argv[2]));
|
||||
} elseif ($mode == 5) {
|
||||
|
@ -81,19 +86,19 @@ function discover_poco_run(&$argv, &$argc) {
|
|||
}
|
||||
logger($result, LOGGER_DEBUG);
|
||||
} elseif ($mode == 3) {
|
||||
update_suggestions();
|
||||
} elseif (($mode == 2) && Config::get('system','poco_completion')) {
|
||||
GlobalContact::updateSuggestions();
|
||||
} elseif (($mode == 2) && Config::get('system', 'poco_completion')) {
|
||||
discover_users();
|
||||
} elseif (($mode == 1) && ($search != "") && Config::get('system','poco_local_search')) {
|
||||
} elseif (($mode == 1) && ($search != "") && Config::get('system', 'poco_local_search')) {
|
||||
discover_directory($search);
|
||||
gs_search_user($search);
|
||||
} elseif (($mode == 0) && ($search == "") && (Config::get('system','poco_discovery') > 0)) {
|
||||
} elseif (($mode == 0) && ($search == "") && (Config::get('system', 'poco_discovery') > 0)) {
|
||||
// Query Friendica and Hubzilla servers for their users
|
||||
poco_discover();
|
||||
|
||||
// Query GNU Social servers for their users ("statistics" addon has to be enabled on the GS server)
|
||||
if (!Config::get('system','ostatus_disabled'))
|
||||
gs_discover();
|
||||
if (!Config::get('system', 'ostatus_disabled'))
|
||||
GlobalContact::gsDiscover();
|
||||
}
|
||||
|
||||
logger('end '.$search);
|
||||
|
@ -246,7 +251,7 @@ function discover_directory($search) {
|
|||
|
||||
$data["server_url"] = $data["baseurl"];
|
||||
|
||||
update_gcontact($data);
|
||||
GlobalContact::update($data);
|
||||
} else {
|
||||
logger("Profile ".$jj->url." is not responding or no Friendica contact - but network ".$data["network"], LOGGER_DEBUG);
|
||||
}
|
||||
|
@ -287,7 +292,7 @@ function gs_search_user($search) {
|
|||
$contact = Probe::uri($user->site_address."/".$user->name);
|
||||
if ($contact["network"] != NETWORK_PHANTOM) {
|
||||
$contact["about"] = $user->description;
|
||||
update_gcontact($contact);
|
||||
GlobalContact::update($contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* @file include/gprobe.php
|
||||
*/
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
|
||||
require_once 'include/socgraph.php';
|
||||
require_once 'include/datetime.php';
|
||||
|
||||
function gprobe_run(&$argv, &$argc){
|
||||
function gprobe_run(&$argv, &$argc)
|
||||
{
|
||||
if ($argc != 2) {
|
||||
return;
|
||||
}
|
||||
$url = $argv[1];
|
||||
|
||||
$r = q("SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1",
|
||||
$r = q(
|
||||
"SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1",
|
||||
dbesc(normalise_link($url))
|
||||
);
|
||||
|
||||
logger("gprobe start for ".normalise_link($url), LOGGER_DEBUG);
|
||||
|
||||
if (!DBM::is_result($r)) {
|
||||
|
||||
// Is it a DDoS attempt?
|
||||
$urlparts = parse_url($url);
|
||||
|
||||
|
@ -39,17 +44,19 @@ function gprobe_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
if (!in_array($arr["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
|
||||
update_gcontact($arr);
|
||||
GlobalContact::update($arr);
|
||||
}
|
||||
|
||||
$r = q("SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1",
|
||||
$r = q(
|
||||
"SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1",
|
||||
dbesc(normalise_link($url))
|
||||
);
|
||||
}
|
||||
if (DBM::is_result($r)) {
|
||||
// Check for accessibility and do a poco discovery
|
||||
if (poco_last_updated($r[0]['url'], true) && ($r[0]["network"] == NETWORK_DFRN))
|
||||
poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url']));
|
||||
if (poco_last_updated($r[0]['url'], true) && ($r[0]["network"] == NETWORK_DFRN)) {
|
||||
PortableContact::loadWorker(0, 0, $r[0]['id'], str_replace('/profile/', '/poco/', $r[0]['url']));
|
||||
}
|
||||
}
|
||||
|
||||
logger("gprobe end for ".normalise_link($url), LOGGER_DEBUG);
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Protocol\DFRN;
|
||||
|
||||
require_once 'include/bbcode.php';
|
||||
|
@ -745,10 +746,10 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
|||
* On comments the author is the better choice.
|
||||
*/
|
||||
if ($arr['parent-uri'] === $arr['uri']) {
|
||||
$arr["gcontact-id"] = get_gcontact_id(array("url" => $arr['owner-link'], "network" => $arr['network'],
|
||||
$arr["gcontact-id"] = GlobalContact::getId(array("url" => $arr['owner-link'], "network" => $arr['network'],
|
||||
"photo" => $arr['owner-avatar'], "name" => $arr['owner-name']));
|
||||
} else {
|
||||
$arr["gcontact-id"] = get_gcontact_id(array("url" => $arr['author-link'], "network" => $arr['network'],
|
||||
$arr["gcontact-id"] = GlobalContact::getId(array("url" => $arr['author-link'], "network" => $arr['network'],
|
||||
"photo" => $arr['author-avatar'], "name" => $arr['author-name']));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\Cache;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Lock;
|
||||
use Friendica\Util\XML;
|
||||
|
@ -225,9 +226,9 @@ class ostatus
|
|||
$contact["generation"] = 2;
|
||||
$contact["hide"] = false; // OStatus contacts are never hidden
|
||||
$contact["photo"] = $author["author-avatar"];
|
||||
$gcid = update_gcontact($contact);
|
||||
$gcid = GlobalContact::update($contact);
|
||||
|
||||
link_gcontact($gcid, $contact["uid"], $contact["id"]);
|
||||
GlobalContact::link($gcid, $contact["uid"], $contact["id"]);
|
||||
}
|
||||
|
||||
return $author;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
|
||||
/**
|
||||
* @brief Calls the post update functions
|
||||
|
@ -72,7 +73,7 @@ function post_update_1192() {
|
|||
|
||||
// Set the "gcontact-id" in the item table and add a new gcontact entry if needed
|
||||
foreach ($item_arr AS $item) {
|
||||
$gcontact_id = get_gcontact_id(array("url" => $item['author-link'], "network" => $item['network'],
|
||||
$gcontact_id = GlobalContact::getId(array("url" => $item['author-link'], "network" => $item['network'],
|
||||
"photo" => $item['author-avatar'], "name" => $item['author-name']));
|
||||
q("UPDATE `item` SET `gcontact-id` = %d WHERE `uid` = %d AND `author-link` = '%s' AND `gcontact-id` = 0",
|
||||
intval($gcontact_id), intval($item["uid"]), dbesc($item["author-link"]));
|
||||
|
|
2446
include/socgraph.php
2446
include/socgraph.php
File diff suppressed because it is too large
Load diff
|
@ -1,13 +1,16 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file mod/allfriends.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
|
||||
require_once('include/socgraph.php');
|
||||
require_once('include/Contact.php');
|
||||
require_once('include/contact_selectors.php');
|
||||
require_once('mod/contacts.php');
|
||||
require_once 'include/socgraph.php';
|
||||
require_once 'include/Contact.php';
|
||||
require_once 'include/contact_selectors.php';
|
||||
require_once 'mod/contacts.php';
|
||||
|
||||
function allfriends_content(App $a) {
|
||||
|
||||
|
@ -39,12 +42,12 @@ function allfriends_content(App $a) {
|
|||
$a->page['aside'] = "";
|
||||
profile_load($a, "", 0, get_contact_details_by_url($c[0]["url"]));
|
||||
|
||||
$total = count_all_friends(local_user(), $cid);
|
||||
$total = GlobalContact::countAllFriends(local_user(), $cid);
|
||||
|
||||
if(count($total))
|
||||
$a->set_pager_total($total);
|
||||
|
||||
$r = all_friends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||
$r = GlobalContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||
|
||||
if (! DBM::is_result($r)) {
|
||||
$o .= t('No friends to display.');
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file include/common.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
|
||||
require_once('include/socgraph.php');
|
||||
require_once('include/Contact.php');
|
||||
require_once('include/contact_selectors.php');
|
||||
require_once('mod/contacts.php');
|
||||
require_once 'include/Contact.php';
|
||||
require_once 'include/contact_selectors.php';
|
||||
require_once 'mod/contacts.php';
|
||||
|
||||
function common_content(App $a) {
|
||||
|
||||
|
@ -83,23 +85,23 @@ function common_content(App $a) {
|
|||
}
|
||||
|
||||
if ($cid) {
|
||||
$t = count_common_friends($uid, $cid);
|
||||
$t = GlobalContact::countCommonFriends($uid, $cid);
|
||||
} else {
|
||||
$t = count_common_friends_zcid($uid, $zcid);
|
||||
$t = GlobalContact::countCommonFriendsZcid($uid, $zcid);
|
||||
}
|
||||
|
||||
if (count($t)) {
|
||||
$a->set_pager_total($t);
|
||||
} else {
|
||||
notice( t('No contacts in common.') . EOL);
|
||||
notice(t('No contacts in common.') . EOL);
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
if ($cid) {
|
||||
$r = common_friends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||
$r = GlobalContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||
} else {
|
||||
$r = common_friends_zcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
|
||||
$r = GlobalContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ use Friendica\App;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Network\Probe;
|
||||
|
||||
require_once 'include/Contact.php';
|
||||
|
@ -312,7 +313,7 @@ function _contact_update_profile($contact_id) {
|
|||
update_contact_avatar($data['photo'], local_user(), $contact_id, true);
|
||||
|
||||
// Update the entry in the gcontact table
|
||||
update_gcontact_from_probe($data["url"]);
|
||||
GlobalContact::updateFromProbe($data["url"]);
|
||||
}
|
||||
|
||||
function _contact_block($contact_id, $orig_record) {
|
||||
|
@ -561,12 +562,12 @@ function contacts_content(App $a) {
|
|||
|
||||
$nettype = sprintf( t('Network type: %s'),network_to_name($contact['network'], $contact["url"]));
|
||||
|
||||
//$common = count_common_friends(local_user(),$contact['id']);
|
||||
//$common = GlobalContact::countCommonFriends(local_user(),$contact['id']);
|
||||
//$common_text = (($common) ? sprintf( tt('%d contact in common','%d contacts in common', $common),$common) : '');
|
||||
|
||||
$polling = (($contact['network'] === NETWORK_MAIL | $contact['network'] === NETWORK_FEED) ? 'polling' : '');
|
||||
|
||||
//$x = count_all_friends(local_user(), $contact['id']);
|
||||
//$x = GlobalContact::countAllFriends(local_user(), $contact['id']);
|
||||
//$all_friends = (($x) ? t('View all contacts') : '');
|
||||
|
||||
// tabs
|
||||
|
@ -878,7 +879,7 @@ function contacts_tab($a, $contact_id, $active_tab) {
|
|||
);
|
||||
|
||||
// Show this tab only if there is visible friend list
|
||||
$x = count_all_friends(local_user(), $contact_id);
|
||||
$x = GlobalContact::countAllFriends(local_user(), $contact_id);
|
||||
if ($x)
|
||||
$tabs[] = array('label'=>t('Contacts'),
|
||||
'url' => "allfriends/".$contact_id,
|
||||
|
@ -888,7 +889,7 @@ function contacts_tab($a, $contact_id, $active_tab) {
|
|||
'accesskey' => 't');
|
||||
|
||||
// Show this tab only if there is visible common friend list
|
||||
$common = count_common_friends(local_user(),$contact_id);
|
||||
$common = GlobalContact::countCommonFriends(local_user(), $contact_id);
|
||||
if ($common)
|
||||
$tabs[] = array('label'=>t('Common Friends'),
|
||||
'url' => "common/loc/".local_user()."/".$contact_id,
|
||||
|
|
|
@ -4,6 +4,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Network\Probe;
|
||||
|
||||
require_once 'include/contact_widgets.php';
|
||||
|
@ -79,7 +80,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)) {
|
||||
update_gcontact($user_data);
|
||||
GlobalContact::update($user_data);
|
||||
}
|
||||
} elseif ($local) {
|
||||
|
||||
|
|
|
@ -74,38 +74,44 @@ function fsuggest_post(App $a) {
|
|||
|
||||
|
||||
|
||||
function fsuggest_content(App $a) {
|
||||
|
||||
require_once('include/acl_selectors.php');
|
||||
function fsuggest_content(App $a)
|
||||
{
|
||||
require_once 'include/acl_selectors.php';
|
||||
|
||||
if (! local_user()) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
notice(t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
if($a->argc != 2)
|
||||
if ($a->argc != 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
$contact_id = intval($a->argv[1]);
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
$r = q(
|
||||
"SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($contact_id),
|
||||
intval(local_user())
|
||||
);
|
||||
if (! DBM::is_result($r)) {
|
||||
notice( t('Contact not found.') . EOL);
|
||||
notice(t('Contact not found.') . EOL);
|
||||
return;
|
||||
}
|
||||
$contact = $r[0];
|
||||
|
||||
$o = '<h3>' . t('Suggest Friends') . '</h3>';
|
||||
|
||||
$o .= '<div id="fsuggest-desc" >' . sprintf( t('Suggest a friend for %s'), $contact['name']) . '</div>';
|
||||
$o .= '<div id="fsuggest-desc" >' . sprintf(t('Suggest a friend for %s'), $contact['name']) . '</div>';
|
||||
|
||||
$o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >';
|
||||
|
||||
$o .= contact_selector('suggest','suggest-select', false,
|
||||
array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true));
|
||||
$o .= contact_selector(
|
||||
'suggest',
|
||||
'suggest-select',
|
||||
array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true),
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
$o .= '<div id="fsuggest-submit-wrapper"><input id="fsuggest-submit" type="submit" name="submit" value="' . t('Submit') . '" /></div>';
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Model\GlobalContact;
|
||||
|
||||
require_once("include/socgraph.php");
|
||||
require_once("include/Contact.php");
|
||||
require_once "include/socgraph.php";
|
||||
require_once "include/Contact.php";
|
||||
|
||||
function hovercard_init(App $a) {
|
||||
// Just for testing purposes
|
||||
|
@ -48,7 +49,7 @@ function hovercard_content() {
|
|||
}
|
||||
|
||||
// if it's the url containing https it should be converted to http
|
||||
$nurl = normalise_link(clean_contact_url($profileurl));
|
||||
$nurl = normalise_link(GlobalContact::cleanContactUrl($profileurl));
|
||||
if($nurl) {
|
||||
// Search for contact data
|
||||
$contact = get_contact_details_by_url($nurl);
|
||||
|
|
|
@ -20,6 +20,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
|
||||
|
@ -737,7 +738,7 @@ function item_post(App $a) {
|
|||
$datarray['postopts'] = $postopts;
|
||||
$datarray['origin'] = $origin;
|
||||
$datarray['moderated'] = $allow_moderated;
|
||||
$datarray['gcontact-id'] = get_gcontact_id(array("url" => $datarray['author-link'], "network" => $datarray['network'],
|
||||
$datarray['gcontact-id'] = GlobalContact::getId(array("url" => $datarray['author-link'], "network" => $datarray['network'],
|
||||
"photo" => $datarray['author-avatar'], "name" => $datarray['author-name']));
|
||||
$datarray['object'] = $object;
|
||||
|
||||
|
@ -1239,7 +1240,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
|
|||
if (!DBM::is_result($r)) {
|
||||
$probed = Probe::uri($name);
|
||||
if ($result['network'] != NETWORK_PHANTOM) {
|
||||
update_gcontact($probed);
|
||||
GlobalContact::update($probed);
|
||||
$r = q("SELECT `url`, `name`, `nick`, `network`, `alias`, `notify` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($probed["url"])));
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file mod/profiles.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Network\Probe;
|
||||
|
||||
require_once 'include/Contact.php';
|
||||
|
@ -507,7 +510,7 @@ function profiles_post(App $a) {
|
|||
Worker::add(PRIORITY_LOW, 'profile_update', local_user());
|
||||
|
||||
// Update the global contact for the user
|
||||
update_gcontact_for_user(local_user());
|
||||
GlobalContact::updateForUser(local_user());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -650,7 +650,7 @@ function settings_post(App $a) {
|
|||
Worker::add(PRIORITY_LOW, 'profile_update', local_user());
|
||||
|
||||
// Update the global contact for the user
|
||||
update_gcontact_for_user(local_user());
|
||||
GlobalContact::updateForUser(local_user());
|
||||
|
||||
//$_SESSION['theme'] = $theme;
|
||||
if ($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file mod/suggest.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
|
||||
require_once('include/socgraph.php');
|
||||
require_once('include/contact_widgets.php');
|
||||
require_once 'include/socgraph.php';
|
||||
require_once 'include/contact_widgets.php';
|
||||
|
||||
function suggest_init(App $a) {
|
||||
if (! local_user()) {
|
||||
|
@ -66,7 +69,7 @@ function suggest_content(App $a) {
|
|||
$a->page['aside'] .= follow_widget();
|
||||
|
||||
|
||||
$r = suggestion_query(local_user());
|
||||
$r = GlobalContact::suggestionQuery(local_user());
|
||||
|
||||
if (! DBM::is_result($r)) {
|
||||
$o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
|
||||
|
|
1004
src/Model/GlobalContact.php
Normal file
1004
src/Model/GlobalContact.php
Normal file
File diff suppressed because it is too large
Load diff
|
@ -12,6 +12,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
|
@ -1675,9 +1676,9 @@ class DFRN
|
|||
$poco["photo"] = $author["avatar"];
|
||||
$poco["hide"] = $hide;
|
||||
$poco["contact-type"] = $contact["contact-type"];
|
||||
$gcid = update_gcontact($poco);
|
||||
$gcid = GlobalContact::update($poco);
|
||||
|
||||
link_gcontact($gcid, $importer["uid"], $contact["id"]);
|
||||
GlobalContact::link($gcid, $importer["uid"], $contact["id"]);
|
||||
}
|
||||
|
||||
return($author);
|
||||
|
|
|
@ -16,6 +16,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
|
@ -2246,9 +2247,9 @@ class Diaspora
|
|||
"addr" => $author, "nick" => $nick, "keywords" => $keywords,
|
||||
"hide" => !$searchable, "nsfw" => $nsfw);
|
||||
|
||||
$gcid = update_gcontact($gcontact);
|
||||
$gcid = GlobalContact::update($gcontact);
|
||||
|
||||
link_gcontact($gcid, $importer["uid"], $contact["id"]);
|
||||
GlobalContact::link($gcid, $importer["uid"], $contact["id"]);
|
||||
|
||||
logger("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], LOGGER_DEBUG);
|
||||
|
||||
|
|
1572
src/Protocol/PortableContact.php
Normal file
1572
src/Protocol/PortableContact.php
Normal file
File diff suppressed because it is too large
Load diff
|
@ -4,11 +4,13 @@ namespace Friendica\Worker;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use dba;
|
||||
|
||||
require_once 'include/follow.php';
|
||||
|
||||
Class OnePoll {
|
||||
Class OnePoll
|
||||
{
|
||||
public static function execute($contact_id = 0, $command = '') {
|
||||
global $a;
|
||||
|
||||
|
@ -16,7 +18,6 @@ Class OnePoll {
|
|||
require_once 'include/items.php';
|
||||
require_once 'include/Contact.php';
|
||||
require_once 'include/email.php';
|
||||
require_once 'include/socgraph.php';
|
||||
require_once 'include/queue_fn.php';
|
||||
|
||||
logger('onepoll: start');
|
||||
|
@ -72,7 +73,7 @@ Class OnePoll {
|
|||
);
|
||||
if (DBM::is_result($r)) {
|
||||
if (!$r[0]['total']) {
|
||||
poco_load($contact['id'], $importer_uid, 0, $contact['poco']);
|
||||
PortableContact::loadWorker($contact['id'], $importer_uid, 0, $contact['poco']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GlobalContact;
|
||||
|
||||
require_once "include/plugin.php";
|
||||
require_once "include/socgraph.php";
|
||||
|
@ -138,8 +139,7 @@ function vier_community_info() {
|
|||
|
||||
// comunity_profiles
|
||||
if ($show_profiles) {
|
||||
|
||||
$r = suggestion_query(local_user(), 0, 9);
|
||||
$r = GlobalContact::suggestionQuery(local_user(), 0, 9);
|
||||
|
||||
$tpl = get_markup_template('ch_directory_item.tpl');
|
||||
if (DBM::is_result($r)) {
|
||||
|
|
Loading…
Reference in a new issue