Test failed for Excellent Love theme for httpBL install

When I was installing the httBL mod on a Simple Machines Forum (SMF), I saw Test failed for "Execute Modification" for the Excellent Love Theme.

The install routine was looking for </body> in the index.template.php file for the theme.

Code: (Find) </body>

Code: (Add Before)

';

        /*****************
        ** httpBL START **
        *****************/
        global $sourcedir, $modSettings;
        if ($modSettings['httpBL_enable']) {
                require_once($sourcedir . '/httpBL_Subs.php');
                $honeyLink = httpBL_honeylink($modSettings['httpBL_honeyPot_link'], $modSettings['httpBL_honeyPot_word']);
                echo $honeyLink;
        }
        /*****************
        **  httpBL END  **
        *****************/

        echo '

When I examined the index.template.ph with the vi editor, I saw the following:

'^M^M</body></html>';

The vi editor showed the following for the first line:

<?php^M^M// Version: 2.0 RC3; index^M^M^M^M/*   This template is, perhaps, the m

When a ^M appears in a file when edited with the vi editor on a Linux sysem, it usually indicates the file was created or edited on a Microsoft Windows system or Mac OS X system, which represent the end of a line, i.e., a newline, differently than Linux systems represent a newline - see OS X Line Endings. I was using a Linux system.

When I examined the file with the od command, I saw the following for the first 10 bytes of the file:

$ od -N 10 -c index.template.php 
0000000   <   ?   p   h   p  \r  \r   /   /    
0000012

A \n, \r, or \t have the following meanings:

		    <newline>            \n
                    <carriage return>    \r
                    <tab>                \t

And when I used the -a option for od, I saw the following showing that there were two carriage return characters, i.e., two instances of the hexadecimal character 0D after "php".

$ od -N 10 -a index.template.php
0000000   <   ?   p   h   p  cr  cr   /   /  sp

So I used dos2unix to convert the file from the OS X format to a Unix/Linux format - see os2unix for CentOS 7.

$ dos2unix -c mac index.template.php
dos2unix: converting file index.template.php to Unix format ...

The -c mac option to the command can be used to convert files in the Mac OS X format for line endings to the Linux format. In normal mode line breaks are converted from DOS to Unix and vice versa. Mac line breaks are not converted. In Mac mode line breaks are converted from Mac to Unix and vice versa. DOS line breaks are not changed.

To run in Mac mode use the command-line option "-c mac" or "--convmode mac" or you can use the commands "mac2unix" or "unix2mac", instead.

When I then examined the index.template.php, I saw the following for the </body> tag:

</div>' : '', '

</body></html>';

}

After I converted the line endings from OS X format to Linux format, I backed up to the prior page in the browser and attempted the httpBL mod install again. This time the test was successful.

Excellent Love Theme
Execute Modification ./Themes/Excellent-Love-Theme-2/index.template.php Test successful

So I was then able to successfully install the mod for that theme and all the other themes installed on the forum.

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: Saturday August 22, 2015