Commit 3d9f048d authored by Nemo Ma's avatar Nemo Ma Committed by GitHub

Merge pull request #105 from hikawiier/waaagh

kill newsinfo.php
parents 8bd8c01d 5b57c92c
...@@ -206,12 +206,11 @@ function compatible_json_encode($data){ //自动选择使用内置函数或者 ...@@ -206,12 +206,11 @@ function compatible_json_encode($data){ //自动选择使用内置函数或者
function addnews($t = 0, $n = '',$a='',$b='',$c = '', $d = '', $e = '') { function addnews($t = 0, $n = '',$a='',$b='',$c = '', $d = '', $e = '') {
global $now,$db,$tablepre,$gtablepre; global $now,$db,$tablepre,$gtablepre;
$t = $t ? $t : $now; $t = $t ? $t : $now;
$newsfile = GAME_ROOT.'./gamedata/newsinfo.php'; /*$newsfile = GAME_ROOT.'./gamedata/newsinfo.php';
touch($newsfile); touch($newsfile);*/
if(is_array($a)){ if(is_array($a)){
$a=implode('_',$a); $a=implode('_',$a);
} }
if(strpos($n,'death11') === 0 || strpos($n,'death32') === 0) { if(strpos($n,'death11') === 0 || strpos($n,'death32') === 0) {
$result = $db->query("SELECT lastword FROM {$gtablepre}users WHERE username = '$a'"); $result = $db->query("SELECT lastword FROM {$gtablepre}users WHERE username = '$a'");
$e = $lastword = $db->result($result, 0); $e = $lastword = $db->result($result, 0);
......
...@@ -65,7 +65,7 @@ function nparse_news($start = 0, $range = 0 ){//$type = '') { ...@@ -65,7 +65,7 @@ function nparse_news($start = 0, $range = 0 ){//$type = '') {
$newsinfo .= "<li>{$hour}{$min}{$sec}秒,增加禁区:"; $newsinfo .= "<li>{$hour}{$min}{$sec}秒,增加禁区:";
$alist = explode('_',$a); $alist = explode('_',$a);
foreach($alist as $ar) { foreach($alist as $ar) {
$newsinfo .= "$plsinfo[$ar] "; $newsinfo .= "{$plsinfo[$ar]} ";
} }
$newsinfo .= "<span class=\"yellow\">【天气:{$wthinfo[$b]}】</span><br>\n"; $newsinfo .= "<span class=\"yellow\">【天气:{$wthinfo[$b]}】</span><br>\n";
} elseif($news == 'hack') { } elseif($news == 'hack') {
......
...@@ -17,13 +17,13 @@ function rs_game($mode = 0) { ...@@ -17,13 +17,13 @@ function rs_game($mode = 0) {
$db->queries($sql); $db->queries($sql);
//重设游戏进行状况的时间 //重设游戏进行状况的时间
if($fp = fopen("{$dir}newsinfo.php", 'wb')) { /*if($fp = fopen("{$dir}newsinfo.php", 'wb')) {
global $checkstr; global $checkstr;
fwrite($fp, $checkstr); fwrite($fp, $checkstr);
fclose($fp); fclose($fp);
} else { } else {
gexit('Can not write to cache files, please check directory ./gamedata/ and ./gamedata/cache/ .', __file__, __line__); gexit('Can not write to cache files, please check directory ./gamedata/ and ./gamedata/cache/ .', __file__, __line__);
} }*/
//清空战斗信息 //清空战斗信息
global $hdamage,$hplayer,$noisetime,$noisepls,$noiseid,$noiseid2,$noisemode,$starttime,$gamevars; global $hdamage,$hplayer,$noisetime,$noisepls,$noiseid,$noiseid2,$noisemode,$starttime,$gamevars;
...@@ -272,6 +272,7 @@ function rs_game($mode = 0) { ...@@ -272,6 +272,7 @@ function rs_game($mode = 0) {
$qry = ''; $qry = '';
foreach($shoplist as $lst){ foreach($shoplist as $lst){
if(!empty($lst) && strpos($lst,',')!==false){ if(!empty($lst) && strpos($lst,',')!==false){
if(empty($lst[8])) $lst[8] = '';
list($kind,$num,$price,$area,$item,$itmk,$itme,$itms,$itmsk)=explode(',',$lst); list($kind,$num,$price,$area,$item,$itmk,$itme,$itms,$itmsk)=explode(',',$lst);
if($kind != 0){ if($kind != 0){
$qry .= "('$kind','$num','$price','$area','$item','$itmk','$itme','$itms','$itmsk'),"; $qry .= "('$kind','$num','$price','$area','$item','$itmk','$itme','$itms','$itmsk'),";
......
...@@ -9,6 +9,7 @@ require './include/game.func.php'; ...@@ -9,6 +9,7 @@ require './include/game.func.php';
require_once GAME_ROOT.'./include/news.func.php'; require_once GAME_ROOT.'./include/news.func.php';
include_once GAME_ROOT.'./include/system.func.php'; include_once GAME_ROOT.'./include/system.func.php';
/*
$newsfile = GAME_ROOT.'./gamedata/newsinfo.php'; $newsfile = GAME_ROOT.'./gamedata/newsinfo.php';
$newshtm = GAME_ROOT.TPLDIR.'/newsinfo.htm'; $newshtm = GAME_ROOT.TPLDIR.'/newsinfo.htm';
$lnewshtm = GAME_ROOT.TPLDIR.'/lastnews.htm'; $lnewshtm = GAME_ROOT.TPLDIR.'/lastnews.htm';
...@@ -16,12 +17,14 @@ $lnewshtm = GAME_ROOT.TPLDIR.'/lastnews.htm'; ...@@ -16,12 +17,14 @@ $lnewshtm = GAME_ROOT.TPLDIR.'/lastnews.htm';
if(filemtime($newsfile) > filemtime($lnewshtm)) { if(filemtime($newsfile) > filemtime($lnewshtm)) {
$lnewsinfo = nparse_news(0,$newslimit); $lnewsinfo = nparse_news(0,$newslimit);
writeover($lnewshtm,$lnewsinfo); writeover($lnewshtm,$lnewsinfo);
} }*/
$last_newsinfo = nparse_news(0,50);
if(!isset($newsmode)){$newsmode = '';} if(!isset($newsmode)){$newsmode = '';}
if($newsmode == 'last') { if($newsmode == 'last') {
echo $last_newsinfo;
include template('lastnews');
$newsdata['innerHTML']['newsinfo'] = ob_get_contents(); $newsdata['innerHTML']['newsinfo'] = ob_get_contents();
if(isset($error)){$newsdata['innerHTML']['error'] = $error;} if(isset($error)){$newsdata['innerHTML']['error'] = $error;}
ob_clean(); ob_clean();
...@@ -32,11 +35,12 @@ if($newsmode == 'last') { ...@@ -32,11 +35,12 @@ if($newsmode == 'last') {
ob_end_flush(); ob_end_flush();
} elseif($newsmode == 'all') { } elseif($newsmode == 'all') {
if(filemtime($newsfile) > filemtime($newshtm)) { /*if(filemtime($newsfile) > filemtime($newshtm)) {
$newsinfo = nparse_news(0,65535); $newsinfo = nparse_news(0,65535);
writeover($newshtm,$newsinfo); writeover($newshtm,$newsinfo);
} }*/
include template('newsinfo'); $newsinfo = nparse_news(0,65535);
echo $newsinfo;
$newsdata['innerHTML']['newsinfo'] = ob_get_contents(); $newsdata['innerHTML']['newsinfo'] = ob_get_contents();
if(isset($error)){$newsdata['innerHTML']['error'] = $error;} if(isset($error)){$newsdata['innerHTML']['error'] = $error;}
ob_clean(); ob_clean();
......
...@@ -24,11 +24,7 @@ ...@@ -24,11 +24,7 @@
<div id="newsinfo"> <div id="newsinfo">
<!--{if $newsmode == 'all'}--> {$last_newsinfo}
{template newsinfo}
<!--{else}-->
{template lastnews}
<!--{/if}-->
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment