Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: ww898 on April 08, 2008, 04:07:31 AM

Title: Meta description bug
Post by: ww898 on April 08, 2008, 04:07:31 AM
Some forum names & forum titles containes quotes! It is fact. So, it will be better if SMF convert them to special HTML symbols such as " in the meta description tag and RSS tag...

=== SMF 1.1.4 ===
echo '<meta name="description" content="', $context['page_title'], '" />'
echo '<link rel="alternate" type="application/rss+xml" title="', $context['forum_name'], ' - RSS" href="', $scripturl, '?type=rss;action=.xml" />'

=== Bug fix example ===

echo '<meta name="description" content="', htmlspecialchars($context['page_title']), '" />'
echo '<link rel="alternate" type="application/rss+xml" title="', htmlspecialchars($context['forum_name']), ' - RSS" href="', $scripturl, '?type=rss;action=.xml" />'
Title: Re: Meta description bug
Post by: SleePy on April 08, 2008, 11:53:16 AM
Thanks for the bug report, Bug #1893: Meta tags do not clean html out of forumname (http://dev.simplemachines.org/mantis/view.php?id=1893)

I don't know if its logical to fix this for 1.1 but commented it.
Title: Re: Meta description bug
Post by: ww898 on May 07, 2008, 03:50:58 AM
Quote from: SleePy on April 08, 2008, 11:53:16 AM
Thanks for the bug report, Bug #1893: Meta tags do not clean html out of forumname (http://dev.simplemachines.org/mantis/view.php?id=1893)

I don't know if its logical to fix this for 1.1 but commented it.
I found that my previous fix is partly wrong, so new version of fix (for 1.1.5):

=== index.template.php: 103 ===
before:
<link rel="alternate" type="application/rss+xml" title="', $context['forum_name'], ' - RSS" href="', $scripturl, '?type=rss;action=.xml" />';
after:
<link rel="alternate" type="application/rss+xml" title="', htmlspecialchars($context['forum_name']), ' - RSS" href="', $scripturl, '?type=rss;action=.xml" />';

=== index.template.php: 197 ===
before:
<span style="font-family: Verdana, sans-serif; font-size: 140%; ">', $context['forum_name'], '</span>';
after:
<span style="font-family: Verdana, sans-serif; font-size: 140%; ">', htmlspecialchars($context['forum_name']), '</span>';

=== index.template.php: 200 ===
before:
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />
after:
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', htmlspecialchars($context['forum_name']), '" />

=== BoardIndex.php: 435 ===
before:
$context['page_title'] = $txt[18];
after:
$context['page_title'] = htmlspecialchars($txt[18]);

=== MessageIndex.php: 151 ===
before:
$context['page_title'] = strip_tags($board_info['name']);
after:
$context['page_title'] = htmlspecialchars(strip_tags($board_info['name']));