aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/zot.php34
-rw-r--r--mod/authtest.php2
-rw-r--r--mod/profile_photo.php2
3 files changed, 31 insertions, 7 deletions
diff --git a/include/zot.php b/include/zot.php
index 37373e7ad..77d82f110 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -670,19 +670,41 @@ function import_xchan($arr,$ud_flags = 1) {
require_once('include/photo/photo_driver.php');
- $photos = import_profile_photo($arr['photo'],$xchan_hash);
- $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'
+ // see if this is a channel clone that's hosted locally - which we treat different from other xchans/connections
+
+ $local = q("select channel_account_id, channel_id from channel where channel_hash = '%s' limit 1",
+ dbesc($xchan_hash)
+ );
+ if($local) {
+ $ph = z_fetch_url($arr['photo'],true);
+ if($ph['success']) {
+ import_channel_photo($ph['body'], $arr['photo_mimetype'], $local[0]['channel_account_id'],$local[0]['channel_id']);
+ // reset the names in case they got messed up when we had a bug in this function
+ $photos = array(
+ z_root() . '/photo/profile/l/' . $local[0]['channel_id'],
+ z_root() . '/photo/profile/m/' . $local[0]['channel_id'],
+ z_root() . '/photo/profile/s/' . $local[0]['channel_id'],
+ $arr['photo_mimetype']
+ );
+ }
+ }
+ else {
+ $photos = import_profile_photo($arr['photo'],$xchan_hash);
+ }
+ if($photos) {
+ $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($arr['photo_updated']),
+ dbesc(datetime_convert('UTC','UTC',$arr['photo_updated'])),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
dbesc($photos[3]),
dbesc($xchan_hash)
- );
+ );
- $what .= 'photo ';
- $changed = true;
+ $what .= 'photo ';
+ $changed = true;
+ }
}
// what we are missing for true hub independence is for any changes in the primary hub to
diff --git a/mod/authtest.php b/mod/authtest.php
index ec32fe171..2c8d7b4b4 100644
--- a/mod/authtest.php
+++ b/mod/authtest.php
@@ -31,6 +31,8 @@ function authtest_content(&$a) {
$z = z_fetch_url($x['url'] . '&test=1');
if($z['success']) {
$j = json_decode($z['body'],true);
+ if(! $j)
+ $o .= 'json_decode failure from remote site. ' . print_r($z['body'],true);
$o .= 'Remote site responded: ' . print_r($j,true);
}
else {
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index f8eda43cf..7893cc302 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -42,7 +42,7 @@ function profile_photo_post(&$a) {
intval($_REQUEST['profile']),
intval(local_user())
);
- if(count($r) && (! intval($r[0]['is_default'])))
+ if(($r) && (! intval($r[0]['is_default'])))
$is_default_profile = 0;
}