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

Contents of /new.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Fri Feb 23 15:42:52 2001 UTC (23 years, 2 months ago) by dpavlin
Branch: MAIN
Changes since 1.5: +4 -2 lines
support za priority, events

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 if ($section == "investor") {
17 $title="INVESTOR'S PAGE";
18 $lpic="investor"; $lext=".jpg";
19 $mpic="investors.gif";
20 $back_url="investor.php";
21 } else {
22 $title="What's New";
23 $lpic="new"; $lext=".jpg";
24 $mpic="new.gif";
25 $back_url="index.php";
26 }
27
28 $smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) );
29
30 $sql_where="where visible is true";
31
32 function find_html_file($dir,$file) {
33 $file="./$dir/$file";
34 if (is_file("$file") && file_exists("$file")) { return "$file"; }
35 if (is_file("$file.htm") && file_exists("$file.htm")) { return "$file.htm"; }
36 if (is_file("$file.html") && file_exists("$file.html")) { return "$file.html"; }
37 return 0;
38 }
39
40 if (file_exists(find_html_file("news",$more))) {
41
42 $main=join('',file(find_html_file("news",$more)));
43 $back_url=$GLOBALS[HTTP_REFERER];
44
45 } else {
46 if (isset($id)) {
47 $sql_where.=" and id=$id ";
48 }
49
50 if (isset($type)) {
51 if ($type == "n") {
52 $sql_where .= " and type='n'";
53 } elseif ($type == "e") {
54 $sql_where .= " and type='e'";
55 }
56 }
57
58 if (! isset($show) && !isset($start)) {
59 $sql_limit="limit 10";
60 } elseif (isset($start)) {
61 $sql_limit="limit 10,$start";
62 }
63
64
65 $num_selected=0;
66 $sql="select
67 id,upper(title) as title,town_date,body,more,pdf,
68 (date-now()::date) as comming
69 from news $sql_where order by priority desc,date desc $sql_limit";
70 print "$sql";
71 $sth = $dbh->prepare("$sql");
72 $sth->execute();
73 while ($row=$sth->fetchrow_hash()) {
74 $data[]=$row;
75 $num_selected++;
76 }
77
78 if ($num_selected == 10) {
79 $smarty->assign(array(
80 "multi_page_show" => 1,
81 "multi_page_next" => "$PHP_SELF?start=".($start+10),
82 ));
83 }
84 if ($start && $start >= 10) {
85 $smarty->assign(array(
86 "multi_page_show" => 1,
87 "multi_page_prev" => "$PHP_SELF?start=".($start-10),
88 ));
89 }
90
91 $smarty->assign("data",$data);
92
93 $main=$smarty->fetch("new.tpl");
94
95 if (isset($id) && find_html_file("news",$data[0][more])) {
96 $main=join('',file(find_html_file("news",$data[0][more])));
97 }
98
99 if ($main == "") {
100 $main = "This news item is no longer available";
101 }
102
103 }
104
105 include("common.inc");
106 $smarty->assign( array(back_url=>$back_url, MAIN=>$main));
107
108 $smarty->display("index.tpl");
109 ?>

  ViewVC Help
Powered by ViewVC 1.1.26