While looking through bbcode.php in admincp/, i noticed that a global query was executed on all of it's pages, however only 2 actions need this query to be executed, so its a useless query on other pages within the BBCode Manager.
In admincp/bbcode.php
Find:
PHP Code:
$bbcodes = $DB_site->query("SELECT bbcodetag, bbcodereplacement, twoparams FROM " . TABLE_PREFIX . "bbcode");
$searcharray = array();
$replacementarray = array();
$doubleRegex = "/(\[)(%s)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/%s\])/siU";
$singleRegex = "/(\[)(%s)(])(.*)(\[\/%s\])/siU";
while ($bbcode = $DB_site->fetch_array($bbcodes))
{
if ($bbcode['twoparams'])
{
$regex = sprintf($doubleRegex, $bbcode['bbcodetag'], $bbcode['bbcodetag']);
}
else
{
$regex = sprintf($singleRegex, $bbcode['bbcodetag'], $bbcode['bbcodetag']);
}
$searcharray[] = $regex;
$replacementarray[] = $bbcode['bbcodereplacement'];
}
Replace It With:
PHP Code:
if($_REQUEST['do'] == "test" || $_REQUEST['do'] == "modify"){
$bbcodes = $DB_site->query("SELECT bbcodetag, bbcodereplacement, twoparams FROM " . TABLE_PREFIX . "bbcode");
$searcharray = array();
$replacementarray = array();
$doubleRegex = "/(\[)(%s)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/%s\])/siU";
$singleRegex = "/(\[)(%s)(])(.*)(\[\/%s\])/siU";
while ($bbcode = $DB_site->fetch_array($bbcodes))
{
if ($bbcode['twoparams'])
{
$regex = sprintf($doubleRegex, $bbcode['bbcodetag'], $bbcode['bbcodetag']);
}
else
{
$regex = sprintf($singleRegex, $bbcode['bbcodetag'], $bbcode['bbcodetag']);
}
$searcharray[] = $regex;
$replacementarray[] = $bbcode['bbcodereplacement'];
}
}
I know it's not much, but every little helps!
- Zero Tolerance