You are not logged in. Please login or register.
Active topics Unanswered topics
Search options
Creating a class is one solution. But I'll probably rename the function, and therefore edit all the files that uses that function. And from now on, i'll put a prefix on my functions.
I just thought there is a way to solve the problem without editing all the files.
I know this has been asked before but I can't find the topic.
I am integrating punbb to my website. How do I avoid duplicate function names? I have a function named redirect() so if I include common.php which includes functions.php, i get an error which says redirect cannot be redefined.
There is a query that I didn't include in my post.
$result = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$pid) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
posted should be included here.
I'm new to PunBB. I was looking for a forum to add to the site I am currently working on and somehow found PunBB. I haven't started integrating yet. I was looking at viewtopic.php and saw this part of the code:
// Determine on what page the post is located (depending on $pun_user['disp_posts'])
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY posted') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$num_posts = $db->num_rows($result);
for ($i = 0; $i < $num_posts; ++$i)
{
$cur_id = $db->result($result, $i);
if ($cur_id == $pid)
break;
}
++$i; // we started at 0
$_GET['p'] = ceil($i / $pun_user['disp_posts']);
I just think there is no need for the for loop. Add to the WHERE clause of the query: AND posted < $posted where $posted is the posted value of the post. Then $num_posts would be the number of posts before the post $pid. $i above would just be $num_posts + 1.
Thus we eliminate a for loop which can take a while (at least theoretically, although I do not know if it is significant).
Posts found: 4