forked from opencaching/opencaching-pl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
81 lines (62 loc) · 3.05 KB
/
index.php
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
<?php
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
/****************************************************************************
Unicode Reminder ăĄă˘
Starting page of the OpenCaching website and template usage example
used template(s): start
parameter(s): none
****************************************************************************/
//prepare the templates and include all neccessary
if(!isset($rootpath)) $rootpath = __DIR__.DIRECTORY_SEPARATOR;
require_once('./lib/common.inc.php');
//Preprocessing
if ($error == false)
{
//set the template to process
$tplname = 'start';
// news
require($stylepath . '/news.inc.php');
$newscontent = '<div class="line-box">';
$rs = sql('SELECT `news`.`date_posted` `date`, `news`.`content` `content` FROM `news` WHERE datediff(now(), news.date_posted) <= 31 AND `news`.`display`=1 AND `news`.`topic`=2 ORDER BY `news`.`date_posted` DESC LIMIT 4');
if (mysql_num_rows($rs)!=0) {
$newscontent .= $tpl_newstopic_header;
}
while ($r = sql_fetch_array($rs))
{
$news= '<div class="logs" style="width: 750px;">'.$tpl_newstopic_without_topic;
$post_date = strtotime($r['date']);
$news = mb_ereg_replace('{date}', fixPlMonth(htmlspecialchars(strftime("%d %B %Y", $post_date), ENT_COMPAT, 'UTF-8')), $news);
$news = mb_ereg_replace('{message}', $r['content'], $news);
$newscontent .= $news . "</div>\n";
}
$newscontent .= "</div>\n";
if (mysql_num_rows($rs)!=0) {
tpl_set_var('display_news', $newscontent);
} else {
tpl_set_var('display_news','');}
mysql_free_result($rs);
$newscontent = '';
global $dynstylepath;
include ($dynstylepath . "totalstats.inc.php");
// here is the right place to set up template replacements
// example:
// tpl_set_var('foo', 'myfooreplacement');
// will replace {foo} in the templates
}
// diffrent oc server handling: display proper info depend on server running the code
$nodeDetect = substr($absolute_server_URI,-3,2);
tpl_set_var('what_do_you_find_intro',tr('what_do_you_find_intro_'.$nodeDetect));
if ($powerTrailModuleSwitchOn) tpl_set_var('ptDisplay','block'); else tpl_set_var('ptDisplay','none');
if ($BlogSwitchOn) tpl_set_var('blogDisplay','block'); else tpl_set_var('blogDisplay','none');
//make the template and send it out
tpl_BuildTemplate(false);
//not neccessary, call tpl_BuildTemplate with true as argument and the db will be closed there
db_disconnect();
?>