/[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.10 - (hide annotations)
Tue Nov 20 11:26:14 2001 UTC (22 years, 5 months ago) by dpavlin
Branch: MAIN
Changes since 1.9: +18 -3 lines
small fixes

1 ravilov 1.1 <?
2    
3 dpavlin 1.10 global $smarty,$dbh,$auth_required;
4 ravilov 1.1
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 dpavlin 1.9 $sth = $dbh->prepare("select item,url,file,w,h from menu where section='$m' and $visible_is_true 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 dpavlin 1.10
24     // link na otroke sa slatkorne stran
25     if ($m == "sladkorna") $smarty->assign("link_otroci",1);
26    
27    
28     $sql_where=" and substr(type,3,1)<>'x'" ; // don't show locked records
29    
30     // auth... based on m
31     if ($m == "za_zdravnike") {
32     Header("X-auth: needed");
33     print "<!-- auth needed -->";
34    
35     $sql_where="";
36     }
37    
38 ravilov 1.1 // fetch news
39    
40 dpavlin 1.10 $sth = $dbh->prepare("select id,title from news where substr(type,1,1)='n' $sql_where and $visible_is_true order by date desc limit 5");
41 ravilov 1.1 $sth->execute();
42     while ($row=$sth->fetchrow_hash()) {
43     $news[]=$row;
44     }
45     $smarty->assign("news",$news);
46    
47 dpavlin 1.10 $sth = $dbh->prepare("select id,title from news where substr(type,1,1)='e' $sql_where and $visible_is_true order by priority desc,date desc limit 5");
48 ravilov 1.1 $sth->execute();
49     while ($row=$sth->fetchrow_hash()) {
50     $events[]=$row;
51     }
52     $smarty->assign("events",$events);
53    
54     #include("debug.inc");
55    
56     function check_required() {
57     global $inputs_required;
58     global $inputs_required_type;
59     $ok=1;
60     if (isset($inputs_required)) {
61     foreach ($inputs_required as $i) {
62     if (! isset($GLOBALS[$i]) || $GLOBALS[$i] == "") $ok=0;
63     switch (strtolower($inputs_required_type[$i])) {
64     case 'email':
65     if (!strstr($GLOBALS[$i],'@')) $ok=0;
66     }
67     // print "$i: $GLOBALS[$i] type: $inputs_required_type[$i] $ok -- ";
68    
69     }
70     } else {
71     print "<!-- no inputs required -->";
72     }
73     return $ok;
74     }
75    
76     ?>

  ViewVC Help
Powered by ViewVC 1.1.26