/[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.6 - (show annotations)
Mon Jul 2 06:55:32 2001 UTC (22 years, 9 months ago) by dpavlin
Branch: MAIN
Changes since 1.5: +1 -0 lines
m_form_session to preserve m in forms

1 <?
2
3 global $smarty,$dbh;
4
5 // fetch menu
6
7 if (!isset($m)) {
8 $m=$section;
9 } else {
10 $smarty->assign("m_session","m=$m&");
11 $smarty->assign("m_form_session","<input type=\"hidden\" name=\"m\" value=\"$m\">");
12 }
13
14 $sth = $dbh->prepare("select item,url,file,w,h from menu where section='$m' and visible order by num");
15 $sth->execute();
16 while ($row=$sth->fetchrow_hash()) {
17 $menu[]=$row;
18 }
19
20 $smarty->assign("menu",$menu);
21
22 // fetch news
23
24 $sth = $dbh->prepare("select id,title from news where substr(type,1,1)='n' and visible order by date desc limit 5");
25 $sth->execute();
26 while ($row=$sth->fetchrow_hash()) {
27 $news[]=$row;
28 }
29 $smarty->assign("news",$news);
30
31 $sth = $dbh->prepare("select id,title from news where substr(type,1,1)='e' and visible order by priority desc,date desc limit 5");
32 $sth->execute();
33 while ($row=$sth->fetchrow_hash()) {
34 $events[]=$row;
35 }
36 $smarty->assign("events",$events);
37
38 #include("debug.inc");
39
40 if ($multi_page) {
41 $max=count($multi_page);
42 $next=$multi_page[$current+1];
43 $show=0;
44
45 $uri=basename($GLOBALS[REQUEST_URI]);
46
47 for ($i=0; $i<=$max; $i++) {
48 if ($multi_page[$i]==substr($uri,0,strlen($uri))) {
49 $current=$i;
50 $show=1;
51 }
52 }
53
54 if ($current && $current!=0) {
55 $prev=$multi_page[$current-1];
56 }
57 if ($current && $current!=$max) {
58 $next=$multi_page[$current+1];
59 }
60 if ($show) {
61 $smarty->assign(array(
62 "multi_page_show" => 1,
63 "multi_page"=>$multi_page,
64 "multi_page_current"=>($current+1),
65 "multi_page_max"=>$max,
66 "multi_page_prev"=>$prev,
67 "multi_page_next"=>$next
68 ));
69 }
70
71 }
72
73 function check_required() {
74 global $inputs_required;
75 global $inputs_required_type;
76 $ok=1;
77 if (isset($inputs_required)) {
78 foreach ($inputs_required as $i) {
79 if (! isset($GLOBALS[$i]) || $GLOBALS[$i] == "") $ok=0;
80 switch (strtolower($inputs_required_type[$i])) {
81 case 'email':
82 if (!strstr($GLOBALS[$i],'@')) $ok=0;
83 }
84 // print "$i: $GLOBALS[$i] type: $inputs_required_type[$i] $ok -- ";
85
86 }
87 } else {
88 print "<!-- no inputs required -->";
89 }
90 return $ok;
91 }
92
93 ?>

  ViewVC Help
Powered by ViewVC 1.1.26