/[pliva-si]/sections/novosti.inc
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 /sections/novosti.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (hide annotations)
Wed Nov 21 09:16:47 2001 UTC (22 years, 5 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +3 -3 lines
prijevodi

1 dpavlin 1.1 <?
2    
3     include("news_sif.inc");
4    
5 dpavlin 1.5 $sql_where="where $visible_is_true";
6 dpavlin 1.1
7 dpavlin 1.8 $smarty->assign("m_session","&m=o_nas&");
8     $smarty->assign("m_session_urlend","&m=o_nas&");
9     $smarty->assign("m_form_session",'<input type="hidden" name="m" value="o_nas">');
10    
11 dpavlin 1.1 if (file_exists(find_html_file("more",$more))) {
12    
13     $main=join('',file(find_html_file("more",$more)));
14     $back_url=$GLOBALS[HTTP_REFERER];
15    
16     } else {
17     if (isset($id)) {
18     $sql_where.=" and id=$id ";
19     }
20    
21     if (isset($type)) {
22     if ($type == "n") {
23     $sql_where .= " and substr(type,1,1)='n'";
24     $title.=" : Novosti";
25     } elseif ($type == "e") {
26     $sql_where .= " and substr(type,1,1)='e'";
27     $title.=" : Dogotki";
28 dpavlin 1.2 } elseif (strlen($type) == 3) {
29     $sql_where .= " and type='$type'";
30 dpavlin 1.7 if (substr($type,0,2) == "mp" || $type=="mcx" || $type=="mix") $title.=" : Publikacije";
31 dpavlin 1.6 if ($type=="mp_") {
32     $title.=" : PLIVA Magazin";
33     $smarty->assign("mtext","PLIVA Magazin");
34 dpavlin 1.7 } elseif ($type=="mpx") {
35     $title.=" : Pharna Info";
36     $smarty->assign("mtext","Pharma Info");
37     } elseif ($type=="mcx") {
38     $title.=" : Medicus";
39     $smarty->assign("mtext","Medicus");
40     } elseif ($type=="mix") {
41     $title.=" : Medinfo bulletin";
42     $smarty->assign("mtext","Medinfo bulletin");
43 dpavlin 1.6 }
44 dpavlin 1.1 }
45     }
46    
47     if (! isset($show) && !isset($start)) {
48     $sql_limit="limit 10";
49     } elseif (isset($start)) {
50     $sql_limit="limit 10,$start";
51     }
52    
53    
54     if (isset($days)) {
55     if ($days != 0) {
56     $sql_where.=" and date(now())-date(date) > 0 and date(now())-date(date) < $days";
57 dpavlin 1.8 $title.=" : Pregled novic zadnjega $days dni";
58 dpavlin 1.1 }
59     $smarty->assign("days",$days);
60     $smarty->assign("last_days",array(14,30,160,240,365));
61 dpavlin 1.10 $smarty->assign("last_desc",array("zadnjih 14 dneh","meseca","¹tirih mesecev","¹estih mesecev","enega leta"));
62 dpavlin 1.1 }
63    
64     $num_selected=0;
65     $sql="select
66     id,upper(title) as title,town_date,body,more,pdf,
67     (date-now()::date) as comming,type,title as title_lc
68     from news $sql_where order by priority desc,date desc $sql_limit";
69     # print "$sql";
70     $sth = $dbh->prepare("$sql");
71     $sth->execute();
72     while ($row=$sth->fetchrow_hash()) {
73 dpavlin 1.8 if ($row[pdf]) $row[url]="blob/".$row[pdf];
74 dpavlin 1.1 $data[]=$row;
75     $num_selected++;
76     }
77    
78     if ($num_selected == 10) {
79     $tmp="$PHP_SELF?start=".($start+10);
80     if ($days) $tmp.="&days=$days";
81     $smarty->assign(array(
82     "multi_page_show" => 1,
83     "multi_page_next" => $tmp
84     ));
85     }
86     if ($start && $start >= 10) {
87     $tmp="$PHP_SELF?start=".($start-10);
88     if ($days) $tmp.="&days=$days";
89     $smarty->assign(array(
90     "multi_page_show" => 1,
91     "multi_page_prev" => $tmp
92     ));
93     }
94    
95     if (isset($id) && $num_selected == 1) {
96     $title.=" : ".$news_sif[$data[0][type]];
97     $title.=" : ".$data[0][title_lc];
98     }
99    
100    
101     if (isset($days) && $num_selected == 0) {
102 dpavlin 1.10 $warning = "Ni novic v zadnjih $days dneh.";
103 dpavlin 1.1 } elseif ($main == "" && $num_selected == 0) {
104 dpavlin 1.10 $warning = "Podatki niso veæ dostopni.";
105 dpavlin 1.1 }
106    
107     $smarty->assign(array(
108     data=>$data,
109     warning=>$warning
110     ));
111    
112    
113     if (isset($id) && find_html_file("more",$data[0][more])) {
114     $main=join('',file(find_html_file("more",$data[0][more])));
115 dpavlin 1.3 } else {
116 dpavlin 1.4 if (! isset($p)) $p="novosti";
117 dpavlin 1.3 $logo="p/${p}_".$data[0][type].".jpg";
118     if (file_exists($logo)) {
119     $smarty->assign("logo",$logo);
120     }
121     $main=$smarty->fetch("$p.tpl");
122 dpavlin 1.1 }
123    
124    
125     }
126    
127     $smarty->assign( array(back_url=>$back_url) );
128 dpavlin 1.3
129 dpavlin 1.1
130     ?>

  ViewVC Help
Powered by ViewVC 1.1.26