|
|
Re: Maximum smileys [message #13868 is a reply to message #13867] |
Wed, 29 October 2003 21:45 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
I am not really sure it is worth the effort, if you don't want smilies you can turn them off. If 1-2 users abuse the feature you can use permission system to take away that ability from just those users.
Counting smileys is incredibly expensive, it would require traversal of the entire message for every smiley in the following manner:
<?php $smiley_count = 0;
foreach ($smiley as $v) { $p = 0; while (($p = strpos($msg, $v, $p)) !== false) { ++$p; ++$smiley_count; } } ?>
I just can't justify this sort of performance inhibitor.
FUDforum Core Developer
|
|
|
|
|
|
Re: Maximum smileys [message #13875 is a reply to message #13874] |
Wed, 29 October 2003 22:46 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
How do you suppose regular expression works? Magically picking out the data you want from text @ instant speed? IT too does plenty of crawling character by character infact following complex rules. strpos() will almost always be faster.
Either way, both ways would be too slow.
FUDforum Core Developer
|
|
|
|
Re: Maximum smileys [message #13877 is a reply to message #13876] |
Wed, 29 October 2003 23:01 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Wrong, it has to be done before the message is sent and if >allowed smilies are found prevent form submission.
There are other technical issues here:
1) You suggested making the limit based on number of characters, so what's to say, prevent me from putting 100 spaces to be able to put 10 smilies etc...
Seems like a half hearted attempted, since it is so easy to bypass.
The alternative then is to set a hard limit on the number of smilies that a person may use inside a message. Now we go back to my original argument, why not simply TELL people that they should not use more then X smilies and remove ability to use smilies who blantantly violate this rule?
It'll be a much cleaner solution, and if once in a blue moon you need to go over the limit, you can...
FUDforum Core Developer
|
|
|
|