I searched everywhere for this.. I searched everywhere for this..
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

I searched everywhere for this..

Started by XBleed, May 19, 2004, 05:42:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

XBleed

I launched my site for beta testing yesterday and I'm already getting people saying, "How do I edit the images?" ha

The way I have it set up is just showing the newest added images on the main page.  I have 30 albums in one category that would need to be displayed on the same page so I did it differently than how Coppermine originally lists them.

I guess my question is, Is there anyway for me to add "Edit this image |  Delete this image"  to the Intermediate photo display if the user is the one who added the image?

I appologize if this is already a mod, I searched for it.
Thanks

Carrie

Yeah that would be a great mod to have *nods* Someone??

XBleed

Although I've been working with it all day and made LITTLE progress... I still can't figure it out. :(

hyperion

"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

XBleed

Yes I did see that, but (correct me if I'm wrong) isn't that just to DELETE the photo, and not Edit it?

I would need to be able to add a "Edit this image" link there as well.

hyperion

#5
Yes, but I linked as a reference for you -- not a step by step guide.  ;)  

As you see, the menu code is generated after two comparisons are made.  First, CPG checks to see if this is the user's private album.  Then it checks to see if the gallery is in admin mode. If one of these conditions is true, it creates the delete buttons (and the edit and crop/rotate buttons in 1.3) for the page.  The user can then click on these links.  Now each of the associated scripts for will check to see if the person calling them has authorization to perform the requested action.  

In displayimage.php:


   $picture_menu = ((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';


You would need to add an additional comparison here to see if the pic owner is the same as the current user.

In delete.php:


   } else {
       $query = "SELECT {$CONFIG['TABLE_PICTURES']}.aid as aid, category, filepath, filename FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND pid='$pid'";
       $result = db_query($query);
       if (!mysql_num_rows($result)) cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
       $pic = mysql_fetch_array($result);
       if ($pic['category'] != FIRST_USER_CAT + USER_ID) cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
   }


and


   case 'picture':
       if (!(GALLERY_ADMIN_MODE || USER_ADMIN_MODE)) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);


The ability to edit the description of a single image and crop/rotate that image are available in 1.3.  You will have to do a query for the pic's owner ID in delete.php, editOnePic.php, and picEditor.php, as all initially test for Gallery or user admin modes. You would compare the result to the current user's ID. You would then add an extra testing condition to the guard lines that would grant access based on the outcome of the comparison.  
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

XBleed

Hmm, I'm sorry but that seldomly makes sense to me.  Not your fault.. PHP is to blame.

BUT.. I can wait for 1.3 to be more stable and upgrade if necesary.. I think?  :-[

hyperion

Yes, just wait until we release the next 1.3 package.

Description editing is available for whole albums in 1.2.1, but this makes the mod far more complex than it needs to be.

I would suggest creating a CPG 1.2.1 installation where you can play with the code to your heart's content while you wait.  When you figure out how to do the queries and code changes for the delete option, you will have learned how to do them for all the options in 1.3.

You did well on the templating, so I'm sure with a little more time you will finish this out, too.  ;D    
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)