diff admajax.php @ 1114:51f24cb35fc8

s/SET_LEN_/SQL_LEN_/g
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 14 Oct 2019 10:31:39 +0300
parents 0a2117349f46
children d5847f016de5
line wrap: on
line diff
--- a/admajax.php	Mon Oct 14 10:31:20 2019 +0300
+++ b/admajax.php	Mon Oct 14 10:31:39 2019 +0300
@@ -24,11 +24,11 @@
 
   stChkRequestItemFail("name", $fake, $res,
     array(CHK_ISGT, VT_STR, 0, "Compo name is empty."),
-    array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_NAME, "Compo name too long (%1 chars, must be less than %2)."));
+    array(CHK_LTEQ, VT_STR, SQL_LEN_COMPO_NAME, "Compo name too long (%1 chars, must be less than %2)."));
 
   stChkRequestItemFail("description", $fake, $res,
     array(CHK_ISGT, VT_STR, 10, "Compo description too short (%1 chars, must be more than %2)"),
-    array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_DESC, "Compo description too long (%1 chars, must be less than %2)."));
+    array(CHK_LTEQ, VT_STR, SQL_LEN_COMPO_DESC, "Compo description too long (%1 chars, must be less than %2)."));
 
   // Not a full check?
   if (!$full)
@@ -49,7 +49,7 @@
         array(CHK_ARRAY_KEY, $previewTypeList, "Invalid preview type value."));
 
       stChkRequestItemFail("cpath", $fake, $res,
-        array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_PATH, "Compo file path too long (%1 chars, must be less than %2)."));
+        array(CHK_LTEQ, VT_STR, SQL_LEN_COMPO_PATH, "Compo file path too long (%1 chars, must be less than %2)."));
       break;
   }
 
@@ -67,11 +67,11 @@
   // Things common for all compo types
   stChkRequestItemFail("name", $fake, $res,
     array(CHK_ISGT, VT_STR, 0, "Name is empty."),
-    array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_NAME, "Name too long (%1 chars, must be less than %2)."));
+    array(CHK_LTEQ, VT_STR, SQL_LEN_ENTRY_NAME, "Name too long (%1 chars, must be less than %2)."));
 
   stChkRequestItemFail("notes", $fake, $res,
     array(CHK_TYPE, VT_TEXT, "Invalid data."),
-    array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_NOTES, "Entry notes are too long (%1 chars, must be less than %2)."));
+    array(CHK_LTEQ, VT_STR, SQL_LEN_ENTRY_NOTES, "Entry notes are too long (%1 chars, must be less than %2)."));
 
   // Check based on compo type
   switch ($ctype)
@@ -82,11 +82,11 @@
 
       stChkRequestItemFail("author", $fake, $res,
         array(CHK_ISGT, VT_STR, 0, "Author name not set."),
-        array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_AUTHOR, "Entry author too long (%1 chars, must be less than %2)."));
+        array(CHK_LTEQ, VT_STR, SQL_LEN_ENTRY_AUTHOR, "Entry author too long (%1 chars, must be less than %2)."));
 
       stChkRequestItemFail("info", $fake, $res,
         array(CHK_TYPE, VT_TEXT, "Invalid data."),
-        array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_INFO, "Entry info text too long (%1 chars, must be less than %2)."));
+        array(CHK_LTEQ, VT_STR, SQL_LEN_ENTRY_INFO, "Entry info text too long (%1 chars, must be less than %2)."));
 
       if ($full)
       {
@@ -118,15 +118,15 @@
 
   stChkRequestItemFail("text", $fake, $res,
     array(CHK_ISGT, VT_STR, 0, "News text too short."),
-    array(CHK_LTEQ, VT_STR, SET_LEN_NEWS_TEXT, "News text too long (%1 chars, must be less than %2)."));
+    array(CHK_LTEQ, VT_STR, SQL_LEN_NEWS_TEXT, "News text too long (%1 chars, must be less than %2)."));
 
   stChkRequestItemFail("author", $fake, $res,
     array(CHK_ISGT, VT_STR, 0, "News author name not set."),
-    array(CHK_LTEQ, VT_STR, SET_LEN_NEWS_AUTHOR, "News author name too long (%1 chars, must be less than %2)."));
+    array(CHK_LTEQ, VT_STR, SQL_LEN_NEWS_AUTHOR, "News author name too long (%1 chars, must be less than %2)."));
 
   stChkRequestItemFail("title", $fake, $res,
     array(CHK_ISGT, VT_STR, 0, "News title not set."),
-    array(CHK_LTEQ, VT_STR, SET_LEN_NEWS_TITLE, "News title too long (%1 chars. must be less than %2)."));
+    array(CHK_LTEQ, VT_STR, SQL_LEN_NEWS_TITLE, "News title too long (%1 chars. must be less than %2)."));
 
   return $res;
 }
