Title: Topic Attachment Icon v2.0

Author: GuldantheWarlock (GuldantheWarlock@xmbgarage.com)

Based on original version by: JDaniels

Updated for 1.9.8 by: WormHole @ XMB Garage

Description:
This modification will add an icon to the thread title in the forum display to indicate that there is at least one attachment in the thread

Supported Version: XMB 1.9.8 SP3/SP4

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

Please backup your files before installing this modification.
Neither XMBGarage nor the author can be held responsible if your board stops functioning properly due to you installing this modification.

=======================================================================================================================================
=======
Step 1:
=======
=====================
Edit File: forumdisplay.php
=====================
==========
Find Code:
==========

$p_extension = get_extension($lang['pollprefix']);
switch($p_extension) {
    case 'gif':
    case 'jpg':
    case 'jpeg':
    case 'png':
        $lang['pollprefix'] = '<img src="'.$imgdir.'/'.$lang['pollprefix'].'" alt="'.$lang['postpoll'].'" border="0" />';
        break;
}

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

// Topic Attachment Icon Mod Begin
$a_extension = get_extension($lang['attachprefix']);
switch($a_extension) {
    case 'gif':
    case 'jpg':
    case 'jpeg':
    case 'png':
        $lang['attachprefix'] = '<img src="'.$THEME['imgdir'].'/'.$lang['attachprefix'].'" alt="'.$lang['postattach'].'" border="0" />';
        break;
}
// Topic Attachment Icon Mod End

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

    if ($thread['topped'] == 1) {
        $prefix = $lang['toppedprefix'].' '.$prefix;
    }

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

    // Topic Attachment Icon Mod Begin
    if ($thread['attachnum'] != 0) {
        $prefix .= $lang['attachprefix'].' '.$prefix;
    }
    // Topic Attachment Icon Mod End

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

(This code is for 1.9.8 SP3)
$querytop = $db->query("SELECT t.* FROM ".X_PREFIX."threads t WHERE t.fid='$fid' $cusdate ORDER BY topped $ascdesc, lastpost $ascdesc LIMIT $start_limit, $tpp");

(This code is for 1.9.8 SP4)
$querytop = $db->query("SELECT $dotadd1 t.* FROM ".X_PREFIX."threads t $dotadd2 WHERE t.fid='$fid' $srchfrom $srchtype ORDER BY topped $srchorder, $srchsort $srchorder LIMIT $start_limit, $tpp");

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

(This code is for 1.9.8 SP3)
$querytop = $db->query("SELECT t.*, COUNT(a.aid) AS attachnum FROM ".X_PREFIX."threads t $dotadd2 LEFT JOIN ".X_PREFIX."attachments a ON a.tid=t.tid WHERE t.fid='$fid' $srchfrom $srchtype $cusdate ORDER BY topped $srchorder, $srchsort $srchorder LIMIT $start_limit, $tpp");

(This code is for 1.9.8 SP4)
$querytop = $db->query("SELECT $dotadd1 t.*, COUNT(a.aid) AS attachnum FROM ".X_PREFIX."threads t $dotadd2 LEFT JOIN $table_attachments a ON a.tid=t.tid WHERE t.fid='$fid' $srchfrom $srchtype GROUP BY tid ORDER BY topped $srchorder, $srchsort $srchorder LIMIT $start_limit, $tpp");

=======================================================================================================================================
=======
Step 2:
=======
=======================
Edit File: lang/English.lang.php
=======================

============================
Add Code To End Of File Above ?>
============================

// Topic Attachment Icon Mod Begin
$lang['attachprefix'] = "attach.gif";
$lang['postattach'] = "Contains attachment(s)";
// Topic Attachment Icon Mod End

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

Upload attach.gif to your theme directories

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