annotate index.php @ 33:5bf22431176c

Modularize.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 11 Dec 2012 11:46:47 +0200
parents b015c0dea42c
children 8ecf7c04a837
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
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 if (!stCheckHTTPS())
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 exit;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
15 // Check for cache-controlled pages
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 if (isset($_SERVER["REQUEST_URI"]) &&
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 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
18 stSetupCacheControl();
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
20 // Start output
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 printPageHeader($pageTitle,
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 " <meta http-equiv=\"Pragma\" content=\"no-cache\" />");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
24 // Initiate SQL database connection
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 if (!stConnectSQLDB())
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 printPageFooter();
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 exit;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
31 // 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
32 stReloadSettings();
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
33
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 ?>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 <div id="headerbox">
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 <div id="header">
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
37 <? echo stGetSetting("siteInfoText") ?>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 <div id="menu">
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 <a href="news">News</a>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 <a href="compos">Compos</a>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 <a href="event">Event</a>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 <?
17
b015c0dea42c Minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
44 if (stGetSetting("showAttendees"))
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
45 echo " <a href=\"attendees\">Attendees</a>\n";
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
46
17
b015c0dea42c Minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
47 if (stGetSetting("allowVoting"))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 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
49
17
b015c0dea42c Minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
50 if (stGetSetting("showResults"))
3
916623924bd5 More work on the party management and voting system.
Matti Hamalainen <ccr@tnsp.org>
parents: 2
diff changeset
51 echo " <a href=\"results\">Results</a>\n";
4
934ab7d8c244 Various improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
52
17
b015c0dea42c Minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
53 if (stGetSetting("showAdmin"))
4
934ab7d8c244 Various improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
54 echo " <a href=\"admin\">Admin</a>\n";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 ?>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 <div id="maincontent">
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 <div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 <?
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 $pageName = isset($_GET["p"]) ? $_GET["p"] : "news";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 $pageFilename = basename($pageName).".inc.php";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 if (file_exists($pageFilename))
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 include($pageFilename);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 ?>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 </div>
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 <?
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 printPageFooter();
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 ?>