annotate admin.php @ 1096:bbc0a3d0b51e

Major renaming / refactor of site messages. Some that were previously modifiable from admin interface are now "hardcoded" in the configuration file. Having these settings made modifiable from there made no sense and just took space in the UI.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 27 Jan 2017 22:15:06 +0200
parents 7da8bde9b7be
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1071
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
1 <?php
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
1072
7da8bde9b7be Bump copyrights.
Matti Hamalainen <ccr@tnsp.org>
parents: 1071
diff changeset
5 // (C) Copyright 2012-2017 Tecnic Software productions (TNSP)
136
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
6 //
32
36392d1d6b5f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 30
diff changeset
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
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
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
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
16 }
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
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
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
25 // Switch to https first, if needed
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
26 if (!stCheckHTTPS())
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
27 {
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
28 header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
29 exit;
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
30 }
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
31
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
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
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
34 cmPrintPageHeader("FAPWeb Administration",
1070
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
35 " <meta http-equiv=\"Pragma\" content=\"no-cache\" />\n",
347
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
36 FALSE);
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
37
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
38
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
39 // Initiate SQL database connection
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
40 if (!stConnectSQLDB())
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
41 {
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
42 // Error occured, bail out early
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
43 cmPrintPageFooter();
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
44 exit;
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
45 }
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
46
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
47 // Fetch non-"hardcoded" settings from SQL database
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
48 stReloadSettings();
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
49
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 // Check if sessions are enabled
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
51 if (!stChkSetting("admPassword"))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 {
614
7987aa59c2a0 Clean up admin login a bit, and add some DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 601
diff changeset
53 stLoginContent();
171
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
54 echo
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
55 "<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
56 "<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
57 stLoginFooter();
347
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
58 exit;
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 else
107
6e076b3630a0 Cleanup the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
61 if (!stAdmSessionAuth(FALSE))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 // 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
64 stLoginContent();
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
65 echo
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
66 "<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
67 "<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
68 "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
69 "\n".
347
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
70 " ".stGetFormStart("admlogin", "admlogin.php").
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
71 " ".stGetFormHiddenInput("mode", "check")."\n".
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
72 " ".stGetFormPasswordInput("admpass", "", "", "autofocus=\"autofocus\"")."\n".
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
73 " ".stGetFormSubmitInput("submit", "Login")."\n".
596
b09fdf99b54b Add return to main pages link to admin login.
Matti Hamalainen <ccr@tnsp.org>
parents: 591
diff changeset
74 " </form>\n".
b09fdf99b54b Add return to main pages link to admin login.
Matti Hamalainen <ccr@tnsp.org>
parents: 591
diff changeset
75 "\n".
b09fdf99b54b Add return to main pages link to admin login.
Matti Hamalainen <ccr@tnsp.org>
parents: 591
diff changeset
76 "<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
77 stLoginFooter();
347
1ef6cd391590 Move things around a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
78 exit;
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 }
107
6e076b3630a0 Cleanup the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
80 else
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 {
1071
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
82 echo
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
83 "<script type=\"text/javascript\" src=\"admajax.js.php\"></script>\n".
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
84 "<script type=\"text/javascript\" src=\"genajax.js\"></script>\n".
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
85 "<div id=\"adminPopup\"></div>\n".
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
86 "<div id=\"adminContent\">\n".
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
87 "<div id=\"nstatus\">-</div>\n".
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
88 "<div id=\"tabHeadersCC\" class=\"tabHeaders\"></div>\n".
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
89 "<div id=\"tabContentsCC\" class=\"tabContents\">\n".
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
90 "<noscript>\n".
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
91 " <h1>Ehm, you need to enable JavaScript to use the admin interface.</h1>\n".
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
92 "</noscript>\n".
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
93 "</div>\n";
171
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
94 }
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
95
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
96 cmPrintPageFooter();
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
97 ?>