changeset 649:a9d10fa6c890

Fix compo data updates.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 03 Nov 2014 03:39:01 +0200
parents 9e4b8df65879
children 1005de5ee3f0
files admajax.php
diffstat 1 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Mon Nov 03 03:26:16 2014 +0200
+++ b/admajax.php	Mon Nov 03 03:39:01 2014 +0200
@@ -35,9 +35,6 @@
     ) &&
     stChkRequestItem("cpath", $fake,
       array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_PATH, "Compo file path too long.")
-    ) &&
-    stChkRequestItem("ctype", $fake,
-      array(CHK_RANGE, VT_INT, array(COMPO_NORMAL, COMPO_ASSIGN), "Invalid compo type.")
     );
 }
 
@@ -1519,14 +1516,12 @@
         stExecSQLCond($sql, "OK, news item updated.");
       }
       else
-      if ($type == "compotype")
+      if ($type == "compotype" &&
+        stChkRequestItem("ctype", $compotype,
+          array(CHK_RANGE, VT_INT, array(COMPO_NORMAL, COMPO_ASSIGN), "Invalid compo type.")
+        ))
       {
-        $sql = stPrepareSQLUpdate("compos",
-          "WHERE id=".$id,
-          array(
-            "ctype" => "D",
-          ));
-
+        $sql = stPrepareSQL("UPDATE compos SET ctype=%d WHERE id=%d", $compotype, $id);
         stExecSQLCond($sql, "OK, compo updated.");
       }
       else
@@ -1541,7 +1536,6 @@
             "voting" => "B",
             "show_authors" => "B",
             "cpath" => "S",
-            "ctype" => "D",
           ));
 
         stExecSQLCond($sql, "OK, compo updated.");