forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 permissions => Topic started by: Silur3D on June 04, 2015, 02:27:17 pm

Title: Edit File - Inforamtion
Post by: Silur3D on June 04, 2015, 02:27:17 pm
Where must i set the permission, for "Registered" user can edit the File -Information
?
Any ideas ?

Sili
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 04, 2015, 04:45:20 pm
http://forum.coppermine-gallery.net/index.php/topic,73056.msg352187.html#msg352187

and this

http://forum.coppermine-gallery.net/index.php/topic,67601.0.html

do not work :-/
Title: Re: Edit File - Inforamtion
Post by: allvip on June 04, 2015, 11:03:05 pm
Users have the Edit File Information button only for the pictures they upload in their private gallery (My gallery).
To have the button even for files they upload in others albums go to Config - User settings - Allow users to retain control over their files in public galleries - ON.
Note but they do not have the Edit File Information button for files they did not upload (pictures uploaded by other users).

If you don't want them to have even the Delete file option then use  Delete Control for V 1.5x plugin http://forum.coppermine-gallery.net/index.php/topic,72695.0.html (http://forum.coppermine-gallery.net/index.php/topic,72695.0.html)

For Album properties.
Visitors can upload files - YES  http://forum.coppermine-gallery.net/index.php/topic,68707.0.html (http://forum.coppermine-gallery.net/index.php/topic,68707.0.html)
When "visitors can upload file" is set to YES, it is possible for them to upload files into albums.Note that only visitors who are members of a group for which the setting "Public albums upload allowed" (groups control panel) is set to YES can actually upload to albums where the option "Visitors can upload files" (album properties) is enabled.
Visitors who are not in the permitted group will not be able to upload files into such an album. Non-registered users are members of the "Anonymous" group.
Visitors can post comments Visitors can rate files http://forum.coppermine-gallery.net/index.php/topic,76650.msg370006.html#msg370006 (http://forum.coppermine-gallery.net/index.php/topic,76650.msg370006.html#msg370006)
Same here.
Title: Re: Edit File - Inforamtion
Post by: allvip on June 04, 2015, 11:11:02 pm
Do you want users to have the Edit File Information button even for pictures uploaded by other users?
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 05, 2015, 08:23:52 am
Yes

"Do you want users to have the Edit File Information button even for pictures uploaded by other users?"

But not only pictures other users, "Registered" user can edit later the File -Information in public galleries.....
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 09, 2015, 08:34:39 am
All "Registered" user can edit all pics  :-\
Title: Re: Edit File - Inforamtion
Post by: Αndré on June 09, 2015, 08:47:01 pm
That's not possible out of the box, but should be possible with some code modification. Such a feature was added during the development of cpg1.5.x, it was called "moderator mode". Unfortunately it hasn't been documented and as it wasn't clear how exactly it should work and it made trouble, it has been removed/disabled. Maybe you can use the left/commented out code and database preparations as base. Alternatively you need to edit editpics.php and/or edit_one_pic.php.

Regarding http://forum.coppermine-gallery.net/index.php/topic,67601.0.html - what exactly doesn't work?
1. Display the edit file/album button
2. Adjust the permission check for the edit form
3. Adjust the permission check while processing the form data
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 10, 2015, 10:34:52 am
Hi, all...

the first step - i have in the index.php a little bit different code ->
therefore i can not replace him


Αndré pn in german ;-) ?
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 10, 2015, 05:00:49 pm
sry had too much } in the index.php ! 8) 8) ::)

but
step:
2. Adjust the permission check for the edit form
3. Adjust the permission check while processing the form data

can i only perform in the editpics.php not in the edit_one_pic.php

what is the code for this ?




Title: Re: Edit File - Inforamtion
Post by: Αndré on June 10, 2015, 08:24:52 pm
That mod is totally different from the mod in the other thread.
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 10, 2015, 08:36:29 pm
this hast but suggested^^
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 11, 2015, 12:09:37 pm
but back to topic

