"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"),
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) {
$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)) {
+ }
+
+ // 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 ($r[0]["nick"] != "")
- $profiledata["nickname"] = $r[0]["nick"];
- }
+ 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
$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()) {