TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 08:39:54 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 175
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 174
  • Total: 174

simple shoutbox smiley and who can see block bug

Started by raid, November 18, 2010, 02:25:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

raid

SMF version: SMF ver. 1.1.12
TP version: TP ver. rc1
Default Forum Language: english
Theme name and version: default
Browser Name and Version: FF 3.6.12
Mods installed: none
Related Error messages: nothing

the smf is just installed on localhost with only tp rc1 installed and if I change a smiley code (filename on server and bbcode on admin menu respecting the new name, this smiley isn't loaded on shoutbox, only the name and not the gif but it is loaded on post page, so the dynamic smiley loader from db is missed I think (I fixed it on my forum, tell me if you need)

second, and more important for me, when I select the "who can see the block" option, exactly the option is (Choose your membergroups that will able to see this block. Note that if none are chosen, it will only display it to admin.)
If I select Ungrouped members, everyone will be able to see the block, even the guest, that are NOT selected
SMF 2.0 + TP RC2

IchBin

Thanks raid, I've added the block access to the bug tracker.

As for the smiley issue, I don't understand. Are you saying you add a smiley in SMF admin, it doesn't show anything in the shoutbox smilies? I don't know how this works, but I'll take a look at it when I get a moment.

raid

#2
ok, dont waste your time, I will post here how I fixed, I will be back soon  :)

EDIT:
Code (TPshout.php just the modded function) Select
function shout_smiley_code()
{
global $context, $settings, $user_info, $txt, $modSettings, $db_prefix;
 
// Initialize smiley array...
$context['tp_smileys'] = array(
'postform' => array(),
'popup' => array(),
);

$context['tp_smileys']['postform'][] = array(
'smileys' => array(
array('code' => ':)', 'filename' => 'smiley.gif', 'description' => $txt[287]),
array('code' => ';)', 'filename' => 'wink.gif', 'description' => $txt[292]),
array('code' => ':D', 'filename' => 'cheesy.gif', 'description' => $txt[289]),
array('code' => ';D', 'filename' => 'grin.gif', 'description' => $txt[293]),
array('code' => '>:(', 'filename' => 'angry.gif', 'description' => $txt[288]),
array('code' => ':(', 'filename' => 'sad.gif', 'description' => $txt[291]),
array('code' => ':o', 'filename' => 'shocked.gif', 'description' => $txt[294]),
array('code' => '8)', 'filename' => 'cool.gif', 'description' => $txt[295]),
array('code' => '???', 'filename' => 'huh.gif', 'description' => $txt[296]),
array('code' => '::)', 'filename' => 'rolleyes.gif', 'description' => $txt[450]),
array('code' => ':P', 'filename' => 'tongue.gif', 'description' => $txt[451]),
array('code' => ':-[', 'filename' => 'embarrassed.gif', 'description' => $txt[526]),
array('code' => ':-X', 'filename' => 'lipsrsealed.gif', 'description' => $txt[527]),
array('code' => ':-\\', 'filename' => 'undecided.gif', 'description' => $txt[528]),
array('code' => ':-*', 'filename' => 'kiss.gif', 'description' => $txt[529]),
array('code' => ':\'(', 'filename' => 'cry.gif', 'description' => $txt[530])
),
'last' => true,
);

// Clean house... add slashes to the code for javascript.
foreach (array_keys($context['tp_smileys']) as $location)
{
foreach ($context['tp_smileys'][$location] as $j => $row)
{
$n = count($context['tp_smileys'][$location][$j]['smileys']);
for ($i = 0; $i < $n; $i++)
{
$context['tp_smileys'][$location][$j]['smileys'][$i]['code'] = addslashes($context['tp_smileys'][$location][$j]['smileys'][$i]['code']);
$context['tp_smileys'][$location][$j]['smileys'][$i]['js_description'] = addslashes($context['tp_smileys'][$location][$j]['smileys'][$i]['description']);
}

$context['tp_smileys'][$location][$j]['smileys'][$n - 1]['last'] = true;
}
if (!empty($context['tp_smileys'][$location]))
$context['tp_smileys'][$location][count($context['tp_smileys'][$location]) - 1]['last'] = true;
}
$settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set'];
}


