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

XML validation of emoticon pack.

This commit is contained in:
Cameron 2020-12-11 14:55:16 -08:00
parent b21191b0a1
commit dbaf062534
2 changed files with 14 additions and 24 deletions

View File

@ -28,12 +28,7 @@ require_once("auth.php");
$mes = e107::getMessage();
if(!$sql->db_Count("core", "(*)", "WHERE e107_name = 'emote_default' AND e107_value !='' "))
{ // Set up the default emotes
// $tmp = 'a:28:{s:9:"alien!png";s:6:"!alien";s:10:"amazed!png";s:7:"!amazed";s:9:"angry!png";s:11:"!grr !angry";s:12:"biglaugh!png";s:4:"!lol";s:11:"cheesey!png";s:10:":D :oD :-D";s:12:"confused!png";s:10:":? :o? :-?";s:7:"cry!png";s:19:"&| &-| &o| :(( !cry";s:8:"dead!png";s:21:"x) xo) x-) x( xo( x-(";s:9:"dodge!png";s:6:"!dodge";s:9:"frown!png";s:10:":( :o( :-(";s:7:"gah!png";s:10:":@ :o@ :o@";s:8:"grin!png";s:10:":D :oD :-D";s:9:"heart!png";s:6:"!heart";s:8:"idea!png";s:10:":! :o! :-!";s:7:"ill!png";s:4:"!ill";s:7:"mad!png";s:13:"~:( ~:o( ~:-(";s:12:"mistrust!png";s:9:"!mistrust";s:11:"neutral!png";s:10:":| :o| :-|";s:12:"question!png";s:2:"?!";s:12:"rolleyes!png";s:10:"B) Bo) B-)";s:7:"sad!png";s:4:"!sad";s:10:"shades!png";s:10:"8) 8o) 8-)";s:7:"shy!png";s:4:"!shy";s:9:"smile!png";s:10:":) :o) :-)";s:11:"special!png";s:3:"%-6";s:12:"suprised!png";s:10:":O :oO :-O";s:10:"tongue!png";s:21:":p :op :-p :P :oP :-P";s:8:"wink!png";s:10:";) ;o) ;-)";}';
// $insert = array("e107_name"=>"emote_default", "e107_value"=>$tmp);
// $sql->db_Replace("core", $insert);
}
// Change the active emote pack
@ -41,9 +36,9 @@ if (isset($_POST['active']))
{
if ($pref['smiley_activate'] != $_POST['smiley_activate'])
{
$pref['smiley_activate'] = $_POST['smiley_activate'];
$pref['smiley_activate'] = (int) $_POST['smiley_activate'];
e107::getLog()->add($pref['smiley_activate'] ? 'EMOTE_02' : 'EMOTE_03', $pref['emotepack'], E_LOG_INFORMATIVE, '');
save_prefs();
e107::getConfig()->set('smiley_activate',$pref['smiley_activate'])->save(true,true,true);
$update = true;
}
@ -57,7 +52,7 @@ if (isset($_POST['active']))
//e107::getRender()->tablerender($caption, $mes->render() . $text);
/* get packs */
require_once(e_HANDLER."file_class.php");
$fl = e107::getFile();
$emote = new emotec;
$one_pack = FALSE;
@ -82,15 +77,7 @@ foreach($filtered as $key => $value)
if(strstr($key, "defPack_"))
{
$pref['emotepack'] = str_replace("defPack_", "", $key);
if(save_prefs())
{
$mes->addSuccess(LAN_UPDATED);
}
else
{
$mes->addInfo(LAN_NO_CHANGE);
}
e107::getConfig()->set('emotepack', str_replace("defPack_", "", $key))->save(true,true,true);
e107::getLog()->add('EMOTE_01', $pref['emotepack'], E_LOG_INFORMATIVE, '');
break;
}
@ -390,7 +377,10 @@ class emotec
$f_string .= "<emoticon file=\"{$ename}\">\n";
foreach (explode(' ',$tp -> toForm($emotecode[$evalue])) as $v)
{
if (trim($v)) $f_string .= "\t<string>{$v}</string>\n";
if (trim($v))
{
$f_string .= "\t<string>".htmlentities($v)."</string>\n";
}
}
$f_string .= "</emoticon>\n";
}
@ -425,7 +415,7 @@ class emotec
// $tmp = addslashes(serialize($encoded_emotes));
$tmp = e107::getArrayStorage()->WriteArray($encoded_emotes);
if ($sql->db_Select("core", "*", "e107_name='emote_".$packID."'"))
if ($sql->select("core", "*", "e107_name='emote_".$packID."'"))
{
e107::getMessage()->addAuto($sql->update("core", "`e107_value`='{$tmp}' WHERE `e107_name`='emote_".$packID."' "), 'update', LAN_SETSAVED, false, false);
}
@ -475,7 +465,7 @@ class emotec
unset($pack_local[$value]);
}
if (($do_one == $value) || !$do_one && (!$sql -> db_Select("core", "*", "e107_name='emote_".$value."' ")))
if (($do_one == $value) || !$do_one && (!$sql->select("core", "*", "e107_name='emote_".$value."' ")))
{ // Pack info not in DB, or to be re-scanned
$no_error = TRUE;
$File_type = EMOLAN_32.":";

View File

@ -26,9 +26,9 @@
<string>:-?</string>
</emoticon>
<emoticon file="cry">
<string>&|</string>
<string>&-|</string>
<string>&o|</string>
<string>&amp;|</string>
<string>&amp;-|</string>
<string>&amp;o|</string>
<string>:((</string>
<string>!cry</string>
</emoticon>