정적 분석기 결과 반영

This commit is contained in:
2018-04-08 23:39:02 +09:00
parent eeaae898ae
commit 27d313c594
23 changed files with 100 additions and 123 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ return [
"target_php_version" => '7.0',
'backward_compatibility_checks ' => false,
'ignore_undeclared_variables_in_global_scope' => false,
'minimum_severity'=>\Phan\Issue::SEVERITY_NORMAL,
'minimum_severity'=>\Phan\Issue::SEVERITY_LOW,
'file_list' => [
'f_config/config.php',
+2 -28
View File
@@ -13,20 +13,7 @@ class ServConfig
public static function getSharedIconPath() : string
{
static $path = '';
if($path){
$path;
}
if (Util::starts_with('http', self::$sharedIconPath)
|| Util::starts_with('//', self::$sharedIconPath))
{
$path = self::$sharedIconPath;
}
else{
$path = self::$serverWebPath.'/'.self::$sharedIconPath;
}
return $path;
return static::$sharedIconPath;
}
public static function getUserIconPath() : string
@@ -36,20 +23,7 @@ class ServConfig
public static function getGameImagePath() : string
{
static $path = '';
if($path){
$path;
}
if (Util::starts_with('http', self::$gameImagePath)
|| Util::starts_with('//', self::$gameImagePath))
{
$path = self::$gameImagePath;
}
else{
$path = self::$serverWebPath.'/'.self::$gameImagePath;
}
return $path;
return static::$gameImagePath;
}
+3 -4
View File
@@ -44,8 +44,7 @@ switch ($btn) {
if ($lognum >= 29) {
$lognum = 0;
}
$history[0] = "<R>★</><S>{$log}</>";
pushWorldHistory($history);
pushWorldHistory(["<R>★</><S>{$log}</>"]);
break;
case "변경1":
$query = "update game set starttime='$starttime'";
@@ -113,8 +112,8 @@ switch ($btn) {
}
}
}
$history[] = "<R>★</>턴시간이 <C>$btn</>으로 변경됩니다.";
pushWorldHistory($history);
pushWorldHistory(["<R>★</>턴시간이 <C>$btn</>으로 변경됩니다."]);
break;
}
-1
View File
@@ -52,7 +52,6 @@ switch($btn) {
case "메세지 전달":
//TODO:새 갠메 시스템으로 변경
$date = date('Y-m-d H:i:s');
$msg;
for($i=0; $i < count($genlist); $i++) {
}
break;
+27 -25
View File
@@ -39,6 +39,8 @@ if($type == 0) {
if($type2 == 0) {
$type2 = 0;
}
$sel = [];
$sel2 = [];
$sel[$type] = "selected";
$sel2[$type2] = "selected";
@@ -60,33 +62,33 @@ $admin = MYDB_fetch_array($result);
<tr><td>
<form name=form1 method=post>정렬순서 :
<select name=type size=1>
<option <?=$sel[0]?> value=0>국력</option>
<option <?=$sel[1]?> value=1>장수</option>
<option <?=$sel[2]?> value=2>기술</option>
<option <?=$sel[3]?> value=3>국고</option>
<option <?=$sel[4]?> value=4>병량</option>
<option <?=$sel[5]?> value=5>평금</option>
<option <?=$sel[6]?> value=6>평쌀</option>
<option <?=$sel[7]?> value=7>평통</option>
<option <?=$sel[8]?> value=8>평무</option>
<option <?=$sel[9]?> value=9>평지</option>
<option <?=$sel[10]?> value=10>평Lv</option>
<option <?=$sel[11]?> value=11>접속률</option>
<option <?=$sel[12]?> value=12>단기접</option>
<option <?=$sel[13]?> value=13>보숙</option>
<option <?=$sel[14]?> value=14>궁숙</option>
<option <?=$sel[15]?> value=15>기숙</option>
<option <?=$sel[16]?> value=16>귀숙</option>
<option <?=$sel[17]?> value=17>차숙</option>
<option <?=$sel[0]??''?> value=0>국력</option>
<option <?=$sel[1]??''?> value=1>장수</option>
<option <?=$sel[2]??''?> value=2>기술</option>
<option <?=$sel[3]??''?> value=3>국고</option>
<option <?=$sel[4]??''?> value=4>병량</option>
<option <?=$sel[5]??''?> value=5>평금</option>
<option <?=$sel[6]??''?> value=6>평쌀</option>
<option <?=$sel[7]??''?> value=7>평통</option>
<option <?=$sel[8]??''?> value=8>평무</option>
<option <?=$sel[9]??''?> value=9>평지</option>
<option <?=$sel[10]??''?> value=10>평Lv</option>
<option <?=$sel[11]??''?> value=11>접속률</option>
<option <?=$sel[12]??''?> value=12>단기접</option>
<option <?=$sel[13]??''?> value=13>보숙</option>
<option <?=$sel[14]??''?> value=14>궁숙</option>
<option <?=$sel[15]??''?> value=15>기숙</option>
<option <?=$sel[16]??''?> value=16>귀숙</option>
<option <?=$sel[17]??''?> value=17>차숙</option>
</select>
<select name=type2 size=1>
<option <?=$sel2[0]?> value=0>국력</option>
<option <?=$sel2[1]?> value=1>국가별성향</option>
<option <?=$sel2[2]?> value=2>국가성향</option>
<option <?=$sel2[3]?> value=3>장수성격</option>
<option <?=$sel2[4]?> value=4>장수특기</option>
<option <?=$sel2[5]?> value=5>병종수</option>
<option <?=$sel2[6]?> value=6>기타</option>
<option <?=$sel2[0]??''?> value=0>국력</option>
<option <?=$sel2[1]??''?> value=1>국가별성향</option>
<option <?=$sel2[2]??''?> value=2>국가성향</option>
<option <?=$sel2[3]??''?> value=3>장수성격</option>
<option <?=$sel2[4]??''?> value=4>장수특기</option>
<option <?=$sel2[5]??''?> value=5>병종수</option>
<option <?=$sel2[6]??''?> value=6>기타</option>
</select>
<input type=submit value='정렬하기'>
</form>
+11 -4
View File
@@ -3,6 +3,9 @@ namespace sammo;
include "lib.php";
include "func.php";
$nation = Util::getReq('nation', 'int');
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
@@ -18,11 +21,15 @@ $connect=$db->get();
switch($btn) {
case "국가변경":
if($nation == 0) {
$query = "update general set nation=0,level=0 where owner='{$userID}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$db->update('general', [
'nation'=>0,
'level'=>0,
], 'owner=%i', $userID);
} else {
$query = "update general set nation='{$nation}',level=1 where owner='{$userID}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$db->update('general', [
'nation'=>$nation,
'level'=>1,
], 'owner=%i', $userID);
}
break;
}
+2
View File
@@ -70,6 +70,8 @@ $sel[$type] = "selected";
</tr>
<?php
$nationName = [];
$nationColor = [];
foreach (getAllNationStaticInfo() as $nation) {
$nationName[$nation['nation']] = $nation['name'];
$nationColor[$nation['nation']] = $nation['color'];
+14
View File
@@ -57,6 +57,8 @@ if (isset($btn) && $btn == "NPC 보기") {
$sel = "npc<2";
}
$nationName = [];
$nationColor = [];
foreach (getAllNationStaticInfo() as $nation) {
$nationName[$nation['nation']] = $nation['name'];
$nationColor[$nation['nation']] = $nation['color'];
@@ -85,7 +87,14 @@ $type = array(
"베 팅 수 익 금",
"베 팅 수 익 률"
);
for ($i=0; $i < 21; $i++) {
$name = [];
$data = [];
$color = [];
$pic = [];
switch ($i) {
case 0: $query = "select nation,no,name,picture,imgsvr,experience as data from general where $sel order by data desc limit 0,10"; break;
case 1: $query = "select nation,no,name,picture,imgsvr,dedication as data from general where $sel order by data desc limit 0,10"; break;
@@ -209,6 +218,11 @@ $func = array(
);
for ($i=0; $i < 4; $i++) {
$name = [];
$data = [];
$color = [];
$pic = [];
echo "
<tr><td align=center colspan=10 id=bg1><font size=4>$type[$i]</font></td></tr>
<tr align=center id=bg2>";
+3
View File
@@ -60,6 +60,9 @@ $query = "select reserved from diplomacy where me='{$you['nation']}' and you='{$
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dip2 = MYDB_fetch_array($result);
$mylog = [];
$youlog = [];
if($ok == "수락") {
// 서신 보낸 후 멸망,선양 등 했을때.
if($me['level'] < 5) {
+5
View File
@@ -53,6 +53,11 @@ $query = "select state from diplomacy where me='{$me['nation']}' and you='{$you[
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dip = MYDB_fetch_array($result);
$mylog = [];
$youlog = [];
$allog = [];
$history = [];
if($ok == "수락") {
// 서신 보낸 후 멸망,선양 등 했을때.
if($me['level'] < 5) {
+5
View File
@@ -53,6 +53,11 @@ $query = "select state from diplomacy where me='{$me['nation']}' and you='{$you[
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dip = MYDB_fetch_array($result);
$mylog = [];
$youlog = [];
$allog = [];
$history = [];
if($ok == "수락") {
// 서신 보낸 후 멸망,선양 등 했을때.
if($me['level'] < 5) {
+5
View File
@@ -78,6 +78,11 @@ for($i=0; $i < $warcount; $i++) {
}
}
$mylog = [];
$youlog = [];
$allog = [];
$history = [];
if($ok == "수락") {
// 서신 보낸 후 멸망 했을때.
if($me['level'] < 5) {
+4
View File
@@ -33,6 +33,10 @@ $query = "select name,nation,level,capital,scout from nation where nation='{$you
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
$mylog = [];
$youlog = [];
$allog = [];
if($ok == "수락" && $me['level'] < 12 && $nation['level'] > 0 && $nation['scout'] == 0 && $me['nation'] != $nation['nation'] && $admin['year'] >= $admin['startyear']+3 && strpos($me['nations'], ",{$nation['nation']},") === false) {
$youlog[] = "<C>●</><Y>{$me['name']}</> 등용에 성공했습니다.";
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$nation['name']}</b></>(으)로 <S>망명</>하였습니다.";
+3
View File
@@ -70,6 +70,9 @@ for($i=0; $i < $warcount; $i++) {
}
$mylog = [];
$youlog = [];
$allog = [];
$history = [];
if($ok == "수락") {
// 서신 보낸 후 멸망 했을때.
+4 -8
View File
@@ -129,17 +129,13 @@ function info($type=0) {
switch($type) {
case 0:
echo "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)<br> 등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
break;
return "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)<br> 등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
case 1:
echo "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
break;
return "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
case 2:
echo "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)";
break;
return "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)";
case 3:
echo "등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
break;
return "등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
}
}
+2 -2
View File
@@ -129,10 +129,10 @@ if ($valid == 1) {
?>
<tr height=30>
<td width=198 align=center><?php info(2); ?></td>
<td width=198 align=center><?=info(2)?></td>
<td width=198 align=center>전체 접속자 수 : <?=$admin['online']?> 명</td>
<td width=198 align=center>턴당 갱신횟수 : <?=$admin['conlimit']?>회</td>
<td width=398 colspan=2 align=center><?php info(3); ?></td>
<td width=398 colspan=2 align=center><?=info(3)?></td>
</tr>
<tr height=30>
<td align=center>
+1 -1
View File
@@ -42,7 +42,7 @@ $connect=$db->get();
<tr><td>장 수 생 성<br><?=backButton()?></td></tr>
</table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td align=center><?php info(0, 1); ?></td></tr>
<tr><td align=center><?=info(0)?></td></tr>
</table>
<?php
$query = "select show_img_level,maxgeneral from game limit 1";
-41
View File
@@ -192,47 +192,6 @@ function command_99($turn) {
echo 'b_chiefcenter.php';//TODO:debug all and replace
}
function GetExplain() {
$explain[0] = "표준적인 보병입니다.<br>보병은 방어특화입니다.";
$explain[1] = "저렴하고 튼튼합니다.<br>중원지역 소유시 가능.";
$explain[2] = "저렴하고 강력합니다.<br>오월지역 소유시 가능.";
$explain[3] = "은밀하고 날쌥니다.<br>저 소유시 가능.";
$explain[4] = "최강의 보병입니다.<br>낙양 소유시 가능.";
$explain[5] = "등갑을 두른 보병입니다.<br>남중지역 소유시 가능.";
$explain[10] = "표준적인 궁병입니다.<br>궁병은 회피특화입니다.";
$explain[11] = "말을 타고 잘 피합니다.<br>동이지역 소유시 가능.";
$explain[12] = "화살을 연사합니다.<br>서촉지역 소유시 가능.";
$explain[13] = "강건한 궁병입니다.<br>양양 소유시 가능.";
$explain[14] = "강력한 화살을 쏩니다.<br>건업 소유시 가능.";
$explain[20] = "표준적인 기병입니다.<br>기병은 공격특화입니다.";
$explain[21] = "백마의 위용을 보여줍니다.<br>하북지역 소유시 가능.";
$explain[22] = "갑주를 두른 기병입니다.<br>서북지역 소유시 가능.";
$explain[23] = "저돌적으로 공격합니다.<br>흉노 소유시 가능.";
$explain[24] = "철갑을 두른 기병입니다.<br>강 소유시 가능.";
$explain[25] = "날쎄고 빠른 기병입니다.<br>산월 소유시 가능.";
$explain[26] = "어느 누구보다 강력합니다.<br>남만 소유시 가능.";
$explain[27] = "정예 기병입니다.<br>허창 소유시 가능.";
$explain[30] = "계략을 사용하는 병종입니다.<br>귀병은 계략특화입니다.";
$explain[31] = "신출귀몰한 귀병입니다.<br>초지역 소유시 가능.";
$explain[32] = "저렴하고 튼튼합니다.<br>오환 소유시 가능.";
$explain[33] = "저렴하고 강력합니다.<br>왜 소유시 가능.";
$explain[34] = "백병전에도 능숙합니다.<br>장안 소유시 가능.";
$explain[35] = "전투를 포기하고 계략에 몰두합니다.<br>귀병은 계략특화입니다.";
$explain[36] = "고도로 훈련된 귀병입니다.<br>낙양 소유시 가능.";
$explain[37] = "갑주를 두른 귀병입니다.<br>성도 소유시 가능.";
$explain[38] = "날카로운 무기를 가진 귀병입니다.<br>업 소유시 가능.";
$explain[40] = "높은 구조물 위에서 공격합니다.<br>차병은 공성특화입니다.";
$explain[41] = "엄청난 위력으로 성벽을 부수어버립니다.<br>차병은 공성특화입니다.";
$explain[42] = "상대에게 돌덩이를 날립니다.<br>업 소유시 가능.";
$explain[43] = "상대를 저지하는 특수병기입니다.<br>성도 소유시 가능.";
return $explain;
}
function command_11($turn, $command) {
$db = DB::db();
$connect=$db->get();
+1 -1
View File
@@ -43,7 +43,7 @@ $connect=$db->get();
<tr><td>장 수 선 택<br><?=backButton()?></td></tr>
</table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td align=center><?php info(0, 1); ?></td></tr>
<tr><td align=center><?=info(0)?></td></tr>
</table>
<?php
+1 -1
View File
@@ -53,7 +53,7 @@ function doServerModeSet($server, $action, &$response){
}
function doAdminPost($action, $notice, $server){
$response['result'] = 'FAIL';
$response = ['result' => 'FAIL'];
if($action == 'notice') {
RootDB::db()->update('SYSTEM', ['NOTICE'=>$notice], true);
+2 -2
View File
@@ -47,10 +47,10 @@ if($expires < $nowDate){
}
$access_token = $result['access_token'];
$expires = TimeUtil::DatetimeFromNowSecond($nowDate, $result['expires_in']);
$expires = TimeUtil::DatetimeFromNowSecond($result['expires_in']);
if(isset($result['refresh_token'])){
$refresh_token = Util::array_get($result['refresh_token']);
$refresh_token_expires = TimeUtil::DatetimeFromNowSecond($nowDate, $result['refresh_token_expires_in']);
$refresh_token_expires = TimeUtil::DatetimeFromNowSecond($result['refresh_token_expires_in']);
}
}
+2 -2
View File
@@ -96,10 +96,10 @@ if($expires < $nowDate){
}
$access_token = $result['access_token'];
$expires = TimeUtil::DatetimeFromNowSecond($nowDate, $result['expires_in']);
$expires = TimeUtil::DatetimeFromNowSecond($result['expires_in']);
if(isset($result['refresh_token'])){
$refresh_token = Util::array_get($result['refresh_token']);
$refresh_token_expires = TimeUtil::DatetimeFromNowSecond($nowDate, $result['refresh_token_expires_in']);
$refresh_token_expires = TimeUtil::DatetimeFromNowSecond($result['refresh_token_expires_in']);
}
}
+2 -2
View File
@@ -59,10 +59,10 @@ if($expires < $nowDate){
}
$access_token = $result['access_token'];
$expires = TimeUtil::DatetimeFromNowSecond($nowDate, $result['expires_in']);
$expires = TimeUtil::DatetimeFromNowSecond($result['expires_in']);
if(isset($result['refresh_token'])){
$refresh_token = Util::array_get($result['refresh_token']);
$refresh_token_expires = TimeUtil::DatetimeFromNowSecond($nowDate, $result['refresh_token_expires_in']);
$refresh_token_expires = TimeUtil::DatetimeFromNowSecond($result['refresh_token_expires_in']);
}
}