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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 <?php
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 require "mconfig.inc.php";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 require "msite.inc.php";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 require "mcommon.inc.php";
33
5bf22431176c Modularize.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
5 require "msession.inc.php";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
7
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 // Switch to https first, if needed
39
1844df51a55c Improve authentication.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
9 if (!stCheckHTTPS() && isset($_SERVER["REQUEST_URI"]) &&
1844df51a55c Improve authentication.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
10 array_key_exists($_SERVER["REQUEST_URI"], $securePages))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 exit;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15
39
1844df51a55c Improve authentication.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 if (isset($_SERVER["REQUEST_URI"]) &&
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 " <meta http-equiv=\"Pragma\" content=\"no-cache\" />");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 if (!stConnectSQLDB())
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 {
39
1844df51a55c Improve authentication.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 exit;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 ?>
40
8c3d425c0560 Change HTML layout a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
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
8c3d425c0560 Change HTML layout a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
40 </div>
8c3d425c0560 Change HTML layout a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
41
8c3d425c0560 Change HTML layout a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
42 <div id="menu">
43
66ab7d43f8a1 Add a new setting.
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
43 <? echo stGetSetting("siteMenuHeader") ?>
104
c7b1eb993240 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
44
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 <a href="news">News</a>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 <a href="compos">Compos</a>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 <a href="event">Event</a>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 <?
78
d50b64fbbc70 Use silent auth check.
Matti Hamalainen <ccr@tnsp.org>
parents: 60
diff changeset
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
b015c0dea42c Minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
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
b015c0dea42c Minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
57 if (stGetSetting("allowVoting"))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
934ab7d8c244 Various improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
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
934ab7d8c244 Various improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
64 echo " <a href=\"admin\">Admin</a>\n";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 ?>
47
73123e322133 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
66 <? echo stGetSetting("siteMenuFooter") ?>
104
c7b1eb993240 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
67
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
72dcc1d48809 More work on the design.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
72 <?
72dcc1d48809 More work on the design.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
73 $pageName = isset($_GET["p"]) ? $_GET["p"] : "news";
72dcc1d48809 More work on the design.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
74 $pageBasename = basename($pageName);
72dcc1d48809 More work on the design.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
75 $pageFilename = $pageBasename.".inc.php";
72dcc1d48809 More work on the design.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
76 if (file_exists($pageFilename))
72dcc1d48809 More work on the design.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
77 echo "<div id=\"infobox\">".strtoupper($pageBasename)."</div>\n";
72dcc1d48809 More work on the design.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
78 ?>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 <div id="maincontent">
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 <div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 <?
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 if (file_exists($pageFilename))
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 include($pageFilename);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 ?>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 <?
34
8ecf7c04a837 Update to match with common web code API.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
88 cmPrintPageFooter();
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 ?>