HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Max number of topics per page

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#94668 (In Topic #18864)
Avatar

Fan in action

Hi,

Is there any config option to prevent displaying more forums' topics on a page than that option's value? For example, at the bottom of a page there is a dropdown with values representing number of topics to be listed. After selecting a value, the param max will be added to the URL e.g. forum_topics?max=50.

What does prevent a user entering 5000 or more affecting performances this way?

The same question is related to a list of members with md_max param and for all other pages that have "par page" option.

Thanks

Freelancing as a way of life
LoneShooter.com
Back to the top
 
Posted
Rating:
#94672
Avatar

Try it as a non-staff member with a large value and you should see it won't work.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#94673
Avatar

Hmm, actually I'm wrong about that (I just checked). It will allow it, but the 64MB memory limit ocPortal imposes would be hit if too much data was loaded and/or the 30 second timeout. So it wouldn't be possible for someone to take the server down, although if someone hammered the URL it would consume resources over time so some kind of anti-DOS solution might be needed if a hacker tried to do this.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#94674
Avatar

A quick code mod to put in a limit of 100, sources_custom/hooks/systems/startup/param_restrict.php:

Code

<?php

class Hook_startup_param_restrict
{
   function run()
   {
      $max=100;

      foreach ($_GET as $key=>$val)
      {
         if ((strpos($key,'max')!==false) && (is_numeric($val)))
         {
            if (intval($val)>$max) $_GET[$key]=strval($max);
         }
      }
   }
}


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#94675
Avatar

Fan in action

It works (and the answers were very fast).

I changed the code in a controller file and didn't think about hooks. Well, we all learn something new every day  :thumbs:

Thank you

Freelancing as a way of life
LoneShooter.com
Back to the top
 
Posted
Rating:
#94676
Avatar

It's a useful little trick. I sometimes also use startup hooks to redefine the defaults for URL parameters.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: