1 pic per user... 1 pic per user...
 

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]

Main Menu

1 pic per user...

Started by ymca, May 29, 2006, 01:33:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ymca

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

thnx

Joachim Müller

One at a time? Check the groups page.

ymca

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)

Stramm

#3
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
    // 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
    // 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)
  '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

ymca

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

It will be visible after admin approval.

Stramm

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

the registers already have a quota of 224kb

Stramm

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

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

Stramm

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

ymca

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.

Stramm

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

ymca

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

Stramm


ymca

now yes, have no upload limit.

Stramm

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

ymca

i did that in the begining

Stramm

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

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

yes i did.
maybe i need to do update.php?