aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php38
1 files changed, 20 insertions, 18 deletions
diff --git a/include/network.php b/include/network.php
index 25ed615c6..98c411cd8 100644
--- a/include/network.php
+++ b/include/network.php
@@ -991,7 +991,7 @@ function discover_by_url($url,$arr = null) {
);
$photos = import_profile_photo($photo,$guid);
- $r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s' limit 1",
+ $r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'",
dbesc(datetime_convert()),
dbesc($photos[0]),
dbesc($photos[1]),
@@ -1092,25 +1092,27 @@ function discover_by_webbie($webbie) {
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($webbie)
);
- if($r)
- return true;
-
- $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_pubkey, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_instance_url, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
- dbesc($addr),
- dbesc($guid),
- dbesc($pubkey),
- dbesc($addr),
- dbesc($profile),
- dbesc($vcard['fn']),
- dbesc($network),
- dbesc(z_root()),
- dbesc(datetime_convert())
- );
+ if(! $r) {
+
+ $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_pubkey, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_instance_url, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
+ dbesc($addr),
+ dbesc($guid),
+ dbesc($pubkey),
+ dbesc($addr),
+ dbesc($profile),
+ dbesc($vcard['fn']),
+ dbesc($network),
+ dbesc(z_root()),
+ dbescdate(datetime_convert())
+ );
+ }
$r = q("select * from hubloc where hubloc_hash = '%s' limit 1",
dbesc($webbie)
);
+
if(! $r) {
+
$r = q("insert into hubloc ( hubloc_guid, hubloc_hash, hubloc_addr, hubloc_network, hubloc_url, hubloc_host, hubloc_callback, hubloc_updated, hubloc_flags ) values ('%s','%s','%s','%s','%s','%s','%s','%s', %d)",
dbesc($guid),
dbesc($addr),
@@ -1119,13 +1121,13 @@ function discover_by_webbie($webbie) {
dbesc(trim($diaspora_base,'/')),
dbesc($hostname),
dbesc($notify),
- dbesc(datetime_convert()),
+ dbescdate(datetime_convert()),
intval(HUBLOC_FLAGS_PRIMARY)
);
}
$photos = import_profile_photo($vcard['photo'],$addr);
- $r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s' limit 1",
- dbesc(datetime_convert('UTC','UTC',$arr['photo_updated'])),
+ $r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'",
+ dbescdate(datetime_convert('UTC','UTC',$arr['photo_updated'])),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),