Mercurial > hg > fapweb
annotate admin.php @ 1069:5f92fa5e683a
Refactor how the "AJAX" stuff works.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 24 Jan 2017 17:25:48 +0200 |
parents | ffacd904fd1f |
children | e23057465ca2 |
rev | line source |
---|---|
0 | 1 <? |
136
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
2 // |
571
ce11ea112a65
Change the header blurb a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
565
diff
changeset
|
3 // FAPWeb - Simple Web-based Demoparty Management System |
136
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
4 // Party administration page frontend module |
1001 | 5 // (C) Copyright 2012-2015 Tecnic Software productions (TNSP) |
136
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
6 // |
32 | 7 $sessionType = "admin"; |
175
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
174
diff
changeset
|
8 require_once "mconfig.inc.php"; |
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
174
diff
changeset
|
9 require_once "msite.inc.php"; |
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
174
diff
changeset
|
10 require_once "msession.inc.php"; |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
11 |
614
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
12 |
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
13 function stLoginContent() |
347 | 14 { |
614
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
15 echo "<div id=\"adminContent\">\n<div id=\"adminLogin\">"; |
347 | 16 } |
17 | |
614
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
18 function stLoginFooter() |
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
19 { |
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
20 echo "</div>\n"; |
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
21 cmPrintPageFooter(); |
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
22 } |
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
23 |
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
24 |
347 | 25 // Switch to https first, if needed |
26 if (!stCheckHTTPS()) | |
27 { | |
28 header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); | |
29 exit; | |
30 } | |
31 | |
32 // Start output | |
591
f7078755dff5
Fix CSS paths for admin and print pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
33 $pageCSS = "css/admin.css"; |
347 | 34 cmPrintPageHeader("FAPWeb Administration", |
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
1001
diff
changeset
|
35 " <meta http-equiv=\"Pragma\" content=\"no-cache\" />\n". |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
1001
diff
changeset
|
36 " <script type=\"text/javascript\" src=\"admajax.js.php\"></script>\n". |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
1001
diff
changeset
|
37 " <script type=\"text/javascript\" src=\"genajax.js\"></script>\n", |
347 | 38 FALSE); |
39 | |
40 | |
41 // Initiate SQL database connection | |
42 if (!stConnectSQLDB()) | |
43 { | |
44 // Error occured, bail out early | |
45 cmPrintPageFooter(); | |
46 exit; | |
47 } | |
48 | |
49 // Fetch non-"hardcoded" settings from SQL database | |
50 stReloadSettings(); | |
51 | |
0 | 52 // Check if sessions are enabled |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
53 if (!stChkSetting("admPassword")) |
0 | 54 { |
614
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
55 stLoginContent(); |
171
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
56 echo |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
57 "<h1>Oh noes, admin configuration not done!</h1>\n". |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
58 "<p>Better go and prod that, so you get to use the fine admin interface.</p>\n"; |
614
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
59 stLoginFooter(); |
347 | 60 exit; |
0 | 61 } |
62 else | |
107 | 63 if (!stAdmSessionAuth(FALSE)) |
0 | 64 { |
65 // Perform authentication if we are not in session already | |
614
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
66 stLoginContent(); |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
67 echo |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
68 "<h1>Party admin login</h1>\n". |
596
b09fdf99b54b
Add return to main pages link to admin login.
Matti Hamalainen <ccr@tnsp.org>
parents:
591
diff
changeset
|
69 "<p>Please use illegal telepathy over HTTP to provide a ". |
b09fdf99b54b
Add return to main pages link to admin login.
Matti Hamalainen <ccr@tnsp.org>
parents:
591
diff
changeset
|
70 "password to enter the party administration systembolaget.</p>\n". |
b09fdf99b54b
Add return to main pages link to admin login.
Matti Hamalainen <ccr@tnsp.org>
parents:
591
diff
changeset
|
71 "\n". |
347 | 72 " ".stGetFormStart("admlogin", "admlogin.php"). |
73 " ".stGetFormHiddenInput("mode", "check")."\n". | |
74 " ".stGetFormPasswordInput("admpass", "", "", "autofocus=\"autofocus\"")."\n". | |
75 " ".stGetFormSubmitInput("submit", "Login")."\n". | |
596
b09fdf99b54b
Add return to main pages link to admin login.
Matti Hamalainen <ccr@tnsp.org>
parents:
591
diff
changeset
|
76 " </form>\n". |
b09fdf99b54b
Add return to main pages link to admin login.
Matti Hamalainen <ccr@tnsp.org>
parents:
591
diff
changeset
|
77 "\n". |
b09fdf99b54b
Add return to main pages link to admin login.
Matti Hamalainen <ccr@tnsp.org>
parents:
591
diff
changeset
|
78 "<p>[<a href=\"".stGetSetting("defaultPage")."\">Return to the main page</a>].</p>\n"; |
614
7987aa59c2a0
Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
79 stLoginFooter(); |
347 | 80 exit; |
0 | 81 } |
107 | 82 else |
0 | 83 { |
84 ?> | |
599
eebbc96d7fe5
Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
596
diff
changeset
|
85 <script type="text/javascript" src="admin.js"></script> |
0 | 86 |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
87 <!-- ========================== --> |
0 | 88 |
427 | 89 <div id="adminPopup"></div> |
345 | 90 <div id="adminContent"> |
91 | |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
92 <div id="nstatus">-</div> |
201
a4be19c4d99d
Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
93 <div id="tabHeadersCC" class="tabHeaders"></div> |
843
ab2697983ab0
Add a nice informative message for cases where JavaScript is disabled.
Matti Hamalainen <ccr@tnsp.org>
parents:
728
diff
changeset
|
94 <div id="tabContentsCC" class="tabContents"> |
ab2697983ab0
Add a nice informative message for cases where JavaScript is disabled.
Matti Hamalainen <ccr@tnsp.org>
parents:
728
diff
changeset
|
95 <noscript> |
ab2697983ab0
Add a nice informative message for cases where JavaScript is disabled.
Matti Hamalainen <ccr@tnsp.org>
parents:
728
diff
changeset
|
96 <h1>Ehm, you need to enable JavaScript to use the admin interface.</h1> |
ab2697983ab0
Add a nice informative message for cases where JavaScript is disabled.
Matti Hamalainen <ccr@tnsp.org>
parents:
728
diff
changeset
|
97 </noscript> |
ab2697983ab0
Add a nice informative message for cases where JavaScript is disabled.
Matti Hamalainen <ccr@tnsp.org>
parents:
728
diff
changeset
|
98 </div> |
ab2697983ab0
Add a nice informative message for cases where JavaScript is disabled.
Matti Hamalainen <ccr@tnsp.org>
parents:
728
diff
changeset
|
99 |
171
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
100 |
0 | 101 <script type="text/javascript"> |
445
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
102 jsRegisterTab("CC", "Settings", "Settings"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
103 jsRegisterTab("CC", "News", "News"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
104 jsRegisterTab("CC", "Attendees", "Attendees"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
105 jsRegisterTab("CC", "Voting", "Voting"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
106 jsRegisterTab("CC", "Compos", "Compos"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
107 jsRegisterTab("CC", "Entries", "Entries"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
108 jsRegisterTab("CC", "InfoSys", "Infosystem"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
109 jsUpdateTabList("CC", |
263 | 110 "<a class=\"admin\" href=\"admlogout.php\">Logout</a> " + |
201
a4be19c4d99d
Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
111 "<a class=\"admin\" href=\"about\">Mainpage</a>"); |
445
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
112 jsSwitchActiveTab("CC", "Settings"); |
0 | 113 </script> |
171
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
114 <? |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
115 } |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
116 |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
117 cmPrintPageFooter(); |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
118 ?> |