Just noticed, but I'm playing with other things... O:)
Okay, found it but since I was already playing with Post and Post2 the solution may not be good...
I'll post something tomorrow.
ETA: what I'm trying to do is consolidate some "common" checks in a function and do it both during Post and Post2.
Let me know is it does make sense. ;)
I don't think it ever flagged for no subject or body during a preview, those are post2(ing) errors and preview jumps out of post2 purposely before it does those checks (and runs back to post)
Seems like it would be easy to add them in to the really_previewing section, in post, at least the basic checks. I don't have a strong opinion on this, but does seem a bit unnecessary for preview ... well maybe adding in the subject flag is not bad idea.
ETA: Added in the subject one since it was a one liner
It was checking for few things in both the functions:
// Validate inputs.
if (empty($context['post_error']))
{
if (htmltrim__recursive(htmlspecialchars__recursive($_REQUEST['subject'])) == '')
$context['post_error']['no_subject'] = true;
if (htmltrim__recursive(htmlspecialchars__recursive($_REQUEST['message'])) == '')
$context['post_error']['no_message'] = true;
if (!empty($modSettings['max_messageLength']) && $smcFunc['strlen']($_REQUEST['message']) > $modSettings['max_messageLength'])
$context['post_error']['long_message'] = true;
// Are you... a guest?
if ($user_info['is_guest'])
{
$_REQUEST['guestname'] = !isset($_REQUEST['guestname']) ? '' : trim($_REQUEST['guestname']);
$_REQUEST['email'] = !isset($_REQUEST['email']) ? '' : trim($_REQUEST['email']);
// Validate the name and email.
if (!isset($_REQUEST['guestname']) || trim(strtr($_REQUEST['guestname'], '_', ' ')) == '')
$context['post_error']['no_name'] = true;
elseif ($smcFunc['strlen']($_REQUEST['guestname']) > 25)
$context['post_error']['long_name'] = true;
else
{
require_once($sourcedir . '/Subs-Members.php');
if (isReservedName(htmlspecialchars($_REQUEST['guestname']), 0, true, false))
$context['post_error']['bad_name'] = true;
}
if (empty($modSettings['guest_post_no_email']))
{
if (!isset($_REQUEST['email']) || $_REQUEST['email'] == '')
$context['post_error']['no_email'] = true;
elseif (preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_REQUEST['email']) == 0)
$context['post_error']['bad_email'] = true;
}
}
// This is self explanatory - got any questions?
if (isset($_REQUEST['question']) && trim($_REQUEST['question']) == '')
$context['post_error']['no_question'] = true;
Ah ... well far be it from me to remove functionality, even if it is dubious :P I like the idea of consolidating all of that error checking in one place, its pretty messy now and thats even after it got cleaned up some from 2.0.
I must say that really is some ugly code flow just to support non javascirpt users preview :o
My 2c: non-js users shouldn't expect frills like preview. It's not essential functionality, it's just a luxury that is often not used anyway. If it requires a pile of ugly code that causes problems, I'd drop it.
/me feels discriminated... :(
/me forks Dialogo to create a JS-free forum. :P
lol... Why you let yerself discriminated? :o
js ftw...