/[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.7 - (hide annotations)
Tue Jul 3 12:41:05 2001 UTC (22 years, 9 months ago) by dpavlin
Branch: MAIN
Changes since 1.6: +0 -33 lines
multi-page support

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

  ViewVC Help
Powered by ViewVC 1.1.26