All Data Structures Namespaces Files Functions Variables Pages
news.php
Go to the documentation of this file.
<?php
define('CURSCRIPT', 'news');
require './include/common.inc.php';
//$t_s=getmicrotime();
//require_once GAME_ROOT.'./include/JSON.php';
require_once GAME_ROOT.'./include/news.func.php';
$newsfile = GAME_ROOT.'./gamedata/newsinfo.php';
$newshtm = GAME_ROOT.TPLDIR.'/newsinfo.htm';
$lnewshtm = GAME_ROOT.TPLDIR.'/lastnews.htm';
if(filemtime($newsfile) > filemtime($lnewshtm)) {
$lnewsinfo = nparse_news(0,$newslimit);
writeover($lnewshtm,$lnewsinfo);
}
if(!isset($newsmode)){$newsmode = '';}
if($newsmode == 'last') {
include template('lastnews');
$newsdata['innerHTML']['newsinfo'] = ob_get_contents();
if(isset($error)){$newsdata['innerHTML']['error'] = $error;}
ob_clean();
$jgamedata = compatible_json_encode($newsdata);
// $json = new Services_JSON();
// $jgamedata = $json->encode($newsdata);
echo $jgamedata;
ob_end_flush();
} elseif($newsmode == 'all') {
if(filemtime($newsfile) > filemtime($newshtm)) {
$newsinfo = nparse_news(0,65535);
writeover($newshtm,$newsinfo);
}
include template('newsinfo');
$newsdata['innerHTML']['newsinfo'] = ob_get_contents();
if(isset($error)){$newsdata['innerHTML']['error'] = $error;}
ob_clean();
$jgamedata = compatible_json_encode($newsdata);
//$json = new Services_JSON();
//$jgamedata = $json->encode($newsdata);
echo $jgamedata;
ob_end_flush();
} elseif($newsmode == 'chat') {
$newsdata['innerHTML']['newsinfo'] = '';
$chats = getchat(0,'',$chatinnews);
$chatmsg = $chats['msg'];
foreach($chatmsg as $val){
$newsdata['innerHTML']['newsinfo'] .= $val;
}
if(isset($error)){$newsdata['innerHTML']['error'] = $error;}
ob_clean();
$jgamedata = compatible_json_encode($newsdata);
// $json = new Services_JSON();
// $jgamedata = $json->encode($newsdata);
echo $jgamedata;
ob_end_flush();
} else {
include template('news');
}
//$t_e=getmicrotime();
//putmicrotime($t_s,$t_e,'news_time');
?>
$chatinnews
$chatinnews
Definition: system.php:47
writeover
writeover($filename, $data, $method="rb+", $iflock=1, $check=1, $chmod=1)
Definition: global.func.php:155
nparse_news
if(!defined('IN_GAME')) nparse_news($start=0, $range=0)
Definition: news.func.php:8
getchat
getchat($last, $team='', $limit=0)
Definition: global.func.php:375
elseif
【生存者数：<?php echo $alivenum?> 人】< input type="button"value="显示全部幸存者"onClick="$('alivemode').value='all';$('gbmode').value='none';postCmd('alive','alive.php');"></p > if($gamblingon &&$gamestate >=20) elseif($gamblingon &&$gamestate<=10)
Definition: 1_alive.tpl.php:18
$lnewshtm
$lnewshtm
Definition: news.php:13
GAME_ROOT
const GAME_ROOT
Definition: clear.php:6
$error
$error
Definition: errorpage.php:2
$jgamedata
$jgamedata
Definition: alive.php:173
$newslimit
$newslimit
Definition: system.php:30
$newsfile
$newsfile
Definition: news.php:11
$newshtm
$newshtm
Definition: news.php:12
compatible_json_encode
compatible_json_encode($data)
Definition: global.func.php:185