$diaspora_key = '';
$has_lrdd = false;
$email_conversant = false;
+ $connectornetworks = false;
+ $appnet = false;
+
+ if (strpos($url,'twitter.com')) {
+ $connectornetworks = true;
+ $network = NETWORK_TWITTER;
+ }
+
+ if (strpos($url,'www.facebook.com')) {
+ $connectornetworks = true;
+ $network = NETWORK_FACEBOOK;
+ }
+
+ if (strpos($url,'alpha.app.net')) {
+ $appnet = true;
+ $network = NETWORK_APPNET;
+ }
// Twitter is deactivated since twitter closed its old API
//$twitter = ((strpos($url,'twitter.com') !== false) ? true : false);
$at_addr = ((strpos($url,'@') !== false) ? true : false);
- if((! $twitter) && (! $lastfm)) {
+ if((!$appnet) && (!$lastfm) && !$connectornetworks) {
if(strpos($url,'mailto:') !== false && $at_addr) {
$url = str_replace('mailto:','',$url);
// Will leave it to others to figure out how to grab the avatar, which is on the $url page in the open graph meta links
}
- if($twitter || ! $poll)
+ if($appnet || ! $poll)
$check_feed = true;
if((! isset($vcard)) || (! x($vcard,'fn')) || (! $profile))
$check_feed = true;
if(($at_addr) && (! count($links)))
$check_feed = false;
+ if ($connectornetworks)
+ $check_feed = false;
+
if($check_feed) {
$feedret = scrape_feed(($poll) ? $poll : $url);
foreach($entry->tags as $tag)
$keywords = implode(", ", $tag);
- if ($network != "") {
- poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $cid, $uid, $zcid);
-
- // Update the Friendica contacts. Diaspora is doing it via a message. (See include/diaspora.php)
- if (($location != "") OR ($about != "") OR ($keywords != "") OR ($gender != ""))
- q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s'
- WHERE `nurl` = '%s' AND NOT `self` AND `network` = '%s'",
- dbesc($location),
- dbesc($about),
- dbesc($keywords),
- dbesc($gender),
- dbesc(normalise_link($profile_url)),
- dbesc(NETWORK_DFRN));
- }
+ poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $cid, $uid, $zcid);
+
+ // Update the Friendica contacts. Diaspora is doing it via a message. (See include/diaspora.php)
+ if (($location != "") OR ($about != "") OR ($keywords != "") OR ($gender != ""))
+ q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s'
+ WHERE `nurl` = '%s' AND NOT `self` AND `network` = '%s'",
+ dbesc($location),
+ dbesc($about),
+ dbesc($keywords),
+ dbesc($gender),
+ dbesc(normalise_link($profile_url)),
+ dbesc(NETWORK_DFRN));
}
logger("poco_load: loaded $total entries",LOGGER_DEBUG);
if ($profile_url == "")
return $gcid;
+ $x = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
+ dbesc(normalise_link($profile_url))
+ );
+ if(count($x))
+ $network = $x[0]["network"];
+
if (($network == "") OR ($name == "") OR ($profile_photo == "")) {
require_once("include/Scrape.php");
$profile_photo = $data["photo"];
}
- if (!in_array($network, array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_STATUSNET)))
- return $gcid;
+ if (count($x) AND ($x[0]["network"] == "") AND ($network != "")) {
+ q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
+ dbesc($network),
+ dbesc(normalise_link($profile_url))
+ );
+ }
if (($name == "") OR ($profile_photo == ""))
return $gcid;
- logger("profile-check URL: ".$profile_url." name: ".$name." avatar: ".$profile_photo, LOGGER_DEBUG);
+ if (!in_array($network, array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_STATUSNET)))
+ return $gcid;
- $x = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
- dbesc(normalise_link($profile_url))
- );
+ logger("profile-check URL: ".$profile_url." name: ".$name." avatar: ".$profile_photo, LOGGER_DEBUG);
if(count($x)) {
$gcid = $x[0]['id'];
Database changes are ONLY applied in the file include/dbstructure.php.
*/
+
+function update_1177() {
+ require_once("mod/profiles.php");
+
+ $profiles = q("SELECT `uid`, `about`, `locality`, `pub_keywords`, `gender` FROM `profile` WHERE `is-default`");
+
+ foreach ($profiles AS $profile) {
+ if ($profile["about"].$profile["locality"].$profile["pub_keywords"].$profile["gender"] == "")
+ continue;
+
+ $profile["pub_keywords"] = profile_clean_keywords($profile["pub_keywords"]);
+
+ $r = q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
+ dbesc($profile["about"]),
+ dbesc($profile["locality"]),
+ dbesc($profile["pub_keywords"]),
+ dbesc($profile["gender"]),
+ intval($profile["uid"])
+ );
+ }
+}