annotate admajax.php @ 204:fa94536c060b

More cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 17 Nov 2013 18:11:46 +0200
parents d75db79e6e64
children 77d33161f8be
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 <?
56
243e9a51920b Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
2 //
136
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
3 // FAPWeb Simple Demoparty System
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
4 // Party administration page AJAX backend module
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
5 // (C) Copyright 2012-2013 Tecnic Software productions (TNSP)
56
243e9a51920b Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
6 //
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
7 $sessionType = "admin";
175
8df523e6326a User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
8 require_once "mconfig.inc.php";
8df523e6326a User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
9 require_once "msite.inc.php";
8df523e6326a User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
10 require_once "msession.inc.php";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 // Check if we are allowed to execute
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
13 if (!stCheckHTTPS() || !stAdmSessionAuth())
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 {
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
15 stSetupCacheControl();
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
16
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
17 stSessionEnd(SESS_ADMIN);
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
18
123
5837b9333964 Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
19 header("Location: ".stGetSetting("defaultPage"));
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 exit;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
23 stSetupCacheControl();
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
25 // Initiate SQL database connection
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 if (!stConnectSQLDB())
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 die("Could not connect to SQL database.");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
29 // Fetch non-"hardcoded" settings from SQL database
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
30 stReloadSettings();
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
31
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32
16
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
33 function saveButton()
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
34 {
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
35 return "<input type=\"submit\" value=\" Save \" />\n";
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
36 }
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
37
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
38
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 // XMLHttp responses
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 $action = "ERROR";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 if (stChkRequestItem("action") && stChkRequestItem("type"))
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 $action = $_REQUEST["action"];
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 $type = $_REQUEST["type"];
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 switch ($action)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 case "dump":
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
51 //
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
52 // Perform generic data dump
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
53 //
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
54 if (($res = stExecSQLCond(
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 "SELECT * FROM attendees WHERE email NOT NULL AND email != '' ORDER BY regtime DESC",
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 "Dump OK.")) !== FALSE)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 $out1 = array();
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 $out2 = array();
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 foreach ($res as $item)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 {
133
cf53c6c7b797 Use chentities() here.
Matti Hamalainen <ccr@tnsp.org>
parents: 128
diff changeset
63 $out1[] = chentities($item["name"])." &lt;".chentities($item["email"])."&gt;";
cf53c6c7b797 Use chentities() here.
Matti Hamalainen <ccr@tnsp.org>
parents: 128
diff changeset
64 $out2[] = chentities($item["email"]);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 echo "<br /><hr />".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 implode(", ", $out1)."<br /><hr /><br />".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 implode("<br />", $out1)."<br /><hr /><br />".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 implode(", ", $out2)."<br /><hr /><br />".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 implode("<br />", $out2)."<br /><hr />";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 break;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 case "get":
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
77 //
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
78 // Get specific data
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
79 //
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 switch ($type)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 case "news":
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 $sql = "SELECT * FROM news ORDER BY utime DESC";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 break;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 case "attendees":
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 $sql = "SELECT * FROM attendees ORDER BY regtime DESC";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 break;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
90 case "voters":
116
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
91 $sqlJoins = "";
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
92 switch (stGetSetting("voteKeyMode"))
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
93 {
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
94 case VOTE_FREELY:
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
95 break;
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
96
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
97 case VOTE_ACTIVATE:
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
98 break;
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
99
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
100 case VOTE_ASSIGN:
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
101 $sqlJoins = "LEFT JOIN attendees ON votekeys.voter_id=attendees.id ";
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
102 break;
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
103 }
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
104 $sql = "SELECT * FROM votekeys ".$sqlJoins."ORDER BY votekeys.id ASC";
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
105 break;
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
106
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 case "compos":
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 $sql = "SELECT * FROM compos ORDER BY id DESC";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 break;
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
110
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
111 case "settings":
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
112 $prefix = "st";
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
113
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
114 echo
16
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
115 "<h1>Site settings</h1>\n".
201
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
116 "<form method=\"post\" action=\"\" onsubmit=\"return updateSettings()\">\n".
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
117 "<table>\n";
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
118 foreach (stExecSQL("SELECT * FROM settings WHERE vtype<>".VT_TEXT) as $item)
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
119 {
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
120 echo
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
121 " <tr>\n".
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
122 " <td>";
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
123 $id = $item["key"];
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
124 switch ($item["vtype"])
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
125 {
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
126 case VT_INT:
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
127 echo stGetFormTextInput(10, 10, "", $id, $prefix, $item["vint"]);
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
128 break;
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
129 case VT_STR:
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
130 echo stGetFormTextInput(40, 128, "", $id, $prefix, $item["vstr"]);
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
131 break;
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
132 case VT_BOOL:
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
133 echo stGetFormCheckBoxInput("", $id, $prefix, $item["vint"], "");
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
134 break;
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
135 }
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
136 echo "</td>\n".
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
137 " <td>".$item["desc"]."</td>\n".
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
138 " </tr>\n";
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
139 }
16
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
140 echo "</table>\n".saveButton();
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
141
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
142 foreach (stExecSQL("SELECT * FROM settings WHERE vtype=".VT_TEXT) as $item)
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
143 {
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
144 echo "<h2>".chentities($item["desc"])."</h2>\n".
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
145 stGetFormTextArea(10, 60, "", $item["key"], $prefix, $item["vtext"]).
16
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
146 "\n<br />\n".saveButton();
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
147 }
201
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
148 echo "</form>\n";
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
149 break;
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 case "entries":
24
5bc8bd5c7ecc Make voting toggle for individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents: 20
diff changeset
152 stGetCompoList(FALSE, FALSE);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 foreach ($compos as $id => $compo)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 echo
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 "<form>\n".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 " <table class=\"misc\">\n".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 " <tr>\n".
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
160 " <th colspan=\"5\">#".$id." - ".chentities($compo["name"])."</th>\n".
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 " </tr>\n".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 " <tr>\n".
113
671330b7f5d1 Add "show_id" to compo entries, to designate the position they were shown at
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
163 " <th style=\"width:4%;\">ID#</th>\n".
671330b7f5d1 Add "show_id" to compo entries, to designate the position they were shown at
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
164 " <th style=\"width:4%;\">S#</th>\n".
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 " <th>Title</th>\n".
29
4b5a176805e2 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 26
diff changeset
166 " <th>Author(s)</th>\n".
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
167 " <th>Filename</th>\n".
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168 " <th>Actions</th>\n".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 " </tr>\n";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 $prefix = "en";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 foreach ($compo["entries"] as $eid => $entry)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 echo
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 " <tr id=\"entry".$eid."\">\n".
113
671330b7f5d1 Add "show_id" to compo entries, to designate the position they were shown at
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
176 " <td>".$eid."</td>\n".
671330b7f5d1 Add "show_id" to compo entries, to designate the position they were shown at
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
177 " <td>".($entry["show_id"] > 0 ? $entry["show_id"] : "-")."</td>\n".
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
178 " <td>".stGetFormTextInput(30, 64, "name", $eid, "en", $entry["name"])."</td>\n".
29
4b5a176805e2 Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 26
diff changeset
179 " <td>".stGetFormTextInput(30, 64, "author", $eid, "en", $entry["author"])."</td>\n".
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
180 " <td>".stGetFormTextInput(20, 64, "filename", $eid, "en", $entry["filename"])."</td>\n".
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 " <td>".
113
671330b7f5d1 Add "show_id" to compo entries, to designate the position they were shown at
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
182 stGetFormButtonInput("delete", $eid, $prefix, " Del ", "deleteEntry(".$eid.")").
671330b7f5d1 Add "show_id" to compo entries, to designate the position they were shown at
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
183 stGetFormTextInput(3, 3, "compo_id", $eid, "en", $id).
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
184 stGetFormButtonInput("update", $eid, $prefix, " Upd ", "updateEntry(".$eid.")").
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 "</td>\n".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 " </tr>\n";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 }
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
188
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
189 $prefix = "ne";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 echo
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
191 " <tr>\n".
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
192 " <td></td>\n".
113
671330b7f5d1 Add "show_id" to compo entries, to designate the position they were shown at
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
193 " <td></td>\n".
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
194 " <td>".stGetFormTextInput(30, 64, "name", $id, "ne", "")."</td>\n".
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
195 " <td>".stGetFormTextInput(30, 64, "author", $id, "ne", "")."</td>\n".
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
196 " <td>".stGetFormTextInput(20, 64, "filename", $id, "ne", "")."</td>\n".
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
197 " <td>".stGetFormButtonInput("add", $id, $prefix, " Add new ", "addEntry(".$id.")")."</td>\n".
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
198 " </tr>\n".
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 " </table>\n".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 "</form>\n";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 break;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204
56
243e9a51920b Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
205 //
243e9a51920b Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
206 // Perform query if we need to, output results
243e9a51920b Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
207 //
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
208 if (isset($sql) && ($res = stExecSQLCond($sql, "")) !== FALSE)
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 if ($type == "news")
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 {
201
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
212 echo
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
213 "<form method=\"post\" action=\"\" onsubmit=\"return addNews()\">\n".
204
fa94536c060b More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
214 " ".stGetFormTextInput(40, 40, "", "nntitle", "", "")."<br />\n".
fa94536c060b More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
215 " ".stGetFormTextArea(5, 60, "", "nntext", "", "")."<br />\n".
fa94536c060b More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
216 " ".stGetFormTextInput(20, 20, "", "nnauthor", "", "orgaz")."\n".
fa94536c060b More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
217 " ".stGetFormSubmitInput("nnadd", "Add post")."\n".
fa94536c060b More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
218 " ".stGetFormButtonInput("", "", "", "Clear", "this.form.reset()")."\n".
201
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
219 "</form>\n".
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
220 "<hr />\n";
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
221
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
222 foreach ($res as $item)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224 $id = $item["id"];
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 stPrintNewsItem($item,
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 "<br />".
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 " <button class=\"button\" id=\"ndel".$id.
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 "\" type=\"button\" onclick=\"deleteNews(".$id.
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 ")\">Delete</button>\n"
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 );
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 if ($type == "attendees")
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235 {
90
32c4654aad50 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
236 // For adding a new one
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
237 $prefix = "ne";
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
238 echo
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
239 "<table>\n".
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
240 " <tr>\n".
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
241 " <th>Name</th>\n".
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
242 " <th>Groups</th>\n".
82
a071dacdcfc5 Change order of table fields.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
243 " <th>Oneliner</th>\n".
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
244 " <th>E-mail</th>\n".
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
245 " <th>Actions</th>\n".
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
246 " </tr>\n".
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
247 " <tr>\n".
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
248 " <td>".stGetFormTextInput(20, 64, "name", "x", $prefix, "")."</td>\n".
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
249 " <td>".stGetFormTextInput(20, 64, "groups", "x", $prefix, "")."</td>\n".
82
a071dacdcfc5 Change order of table fields.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
250 " <td>".stGetFormTextInput(30, 64, "oneliner", "x", $prefix, "")."</td>\n".
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
251 " <td>".stGetFormTextInput(20, 64, "email", "x", $prefix, "")."</td>\n".
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
252 " <td>".stGetFormButtonInput("add", "", $prefix, " Add new ", "addAttendee()")."</td>\n".
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
253 " </tr>\n".
169
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
254 "</table>\n".
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
255 "<hr />\n";
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
256
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
257 // List of attendees
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
258 echo
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
259 "<table class=\"attendees\">\n".
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
260 " <tr>\n".
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
261 " <th class=\"name\">Name</th>\n".
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
262 " <th class=\"groups\">Groups</th>\n".
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
263 " <th class=\"regtime\">Registered</th>\n".
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
264 " <th class=\"oneliner\">Oneliner</th>\n".
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
265 " <th class=\"email\">E-mail</th>\n".
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
266 " <th>Actions</th>\n".
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
267 " </tr>\n";
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
268
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
269 $row = 0;
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
270 foreach ($res as $item)
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
271 stPrintAttendee($item, $row++, TRUE);
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
272
8db98399bb38 Put the "new attendee" form above the current attendees in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
273 echo
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
274 "</table>\n";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276 else
116
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
277 if ($type == "voters")
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
278 {
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
279 switch (stGetSetting("voteKeyMode"))
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
280 {
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
281 case VOTE_FREELY:
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
282 break;
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
283
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
284 case VOTE_ACTIVATE:
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
285 break;
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
286
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
287 case VOTE_ASSIGN:
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
288 break;
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
289 }
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
290 // List of votekeys
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
291 echo
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
292 "<table class=\"attendees\">\n".
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
293 " <tr>\n".
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
294 " <th class=\"name\">Name</th>\n".
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
295 " <th class=\"groups\">Groups</th>\n".
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
296 " <th class=\"email\">E-mail</th>\n".
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
297 " <th class=\"\">Key</th>\n".
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
298 " </tr>\n";
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
299 $row = 0;
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
300
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
301 echo
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
302 "</table>\n";
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
303 }
a95facb41c86 Some preliminary work on the votekey administration backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
304 else
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 if ($type == "compos")
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306 {
201
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
307 echo
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
308 "<form method=\"post\" action=\"\" onsubmit=\"return addCompo()\">\n".
203
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
309 " ".stGetFormTextInput(64, 64, "", "ncname", "", "")."<br />\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
310 " ".stGetFormTextArea(5, 60, "", "ncdescription", "", "")."<br />\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
311 " ".stGetFormSubmitInput("nccompo", "Add compo")."\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
312 " ".stGetFormButtonInput("", "", "", "Clear", "this.form.reset()")."\n".
201
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
313 "</form>\n".
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
314 "<hr />\n";
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
315
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316 foreach ($res as $item)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 $id = $item["id"];
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319 $prefix = "co";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320 echo
203
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
321 "<div id=\"compo".$id."\">\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
322 "<h2>#".$id." - ".chentities($item["name"])."</h2>\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
323 stGetFormTextInput(40, 64, "name", $id, $prefix, $item["name"])."\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
324 stGetFormCheckBoxInput("visible", $id, $prefix, $item["visible"], "Visible")."\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
325 stGetFormCheckBoxInput("showAuthors", $id, $prefix, $item["showAuthors"], "Show authors")."\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
326 stGetFormCheckBoxInput("voting", $id, $prefix, $item["voting"], "Enable voting")."<br />\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
327 stGetFormTextArea(5, 60, "description", $id, $prefix, $item["description"])."\n<br />\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
328 stGetFormButtonInput("update", $id, $prefix, " Update ", "updateCompo(".$id.")")."\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
329 "</div>\n".
d75db79e6e64 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
330 "<hr />\n";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
331 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
332 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
333 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
334 break;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
335
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
336 case "delete":
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
337 //
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
338 // Delete entry
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
339 //
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
340 if (stChkRequestItem("id"))
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
342 $id = intval(stGetRequestItem("id"));
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344 if ($type == "news")
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
345 {
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346 $sql = stPrepareSQL("DELETE FROM news WHERE id=%d AND persist=0", $id);
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
347 stExecSQLCond($sql, "OK, news item ".$id." deleted.");
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
348 }
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350 if ($type == "attendees")
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
351 {
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
352 // Attendees require some more work
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
353 $sql = stPrepareSQL("DELETE FROM attendees WHERE id=%d", $id);
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
354 stExecSQLCond($sql, "OK, attendee ".$id." deleted.");
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
355
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
356 $sql = stPrepareSQL("DELETE FROM votes WHERE voter_id=%d", $id);
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
357 stExecSQLCond($sql, "OK, attendee ".$id." votes deleted.");
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
358 }
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
359 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
360 if ($type == "entries")
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
361 {
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
362 // .. as do compo entries
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
363 $sql = stPrepareSQL("DELETE FROM entries WHERE id=%d", $id);
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
364 stExecSQLCond($sql, "OK, entry ".$id." deleted.");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
366 $sql = stPrepareSQL("DELETE FROM votes WHERE entry_id=%d", $id);
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
367 stExecSQLCond($sql, "OK, entry ".$id." votes deleted.");
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
368 }
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370 else
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
371 stSetStatus(901, "No ID specified.");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 break;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
373
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
374 case "add":
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
375 //
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
376 // Add new entry
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
377 //
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
378 if ($type == "news" && stChkRequestItem("text") &&
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
379 stChkRequestItem("author") && stChkRequestItem("title"))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
380 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
381 $sql = stPrepareSQL(
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
382 "INSERT INTO news (utime,title,text,author) VALUES (%d,%S,%Q,%S)",
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
383 time(), "title", "text", "author");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
384
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
385 stExecSQLCond($sql, "OK, news item added.");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387 else
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
388 if ($type == "compo" && stChkRequestItem("name") &&
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
389 stChkRequestItem("description"))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
390 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
391 $sql = stPrepareSQL(
55
4fac95384753 Make visibility of entry authors per compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
392 "INSERT INTO compos (name,description,visible,voting,showAuthors) VALUES (%S,%Q,0,0,0)",
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
393 "name", "description");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
395 stExecSQLCond($sql, "OK, compo added.");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
396 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
397 else
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
398 if ($type == "attendees" && stChkRequestItem("name") &&
75
699f6db022d9 Cosmetic reorder of checks.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
399 stChkRequestItem("groups") && stChkRequestItem("oneliner") &&
699f6db022d9 Cosmetic reorder of checks.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
400 stChkRequestItem("email"))
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
401 {
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
402 $sql = stPrepareSQL(
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
403 "INSERT INTO attendees (regtime,name,groups,oneliner,email) VALUES (%d,%S,%S,%S,%S)",
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
404 time(), "name", "groups", "oneliner", "email");
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
405
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
406 stExecSQLCond($sql, "OK, attendee added.");
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
407 }
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
408 else
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
409 if ($type == "entry" && stChkRequestItem("name") &&
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
410 stChkRequestItem("author") && stChkRequestItem("compo_id"))
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
411 {
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
412 $sql = stPrepareSQL(
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
413 "INSERT INTO entries (name,author,compo_id,filename) VALUES (%S,%S,%D,%S)",
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
414 "name", "author", "compo_id", "filename");
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
415
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
416 stExecSQLCond($sql, "OK, entry added.");
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
417 }
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
418 else
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
419 stSetStatus(902, "No data.");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
420 break;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
421
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
422 case "update":
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
423 //
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
424 // Update existing entry
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
425 //
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
426 if ($type == "attendees" && stChkRequestItem("id") &&
52
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
427 stChkRequestItem("email") && stChkRequestItem("oneliner") &&
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
428 stChkRequestItem("active"))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
429 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
430 $sql = stPrepareSQLUpdate("attendees",
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
431 "WHERE id=".intval(stGetRequestItem("id")),
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
432 array(
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
433 "email" => "S",
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
434 "oneliner" => "S",
52
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
435 "active" => "B",
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
436 ));
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
437
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
438 stExecSQLCond($sql, "OK, attendee updated.");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
439 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
440 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
441 if ($type == "news" && stChkRequestItem("id") &&
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
442 stChkRequestItem("text") && stChkRequestItem("author") &&
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
443 stChkRequestItem("title"))
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
444 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445 $sql = stPrepareSQLUpdate("news",
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
446 "WHERE id=".intval(stGetRequestItem("id")),
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
447 array(
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
448 "title" => "S",
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
449 "text" => "Q",
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
450 "author" => "S"
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
451 ));
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
452
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
453 stExecSQLCond($sql, "OK, news item updated.");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
454 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
455 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
456 if ($type == "compo" && stChkRequestItem("id") &&
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
457 stChkRequestItem("name") && stChkRequestItem("description") &&
55
4fac95384753 Make visibility of entry authors per compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
458 stChkRequestItem("visible") && stChkRequestItem("voting") &&
4fac95384753 Make visibility of entry authors per compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
459 stChkRequestItem("showAuthors"))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
460 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
461 $sql = stPrepareSQLUpdate("compos",
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
462 "WHERE id=".intval(stGetRequestItem("id")),
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
463 array(
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
464 "name" => "S",
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
465 "description" => "Q",
24
5bc8bd5c7ecc Make voting toggle for individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents: 20
diff changeset
466 "visible" => "B",
5bc8bd5c7ecc Make voting toggle for individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents: 20
diff changeset
467 "voting" => "B",
55
4fac95384753 Make visibility of entry authors per compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
468 "showAuthors" => "B",
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
469 ));
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
470
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
471 stExecSQLCond($sql, "OK, compo updated.");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
472 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
473 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
474 if ($type == "entry" && stChkRequestItem("id") &&
30
ad25827304b6 Adding entries is now done via the regular entry submission system .. which
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
475 stChkRequestItem("name") && stChkRequestItem("author") &&
ad25827304b6 Adding entries is now done via the regular entry submission system .. which
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
476 stChkRequestItem("compo_id"))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
477 {
112
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
478 $cid = stGetRequestItem("compo_id");
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
479 if (stFetchSQLColumn("SELECT id FROM compos WHERE id=".$cid) === FALSE)
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
480 {
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
481 stSetStatus(903, "No such compo id.");
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
482 }
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
483 else
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
484 {
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
485 $sql = stPrepareSQLUpdate("entries",
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
486 "WHERE id=".intval(stGetRequestItem("id")),
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
487 array(
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
488 "name" => "S",
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
489 "author" => "S",
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
490 "filename" => "S",
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
491 "compo_id" => "D",
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
492 ));
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493
112
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
494 stExecSQLCond($sql, "OK, entry updated.");
91660a9d50f0 Add some error checking to compo id updating vs. compo entries.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
495 }
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
496 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
497 else
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
498 if ($type == "settings")
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
499 {
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
500 foreach (stExecSQL("SELECT * FROM settings") as $item)
198
96ab189e5c03 Add some new helper functions and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 175
diff changeset
501 if (($val = stGetRequestItem($item["key"], FALSE)) !== FALSE)
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
502 {
198
96ab189e5c03 Add some new helper functions and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 175
diff changeset
503 $sql = "UPDATE settings SET ".stGetSettingSQL($item, $val)." WHERE key=".$db->quote($item["key"]);
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
504 stExecSQLCond($sql, "OK, setting updated.");
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
505 }
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
506 }
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
507 else
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
508 stSetStatus(902, "No data.");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
509 break;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
510
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
511 default:
66
230aacc22cb4 Move some functions to site lib.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
512 stSetStatus(404, "Not Found");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
513 break;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
514 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
515
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
516 ?>