Logo Search packages:      
Sourcecode: dacode version File versions  Download package

news.php3

<?php
/* daCode http://www.dacode.org
 * htdocs/wap/news.php3
 * Fabien Penso <penso@linuxfr.org>
 * $Id: news.php3,v 1.12.2.5 2002/08/10 22:04:09 pterjan Exp $
 *
 * This is used to make a WML/WAP version
 */

      if (!ereg("^[0-9]+$",$HTTP_GET_VARS['news_id'])) {
            exit;
      }

      $topdir = '..';
      require $topdir.'/dacode.php3';
      $news = LoadClass('News');

      header("Content-Type: text/vnd.wap.wml");
      $ret = '<?xml version="1.0" encoding="'.$config->encodingcharset.'"?>'."\n";

      $ret .= '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" '.
            '"http://www.wapforum.org/DTD/wml_1.1.xml">'."\n".
            "<wml>\n".
            "<head>\n".
            '<meta http-equiv="Content-Type" content="text/html; '.
            'charset='.$config->encodingcharset.'" />'."\n".
            '<meta http-equiv="Cache-Control" content="max-age=0" />'.
            "\n</head>\n".
            '<card id="card1" title="'.$config->name.'">'."\n";

      $tmp = $news->get_news(1,0,0,1,1,$HTTP_GET_VARS['news_id'],1,0);

      if (gettype($tmp) == "array") {
            reset($tmp);
            while(current($tmp)) {
                  $cur = current($tmp);

                  $cur['title'] = htmlspecialchars($cur['title']);
                  $cur['title'] = preg_replace("/\\\$/", "\\\$\\\$", $cur['title']);

                  $ret .= '<p align="center"><u>'.$cur['title'].'</u></p>'."\n".
                        '<p align="left"><small>';

                  if ($cur['content_type'] == "text/plain") {
                        $cur['body'] = htmlspecialchars($cur['body']);
                        $cur['body'] = nl2br($cur['body']);
                  }

                  $cur['body'] = preg_replace("/\\\$/", "\\\$\\\$", $cur['body']);
                  $ret .= preg_replace("/<br>/i","<br />",$cur['body']).
                        '</small></p>'."\n";

                  next($tmp);
            }
      }

      $ret .= '<p align="center">'.
            '<do type="prev" label="'.lecho("back").'"><prev /></do>'.
            "</p>\n\n</card>\n</wml>\n";

      echo $ret;

?>

Generated by  Doxygen 1.6.0   Back to index