From e09688788ce1d162e3f6792845c367a2729c0ad6 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 24 Aug 2015 09:48:27 -0700 Subject: [PATCH] Fixes #732 - Custom Emoticon packs were being ignored. --- e107_admin/emoticon.php | 32 ++++++++++++++++---------------- e107_handlers/e_parse_class.php | 13 ++++++++----- e107_handlers/form_handler.php | 3 ++- e107_handlers/pref_class.php | 18 +++++++++++++++--- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/e107_admin/emoticon.php b/e107_admin/emoticon.php index 14dde8c4c..bfc3c25c0 100644 --- a/e107_admin/emoticon.php +++ b/e107_admin/emoticon.php @@ -22,6 +22,8 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); $e_sub_cat = 'emoticon'; +e107::getConfig('emote')->clearPrefCache('emote'); + require_once("auth.php"); $mes = e107::getMessage(); @@ -43,6 +45,7 @@ if (isset($_POST['active'])) e107::getLog()->add($pref['smiley_activate'] ? 'EMOTE_02' : 'EMOTE_03', $pref['emotepack'], E_LOG_INFORMATIVE, ''); save_prefs(); $update = true; + } else { @@ -181,12 +184,12 @@ class emotec
".EMOLAN_13." - +
- - + + @@ -207,8 +210,8 @@ class emotec $text .= " - - + - + @@ -292,7 +292,7 @@ class emotec
".LAN_EDIT." -
".sprintf(str_replace("[x]", "%u", EMOLAN_31), count($eArray))."
+
".$tp->lanVars(EMOLAN_31, count($eArray))."
{$pack} + {$pack} "; foreach($emoteArray as $emote) @@ -228,24 +231,21 @@ class emotec $text .= " ".($pref['emotepack'] == $pack ? LAN_ACTIVE : "")."".($pref['emotepack'] == $pack ? "".LAN_ACTIVE."" : "")." "; - $text .= $frm->admin_button('subPack_'.$pack,'edit','submit',LAN_CONFIGURE); + $text .= $frm->admin_button('subPack_'.$pack,'edit','default',LAN_CONFIGURE); if ($can_scan && ($pack != 'default')) { - $text .= " - - - "; - $text .= $frm->admin_button('scanPack_'.$pack,'active','submit',EMOLAN_26); + // $text .= ""; + $text .= $frm->admin_button('scanPack_'.$pack,'active','default',EMOLAN_26); } - $text .= $frm->admin_button('XMLPack_'.$pack,'submit','submit',EMOLAN_28); + $text .= $frm->admin_button('XMLPack_'.$pack,'submit','default',EMOLAN_28); $text .= "
@@ -318,11 +318,11 @@ class emotec if (!isset($emotecode[$evalue])) { - $file_back = '  '.EMOLAN_37.''; + $file_back = '  '.EMOLAN_37.''; } elseif (!$emotecode[$evalue]) { - $text_back = '  '.EMOLAN_38.''; + $text_back = '  '.EMOLAN_38.''; } $text .= " diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 58d05cefc..fee79b381 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -3994,14 +3994,15 @@ class e_emotefilter { { $pref = e107::getPref(); - if(!$pref['emotepack']) + if(empty($pref['emotepack'])) { $pref['emotepack'] = "default"; - save_prefs(); + e107::getConfig('emote')->clearPrefCache('emote'); + e107::getConfig('core')->set('emotepack','default')->save(false,true,false); } - + $this->emotes = e107::getConfig("emote")->getPref(); - + if(!vartrue($this->emotes)) { return; @@ -4056,12 +4057,14 @@ class e_emotefilter { } } } - + + function filterEmotes($text) { $text = str_replace($this->search, $this->replace, $text); return $text; } + function filterEmotesRev($text) { diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index a70a7c74a..8e491b9c8 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -2331,7 +2331,8 @@ class e_form case 'filter e-hide-if-js': // FIXME hide-js shouldn't be here. $options['class'] .= 'btn-primary'; break; - + + case 'default': default: $options['class'] .= 'btn-default'; break; diff --git a/e107_handlers/pref_class.php b/e107_handlers/pref_class.php index 770e0ef72..b3dc6fa13 100644 --- a/e107_handlers/pref_class.php +++ b/e107_handlers/pref_class.php @@ -807,9 +807,19 @@ final class e_core_pref extends e_pref */ function __construct($alias, $load = true) { + + $pref_alias = $alias; + + if($alias == 'emote') + { + $pack = e107::pref('core','emotepack'); + $this->aliases['emote'] = 'emote_'.$pack; + } + $pref_id = $this->getConfigId($alias); + if(!$pref_id) { $pref_id = $pref_alias = ''; @@ -832,6 +842,8 @@ final class e_core_pref extends e_pref { $this->load(); } + + } /** @@ -928,7 +940,7 @@ class e_plugin_pref extends e_pref $ret = false; if($this->plugin_id) { - $ret = e107::getDb($this->plugin_id)->db_Delete('core', "e107_name='{$this->plugin_id}'"); + $ret = e107::getDb($this->plugin_id)->delete('core', "e107_name='{$this->plugin_id}'"); $this->destroy(); } return $ret; @@ -982,11 +994,11 @@ class prefs $Args .= ($Args ? " OR e107_name='{$v}'" : "e107_name='{$v}'"); } } - if (!$sql->db_Select('core', '*', $Args, 'default')) + if (!$sql->select('core', '*', $Args, 'default')) { return FALSE; } - while ($row = $sql->db_Fetch()) + while ($row = $sql->fetch()) { $this->prefVals['core'][$row['e107_name']] = $row['e107_value']; }