Title: Forum Based Forum Icons v2.0

Author: John Briggs

Description:
This modification will give you the option in forum options to set to show a 32x32 icon (Ideal Size) next to each forum.
Unlike v1.0 where the forum icon is displayed with the forum description, this modification puts the icon in a table cell to the left of the forum description.

Copyright:  2009 John Briggs. All rights reserved.

Compatability: XMB 1.9.11

Install Note: Before adding this modification to your forum you should back up all files related to this modification.

License Note: This modification is released under the GPL License. A copy is provided with this software package.

=======================================================================================================================================
=======
Step 1:
=======

=====================================================================================
Go To Admin Panel -> Insert Raw SQL -> Copy & Paste Code Below & Click Submit CHanges
=====================================================================================

ALTER TABLE `$table_forums` ADD `ficon_status` set('on','off') NOT NULL default 'on';
ALTER TABLE `$table_forums` ADD `ficon` varchar(100) NOT NULL;

=======================================================================================================================================
=======
Step 2:
=======

=========================
Edit File: include/functions.inc.php
=========================

==========
Find Code:
==========

// As of version 1.9.11, function forum() is not responsible for any permissions checking.
// Caller should use permittedForums() or getStructuredForums() instead of querying for the parameters.
function forum($forum, $template, $index_subforums) {
    global $timecode, $dateformat, $lang, $timeoffset, $oldtopics, $lastvisit;
    global $altbg1, $altbg2, $imgdir, $THEME, $SETTINGS;

===============
Add Code Below:
===============

    // Forum Based Forum Icons Mod Begin
    if ($forum['ficon_status'] == 'on' And $forum['ficon'] != '' And file_exists('./images/ficons/'.$forum['ficon'])) {
        $forum['ficon'] = '<a href="forumdisplay.php?fid='.intval($forum['fid']).'"><img src="./images/ficons/'.$forum['ficon'].'" border="0" alt="'.$lang['ficonalt'].'" /></a>';
    } else {
        $forum['ficon'] = '';
    }
    // Forum Based Forum Icons Mod End

=======================================================================================================================================
=======
Step 3:
=======

=============
Edit File: cp.php
=============

==========
Find Code:
==========

        if ($forum['attachstatus'] == "on") {
            $checked6 = $cheHTML;
        } else {
            $checked6 = '';
        }

===============
Add Code Below:
===============

        // Forum Based Forum Icons Mod Begin
        $ficon_statuson = $ficon_statusoff = '';
        switch($forum['ficon_status']) {
            case 'on':
                $ficon_statuson = $selHTML;
                break;
            default:
                $ficon_statusoff = $selHTML;
                break;
        }
        // Forum Based Forum Icons Mod End

==========
Find Code:
==========

        $forum['name'] = stripslashes($forum['name']);

===============
Add Code Below:
===============

        // Forum Based Forum Icons Mod Begin
        $forum['ficon'] = stripslashes($forum['ficon']);
        // Forum Based Forum Icons Mod End

==========
Find Code:
==========

        <tr class="tablerow">
        <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['textdesc']?></td>
        <td bgcolor="<?php echo $altbg2?>"><textarea rows="4" cols="30" name="descnew">
<?php // Linefeed required here - Do not edit!
        echo $forum['description'];
        ?></textarea></td>
        </tr>

===============
Add Code Below:
===============

        <!-- Forum Based Forum Icons Mod Begin -->
        <?php
        printsetting1($lang['ficonstatus'], 'ficon_statusnew', $ficon_statuson, $ficon_statusoff);
        printsetting2($lang['ficoninfo'], 'ficonnew', $forum['ficon'], 20);
        ?>
        <!-- Forum Based Forum Icons Mod End -->

==========
Find Code:
==========

        if ($newfname != $lang['textnewforum'] And $newfname != '') {
            $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, password, mt_status, mt_open, mt_close) VALUES ('forum', '$newfname', '$newfstatus', '', '', $newforder, '', 'no', 'yes', 'yes', '', 0, 0, 0, $newffup, '31,31,31,63', 'yes', 'on', '', 'off', '', '')");
        }

==============================
Find Code IN-LINE in Above Statement:
==============================

) VALUES ('forum',

================
Replace Code With:
================

, ficon_status, ficon) VALUES ('forum',

=============================
Find Code At End Of Above Statement:
=============================

)");

================
Replace Code With:
================

, 'off', '')");

