1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Fixes #1621 : Emoticons fix for codes using | char.

This commit is contained in:
Cameron 2016-05-06 08:16:45 -07:00
parent a8f658283f
commit 72891ca226
2 changed files with 21 additions and 4 deletions

View File

@ -664,8 +664,15 @@ class emotec
{
foreach ($pack_local as $p => $d)
{
$mes->addInfo(EMOLAN_34.":".$p.EMOLAN_35);
$sql->db_Delete("core","`e107_name` = 'emote_{$p}'");
if($p == '0')
{
$p = '';
}
if($sql->delete("core","`e107_name` = 'emote_{$p}'"))
{
$mes->addInfo(EMOLAN_34.":".$p.EMOLAN_35);
}
}
}

View File

@ -4650,7 +4650,7 @@ class e_emotefilter
$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);
@ -4666,7 +4666,7 @@ class e_emotefilter
foreach($tmp as $code)
{
$img = "<img class='e-emoticon' src='".$fileloc."' alt=\"".$alt."\" />";
$this->regSearch[] = "/(^|[\s>])(".quotemeta($code).")($|[\s<])/";
$this->regSearch[] = "#(^|[\s>])(".$this->buildRegex($code).")($|[\s<])#";
$this->regReplace[] ="$1".$img."$3";
$this->search[] = $code;
$this->replace[] = $img;
@ -4708,9 +4708,19 @@ class e_emotefilter
}
// print_a($this->regSearch);
// print_a($this->regReplace);
}
function buildRegex($code)
{
$code = quotemeta($code);
$code = str_replace('|','\|',$code);
return $code;
}
function filterEmotes($text)
{