httpBL Viewlog Error

To combat forum spammers attempting to register on a Simple Machines Forum (SMF) site, I installed the httpBL package (also available from the SMF mods page on this site). The mod uses the http:BL API from Project Honey Pot to stop spammers from accesing your forum. Instructions for installing and using it are at Adding httpBL to Block Forum Spammers. I experienced several problems when installing the mod this time, though the installation has proceeded smoothly when I've installed the mod on other forums in the past. The last issue I encountered was when I tried to view any of the httpBL logs. Instead of the logs being displayed, I saw the following error message:

An Error Has Occurred!
Unable to load the 'viewlog' template.

The URL I saw when I clicked on Spammers Log contained the following:

/index.php?action=admin;area=httpBL;sa=viewlog;

A long string of hexadecimal characters appeared at the end of the URL.

If I clicked on Humans Log, I saw that sa=viewlog was replaced with sa=viewlogpass in the URL and, if I clicked on Errors Log, it was replaced with sa=viewlogerror.

When I viewed the contents of the httpbl table with phpMyAdmin, I found that there was data in the table, i.e., entries for spammers who had tried accessing the forum.

In index.php, I saw the following:

// Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
        $actionArray = array(
                'activate' => array('Register.php', 'Activate'),
                'admin' => array('Admin.php', 'AdminMain'),

Since action=admin appeared in the URL, I assumed it was then calling Admin.php, which is in the Sources directory. And since area=httpBL appears in the URL, I assumed that the following code in Admin.php was being executed:

'httpBL' => array(
        'label' => $txt['httpBL_title'],
        'file' => 'httpBL_2_Config.php',
        'function' => 'httpBL_Admin',
        'icon' => 'modifications.gif',
        'permission' => 'admin_forum',
        'subsections' => array(
        'config' => array($txt['httpBL_config']),
        'viewlog' => array($txt['httpBL_viewlog']),
        'viewlogpass' => array($txt['httpBL_viewlogpass']),
        'viewlogerror' => array($txt['httpBL_viewlogerror']),
        'helping' => array($txt['httpBL_helping']),
        ),

That code appeared to lead to the following code being executed in Sources/httpBL_2_Config.php:

function httpBL_Admin()
{
        global $context, $txt, $scripturl;

        isAllowedTo('admin_forum');

        $subActions = array(
                'config' => 'httpBL_Config',
                'viewlog' => 'httpBL_ViewLog',
                'viewlogpass' => 'httpBL_ViewLog',
                'viewlogerror' => 'httpBL_ViewLog',
                'helping' => 'httpBL_Helping',
        );

I assumed that the sa=viewlog referred to a "subAction", so that the function httpBL_ViewLog in httpBL_2_Config.php is called. For the httpBL_ViewLog function, I see the following:

function httpBL_ViewLog()
{
        global $txt, $context, $smcFunc, $scripturl, $sourcedir, $settings;

        // In SMF 1.x we needed the template for all the tabs
        // In 2.0 we only need it for ViewLog and Helping
        loadTemplate('httpBL');

So I presumed that the loadTemplate('httpBL'); was where the error message was triggered.

At the SMF website, there is a loadTemplate page with information on loadTemplate:

Description

Loads a template file with the name template_name from the current, default, or base theme.

The notes at the end of that page state:

In Sources/Load.php, I saw the code below:

$loaded = false;
        foreach ($settings['template_dirs'] as $template_dir)
        {
                if (file_exists($template_dir . '/' . $template_name . '.template.php'))
                {
                        $loaded = true;
                        template_include($template_dir . '/' . $template_name . '.template.php', true);
                        break;

The theme for the forum was "SMF Default Theme - Curve". I looked in Themes/default for a httpBL.template.php file and found it was an empty file, i.e., zero bytes in length.

$ ls -lgG Themes/default/httpBL.template.php 
-rw-rw-rw-. 1 0 Aug 23 16:20 Themes/default/httpBL.template.php

Looking for that same file for other forums I had installed, I found it was 25,317 bytes in length. And when I extracted all the files from the zip file I used to install the httpBL mod, I found that file was 25,317 bytes in length. I replaced the zero byte file with that one and I was then able to view the Spammers, Humans, and Errors logs. The first two contained entries, but the Errors log did not. When I viewed it, I saw "(There are no entries in the MOD httpBL Errors Log. Either you haven't got any errors yet or you have erased all the entries.)", so all now seemed well with the mod. When I changed the forum's theme to others I had installed, the logs looked fine there as well. The httpBL.template.php is only needed in the Themes/default directory.

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: Thursday August 27, 2015