============================================================================================================================
Modification Title: Forum Based Topic Subject Prefixes v1.2

Author: John Briggs

Description: This modification will add the ability to specify subject prefixes per forum that can be used for new threads, replying and editing.

Copyright:  2010 John Briggs. All rights reserved.

Compatability: XMB 1.9.5 SP1

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.

Author Note: You downloaded this modification from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.
============================================================================================================================
=======
Step 1:
=======
====================================
Go To Administration Panel --> Insert Raw SQL
====================================

Upload provided file named "SQL.txt" & click "Submit Changes" button.

============================================================================================================================
=======
Step 2:
=======
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of File Above  ?>
============================

// Forum Based Topic Subject Prefixes Mod Begin
$lang['topicsubjectprefixes'] = "Topic Subject Prefixes:<br /><span class=\"smalltxt\"><strong>Note:</strong> Separate each prefix with a comma.<br /><strong>Example:</strong> [prefix #1],[prefix #2],[prefix #3]</span>";
$lang['topicselectprefix'] = "Select Topic Prefix";
// Forum Based Topic Subject Prefixes Mod End

============================================================================================================================
=======
Step 3:
=======
==============
Edit File: cp.php
==============
==========
Find Code:
==========

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

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

        // Forum Based Topic Subject Prefixes Mod Begin
        $forum['subjectprefixes'] = stripslashes($forum['subjectprefixes']);
        // Forum Based Topic Subject Prefixes 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 echo htmlspecialchars($forum['description'])?></textarea></td>
        </tr>

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

        <!-- Forum Based Topic Subject Prefixes Mod Begin -->
        <tr class="tablerow">
        <td bgcolor="<?php echo $altbg1?>" valign="top"><?php echo $lang['topicsubjectprefixes']?></td>
        <td bgcolor="<?php echo $altbg2?>"><textarea rows="4" cols="30" name="subjectprefixesnew"><?php echo htmlspecialchars($forum['subjectprefixes'])?></textarea></td>
        </tr>
        <!-- Forum Based Topic Subject Prefixes Mod End -->

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

            if ($newfname != $lang['textnewforum']) {
                $newfname = addslashes($newfname);
                $db->query("INSERT INTO $table_forums ( type, fid, name, status, lastpost, moderator, displayorder, private, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, pollstatus, password, guestposting ) VALUES ('forum', '', '$newfname', '$newfstatus', '', '', '$newforder', '1', '', 'no', 'yes', 'yes', '', '', '0', '0', '$newffup', '1|1', 'yes', 'on', 'on', '', 'off')");
            }

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

) VALUES ('forum',

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

, subjectprefixes ) VALUES ('forum',

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

)");

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

, '')");

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

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

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

) VALUES ('group',

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

, subjectprefixes ) VALUES ('group',

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

)");

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

, '')");

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

            if ($newsubname != $lang['textnewsubf']) {
                $newsubname = addslashes($newsubname);
                $db->query("INSERT INTO $table_forums ( type, fid, name, status, lastpost, moderator, displayorder, private, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, pollstatus, password, guestposting ) VALUES ('sub', '', '$newsubname', '$newsubstatus', '', '', '$newsuborder', '1', '', 'no', 'yes', 'yes', '', '', '0', '0', '$newsubfup', '1|1', 'yes', 'on', 'on', '', 'off')");
            }

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

) VALUES ('sub',

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

, subjectprefixes ) VALUES ('sub',

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

)");

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

, '')");

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

            $descnew = addslashes($descnew);

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

            // Forum Based Topic Subject Prefixes Mod Begin
            $subjectprefixesnew = addslashes($subjectprefixesnew);
            // Forum Based Topic Subject Prefixes Mod End

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