==========
Find Code:
==========

        if ($newgname != $lang['textnewgroup'] And $newgname != '') {
            $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, password) VALUES ('group', '$newgname', '$newgstatus', '', '', $newgorder, '', '', '', '', '', 0, 0, 0, 0, '', '', '', '')");
        }

==============================
Find Code IN-LINE in Above Statement:
==============================

) VALUES ('group',

================
Replace Code With:
================

, ficon_status, ficon) VALUES ('group',

=============================
Find Code At End Of Above Statement:
=============================

)");

==================
Replace Code With:
==================

, 'off', '')");

==========
Find Code:
==========

        if ($newsubname != $lang['textnewsubf'] And $newsubname != '') {
            $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, password) VALUES ('sub', '$newsubname', '$newsubstatus', '', '', $newsuborder, '', 'no', 'yes', 'yes', '', 0, 0, 0, $newsubfup, '31,31,31,63', 'yes', 'on', '')");
        }

==============================
Find Code IN-LINE in Above Statement:
==============================

) VALUES ('sub',

================
Replace Code With:
================

, ficon_status, ficon) VALUES ('sub',

=============================
Find Code At End Of Above Statement:
=============================

)");

==================
Replace Code With:
==================

, 'off', '')");

==========
Find Code:
==========

        $delete = formInt('delete');

===============
Add Code Below:
===============

        // Forum Based Forum Icons Mod Begin
        $ficon_statusnew = formOnOff('ficon_statusnew');
        $ficonnew = postedVar('ficonnew');
        // Forum Based Forum Icons Mod End

==========
Find Code:
==========

        $db->query("UPDATE ".X_PREFIX."forums SET

===============
Add Code Below:
===============

            ficon_status='$ficon_statusnew',
            ficon='$ficonnew',

=======================================================================================================================================
=======
Step 4:
=======

==============================================
Go To Admin Panel -> Translations & Download Language File:
==============================================

===============
Edit Language File:
===============

==========================
Add Code At Very Bottom Of File:
==========================

// Forum Based Forum Icons Mod Begin
$lang['ficonstatus'] = "Forum Icon Status:<br /><small>This will enable/disable the forum icon status display in this forum.</small>";
$lang['ficoninfo'] = "Forum Icon:<br /><small>(Use example: imagename.gif)</small>";
$lang['ficonalt'] = "Forum Icon";
// Forum Based Forum Icons Mod End

============================================
Go To Admin Panel -> Translations & Upload Language File:
============================================

=======================================================================================================================================
=======
Step 5:
=======

======================================
Go To Admin Panel -> Templates -> index_category
======================================

==========
Find Code:
==========

colspan="5"

================
Replace Code With:
================

colspan="6"

=======================================================================================================================================
=======
Step 6:
=======

========================================
Go To Admin Panel -> Templates -> index_category_hr
========================================

==========
Find Code:
==========

<td width="4%">&nbsp;</td>

===============
Add Code Below:
==============

<td width="4%">&nbsp;</td>

=======================================================================================================================================
=======
Step 7:
=======

====================================
Go To Admin Panel -> Templates -> index_forum
====================================

==========
Find Code:
==========

<td bgcolor="$altbg1" class="ctrtablerow" width="4%">$folder</td>

===============
Add Code Below:
===============

<td bgcolor="$altbg1" class="ctrtablerow" width="4%">$forum[ficon]</td>

=======================================================================================================================================
=======
Step 8:
=======

===========================================
Go To Admin Panel -> Templates -> forumdisplay_subforum
===========================================

==========
Find Code:
==========

<td bgcolor="$altbg1" class="ctrtablerow" align="center">$folder</td>

===============
Add Code Below:
===============

<td bgcolor="$altbg1" class="ctrtablerow" align="center">$forum[ficon]</td>

=======================================================================================================================================
=======
Step 9:
=======

============================================
Go To Admin Panel -> Templates -> forumdisplay_subforums
============================================

==========
Find Code:
==========

<td width="4%">&nbsp;</td>

===============
Add Code Below:
===============

<td width="4%">&nbsp;</td>

=======================================================================================================================================
=======
Step 9:
=======

Now upload the folder named "ficons" to your forum "images" folder.

Note: all forum icons must be uploaded to the folder named "ficons" for them to show.

=======================================================================================================================================
========
Step 10:
========

I have added a few icons with the "ficons" folder but if you desire to use different images then you can visit the site below.

http://www.iconarchive.com/

=======================================================================================================================================
Enjoy!