Mercurial > hg > fapweb
annotate index.php @ 106:324f3a415237
Add extra HTML + sponsors box to layout.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 21 Oct 2013 22:11:40 +0300 |
parents | c7b1eb993240 |
children | 5837b9333964 |
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 ?> |
40 | 38 <div id="header"> |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
39 <? echo stGetSetting("siteInfoText") ?> |
40 | 40 </div> |
41 | |
42 <div id="menu"> | |
43 | 43 <? echo stGetSetting("siteMenuHeader") ?> |
104 | 44 |
0 | 45 <a href="news">News</a> |
46 <a href="compos">Compos</a> | |
47 <a href="event">Event</a> | |
48 <? | |
78 | 49 $visibility = stAdmSessionAuth(TRUE); |
60
4e09327ed4d0
Show certain menu options always if we are inside an admin session.
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
50 |
17 | 51 if (stGetSetting("showAttendees")) |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
52 echo " <a href=\"attendees\">Attendees</a>\n"; |
103
c6b9041078ec
Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
53 else |
c6b9041078ec
Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
54 if (stChkSetting("allowRegister")) |
c6b9041078ec
Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
55 echo " <a href=\"register\">Register</a>\n"; |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
56 |
17 | 57 if (stGetSetting("allowVoting")) |
0 | 58 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
|
59 |
60
4e09327ed4d0
Show certain menu options always if we are inside an admin session.
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
60 if ($visibility || stGetSetting("showResults")) |
3
916623924bd5
More work on the party management and voting system.
Matti Hamalainen <ccr@tnsp.org>
parents:
2
diff
changeset
|
61 echo " <a href=\"results\">Results</a>\n"; |
4 | 62 |
60
4e09327ed4d0
Show certain menu options always if we are inside an admin session.
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
63 if ($visibility || stGetSetting("showAdmin")) |
4 | 64 echo " <a href=\"admin\">Admin</a>\n"; |
0 | 65 ?> |
47 | 66 <? echo stGetSetting("siteMenuFooter") ?> |
104 | 67 |
0 | 68 </div> |
69 | |
106
324f3a415237
Add extra HTML + sponsors box to layout.
Matti Hamalainen <ccr@tnsp.org>
parents:
104
diff
changeset
|
70 <? echo stGetSetting("siteExtraHTML") ?> |
324f3a415237
Add extra HTML + sponsors box to layout.
Matti Hamalainen <ccr@tnsp.org>
parents:
104
diff
changeset
|
71 |
44 | 72 <? |
73 $pageName = isset($_GET["p"]) ? $_GET["p"] : "news"; | |
74 $pageBasename = basename($pageName); | |
75 $pageFilename = $pageBasename.".inc.php"; | |
76 if (file_exists($pageFilename)) | |
77 echo "<div id=\"infobox\">".strtoupper($pageBasename)."</div>\n"; | |
78 ?> | |
0 | 79 <div id="maincontent"> |
80 <div> | |
81 <? | |
82 if (file_exists($pageFilename)) | |
83 include($pageFilename); | |
84 ?> | |
85 </div> | |
86 </div> | |
87 <? | |
34
8ecf7c04a837
Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
88 cmPrintPageFooter(); |
0 | 89 ?> |