Code (the fixed code) Select
function shout_smiley_code()
{
global $context, $settings, $user_info, $txt, $modSettings, $db_prefix;
 
// Initialize smiley array...
$context['tp_smileys'] = array(
'postform' => array(),
'popup' => array(),
);
// Load smileys - don't bother to run a query if we're not using the database's ones anyhow.
if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none')
$context['tp_smileys']['postform'][] = array(
'smileys' => array(
array('code' => ':)', 'filename' => 'smiley.gif', 'description' => $txt[287]),
array('code' => ';)', 'filename' => 'wink.gif', 'description' => $txt[292]),
array('code' => ':D', 'filename' => 'cheesy.gif', 'description' => $txt[289]),
array('code' => ';D', 'filename' => 'grin.gif', 'description' => $txt[293]),
array('code' => '>:(', 'filename' => 'angry.gif', 'description' => $txt[288]),
array('code' => ':(', 'filename' => 'sad.gif', 'description' => $txt[291]),
array('code' => ':o', 'filename' => 'shocked.gif', 'description' => $txt[294]),
array('code' => '8)', 'filename' => 'cool.gif', 'description' => $txt[295]),
array('code' => '???', 'filename' => 'huh.gif', 'description' => $txt[296]),
array('code' => '::)', 'filename' => 'rolleyes.gif', 'description' => $txt[450]),
array('code' => ':P', 'filename' => 'tongue.gif', 'description' => $txt[451]),
array('code' => ':-[', 'filename' => 'embarrassed.gif', 'description' => $txt[526]),
array('code' => ':-X', 'filename' => 'lipsrsealed.gif', 'description' => $txt[527]),
array('code' => ':-\\', 'filename' => 'undecided.gif', 'description' => $txt[528]),
array('code' => ':-*', 'filename' => 'kiss.gif', 'description' => $txt[529]),
array('code' => ':\'(', 'filename' => 'cry.gif', 'description' => $txt[530])
),
'last' => true,
);
elseif ($user_info['smiley_set'] != 'none')
{
if (($temp = cache_get_data('posting_smileys', 480)) == null)
{
$request = db_query("
SELECT code, filename, description, smileyRow, hidden
FROM {$db_prefix}smileys
WHERE hidden IN (0, 2)
ORDER BY smileyRow, smileyOrder", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
$row['code'] = htmlspecialchars($row['code']);
$row['filename'] = htmlspecialchars($row['filename']);
$row['description'] = htmlspecialchars($row['description']);

$context['tp_smileys'][empty($row['hidden']) ? 'postform' : 'popup'][$row['smileyRow']]['smileys'][] = $row;
}
mysql_free_result($request);

cache_put_data('posting_smileys', $context['tp_smileys'], 480);
}
else
$context['tp_smileys'] = $temp;
}
// Clean house... add slashes to the code for javascript.
foreach (array_keys($context['tp_smileys']) as $location)
{
foreach ($context['tp_smileys'][$location] as $j => $row)
{
$n = count($context['tp_smileys'][$location][$j]['smileys']);
for ($i = 0; $i < $n; $i++)
{
$context['tp_smileys'][$location][$j]['smileys'][$i]['code'] = addslashes($context['tp_smileys'][$location][$j]['smileys'][$i]['code']);
$context['tp_smileys'][$location][$j]['smileys'][$i]['js_description'] = addslashes($context['tp_smileys'][$location][$j]['smileys'][$i]['description']);
}

$context['tp_smileys'][$location][$j]['smileys'][$n - 1]['last'] = true;
}
if (!empty($context['tp_smileys'][$location]))
$context['tp_smileys'][$location][count($context['tp_smileys'][$location]) - 1]['last'] = true;
}
$settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set'];
}


the code is taken from tp 1063, just updated the variables name, it works.

P.S.
I added the [more smiley] link as popup but this is another story (took from tp 1063 too)

EDIT2:
just 2 screenshots to make you understand easily:
http://i52.tinypic.com/dw2dg6.jpg    how I edited the smiley and bbcode, so custom one
http://i54.tinypic.com/2uxwdis.jpg   < the problem
SMF 2.0 + TP RC2

IchBin

I was thinking that TP did it's own Smiley array. Good idea on adding in the database call if selected.  O0

I'll try to remember to put this into the code when I start working on things. :D

raid

#4
hi,
I upgraded to smf 2 and tp rc2, this problem is still there

thx for your work :) I love tp


EDIT: the same function on tpshout.php source file, db query now are interesting, it works for me