i need the possibility,  all "Registered" user can edit the "File Information" in public galleries.....
 ::) :-\
Title: Re: Edit File - Inforamtion
Post by: Αndré on June 11, 2015, 07:53:55 pm
It would really help if you'd explain exactly what you need. As the access to editpics.php seems already solved by the other thread, all you currently need is the access to edit_one_pic.php, right?
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 11, 2015, 09:48:22 pm
 :'( yes i need  the access to edit_one_pic.php,
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 14, 2015, 10:19:47 pm
i tried it without help, i do not get out there  :-\
Title: Re: Edit File - Inforamtion
Post by: Αndré on June 15, 2015, 10:22:38 am
This works for me:
Code: [Select]
Index: displayimage.php
===================================================================
--- displayimage.php (revision 8793)
+++ displayimage.php (working copy)
@@ -94,6 +94,15 @@
  </div>
 EOT;
 
+    } elseif (USER_ID) {
+        $edit_icon   = cpg_fetch_icon('edit', 1);
+        $picmenu = <<< EOT
+    <div class="buttonlist align_right">
+ <ul>
+ <li><a href="edit_one_pic.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture"><span>{$edit_icon}{$lang_display_image_php['edit_pic']}</span></a></li>
+ </ul>
+ </div>
+EOT;
     } else {
         $picmenu = '';
     }
Index: edit_one_pic.php
===================================================================
--- edit_one_pic.php (revision 8793)
+++ edit_one_pic.php (working copy)
@@ -109,12 +109,7 @@
         }
     }
 
