I've submitted the pull request:
https://github.com/kestasjk/webDiplomacy/pull/7I tried to keep it to just the necessary changes without any extra "cleanup". For example:
Code:
if( !isset($_REQUEST['newmessage']) ) $_REQUEST['newmessage'] = '';
if( !isset($_REQUEST['newsubject']) ) $_REQUEST['newsubject'] = '';
if( !isset($_REQUEST['newmessagereply']) ) $_REQUEST['newmessagereply'] = '';
$new = array('message' => "", 'subject' => "", 'id' => -1);
if( $User->type['User'] AND
((isset($_REQUEST['newmessage']) AND ($_REQUEST['newmessage'] != "")) OR
(isset($_REQUEST['newmessagereply']) AND ($_REQUEST['newmessagereply'] != ""))) )
{
in the lower if statement, why check isset() when just above we ensured they were set?
Code:
elseif( strlen($new['subject'])>=90 )
{
$messageproblem = "Subject is too long, please keep it within 90 characters.";
$postboxopen = true;
}
If you do a subject that is exactly 90 wrong, you'll get this error message saying "within 90". If you want to allow 90 characters, then it should check > 90.
And then the code would be easier to follow if we used variables of newsubject, newsummary, and newreply, also changing the reply box to use newreply. But that is just cosmetic and you have to be careful to what you change to what since newmessage becomes newsummary for new messages but newreply for new replies.
I would prefer to make those changes, but probably better to do it separate from the functional changes.