Mercurial > hg > fapweb
annotate index.php @ 39:1844df51a55c
Improve authentication.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 01 Oct 2013 14:34:09 +0300 |
parents | 8ecf7c04a837 |
children | 8c3d425c0560 |
rev | line source |
---|---|
0 | 1 <?php |
2 require "mconfig.inc.php"; | |
3 require "msite.inc.php"; | |
4 require "mcommon.inc.php"; | |
33 | 5 require "msession.inc.php"; |
0 | 6 |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
7 |
0 | 8 // Switch to https first, if needed |
39 | 9 if (!stCheckHTTPS() && isset($_SERVER["REQUEST_URI"]) && |
10 array_key_exists($_SERVER["REQUEST_URI"], $securePages)) | |
0 | 11 { |
12 header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); | |
13 exit; | |
14 } | |
15 | |
39 | 16 |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
17 // Check for cache-controlled pages |
0 | 18 if (isset($_SERVER["REQUEST_URI"]) && |
19 array_key_exists($_SERVER["REQUEST_URI"], $securePages)) | |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
20 stSetupCacheControl(); |
0 | 21 |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
22 // Start output |
34
8ecf7c04a837
Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
23 cmPrintPageHeader($pageTitle, |
0 | 24 " <meta http-equiv=\"Pragma\" content=\"no-cache\" />"); |
25 | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
26 // Initiate SQL database connection |
0 | 27 if (!stConnectSQLDB()) |
28 { | |
39 | 29 // Error occured, bail out early |
34
8ecf7c04a837
Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
30 cmPrintPageFooter(); |
0 | 31 exit; |
32 } | |
33 | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
34 // 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
|
35 stReloadSettings(); |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
36 |
0 | 37 ?> |
38 <div id="headerbox"> | |
39 <div id="header"> | |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
40 <? echo stGetSetting("siteInfoText") ?> |
0 | 41 </div> |
42 <div id="menu"> | |
43 <a href="news">News</a> | |
44 <a href="compos">Compos</a> | |
45 <a href="event">Event</a> | |
46 <? | |
17 | 47 if (stGetSetting("showAttendees")) |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
48 echo " <a href=\"attendees\">Attendees</a>\n"; |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
49 |
39 | 50 if (stGetSetting("allowSubmit")) |
51 echo " <a href=\"entry\">Submit</a>\n"; | |
52 | |
17 | 53 if (stGetSetting("allowVoting")) |
0 | 54 echo " <a href=\"vote\">Vote</a>\n"; |
3
916623924bd5
More work on the party management and voting system.
Matti Hamalainen <ccr@tnsp.org>
parents:
2
diff
changeset
|
55 |
17 | 56 if (stGetSetting("showResults")) |
3
916623924bd5
More work on the party management and voting system.
Matti Hamalainen <ccr@tnsp.org>
parents:
2
diff
changeset
|
57 echo " <a href=\"results\">Results</a>\n"; |
4 | 58 |
17 | 59 if (stGetSetting("showAdmin")) |
4 | 60 echo " <a href=\"admin\">Admin</a>\n"; |
0 | 61 ?> |
62 </div> | |
63 </div> | |
64 | |
65 <div id="maincontent"> | |
66 <div> | |
67 <? | |
68 $pageName = isset($_GET["p"]) ? $_GET["p"] : "news"; | |
69 $pageFilename = basename($pageName).".inc.php"; | |
70 if (file_exists($pageFilename)) | |
71 include($pageFilename); | |
72 ?> | |
73 </div> | |
74 </div> | |
75 <? | |
34
8ecf7c04a837
Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
76 cmPrintPageFooter(); |
0 | 77 ?> |