summaryrefslogtreecommitdiff
path: root/htdocs/index.php
blob: d389e6d583f9f51ea452f439bf6237d76c1512ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
$start_time = microtime(true);

if(file_exists("config.php")) include_once("config.php");

if(!isset($DATA_DIR)) $DATA_DIR = "../data";
if(!isset($ALBUMS_DIR)) $ALBUMS_DIR = "gfx/albums";
if(!isset($ICONS_DIR)) $ICONS_DIR = "gfx/icons";
if(!isset($MEMBERS_DIR)) $MEMBERS_DIR = "gfx/members";
if(!isset($UTIL_DIR)) $UTIL_DIR = "../utils";
if(!isset($MODULES_DIR)) $MODULES_DIR = $UTIL_DIR . "/modules";
if(!isset($IMAGECACHE)) $IMAGECACHE = $DATA_DIR . "/imagecache";
if(!isset($ADMIN_TIMEOUT)) $ADMIN_TIMEOUT = 60*60; // 60 min timeout
if(!isset($JPEG_CACHE_QUALITY)) $JPEG_CACHE_QUALITY = 85;

if($mode == "imagecache") {
  include_once($UTIL_DIR. "/imagecache.php");
  getCachedImage($uri, $mod, $cat);

	include_once($MODULES_DIR."/sitestats.php");
	$stats = new SiteStats($DATA_DIR."/sitestats");

	$stop_time = microtime(true);
	$stats->log($stop_time - $start_time);

  return;
}

include_once($MODULES_DIR . "/config.php");

$config = new Config($DATA_DIR . "/config.xml");

header("Content-Type: text/html; charset=UTF-8");

include_once($UTIL_DIR . "/login.php");
if($page == "admin") checklogin();

include_once($MODULES_DIR . "/pages.php");

$pages = new Pages($DATA_DIR . "/pages.xml");

if($config->value('splash') == "true") {
	if($_GET["skipsplash"]) {
		setcookie("skipsplash", "true", time()+$config->value('splashreshow'));
	}

	if($GLOBALS["skipsplash"] != "true") {
?><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title><?php echo $config->value('title');?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta name="MSSmartTagsPreventParsing" content="true"/>
	<meta http-equiv="Content-Type" content="text/html"/>
	<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml" />
	<link rel="author" title="Bent Bisballe Nyeng" href="http://www.aasimon.org"/>
	<link href="/favicon.ico" rel="shortcut icon"/>
	<link rel="stylesheet" type="text/css" href="<?php echo $config->value('css'); ?>" media="screen"/>
</head>
<body class="splashbody">
  <div class="splash">
<?php
    $p = $pages->getPage($config->value('splashpage'));
		$p->show();
?>
<!--    <div class="splash_enter"><a href="?skipsplash=true"><span class="splash_enter_text">Enter Site</span></a></div> -->
  </div>
</body>
</html>
<?php
		include_once($MODULES_DIR."/sitestats.php");
		$stats = new SiteStats($DATA_DIR."/sitestats");

		$page = "[splash]";
		$stop_time = microtime(true);
		$stats->log($stop_time - $start_time);

		return;
	} 
}

?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title><?php echo $config->value('title');?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta name="MSSmartTagsPreventParsing" content="true"/>
	<meta http-equiv="Content-Type" content="text/html"/>
	<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml" />
	<link rel="author" title="Bent Bisballe Nyeng" href="http://www.aasimon.org"/>
	<link href="/favicon.ico" rel="shortcut icon"/>
	<link rel="stylesheet" type="text/css" href="<?php echo $config->value('css'); ?>" media="screen"/>
	<link rel="stylesheet" type="text/css" href="admin.css" media="screen"/>
	<script type="text/javascript">
	// <!--
    function externalLinks() {
    	if (!document.getElementsByTagName) return;
    	var anchors = document.getElementsByTagName("a");
    	for (var i=0; i<anchors.length; i++) {
    		var anchor = anchors[i];
    		if (anchor.getAttribute("href") &&
    				anchor.getAttribute("rel") == "external")
    			anchor.target = "_blank";
    	}
    }
    window.onload = externalLinks;
// -->
  </script>
</head>
<body><?php

include_once($UTIL_DIR."/preload.php");
preload($config->value('css'));

if($page == "admin") {
	include($UTIL_DIR."/admin.php");
}
?>
<div class="page">
  <div class="menu">
<?php
$menu = $config->value('menu');
if(sizeof($menu)) {
	$idx = 1;
	foreach($menu as $_m => $_t) {
		if($idx != 1) {
			echo "    <div class=\"seperator\"></div>\n";
		}
		echo "    <a href=\"?page=".$_m."\" class=\"menu_entry_".$_m."\"></a>\n";
		echo "    <a href=\"?page=".$_m."\" class=\"menutitle\">".$_t."</a>\n";
		$idx++;
	}
}
?>
  </div>
  <div class="wrapper">
  <div class="content">
<?php
if($page && $page != "admin") $_p = $pages->getPage($page);
else $_p = $pages->getPage($config->value('defaultpage'));
if($_p) $_p->show();
?>
  </div>
  <div class="column">
<?php
$_p = $pages->getPage("column");
if($_p) $_p->show();
?>
  </div>
  </div>
  <div class="footer">
<?php
$_p = $pages->getPage("footer");
if($_p) $_p->show();
?>
  </div>
  <div class="generationtime">This document was generated in <?php $stop_time = microtime(true); echo $stop_time - $start_time; ?> seconds</div>
</div>
<div>
<a href="?page=admin" class="admin_link"></a>
<a href="?page=admin" class="admin_link_text">Admin</a>
</div>
</body>
</html><?php
include_once($MODULES_DIR."/sitestats.php");
$stats = new SiteStats($DATA_DIR."/sitestats");
$stats->log($stop_time - $start_time);
?>