change photo permissions when attach permissions are changed through mod/filestorage, and fix lockview for photos.
This commit is contained in:
parent
cc95c3e9c8
commit
f2fefb91d5
@ -1132,7 +1132,7 @@ function attach_mkdirp($channel, $observer_hash, $arr = null) {
|
||||
*/
|
||||
function attach_change_permissions($channel_id, $resource, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $recurse = false) {
|
||||
|
||||
$r = q("select hash, flags, is_dir from attach where hash = '%s' and uid = %d limit 1",
|
||||
$r = q("select hash, flags, is_dir, is_photo from attach where hash = '%s' and uid = %d limit 1",
|
||||
dbesc($resource),
|
||||
intval($channel_id)
|
||||
);
|
||||
@ -1162,6 +1162,16 @@ function attach_change_permissions($channel_id, $resource, $allow_cid, $allow_gi
|
||||
dbesc($resource),
|
||||
intval($channel_id)
|
||||
);
|
||||
if($r[0]['is_photo']) {
|
||||
$x = q("update photo set allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s' where resource_id = '%s' and uid = %d",
|
||||
dbesc($allow_cid),
|
||||
dbesc($allow_gid),
|
||||
dbesc($deny_cid),
|
||||
dbesc($deny_gid),
|
||||
dbesc($resource),
|
||||
intval($channel_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -770,7 +770,7 @@ function photos_content(&$a) {
|
||||
|
||||
// fetch image, item containing image, then comments
|
||||
|
||||
$ph = q("SELECT aid,uid,xchan,resource_id,created,edited,title,`description`,album,filename,`type`,height,width,`size`,scale,photo_usage,is_nsfw,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
|
||||
$ph = q("SELECT id,aid,uid,xchan,resource_id,created,edited,title,`description`,album,filename,`type`,height,width,`size`,scale,photo_usage,is_nsfw,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
|
||||
$sql_extra ORDER BY `scale` ASC ",
|
||||
intval($owner_uid),
|
||||
dbesc($datum)
|
||||
@ -1147,7 +1147,7 @@ function photos_content(&$a) {
|
||||
|
||||
$photo_tpl = get_markup_template('photo_view.tpl');
|
||||
$o .= replace_macros($photo_tpl, array(
|
||||
'$id' => $link_item['id'], //$ph[0]['id'],
|
||||
'$id' => $ph[0]['id'],
|
||||
'$album' => $album_e,
|
||||
'$tools' => $tools,
|
||||
'$lock' => $lockstate[1],
|
||||
|
@ -15,7 +15,7 @@
|
||||
<i class="icon-pencil btn btn-default btn-xs" title="{{$edit.edit}}" onclick="openClose('photo-edit');"></i>
|
||||
{{/if}}
|
||||
{{if $lock}}
|
||||
<i id="lockview" class="icon-lock btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" title="{{$lock}}" onclick="lockview('item',{{$id}});" ></i><ul id="panel-{{$id}}" class="lockview-panel dropdown-menu"></ul>
|
||||
<i id="lockview" class="icon-lock btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" title="{{$lock}}" onclick="lockview('photo',{{$id}});" ></i><ul id="panel-{{$id}}" class="lockview-panel dropdown-menu"></ul>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="btn-group btn-group">
|
||||
|
Reference in New Issue
Block a user