1

(124 replies, posted in News)

So, now, without donations, if I want to use punbb without the copyright, what can I do?
Thanks.

guardian34 wrote:

miketk, isn't your above rule using a regex?

Yes, you're right, but it's only one. I know that in the actual system breaks when a condition is matched, but, in the worst case scenario, it has to parse 50+ rules.
Maybe it's only me too much paranoic.

@MadHatter: thanks for your link, but I did know how it works, I was looking for a document that explains which could be the faster system.

@guardian34: I thought that a regex evaluation could be more resource expensive than a switch-case clause, so I was asking. Do you or MadHatter have some links on this topic? I've searched online but I found nothing that compares those different ways.
Thanks,

Mike

I feel not so confortable to use such a .htaccess (but maybe I'm wrong), so I suggest a method that implies only one rewrite rule and a new php file.

The rewrite rule is generic, like this one (to be optimized, with the right matching-option for each field):
(thi example is only for topic, post and forum viewing, to be extended)

RewriteRule ^(forum|topic|post)/?([A-Za-z0-9-]*)/?([A-Za-z0-9-]*)/?$ rewriter.php?rewriteselector=$1&id=$2&p=$3 [PT,NC]

I've called the new file rewriter.php. It contains a switch-case clause to include the right php file and do some variabile rewriting if necessary (like traslating the id in a pid if viewing a post).

switch($rewriteselector){
case 'forum':include('vewforum.php');
break;
case 'topic':include('viewtopic.php');
break;
case 'post':$_GET['pid']=$_GET['id'];
include('viewtopic.php');
break;
default: include('index.php');
break;
}

I see no drawbacks in this system, and I think this should be faster than the actual htaccess, but I'm really new to punBB, so maybe I've not seen the problems of this approach.
What do you think about this idea?

Mike