annotate index.php @ 303:734781881e47

Change page parameter.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 26 Nov 2013 06:15:52 +0200
parents aad9ededea6c
children 2e0a0d93b8c1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 // Switch to https first, if needed
39
1844df51a55c Improve authentication.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
14 if (!stCheckHTTPS() && isset($_SERVER["REQUEST_URI"]) &&
1844df51a55c Improve authentication.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
15 array_key_exists($_SERVER["REQUEST_URI"], $securePages))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 exit;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
39
1844df51a55c Improve authentication.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 if (isset($_SERVER["REQUEST_URI"]) &&
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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,
232
aad9ededea6c Reorder some meta tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 231
diff changeset
29 " <meta http-equiv=\"Pragma\" content=\"no-cache\" />\n".
aad9ededea6c Reorder some meta tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 231
diff changeset
30 " <meta name=\"viewport\" content=\"width=device-width\" />\n");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
32 // Initiate SQL database connection
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 if (!stConnectSQLDB())
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 {
39
1844df51a55c Improve authentication.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
35 // Error occured, bail out early
34
8ecf7c04a837 Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
36 cmPrintPageFooter();
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 exit;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
40 // 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
41 stReloadSettings();
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
42
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 ?>
40
8c3d425c0560 Change HTML layout a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
44 <div id="header">
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
45 <? echo stGetSetting("siteInfoText") ?>
40
8c3d425c0560 Change HTML layout a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
46 </div>
8c3d425c0560 Change HTML layout a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
47
8c3d425c0560 Change HTML layout a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
48 <div id="menu">
43
66ab7d43f8a1 Add a new setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
49 <? echo stGetSetting("siteMenuHeader") ?>
104
c7b1eb993240 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
50
123
5837b9333964 Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
51 <a href="about">About</a>
5837b9333964 Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
52 <?
5837b9333964 Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
53 if (stGetSetting("showNews"))
5837b9333964 Add new "about" page, and setting for default page.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
54 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
55 ?>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 <a href="compos">Compos</a>
131
ed05cc69e1c2 The event page was renamed to schedule.
Matti Hamalainen <ccr@tnsp.org>
parents: 123
diff changeset
57 <a href="schedule">Schedule</a>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 <?
78
d50b64fbbc70 Use silent auth check.
Matti Hamalainen <ccr@tnsp.org>
parents: 60
diff changeset
59 $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
60
17
b015c0dea42c Minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
61 if (stGetSetting("showAttendees"))
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
62 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
63 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
64 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
65 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
66
17
b015c0dea42c Minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
67 if (stGetSetting("allowVoting"))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 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
69
60
4e09327ed4d0 Show certain menu options always if we are inside an admin session.
Matti Hamalainen <ccr@tnsp.org>
parents: 51
diff changeset
70 if ($visibility || stGetSetting("showResults"))
3
916623924bd5 More work on the party management and voting system.
Matti Hamalainen <ccr@tnsp.org>
parents: 2
diff changeset
71 echo " <a href=\"results\">Results</a>\n";
4
934ab7d8c244 Various improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
72
60
4e09327ed4d0 Show certain menu options always if we are inside an admin session.
Matti Hamalainen <ccr@tnsp.org>
parents: 51
diff changeset
73 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
74 echo " <a href=\"admin.php\">Admin</a>\n";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 ?>
47
73123e322133 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
76 <? echo stGetSetting("siteMenuFooter") ?>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78
149
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
79 <?
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
80 echo stGetSetting("siteExtraHTML");
106
324f3a415237 Add extra HTML + sponsors box to layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 104
diff changeset
81
149
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
82 // Get the name of the page
303
734781881e47 Change page parameter.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
83 $pageName = isset($_GET["page"]) ? $_GET["page"] : stGetSetting("defaultPage");
44
72dcc1d48809 More work on the design.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
84 $pageBasename = basename($pageName);
72dcc1d48809 More work on the design.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
85 $pageFilename = $pageBasename.".inc.php";
149
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
86
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
87 // Default to set default page if selected page does not exist
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
88 if (!file_exists($pageBasename.".inc.php"))
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
89 $pageBasename = stGetSetting("defaultPage");
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
90
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
91
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
92 echo "<div id=\"infobox\">".strtoupper($pageBasename)."</div>\n";
44
72dcc1d48809 More work on the design.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
93 ?>
201
a4be19c4d99d Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents: 175
diff changeset
94 <div id="mainContent">
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 <div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 <?
149
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
97 if (file_exists($pageBasename.".inc.php"))
7e20560ac479 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
98 include($pageBasename.".inc.php");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 ?>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 <?
34
8ecf7c04a837 Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
103 cmPrintPageFooter();
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 ?>