Meta description bug

Started by ww898, April 08, 2008, 04:07:31 AM

Previous topic - Next topic

ww898

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" />'

SleePy

Thanks for the bug report, Bug #1893: Meta tags do not clean html out of forumname

I don't know if its logical to fix this for 1.1 but commented it.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

ww898

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

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']));

Advertisement: