/[pliva-si]/inc/common.inc
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /inc/common.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Fri Jun 29 08:33:59 2001 UTC (22 years, 9 months ago) by dpavlin
Branch: MAIN
Changes since 1.2: +1 -1 lines
multi-line support za menu

1 <?
2
3 global $smarty,$dbh;
4
5 // fetch menu
6
7 $sth = $dbh->prepare("select item,url,file,w,h from menu where section='$section' and visible 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 $sth = $dbh->prepare("select id,title from news where type<>'e' and type<>'p' and visible order by date desc limit 5");
18 $sth->execute();
19 while ($row=$sth->fetchrow_hash()) {
20 $news[]=$row;
21 }
22 $smarty->assign("news",$news);
23
24 $sth = $dbh->prepare("select id,title from news where type='e' and visible order by priority desc,date desc limit 5");
25 $sth->execute();
26 while ($row=$sth->fetchrow_hash()) {
27 $events[]=$row;
28 }
29 $smarty->assign("events",$events);
30
31 #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 "multi_page_show" => 1,
56 "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 function check_required() {
67 global $inputs_required;
68 global $inputs_required_type;
69 $ok=1;
70 if (isset($inputs_required)) {
71 foreach ($inputs_required as $i) {
72 if (! isset($GLOBALS[$i]) || $GLOBALS[$i] == "") $ok=0;
73 switch (strtolower($inputs_required_type[$i])) {
74 case 'email':
75 if (!strstr($GLOBALS[$i],'@')) $ok=0;
76 }
77 // print "$i: $GLOBALS[$i] type: $inputs_required_type[$i] $ok -- ";
78
79 }
80 } else {
81 print "<!-- no inputs required -->";
82 }
83 return $ok;
84 }
85
86 ?>

  ViewVC Help
Powered by ViewVC 1.1.26