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