Mercurial > hg > fapweb
comparison admajax.php @ 1120:b2bca5f6d0ff default tip
Cosmetic cleanup: remove trailing whitespace.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 13 Dec 2020 13:47:13 +0200 |
parents | a4daa7ea7479 |
children |
comparison
equal
deleted
inserted
replaced
1119:a4daa7ea7479 | 1120:b2bca5f6d0ff |
---|---|
93 stChkRequestItemFail("preview_type", $fake, $res, | 93 stChkRequestItemFail("preview_type", $fake, $res, |
94 array(CHK_TYPE, VT_INT, "Invalid data."), | 94 array(CHK_TYPE, VT_INT, "Invalid data."), |
95 array(CHK_RANGE, VT_INT, array(EPREV_NONE, EPREV_AUDIO), "Invalid preview type value.")); | 95 array(CHK_RANGE, VT_INT, array(EPREV_NONE, EPREV_AUDIO), "Invalid preview type value.")); |
96 } | 96 } |
97 break; | 97 break; |
98 | 98 |
99 case COMPO_POINTS: | 99 case COMPO_POINTS: |
100 stChkRequestItemFail("evalue", $fake, $res, | 100 stChkRequestItemFail("evalue", $fake, $res, |
101 array(CHK_TYPE, VT_INT, "Invalid points value, must be a valid integer.")); | 101 array(CHK_TYPE, VT_INT, "Invalid points value, must be a valid integer.")); |
102 break; | 102 break; |
103 | 103 |
137 global $compoModeData, $previewTypeList; | 137 global $compoModeData, $previewTypeList; |
138 | 138 |
139 switch ($item["ctype"]) | 139 switch ($item["ctype"]) |
140 { | 140 { |
141 case COMPO_NORMAL: | 141 case COMPO_NORMAL: |
142 $str1 = | 142 $str1 = |
143 " File path: ".stGetFormTextInput(40, SQL_LEN_COMPO_PATH, "cpath", $id, $prefix, $item["cpath"])."<br />\n"; | 143 " File path: ".stGetFormTextInput(40, SQL_LEN_COMPO_PATH, "cpath", $id, $prefix, $item["cpath"])."<br />\n"; |
144 | 144 |
145 $str2 = | 145 $str2 = |
146 " ".stGetFormCheckBoxInput("voting", $id, $prefix, $item["voting"], | 146 " ".stGetFormCheckBoxInput("voting", $id, $prefix, $item["voting"], |
147 "Enable voting", "onChange=\"setCompoData(".$id.",'voting')\""). | 147 "Enable voting", "onChange=\"setCompoData(".$id.",'voting')\""). |
259 if ($mode != EEMODE_ADD && $compo["ctype"] == COMPO_NORMAL) | 259 if ($mode != EEMODE_ADD && $compo["ctype"] == COMPO_NORMAL) |
260 { | 260 { |
261 echo | 261 echo |
262 " <div class=\"entryCell entryShowID\">".($item["show_id"] > 0 ? $item["show_id"] : "-")."</div>\n"; | 262 " <div class=\"entryCell entryShowID\">".($item["show_id"] > 0 ? $item["show_id"] : "-")."</div>\n"; |
263 } | 263 } |
264 | 264 |
265 switch ($compo["ctype"]) | 265 switch ($compo["ctype"]) |
266 { | 266 { |
267 case COMPO_NORMAL: | 267 case COMPO_NORMAL: |
268 echo | 268 echo |
269 " <div class=\"entryCell entryBasic\">\n". | 269 " <div class=\"entryCell entryBasic\">\n". |
322 | 322 |
323 echo | 323 echo |
324 stGetFormOptionListEnd(" ", TRUE). | 324 stGetFormOptionListEnd(" ", TRUE). |
325 "</div>\n"; | 325 "</div>\n"; |
326 } | 326 } |
327 | 327 |
328 echo "</div>\n"; | 328 echo "</div>\n"; |
329 break; | 329 break; |
330 | 330 |
331 case COMPO_POINTS: | 331 case COMPO_POINTS: |
332 case COMPO_ASSIGN: | 332 case COMPO_ASSIGN: |
333 echo | 333 echo |
334 " <div class=\"entryCell entryBase\">". | 334 " <div class=\"entryCell entryBase\">". |
335 stGetEditFormTextInput($mode, "Name", 15, SQL_LEN_ENTRY_AUTHOR, "name", $eid, $prefix, $item["name"]). | 335 stGetEditFormTextInput($mode, "Name", 15, SQL_LEN_ENTRY_AUTHOR, "name", $eid, $prefix, $item["name"]). |
364 case EEMODE_EDIT: | 364 case EEMODE_EDIT: |
365 echo | 365 echo |
366 stGetFormButtonInput("update", $eid, $prefix, "Update", "updateEntry(".$item["compo_id"].",".$eid.", 0)"). | 366 stGetFormButtonInput("update", $eid, $prefix, "Update", "updateEntry(".$item["compo_id"].",".$eid.", 0)"). |
367 stGetFormButtonInput("delete", $eid, $prefix, "Delete", "deleteEntry(".$item["compo_id"].",".$eid.")"); | 367 stGetFormButtonInput("delete", $eid, $prefix, "Delete", "deleteEntry(".$item["compo_id"].",".$eid.")"); |
368 break; | 368 break; |
369 | 369 |
370 case EEMODE_ADD: | 370 case EEMODE_ADD: |
371 echo | 371 echo |
372 stGetFormButtonInput("add", $item["compo_id"], $prefix, "Add new", "addEntry(".$item["compo_id"].")"); | 372 stGetFormButtonInput("add", $item["compo_id"], $prefix, "Add new", "addEntry(".$item["compo_id"].")"); |
373 break; | 373 break; |
374 } | 374 } |
381 | 381 |
382 | 382 |
383 function stGetUserKeyClass($item) | 383 function stGetUserKeyClass($item) |
384 { | 384 { |
385 global $setUserKeyMode; | 385 global $setUserKeyMode; |
386 | 386 |
387 switch ($setUserKeyMode) | 387 switch ($setUserKeyMode) |
388 { | 388 { |
389 case VOTE_FREELY: | 389 case VOTE_FREELY: |
390 $cond = 0; | 390 $cond = 0; |
391 break; | 391 break; |
407 | 407 |
408 function stGetUserKeyInfo() | 408 function stGetUserKeyInfo() |
409 { | 409 { |
410 $nkeys = stFetchSQLColumn("SELECT COUNT(*) FROM userkeys WHERE active=1"); | 410 $nkeys = stFetchSQLColumn("SELECT COUNT(*) FROM userkeys WHERE active=1"); |
411 $totalKeys = stFetchSQLColumn("SELECT COUNT(*) FROM userkeys"); | 411 $totalKeys = stFetchSQLColumn("SELECT COUNT(*) FROM userkeys"); |
412 | 412 |
413 $nvoters = stFetchSQLColumn("SELECT COUNT(DISTINCT(key_id)) FROM votes"); | 413 $nvoters = stFetchSQLColumn("SELECT COUNT(DISTINCT(key_id)) FROM votes"); |
414 | 414 |
415 return | 415 return |
416 "Info: <b>".$nkeys."</b> of <b>".$totalKeys."</b> userkeys are activated. ". | 416 "Info: <b>".$nkeys."</b> of <b>".$totalKeys."</b> userkeys are activated. ". |
417 "Also, <b>".$nvoters."</b> keys have been used for voting."; | 417 "Also, <b>".$nvoters."</b> keys have been used for voting."; |
436 if ($setUserKeyMode == VOTE_ACTIVATE) | 436 if ($setUserKeyMode == VOTE_ACTIVATE) |
437 { | 437 { |
438 $str .= stGetFormCheckBoxInput("active", $id, $prefix, $item["active"], FALSE, | 438 $str .= stGetFormCheckBoxInput("active", $id, $prefix, $item["active"], FALSE, |
439 "class=\"keyactive\" onChange=\"userKeySetActive(".$id.")\"", ""); | 439 "class=\"keyactive\" onChange=\"userKeySetActive(".$id.")\"", ""); |
440 } | 440 } |
441 | 441 |
442 return $str; | 442 return $str; |
443 | 443 |
444 case VOTE_ASSIGN: | 444 case VOTE_ASSIGN: |
445 $str = | 445 $str = |
446 " <td class=\"name\">".chentities($item["name"])."</td>\n". | 446 " <td class=\"name\">".chentities($item["name"])."</td>\n". |
449 stGetFormTextInput(5, 5, "key_id", $id, $prefix, $item["key_id"]). | 449 stGetFormTextInput(5, 5, "key_id", $id, $prefix, $item["key_id"]). |
450 stGetFormButtonInput("assign", $id, $prefix, "Set", "userKeyAssign(".$id.",1)"); | 450 stGetFormButtonInput("assign", $id, $prefix, "Set", "userKeyAssign(".$id.",1)"); |
451 | 451 |
452 if ($item["key_id"] != 0) | 452 if ($item["key_id"] != 0) |
453 $str .= stGetFormButtonInput("clear", $id, $prefix, "Clear", "userKeyAssign(".$id.",0)"); | 453 $str .= stGetFormButtonInput("clear", $id, $prefix, "Clear", "userKeyAssign(".$id.",0)"); |
454 | 454 |
455 $str .= | 455 $str .= |
456 "</td>\n". | 456 "</td>\n". |
457 " <td class=\"vkey\">"; | 457 " <td class=\"vkey\">"; |
458 | 458 |
459 if ($item["key_id"] > 0) | 459 if ($item["key_id"] > 0) |
554 $item["show_id"], | 554 $item["show_id"], |
555 substr($item["name"], 0, 25), | 555 substr($item["name"], 0, 25), |
556 substr($item["author"], 0, 15))); | 556 substr($item["author"], 0, 15))); |
557 } | 557 } |
558 } | 558 } |
559 | 559 |
560 return $str.stGetFormOptionListEnd($indent, $outer); | 560 return $str.stGetFormOptionListEnd($indent, $outer); |
561 } | 561 } |
562 | 562 |
563 | 563 |
564 function stGetInfoRotationLists($indent, $outer) | 564 function stGetInfoRotationLists($indent, $outer) |
604 function stGetInfoRotationListEditFull($indent, $outer, $list_id) | 604 function stGetInfoRotationListEditFull($indent, $outer, $list_id) |
605 { | 605 { |
606 $sql = stPrepareSQL("SELECT * FROM rot_list_data WHERE id=%d", $list_id); | 606 $sql = stPrepareSQL("SELECT * FROM rot_list_data WHERE id=%d", $list_id); |
607 if (($data = stFetchSQL($sql)) === FALSE) | 607 if (($data = stFetchSQL($sql)) === FALSE) |
608 return "<p>No such rotation list ID #".intval($list_id)."</p>"; | 608 return "<p>No such rotation list ID #".intval($list_id)."</p>"; |
609 | 609 |
610 $str = | 610 $str = |
611 ($outer ? $indent."<div class=\"ctrlBox\" id=\"ctrlRotationListEdit\">\n" : ""). | 611 ($outer ? $indent."<div class=\"ctrlBox\" id=\"ctrlRotationListEdit\">\n" : ""). |
612 $indent." <div class=\"ctrlTitle\">Edit rotation list</div>\n". | 612 $indent." <div class=\"ctrlTitle\">Edit rotation list</div>\n". |
613 $indent." ".stGetFormTextInput(30, SQL_LEN_ROT_LIST_NAME, "", "ctrlEDRotationListName", "", $data["name"])."\n". | 613 $indent." ".stGetFormTextInput(30, SQL_LEN_ROT_LIST_NAME, "", "ctrlEDRotationListName", "", $data["name"])."\n". |
614 $indent." ".stGetFormButtonInput("updname", "", "", "Save", "updateRotationList(".$list_id.")")."\n". | 614 $indent." ".stGetFormButtonInput("updname", "", "", "Save", "updateRotationList(".$list_id.")")."\n". |
664 | 664 |
665 function stGetInfoActiveRotationList($indent, $outer) | 665 function stGetInfoActiveRotationList($indent, $outer) |
666 { | 666 { |
667 $sql = stPrepareSQL("SELECT * FROM rot_list_data WHERE id=%d", | 667 $sql = stPrepareSQL("SELECT * FROM rot_list_data WHERE id=%d", |
668 stGetDisplayVar("rotateList")); | 668 stGetDisplayVar("rotateList")); |
669 | 669 |
670 $str = $indent.($outer ? "<div id=\"ctrlActiveRotationList\">" : ""). | 670 $str = $indent.($outer ? "<div id=\"ctrlActiveRotationList\">" : ""). |
671 "<b>Active list:</b> "; | 671 "<b>Active list:</b> "; |
672 | 672 |
673 if (($slist = stFetchSQL($sql)) === FALSE) | 673 if (($slist = stFetchSQL($sql)) === FALSE) |
674 $str .= "-"; | 674 $str .= "-"; |
701 " ".stGetFormSubmitInput("createslide", "Save slide")."\n". | 701 " ".stGetFormSubmitInput("createslide", "Save slide")."\n". |
702 " ".stGetFormButtonInput("cancelslide", "", "", "Close / Cancel", "jsCloseAdminPopup()")."\n". | 702 " ".stGetFormButtonInput("cancelslide", "", "", "Close / Cancel", "jsCloseAdminPopup()")."\n". |
703 " </div>\n". | 703 " </div>\n". |
704 " </form>\n". | 704 " </form>\n". |
705 ($outer ? "</div>\n" : ""); | 705 ($outer ? "</div>\n" : ""); |
706 | 706 |
707 return $str; | 707 return $str; |
708 } | 708 } |
709 | 709 |
710 | 710 |
711 function stGetSaveButton() | 711 function stGetSaveButton() |
857 // | 857 // |
858 $errors = 0; | 858 $errors = 0; |
859 echo | 859 echo |
860 "<h1>Competitions / voting</h1>\n". | 860 "<h1>Competitions / voting</h1>\n". |
861 "<ul>\n"; | 861 "<ul>\n"; |
862 | 862 |
863 echo "<li>".(stGetSetting("allowVoting") ? "Voting <b>IS ENABLED</b>." : "Voting is NOT enabled!")."</li>\n"; | 863 echo "<li>".(stGetSetting("allowVoting") ? "Voting <b>IS ENABLED</b>." : "Voting is NOT enabled!")."</li>\n"; |
864 | 864 |
865 if (($compos = stExecSQL("SELECT * FROM compos")) === FALSE) | 865 if (($compos = stExecSQL("SELECT * FROM compos")) === FALSE) |
866 stError("Eh? SQL error occured."); | 866 stError("Eh? SQL error occured."); |
867 else | 867 else |
874 echo "<li>Compo <b>#".$compo["id"]." - ".$compo["name"]."</b> has NO show order set for some entries.</li>\n"; | 874 echo "<li>Compo <b>#".$compo["id"]." - ".$compo["name"]."</b> has NO show order set for some entries.</li>\n"; |
875 $errors++; | 875 $errors++; |
876 } | 876 } |
877 } | 877 } |
878 } | 878 } |
879 | 879 |
880 $nenabled = stFetchSQLColumn("SELECT COUNT(*) FROM compos WHERE visible<>0 AND voting<>0"); | 880 $nenabled = stFetchSQLColumn("SELECT COUNT(*) FROM compos WHERE visible<>0 AND voting<>0"); |
881 if ($nenabled == 0) | 881 if ($nenabled == 0) |
882 echo "<li>No competitions that are visible and enabled for voting.</li>\n"; | 882 echo "<li>No competitions that are visible and enabled for voting.</li>\n"; |
883 | 883 |
884 $nenabled = stFetchSQLColumn("SELECT COUNT(*) FROM compos WHERE visible=0 AND voting<>0"); | 884 $nenabled = stFetchSQLColumn("SELECT COUNT(*) FROM compos WHERE visible=0 AND voting<>0"); |
908 } | 908 } |
909 } | 909 } |
910 if ($ncompos > 0) | 910 if ($ncompos > 0) |
911 echo "<li>NON-VOTING COMPOS: <b>".$nentries."</b> entries/participants in <b>".$ncompos."</b> compos.</li>\n"; | 911 echo "<li>NON-VOTING COMPOS: <b>".$nentries."</b> entries/participants in <b>".$ncompos."</b> compos.</li>\n"; |
912 | 912 |
913 | 913 |
914 if ($errors == 0) | 914 if ($errors == 0) |
915 echo "<li>No errors/warnings detected.</li>\n"; | 915 echo "<li>No errors/warnings detected.</li>\n"; |
916 | 916 |
917 echo "</ul>\n"; | 917 echo "</ul>\n"; |
918 | 918 |
919 break; | 919 break; |
920 | 920 |
921 case "ctrl": | 921 case "ctrl": |
922 // | 922 // |
923 // Party information system control | 923 // Party information system control |
1163 stChkRequestItem("slide_id", $slide_id, array(CHK_TYPE, VT_INT, "Invalid data.")) && | 1163 stChkRequestItem("slide_id", $slide_id, array(CHK_TYPE, VT_INT, "Invalid data.")) && |
1164 stChkRequestItem("order_num", $order_num, array(CHK_TYPE, VT_INT, "Invalid data."))) | 1164 stChkRequestItem("order_num", $order_num, array(CHK_TYPE, VT_INT, "Invalid data."))) |
1165 { | 1165 { |
1166 $sql = stPrepareSQL("DELETE FROM rot_list_slides WHERE list_id=%d AND slide_id=%d AND order_num=%d", | 1166 $sql = stPrepareSQL("DELETE FROM rot_list_slides WHERE list_id=%d AND slide_id=%d AND order_num=%d", |
1167 $list_id, $slide_id, $order_num); | 1167 $list_id, $slide_id, $order_num); |
1168 | 1168 |
1169 if (stExecSQLCond($sql, "List slide refs deleted.")) | 1169 if (stExecSQLCond($sql, "List slide refs deleted.")) |
1170 { | 1170 { |
1171 stNormalizeListSlideOrder($list_id); | 1171 stNormalizeListSlideOrder($list_id); |
1172 stDisplayUpdated(); | 1172 stDisplayUpdated(); |
1173 } | 1173 } |
1188 break; | 1188 break; |
1189 | 1189 |
1190 case "infoCurrEntryList": | 1190 case "infoCurrEntryList": |
1191 echo stGetInfoCurrEntryList("", FALSE); | 1191 echo stGetInfoCurrEntryList("", FALSE); |
1192 break; | 1192 break; |
1193 | 1193 |
1194 case "infoRotationLists": | 1194 case "infoRotationLists": |
1195 echo stGetInfoRotationLists("", FALSE); | 1195 echo stGetInfoRotationLists("", FALSE); |
1196 break; | 1196 break; |
1197 | 1197 |
1198 case "infoDisplaySlides": | 1198 case "infoDisplaySlides": |
1199 echo stGetInfoDisplaySlides("", FALSE); | 1199 echo stGetInfoDisplaySlides("", FALSE); |
1200 break; | 1200 break; |
1201 | 1201 |
1202 case "infoRotationListEdit": | 1202 case "infoRotationListEdit": |
1472 | 1472 |
1473 echo | 1473 echo |
1474 "<div class=\"info\">". | 1474 "<div class=\"info\">". |
1475 "User key length ".stGetSetting("userKeyLength")." ". | 1475 "User key length ".stGetSetting("userKeyLength")." ". |
1476 "<b>Voting mode: "; | 1476 "<b>Voting mode: "; |
1477 | 1477 |
1478 if (isset($voteModeData[$setUserKeyMode])) | 1478 if (isset($voteModeData[$setUserKeyMode])) |
1479 echo $voteModeData[$setUserKeyMode][0]."</b>. ".$voteModeData[$setUserKeyMode][1]; | 1479 echo $voteModeData[$setUserKeyMode][0]."</b>. ".$voteModeData[$setUserKeyMode][1]; |
1480 else | 1480 else |
1481 echo "VOTE MODE NOT SET! CHECK CONFIGURATION!</b>"; | 1481 echo "VOTE MODE NOT SET! CHECK CONFIGURATION!</b>"; |
1482 | 1482 |
1625 stGetSaveButton(); | 1625 stGetSaveButton(); |
1626 } | 1626 } |
1627 echo "</form>\n"; | 1627 echo "</form>\n"; |
1628 } | 1628 } |
1629 break; | 1629 break; |
1630 | 1630 |
1631 case "compolist": | 1631 case "compolist": |
1632 $index = 0; | 1632 $index = 0; |
1633 foreach (stExecSQL("SELECT * FROM compos") as $compo) | 1633 foreach (stExecSQL("SELECT * FROM compos") as $compo) |
1634 { | 1634 { |
1635 $ne = stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"]); | 1635 $ne = stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"]); |
1889 "show_authors" => "B", | 1889 "show_authors" => "B", |
1890 "preview_type" => "D", | 1890 "preview_type" => "D", |
1891 "cpath" => "S", | 1891 "cpath" => "S", |
1892 ); | 1892 ); |
1893 break; | 1893 break; |
1894 | 1894 |
1895 default: | 1895 default: |
1896 $cdata = array(); | 1896 $cdata = array(); |
1897 break; | 1897 break; |
1898 } | 1898 } |
1899 | 1899 |
1900 $sql = stPrepareSQLUpdate("compos", | 1900 $sql = stPrepareSQLUpdate("compos", |
1901 "WHERE id=".$id, | 1901 "WHERE id=".$id, |
1902 array_merge(array( | 1902 array_merge(array( |
1903 "name" => "S", | 1903 "name" => "S", |
1904 "description" => "Q", | 1904 "description" => "Q", |
1980 | 1980 |
1981 case "clear": | 1981 case "clear": |
1982 $sql = stPrepareSQL("UPDATE attendees SET key_id=NULL WHERE id=%d", $id); | 1982 $sql = stPrepareSQL("UPDATE attendees SET key_id=NULL WHERE id=%d", $id); |
1983 stExecSQLCond($sql, "Assigned key cleared."); | 1983 stExecSQLCond($sql, "Assigned key cleared."); |
1984 break; | 1984 break; |
1985 | 1985 |
1986 case "active": | 1986 case "active": |
1987 // Autobots activate! | 1987 // Autobots activate! |
1988 $sql = stPrepareSQL("UPDATE userkeys SET active=%B WHERE id=%d", "active", $id); | 1988 $sql = stPrepareSQL("UPDATE userkeys SET active=%B WHERE id=%d", "active", $id); |
1989 stExecSQLCond($sql, "Userkey status changed."); | 1989 stExecSQLCond($sql, "Userkey status changed."); |
1990 break; | 1990 break; |