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] 2   Go Down

Author Topic: 1 pic per user...  (Read 18411 times)

0 Members and 1 Guest are viewing this topic.

ymca

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 79
1 pic per user...
« on: May 29, 2006, 01:33:55 pm »

Hi,
can anyone help me on how to add an option that let me limit the upload pictures to 1 picture per user?

thnx
« Last Edit: August 04, 2006, 10:18:37 am by Stramm »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: 1 pic per user...
« Reply #1 on: May 30, 2006, 04:45:03 am »

One at a time? Check the groups page.
Logged

ymca

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 79
Re: 1 pic per user...
« Reply #2 on: May 30, 2006, 10:51:54 am »

not at a time but 1 picture & not more!

if i give users a limit in Kb they can upload how many pics they want in the limit of the Kb but i want them to just have a"number of pics that i want" (like 1 per user)
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: 1 pic per user...
« Reply #3 on: May 30, 2006, 12:33:27 pm »

I've a quick hack for that. The disk quota settings in the groupmanager won't have a function anymore after applying it. Only admins will be able to upload more than 1 pic

in include/picmgmnt.inc.php find
Code: [Select]
    // Test if disk quota exceeded
    if (!GALLERY_ADMIN_MODE && $USER_DATA['group_quota']) {
        $result = cpg_db_query("SELECT sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE  {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND category = '" . (FIRST_USER_CAT + USER_ID) . "'");
        $record = mysql_fetch_array($result);
        $total_space_used = $record[0];
        mysql_free_result($result);

        if ((($total_space_used + $total_filesize)>>10) > $USER_DATA['group_quota'] ) {
and replace with
Code: [Select]
    // Test if disk quota exceeded
    if (!GALLERY_ADMIN_MODE) {
        $result = cpg_db_query("SELECT total_filesize FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE  {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND category = '" . (FIRST_USER_CAT + USER_ID) . "'");
        $record = mysql_fetch_array($result);
        $total_space_used = count($record);
        mysql_free_result($result);

        if ($total_space_used > 1 ) {

now open your lang file and find (I'm using english.php in that example)
Code: [Select]
  'quota_exceeded' => 'Disk quota exceeded<br /><br />You have a space quota of [quota]K, your files currently use [space]K, adding this file would make you exceed your quota.',
and modify it to your needs... eg. 'You have already uploaded a pic' or similar

Should work but I haven't tested it. Therefore backup your files before modifying them
« Last Edit: May 30, 2006, 01:21:43 pm by Stramm »
Logged

ymca

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 79
Re: 1 pic per user...
« Reply #4 on: May 30, 2006, 01:08:18 pm »

I get this message after i uploaded a picture & want to upload again.
(the first picture was approved)
Quote
Your file was uploaded successfully.

It will be visible after admin approval.
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: 1 pic per user...
« Reply #5 on: May 30, 2006, 01:23:26 pm »

I've modified the part after // Test if disk quota exceeded a lil bit.
Before the modification you needed to set a quota in group manager even if coppermine doesn't use it anymore. Just to trigger...

ymca

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 79
Re: 1 pic per user...
« Reply #6 on: May 30, 2006, 01:36:47 pm »

the registers already have a quota of 224kb
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: 1 pic per user...
« Reply #7 on: May 30, 2006, 01:46:47 pm »

I've applied my above changes to my test gallery... works as expected

after uploading a second image with a non admin registered user (as said, admins are able to upload without limits)
'Error
Disk quota exceeded'

cause I haven't changed the lang file

ymca

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 79
Re: 1 pic per user...
« Reply #8 on: May 30, 2006, 02:35:20 pm »

no change for me... :(
maybe because i approve uploads after they upload them?
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: 1 pic per user...
« Reply #9 on: May 30, 2006, 02:40:53 pm »

are you logged in as user (no admin rights)?
if yes, zip your picmgmnt.inc.php and attach it to your next post

ymca

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 79
Re: 1 pic per user...
« Reply #10 on: May 30, 2006, 02:48:52 pm »

here's my zip.
also after i did change the need approve to no it gave me -
The selected album/file does not exist !
but still the pic did go to the albom.
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: 1 pic per user...
« Reply #11 on: May 30, 2006, 02:59:28 pm »

tried yours... works like a charm for me (I'm using upload approval as well)

ymca

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 79
Re: 1 pic per user...
« Reply #12 on: May 30, 2006, 03:07:24 pm »

 :'( so where the problem can be  ???
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: 1 pic per user...
« Reply #13 on: May 30, 2006, 08:51:44 pm »

you've tried as admin?

ymca

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 79
Re: 1 pic per user...
« Reply #14 on: May 30, 2006, 08:58:00 pm »

now yes, have no upload limit.
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: 1 pic per user...
« Reply #15 on: May 30, 2006, 09:18:26 pm »

so should it be.. as admin you can upload without limit. Logout and use a testuser account without admin privileges

ymca

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 79
Re: 1 pic per user...
« Reply #16 on: May 30, 2006, 09:36:20 pm »

i did that in the begining
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: 1 pic per user...
« Reply #17 on: May 31, 2006, 05:56:57 am »

Last thing you can do is posting a testuser account and the URL to your gallery.
I can't replicate your problems cause all works well for me... so not much I can advice you

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: 1 pic per user...
« Reply #18 on: May 31, 2006, 06:16:00 pm »

tried and I can upload more pics to your gallery. Have you replaced the old picmgmnt.inc.php? --> uploaded into  the include dir?

I've chosen exactly the same settings for my test environment as you and the lil mod works perfectly for me

ymca

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 79
Re: 1 pic per user...
« Reply #19 on: May 31, 2006, 06:31:26 pm »

yes i did.
maybe i need to do update.php?
Logged
Pages: [1] 2   Go Up
 

Page created in 0.019 seconds with 21 queries.