changeset 643:d32b5f601670

Fix adding of new compos.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 03 Nov 2014 02:11:10 +0200
parents 9fbbbb8628ff
children de35a9743557
files admajax.php
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Mon Nov 03 02:00:28 2014 +0200
+++ b/admajax.php	Mon Nov 03 02:11:10 2014 +0200
@@ -17,11 +17,7 @@
       array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_NAME, "Compo name too long.")) ||
     !stChkRequestItem("description", $fake,
       array(CHK_ISGT, VT_STR, 10, "Compo description too short"),
-      array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_DESC, "Compo description too long.")) ||
-    !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.")))
+      array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_DESC, "Compo description too long.")))
     return FALSE;
   
   if (!$full)
@@ -36,6 +32,12 @@
     ) &&
     stChkRequestItem("show_authors", $fake,
       array(CHK_TYPE, VT_BOOL, "Invalid data.")
+    ) &&
+    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.")
     );
 }
 
@@ -1432,8 +1434,8 @@
     if ($type == "compo" && stValidateRequestCompoData(FALSE))
     {
       $sql = stPrepareSQL(
-        "INSERT INTO compos (name,description,visible,voting,show_authors,path,type) VALUES (%S,%Q,%D,0,0,0,%S,%D)",
-        "name", "description", "cpath", "ctype");
+        "INSERT INTO compos (name,description,visible,voting,show_authors) VALUES (%S,%Q,0,0,0)",
+        "name", "description");
 
       stExecSQLCond($sql, "OK, compo added.");
     }