Welcome to all phpBB2 Refugees!This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area. |
|
Author |
Message |
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Sat Oct 02, 2010 5:05 am Post subject: How to keep smilies from getting parsed? |
|
|
I would like to show smilies as their code instead of as images, in topic view.
Where should I look for the code I will have to change?
Or will this require totally new code?
Is this part of bbcode.php the part were the smilies get parsed or is there more code involved?
Code: | //
// Smilies code ... would this be better tagged on to the end of bbcode.php?
// Probably so and I'll move it before B2
//
function smilies_pass($message)
{
static $orig, $repl;
if (!isset($orig))
{
global $db, $board_config;
$orig = $repl = array();
$sql = 'SELECT * FROM ' . SMILIES_TABLE;
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
}
$smilies = $db->sql_fetchrowset($result);
if (count($smilies))
{
usort($smilies, 'smiley_sort');
}
for ($i = 0; $i < count($smilies); $i++)
{
$orig[] = "/(?<=.\W|\W.|^\W)" . preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
$repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />';
}
}
if (count($orig))
{
$message = preg_replace($orig, $repl, ' ' . $message . ' ');
$message = substr($message, 1, -1);
}
return $message;
} |
_________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
Acaria Board Member
Joined: 20 Feb 2009
Posts: 238
|
Posted: Sat Oct 02, 2010 10:37 am Post subject: Re: How to keep smilies from getting parsed? |
|
|
I believe it's during the post that smilies are parsed. Notice underneath the post box when you reply to a topic the "Disable Smilies in this post" checkbox.
I believe the code you posted is just listing smilies, like in the rows beside the Reply box, in the ACP, or something like that. Though I'm not entirely sure.
I'd just snoop around viewtopic.php for anything smilie-related. Try simply removing code (if it looks like it might be what needs to be removed) and running it. Just paste it back if it doesn't work and/or breaks something. :P
If that doesn't work, just post again and I'll take a look in the files myself to see if I can hunt the code down. |
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Sat Oct 02, 2010 12:34 pm Post subject: Re: How to keep smilies from getting parsed? |
|
|
I believe you're right, smilies are parsed on posting, not on viewing.
And I guess the code I posted is the one that parses 'em.
I'll have a looky as you suggest, but I guess something will have to be written to preg_replace them out of view.
**EDIT** Five minutes later.
Well, that was quick, and easy.
In viewtopic.php:
Code: | //
// Parse smilies
//
if ( $board_config['allow_smilies'] )
{
if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
{
$user_sig = smilies_pass($user_sig);
}
if ( $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message);
}
} |
Removing Code: | if ( $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message);
} | does exactly what I want. _________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Mon Oct 11, 2010 9:19 am Post subject: Re: How to keep smilies from getting parsed? |
|
|
Sorry I'm late (was out last week at a conference) but that is exactly what I have done here on this board, for the "Don't show smilies" profile option. You may also need to find the area that parses signatures. If you can't find it, let me know and I will post it. _________________ phpBBDoctor Blog |
|
Back to top |
|
|
|
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0588 seconds using 17 queries. (SQL 0.0110 Parse 0.0006 Other 0.0472) |
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com
|
|