Catch bad replyto IDs before saving a new notice to avoid a constraint violation. This happens, for example, when posting for the first time on a fresh install

This commit is contained in:
CiaranG 2009-03-03 21:33:52 +00:00
parent 3fd877c4ce
commit 35677336de

View File

@ -152,6 +152,11 @@ class NewnoticeAction extends Action
}
$replyto = $this->trimmed('inreplyto');
#If an ID of 0 is wrongly passed here, it will cause a database error,
#so override it...
if ($replyto == 0) {
$replyto = 'false';
}
$notice = Notice::saveNew($user->id, $content, 'web', 1,
($replyto == 'false') ? null : $replyto);