Advanced search  

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

Pages: [1]   Go Down

Author Topic: Limit Users to int number of uploads?  (Read 9720 times)

0 Members and 1 Guest are viewing this topic.

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Limit Users to int number of uploads?
« on: June 28, 2010, 03:53:45 am »

Hi,
   I've been searching the forums/docs but can't find this issue specificaly addressed (lot's of stuff about quotas!) so i apologize specificlaly to jaochim if its been covered before:

Any easy way to limit the number of user uploads? Basically, I'm trying to pervert coppermine into a photo contest style app (the contest plugin didn't work for me, by the way, in ver 1.4 or ver 1.5) and I would like to limit users to a 1 image upload limit. Any thoughts?

best
MAXX
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Limit Users to int number of uploads?
« Reply #1 on: June 28, 2010, 07:59:12 am »

Instead of apologizing you could have done as suggested per board rules. If you indeed have reviewed a lot of postings you should be aware that all invalid postings like yours get the same, stereotype reply "Board rules / Forum policies: Post Links". Do you really think that this is my idea of having fun: telling people again and again to respect the rules. That's not fun - that's frustrating. Don't be part of the problem, but be part of the solution instead.
Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Limit Users to int number of uploads?
« Reply #2 on: June 28, 2010, 08:59:39 am »

Hi Joachim,
  my install is on my local apache server. it is not even open to a wan.
 Does that mean I am not allowed to ask questions in this forum?
Having rules, I thought,  is supposed to aid people (like me) seeking help in the community in an organized and efficient way.

For example, in this case - I was wondering if any of the devs or users out there could point me to the right place in the libs. Its not particualry relevant for you to have a look at my install as this is not a topic that would benefit from referring it. i don't really like wasting time either :)   
 
  Soooo - any thoughts on the  topic by any chance?
Logged

papukaija

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 333
Re: Limit Users to int number of uploads?
« Reply #3 on: June 28, 2010, 10:42:43 am »

Please read this. Sorry, no link, no support.
Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Limit Users to int number of uploads?
« Reply #4 on: June 28, 2010, 05:12:00 pm »

Hi!
  Thanks for that link. I did read that through - however, as this topic has nothing to do with installation or server setup/maintenance not sure that its relevant ;)
Anyway, I apologize  to the board. i should have respected board to  the letter  from the beginning: http://thesidedoor.ca/gallery/

So - I was wondering if anyone out there might point me to the right area for limiting the number of user uploaded photos?

cheers.
maxx



 

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Limit Users to int number of uploads?
« Reply #5 on: June 28, 2010, 06:19:13 pm »

You're running cpg1.4.12 on that page. Do I have to say more?
Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Limit Users to int number of uploads?
« Reply #6 on: June 28, 2010, 06:35:21 pm »

....thats an old install of coppermine. the site I'm working on is a dev site! It cannot go live until the code is in place...that's pretty standard practice, no?

I'm really not trying to be frustrating! Lesson here is, when you ask for help - be ready to play ball with the moderators :) 
alrighty then: here is a nice new install of coppermine 1.5:

http://toimoietbebe.com/concoursphoto2/
 
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Limit Users to int number of uploads?
« Reply #7 on: June 28, 2010, 06:56:52 pm »

That's an outdated copy of the prorandom theme that you mustn't use. Try the curve theme for a start (http://toimoietbebe.com/concoursphoto2/?theme=curve).

You need to upgrade http://thesidedoor.ca/gallery/ immediately as per http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#upgrade_why_reasons - you're running behind 15 versions. Coming up with all kinds of test galleries doesn't help, nor is the fact that you're considering to upgrade relevant in this aspect; the live-gallery is vulnerable and needs fixing. Maybe it's already corrupted. That should be your main focus.

So - I was wondering if anyone out there might point me to the right area for limiting the number of user uploaded photos?
The brute-force method would be editing upload.php, running a query against the database if the user is not an admin about the number of files he has uploaded so far (simple count query) and adding a cpg_die function call it's higher than a set limit. Not very elegant of course. If you want to apply this in a more elegant way, write a plugin and perform the steps I posted inside your plugin.
Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Limit Users to int number of uploads?
« Reply #8 on: June 28, 2010, 07:41:18 pm »

Thanks for your input.
Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Limit Users to int number of uploads?
« Reply #9 on: July 02, 2010, 04:25:08 pm »

here is the quick and simple mod for limiting the number of nonadmin user photos...

Code: [Select]
// CHECK for previously uploaded file
 if (!GALLERY_ADMIN_MODE) {

        $result = cpg_db_query("SELECT * FROM `cpg15x_pictures` WHERE owner_id ='" .USER_ID."'");

        if (mysql_num_rows($result) != 0) {
    cpg_die(ERROR, "You have already uploaded a photo! Please delete your current photo to upload a new one!", __FILE__, __LINE__);
            exit;
        }
 }

I've put this on line 33 of upload.php
the error message should be a localization variable.
Also, I am merely checking  if any photos have been uploaded. To specify a different cap, you would change  "!= 0" to your custom limit.


-maxx
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Limit Users to int number of uploads?
« Reply #10 on: July 03, 2010, 08:27:04 am »

Performing a SELECT COUNT would be less resources intensive.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Limit Users to int number of uploads?
« Reply #11 on: July 06, 2010, 03:14:45 pm »

Please see here for a plugin that accomplishes the same without modifying any core files.
Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Limit Users to int number of uploads?
« Reply #12 on: September 01, 2010, 05:18:01 am »

Hi Andre, thanks for that link. But I'm getting the same problem in 0.4 as thundered reports (can still upload unlimited files)
I think my comments on that plugin would be off-toptic for this thread. (I assume an ungraceful hack of my install is what is preventing it from working properly)

Thank you to the advice for performing select_count and also not hacking the core, I will try and perform mods in line with the coppermine guidlines before attempting to 'contribute' :)
in the future.

I would consider this topic closed/resolved but i cannot seem to be able to do that myself (moderators?)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Limit Users to int number of uploads?
« Reply #13 on: September 01, 2010, 08:36:56 am »

I would consider this topic closed/resolved but i cannot seem to be able to do that myself (moderators?)
http://forum.coppermine-gallery.net/index.php/topic,55415.msg270631.html#msg270631
Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Limit Users to int number of uploads?
« Reply #14 on: September 01, 2010, 08:49:58 am »

I swear I had just read that exact rule before posting. *sigh*
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 20 queries.