Tokiwa Battle Royale  GE777
A PHP Battle Royale inspired game
 All Data Structures Namespaces Files Functions Variables Pages
news.php
Go to the documentation of this file.
1 <?php
2 
3 define('CURSCRIPT', 'news');
4 
5 require './include/common.inc.php';
6 //$t_s=getmicrotime();
7 //require_once GAME_ROOT.'./include/JSON.php';
8 require_once GAME_ROOT.'./include/news.func.php';
9 
10 
11 $newsfile = GAME_ROOT.'./gamedata/newsinfo.php';
12 $newshtm = GAME_ROOT.TPLDIR.'/newsinfo.htm';
13 $lnewshtm = GAME_ROOT.TPLDIR.'/lastnews.htm';
14 
15 if(filemtime($newsfile) > filemtime($lnewshtm)) {
16  $lnewsinfo = nparse_news(0,$newslimit);
17  writeover($lnewshtm,$lnewsinfo);
18 }
19 if(!isset($newsmode)){$newsmode = '';}
20 
21 if($newsmode == 'last') {
22 
23  include template('lastnews');
24  $newsdata['innerHTML']['newsinfo'] = ob_get_contents();
25  if(isset($error)){$newsdata['innerHTML']['error'] = $error;}
26  ob_clean();
28 // $json = new Services_JSON();
29 // $jgamedata = $json->encode($newsdata);
30  echo $jgamedata;
31  ob_end_flush();
32 } elseif($newsmode == 'all') {
33 
34  if(filemtime($newsfile) > filemtime($newshtm)) {
35  $newsinfo = nparse_news(0,65535);
36  writeover($newshtm,$newsinfo);
37  }
38  include template('newsinfo');
39  $newsdata['innerHTML']['newsinfo'] = ob_get_contents();
40  if(isset($error)){$newsdata['innerHTML']['error'] = $error;}
41  ob_clean();
43  //$json = new Services_JSON();
44  //$jgamedata = $json->encode($newsdata);
45  echo $jgamedata;
46  ob_end_flush();
47 
48 } elseif($newsmode == 'chat') {
49  $newsdata['innerHTML']['newsinfo'] = '';
50  $chats = getchat(0,'',$chatinnews);
51  $chatmsg = $chats['msg'];
52  foreach($chatmsg as $val){
53  $newsdata['innerHTML']['newsinfo'] .= $val;
54  }
55  if(isset($error)){$newsdata['innerHTML']['error'] = $error;}
56  ob_clean();
58 // $json = new Services_JSON();
59 // $jgamedata = $json->encode($newsdata);
60  echo $jgamedata;
61  ob_end_flush();
62 } else {
63  include template('news');
64 }
65 //$t_e=getmicrotime();
66 //putmicrotime($t_s,$t_e,'news_time');
67 
68 ?>
$chatinnews
Definition: system.php:47
writeover($filename, $data, $method="rb+", $iflock=1, $check=1, $chmod=1)
if(!defined('IN_GAME')) nparse_news($start=0, $range=0)
Definition: news.func.php:8
getchat($last, $team='', $limit=0)
【生存者数:<?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
Definition: news.php:13
const GAME_ROOT
Definition: clear.php:6
$error
Definition: errorpage.php:2
$jgamedata
Definition: alive.php:173
$newslimit
Definition: system.php:30
$newsfile
Definition: news.php:11
$newshtm
Definition: news.php:12
compatible_json_encode($data)