SMF Development > Fixed or Bogus Bugs
[4873] Agreement.txt missing bug
tmarques:
--- Code: --- // If you have to agree to the agreement, it needs to be fetched from the file.
$context['require_agreement'] = !empty($modSettings['requireAgreement']);
if ($context['require_agreement'])
{
// Have we got a localized one?
if (file_exists($boarddir . '/agreement.' . $user_info['language'] . '.txt'))
$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.' . $user_info['language'] . '.txt'), true, 'agreement_' . $user_info['language']);
elseif (file_exists($boarddir . '/agreement.txt'))
$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.txt'), true, 'agreement');
else
$context['agreement'] = '';
}
--- End code ---
When the agreement.txt file doesn't exist, the code is setting $context['agreement'] to nothing, when it should not be showing the agreement page at all. I don't know how how you'd like to handle this but a more elegant way to do this would probably be to show an error when require_agreement is set and there is no agreement.txt.
IrateZebra:
Actually, an easier way to fix this would be to create an empty agreement.txt, this way $context['agreement'] is still set, but doesn't contain anything.
live627:
Yeh I came across that code the other day and thought it quite odd
tmarques:
--- Quote from: IrateZebra on August 17, 2010, 07:02:15 PM ---Actually, an easier way to fix this would be to create an empty agreement.txt, this way $context['agreement'] is still set, but doesn't contain anything.
--- End quote ---
I forgot to mention that doing that also carries a problem(as does the current code), as it will show an empty box on the agreement page. Perhaps it would be better to jump to the second call of the function since there's no agreement(or it's empty).
niko:
Not sure if this is really bug since you can uncheck show agreement and probably are expected to if you don't want to show agreement but it doesn't make sense to display empty page for user. (well they probably just click I agree anyways without reading)
Navigation
[0] Message Index
[#] Next page
Go to full version