/[corp_html]/rss.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 /rss.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Fri May 11 06:18:41 2001 UTC (18 years, 1 month ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +3 -3 lines
changes made by back-end

1 dpavlin 1.1 <?
2    
3     #header("Content-Type: text/vnd.wap.wml");
4    
5     global $RSS;
6     $RSS=1;
7     require("conn.inc");
8     require("Smarty.class.php");
9     $smarty = new Smarty;
10    
11     if ($part && file_exists("templates/rss-$part.tpl")) {
12     include("stocks.inc");
13     $smarty->assign(array(stock=>$stock, date=>$date, time=>$time));
14     $rss=$smarty->fetch("rss-$part.tpl");
15    
16     } else {
17    
18     $on_page=5;
19    
20     $sql_where="where visible is true";
21    
22     if (!isset($s)) {
23     $sql_limit="limit $on_page";
24     } elseif (isset($s)) {
25     $sql_limit="limit $on_page,$s";
26     }
27    
28     if (isset($id)) {
29     $sql_where.=" and id=$id ";
30     }
31    
32     $num_selected=0;
33    
34     $sql="select
35     id,title,town_date,body,more,pdf,
36     (date-now()::date) as comming,type
37     from news $sql_where
38     order by priority desc,date desc $sql_limit";
39     $sth = $dbh->prepare("$sql");
40     $sth->execute();
41    
42     function fixup($html) {
43     if (strip_tags($html)) {
44     $tmp=strip_tags($html);
45     } else {
46     $tmp=$html;
47     }
48 dpavlin 1.2 return utf8_encode(htmlspecialchars($tmp));
49     # return htmlspecialchars($tmp);
50 dpavlin 1.1 }
51    
52    
53     while ($row=$sth->fetchrow_hash()) {
54     $row[title]=fixup($row[title]);
55     $row[body]=fixup($row[body]);
56     $row[town_date]=fixup($row[town_date]);
57     $data[]=$row;
58    
59     $num_selected++;
60     }
61    
62    
63     if ($num_selected == $on_page) {
64     $next=$s+$on_page;
65     }
66     if ($s && $s >= $on_page) {
67     $prev=$s-$on_page;
68     }
69    
70     $smarty->assign( array (
71     data=>$data,
72     body=>$rss_body,
73     prev=>$prev, next=>$next,
74     num_selected=>$num_selected,
75     on_page=>$on_page
76     ) );
77     $rss=$smarty->fetch("rss.tpl");
78     }
79    
80 dpavlin 1.2 print '<?xml version="1.0" encoding="UTF-8"?>
81 dpavlin 1.1 <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">
82     <rss version="0.91">
83    
84     <channel>
85     <title>Pliva News</title>
86     <link>http://www.pliva.hr</link>
87     <description>News from Pliva d.d.</description>
88     <language>en-us</language>
89    
90     '.$rss.'
91     </channel>
92     </rss>
93     ';
94    
95     ?>

  ViewVC Help
Powered by ViewVC 1.1.26