miniBB ®

miniBB

®
Support Forums
  
 · Start · Sign in · Register · Search · Statistics · File Bank · Manual ·
Master Class miniBB Support Forums / Master Class /  
 

Is this line in the index.php file necessary?

 
Author tom322
Active Member
#1 · Posted: 28 Jan 2026 21:19
In the index.php file, there are these 3 lines of code:

$queryStr=preg_replace("@[^0-9a-zA-Z./#_&=%-]@", '', $queryStr);
$queryStrDisp=str_replace('&', '&', $queryStr);
$queryStr=str_replace('&', '&', $queryStr);// is this one needed?
My question is β€” is the 3rd line necessary? It seems it doesn't do anything once the first two lines of code are executed (the first line seems to already take care of the ampersand, or I'm wrong)..

Author Paul
Lead Lead Developer
#2 · Posted: 2 Feb 2026 18:18
All these lines are necessary.

The first line removes everything except what is defined in square brackets. It doesn't handle the ampersand. It just secures up this query.

The third line converts the HTML entity of the ampersand which could come from a valid HTML source. Later it could be used in the header page redirection, where no entities are allowed.

Author tom322
Active Member
#3 · Posted: 2 Feb 2026 18:53
Thanks for the explanation, it makes sense now.

Author tom322
Active Member
#4 · Posted: 4 Mar 2026 17:22
Something similar β€” in index.php there is this line:

if($cookiesecure) $csecurejs='1'; else $csecurejs='0';
But is it used anywhere? If not, would it be safe to comment it or remove it?

Author Paul
Lead Lead Developer
#5 · Posted: 5 Mar 2026 14:08
tom322:
But is it used anywhere? If not, would it be safe to comment it or remove it?
Indeed you can safely remove it.

I already did it in the updated miniBB version which came out today.

I don't have an idea where this code comes from and what it's necessary for. I've checked all of my existing archives of old versions and old add-ons, and the most earlier trace of it appears even in miniBB 2.0.5b πŸ˜‚ but still, it's not clear why it's here. I suppose, it's just a very outdated development trace, which followed uncaught from version to version for many years, because it's not remarkable and has no meaning 😎

Thanks for finding out!

Author tom322
Active Member
#6 · Posted: 6 Mar 2026 19:16
Something from bb_func_vthread.php

Is $i needed there, ie.

$i=1;
...

$i=-$i;
I think it's not used in the main_posts/cell templates, so maybe it's not needed now..

Author Paul
Lead Lead Developer
#7 · Posted: 6 Mar 2026 19:35
tom322:
$i=1;
This is required indeed in default version. Following the code you could locate this:

if($i>0) $bg='tbCel1'; else $bg='tbCel2';
Depending on its value, this var defines swapping of posts colors.

Author tom322
Active Member
#8 · Posted: 6 Mar 2026 21:33
ok (I only use tbCel1 so I missed it).

Author tom322
Active Member
#9 · Posted: 16 Mar 2026 01:17
In bb_func_vthread.php, there is this line:

if(!($logged_admin==1 or $isMod==1 or $user_id==0)) $availEditMes=($topicStatus==0 and (time()-strtotime($cols[2])<$useredit OR $useredit==0 ) );
else $availEditMes=TRUE;
The question is β€” to me, after some more thinking β€” it appears that this condition is TRUE for $user_id==0. If so, it might have been a big issue, but thankfully there are other checks.

So if rewritten, probably this should be better there:

if($logged_admin==1 or $isMod==1) $availEditMes=true;
elseif ($user_id==0) $availEditMes=false;
else $availEditMes=($topicStatus==0 and ($useredit==0 or time()-strtotime($cols[2])<$useredit));
?

Master Class miniBB Support Forums / Master Class /
 Is this line in the index.php file necessary?
Share Link Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Proceed with the File and Picture Attachments add-on: extend your miniBB-forums, attaching images and files.