-    if (!USER_ID
-        || !(GALLERY_ADMIN_MODE
-                || ($pic['category'] == FIRST_USER_CAT + USER_ID)
-                || ($CONFIG['users_can_edit_pics'] && $pic['owner_id'] == USER_ID)
-            )
-       ) {
+    if (!USER_ID) {
         cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
     }
 
@@ -334,7 +329,7 @@
 $CURRENT_PIC = mysql_fetch_assoc($result);
 mysql_free_result($result);
 
-if (!(GALLERY_ADMIN_MODE || $CURRENT_PIC['category'] == FIRST_USER_CAT + USER_ID || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC['owner_id'] == USER_ID)) || !USER_ID) {
+if (!USER_ID) {
     cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
 }
 
Index: include/functions.inc.php
===================================================================
--- include/functions.inc.php (revision 8793)
+++ include/functions.inc.php (working copy)
@@ -5931,7 +5931,7 @@
     if (GALLERY_ADMIN_MODE) {
         $result = cpg_db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE 1 $only_empty_albums ORDER BY pos");
     } elseif (USER_ID) {
-        $result = cpg_db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE (category = " . (FIRST_USER_CAT + USER_ID) . " OR owner = " . USER_ID . " $uploads_yes) $only_empty_albums ORDER BY pos");
+        $result = cpg_db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE (category = " . (FIRST_USER_CAT + USER_ID) . " OR owner = " . USER_ID . " $uploads_yes) OR aid = '$selected' $only_empty_albums ORDER BY pos");
     } else {
         $result = cpg_db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE (0 $uploads_yes) $only_empty_albums ORDER BY pos");
     }
Title: Re: Edit File - Inforamtion
Post by: Αndré on June 15, 2015, 10:31:48 am
Open displayimage.php, find
Code: [Select]
    if ((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) {

        $delete_icon = cpg_fetch_icon('delete', 1);
        $edit_icon   = cpg_fetch_icon('edit', 1);
        $rotate_icon = cpg_fetch_icon('rotate_ccw', 1);

        list($timestamp, $form_token) = getFormToken();
        $picmenu = <<< EOT
    <div class="buttonlist align_right">
<ul>
<li><a href="javascript:;" onclick="return MM_openBrWindow('pic_editor.php?id={$CURRENT_PIC_DATA['pid']}','Crop_Picture','scrollbars=yes,toolbar=no,status=yes,resizable=yes')"><span>{$rotate_icon}{$lang_display_image_php['crop_pic']}</span></a></li>
<li><a href="edit_one_pic.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture"><span>{$edit_icon}{$lang_display_image_php['edit_pic']}</span></a></li>
<li><a href="delete.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture&amp;form_token={$form_token}&amp;timestamp={$timestamp}" onclick="return confirm('{$lang_display_image_php['confirm_del']}'); return false; "><span class="last">{$delete_icon}{$lang_display_image_php['del_pic']}</span></a></li>
</ul>
</div>
EOT;

    } else {
        $picmenu = '';
    }
and replace with
Code: [Select]
    if ((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) {

        $delete_icon = cpg_fetch_icon('delete', 1);
        $edit_icon   = cpg_fetch_icon('edit', 1);
        $rotate_icon = cpg_fetch_icon('rotate_ccw', 1);

        list($timestamp, $form_token) = getFormToken();
        $picmenu = <<< EOT
    <div class="buttonlist align_right">
<ul>
<li><a href="javascript:;" onclick="return MM_openBrWindow('pic_editor.php?id={$CURRENT_PIC_DATA['pid']}','Crop_Picture','scrollbars=yes,toolbar=no,status=yes,resizable=yes')"><span>{$rotate_icon}{$lang_display_image_php['crop_pic']}</span></a></li>
<li><a href="edit_one_pic.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture"><span>{$edit_icon}{$lang_display_image_php['edit_pic']}</span></a></li>
<li><a href="delete.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture&amp;form_token={$form_token}&amp;timestamp={$timestamp}" onclick="return confirm('{$lang_display_image_php['confirm_del']}'); return false; "><span class="last">{$delete_icon}{$lang_display_image_php['del_pic']}</span></a></li>
</ul>
</div>
EOT;

    } elseif (USER_ID) {
        $edit_icon   = cpg_fetch_icon('edit', 1);
        $picmenu = <<< EOT
    <div class="buttonlist align_right">
<ul>
<li><a href="edit_one_pic.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture"><span>{$edit_icon}{$lang_display_image_php['edit_pic']}</span></a></li>
</ul>
</div>
EOT;
    } else {
        $picmenu = '';
    }


Open edit_one_pic.php, find
Code: [Select]
    if (!USER_ID
        || !(GALLERY_ADMIN_MODE
                || ($pic['category'] == FIRST_USER_CAT + USER_ID)
                || ($CONFIG['users_can_edit_pics'] && $pic['owner_id'] == USER_ID)
            )
       ) {
        cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
    }
and replace with
Code: [Select]
    if (!USER_ID) {
        cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
    }

find
Code: [Select]
if (!(GALLERY_ADMIN_MODE || $CURRENT_PIC['category'] == FIRST_USER_CAT + USER_ID || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC['owner_id'] == USER_ID)) || !USER_ID) {and replace with
Code: [Select]
if (!USER_ID) {

Open include/functions.inc.php, find
Code: [Select]
$result = cpg_db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE (category = " . (FIRST_USER_CAT + USER_ID) . " OR owner = " . USER_ID . " $uploads_yes) $only_empty_albums ORDER BY pos");and replace with
Code: [Select]
$result = cpg_db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE (category = " . (FIRST_USER_CAT + USER_ID) . " OR owner = " . USER_ID . " $uploads_yes) OR aid = '$selected' $only_empty_albums ORDER BY pos");
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 15, 2015, 05:33:28 pm
perfect ;-) it works , BIG THX  8) 8) ;D
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 18, 2015, 10:30:05 am
The Edit button is now available to all users,
BUT

The album will not be read and that leads to an error message when i save


Title: Re: Edit File - Inforamtion
Post by: Αndré on June 18, 2015, 10:51:19 am
Please check if you applied the mod in include/functions.inc.php correctly.
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 18, 2015, 02:52:34 pm
yes, i think its correct   :-\
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 22, 2015, 06:47:36 am
can you upload the right ;-) ?


