SmileyLimit

Started by snork13, August 22, 2006, 08:53:53 AM

Previous topic - Next topic

snork13

Link to Mod
Rate this Mod

SmileyLimit
by Snork13
[email protected]

SmileyLimit
version: 1.1

Tired of members posting too many smileys?

SmileyLimit was packaged up from the tips and tricks board, see topic id#17213.0 by Owdy & [Unknown].
I added an admin setting to control the number you wish to have.
Access via the admin panel->Smileys and Message Icons.

Files edited:

$sourcedir/Post.php
$sourcedir/ManageSmileys.php
$themedir/ManageSmileys.template.php
$themedir/languages/Post.english.php
$themedir/languages/ModSettings.english.php
$themedir/languages/ManageSmileys.english.php

database changes via:

add_settings.php


Works for 1.1 RC1, 1.1RC2, 1.1RC3 and 1.1 Final. Not tested on others.

Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

Loverboy

It works.. But I get the wrong message when I use it.. Thats because I use the Dutch Language.. So coult anyone translate this Mod into Dutch please?

Nu in het nederlands.. zou iemand deze modificatie kunnen omzetten naar het Nederlandse taal zodat we een juiste berichtgeving krijgen wanneer we de smileylimiet overschrijden.

Laibeus Lord

Hmm, you updated this to 1.1 right?  But your description says otherwise... confusing ^^;;


snork13

Quote from: Laibeus Lord on December 05, 2006, 11:39:15 PM
Hmm, you updated this to 1.1 right?  But your description says otherwise... confusing ^^;;



I updated everthing, but left out this page. Sorry you were confused.
Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

hotrod

Hallo allemaal, Hello There,

Werkt deze versie ook in de final 1.1.1?


Is this working in 1.1.1 to?

Greetz Hotrod  8)
Check: http://www.hotrodpage.nl              and       http://www.coverplaza.nl

Loverboy


RoarinRow

Very cool!  I like it!  Sometime our users go crazy with smileys   :o

SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

Loverboy


hotrod

Oner versie 1.1.1 kan ik deze mod niet installen. geen instal defenities .. ?
Check: http://www.hotrodpage.nl              and       http://www.coverplaza.nl

geezmo

Hope this can be updated. I got this error installing this mod in an 1.1.1 SMF:

The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

teamvtec

Open up the package info.xml and change
<install for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1" >
<uninstall for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1">

To:
<install for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1.1" >
<uninstall for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1.1">

Mod works fine :D

Suby

I can't uninstall it, how can I do that?

RODEOSOLSTICE

Quote from: teamvtec on January 08, 2007, 07:44:35 PM
Open up the package info.xml and change
<install for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1" >
<uninstall for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1">

To:
<install for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1.1" >
<uninstall for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1.1">

Mod works fine :D
Quote from: teamvtec on January 08, 2007, 07:44:35 PM
Open up the package info.xml and change
<install for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1" >
<uninstall for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1">

To:
<install for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1.1" >
<uninstall for="1.1 RC1, 1.1 RC2, 1.1 RC3, 1.1.1">

Mod works fine :D

THANK YOU FOR THIS POST - and great mod!!!

a2h_

Hmm...

I have a good idea of how to put this to use.

Is it possible to have it PM user id 1 (ie the owner) if such an error is thrown, something like this:
QuoteUser 432 has posted too many smileys in one post!

Spoiler:
So I can apply the "noob award" to someone who does so!
With an underscore. Because the one without an underscore's taken.

shumilica

Did someone tried to install this in a smf 1.1.1 board that has the minimum characters mod intalled and activated?

It gives test failed in the post.php file. I don't know exactly where it gives the error but here is the code that introduces this mod and the minimum character mod. I don't know php code, so if anyone can help clearing out where is the conflict between the two mods please post:


// Now make sure this email address is not banned from posting.
isBannedEmail($_POST['email'], 'cannot_post', sprintf($txt['you_are_post_banned'], $txt[28]));
}
}
// Check the subject and message.
    if (!isset($_POST['subject']) || $func['htmltrim']($_POST['subject']) === '')
