ModificationName: Minimum Post Characters v1.0

Description: This modification gives a setting in the admin control panel to set a minimum number of how many characters are needed before a post will be posted.

Inspired By FunForum's Version so he deserves credit for this being completed.

Code Designed By: John Briggs

Compatability: XMB 1.9.8 SP3

Note: Please backup all effected files, templates & databases prior to proceeding with this modification for your own safety.

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
====================================
==============================
Insert Code And Click "Submit Changes"
==============================

ALTER TABLE $table_settings ADD `min_chars_in_msg` text NOT NULL;

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

if ($self['status'] == "Banned") {
    error($lang['bannedmessage']);
}

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

// Minimum Post Characters Mod Begin
$message = '';
if (strlen($message) < $min_chars_in_msg) {
    eval('echo stripslashes("'.template('header').'");');
    echo "<center><span class=\"mediumtxt \">$lang[minamountmessage]</span></center>";
    ?>
    <script>
        function redirect() {
        window.location.replace("viewthread.php?tid=<?=$tid?>");
    }
    setTimeout("redirect();", 1250);
    </script>
    <?php
    end_time();
    eval('echo stripslashes("'.template('footer').'");');
    exit();
}
// Minimum Post Characters Mod End

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

                if ($self['status'] == "Banned") {
                    error($lang['bannedmessage']);
                }

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

                // Minimum Post Characters Mod Begin
                if (strlen($message) < $min_chars_in_msg) {
                    eval('echo stripslashes("'.template('header').'");');
                    echo "<center><span class=\"mediumtxt \">$lang[minamountmessage]</span></center>";
                    ?>
                    <script>
                        function redirect() {
                        window.location.replace("viewthread.php?tid=<?=$tid?>");
                    }
                    setTimeout("redirect();", 2000);
                    </script>
                    <?php
                    end_time();
                    eval('echo stripslashes("'.template('footer').'");');
                    exit();
                }
                // Minimum Post Characters Mod End

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

            if ($subject == '' || $message == '') {
                error($lang['postnothing']);
            }

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

            // Minimum Post Characters Mod Begin
            if (strlen($message) < $min_chars_in_msg) {
                eval('echo stripslashes("'.template('header').'");');
                echo "<center><span class=\"mediumtxt \">$lang[minamountmessage]</span></center>";
                ?>
                <script>
                    function redirect() {
                    window.location.replace("viewthread.php?tid=<?=$tid?>");
                }
                setTimeout("redirect();", 2000);
                </script>
                <?php	
                end_time();
                eval('echo stripslashes("'.template('footer').'");');
                echo $footer;
                exit();
            }
            // Minimum Post Characters Mod End

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

// Minimum Post Characters Mod Begin
$lang['minamountofchars'] = "Minimum amount of characters in a post:";
$lang['minamountmessage'] = "Your post contains less than $min_chars_in_msg characters. Please go back and make a full post.";
// Minimum Post Characters Mod End

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

        $lang['spell_checker'] .= $spell_off_reason;

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

        // Minimum Post Characters Mod Begin
        $SETTINGS['min_chars_in_msg'] = stripslashes($SETTINGS['min_chars_in_msg']);
        // Minimum Post Characters Mod End

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

        printsetting2($lang['textflood'], 'floodctrlnew', ((int)$SETTINGS['floodctrl']), 3);

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

        // Minimum Post Characters Mod Begin
        printsetting2($lang['minamountofchars'], 'min_chars_in_msgnew', $SETTINGS['min_chars_in_msg'], 2);
        // Minimum Post Characters Mod End

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

        $gzipcompressnew = formOnOff('gzipcompressnew');

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

        // Minimum Post Characters Mod Begin
        $min_chars_in_msgnew = formInt('min_chars_in_msgnew');
        // Minimum Post Characters Mod End
        
==========
Find Code:
==========
 

        $db->query("UPDATE ".X_PREFIX."settings SET
		
================
Replace Code With:
================

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

            min_chars_in_msg = '$min_chars_in_msgnew',

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

Now upload all effected files, assuming you have backed them up for safety before installing this modification, and then go to administration panel --> Settings and set the Minimum amount of characters you want to allow in posts.

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