Просмотр файла wapnuke05/html/modules/Wap/print.php

Размер файла: 3.51Kb
<?php

/* version  0.5
   home     http://wapnuke.org/
   author   Antonio Terreno
   email    [email protected]
*/

######################################################################
# PHP-NUKE: Web Portal System: Wap Add-on 
# ===========================================
#
# This module is to view your last news items via wap enabled devices 
# This program is free software. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
#
# Copyright (c) 2002 by Antonio Terreno - http://java2me.org
######################################################################

if (!eregi("modules.php", $PHP_SELF)) {
	die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

header("Content-type: text/vnd.wap.wml");
//Puts the header content type to wml

if(!isset($sid)) {
    exit();
}
function PrintPage($sid) {

global $site_logo, $nukeurl, $sitename, $datetime, $prefix, $dbi;

//now wapnuke supports all tags :-D 

$search  = array  ("'(<\/?)(w+)([^>]*>)'e",
                   "'(<\/?)(br|hr)([^>]*)( />)'ie", 
                   "'(<\/?)(br|hr)([^>]*)(/>)'ie",
                   "'(<\/?)(br|hr)([^>]*)(>)'ie",
                   "'(w+=)(w+)'ie",
                   "'(w+=)(.+?)'ie",
                   "'(<\/?)(img|input|table|td|tr|font)([^>]*)( />)'ie",
                   "'(<\/?)(img|input|table|td|tr|font)([^>]*)(/>)'ie",
                   "'(<\/?)(img|input|table|td|tr|font)([^>]*)(>)'ie",
		   "'(<\/?)(p|blockquote|h1|h2|h3|h4|h5|h6|div|code|tt|em|strong|i|cite|b|pre)([^>]*)( />)'ie",
                   "'(<\/?)(p|blockquote|h1|h2|h3|h4|h5|h6|div|code|tt|em|strong|i|cite|b|pre)([^>]*)(/>)'ie",
                   "'(<\/?)(p|blockquote|h1|h2|h3|h4|h5|h6|div|code|tt|em|strong|i|cite|b|pre)([^>]*)(>)'ie");



$replace = array ("'\\1'.strtolower('\\2').'\\3'",
                   "'\\1\\2\\3>'",
                   "'\\1\\2\\3>'",
                   "'\\1\\2\\3 /\\4'",
                   "strtolower('\\1').'\"\\2\"'",
                   "strtolower('\\1').'\\2'",
		   " ",
		   " ",
		   " ",
                   "'\\1'.strtolower('\\2').'\\3'.'\\4'",
		   "'\\1'.strtolower('\\2').'\\3'.'\\4'",
		   "'\\1'.strtolower('\\2').'\\3'.'\\4'");
 
$result = sql_query("select title, time, hometext, bodytext, topic, notes from ".$prefix."_stories where sid=$sid", $dbi);
       
    list($title, $time, $hometext, $bodytext, $topic, $notes) = sql_fetch_row($result, $dbi);
    
    $result2 = sql_query("select topictext from ".$prefix."_topics where topicid=$topic", $dbi);

    list($topictext) = sql_fetch_row($result2, $dbi);
    formatTimestamp($time);

$homexhtml = preg_replace($search, $replace, $hometext);	
$bodyxhtml = preg_replace($search, $replace, $bodytext);	

echo "<?xml version=\"1.0\"?>\n"
    ."<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">"
    ."<wml>\n\n"
    ."<template>"
    ."<do name=\"back\" type=\"prev\" label=\"Back\">"
    ."<prev/>"
    ."</do>"
    ."</template>"

    ."<card id=\"Card02\" title=\"News\">\n" 
    ."<p>\n"
    ."<b>$title</b>\n"
    ."<b>"._PDATE."</b> $datetime<br/><b>"
    ._PTOPIC." </b> $topictext<br/><br/>"
    ."$homexhtml<br/><br/>"
    ."$bodyxhtml<br/>"
    ."Posted: $time<br/>"    
    ."</p>"
    ."</card>"
    ."</wml>";

}

PrintPage($sid);

?>