Mercurial > hg > fapweb
changeset 654:f416330b8792
Reorder code for clarity.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 03 Nov 2014 05:07:49 +0200 |
parents | 5ed91fb08165 |
children | baf2c9608e0a |
files | admajax.php |
diffstat | 1 files changed, 20 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/admajax.php Mon Nov 03 04:19:24 2014 +0200 +++ b/admajax.php Mon Nov 03 05:07:49 2014 +0200 @@ -1541,31 +1541,30 @@ else if ($type == "compo") { - if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$id)) !== false) + // Check if compo ID exists + if (($compo = stFetchSQL("SELECT * FROM compos WHERE id=".$id)) === false) + stError("No such compo ID."); + else + if (stValidateRequestCompoData(TRUE, $compo["ctype"])) { - if (stValidateRequestCompoData(TRUE, $compo["ctype"])) + $skeys = array( + "name" => "S", + "description" => "Q", + "visible" => "B", + "show_authors" => "B", + "cpath" => "S", + ); + + switch ($compo["ctype"]) { - $skeys = array( - "name" => "S", - "description" => "Q", - "visible" => "B", - "show_authors" => "B", - "cpath" => "S", - ); - - switch ($compo["ctype"]) - { - case COMPO_NORMAL: - $skeys["voting"] = "B"; - break; - } - - $sql = stPrepareSQLUpdate("compos", "WHERE id=".$id, $skeys); - stExecSQLCond($sql, "OK, compo updated."); + case COMPO_NORMAL: + $skeys["voting"] = "B"; + break; } + + $sql = stPrepareSQLUpdate("compos", "WHERE id=".$id, $skeys); + stExecSQLCond($sql, "OK, compo updated."); } - else - stError("No such compo ID."); } else if ($type == "entry" && stValidateRequestEntryData($compo_id))