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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Wed Feb 28 09:53:13 2001 UTC (21 years, 2 months ago) by dpavlin
Branch: MAIN
WAP podrıka

1 dpavlin 1.1 <?
2    
3     require("Smarty.class.php");
4    
5     // hdml;version=3.0"
6     if (strstr(strtolower($HTTP_ACCEPT), "text/vnd.wap.wml")) {
7    
8     global $WAP;
9     $WAP=1;
10     require("conn.inc");
11     header("Content-Type: text/vnd.wap.wml");
12    
13     $sql_where="where visible is true";
14    
15     if (!isset($s)) {
16     $sql_limit="limit 10";
17     } elseif (isset($s)) {
18     $sql_limit="limit 10,$s";
19     }
20    
21     if (isset($id)) {
22     $sql_where.=" and id=$id ";
23     }
24    
25     $num_selected=0;
26    
27     $sql="select
28     id,title,town_date,body,more,pdf,
29     (date-now()::date) as comming,type
30     from news $sql_where order by priority desc,date desc $sql_limit";
31     $sth = $dbh->prepare("$sql");
32     $sth->execute();
33    
34     function fixup($html) {
35     if (strip_tags($html)) {
36     $tmp=strip_tags($html);
37     } else {
38     $tmp=$html;
39     }
40     return utf8_encode(htmlspecialchars($tmp));
41     }
42    
43     $smarty = new Smarty;
44    
45     while ($row=$sth->fetchrow_hash()) {
46     $row[title]=fixup($row[title]);
47     $row[body]=fixup($row[body]);
48     $row[town_date]=fixup($row[town_date]);
49     $data[]=$row;
50    
51     $num_selected++;
52     }
53    
54    
55     if ($num_selected == 10) {
56     $next=$s+10;
57     }
58     if ($s && $s >= 10) {
59     $prev=$s-10;
60     }
61    
62     $smarty->assign( array (
63     data=>$data,
64     body=>$wml_body,
65     prev=>$prev, next=>$next,
66     num_selected=>$num_selected
67     ) );
68     print '<?xml version="1.0"?>
69     <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">';
70    
71     $smarty->display("wap.tpl");
72    
73     } else {
74     print "You need wap-enabled device or browser for this page!
75     <br>Go <a href=\"index.php\">back to main site</a>.";
76     }
77     ?>

  ViewVC Help
Powered by ViewVC 1.1.26