1 |
ravilov |
1.1 |
<? |
2 |
|
|
|
3 |
|
|
global $smarty,$dbh; |
4 |
|
|
|
5 |
|
|
// fetch menu |
6 |
|
|
|
7 |
dpavlin |
1.5 |
if (!isset($m)) { |
8 |
|
|
$m=$section; |
9 |
|
|
} else { |
10 |
|
|
$smarty->assign("m_session","m=$m&"); |
11 |
dpavlin |
1.8 |
$smarty->assign("m_session_urlend","&m=$m"); |
12 |
dpavlin |
1.6 |
$smarty->assign("m_form_session","<input type=\"hidden\" name=\"m\" value=\"$m\">"); |
13 |
dpavlin |
1.5 |
} |
14 |
|
|
|
15 |
|
|
$sth = $dbh->prepare("select item,url,file,w,h from menu where section='$m' and visible order by num"); |
16 |
ravilov |
1.1 |
$sth->execute(); |
17 |
|
|
while ($row=$sth->fetchrow_hash()) { |
18 |
|
|
$menu[]=$row; |
19 |
|
|
} |
20 |
|
|
|
21 |
|
|
$smarty->assign("menu",$menu); |
22 |
|
|
|
23 |
|
|
// fetch news |
24 |
|
|
|
25 |
dpavlin |
1.4 |
$sth = $dbh->prepare("select id,title from news where substr(type,1,1)='n' and visible order by date desc limit 5"); |
26 |
ravilov |
1.1 |
$sth->execute(); |
27 |
|
|
while ($row=$sth->fetchrow_hash()) { |
28 |
|
|
$news[]=$row; |
29 |
|
|
} |
30 |
|
|
$smarty->assign("news",$news); |
31 |
|
|
|
32 |
dpavlin |
1.4 |
$sth = $dbh->prepare("select id,title from news where substr(type,1,1)='e' and visible order by priority desc,date desc limit 5"); |
33 |
ravilov |
1.1 |
$sth->execute(); |
34 |
|
|
while ($row=$sth->fetchrow_hash()) { |
35 |
|
|
$events[]=$row; |
36 |
|
|
} |
37 |
|
|
$smarty->assign("events",$events); |
38 |
|
|
|
39 |
|
|
#include("debug.inc"); |
40 |
|
|
|
41 |
|
|
function check_required() { |
42 |
|
|
global $inputs_required; |
43 |
|
|
global $inputs_required_type; |
44 |
|
|
$ok=1; |
45 |
|
|
if (isset($inputs_required)) { |
46 |
|
|
foreach ($inputs_required as $i) { |
47 |
|
|
if (! isset($GLOBALS[$i]) || $GLOBALS[$i] == "") $ok=0; |
48 |
|
|
switch (strtolower($inputs_required_type[$i])) { |
49 |
|
|
case 'email': |
50 |
|
|
if (!strstr($GLOBALS[$i],'@')) $ok=0; |
51 |
|
|
} |
52 |
|
|
// print "$i: $GLOBALS[$i] type: $inputs_required_type[$i] $ok -- "; |
53 |
|
|
|
54 |
|
|
} |
55 |
|
|
} else { |
56 |
|
|
print "<!-- no inputs required -->"; |
57 |
|
|
} |
58 |
|
|
return $ok; |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
?> |