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

Annotation of /inc/common.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (hide annotations)
Tue Sep 18 10:26:46 2001 UTC (22 years, 7 months ago) by dpavlin
Branch: MAIN
Changes since 1.12: +8 -3 lines
changes to support /preview/ URL

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

  ViewVC Help
Powered by ViewVC 1.1.26