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: Allowing users to edit their uploaded files...  (Read 7570 times)

0 Members and 1 Guest are viewing this topic.

lawless314

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Allowing users to edit their uploaded files...
« on: February 22, 2005, 11:53:17 pm »

As it stands, registered users can upload to any public albulm, but once they have uploaded the file, they cannot edit the file information, such as title, description, keywords, etc.

I can't find any actual permissions setting for this - there's either upload approval or admin access, but not upload+edit personal files.  Is there a database flag for it that I could set manually, or is it just admin only?

Thanks,
--Lindsay
« Last Edit: October 28, 2005, 01:47:18 pm by Abbas Ali »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Allowing users to edit their uploaded files...
« Reply #1 on: February 23, 2005, 07:42:45 am »

currently (with cpg1.3.x) it's admin only, there's no way to allow users to edit their files once they uploaded it to a public gallery. However, the feature you're looking for will be in cpg1.4.x (which just went into feature freeze status, so you can expect a release soon).

Joachim
Logged

rusk

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Allowing users to edit their uploaded files...
« Reply #2 on: March 07, 2005, 01:25:05 am »

Add line

Code: [Select]
    $picture_menu = (USER_ID == $CURRENT_PIC_DATA['owner_id']) ? html_picture_menu($pid) : '';
in displayimage.php file after line 153 that allows to edit/delete image only for admins.
Logged

rusk

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Allowing users to edit their uploaded files...
« Reply #3 on: March 07, 2005, 01:33:31 am »

Sorry, this code wil worc correct:

Code: [Select]
    if (USER_ID == $CURRENT_PIC_DATA['owner_id']) {
        $picture_menu = html_picture_menu($pid);
    }

this lines must be AFTER line

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

dbasulto

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Allowing users to edit their uploaded files...
« Reply #4 on: October 21, 2005, 09:25:59 pm »

so this code will enable users to edit their own submitted files?
or just an edit link in case you are admin?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Allowing users to edit their uploaded files...
« Reply #5 on: October 22, 2005, 12:49:12 am »

why don't you try and find it out and then let us know?
Logged

agridoc

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Aeromodelling GR - Aeromodelling in Greece
Re: Allowing users to edit their uploaded files...
« Reply #6 on: October 25, 2005, 10:46:06 pm »

The script works OK for editing (Crop and Rotate - Edit description). The  DELETE THIS FILE command gives the error message "You don't have permission to perform this operation."

I was very happy at first but ... (see next message)

« Last Edit: October 26, 2005, 12:59:08 am by agridoc »
Logged

agridoc

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Aeromodelling GR - Aeromodelling in Greece
Re: Allowing users to edit their uploaded files...
« Reply #7 on: October 26, 2005, 12:56:22 am »

The script opens editing (Crop and Rotate - Edit description). The  DELETE THIS FILE command gives the error message "You don't have permission to perform this operation."

The problem is that when you open editing only the personal album is available, so if you save it, it will be moved to a personal album and it can' t be moved back to a public one (version 1.33).
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Allowing users to edit their uploaded files...
« Reply #8 on: October 27, 2005, 12:32:00 pm »

that code from rusk is just to add a lil bit functionality. To let users have full control over their images outside their own user album would mean editing far more code.

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Allowing users to edit their uploaded files...
« Reply #9 on: October 27, 2005, 01:46:23 pm »

The problem is that when you open editing only the personal album is available, so if you save it, it will be moved to a personal album and it can' t be moved back to a public one (version 1.33).

To solve this problem edit editOnePic.php (function get_user_albums)

Replace

Code: [Select]
        global $CONFIG, $USER_ALBUMS_ARRAY, $user_albums_list;

        if (!isset($USER_ALBUMS_ARRAY[$user_id])) {
                $user_albums = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='".(FIRST_USER_CAT + $user_id)."' ORDER BY title");

with

Code: [Select]
        global $CONFIG, $USER_ALBUMS_ARRAY, $user_albums_list, $CURRENT_PIC;

        if (!isset($USER_ALBUMS_ARRAY[$user_id])) {
                if (!GALLERY_ADMIN_MODE) {
                  $user_albums = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='".(FIRST_USER_CAT + $user_id)."'OR aid = '".$CURRENT_PIC['aid']."'  ORDER BY title");               
                } else {
                  $user_albums = db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='".(FIRST_USER_CAT + $user_id)."' ORDER BY title");
                }

This should solve the problem.
Logged
Chief Geek at Ranium Systems

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Allowing users to edit their uploaded files...
« Reply #10 on: October 27, 2005, 01:57:49 pm »

The script opens editing (Crop and Rotate - Edit description). The DELETE THIS FILE command gives the error message "You don't have permission to perform this operation."

And to solve this edit delete.php (function delete_picture)

Replace

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

with

Code: [Select]
        $query = "SELECT {$CONFIG['TABLE_PICTURES']}.aid as aid, category, filepath, filename, owner_id 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 && $pic['owner_id'] != USER_ID) cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
Logged
Chief Geek at Ranium Systems

agridoc

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Aeromodelling GR - Aeromodelling in Greece
Re: Allowing users to edit their uploaded files...
« Reply #11 on: October 28, 2005, 01:34:28 pm »

OK it works know. Thank you very much Abbas Ali and Rusk for the first script. All three modifications are needed.

I have tested it and I will announce it in my forum for further testing.

This modification is quite useful as many times members uploaded photos without descriptions in a public album for an event. I think one more modification is needed but this is another topic so I posted it in Allowing users to move files from own to public album.
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 20 queries.