/[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

Annotation of /inc/common.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations)
Fri Jun 29 14:12:07 2001 UTC (22 years, 10 months ago) by dpavlin
Branch: MAIN
Changes since 1.4: +7 -1 lines
m=section support in URL

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

  ViewVC Help
Powered by ViewVC 1.1.26