From f24e0f98143528c7b2cd5c504899c5492f5d75fd Mon Sep 17 00:00:00 2001 From: czaks Date: Sun, 8 May 2016 14:01:55 +0200 Subject: [PATCH] =?UTF-8?q?optimize=20out=20openboard=20when=20we=20don`t?= =?UTF-8?q?=20need=20it.=20a=20big=20performance=20improvement=20too=20?= =?UTF-8?q?=F0=9F=8F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also, don't call dnsbl for local ip addresses --- inc/functions.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 0cfdb72f..35be56b9 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -556,14 +556,19 @@ function setupBoard($array) { } function openBoard($uri) { - global $config, $build_pages; + global $config, $build_pages, $board; if ($config['try_smarter']) $build_pages = array(); - $board = getBoardInfo($uri); - if ($board) { - setupBoard($board); + // And what if we don't really need to change a board we have opened? + if (isset ($board) && isset ($board['uri']) && $board['uri'] == $uri) { + return true; + } + + $b = getBoardInfo($uri); + if ($b) { + setupBoard($b); if (function_exists('after_open_board')) { after_open_board(); @@ -1759,6 +1764,9 @@ function checkDNSBL() { if (!isset($_SERVER['REMOTE_ADDR'])) return; // Fix your web server configuration + if (preg_match("/^(::(ffff:)?)?(127\.|192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.|0\.|255\.)/", $_SERVER['REMOTE_ADDR'])) + return; // It's pointless to check for local IP addresses in dnsbls, isn't it? + if (in_array($_SERVER['REMOTE_ADDR'], $config['dnsbl_exceptions'])) return;