Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: I searched everywhere for this..  (Read 3149 times)

0 Members and 1 Guest are viewing this topic.

XBleed

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 64
I searched everywhere for this..
« on: May 19, 2004, 05:42:07 pm »

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
Logged

Carrie

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 19
  • ~*~ blah ~*~
    • http://www.casketcrew.com
Re: I searched everywhere for this..
« Reply #1 on: May 20, 2004, 04:16:54 am »

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

XBleed

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 64
Re: I searched everywhere for this..
« Reply #2 on: May 20, 2004, 04:38:54 am »

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

hyperion

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 1317
  • - retired -
Re: I searched everywhere for this..
« Reply #3 on: May 20, 2004, 04:52:49 am »

Logged
"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://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

XBleed

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 64
Re: I searched everywhere for this..
« Reply #4 on: May 20, 2004, 05:11:22 am »

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.
Logged

hyperion

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 1317
  • - retired -
Re: I searched everywhere for this..
« Reply #5 on: May 20, 2004, 05:40:07 am »

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:

Code: [Select]
   $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:

Code: [Select]
   } 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

Code: [Select]
   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.  
« Last Edit: May 20, 2004, 05:45:50 am by hyperion »
Logged
"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://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

XBleed

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 64
Re: I searched everywhere for this..
« Reply #6 on: May 20, 2004, 05:49:06 am »

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?  :-[
Logged

hyperion

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 1317
  • - retired -
Re: I searched everywhere for this..
« Reply #7 on: May 20, 2004, 06:12:54 am »

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    
Logged
"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://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)
Pages: [1]   Go Up
 

Page created in 0.035 seconds with 18 queries.