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

Annotation of /new.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations)
Wed Feb 28 14:16:33 2001 UTC (21 years, 11 months ago) by dpavlin
Branch: MAIN
Changes since 1.8: +5 -2 lines
misc

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

  ViewVC Help
Powered by ViewVC 1.1.26