/[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.6 - (hide annotations)
Wed Nov 7 12:09:58 2001 UTC (22 years, 5 months ago) by dpavlin
Branch: MAIN
Changes since 1.5: +4 -0 lines
mnogo toga

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     if (file_exists(find_html_file("more",$more))) {
8    
9     $main=join('',file(find_html_file("more",$more)));
10     $back_url=$GLOBALS[HTTP_REFERER];
11    
12     } else {
13     if (isset($id)) {
14     $sql_where.=" and id=$id ";
15     }
16    
17     if (isset($type)) {
18     if ($type == "n") {
19     $sql_where .= " and substr(type,1,1)='n'";
20     $title.=" : Novosti";
21     } elseif ($type == "e") {
22     $sql_where .= " and substr(type,1,1)='e'";
23     $title.=" : Dogotki";
24 dpavlin 1.2 } elseif (strlen($type) == 3) {
25     $sql_where .= " and type='$type'";
26 dpavlin 1.6 if ($type=="mp_") {
27     $title.=" : PLIVA Magazin";
28     $smarty->assign("mtext","PLIVA Magazin");
29     }
30 dpavlin 1.1 }
31     }
32    
33     if (! isset($show) && !isset($start)) {
34     $sql_limit="limit 10";
35     } elseif (isset($start)) {
36     $sql_limit="limit 10,$start";
37     }
38    
39    
40     if (isset($days)) {
41     if ($days != 0) {
42     $sql_where.=" and date(now())-date(date) > 0 and date(now())-date(date) < $days";
43     $title.=" : News in last $days days";
44     }
45     $smarty->assign("days",$days);
46     $smarty->assign("last_days",array(14,30,160,240,365));
47     $smarty->assign("last_desc",array("two weeks","one month","four months","six months","one year"));
48     }
49    
50     $num_selected=0;
51     $sql="select
52     id,upper(title) as title,town_date,body,more,pdf,
53     (date-now()::date) as comming,type,title as title_lc
54     from news $sql_where order by priority desc,date desc $sql_limit";
55     # print "$sql";
56     $sth = $dbh->prepare("$sql");
57     $sth->execute();
58     while ($row=$sth->fetchrow_hash()) {
59     $data[]=$row;
60     $num_selected++;
61     }
62    
63     if ($num_selected == 10) {
64     $tmp="$PHP_SELF?start=".($start+10);
65     if ($days) $tmp.="&days=$days";
66     $smarty->assign(array(
67     "multi_page_show" => 1,
68     "multi_page_next" => $tmp
69     ));
70     }
71     if ($start && $start >= 10) {
72     $tmp="$PHP_SELF?start=".($start-10);
73     if ($days) $tmp.="&days=$days";
74     $smarty->assign(array(
75     "multi_page_show" => 1,
76     "multi_page_prev" => $tmp
77     ));
78     }
79    
80     if (isset($id) && $num_selected == 1) {
81     $title.=" : ".$news_sif[$data[0][type]];
82     $title.=" : ".$data[0][title_lc];
83     }
84    
85    
86     if (isset($days) && $num_selected == 0) {
87     $warning = "There are no news for last $days days.";
88     } elseif ($main == "" && $num_selected == 0) {
89     $warning = "This news item is no longer available";
90     }
91    
92     $smarty->assign(array(
93     data=>$data,
94     warning=>$warning
95     ));
96    
97    
98     if (isset($id) && find_html_file("more",$data[0][more])) {
99     $main=join('',file(find_html_file("more",$data[0][more])));
100 dpavlin 1.3 } else {
101 dpavlin 1.4 if (! isset($p)) $p="novosti";
102 dpavlin 1.3 $logo="p/${p}_".$data[0][type].".jpg";
103     if (file_exists($logo)) {
104     $smarty->assign("logo",$logo);
105     }
106     $main=$smarty->fetch("$p.tpl");
107 dpavlin 1.1 }
108    
109    
110     }
111    
112     $smarty->assign( array(back_url=>$back_url) );
113 dpavlin 1.3
114 dpavlin 1.1
115     ?>

  ViewVC Help
Powered by ViewVC 1.1.26