$db->query("UPDATE $table_forums SET name='$namenew',

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

 WHERE fid='$fdetails'");

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

, subjectprefixes='$subjectprefixesnew' WHERE fid='$fdetails'");

============================================================================================================================
=======
Step 4:
=======
===============
Edit File: post.php
===============
==========
Find Code:
==========

eval('$bbcodescript = "'.template('functions_bbcode').'";');

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

// Forum Based Topic Subject Prefixes Mod Begin
if (isset($forums['subjectprefixes']) && $forums['subjectprefixes'] != '') {
    $prefix = array();
    $prefix[] = '<select name="subjectprefix">';
    $prefix[] = '<option value="">'.$lang['topicselectprefix'].'</option>';
    $prefixes = explode(',', $forums['subjectprefixes']);
    for($i = 0; $i < count($prefixes); $i++) {
        if ($subjectprefix == $prefixes[$i]) {
            $prefix[] = '<option value="'.stripslashes($prefixes[$i]).'" '.$selHTML.'>'.stripslashes($prefixes[$i]).'</option>';
        } else {
            $prefix[] = '<option value="'.stripslashes($prefixes[$i]).'">'.stripslashes($prefixes[$i]).'</option>';
        }
    }
    $prefix[] = '</select>';
    $prefix = implode("\n", $prefix);
} else {
    $prefix = '';
    $subjectprefix = '';
}
// Forum Based Topic Subject Prefixes Mod End

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

$db->query("INSERT INTO $table_threads ( fid, subject, icon, lastpost, views, replies, author, closed, topped, pollopts ) VALUES ('$fid', '$subject', '$posticon', '$thatime|$username', 0, 0, '$username', '', 0, '$pollanswers')");

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

$db->query("INSERT INTO $table_threads ( fid, subject, icon, lastpost, views, replies, author, closed, topped, pollopts ) VALUES ('$fid', '$subjectprefix $subject', '$posticon', '$thatime|$username', '0', '0', '$username', '', '', '$pollanswers')");

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

$db->query("INSERT INTO $table_posts ( fid, tid, author, message, subject, dateline, icon, usesig, useip, bbcodeoff, smileyoff ) VALUES ('$fid', '$tid', '$username', '$message', '$subject', ".$db->time($thatime).", '$posticon', '$usesig', '$onlineip', '$bbcodeoff', '$smileyoff')");

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

$db->query("INSERT INTO $table_posts ( fid, tid, author, message, subject, dateline, icon, usesig, useip, bbcodeoff, smileyoff ) VALUES ('$fid', '$tid', '$username', '$message', '$subjectprefix $subject', ".$db->time(time()).", '$posticon', '$usesig', '$onlineip', '$bbcodeoff', '$smileyoff')");

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

$db->query("INSERT INTO $table_posts ( fid, tid, author, message, subject, dateline, icon, usesig, useip, bbcodeoff, smileyoff ) VALUES ('$fid', '$tid', '$username', '$message', '$subject', ".$db->time(time()).", '$posticon', '$usesig', '$onlineip', '$bbcodeoff', '$smileyoff')");

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

$db->query("INSERT INTO $table_posts ( fid, tid, author, message, subject, dateline, icon, usesig, useip, bbcodeoff, smileyoff ) VALUES ('$fid', '$tid', '$username', '$message', '$subjectprefix $subject', ".$db->time($thatime).", '$posticon', '$usesig', '$onlineip', '$bbcodeoff', '$smileyoff')");

==================
Find Code 6 Times:
==================

        $subject = checkInput($subject, $chkInputTags, $chkInputHTML, '', false);

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

        // Forum Based Topic Subject Prefixes Mod Begin
        $forums['subjectprefixes'] = checkInput($forums['subjectprefixes'], $chkInputTags, $chkInputHTML, '', false);
        // Forum Based Topic Subject Prefixes Mod End

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

$db->query("UPDATE $table_threads SET icon='$posticon', subject='$subject' WHERE tid='$tid'");

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

$db->query("UPDATE $table_threads SET icon='$posticon', subject='$subjectprefix $subject' WHERE tid='$tid'");

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

$db->query("UPDATE $table_posts SET message='$message', usesig='$usesig', bbcodeoff='$bbcodeoff', smileyoff='$smileyoff', icon='$posticon', subject='$subject' WHERE pid='$pid'");

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

$db->query("UPDATE $table_posts SET message='$message', usesig='$usesig', bbcodeoff='$bbcodeoff', smileyoff='$smileyoff', icon='$posticon', subject='$subjectprefix $subject' WHERE pid='$pid'");

=======================
Find Code: (First 2 Instances)
=======================

        $subject = addslashes($subject);

===========================
Add Code Below: (First 2 Instances)
===========================

        // Forum Based Topic Subject Prefixes Mod Begin
        $forums['subjectprefixes'] = addslashes($forums['subjectprefixes']);
        // Forum Based Topic Subject Prefixes Mod End

============================================================================================================================
=======
Step 5:
=======
===============================
Go To Administration Panel --> Templates
===============================
=======================
Edit Template: post_newthread
=======================
==========
Find Code:
==========

<input type="text" name="subject" size="45" value="$subject" />

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

$prefix<input type="text" name="subject" size="45" value="$subject" />

============================================================================================================================
=======
Step 6:
=======
===============================
Go To Administration Panel --> Templates
===============================
====================
Edit Template: post_reply
====================
==========
Find Code:
==========

<input type="text" name="subject" size="45" value="$subject" />

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

$prefix<input type="text" name="subject" size="45" value="$subject" />

============================================================================================================================
=======
Step 7:
=======
===============================
Go To Administration Panel --> Templates
===============================
======================
Edit Template: post_newpoll
======================
==========
Find Code:
==========

<input type="text" name="subject" size="45" value="$subject" />

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

$prefix<input type="text" name="subject" size="45" value="$subject" />

============================================================================================================================
=======
Step 8:
=======
===============================
Go To Administration Panel --> Templates
===============================
===================
Edit Template: post_edit
===================
==========
Find Code:
==========

<input type="text" name="subject" size="45" value="$postinfo[subject]" />

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

$prefix<input type="text" name="subject" size="45" value="$postinfo[subject]" />

============================================================================================================================
=======
Step 9:
=======
===============================
Go To Administration Panel --> Templates
===============================
======================
Edit Template: post_preview
======================
==========
Find Code:
==========

$dissubject

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

$subjectprefix $dissubject

============================================================================================================================
========
Step 10:
========
===============================
Go To Administration Panel --> Templates
===============================
============================
Edit Template: viewthread_quickreply
============================
==========
Find Code:
==========

<input type="hidden" name="subject" value="" />

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

<input type="hidden" name="subject" value="" /><input type="hidden" name="subjectprefix" value="" />

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