=======================================================================================================================================
Modification Title: Forum Based Topic Subject Prefixes

Modification Version: 1.0

Modification Author: John Briggs

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

Modification Copyright:  2007-2000 by John Briggs. All rights reserved.

Modification Compatibility: XMB 1.9.8 SP3

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

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

Modification Author Note:
This modification is developed and released for use with XMB 1.9.8 SP3 which is provided by XMBGarage.com.

=======================================================================================================================================
=======
Step 1:
=======
==============================
Go To Admin 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> Seperate 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_decode($forum['description'])?></textarea></td>
        </tr>

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

        <!-- Forum Based Topic Subject Prefixes Mod Begin -->
        <?php
        printsetting2($lang['topicsubjectprefixes'], 'subjectprefixesnew', htmlspecialchars_decode($forum['subjectprefixes']), 5);
        ?>
        <!-- Forum Based Topic Subject Prefixes Mod End -->

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

        if ($newfname != $lang['textnewforum']) {
            $newfname = addslashes($newfname);
            $db->query("INSERT INTO ".X_PREFIX."forums (type, 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', '', '', ".(int)$newforder.", '1', '', 'no', 'yes', 'yes', '', 0, 0, 0, ".(int)$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 ".X_PREFIX."forums (type, 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', '', '', ".(int)$newgorder.", '', '', '', '', '', '', 0, 0, 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 ".X_PREFIX."forums (type, 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', '', '', ".(int)$newsuborder.", '1', '', 'no', 'yes', 'yes', '', 0, 0, 0, ".(int)$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(formVar('descnew', false));

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

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


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

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

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

        $db->query("UPDATE ".X_PREFIX."forums SET
            subjectprefixes='$subjectprefixesnew',

=======================================================================================================================================
=======
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'] != '') {
    $subjectprefix = formVar('subjectprefix');
    $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 ".X_PREFIX."threads (fid, subject, icon, lastpost, views, replies, author, closed, topped) VALUES ($fid, '$subject', '$posticon', '$thatime|$username', 0, 0, '$username', '', 0)");

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

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

===========================
Find Code (2nd and 3rd Instances):
===========================

            $subject = addslashes($subject);

===============================
Add Code Below (2nd and 3rd Instances):
===============================

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

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

            $db->query("INSERT INTO ".X_PREFIX."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 ".X_PREFIX."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:
==========

                $db->query("INSERT INTO ".X_PREFIX."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 ".X_PREFIX."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 (5 Instances):
===================

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

========================
Add Code Below (5 Instances):
========================

// 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 ".X_PREFIX."threads SET icon='$posticon', subject='$subject' WHERE tid='$tid'");

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

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

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

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

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

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

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

==========================
Go To Admin 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 Admin 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 Admin 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 Admin 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 Admin Panel --> Templates
==========================
======================
Edit Template: post_preview
======================
==========
Find Code:
==========

$dissubject

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

$subjectprefix $dissubject

=======================================================================================================================================
========
Step 10:
========
==========================
Go To Admin 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!