$post_errors[] = 'no_subject';
if (!isset($_POST['message']) || $func['htmltrim']($_POST['message']) === '')
$post_errors[] = 'no_message';]]></search>
<add><![CDATA[
if (isset($_POST['message']))
{
$smileyLimit = $modSettings['smileyNumber'];

$prev = substr_count($_POST['message'], '[img') + substr_count($_POST['message'], '[IMG');
$tempmsg = doUBBC($_POST['message'], true);
if (substr_count($tempmsg, '<img') > ($prev + $smileyLimit))
$post_errors[] = 'smiley_limit';
}
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';
}
if (!isset($_POST['subject']) || $func['htmltrim']($_POST['subject']) === '')
$post_errors[] = 'no_subject';
if (!isset($_POST['message']) || $func['htmltrim']($_POST['message']) === '')
$post_errors[] = 'no_message';
elseif (!empty($modSettings['max_messageLength']) && $func['strlen']($_POST['message']) > $modSettings['max_messageLength'])
$post_errors[] = 'long_message';
else
{
// Prepare the message a bit for some additional testing.
$_POST['message'] = $func['htmlspecialchars']($_POST['message'], ENT_QUOTES);
Today, if you're not confused it means you're not thinking clear!

shumilica

Noboy knows what needs to be changed in the code above so that the mods won't conflict with eachother? I am sure that it is a small thing to be changed.

Thank you
Today, if you're not confused it means you're not thinking clear!

snork13

Quote from: shumilica on February 15, 2007, 06:20:39 PM
Noboy knows what needs to be changed in the code above so that the mods won't conflict with eachother? I am sure that it is a small thing to be changed.

Thank you

If you unzip the package and look at the modification xml file, you will see the code changes. From there you can see what the conflict is.

-Snork13
Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

shumilica

Thank you for the reply,
I did put in the message before the above ( http://www.simplemachines.org/community/index.php?topic=107685.msg955429#msg955429 ) the code of both mods... currently I have the minimum characters mod installed... and i added the code from the smileylimit in the code box in the above message...
Unfortunatelly i don't know to much php so i can't tell what is wrong in the code I posted (it is an error for sure because the test gives a parse error).. if you or anyone else can help I be glad to read any of the posted solution.
Thanks
Today, if you're not confused it means you're not thinking clear!

snork13

Quote from: shumilica on February 11, 2007, 08:57:04 PM
Did someone tried to install this in a smf 1.1.1 board that has the minimum characters mod intalled and activated?

It gives test failed in the post.php file. I don't know exactly where it gives the error but here is the code that introduces this mod and the minimum character mod. I don't know php code, so if anyone can help clearing out where is the conflict between the two mods please post:


// Now make sure this email address is not banned from posting.
isBannedEmail($_POST['email'], 'cannot_post', sprintf($txt['you_are_post_banned'], $txt[28]));
}
}
// Check the subject and message.
    if (!isset($_POST['subject']) || $func['htmltrim']($_POST['subject']) === '')
$post_errors[] = 'no_subject';
if (!isset($_POST['message']) || $func['htmltrim']($_POST['message']) === '')
$post_errors[] = 'no_message';]]></search>
<add><![CDATA[
if (isset($_POST['message']))
{
$smileyLimit = $modSettings['smileyNumber'];

$prev = substr_count($_POST['message'], '[img') + substr_count($_POST['message'], '[IMG');
$tempmsg = doUBBC($_POST['message'], true);
if (substr_count($tempmsg, '<img') > ($prev + $smileyLimit))
$post_errors[] = 'smiley_limit';
}
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';
}
if (!isset($_POST['subject']) || $func['htmltrim']($_POST['subject']) === '')
$post_errors[] = 'no_subject';
if (!isset($_POST['message']) || $func['htmltrim']($_POST['message']) === '')
$post_errors[] = 'no_message';
elseif (!empty($modSettings['max_messageLength']) && $func['strlen']($_POST['message']) > $modSettings['max_messageLength'])
$post_errors[] = 'long_message';
else
{
// Prepare the message a bit for some additional testing.
$_POST['message'] = $func['htmlspecialchars']($_POST['message'], ENT_QUOTES);



remove this:

]]></search>
<add><![CDATA[


Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

readme.txt

#19
   
How I do so that "Quick Edit" icon also can limit the smilies?

Thanks

images:
Hagamos el mundo al reves.

Advertisement: