Use gcontact when adressing contacts in editor
parent
5ab2786c00
commit
fdb31abdfa
|
@ -784,6 +784,8 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
|||
$version = trim(str_replace("X-Diaspora-Version:", "", $line));
|
||||
$version = trim(str_replace("x-diaspora-version:", "", $version));
|
||||
$network = NETWORK_DIASPORA;
|
||||
$versionparts = explode("-", $version);
|
||||
$version = $versionparts[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1534,7 +1536,7 @@ function update_gcontact($contact) {
|
|||
if (!$gcontact_id)
|
||||
return false;
|
||||
|
||||
$r = q("SELECT `name`, `nick`, `photo`, `location`, `about`, `addr`, `generation`, `birthday`, `gender`, `keywords`, `hide`, `nsfw`
|
||||
$r = q("SELECT `name`, `nick`, `photo`, `location`, `about`, `addr`, `generation`, `birthday`, `gender`, `keywords`, `hide`, `nsfw`, `network`
|
||||
FROM `gcontact` WHERE `id` = %d LIMIT 1",
|
||||
intval($gcontact_id));
|
||||
|
||||
|
@ -1574,23 +1576,27 @@ function update_gcontact($contact) {
|
|||
if (!isset($contact["nsfw"]))
|
||||
$contact["nsfw"] = $r[0]["nsfw"];
|
||||
|
||||
if ($contact["network"] =="")
|
||||
$contact["network"] = $r[0]["network"];
|
||||
|
||||
if ($contact["network"] == NETWORK_STATUSNET)
|
||||
$contact["network"] = NETWORK_OSTATUS;
|
||||
|
||||
if (($contact["photo"] != $r[0]["photo"]) OR ($contact["name"] != $r[0]["name"]) OR ($contact["nick"] != $r[0]["nick"]) OR ($contact["addr"] != $r[0]["addr"]) OR
|
||||
($contact["birthday"] != $r[0]["birthday"]) OR ($contact["gender"] != $r[0]["gender"]) OR ($contact["keywords"] != $r[0]["keywords"]) OR
|
||||
($contact["hide"] != $r[0]["hide"]) OR ($contact["nsfw"] != $r[0]["nsfw"]) OR
|
||||
($contact["hide"] != $r[0]["hide"]) OR ($contact["nsfw"] != $r[0]["nsfw"]) OR ($contact["network"] != $r[0]["network"]) OR
|
||||
($contact["location"] != $r[0]["location"]) OR ($contact["about"] != $r[0]["about"]) OR ($contact["generation"] < $r[0]["generation"])) {
|
||||
|
||||
q("UPDATE `gcontact` SET `photo` = '%s', `name` = '%s', `nick` = '%s', `addr` = '%s',
|
||||
q("UPDATE `gcontact` SET `photo` = '%s', `name` = '%s', `nick` = '%s', `addr` = '%s', `network` = '%s',
|
||||
`birthday` = '%s', `gender` = '%s', `keywords` = %d, `hide` = %d, `nsfw` = %d,
|
||||
`location` = '%s', `about` = '%s', `generation` = %d, `updated` = '%s'
|
||||
WHERE `nurl` = '%s' AND `network` = '%s' AND (`generation` = 0 OR `generation` >= %d)",
|
||||
dbesc($contact["photo"]), dbesc($contact["name"]), dbesc($contact["nick"]), dbesc($contact["addr"]),
|
||||
WHERE `nurl` = '%s' AND (`generation` = 0 OR `generation` >= %d)",
|
||||
dbesc($contact["photo"]), dbesc($contact["name"]), dbesc($contact["nick"]),
|
||||
dbesc($contact["addr"]), dbesc($contact["network"]),
|
||||
dbesc($contact["birthday"]), dbesc($contact["gender"]), dbesc($contact["keywords"]),
|
||||
intval($contact["hide"]), intval($contact["nsfw"]),
|
||||
dbesc($contact["location"]), dbesc($contact["about"]), intval($contact["generation"]), dbesc(datetime_convert()),
|
||||
dbesc(normalise_link($contact["url"])), dbesc($contact["network"]), intval($contact["generation"]));
|
||||
dbesc(normalise_link($contact["url"])), intval($contact["generation"]));
|
||||
}
|
||||
|
||||
return $gcontact_id;
|
||||
|
|
23
mod/item.php
23
mod/item.php
|
@ -137,6 +137,7 @@ function item_post(&$a) {
|
|||
AND (normalise_link($parent_contact["url"]) != normalise_link($thrparent[0]["author-link"]))) {
|
||||
$parent_contact = null;
|
||||
|
||||
// @todo: Use gcontact
|
||||
require_once("include/Scrape.php");
|
||||
$probed_contact = probe_url($thrparent[0]["author-link"]);
|
||||
if ($probed_contact["network"] != NETWORK_FEED) {
|
||||
|
@ -1098,6 +1099,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
|
|||
//is it a link or a full dfrn address?
|
||||
if((strpos($name,'@')) || (strpos($name,'http://'))) {
|
||||
$newname = $name;
|
||||
|
||||
//get the profile links
|
||||
$links = @lrdd($name);
|
||||
if(count($links)) {
|
||||
|
@ -1209,8 +1211,29 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
|
|||
$inform .= 'cid:' . $r[0]['id'];
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($profile)) {
|
||||
$r = q("SELECT `url` FROM `gcontact` WHERE `addr` = '%s' LIMIT 1",
|
||||
dbesc($name));
|
||||
if ($r)
|
||||
$profile = $r[0]["url"];
|
||||
}
|
||||
|
||||
//if there is an url for this persons profile
|
||||
if(isset($profile)) {
|
||||
|
||||
$r = q("SELECT `nick`, `name`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($profile)));
|
||||
if ($r) {
|
||||
$newname = $r[0]["name"];
|
||||
|
||||
//set newname to nick
|
||||
if(($r[0]['network'] === NETWORK_OSTATUS) OR ($r[0]['network'] === NETWORK_TWITTER)
|
||||
OR ($r[0]['network'] === NETWORK_STATUSNET) OR ($r[0]['network'] === NETWORK_APPNET)) {
|
||||
$newname = $r[0]['nick'];
|
||||
}
|
||||
}
|
||||
|
||||
$replaced = true;
|
||||
//create profile link
|
||||
$profile = str_replace(',','%2c',$profile);
|
||||
|
|
Loading…
Reference in New Issue