Mercurial > hg > fapweb
annotate index.php @ 820:e213dca6354d
Add filename as ref variable argument to stSetFileEntryFilename().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 24 Nov 2014 22:31:47 +0200 |
parents | 9a948144dcc9 |
children | e6a1410ce71d |
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 // |
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:
131
diff
changeset
|
4 // Main HTML page wrapper |
565 | 5 // (C) Copyright 2012-2014 Tecnic Software productions (TNSP) |
136
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 |
699 | 11 // Get the name of the page |
12 if (!isset($pagePath)) $pagePath = "pages/"; | |
13 if (!isset($pageExt)) $pageExt = ".inc.php"; | |
14 $pageName = isset($_GET["page"]) ? basename($_GET["page"]) : stGetSetting("defaultPage"); | |
15 | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
16 |
0 | 17 // Switch to https first, if needed |
699 | 18 $isSecurePage = isset($pageName) && array_key_exists($pageName, $securePages); |
365
2e0a0d93b8c1
Sanitize secure pages scheme.
Matti Hamalainen <ccr@tnsp.org>
parents:
303
diff
changeset
|
19 if (!stCheckHTTPS() && $isSecurePage) |
0 | 20 { |
21 header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); | |
22 exit; | |
23 } | |
24 | |
39 | 25 |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
26 // Check for cache-controlled pages |
699 | 27 $noCache = $isSecurePage && $securePages[$pageName]; |
365
2e0a0d93b8c1
Sanitize secure pages scheme.
Matti Hamalainen <ccr@tnsp.org>
parents:
303
diff
changeset
|
28 if ($noCache) |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
29 stSetupCacheControl(); |
0 | 30 |
699 | 31 stDebug("PG: '".$pageName."' is secure=".intval($isSecurePage).", noCache=".intval($noCache)); |
32 | |
33 | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
34 // Start output |
34
8ecf7c04a837
Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
35 cmPrintPageHeader($pageTitle, |
365
2e0a0d93b8c1
Sanitize secure pages scheme.
Matti Hamalainen <ccr@tnsp.org>
parents:
303
diff
changeset
|
36 ($noCache ? " <meta http-equiv=\"Pragma\" content=\"no-cache\" />\n" : ""). |
232 | 37 " <meta name=\"viewport\" content=\"width=device-width\" />\n"); |
0 | 38 |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
39 // Initiate SQL database connection |
0 | 40 if (!stConnectSQLDB()) |
41 { | |
39 | 42 // Error occured, bail out early |
34
8ecf7c04a837
Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
43 cmPrintPageFooter(); |
0 | 44 exit; |
45 } | |
46 | |
699 | 47 |
48 // Default to set default page if selected page does not exist | |
49 if (!file_exists($pagePath.$pageName.$pageExt)) | |
50 $pageName = stGetSetting("defaultPage"); | |
51 $currPagename = $pageName; | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
52 |
106
324f3a415237
Add extra HTML + sponsors box to layout.
Matti Hamalainen <ccr@tnsp.org>
parents:
104
diff
changeset
|
53 |
699 | 54 // Fetch non-"hardcoded" settings from SQL database |
55 stReloadSettings(); | |
149 | 56 |
585
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
57 // Output the page menu etc. |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
58 echo |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
59 "<div id=\"header\">\n". |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
60 stGetSetting("siteInfoText"). |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
61 " <div id=\"menu\">\n". |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
62 " ".stGetSetting("siteMenuHeader")."\n". |
610
167ca3827c31
Add some new HTML elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
603
diff
changeset
|
63 " <div id=\"menuInner\">\n". |
585
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
64 stGetMainPageLink("about", "About"). |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
65 stGetMainPageLink("news", "News", stGetSetting("showNews")). |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
585
diff
changeset
|
66 stGetMainPageLink("compos", "Compos", stGetSetting("showCompos")). |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
585
diff
changeset
|
67 stGetMainPageLink("schedule", "Schedule", stGetSetting("showSchedule")); |
585
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
68 |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
69 if (stGetSetting("showAttendees")) |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
585
diff
changeset
|
70 echo stGetMainPageLink("visitors", "Visitors"); |
585
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
71 else |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
72 if (stChkSetting("allowRegister")) |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
73 echo stGetMainPageLink("register", "Register"); |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
74 |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
75 $visibility = stAdmSessionAuth(TRUE); |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
76 echo |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
77 stGetMainPageLink("vote", "Vote", stGetSetting("allowVoting")). |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
78 stGetMainPageLink("results", "Results", $visibility || stGetSetting("showResults")). |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
79 stGetMainPageLink("admin.php", "Admin", $visibility || stGetSetting("showAdmin")). |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
80 stGetSetting("siteMenuFooter"). |
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
81 " </div>\n". |
610
167ca3827c31
Add some new HTML elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
603
diff
changeset
|
82 " </div>\n". |
585
cec36fd24d21
Clean up the menu and HTML somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
83 "</div>\n". |
699 | 84 "<div id=\"infobox\">".$pageName."</div>\n"; |
44 | 85 ?> |
201
a4be19c4d99d
Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
86 <div id="mainContent"> |
588
e533955fa055
Add some more DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
587
diff
changeset
|
87 <div id="mainContentInner"> |
e533955fa055
Add some more DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
587
diff
changeset
|
88 <div id="mainContentWrap"> |
0 | 89 <? |
699 | 90 if (file_exists($pagePath.$pageName.$pageExt)) |
91 include($pagePath.$pageName.$pageExt); | |
0 | 92 ?> |
93 </div> | |
94 </div> | |
588
e533955fa055
Add some more DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
587
diff
changeset
|
95 </div> |
0 | 96 <? |
603 | 97 echo stGetSetting("siteExtraHTML"); |
34
8ecf7c04a837
Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
98 cmPrintPageFooter(); |
0 | 99 ?> |