News: When asking for support, it helps us and you, if you read the Posting Guidelines

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

October 18, 2019, 08:15:21 PM

Login with username, password and session length

Recent

Members
  • Total Members: 3756
  • Latest: Ocean
Stats
  • Total Posts: 189090
  • Total Topics: 20764
  • Online Today: 73
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 0
Guests: 42
Total: 42

Author Topic: simple shoutbox smiley and who can see block bug  (Read 6560 times)

0 Members and 1 Guest are viewing this topic.

Offline raid

  • Full Member
  • ***
  • Posts: 162
    • http://www.darkforge.it/
simple shoutbox smiley and who can see block bug
« on: November 18, 2010, 07:25:19 AM »
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

Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: simple shoutbox smiley and who can see block bug
« Reply #1 on: November 18, 2010, 11:11:56 AM »
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.

Offline raid

  • Full Member
  • ***
  • Posts: 162
    • http://www.darkforge.it/
Re: simple shoutbox smiley and who can see block bug
« Reply #2 on: November 18, 2010, 11:13:19 AM »
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
« Last Edit: November 18, 2010, 11:50:40 AM by raid »
SMF 2.0 + TP RC2

Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: simple shoutbox smiley and who can see block bug
« Reply #3 on: November 18, 2010, 02:40:09 PM »
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

Offline raid

  • Full Member
  • ***
  • Posts: 162
    • http://www.darkforge.it/
Re: simple shoutbox smiley and who can see block bug
« Reply #4 on: June 26, 2011, 06:40:48 AM »
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

Code: [Select]
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'];
}
« Last Edit: June 27, 2011, 05:26:39 PM by raid »
SMF 2.0 + TP RC2

Offline raid

  • Full Member
  • ***
  • Posts: 162
    • http://www.darkforge.it/
Re: simple shoutbox smiley and who can see block bug
« Reply #5 on: June 28, 2011, 08:17:07 AM »
am I wrong or are you having the shoutbox smiley issue here too?
SMF 2.0 + TP RC2

Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: simple shoutbox smiley and who can see block bug
« Reply #6 on: June 29, 2011, 09:12:15 AM »
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.