func_map.php에서 연관배열을 일반 배열로 착각한 버그 수정

func_map.php에서 result를 설정하지 않은 버그 수정

main.php에서 지도를 제대로 불러오도록 수정

map.js에서 국가가 재야인 경우 국가 tooltip을 띄우지 않도록 수정

b_CurrentCity.php의 도시 정보 값을 get으로도 받을 수 있도록 변경
This commit is contained in:
2018-02-02 00:55:02 +09:00
parent 0841950366
commit 438511972e
5 changed files with 56 additions and 31 deletions
+8 -8
View File
@@ -36,10 +36,10 @@ if($me['skin'] < 1) {
<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 width=998>
<form name=cityselect method=post>도시선택 :
<form name=cityselect method=get>도시선택 :
<select name=citylist size=1 style=color:white;background-color:black;width:798;>
<?php
if(!array_key_exists('citylist', $_POST) && $_POST['citylist'] == '') { $_POST['citylist'] = $me['city']; }
if(!array_key_exists('citylist', $_REQUEST) || $_REQUEST['citylist'] == '') { $_REQUEST['citylist'] = $me['city']; }
// 재야일때는 현재 도시만
$valid = 0;
@@ -49,7 +49,7 @@ if($me['level'] == 0) {
$city = MYDB_fetch_array($cityresult);
echo "
<option value={$city['city']}";
if($city['city'] == $_POST['citylist']) { echo " selected"; $valid = 1; }
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국==";
@@ -65,7 +65,7 @@ if($me['level'] == 0) {
$city = MYDB_fetch_array($cityresult);
echo "
<option value={$city['city']}";
if($city['city'] == $_POST['citylist']) { echo " selected"; $valid = 1; }
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국==";
@@ -82,7 +82,7 @@ if($me['level'] == 0) {
$city = MYDB_fetch_array($cityresult);
echo "
<option value={$city['city']}";
if($city['city'] == $_POST['citylist']) { echo " selected"; $valid = 1; }
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국==";
@@ -108,7 +108,7 @@ if($myNation['level'] > 0) {
$city = MYDB_fetch_array($cityresult);
echo "
<option value={$city['city']}";
if($city['city'] == $_POST['citylist']) { echo " selected"; $valid = 1; }
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국==";
@@ -130,10 +130,10 @@ echo "
// 첩보된 도시까지만 허용
if($valid == 0 && $me['userlevel'] < 5) {
$_POST['citylist'] = $me['city'];
$_REQUEST['citylist'] = $me['city'];
}
$query = "select * from city where city='{$_POST['citylist']}'"; // 도시 이름 목록
$query = "select * from city where city='{$_REQUEST['citylist']}'"; // 도시 이름 목록
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$city = MYDB_fetch_array($cityresult);
+13 -5
View File
@@ -54,13 +54,19 @@ function getWorldMap($req){
$db = getDB();
list($startYear, $year, $month) = $db->queryFirstRow('select `startyear`, `year`, `month` from `game` where `no`=1');
$game = $db->queryFirstRow('select `startyear`, `year`, `month` from `game` where `no` = 1');
$startYear = $game['startyear'];
$year = $game['year'];
$month = $game['month'];
if($generalID && ($req->showMe || $req->neutralView)){
list($myCity, $myNation)
= $db->queryFirstRow(
$city = $db->queryFirstRow(
'select `city`, `nation` from `general` where `user_id`=%i',
$generalID);
$myCity = $city['city'];
$myNation = $city['nation'];
if(!$req->showMe){
$myCity = null;
}
@@ -99,7 +105,8 @@ function getWorldMap($req){
$cityList = [];
foreach($db->query('select `city`, `level`, `state`, `nation`, `region`, `supply` from `city`') as $r){
$cityList[] = [$r['city'], $r['level'], $r['state'], $r['nation'], $r['region'], $r['supply']];
$cityList[] =
array_map('intval', [$r['city'], $r['level'], $r['state'], $r['nation'], $r['region'], $r['supply']]);
}
return [
@@ -111,6 +118,7 @@ function getWorldMap($req){
'spyList' => $spyList,
'shownByGeneralList' => $shownByGeneralList,
'myCity' => $myCity,
'myNation' => $myNation
'myNation' => $myNation,
'result' => true
];
}
+1 -9
View File
@@ -33,12 +33,4 @@ else{
$post['month'] = null;
}
//TODO: DB를 받아오는 함수를 부른다. 부르는 함수는 func.php 쪽에 있는 것이 좋을 듯. 받아오는 방식은 map.php 참고.
//TODO: 결과값을 반환한다. 반환하는 양식은 tmp_map/result.json 참고
$request = new MapRequest($post);
returnJson(getWorldMap($request));
returnJson(getWorldMap($post));
+20 -6
View File
@@ -391,7 +391,15 @@ function reloadWorldMap(option){
var $this = $(this);
var position = $this.parent().position();
$tooltip_city.html($this.data('text'));
$tooltip_nation.html($this.data('nation'));
var nation_text = $this.data('nation');
if(nation_text){
$tooltip_nation.html(nation_text).show();
}
else{
$tooltip_nation.html('').hide();
}
$tooltip.css({'top': position.top + 25, 'left': position.left + 35}).show();
var touchMode = $this.data('touchMode');
@@ -432,7 +440,13 @@ function reloadWorldMap(option){
$tooltip_city.data('target', $this.data('id'));
$tooltip_city.html($this.data('text'));
$tooltip_nation.html($this.data('nation'));
var nation_text = $this.data('nation');
if(nation_text){
$tooltip_nation.html(nation_text).show();
}
else{
$tooltip_nation.html('').hide();
}
$tooltip.show();
});
@@ -491,16 +505,16 @@ function reloadWorldMap(option){
//deferred mode of jQuery. != promise-then.
deferred = $.ajax({
url: option.targetJson,
type: 'POST',
type: 'post',
dataType:'json',
contentType: 'application/json',
data: {
data: JSON.stringify({
neutralView:option.neutralView,
year:option.year,
month:option.month,
showMe:option.showMe,
aux:option.aux
},
dataType:'json'
})
});
deferred
+14 -3
View File
@@ -58,13 +58,22 @@ $scenario = getScenario();
<head>
<title>메인</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="../e_lib/jquery-3.2.1.min.js"></script>
<script src="js/main.js"></script>
<script src="js/base_map.js"></script>
<script src="js/map.js"></script>
<script>
$(function(){
reloadWorldMap({
hrefTemplate:'b_currentCity.php?citylist={0}'
});
});
</script>
<link href="css/normalize.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<link rel=stylesheet href=css/common.css type=text/css>
<link href="css/map.css" rel="stylesheet">
<?php require('analytics.php'); ?>
</head>
@@ -178,7 +187,9 @@ if($me['userlevel'] >= 5) {
</table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 style=font-size:13px;word-break:break-all; id=bg0>
<tr>
<td width=698 height=520 colspan=2><iframe src='map.php?type=0&graphic=<?=$me['map'];?>' width=698 height=520 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no></iframe></td>
<td width=698 height=520 colspan=2>
<?=getMapHtml()?>
</td>
<td width=298 rowspan=4><iframe name=commandlist src='commandlist.php' width=298 height=700 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no></iframe></td>
</tr>
<form name=form2 action=preprocessing.php method=post target=commandlist>