SMF Thailand.

SMF Development => SMF Coding Discussion => ข้อความที่เริ่มโดย: sketball ที่ 26/12/06, 00:58:15

หัวข้อ: mod ป้องกันการปั๊มกระทู้ครับ พวกพิมสั้นๆ dd ff ggrr ss โดนแน่
เริ่มหัวข้อโดย: sketball ที่ 26/12/06, 00:58:15
<id>aitsukai:minwords</id>
<version>1.0.0</version>

<edit file>
$themedir/languages/Errors.english.php
</edit file>

<search for>
$txt['error_long_message'] = 'The message exceeds the maximum allowed length (' . $modSettings['max_messageLength'] . ' characters).';
</search for>

<add after>
$txt['error_minWordLen'] = 'The message does not meet the minimum word requirements (' . $modSettings['minWordLen'] . ' words).';
$txt['error_minChar'] = 'The message does not meet the minimum character requirements (' . $modSettings['minChar'] . ' characters).';
</add after>

<edit file>
$sourcedir/Post.php
</edit file>

<search for>
   // Check the subject and message.
</search for>

<add after>
if (!empty($modSettings['minWordLen']) && ((int)$modSettings['minWordLen'] != 0))
{
    $Temp = trim(preg_replace('~[^a-z0-9 ]~si', '', $_POST['message']));
    $Temp = preg_replace('~(( )+)~si', ' ', $Temp);
    $WordArr = explode(' ', $Temp);
    if (count($WordArr) < (int)$modSettings['minWordLen'])
    $post_errors[] = 'minWordLen';
}

if (!empty($modSettings['minChar']) && ((int)$modSettings['minChar'] != 0))
{
    if (strlen($_POST['message']) < (int)$modSettings['minChar'])
      $post_errors[] = 'minChar';
}
</add after>

<edit file>
$sourcedir/ManagePosts.php
</edit file>

<search for>
      // Update the actual settings.
      updateSettings(array(
</search for>

<add after>
         'minWordLen' => empty($_POST['minWordLen']) ? '0' : (int) $_POST['minWordLen'],
         'minChar' => empty($_POST['minChar']) ? '0' : (int) $_POST['minChar'],
</add after>

<edit file>
$themedir/languages/Admin.english.php
</edit file>

<search for>
$txt['caching_settings'] = 'Caching';
</search for>

<add after>
$txt['minWordLen'] = 'Minimum words per post';
$txt['minWordLen_zero'] = '0 for no minimum.';
$txt['minWordLen_words'] = 'words';
$txt['minChar'] = 'Minimum characters per post';
$txt['minChar_zero'] = '0 for no minimum.';
$txt['minChar_chars'] = 'characters';
</add after>

<edit file>
$themedir/Admin.template.php
</edit file>

<search for>
            <td valign="top">
               <input type="text" name="max_messageLength" id="max_messageLength_input" value="', empty($modSettings['max_messageLength']) ? '0' : $modSettings['max_messageLength'], '" size="5" /> ', $txt['manageposts_characters'], '
            </td>
         </tr>
</search for>

<add after>
         <tr class="windowbg2">
            <th width="50%" align="right">
               <label for="minWordLen_input">', $txt['minWordLen'], ':
               <div class="smalltext" style="font-weight: normal;">', $txt['minWordLen_zero'], '</div>
            </th>
            <td valign="top">
               <input type="text" name="minWordLen" id="minWordLen_input" value="', empty($modSettings['minWordLen']) ? '5' : $modSettings['minWordLen'], '" size="5" /> ', $txt['minWordLen_words'], '
            </td>
         </tr>
         <tr class="windowbg2">
            <th width="50%" align="right">
               <label for="minChar_input">', $txt['minChar'], ':
               <div class="smalltext" style="font-weight: normal;">', $txt['minChar_zero'], '</div>
            </th>
            <td valign="top">
               <input type="text" name="minChar" id="minChar_input" value="', empty($modSettings['minChar']) ? '100' : $modSettings['minChar'], '" size="5" /> ', $txt['minChar_chars'], '
            </td>
         </tr>
</add after>
หัวข้อ: Re: mod ป้องกันการปั๊มกระทู้ครับ พวกพิมสั้นๆ dd ff ggrr ss โดนแน่
เริ่มหัวข้อโดย: blueranchu ที่ 13/01/07, 07:42:11
ไม่เห็นใช้ได้เลยครับ
ผมโพสสั้นๆว่า d ยังโพสได้ปกติอ่ะครับ
มันกันไง
หัวข้อ: Re: mod ป้องกันการปั๊มกระทู้ครับ พวกพิมสั้นๆ dd ff ggrr ss โดนแน่
เริ่มหัวข้อโดย: An_ant ที่ 13/01/07, 09:13:39
ปัญหานี้ใน vB มันจะบังคับไว้เป็นพื้นฐานรู้สึกว่าจะไม่น้อยกว่า 10 ตัว...

ถ้าเกรงว่าจะเกิดปัญหาแบบนั้น  และเพื่อใครอยากลองเล่นดู
หัวข้อ: Re: mod ป้องกันการปั๊มกระทู้ครับ พวกพิมสั้นๆ dd ff ggrr ss โดนแน่
เริ่มหัวข้อโดย: blueranchu ที่ 13/01/07, 11:04:50
ของผมมันเวป smf อ่ะดิ ย้ายดาต้าเบสไม่เป็น
เสียดายดาต้าเบสเดิม

ผมเซ็ตไอ้ minum word แล้วมันไม่เปลี่ยนด้วยอ่ะครับ

มีอะไรผิดพลาดไม่รู้
ผมตรวจสอบหลายทีก็ทำตามคำแนะนำเหมือนหมดแล้วอ่ะ
ผมทางลองทำในเครื่องผมเอง ไม่ได้ลองที่ โฮสจริง

ทดลองโดยใช้ smf rc2 บน iis ครับ
หัวข้อ: Re: mod ป้องกันการปั๊มกระทู้ครับ พวกพิมสั้นๆ dd ff ggrr ss โดนแน่
เริ่มหัวข้อโดย: sketball ที่ 26/01/07, 19:05:32
ผมใช้ที่เว็บ www.devil-bike.com ใช้ได้เลยครับ

ผมใช้วิธีดูบันทัดที่ค้นหา ปละใส่เข้าไปตามที่โค๊ดระบุ ยากและสับสนหน่อยครับ แต่ใช้ได้แน่นอน
หัวข้อ: Re: mod ป้องกันการปั๊มกระทู้ครับ พวกพิมสั้นๆ dd ff ggrr ss โดนแน่
เริ่มหัวข้อโดย: singh ที่ 8/06/07, 21:15:29
ไม่รู้จะ แต่คงไม่ทำง่ะ ตามลบเอาเอง