The table "unique_contacts" now has an "about" and "location" field as well.
This commit is contained in:
parent
044eaa778f
commit
46db8575a0
|
@ -1251,6 +1251,8 @@ function db_definition() {
|
|||
"nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"about" => array("type" => "text", "not null" => "1"),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
|
|
@ -2213,6 +2213,21 @@ function diaspora_profile($importer,$xml,$msg) {
|
|||
intval($importer['uid'])
|
||||
);
|
||||
|
||||
$profileurl = "";
|
||||
$author = q("SELECT * FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
|
||||
dbesc(normalise_link($contact['url'])));
|
||||
|
||||
if (count($author) == 0) {
|
||||
q("INSERT INTO `unique_contacts` (`url`, `name`, `avatar`, `location`, `about`) VALUES ('%s', '%s', '%s', '%s', '%s')",
|
||||
dbesc(normalise_link($contact['url'])), dbesc($name), dbesc($location), dbesc($about), dbesc($images[0]));
|
||||
|
||||
$author = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
|
||||
dbesc(normalise_link($contact['url'])));
|
||||
} else if (normalise_link($contact['url']).$name.$location.$about != normalise_link($author[0]["url"]).$author[0]["name"].$author[0]["location"].$author[0]["about"]) {
|
||||
q("UPDATE unique_contacts SET name = '%s', avatar = '%s', `location` = '%s', `about` = '%s' WHERE url = '%s'",
|
||||
dbesc($name), dbesc($images[0]), dbesc($location), dbesc($about), dbesc(normalise_link($contact['url'])));
|
||||
}
|
||||
|
||||
/* if($r) {
|
||||
if($oldphotos) {
|
||||
foreach($oldphotos as $ph) {
|
||||
|
|
|
@ -98,14 +98,19 @@ function display_fetchauthor($a, $item) {
|
|||
$profiledata["about"] = bbcode($r[0]["about"]);
|
||||
if ($r[0]["nick"] != "")
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
} else {
|
||||
// Fetching profile data from unique contacts
|
||||
$r = q("SELECT `avatar`, `nick` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
|
||||
if (count($r)) {
|
||||
$profiledata["photo"] = proxy_url($r[0]["avatar"]);
|
||||
if ($r[0]["nick"] != "")
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
}
|
||||
|
||||
// Fetching profile data from unique contacts
|
||||
$r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
|
||||
if (count($r)) {
|
||||
if ($profiledata["photo"] == "")
|
||||
$profiledata["photo"] = proxy_url($r[0]["avatar"]);
|
||||
if ($profiledata["address"] == "")
|
||||
$profiledata["address"] = bbcode($r[0]["location"]);
|
||||
if ($profiledata["about"] == "")
|
||||
$profiledata["about"] = bbcode($r[0]["about"]);
|
||||
if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != ""))
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
}
|
||||
|
||||
// Check for a repeated message
|
||||
|
@ -158,6 +163,21 @@ function display_fetchauthor($a, $item) {
|
|||
|
||||
$profiledata["nickname"] = $profiledata["name"];
|
||||
$profiledata["network"] = GetProfileUsername($profiledata["url"], "", false, true);
|
||||
|
||||
$profiledata["address"] = "";
|
||||
$profiledata["about"] = "";
|
||||
|
||||
// Fetching profile data from unique contacts
|
||||
if ($profiledata["url"] != "") {
|
||||
$r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
|
||||
if (count($r)) {
|
||||
$profiledata["photo"] = proxy_url($r[0]["avatar"]);
|
||||
$profiledata["address"] = bbcode($r[0]["location"]);
|
||||
$profiledata["about"] = bbcode($r[0]["about"]);
|
||||
if ($r[0]["nick"] != "")
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user