function shout_smiley_code()
{
global $context, $settings, $user_info, $txt, $modSettings, $db_prefix, $smcFunc;
 
// Initialize smiley array...
$context['tp_smileys'] = array(
'postform' => array(),
'popup' => array(),
);
// Load smileys - don't bother to run a query if we're not using the database's ones anyhow.
if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none')
$context['tp_smileys']['postform'][] = array(
'smileys' => array(
array('code' => ':)', 'filename' => 'smiley.gif', 'description' => $txt['icon_smiley']),
array('code' => ';)', 'filename' => 'wink.gif', 'description' => $txt['icon_wink']),
array('code' => ':D', 'filename' => 'cheesy.gif', 'description' => $txt['icon_cheesy']),
array('code' => ';D', 'filename' => 'grin.gif', 'description' => $txt['icon_grin']),
array('code' => '>:(', 'filename' => 'angry.gif', 'description' => $txt['icon_angry']),
array('code' => ':(', 'filename' => 'sad.gif', 'description' => $txt[ 'icon_sad']),
array('code' => ':o', 'filename' => 'shocked.gif', 'description' => $txt['icon_shocked']),
array('code' => '8)', 'filename' => 'cool.gif', 'description' => $txt[ 'icon_cool']),
array('code' => '???', 'filename' => 'huh.gif', 'description' => $txt['icon_huh']),
array('code' => '::)', 'filename' => 'rolleyes.gif', 'description' => $txt[ 'icon_rolleyes']),
array('code' => ':P', 'filename' => 'tongue.gif', 'description' => $txt['icon_tongue']),
array('code' => ':-[', 'filename' => 'embarrassed.gif', 'description' => $txt['icon_embarrassed']),
array('code' => ':-X', 'filename' => 'lipsrsealed.gif', 'description' => $txt['icon_lips']),
array('code' => ':-\\', 'filename' => 'undecided.gif', 'description' => $txt[ 'icon_undecided']),
array('code' => ':-*', 'filename' => 'kiss.gif', 'description' => $txt['icon_kiss']),
array('code' => ':\'(', 'filename' => 'cry.gif', 'description' => $txt['icon_cry'])
),
'last' => true,
);
elseif ($user_info['smiley_set'] != 'none')
{
if (($temp = cache_get_data('posting_smileys', 480)) == null)
{
$request = $smcFunc['db_query']('', '
  SELECT code, filename, description, smiley_row, hidden
FROM {db_prefix}smileys
WHERE hidden IN ({int:val1}, {int:val2})
ORDER BY smiley_row, smiley_order',
array('val1' => 0,
      'val2' => 2)
);

while ($row = $smcFunc['db_fetch_assoc']($request))
{
$row['code'] = htmlspecialchars($row['code']);
$row['filename'] = htmlspecialchars($row['filename']);
$row['description'] = htmlspecialchars($row['description']);

$context['tp_smileys'][empty($row['hidden']) ? 'postform' : 'popup'][$row['smiley_row']]['smileys'][] = $row;
}
$smcFunc['db_free_result']($request);

cache_put_data('posting_smileys', $context['tp_smileys'], 480);
}
else
$context['tp_smileys'] = $temp;
}
// Clean house... add slashes to the code for javascript.
foreach (array_keys($context['tp_smileys']) as $location)
{
foreach ($context['tp_smileys'][$location] as $j => $row)
{
$n = count($context['tp_smileys'][$location][$j]['smileys']);
for ($i = 0; $i < $n; $i++)
{
$context['tp_smileys'][$location][$j]['smileys'][$i]['code'] = addslashes($context['tp_smileys'][$location][$j]['smileys'][$i]['code']);
$context['tp_smileys'][$location][$j]['smileys'][$i]['js_description'] = addslashes($context['tp_smileys'][$location][$j]['smileys'][$i]['description']);
}

$context['tp_smileys'][$location][$j]['smileys'][$n - 1]['last'] = true;
}
if (!empty($context['tp_smileys'][$location]))
$context['tp_smileys'][$location][count($context['tp_smileys'][$location]) - 1]['last'] = true;
}
$settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set'];
}
SMF 2.0 + TP RC2

raid

am I wrong or are you having the shoutbox smiley issue here too?
SMF 2.0 + TP RC2

IchBin

From what I remember, the shoutbox loads the smilies assigned in the code. It doesn't call the smilies that SMF loads from the database. The proposed fix you posted changes the way it works completely. Not that I don't want to change it, but at this point I'm only trying to add bug fixes, not new features. :)

Added to bug tracker so I won't forget about it.