aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2019-04-19 19:37:06 +0200
committerMario Vavti <mario@mariovavti.com>2019-04-19 19:37:06 +0200
commitfd87faa7a6949f7f44cd4dc6ca866bc072cf444b (patch)
tree729c5c9f090372e9d7dc8a1845d960ca3fcbee0c
parentcb2d706fa1118cf2bd55009f99186d65dfee5a2d (diff)
parent6b638ac8968886049e97dd3c67ef4f87938a7af6 (diff)
downloadvolse-hubzilla-fd87faa7a6949f7f44cd4dc6ca866bc072cf444b.tar.gz
volse-hubzilla-fd87faa7a6949f7f44cd4dc6ca866bc072cf444b.tar.bz2
volse-hubzilla-fd87faa7a6949f7f44cd4dc6ca866bc072cf444b.zip
Merge branch 'dev' into calendar_merge
-rw-r--r--Zotlabs/Module/Profile_photo.php34
-rwxr-xr-xview/tpl/profile_photo.tpl5
2 files changed, 33 insertions, 6 deletions
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 9f1928e52..a812ca210 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -52,14 +52,39 @@ class Profile_photo extends \Zotlabs\Web\Controller {
return;
}
+ $channel = \App::get_channel();
+
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
+
+ // Remove cover photo
+ if(isset($_POST['remove'])) {
+
+ $r = q("SELECT resource_id FROM photo WHERE photo_usage = %d AND uid = %d LIMIT 1",
+ intval(PHOTO_PROFILE),
+ intval(local_channel())
+ );
+
+ if($r) {
+ q("update photo set photo_usage = %d where photo_usage = %d and uid = %d",
+ intval(PHOTO_NORMAL),
+ intval(PHOTO_PROFILE),
+ intval(local_channel())
+ );
+
+ $sync = attach_export_data($channel,$r[0]['resource_id']);
+ if($sync)
+ build_sync_packet($channel['channel_id'],array('file' => array($sync)));
+ }
+
+ $_SESSION['reload_avatar'] = true;
+
+ goaway(z_root() . '/profiles');
+ }
if((array_key_exists('cropfinal',$_POST)) && (intval($_POST['cropfinal']) == 1)) {
// logger('crop: ' . print_r($_POST,true));
-
-
// phase 2 - we have finished cropping
if(argc() != 2) {
@@ -161,8 +186,6 @@ class Profile_photo extends \Zotlabs\Web\Controller {
return;
}
- $channel = \App::get_channel();
-
// If setting for the default profile, unset the profile photo flag from any other photos I own
if($is_default_profile) {
@@ -390,8 +413,10 @@ class Profile_photo extends \Zotlabs\Web\Controller {
if($sync)
build_sync_packet($channel['channel_id'],array('file' => array($sync)));
+ $_SESSION['reload_avatar'] = true;
\Zotlabs\Daemon\Master::Summon(array('Directory',local_channel()));
+
goaway(z_root() . '/profiles');
}
@@ -471,6 +496,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
'$lbl_profiles' => t('Select a profile:'),
'$title' => (($importing) ? t('Use Photo for Profile') : t('Change Profile Photo')),
'$submit' => (($importing) ? t('Use') : t('Upload')),
+ '$remove' => t('Remove'),
'$profiles' => $profiles,
'$single' => ((count($profiles) == 1) ? true : false),
'$profile0' => $profiles[0],
diff --git a/view/tpl/profile_photo.tpl b/view/tpl/profile_photo.tpl
index b2190dda3..61d8f4254 100755
--- a/view/tpl/profile_photo.tpl
+++ b/view/tpl/profile_photo.tpl
@@ -125,14 +125,15 @@
<div id="profile-photo-submit-wrapper">
<button type="submit" class="btn btn-outline-primary" name="submit" id="profile-photo-submit">{{$submit}}</button>
+ <button type="submit" class="btn btn-outline-danger" name="remove" id="profile-photo-remove">{{$remove}}</button>
</div>
</div>
</form>
<br />
<div id="profile-photo-link-select-wrapper">
- <button id="embed-photo-wrapper" class="btn btn-default btn-primary" title="{{$embedPhotos}}" onclick="initializeEmbedPhotoDialog();return false;">
- <i id="embed-photo" class="fa fa-file-image-o"></i> {{$select}}
+ <button id="embed-photo-wrapper" class="btn btn-default btn-primary" title="{{$embedPhotos}}" onclick="initializeEmbedPhotoDialog();return false;">
+ <i id="embed-photo" class="fa fa-file-image-o"></i> {{$select}}
</button>
</div>
</div>