Mercurial > hg > fapweb
annotate index.php @ 175:8df523e6326a
User require_once instead of require.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 06 Nov 2013 10:27:57 +0200 |
parents | 63c840590476 |
children | a4be19c4d99d |
rev | line source |
---|---|
136
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
1 <? |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
2 // |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
3 // FAPWeb Simple Demoparty System |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
4 // Main HTML page wrapper |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
5 // (C) Copyright 2012-2013 Tecnic Software productions (TNSP) |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
131
diff
changeset
|
6 // |
175
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
174
diff
changeset
|
7 require_once "mconfig.inc.php"; |
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
174
diff
changeset
|
8 require_once "msite.inc.php"; |
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
174
diff
changeset
|
9 require_once "msession.inc.php"; |
0 | 10 |
174
63c840590476
Move common code from mcommon.inc.php to msitegen module.
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
11 cmLocaleInit(); |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
12 |
0 | 13 // Switch to https first, if needed |
39 | 14 if (!stCheckHTTPS() && isset($_SERVER["REQUEST_URI"]) && |
15 array_key_exists($_SERVER["REQUEST_URI"], $securePages)) | |
0 | 16 { |
17 header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); | |
18 exit; | |
19 } | |
20 | |
39 | 21 |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
22 // Check for cache-controlled pages |
0 | 23 if (isset($_SERVER["REQUEST_URI"]) && |
24 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
|
25 stSetupCacheControl(); |
0 | 26 |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
27 // Start output |
34
8ecf7c04a837
Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
28 cmPrintPageHeader($pageTitle, |
0 | 29 " <meta http-equiv=\"Pragma\" content=\"no-cache\" />"); |
30 | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
31 // Initiate SQL database connection |
0 | 32 if (!stConnectSQLDB()) |
33 { | |
39 | 34 // Error occured, bail out early |
34
8ecf7c04a837
Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
35 cmPrintPageFooter(); |
0 | 36 exit; |
37 } | |
38 | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
39 // 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
|
40 stReloadSettings(); |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
41 |
0 | 42 ?> |
40 | 43 <div id="header"> |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
44 <? echo stGetSetting("siteInfoText") ?> |
40 | 45 </div> |
46 | |
47 <div id="menu"> | |
43 | 48 <? echo stGetSetting("siteMenuHeader") ?> |
104 | 49 |
123
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
50 <a href="about">About</a> |
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
51 <? |
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
52 if (stGetSetting("showNews")) |
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
53 echo "<a href=\"news\">News</a>\n"; |
5837b9333964
Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
54 ?> |
0 | 55 <a href="compos">Compos</a> |
131
ed05cc69e1c2
The event page was renamed to schedule.
Matti Hamalainen <ccr@tnsp.org>
parents:
123
diff
changeset
|
56 <a href="schedule">Schedule</a> |
0 | 57 <? |
78 | 58 $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
|
59 |
17 | 60 if (stGetSetting("showAttendees")) |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
61 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
|
62 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
|
63 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
|
64 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
|
65 |
17 | 66 if (stGetSetting("allowVoting")) |
0 | 67 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
|
68 |
60
4e09327ed4d0
Show certain menu options always if we are inside an admin session.
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
69 if ($visibility || stGetSetting("showResults")) |
3
916623924bd5
More work on the party management and voting system.
Matti Hamalainen <ccr@tnsp.org>
parents:
2
diff
changeset
|
70 echo " <a href=\"results\">Results</a>\n"; |
4 | 71 |
60
4e09327ed4d0
Show certain menu options always if we are inside an admin session.
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
72 if ($visibility || stGetSetting("showAdmin")) |
171
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
73 echo " <a href=\"admin.php\">Admin</a>\n"; |
0 | 74 ?> |
47 | 75 <? echo stGetSetting("siteMenuFooter") ?> |
0 | 76 </div> |
77 | |
149 | 78 <? |
79 echo stGetSetting("siteExtraHTML"); | |
106
324f3a415237
Add extra HTML + sponsors box to layout.
Matti Hamalainen <ccr@tnsp.org>
parents:
104
diff
changeset
|
80 |
149 | 81 // Get the name of the page |
157
5136563c1f04
Oops, use defaultPage here, too.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
82 $pageName = isset($_GET["p"]) ? $_GET["p"] : stGetSetting("defaultPage"); |
44 | 83 $pageBasename = basename($pageName); |
84 $pageFilename = $pageBasename.".inc.php"; | |
149 | 85 |
86 // Default to set default page if selected page does not exist | |
87 if (!file_exists($pageBasename.".inc.php")) | |
88 $pageBasename = stGetSetting("defaultPage"); | |
89 | |
90 | |
91 echo "<div id=\"infobox\">".strtoupper($pageBasename)."</div>\n"; | |
44 | 92 ?> |
0 | 93 <div id="maincontent"> |
94 <div> | |
95 <? | |
149 | 96 if (file_exists($pageBasename.".inc.php")) |
97 include($pageBasename.".inc.php"); | |
0 | 98 ?> |
99 </div> | |
100 </div> | |
101 <? | |
34
8ecf7c04a837
Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
102 cmPrintPageFooter(); |
0 | 103 ?> |