aboutsummaryrefslogtreecommitdiffstats
path: root/include/photos.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-02-12 15:56:33 -0800
committerzotlabs <mike@macgirvin.com>2017-02-12 15:56:33 -0800
commitccdfbc721fa0cf6710cce262cbaa219e2803e8c2 (patch)
tree3ff4e912a8496d6e6ae7abb530afc80eeba8b24c /include/photos.php
parentbc3605a5025908ae0835c057cb7caa1bc26d9c37 (diff)
downloadvolse-hubzilla-ccdfbc721fa0cf6710cce262cbaa219e2803e8c2.tar.gz
volse-hubzilla-ccdfbc721fa0cf6710cce262cbaa219e2803e8c2.tar.bz2
volse-hubzilla-ccdfbc721fa0cf6710cce262cbaa219e2803e8c2.zip
Create virtual privacy groups for private profile member lists
Diffstat (limited to 'include/photos.php')
-rw-r--r--include/photos.php53
1 files changed, 51 insertions, 2 deletions
diff --git a/include/photos.php b/include/photos.php
index 55cc2d945..4cd5952f9 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -718,10 +718,59 @@ function gps2Num($coordPart) {
return floatval($parts[0]) / floatval($parts[1]);
}
+
+function photo_profile_setperms($channel_id,$resource_id,$profile_id) {
+
+ if(! $profile_id)
+ return;
+
+ $r = q("select profile_guid, is_default from profile where id = %d and uid = %d limit 1",
+ dbesc($profile_id),
+ intval($channel_id)
+ );
+
+ if(! $r)
+ return;
+
+ $is_default = $r[0]['is_default'];
+ $profile_guid = $r[0]['profile_guid'];
+
+ if($is_default) {
+ $r = q("update photo set allow_cid = '', allow_gid = '', deny_cid = '', deny_gid = ''
+ where resource_id = '%s' and uid = %d",
+ dbesc($resource_id),
+ intval($channel_id)
+ );
+ $r = q("update attach set allow_cid = '', allow_gid = '', deny_cid = '', deny_gid = ''
+ where hash = '%s' and uid = %d",
+ dbesc($resource_id),
+ intval($channel_id)
+ );
+ }
+ else {
+ $r = q("update photo set allow_cid = '', allow_gid = '%s', deny_cid = '', deny_gid = ''
+ where resource_id = '%s' and uid = %d",
+ dbesc('vp.' . $profile_guid),
+ dbesc($resource_id),
+ intval($channel_id)
+ );
+
+ $r = q("update attach set allow_cid = '', allow_gid = '%s', deny_cid = '', deny_gid = ''
+ where hash = '%s' and uid = %d",
+ dbesc('vp.' . $profile_guid),
+ dbesc($resource_id),
+ intval($channel_id)
+ );
+ }
+}
+
function profile_photo_set_profile_perms($uid, $profileid = 0) {
- $allowcid = '';
- if($profileid) {
+ $allowcid = '';
+
+
+ if($profileid) {
+
$r = q("SELECT photo, profile_guid, id, is_default, uid
FROM profile WHERE uid = %d and ( profile.id = %d OR profile.profile_guid = '%s') LIMIT 1",
intval($uid),