Combine these if statements into one to reduce the cyclomatic complexity.

This commit is contained in:
jgen 2014-04-26 03:56:06 -04:00
parent efb5038b20
commit a8dd045586
2 changed files with 14 additions and 24 deletions

View File

@ -323,26 +323,16 @@ class Notes extends Extension {
$noteText = mysql_real_escape_string(html_escape($_POST["note_text"]));
// validate parameters
if(is_null($imageID) || !is_numeric($imageID))
return;
if(is_null($noteID) || !is_numeric($noteID))
return;
if(is_null($noteX1) || !is_numeric($noteX1))
return;
if(is_null($noteY1) || !is_numeric($noteY1))
return;
if(is_null($noteHeight) || !is_numeric($noteHeight))
return;
if(is_null($noteWidth) || !is_numeric($noteWidth))
return;
if(is_null($noteText) || strlen($noteText) == 0)
if (is_null($imageID) || !is_numeric($imageID) ||
is_null($noteID) || !is_numeric($noteID) ||
is_null($noteX1) || !is_numeric($noteX1) ||
is_null($noteY1) || !is_numeric($noteY1) ||
is_null($noteHeight) || !is_numeric($noteHeight) ||
is_null($noteWidth) || !is_numeric($noteWidth) ||
is_null($noteText) || strlen($noteText) == 0)
{
return;
}
global $database;
$database->execute("UPDATE notes ".
@ -369,11 +359,11 @@ class Notes extends Extension {
$noteID = int_escape($_POST["note_id"]);
// validate parameters
if(is_null($imageID) || !is_numeric($imageID))
return;
if(is_null($noteID) || !is_numeric($noteID))
if( is_null($imageID) || !is_numeric($imageID) ||
is_null($noteID) || !is_numeric($noteID))
{
return;
}
global $database;