aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-12-31 14:45:42 -0800
committerMario <mario@mariovavti.com>2018-01-03 12:16:05 +0100
commit301e5383c7d524ca7cbcfd8e65b02f7b3591fc75 (patch)
tree0867c6a5e37c40f1ed222335f7ac43e8839a8be8
parent66d0b4d0d57d98540e36e3a9f6fa5ccd84ea5ff9 (diff)
downloadvolse-hubzilla-301e5383c7d524ca7cbcfd8e65b02f7b3591fc75.tar.gz
volse-hubzilla-301e5383c7d524ca7cbcfd8e65b02f7b3591fc75.tar.bz2
volse-hubzilla-301e5383c7d524ca7cbcfd8e65b02f7b3591fc75.zip
this should finish up hubzilla issue #113
-rw-r--r--Zotlabs/Module/Profile_photo.php7
-rw-r--r--include/channel.php9
-rw-r--r--include/import.php14
-rw-r--r--include/zot.php9
4 files changed, 30 insertions, 9 deletions
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 411518c61..45a606d5f 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -179,7 +179,10 @@ class Profile_photo extends \Zotlabs\Web\Controller {
);
}
- profiles_build_sync(local_channel());
+ // set $send to false in profiles_build_sync() to return the data
+ // so that we only send one sync packet.
+
+ $sync_profiles = profiles_build_sync(local_channel(),false);
// We'll set the updated profile-photo timestamp even if it isn't the default profile,
// so that browsers will do a cache update unconditionally
@@ -201,7 +204,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$sync = attach_export_data($channel,$base_image['resource_id']);
if($sync)
- build_sync_packet($channel['channel_id'],array('file' => array($sync)));
+ build_sync_packet($channel['channel_id'],array('file' => array($sync), 'profile' => $sync_profiles));
// Similarly, tell the nav bar to bypass the cache and update the avatar image.
diff --git a/include/channel.php b/include/channel.php
index 2d40b7db6..b9adc588b 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -1982,12 +1982,17 @@ function get_channel_default_perms($uid) {
}
-function profiles_build_sync($channel_id) {
+function profiles_build_sync($channel_id,$send = true) {
$r = q("select * from profile where uid = %d",
intval($channel_id)
);
if($r) {
- build_sync_packet($channel_id,array('profile' => $r));
+ if($send) {
+ build_sync_packet($channel_id,array('profile' => $r));
+ }
+ else {
+ return $r;
+ }
}
}
diff --git a/include/import.php b/include/import.php
index 496bcd89e..5a655ce4c 100644
--- a/include/import.php
+++ b/include/import.php
@@ -162,13 +162,17 @@ function import_profiles($channel, $profiles) {
convert_oldfields($profile,'work','employment');
/**
- * @TODO we are going to reset all profile photos to the original
- * somebody will have to fix this later and put all the applicable
- * photos into the export.
+ * @TODO put all the applicable photos into the export.
*/
- $profile['photo'] = z_root() . '/photo/profile/l/' . $channel['channel_id'];
- $profile['thumb'] = z_root() . '/photo/profile/m/' . $channel['channel_id'];
+ if((strpos($profile['thumb'],'/photo/profile/l/') !== false) || intval($profile['is_default'])) {
+ $profile['photo'] = z_root() . '/photo/profile/l/' . $channel['channel_id'];
+ $profile['thumb'] = z_root() . '/photo/profile/m/' . $channel['channel_id'];
+ }
+ else {
+ $profile['photo'] = z_root() . '/photo/' . basename($profile['photo']);
+ $profile['thumb'] = z_root() . '/photo/' . basename($profile['thumb']);
+ }
create_table_from_array('profile', $profile);
}
diff --git a/include/zot.php b/include/zot.php
index 6c0d92a42..8e3d03ad8 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -3745,6 +3745,15 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
* @TODO
* We also need to import local photos if a custom photo is selected
*/
+
+ if((strpos($profile['thumb'],'/photo/profile/l/') !== false) || intval($profile['is_default'])) {
+ $profile['photo'] = z_root() . '/photo/profile/l/' . $channel['channel_id'];
+ $profile['thumb'] = z_root() . '/photo/profile/m/' . $channel['channel_id'];
+ }
+ else {
+ $profile['photo'] = z_root() . '/photo/' . basename($profile['photo']);
+ $profile['thumb'] = z_root() . '/photo/' . basename($profile['thumb']);
+ }
}
if(count($clean)) {