I looked in the whole code and I think that this small piece can give false results, when working with the custom pre-5.4 http_response_code() function:
PHP Code:
... http_response_code() != $vbo['bop5he_noperm_err'] ...
Then I have 2 suggestions:
First I found a way to look for outdated searchids. Second maybe we should send a 503 code for forum closed and server too busy?
PHP Code:
// hook: search_before_process, only for >vB4.0
// outdated searchids
if(is_object($this) AND $this->results === null)
{
define('ERR_RESPONSE_CODE', 410);
}
PHP Code:
// ERR_RESPONSE_CODE somewhere defined in the whole wide world?
if(defined('ERR_RESPONSE_CODE'))
{
http_response_header(ERR_RESPONSE_CODE);
}
// server to busy
else if($vbulletin->loadcache['loadavg'] > $vbulletin->options['loadlimit'])
{
http_response_header(503);
header('Retry-After: 60'); // 60 seconds is ok, isn't it?
}
// forum closed
else if(
!$vbulletin->options['bbactive']
AND
!in_array(THIS_SCRIPT, array('login', 'css', 'mobile'))
)
{
http_response_header(503);
header('Retry-After: 3600'); // 1 hour, put this in a new option?
}
// and your original code
else if (THIS_SCRIPT == 'search')
{
http_response_code($vbo['bop5he_ser_err']);
}
else
{
http_response_code($vbo['bop5he_gen_err']);
}
untested