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.10 |
if (! isset($type)) { |
24 |
|
|
$sql_where .= " and type='i'"; |
25 |
|
|
} |
26 |
dpavlin |
1.9 |
$title.=" : Investors News"; |
27 |
dpavlin |
1.8 |
} elseif ($section == "about") { |
28 |
|
|
$title="ABOUT US"; |
29 |
|
|
$lpic="about"; $lext=".gif"; |
30 |
|
|
$mpic="about.gif"; |
31 |
dpavlin |
1.1 |
} else { |
32 |
|
|
$title="What's New"; |
33 |
|
|
$lpic="new"; $lext=".jpg"; |
34 |
|
|
$mpic="new.gif"; |
35 |
|
|
$back_url="index.php"; |
36 |
|
|
} |
37 |
|
|
|
38 |
dpavlin |
1.7 |
$smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, ) ); |
39 |
dpavlin |
1.1 |
|
40 |
dpavlin |
1.14 |
include("find_html_file.inc"); |
41 |
dpavlin |
1.1 |
|
42 |
dpavlin |
1.3 |
if (file_exists(find_html_file("news",$more))) { |
43 |
dpavlin |
1.1 |
|
44 |
dpavlin |
1.3 |
$main=join('',file(find_html_file("news",$more))); |
45 |
|
|
$back_url=$GLOBALS[HTTP_REFERER]; |
46 |
|
|
|
47 |
|
|
} else { |
48 |
|
|
if (isset($id)) { |
49 |
|
|
$sql_where.=" and id=$id "; |
50 |
|
|
} |
51 |
|
|
|
52 |
dpavlin |
1.5 |
if (isset($type)) { |
53 |
|
|
if ($type == "n") { |
54 |
dpavlin |
1.9 |
$sql_where .= " and (type='n' or type='i')"; |
55 |
dpavlin |
1.7 |
$title.=" : News"; |
56 |
dpavlin |
1.6 |
} elseif ($type == "e") { |
57 |
|
|
$sql_where .= " and type='e'"; |
58 |
dpavlin |
1.7 |
$title.=" : Events"; |
59 |
dpavlin |
1.8 |
} elseif ($type == "c") { |
60 |
|
|
$sql_where .= " and type='c'"; |
61 |
|
|
$title.=" : Community"; |
62 |
dpavlin |
1.5 |
} |
63 |
|
|
} |
64 |
|
|
|
65 |
|
|
if (! isset($show) && !isset($start)) { |
66 |
|
|
$sql_limit="limit 10"; |
67 |
|
|
} elseif (isset($start)) { |
68 |
|
|
$sql_limit="limit 10,$start"; |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
|
72 |
dpavlin |
1.13 |
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 week","one month","four months","six months","one year")); |
80 |
|
|
} |
81 |
|
|
|
82 |
dpavlin |
1.5 |
$num_selected=0; |
83 |
|
|
$sql="select |
84 |
|
|
id,upper(title) as title,town_date,body,more,pdf, |
85 |
dpavlin |
1.7 |
(date-now()::date) as comming,type,title as title_lc |
86 |
dpavlin |
1.6 |
from news $sql_where order by priority desc,date desc $sql_limit"; |
87 |
dpavlin |
1.7 |
# print "$sql"; |
88 |
dpavlin |
1.5 |
$sth = $dbh->prepare("$sql"); |
89 |
dpavlin |
1.3 |
$sth->execute(); |
90 |
|
|
while ($row=$sth->fetchrow_hash()) { |
91 |
|
|
$data[]=$row; |
92 |
dpavlin |
1.5 |
$num_selected++; |
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
if ($num_selected == 10) { |
96 |
|
|
$smarty->assign(array( |
97 |
|
|
"multi_page_show" => 1, |
98 |
|
|
"multi_page_next" => "$PHP_SELF?start=".($start+10), |
99 |
|
|
)); |
100 |
|
|
} |
101 |
|
|
if ($start && $start >= 10) { |
102 |
|
|
$smarty->assign(array( |
103 |
|
|
"multi_page_show" => 1, |
104 |
|
|
"multi_page_prev" => "$PHP_SELF?start=".($start-10), |
105 |
|
|
)); |
106 |
dpavlin |
1.3 |
} |
107 |
dpavlin |
1.1 |
|
108 |
dpavlin |
1.7 |
if (isset($id) && $num_selected == 1) { |
109 |
|
|
if ($data[0][type] == "n") { |
110 |
|
|
$title.=" : News : ".$data[0][title_lc]; |
111 |
|
|
} elseif ($data[0][type] == "e") { |
112 |
|
|
$title.=" : Event : ".$data[0][title_lc]; |
113 |
|
|
} elseif ($data[0][type] == "c") { |
114 |
|
|
$title.=" : Community : ".$data[0][title_lc]; |
115 |
|
|
} elseif ($data[0][type] == "r") { |
116 |
|
|
$title.=" : Result : ".$data[0][title_lc]; |
117 |
dpavlin |
1.11 |
} elseif ($data[0][type] == "i") { |
118 |
|
|
$title.=" : Investors News : ".$data[0][title_lc]; |
119 |
dpavlin |
1.12 |
} elseif ($data[0][type] == "a") { |
120 |
|
|
$title.=" : Annual Report : ".$data[0][title_lc]; |
121 |
dpavlin |
1.7 |
} |
122 |
|
|
} |
123 |
|
|
|
124 |
dpavlin |
1.13 |
|
125 |
|
|
if (isset($days) && $num_selected == 0) { |
126 |
|
|
$warning = "There are no news for last $days days."; |
127 |
|
|
} |
128 |
|
|
|
129 |
|
|
if ($main == "" && $num_selected == 0) { |
130 |
|
|
$warning = "This news item is no longer available"; |
131 |
|
|
} |
132 |
|
|
|
133 |
|
|
$smarty->assign(array( |
134 |
|
|
data=>$data, |
135 |
|
|
warning=>$warning |
136 |
|
|
)); |
137 |
dpavlin |
1.1 |
|
138 |
dpavlin |
1.3 |
$main=$smarty->fetch("new.tpl"); |
139 |
dpavlin |
1.1 |
|
140 |
dpavlin |
1.3 |
if (isset($id) && find_html_file("news",$data[0][more])) { |
141 |
|
|
$main=join('',file(find_html_file("news",$data[0][more]))); |
142 |
|
|
} |
143 |
dpavlin |
1.1 |
|
144 |
|
|
|
145 |
|
|
} |
146 |
|
|
|
147 |
|
|
include("common.inc"); |
148 |
dpavlin |
1.7 |
$smarty->assign( array(back_url=>$back_url, MAIN=>$main, |
149 |
|
|
Section_title=>$title ) ); |
150 |
dpavlin |
1.1 |
|
151 |
|
|
$smarty->display("index.tpl"); |
152 |
|
|
?> |