Gruß
Sili
Title: Re: Edit File - Inforamtion
Post by: allvip on June 22, 2015, 10:16:00 am
The album will not be read and that leads to an error message when i save

I followed the steps from Reply #16. It works for me. Make sure the users have the rights to upload in all the albums (see attachment Album properties.jpg). If not the albums will not be read. You have to manually set this for all the albums or use this topic Visitors can upload files - YES by default http://forum.coppermine-gallery.net/index.php/topic,68707.0.html (http://forum.coppermine-gallery.net/index.php/topic,68707.0.html)


can you upload the right ;-) ?

I also replaced my functions.inc.php with your functions.inc.php from the zip you attached in Reply #20 functions.inc.zip. It works fine. Like I said you need to make sure the users have the rights to upload in all the albums (see attachment Album properties.jpg). If not the albums will not be read. Will read only the albums that they are allowed to upload in.
Title: Re: Edit File - Inforamtion
Post by: allvip on June 22, 2015, 10:54:11 am
If you also want to have Uploaded by under thumbnails like I have in the attachment then use this users name under the image http://forum.coppermine-gallery.net/index.php/topic,75334.msg374909.html#msg374909 (http://forum.coppermine-gallery.net/index.php/topic,75334.msg374909.html#msg374909)

I notice from your functions.inc.php that you use Coppermine version: 1.5.22.
You should update to the latest version 1.5.36 for security reasons then apply the edits from reply #16.
Title: Re: Edit File - Inforamtion
Post by: Silur3D on June 22, 2015, 01:43:25 pm
im so sorry, i have forget the Album properties :-/ very big thx
and thanks for the tip with the latest version and the "uploaded by" info under the thumbnail

Sili 8)
Title: Re: Edit File - Inforamtion
Post by: Αndré on June 23, 2015, 02:41:11 pm
Make sure the users have the rights to upload in all the albums (see attachment Album properties.jpg). If not the albums will not be read. You have to manually set this for all the albums or use this topic Visitors can upload files - YES by default http://forum.coppermine-gallery.net/index.php/topic,68707.0.html (http://forum.coppermine-gallery.net/index.php/topic,68707.0.html)

Actually, this shouldn't be necessary, as the edit to include/functions.inc.php automatically adds the current album to the album list, even if the user has no permission to upload to that album. Of course I haven't tested that just with the latest version of Coppermine and not with cpg1.5.22.
Title: Re: Re: Edit File - Inforamtion
Post by: allvip on June 23, 2015, 08:09:45 pm
Actually, this shouldn't be necessary, as the edit to include/functions.inc.php automatically adds the current album to the album list, even if the user has no permission to upload to that album. Of course I haven't tested that just with the latest version of Coppermine and not with cpg1.5.22.

True. My mistake. It's not necessary. The drop down menu on edit_one_pic.php shows the current album even if the user has no permission to upload to that album (see attachment 1522 Visitors can upload files - NO for all albums.jpg). I don't know where I was thinking. With Visitors can upload files - YES shows all the albums in the drop down menu not just the current album (see attachment 1522 Visitors can upload files - YES for all albums.jpg).

I installed cpg1.5.22 and it still works. I used his functions.inc.php and it still works.

I don't know why he has a blank in the drop down menu. Maybe he should review all the steps on reply #16.
Title: Re: Edit File - Inforamtion
Post by: allvip on June 24, 2015, 11:07:28 am
For Silur3D

I have installed cpg1.5.22. Can you attach in a zip archive your displayimage.php and edit_one_pic.php so I can test it with my cpg1.5.22 because Andre's code should work even if the user has no permission to upload to that album or in no album at all (with Visitors can upload files - NO Andre's code should still work) ?
Title: Re: Edit File - Inforamtion
Post by: Surfer2010 on December 13, 2015, 02:00:47 pm
Great help!!! Works just fine so far.

I think this should be a standard Option for everybody. Because a big amount of Pictures can be "tagged with keywords" by everybody work is being split to the croud.

Might be the best to have it connected to group-permissions on a gallery/album.