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

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

revision 1.2 by dpavlin, Wed Feb 21 15:52:31 2001 UTC revision 1.12 by dpavlin, Mon Mar 19 16:53:48 2001 UTC
# Line 13  if (isset($from)) { Line 13  if (isset($from)) {
13          $section="new";          $section="new";
14  }  }
15    
16    $sql_where="where visible is true";
17    
18  if ($section == "investor") {  if ($section == "investor") {
19          $title="INVESTOR'S PAGE";          $title="INVESTOR'S PAGE";
20          $lpic="investor"; $lext=".jpg";          $lpic="investor"; $lext=".jpg";
21          $mpic="investors.gif";          $mpic="investors.gif";
22          $back_url="investor.php";          $back_url="investor.php";
23            if (! isset($type)) {
24                    $sql_where .= " and type='i'";
25            }
26            $title.=" : Investors News";
27    } elseif ($section == "about") {
28            $title="ABOUT US";
29            $lpic="about"; $lext=".gif";
30            $mpic="about.gif";
31  } else {  } else {
32          $title="What's New";          $title="What's New";
33          $lpic="new"; $lext=".jpg";          $lpic="new"; $lext=".jpg";
# Line 25  if ($section == "investor") { Line 35  if ($section == "investor") {
35          $back_url="index.php";          $back_url="index.php";
36  }  }
37    
38  $smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) );  $smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, ) );
39    
 $sql_where="where visible is true";  
40    
41  if (isset($id)) {  function find_html_file($dir,$file) {
42          $sql_where.=" and id=$id ";          $file="./$dir/$file";
43            if (is_file("$file") && file_exists("$file")) { return "$file"; }
44            if (is_file("$file.htm") && file_exists("$file.htm")) { return "$file.htm"; }
45            if (is_file("$file.html") && file_exists("$file.html")) { return "$file.html"; }
46            return 0;
47  }  }
48    
49  if (! isset($more) || !file_exists("./news/$more")) {  if (file_exists(find_html_file("news",$more))) {
50    
51  $sth = $dbh->prepare("select id,title,town_date,body,more,pdf from news $sql_where order by id desc");          $main=join('',file(find_html_file("news",$more)));
52  $sth->execute();          $back_url=$GLOBALS[HTTP_REFERER];
 while ($row=$sth->fetchrow_hash()) {  
         $data[]=$row;  
 }  
53    
54  $smarty->assign("data",$data);  } else {
55            if (isset($id)) {
56                    $sql_where.=" and id=$id ";
57            }
58    
59            if (isset($type)) {
60                    if ($type == "n") {
61                            $sql_where .= " and (type='n' or type='i')";
62                            $title.=" : News";
63                    } elseif ($type == "e") {
64                            $sql_where .= " and type='e'";
65                            $title.=" : Events";
66                    } elseif ($type == "c") {
67                            $sql_where .= " and type='c'";
68                            $title.=" : Community";
69                    }
70            }
71    
72  $main=$smarty->fetch("new.tpl");          if (! isset($show) && !isset($start)) {
73                    $sql_limit="limit 10";
74            } elseif (isset($start)) {
75                    $sql_limit="limit 10,$start";
76            }
77    
         if (isset($id) && $data[0][more]) {  
                 $main=join('',file("./news/".$data[0][more]));  
78    
79            $num_selected=0;
80            $sql="select
81                            id,upper(title) as title,town_date,body,more,pdf,
82                            (date-now()::date) as comming,type,title as title_lc
83                    from news $sql_where order by priority desc,date desc $sql_limit";
84    #       print "$sql";
85            $sth = $dbh->prepare("$sql");
86            $sth->execute();
87            while ($row=$sth->fetchrow_hash()) {
88                    $data[]=$row;
89                    $num_selected++;
90            }
91    
92            if ($num_selected == 10) {
93                    $smarty->assign(array(
94                            "multi_page_show" => 1,
95                            "multi_page_next" => "$PHP_SELF?start=".($start+10),
96                    ));
97            }
98            if ($start && $start >= 10) {
99                    $smarty->assign(array(
100                            "multi_page_show" => 1,
101                            "multi_page_prev" => "$PHP_SELF?start=".($start-10),
102                    ));
103            }
104    
105            if (isset($id) && $num_selected == 1) {
106                    if ($data[0][type] == "n") {
107                            $title.=" : News : ".$data[0][title_lc];
108                    } elseif ($data[0][type] == "e") {
109                            $title.=" : Event : ".$data[0][title_lc];
110                    } elseif ($data[0][type] == "c") {
111                            $title.=" : Community : ".$data[0][title_lc];
112                    } elseif ($data[0][type] == "r") {
113                            $title.=" : Result : ".$data[0][title_lc];
114                    } elseif ($data[0][type] == "i") {
115                            $title.=" : Investors News : ".$data[0][title_lc];
116                    } elseif ($data[0][type] == "a") {
117                            $title.=" : Annual Report : ".$data[0][title_lc];
118                    }
119            }
120    
121            $smarty->assign("data",$data);
122    
123            $main=$smarty->fetch("new.tpl");
124    
125            if (isset($id) && find_html_file("news",$data[0][more])) {
126                    $main=join('',file(find_html_file("news",$data[0][more])));
127            }
128    
129            if ($main == "") {
130                    $main = "This news item is no longer available";
131          }          }
132    
 } else {        // display details  
         $main=join('',file("./news/$more"));  
         $back_url=$GLOBALS[HTTP_REFERER];  
133  }  }
134    
135  include("common.inc");  include("common.inc");
136  $smarty->assign( array(back_url=>$back_url, MAIN=>$main));  $smarty->assign( array(back_url=>$back_url, MAIN=>$main,
137            Section_title=>$title ) );
138    
139  $smarty->display("index.tpl");  $smarty->display("index.tpl");
140  ?>  ?>

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.26