@@ -140,7 +140,7 @@
   {
     case COMPO_NORMAL:
       $str1 = 
-        "  File path: ".stGetFormTextInput(40, SET_LEN_COMPO_PATH, "cpath", $id, $prefix, $item["cpath"])."<br />\n";
+        "  File path: ".stGetFormTextInput(40, SQL_LEN_COMPO_PATH, "cpath", $id, $prefix, $item["cpath"])."<br />\n";
 
       $str2 =
         "  ".stGetFormCheckBoxInput("voting", $id, $prefix, $item["voting"],
@@ -158,7 +158,7 @@
     "  <h2>#".$id." - ".chentities($item["name"])."</h2>\n".
     "  Type: ".stGetFormOptionListFromArray($prefix."type".$id, "  ", FALSE, $compoModeData, $item["ctype"], 0, 0, "updateCompoType(".$id.")").
     " - ".$compoModeData[$item["ctype"]][1]."<br />\n".
-    "  Name: ".stGetFormTextInput(40, SET_LEN_COMPO_NAME, "name", $id, $prefix, $item["name"])."<br />\n".
+    "  Name: ".stGetFormTextInput(40, SQL_LEN_COMPO_NAME, "name", $id, $prefix, $item["name"])."<br />\n".
     $str1.
     "<div class=\"compoDesc\"><h3>Description</h3>".stGetFormTextArea(8, 60, "description", $id, $prefix, $item["description"])."</div>\n".
     "<div class=\"compoDesc\"><h3>Notes (shown in results)</h3>".stGetFormTextArea(8, 60, "notes", $id, $prefix, $item["notes"])."</div>\n".
@@ -175,10 +175,10 @@
 {
   return
     "  <h2>".chentities($item["title"])."</h2>\n".
-    "  ".stGetFormTextInput(40, SET_LEN_NEWS_TITLE, "title", $id, $prefix, $item["title"]).
+    "  ".stGetFormTextInput(40, SQL_LEN_NEWS_TITLE, "title", $id, $prefix, $item["title"]).
     " - posted ".date("d M Y / H:i", $item["utime"])."<br />\n".
     "  ".stGetFormTextArea(5, 60, "text", $id, $prefix, $item["text"])."<br />\n".
-    "  ".stGetFormTextInput(20, SET_LEN_NEWS_AUTHOR, "author",  $id, $prefix, $item["author"])."\n".
+    "  ".stGetFormTextInput(20, SQL_LEN_NEWS_AUTHOR, "author",  $id, $prefix, $item["author"])."\n".
     "  ".stGetFormButtonInput("", "upd".$id, $prefix, "Update", "updateNews(".$id.")")."\n".
     "  ".stGetFormButtonInput("", "del".$id, $prefix, "Delete", "deleteNews(".$id.")")."\n";
 }
@@ -267,8 +267,8 @@
     case COMPO_NORMAL:
       echo
       "   <div class=\"entryCell entryBasic\">\n".
-      "   ".stGetEditFormTextInput($mode, "Name", 20, SET_LEN_ENTRY_NAME, "name", $eid, $prefix, $item["name"])."\n".
-      "   ".stGetEditFormTextInput($mode, "Author", 20, SET_LEN_ENTRY_AUTHOR, "author", $eid, $prefix, $item["author"])."\n".
+      "   ".stGetEditFormTextInput($mode, "Name", 20, SQL_LEN_ENTRY_NAME, "name", $eid, $prefix, $item["name"])."\n".
+      "   ".stGetEditFormTextInput($mode, "Author", 20, SQL_LEN_ENTRY_AUTHOR, "author", $eid, $prefix, $item["author"])."\n".
       "   </div>\n".
       "   <div class=\"entryCell entryFiles\">\n".
       ($mode == 2 ? "Files can be uploaded after adding the entry" : "").
@@ -332,10 +332,10 @@
     case COMPO_ASSIGN:
       echo
       "   <div class=\"entryCell entryBase\">".
-      stGetEditFormTextInput($mode, "Name", 15, SET_LEN_ENTRY_AUTHOR, "name", $eid, $prefix, $item["name"]).
+      stGetEditFormTextInput($mode, "Name", 15, SQL_LEN_ENTRY_AUTHOR, "name", $eid, $prefix, $item["name"]).
       "</div>\n".
       "   <div class=\"entryCell entryEvalue\">".
-      stGetEditFormTextInput($mode, $compoModeData[$compo["ctype"]][2], 5, SET_LEN_ENTRY_AUTHOR, "evalue", $eid, $prefix, $item["evalue"]).
+      stGetEditFormTextInput($mode, $compoModeData[$compo["ctype"]][2], 5, SQL_LEN_ENTRY_AUTHOR, "evalue", $eid, $prefix, $item["evalue"]).
       "</div>\n".
       "   <div class=\"entryCell entryNotes\">\n".
       "    ".stGetEditFormTextArea($mode, "Notes", 2, 30, "notes", $eid, $prefix, $item["notes"])."\n".
@@ -610,7 +610,7 @@
   $str =
     ($outer ? $indent."<div class=\"ctrlBox\" id=\"ctrlRotationListEdit\">\n" : "").
     $indent."  <div class=\"ctrlTitle\">Edit rotation list</div>\n".
-    $indent."  ".stGetFormTextInput(30, SET_LEN_ROT_LIST_NAME, "", "ctrlEDRotationListName", "", $data["name"])."\n".
+    $indent."  ".stGetFormTextInput(30, SQL_LEN_ROT_LIST_NAME, "", "ctrlEDRotationListName", "", $data["name"])."\n".
     $indent."  ".stGetFormButtonInput("updname", "", "", "Save", "updateRotationList(".$list_id.")")."\n".
     "<div>Available slides:</div>\n".
     stGetFormOptionListStart("ctrlEDDisplaySlides", $indent."  ", TRUE);
@@ -692,7 +692,7 @@
   if (($slide = stFetchSQL($sql)) !== FALSE)
   {
     $str .=
-      "    ".stGetFormTextInput(40, SET_LEN_DISP_SLIDE_TITLE, "", "Title", $prefix, $slide["title"])."<br />\n".
+      "    ".stGetFormTextInput(40, SQL_LEN_DISP_SLIDE_TITLE, "", "Title", $prefix, $slide["title"])."<br />\n".
       "    ".stGetFormTextArea(10, 80, "", "Text", $prefix, $slide["text"])."<br />\n";
   }
 
@@ -1057,10 +1057,10 @@
         if (stChkRequestItem("id", $slide_id, array(CHK_TYPE, VT_INT, "Invalid data.")) &&
             stChkRequestItem("title", $fake,
               array(CHK_GTEQ, VT_STR, 1, "Slide title too short."),
-              array(CHK_LTEQ, VT_STR, SET_LEN_DISP_SLIDE_TITLE, "Slide title too long.")
+              array(CHK_LTEQ, VT_STR, SQL_LEN_DISP_SLIDE_TITLE, "Slide title too long.")
             ) &&
             stChkRequestItem("text", $fake,
-              array(CHK_LTEQ, VT_STR, SET_LEN_DISP_SLIDE_TEXT, "Slide content too long.")
+              array(CHK_LTEQ, VT_STR, SQL_LEN_DISP_SLIDE_TEXT, "Slide content too long.")
             ))
         {
           $sql = stPrepareSQLUpdate("display_slides",
@@ -1106,7 +1106,7 @@
         if (stChkRequestItem("id", $list_id, array(CHK_TYPE, VT_INT, "Invalid data.")) &&
             stChkRequestItem("name", $fake,
               array(CHK_GTEQ, VT_STR, 3, "Rotation list name too short."),
-              array(CHK_LTEQ, VT_STR, SET_LEN_ROT_LIST_NAME, "Rotation list name too long.")))
+              array(CHK_LTEQ, VT_STR, SQL_LEN_ROT_LIST_NAME, "Rotation list name too long.")))
         {
           $sql = stPrepareSQLUpdate("rot_list_data",
             "WHERE id=".$list_id,
@@ -1325,9 +1325,9 @@
       case "news":
         echo
           "<form method=\"post\" action=\"\" onsubmit=\"return addNews()\">\n".
-          "  ".stGetFormTextInput(40, SET_LEN_NEWS_TITLE, "", "nntitle", "", "")."<br />\n".
+          "  ".stGetFormTextInput(40, SQL_LEN_NEWS_TITLE, "", "nntitle", "", "")."<br />\n".
           "  ".stGetFormTextArea(5, 60, "", "nntext", "", "")."<br />\n".
-          "  ".stGetFormTextInput(20, SET_LEN_NEWS_AUTHOR, "", "nnauthor", "", "orgaz")."\n".
+          "  ".stGetFormTextInput(20, SQL_LEN_NEWS_AUTHOR, "", "nnauthor", "", "orgaz")."\n".
           "  ".stGetFormSubmitInput("nnadd", "Add post")."\n".
           "  ".stGetFormButtonInput("", "", "", "Clear", "this.form.reset()")."\n".
           "</form>\n".
@@ -1367,10 +1367,10 @@
           "  <th>Actions</th>\n".
           " </tr>\n".
           " <tr>\n".
-          "  <td>".stGetFormTextInput(20, SET_LEN_USERNAME, "name", "x", $prefix, "")."</td>\n".
-          "  <td>".stGetFormTextInput(20, SET_LEN_GROUPS,   "groups", "x", $prefix, "")."</td>\n".
-          "  <td>".stGetFormTextInput(30, SET_LEN_ONELINER, "oneliner", "x", $prefix, "")."</td>\n".
-          "  <td>".stGetFormTextInput(20, SET_LEN_EMAIL,    "email", "x", $prefix, "")."</td>\n".
+          "  <td>".stGetFormTextInput(20, SQL_LEN_USERNAME, "name", "x", $prefix, "")."</td>\n".
+          "  <td>".stGetFormTextInput(20, SQL_LEN_GROUPS,   "groups", "x", $prefix, "")."</td>\n".
+          "  <td>".stGetFormTextInput(30, SQL_LEN_ONELINER, "oneliner", "x", $prefix, "")."</td>\n".
+          "  <td>".stGetFormTextInput(20, SQL_LEN_EMAIL,    "email", "x", $prefix, "")."</td>\n".
           "  <td>".stGetFormButtonInput("add", "", $prefix, " Add new ", "addAttendee()")."</td>\n".
           " </tr>\n".
           "</table>\n".
@@ -1531,7 +1531,7 @@
         echo
           "<form method=\"post\" action=\"\" onsubmit=\"return addCompo()\">\n".
           "<b>Name:<b>".
-          "  ".stGetFormTextInput(64, SET_LEN_COMPO_NAME, "", "ncname", "", "")."<br />\n".
+          "  ".stGetFormTextInput(64, SQL_LEN_COMPO_NAME, "", "ncname", "", "")."<br />\n".
           "<b>Description:</b>".
           "  ".stGetFormTextArea(5, 60, "", "ncdescription", "", "")."<br />\n".
           "  ".stGetFormSubmitInput("nccompo", "Add compo")."\n".