diff --git a/hwe/a_vote.php b/hwe/a_vote.php index 70b6b17a..67a5f0db 100644 --- a/hwe/a_vote.php +++ b/hwe/a_vote.php @@ -6,6 +6,7 @@ include "func.php"; $db = DB::db(); $connect=$db->get(); +$session = Session::requireGameLogin()->setReadOnly(); increaseRefresh("설문조사", 1); diff --git a/hwe/commandlist.php b/hwe/commandlist.php index 63e12d51..c53dd9b2 100644 --- a/hwe/commandlist.php +++ b/hwe/commandlist.php @@ -65,6 +65,7 @@ function myclock() { myCommandList(); function myCommandList() { + $session = Session::Instance(); global $_basecolor, $_basecolor2, $_basecolor3; global $images; diff --git a/hwe/css/main.css b/hwe/css/main.css index 07cdf780..d0fa7365 100644 --- a/hwe/css/main.css +++ b/hwe/css/main.css @@ -29,6 +29,30 @@ color:white; display:block; } +.commandButton { + float:left; + width:111px; + height:30px; + font-weight:bold; + font-size:13px; + margin:0; + display:block; +} + +.commandButton:disabled::before{ + content:'【' +} + +.commandButton:disabled::after{ + content:'】' +} + +.commandButton:disabled{ + background-color:transparent !important; + color:gray !important; + border-color:transparent !important; +} + .toolbarButton2 { float:left; background-color:#225500; diff --git a/hwe/func.php b/hwe/func.php index 0f392244..08af199e 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -77,6 +77,7 @@ function GetImageURL($imgsvr) { } function checkLimit($con, $conlimit) { + $session = Session::Instance(); if($session->userGrade>=4){ return 0; } @@ -116,6 +117,7 @@ function getRandGenName() { function cityInfo() { + $session = Session::Instance(); global $_basecolor, $_basecolor2, $images; $db = DB::db(); @@ -145,7 +147,7 @@ function cityInfo() { $tradeStr = $city['trade'] . "%"; } - if($nation['color'] == "" ) { $nation['color'] = "000000"; } + if($nation['color'] == "" ) { $nation['color'] = "#000000"; } echo " diff --git a/hwe/js/main.js b/hwe/js/main.js index 4ea5edef..74ddba88 100644 --- a/hwe/js/main.js +++ b/hwe/js/main.js @@ -5,18 +5,25 @@ if (document.all) { var key_enter = 13; // 13 = 엔터 if (key_f5 == event.keyCode) { event.keyCode=0; - refreshing(0,0); + refreshing(null, 0,0); return false; } else if(key_enter == event.keyCode) { event.keyCode=0; - refreshing(4,message); + refreshing(null, 4,message); return false; } return true; } } -function refreshing(arg1, arg2) { +function refreshing(obj, arg1, arg2) { + if(obj !== null){ + var $obj = $(obj); + if($obj.find('button:disabled').length > 0){ + console.log('locked'); + return; + } + } // if(term <= 0) { switch(arg1) { case 0: location.reload(); break; diff --git a/hwe/processing.php b/hwe/processing.php index e59eedd3..2aa86a50 100644 --- a/hwe/processing.php +++ b/hwe/processing.php @@ -176,6 +176,7 @@ function ender($type=0) { function command_99($turn) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); $query = "select nation,level from general where owner='{$session->userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -237,6 +238,7 @@ function GetExplain() { function command_11($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); global $_basecolor, $_basecolor2, $images, $image; starter("징병"); @@ -445,6 +447,7 @@ function calc(cost, formnum) { function command_12($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); global $_basecolor, $_basecolor2, $images, $image; starter("모병"); @@ -655,6 +658,7 @@ function calc(cost, formnum) { function command_15($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("재편성"); $query = "select no,nation from general where owner='{$session->userID}'"; @@ -699,6 +703,7 @@ function command_15($turn, $command) { function command_16($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("출병"); $query = "select city from general where owner='{$session->userID}'"; @@ -741,6 +746,7 @@ function command_16($turn, $command) { function command_21($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("이동"); $query = "select city from general where owner='{$session->userID}'"; @@ -783,6 +789,7 @@ function command_21($turn, $command) { function command_22($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); die('비활성화됨');//TODO:등용장 대 디자인 starter("등용"); @@ -847,6 +854,7 @@ function command_22($turn, $command) { function command_23($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("포상", 1); $query = "select no,nation from general where owner='{$session->userID}'"; @@ -920,6 +928,7 @@ function command_23($turn, $command) { function command_24($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("몰수", 1); $query = "select no,nation from general where owner='{$session->userID}'"; @@ -996,6 +1005,7 @@ function command_25($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("임관"); @@ -1073,6 +1083,7 @@ function command_25($turn, $command) { function command_27($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("발령", 1); @@ -1132,6 +1143,7 @@ function command_27($turn, $command) { function command_30($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("강행"); $query = "select city from general where owner='{$session->userID}'"; @@ -1174,6 +1186,7 @@ ender(); function command_31($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("첩보"); $query = "select city from general where owner='{$session->userID}'"; @@ -1220,6 +1233,7 @@ function command_31($turn, $command) { function command_32($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("화계"); $query = "select city from general where owner='{$session->userID}'"; @@ -1261,6 +1275,7 @@ function command_32($turn, $command) { function command_33($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("탈취"); $query = "select city from general where owner='{$session->userID}'"; @@ -1302,6 +1317,7 @@ function command_33($turn, $command) { function command_34($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("파괴"); $query = "select city from general where owner='{$session->userID}'"; @@ -1343,6 +1359,7 @@ function command_34($turn, $command) { function command_35($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("선동"); $query = "select city from general where owner='{$session->userID}'"; @@ -1384,6 +1401,7 @@ function command_35($turn, $command) { function command_36($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("기습"); $query = "select city from general where owner='{$session->userID}'"; @@ -1425,6 +1443,7 @@ function command_36($turn, $command) { function command_43($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("증여"); $query = "select no,nation from general where owner='{$session->userID}'"; @@ -1644,6 +1663,7 @@ function command_46($turn, $command) { function command_48($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("장비 매매"); @@ -1760,6 +1780,7 @@ function command_49($turn, $command) { function command_51($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("항복 권고", 1); @@ -1814,6 +1835,7 @@ function command_51($turn, $command) { function command_52($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("원조", 1); @@ -1891,6 +1913,7 @@ function command_52($turn, $command) { function command_53($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("통합제의", 1); @@ -1959,6 +1982,7 @@ function command_53($turn, $command) { function command_54($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("선양"); $query = "select no,nation from general where owner='{$session->userID}'"; @@ -2005,6 +2029,7 @@ function command_54($turn, $command) { function command_61($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("불가침", 1); @@ -2088,6 +2113,7 @@ function command_61($turn, $command) { function command_62($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("선전포고", 1); @@ -2154,6 +2180,7 @@ function command_62($turn, $command) { function command_63($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("종전", 1); @@ -2212,6 +2239,7 @@ function command_63($turn, $command) { function command_64($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("파기", 1); @@ -2270,6 +2298,7 @@ function command_64($turn, $command) { function command_65($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("초토화", 1); $query = "select city from general where owner='{$session->userID}'"; @@ -2309,6 +2338,7 @@ echo "
function command_66($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("천도", 1); $query = "select city from general where owner='{$session->userID}'"; @@ -2349,6 +2379,7 @@ echo "
function command_67($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("증축", 1); $query = "select city from general where owner='{$session->userID}'"; @@ -2389,6 +2420,7 @@ echo "
function command_68($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("감축", 1); $query = "select city from general where owner='{$session->userID}'"; @@ -2429,6 +2461,7 @@ echo "
function command_72($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("백성동원", 1); $query = "select city from general where owner='{$session->userID}'"; @@ -2469,6 +2502,7 @@ echo "
function command_73($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("수몰", 1); $query = "select city from general where owner='{$session->userID}'"; @@ -2509,6 +2543,7 @@ echo "
function command_74($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("허보", 1); $query = "select city from general where owner='{$session->userID}'"; @@ -2549,6 +2584,7 @@ echo "
function command_75($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("피장파장", 1); @@ -2608,6 +2644,7 @@ function command_75($turn, $command) { function command_77($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("이호경식", 1); @@ -2667,6 +2704,7 @@ function command_77($turn, $command) { function command_78($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); starter("급습", 1); diff --git a/hwe/templates/commandButton.php b/hwe/templates/commandButton.php new file mode 100644 index 00000000..8de311cd --- /dev/null +++ b/hwe/templates/commandButton.php @@ -0,0 +1,27 @@ +
+
+ + + + + + + + + + +
+
+ + + + + + + + + + + +
+
\ No newline at end of file
【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]." 】 {$city['name']}
"; @@ -230,6 +232,7 @@ function cityInfo() { } function myNationInfo() { + $session = Session::Instance(); global $_basecolor, $_basecolor2, $images; $db = DB::db(); @@ -408,6 +411,7 @@ function commandGroup($typename, $type=0) { } function commandTable() { + $session = Session::Instance(); $db = DB::db(); $connect=$db->get(); @@ -645,6 +649,7 @@ function commandTable() { } function CoreCommandTable() { + $session = Session::Instance(); $db = DB::db(); $connect=$db->get(); @@ -744,6 +749,7 @@ function CoreCommandTable() { function myInfo() { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); $query = "select no from general where owner='{$session->userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -824,7 +830,7 @@ function generalInfo($no) { $remaining = substr($general['turntime'], 14, 2) - date('i'); if($remaining < 0) { $remaining = 60 + $remaining; } - if($nation['color'] == "") { $nation['color'] = "000000"; } + if($nation['color'] == "") { $nation['color'] = "#000000"; } if($general['age'] < 60) { $general['age'] = "{$general['age']} 세"; } elseif($general['age'] < 80) { $general['age'] = "{$general['age']} 세"; } @@ -932,6 +938,7 @@ function generalInfo($no) { } function myInfo2() { + $session = Session::Instance(); $db = DB::db(); $connect=$db->get(); @@ -1097,6 +1104,7 @@ function onlineNation() { } function nationMsg() { + $session = Session::Instance(); $db = DB::db(); $connect=$db->get(); @@ -2380,6 +2388,7 @@ function getAdmin() { function getMe() { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); $query = "select * from general where owner='{$session->userID}'"; $result = MYDB_query($query, $connect) or Error("접속자가 많아 접속을 중단합니다. 잠시후 갱신해주세요.
getMe : ".MYDB_error($connect),""); diff --git a/hwe/func_command.php b/hwe/func_command.php index 73652a64..b55bb486 100644 --- a/hwe/func_command.php +++ b/hwe/func_command.php @@ -455,6 +455,7 @@ function getCoreTurn($nation, $level) { function processCommand($no) { + $session = Session::Instance(); $db = DB::db(); $connect=$db->get(); @@ -684,6 +685,7 @@ where nation='{$general['nation']}' function command_Single($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); $command = EncodeCommand(0, 0, 0, $command); @@ -702,6 +704,7 @@ function command_Single($turn, $command) { function command_Chief($turn, $command) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); $command = EncodeCommand(0, 0, 0, $command); diff --git a/hwe/func_converter.php b/hwe/func_converter.php index d95559df..3c88b318 100644 --- a/hwe/func_converter.php +++ b/hwe/func_converter.php @@ -836,7 +836,7 @@ function ConvertLog($str, $type=1) { function newColor($color) { switch($color) { case "": - case "330000": + case "#330000": case "#FF0000": case "#800000": case "#A0522D": @@ -852,10 +852,10 @@ function newColor($color) { case "#7B68EE": case "#800080": case "#A9A9A9": - case "000000": + case "#000000": $color = "#FFFFFF"; break; default: - $color = "000000"; break; + $color = "#000000"; break; } return $color; } diff --git a/hwe/func_message.php b/hwe/func_message.php index ae1a2554..6fa7d5d9 100644 --- a/hwe/func_message.php +++ b/hwe/func_message.php @@ -280,6 +280,7 @@ function getMailboxList(){ function DecodeMsg($msg, $type, $who, $date, $bg, $num=0) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); //FIXME: 폐기 $query = "select no,nation,name,picture,level from general where owner='{$session->userID}'"; @@ -300,7 +301,7 @@ function DecodeMsg($msg, $type, $who, $date, $bg, $num=0) { if($sndr['nation'] == 0) { $sndrnation['name'] = '재야'; - $sndrnation['color'] = 'FFFFFF'; + $sndrnation['color'] = '#FFFFFF'; } else { $sndrnation = getNationStaticInfo($sndr['nation']); } @@ -327,7 +328,7 @@ function DecodeMsg($msg, $type, $who, $date, $bg, $num=0) { if($rcvr['nation'] == 0) { $rcvrnation['name'] = '재야'; - $rcvrnation['color'] = 'FFFFFF'; + $rcvrnation['color'] = '#FFFFFF'; } else { $rcvrnation = getNationStaticInfo($rcvr['nation']); } @@ -348,6 +349,7 @@ function moveMsg($table, $msgtype, $msgnum, $msg, $type, $who, $when, $column, $ function MsgDip($bg) { $db = DB::db(); $connect=$db->get(); + $session = Session::Instance(); $query = "select no,nation from general where owner='{$session->userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/hwe/func_template.php b/hwe/func_template.php index 88935d80..f75858f6 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -89,67 +89,38 @@ function allButton() { function commandButton() { global $_basecolor, $_basecolor2; - $generalID = Session::Instance()->generalID; + $session = Session::Instance(); + $generalID = $session->generalID; if($generalID === null){ return ''; } $db = DB::db(); - - $me = $db->queryFirstRow("select no,nation,level,belong from general where no=%i", $generalID); + $me = $db->queryFirstRow("select no,nation,level,belong from general where owner=%i", $session->userID); $nation = $db->queryFirstRow("select nation,color,secretlimit from nation where nation=%i",$me['nation']); - if($nation['color'] == "") { $nation['color'] = "000000"; } + if($nation['color'] == "") { $nation['color'] = "#000000"; } - $result = ''; - $result .= " - - "; - if($me['level'] >= 1) { $result .= ""; } - else { $result .= ""; } - if($me['level'] >= 5) { $result .= ""; } - else { $result .= ""; } - if($me['level'] >= 1) { $result .= ""; } - else { $result .= ""; } - if($me['level'] >= 1) { $result .= ""; } - else { $result .= ""; } - if($me['level'] >= 2 || ($me['level'] == 1 && $me['belong'] >= $nation['secretlimit'])) { $result .= ""; } - else { $result .= ""; } - if($me['level'] >= 2 || ($me['level'] == 1 && $me['belong'] >= $nation['secretlimit'])) { $result .= ""; } - else { $result .= ""; } - if($me['level'] >= 2 || ($me['level'] == 1 && $me['belong'] >= $nation['secretlimit'])) { $result .= ""; } - else { $result .= ""; } - $result .= ""; - $result .= ""; - $result .= " - -
【회 의 실】【기 밀 실】【부대 편성】【인 사 부】【내 무 부】【사 령 부】【암 행 부】
"; + $bgColor = Util::array_get($nation['color'])?:'#000000'; + $fgColor = newColor($bgColor); - $result .= " - - "; - - if($me['level'] >= 1) { $result .= ""; } - else { $result .= ""; } - if($me['level'] >= 1) { $result .= ""; } - else { $result .= ""; } - if($me['level'] >= 1) { $result .= ""; } - else { $result .= ""; } - if($me['level'] >= 1) { $result .= ""; } - else { $result .= ""; } - $result .= ""; - $result .= ""; - if($me['level'] >= 2 || ($me['level'] == 1 && $me['belong'] >= $nation['secretlimit'])) { $result .= ""; } - else { $result .= ""; } - $result .= ""; - $result .= ""; - $result .= " - -
【세력 정보】【세력 도시】【세력 장수】【국 법】【감 찰 부】
"; - - return $result; + $templates = new \League\Plates\Engine('templates'); + $showSecret = false; + if($me['level'] >= 2){ + $showSecret = true; + } + else if($me['belong'] >= $nation['secretlimit']){ + $showSecret = true; + } + + return $templates->render('commandButton', [ + 'bgColor'=>$bgColor, + 'fgColor'=>$fgColor, + 'meLevel'=>$me['level'], + 'showSecret'=>$showSecret + ]); } diff --git a/hwe/index.php b/hwe/index.php index 6de4892d..a6138389 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -216,13 +216,13 @@ if($session->userGrade >= 5) { - ;color:white;width:50;font-size:13px; value='반복' onclick='refreshing(2,0)'>;color:white;width:80;font-size:13px; value='▼미루기' onclick='refreshing(2,1)'>;color:white;width:80;font-size:13px; value='▲당기기' onclick='refreshing(2,2)'> + ;color:white;width:50;font-size:13px; value='반복' onclick='refreshing(this, 2,0)'>;color:white;width:80;font-size:13px; value='▼미루기' onclick='refreshing(this, 2,1)'>;color:white;width:80;font-size:13px; value='▲당기기' onclick='refreshing(this, 2,2)'>
- ;color:white;width:110;font-size:13px; value='실 행' onclick='refreshing(3,form2)'>;color:white;width:110;font-size:13px; value='갱 신' onclick='refreshing(0,0)'>;color:white;width:160;font-size:13px; value='로그아웃' onclick=location.replace('logout_process.php')>
+ ;color:white;width:110;font-size:13px; value='실 행' onclick='refreshing(this, 3,form2)'>;color:white;width:110;font-size:13px; value='갱 신' onclick='refreshing(this, 0,0)'>;color:white;width:160;font-size:13px; value='로그아웃' onclick=location.replace('logout_process.php')>