1 |
dpavlin |
1.1 |
<? |
2 |
|
|
|
3 |
|
|
global $smarty,$dbh; |
4 |
|
|
|
5 |
|
|
// fetch menu |
6 |
|
|
|
7 |
|
|
$sth = $dbh->prepare("select item,url,file from menu where section='$section' order by num"); |
8 |
|
|
$sth->execute(); |
9 |
|
|
while ($row=$sth->fetchrow_hash()) { |
10 |
|
|
$menu[]=$row; |
11 |
|
|
} |
12 |
|
|
|
13 |
|
|
$smarty->assign("menu",$menu); |
14 |
|
|
|
15 |
|
|
// fetch news |
16 |
|
|
|
17 |
dpavlin |
1.8 |
$sth = $dbh->prepare("select id,title from news where type<>'e' and visible order by date desc limit 5"); |
18 |
dpavlin |
1.1 |
$sth->execute(); |
19 |
|
|
while ($row=$sth->fetchrow_hash()) { |
20 |
|
|
$news[]=$row; |
21 |
|
|
} |
22 |
|
|
$smarty->assign("news",$news); |
23 |
|
|
|
24 |
dpavlin |
1.7 |
$sth = $dbh->prepare("select id,title from news where type='e' and visible order by priority desc,date desc limit 5"); |
25 |
dpavlin |
1.4 |
$sth->execute(); |
26 |
|
|
while ($row=$sth->fetchrow_hash()) { |
27 |
|
|
$events[]=$row; |
28 |
|
|
} |
29 |
|
|
$smarty->assign("events",$events); |
30 |
|
|
|
31 |
dpavlin |
1.1 |
#include("debug.inc"); |
32 |
|
|
|
33 |
|
|
if ($multi_page) { |
34 |
|
|
$max=count($multi_page); |
35 |
|
|
$next=$multi_page[$current+1]; |
36 |
|
|
$show=0; |
37 |
|
|
|
38 |
|
|
$uri=basename($GLOBALS[REQUEST_URI]); |
39 |
|
|
|
40 |
|
|
for ($i=0; $i<=$max; $i++) { |
41 |
|
|
if ($multi_page[$i]==substr($uri,0,strlen($uri))) { |
42 |
|
|
$current=$i; |
43 |
|
|
$show=1; |
44 |
|
|
} |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
if ($current && $current!=0) { |
48 |
|
|
$prev=$multi_page[$current-1]; |
49 |
|
|
} |
50 |
|
|
if ($current && $current!=$max) { |
51 |
|
|
$next=$multi_page[$current+1]; |
52 |
|
|
} |
53 |
|
|
if ($show) { |
54 |
|
|
$smarty->assign(array( |
55 |
dpavlin |
1.6 |
"multi_page_show" => 1, |
56 |
dpavlin |
1.1 |
"multi_page"=>$multi_page, |
57 |
|
|
"multi_page_current"=>($current+1), |
58 |
|
|
"multi_page_max"=>$max, |
59 |
|
|
"multi_page_prev"=>$prev, |
60 |
|
|
"multi_page_next"=>$next |
61 |
|
|
)); |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
?> |