1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-19 12:51:52 +02:00

Don't allow selection of emote without substitution string

This commit is contained in:
e107steved
2007-05-25 21:47:19 +00:00
parent 734933399e
commit 9295ce93bc

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/emote_filter.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/emote_filter.php,v $
| $Revision: 1.1.1.1 $ | $Revision: 1.2 $
| $Date: 2006-12-02 04:33:44 $ | $Date: 2007-05-25 21:47:13 $
| $Author: mcfly_e107 $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -36,17 +36,20 @@ class e_emotefilter {
foreach($this->emotes as $key => $value) foreach($this->emotes as $key => $value)
{ {
$value = trim($value);
if ($value)
{ // Only 'activate' emote if there's a substitution string set
$key = preg_replace("#!(\w{3,}?)$#si", ".\\1", $key); $key = preg_replace("#!(\w{3,}?)$#si", ".\\1", $key);
// Next two probably to sort out legacy issues - may not be required any more
$key = preg_replace("#_(\w{3})$#", ".\\1", $key); $key = preg_replace("#_(\w{3})$#", ".\\1", $key);
$key = str_replace("!", "_", $key); $key = str_replace("!", "_", $key);
$value = trim($value); $filename = e_IMAGE."emotes/" . $pref['emotepack'] . "/" . $key;
$fileloc = SITEURLBASE.e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" . $key;
$filename = e_IMAGE."emotes/" . $pref['emotepack'] . "/" . $key; if(file_exists($filename))
$fileloc = SITEURLBASE.e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" . $key; {
if(file_exists($filename))
{
if(strstr($value, " ")) if(strstr($value, " "))
{ {
$tmp = explode(" ", $value); $tmp = explode(" ", $value);
@@ -69,7 +72,12 @@ class e_emotefilter {
$this->replace[] = "\n <img src='".$filename."' alt='' style='vertical-align:middle; border:0' /> "; $this->replace[] = "\n <img src='".$filename."' alt='' style='vertical-align:middle; border:0' /> ";
} }
} }
} }
}
else
{
unset($this->emotes[$key]);
}
} }
} }