1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 06:38:00 +02:00

Fixes #732 - Custom Emoticon packs were being ignored.

This commit is contained in:
Cameron
2015-08-24 09:48:27 -07:00
parent f2adea1481
commit e09688788c
4 changed files with 41 additions and 25 deletions

View File

@@ -22,6 +22,8 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
$e_sub_cat = 'emoticon'; $e_sub_cat = 'emoticon';
e107::getConfig('emote')->clearPrefCache('emote');
require_once("auth.php"); require_once("auth.php");
$mes = e107::getMessage(); $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, ''); e107::getLog()->add($pref['smiley_activate'] ? 'EMOTE_02' : 'EMOTE_03', $pref['emotepack'], E_LOG_INFORMATIVE, '');
save_prefs(); save_prefs();
$update = true; $update = true;
} }
else else
{ {
@@ -181,12 +184,12 @@ class emotec
<form method='post' action='".e_SELF."#etabTabContainer=emoticon-packages'> <form method='post' action='".e_SELF."#etabTabContainer=emoticon-packages'>
<fieldset> <fieldset>
<legend>".EMOLAN_13."</legend> <legend>".EMOLAN_13."</legend>
<table class='table adminlist'> <table class='table adminlist' style='margin-top:10px'>
<colgroup> <colgroup>
<col style='width:15%' /> <col style='width:15%' />
<col style='width:50%' /> <col style='width:50%' />
<col style='width:15%' /> <col style='width:10%' />
<col style='width:20%' /> <col style='width:25%' />
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
@@ -207,8 +210,8 @@ class emotec
$text .= " $text .= "
<tr> <tr>
<td class='forumheader' style='width: 20%;'>{$pack}</td> <td class='forumheader'>{$pack}</td>
<td class='forumheader' style='width: 20%;'> <td class='forumheader'>
"; ";
foreach($emoteArray as $emote) foreach($emoteArray as $emote)
@@ -228,24 +231,21 @@ class emotec
$text .= " $text .= "
</td> </td>
<td class='center middle'>".($pref['emotepack'] == $pack ? LAN_ACTIVE : "<button type='submit' name='defPack_".$pack."' value='".EMOLAN_11."'><span>".EMOLAN_11."</span></button>")."</td> <td class='center middle'>".($pref['emotepack'] == $pack ? "<span class='label label-success'>".LAN_ACTIVE."</span>" : "<button class='btn btn-primary' type='submit' name='defPack_".$pack."' value='".EMOLAN_11."'><span>".EMOLAN_11."</span></button>")."</td>
<td>"; <td>";
$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')) if ($can_scan && ($pack != 'default'))
{ {
$text .= " // $text .= "<button class='btn btn-default submit' type='submit' name='scanPack_".$pack."'><span>".EMOLAN_26."</span></button>";
$text .= $frm->admin_button('scanPack_'.$pack,'active','default',EMOLAN_26);
<button class='submit' type='submit' name='scanPack_".$pack."'><span>".EMOLAN_26."</span></button>
";
$text .= $frm->admin_button('scanPack_'.$pack,'active','submit',EMOLAN_26);
} }
$text .= $frm->admin_button('XMLPack_'.$pack,'submit','submit',EMOLAN_28); $text .= $frm->admin_button('XMLPack_'.$pack,'submit','default',EMOLAN_28);
$text .= " $text .= "
</td> </td>
</tr> </tr>
@@ -292,7 +292,7 @@ class emotec
<form method='post' action='".e_SELF."#etabTabContainer=emoticon-packages'> <form method='post' action='".e_SELF."#etabTabContainer=emoticon-packages'>
<fieldset id='core-emoticon-configure'> <fieldset id='core-emoticon-configure'>
<legend class='e-hideme'>".LAN_EDIT."</legend> <legend class='e-hideme'>".LAN_EDIT."</legend>
<div class='info-bar'><strong>".sprintf(str_replace("[x]", "%u", EMOLAN_31), count($eArray))."</strong></div> <div class='info-bar' style='padding-bottom:10px'>".$tp->lanVars(EMOLAN_31, count($eArray))."</div>
<table class='table adminlist'> <table class='table adminlist'>
<colgroup> <colgroup>
<col style='width:20px' /> <col style='width:20px' />
@@ -318,11 +318,11 @@ class emotec
if (!isset($emotecode[$evalue])) if (!isset($emotecode[$evalue]))
{ {
$file_back = '<span class="error">&nbsp;&nbsp;'.EMOLAN_37.'</span>'; $file_back = '&nbsp;&nbsp;<span class="label label-danger error">'.EMOLAN_37.'</span>';
} }
elseif (!$emotecode[$evalue]) elseif (!$emotecode[$evalue])
{ {
$text_back = '<span class="error">&nbsp;&nbsp;'.EMOLAN_38.'</span>'; $text_back = '&nbsp;&nbsp;<span class="label label-danger error">'.EMOLAN_38.'</span>';
} }
$text .= " $text .= "
<tr> <tr>

View File

@@ -3994,14 +3994,15 @@ class e_emotefilter {
{ {
$pref = e107::getPref(); $pref = e107::getPref();
if(!$pref['emotepack']) if(empty($pref['emotepack']))
{ {
$pref['emotepack'] = "default"; $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(); $this->emotes = e107::getConfig("emote")->getPref();
if(!vartrue($this->emotes)) if(!vartrue($this->emotes))
{ {
return; return;
@@ -4056,12 +4057,14 @@ class e_emotefilter {
} }
} }
} }
function filterEmotes($text) function filterEmotes($text)
{ {
$text = str_replace($this->search, $this->replace, $text); $text = str_replace($this->search, $this->replace, $text);
return $text; return $text;
} }
function filterEmotesRev($text) function filterEmotesRev($text)
{ {

View File

@@ -2331,7 +2331,8 @@ class e_form
case 'filter e-hide-if-js': // FIXME hide-js shouldn't be here. case 'filter e-hide-if-js': // FIXME hide-js shouldn't be here.
$options['class'] .= 'btn-primary'; $options['class'] .= 'btn-primary';
break; break;
case 'default':
default: default:
$options['class'] .= 'btn-default'; $options['class'] .= 'btn-default';
break; break;

View File

@@ -807,9 +807,19 @@ final class e_core_pref extends e_pref
*/ */
function __construct($alias, $load = true) function __construct($alias, $load = true)
{ {
$pref_alias = $alias; $pref_alias = $alias;
if($alias == 'emote')
{
$pack = e107::pref('core','emotepack');
$this->aliases['emote'] = 'emote_'.$pack;
}
$pref_id = $this->getConfigId($alias); $pref_id = $this->getConfigId($alias);
if(!$pref_id) if(!$pref_id)
{ {
$pref_id = $pref_alias = ''; $pref_id = $pref_alias = '';
@@ -832,6 +842,8 @@ final class e_core_pref extends e_pref
{ {
$this->load(); $this->load();
} }
} }
/** /**
@@ -928,7 +940,7 @@ class e_plugin_pref extends e_pref
$ret = false; $ret = false;
if($this->plugin_id) 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(); $this->destroy();
} }
return $ret; return $ret;
@@ -982,11 +994,11 @@ class prefs
$Args .= ($Args ? " OR e107_name='{$v}'" : "e107_name='{$v}'"); $Args .= ($Args ? " OR e107_name='{$v}'" : "e107_name='{$v}'");
} }
} }
if (!$sql->db_Select('core', '*', $Args, 'default')) if (!$sql->select('core', '*', $Args, 'default'))
{ {
return FALSE; return FALSE;
} }
while ($row = $sql->db_Fetch()) while ($row = $sql->fetch())
{ {
$this->prefVals['core'][$row['e107_name']] = $row['e107_value']; $this->prefVals['core'][$row['e107_name']] = $row['e107_value'];
} }