/[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.15 by dpavlin, Mon Apr 9 13:30:14 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    
40  $sql_where="where visible is true";  include("find_html_file.inc");
41    
42  if (isset($id)) {  if (file_exists(find_html_file("news",$more))) {
         $sql_where.=" and id=$id ";  
 }  
43    
44  if (! isset($more) || !file_exists("./news/$more")) {          $main=join('',file(find_html_file("news",$more)));
45            $back_url=$GLOBALS[HTTP_REFERER];
46    
47  $sth = $dbh->prepare("select id,title,town_date,body,more,pdf from news $sql_where order by id desc");  } else {
48  $sth->execute();          if (isset($id)) {
49  while ($row=$sth->fetchrow_hash()) {                  $sql_where.=" and id=$id ";
50          $data[]=$row;          }
 }  
51    
52  $smarty->assign("data",$data);          if (isset($type)) {
53                    if ($type == "n") {
54                            $sql_where .= " and (type='n' or type='i')";
55                            $title.=" : News";
56                    } elseif ($type == "e") {
57                            $sql_where .= " and type='e'";
58                            $title.=" : Events";
59                    } elseif ($type == "c") {
60                            $sql_where .= " and type='c'";
61                            $title.=" : Community";
62                    }
63            }
64    
65  $main=$smarty->fetch("new.tpl");          if (! isset($show) && !isset($start)) {
66                    $sql_limit="limit 10";
67            } elseif (isset($start)) {
68                    $sql_limit="limit 10,$start";
69            }
70    
         if (isset($id) && $data[0][more]) {  
                 $main=join('',file("./news/".$data[0][more]));  
71    
72            if (isset($days)) {
73                    if ($days != 0) {
74                            $sql_where.=" and date(now())-date(date) > 0 and date(now())-date(date) < $days";
75                            $title.=" : News in last $days days";
76                    }
77                    $smarty->assign("days",$days);
78                    $smarty->assign("last_days",array(14,30,160,240,365));
79                    $smarty->assign("last_desc",array("two weeks","one month","four months","six months","one year"));
80          }          }
81    
82  } else {        // display details          $num_selected=0;
83          $main=join('',file("./news/$more"));          $sql="select
84          $back_url=$GLOBALS[HTTP_REFERER];                          id,upper(title) as title,town_date,body,more,pdf,
85                            (date-now()::date) as comming,type,title as title_lc
86                    from news $sql_where order by priority desc,date desc $sql_limit";
87    #       print "$sql";
88            $sth = $dbh->prepare("$sql");
89            $sth->execute();
90            while ($row=$sth->fetchrow_hash()) {
91                    $data[]=$row;
92                    $num_selected++;
93            }
94    
95            if ($num_selected == 10) {
96                    $tmp="$PHP_SELF?start=".($start+10);
97                    if ($days) $tmp.="&days=$days";
98                    $smarty->assign(array(
99                            "multi_page_show" => 1,
100                            "multi_page_next" => $tmp
101                    ));
102            }
103            if ($start && $start >= 10) {
104                    $tmp="$PHP_SELF?start=".($start-10);
105                    if ($days) $tmp.="&days=$days";
106                    $smarty->assign(array(
107                            "multi_page_show" => 1,
108                            "multi_page_prev" => $tmp
109                    ));
110            }
111    
112            if (isset($id) && $num_selected == 1) {
113                    if ($data[0][type] == "n") {
114                            $title.=" : News : ".$data[0][title_lc];
115                    } elseif ($data[0][type] == "e") {
116                            $title.=" : Event : ".$data[0][title_lc];
117                    } elseif ($data[0][type] == "c") {
118                            $title.=" : Community : ".$data[0][title_lc];
119                    } elseif ($data[0][type] == "r") {
120                            $title.=" : Result : ".$data[0][title_lc];
121                    } elseif ($data[0][type] == "i") {
122                            $title.=" : Investors News : ".$data[0][title_lc];
123                    } elseif ($data[0][type] == "a") {
124                            $title.=" : Annual Report : ".$data[0][title_lc];
125                    }
126            }
127    
128    
129            if (isset($days) && $num_selected == 0) {
130                    $warning = "There are no news for last $days days.";
131            } elseif ($main == "" && $num_selected == 0) {
132                    $warning = "This news item is no longer available";
133            }
134    
135            $smarty->assign(array(
136                    data=>$data,
137                    warning=>$warning
138                    ));
139    
140            $main=$smarty->fetch("new.tpl");
141    
142            if (isset($id) && find_html_file("news",$data[0][more])) {
143                    $main=join('',file(find_html_file("news",$data[0][more])));
144            }
145    
146    
147  }  }
148    
149  include("common.inc");  include("common.inc");
150  $smarty->assign( array(back_url=>$back_url, MAIN=>$main));  $smarty->assign( array(back_url=>$back_url, MAIN=>$main,
151            Section_title=>$title ) );
152    
153  $smarty->display("index.tpl");  $smarty->display("index.tpl");
154  ?>  ?>

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

  ViewVC Help
Powered by ViewVC 1.1.26