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

Diff of /inc/common.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by dpavlin, Thu Feb 22 21:07:44 2001 UTC revision 1.14 by dpavlin, Tue Sep 18 10:38:55 2001 UTC
# Line 1  Line 1 
1  <?  <?
2    
3  global $smarty,$dbh;  global $smarty,$dbh,$visible_is_true;
4    
5    // just to be on safe side
6    if (! isset($visible_is_true)) {
7            $visible_is_true="visible is true";
8    }
9    
10  // fetch menu  // fetch menu
11    
12  $sth = $dbh->prepare("select item,url,file from menu where section='$section' order by num");  $sth = $dbh->prepare("select item,url,file from menu where section='$section' and $visible_is_true order by num");
13  $sth->execute();  $sth->execute();
14  while ($row=$sth->fetchrow_hash()) {  while ($row=$sth->fetchrow_hash()) {
15          $menu[]=$row;          $menu[]=$row;
# Line 14  $smarty->assign("menu",$menu); Line 19  $smarty->assign("menu",$menu);
19    
20  // fetch news  // fetch news
21    
22  $sth = $dbh->prepare("select id,title from news where type='n' and visible order by date desc limit 5");  $sth = $dbh->prepare("select id,title from news where type<>'e' and type<>'p' and $visible_is_true order by date desc limit 5");
23  $sth->execute();  $sth->execute();
24  while ($row=$sth->fetchrow_hash()) {  while ($row=$sth->fetchrow_hash()) {
25          $news[]=$row;          $news[]=$row;
26  }  }
27  $smarty->assign("news",$news);  $smarty->assign("news",$news);
28    
29  $sth = $dbh->prepare("select id,title from news where type='e' and visible order by date desc limit 5");  $sth = $dbh->prepare("select id,title from news where type='e' and $visible_is_true order by priority desc,date desc limit 5");
30  $sth->execute();  $sth->execute();
31  while ($row=$sth->fetchrow_hash()) {  while ($row=$sth->fetchrow_hash()) {
32          $events[]=$row;          $events[]=$row;
# Line 52  if ($multi_page) { Line 57  if ($multi_page) {
57          }          }
58          if ($show) {          if ($show) {
59                  $smarty->assign(array(                  $smarty->assign(array(
60                    "multi_page_show" => 1,
61                  "multi_page"=>$multi_page,                  "multi_page"=>$multi_page,
62                  "multi_page_current"=>($current+1),                  "multi_page_current"=>($current+1),
63                  "multi_page_max"=>$max,                  "multi_page_max"=>$max,
# Line 62  if ($multi_page) { Line 68  if ($multi_page) {
68    
69  }  }
70    
71    function check_required() {
72            global $inputs_required;
73            global $inputs_required_type;
74            $ok=1;
75            if (isset($inputs_required)) {
76                    foreach ($inputs_required as $i) {
77                            if (! isset($GLOBALS[$i]) || $GLOBALS[$i] == "") $ok=0;
78                            switch (strtolower($inputs_required_type[$i])) {
79                                    case 'email':
80                                            if (!strstr($GLOBALS[$i],'@')) $ok=0;
81                            }
82    //                      print "$i: $GLOBALS[$i] type: $inputs_required_type[$i] $ok -- ";
83    
84                    }
85            } else {
86                    print "<!-- no inputs required -->";
87            }
88            return $ok;
89    }
90    
91  ?>  ?>

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.26