From 117f820eaa91bb62100de61f0dda7286b88f90fd Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 31 Mar 2018 20:17:28 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EB=A6=AC=EC=85=8B?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20=EC=B6=94=EA=B0=80=20-=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EC=84=A0=ED=83=9D=20=EC=B0=BD=20=EC=9D=BC?= =?UTF-8?q?=EB=B6=80=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/entrance.js | 4 ++-- twe/func_command.php | 2 +- twe/j_install.php | 37 ++++++++++++++++++++++++++++ twe/j_server_basic_info.php | 48 +++++-------------------------------- 4 files changed, 46 insertions(+), 45 deletions(-) diff --git a/js/entrance.js b/js/entrance.js index 1c8b6a5f..93b47a18 100644 --- a/js/entrance.js +++ b/js/entrance.js @@ -11,7 +11,7 @@ var serverListTemplate = "\ var serverTextInfo = "\ \ 서기 <%year%>년 <%month%>월 (<%scenario%>)
\ -유저 : <%userCnt%> / <%maxUserCnt%>명 NPC : <%npcCnt%>명 (<%turnTerm%>)\ +유저 : <%userCnt%> / <%maxUserCnt%>명 NPC : <%npcCnt%>명 (<%turnTerm%>분 턴 서버)\ \ "; @@ -92,7 +92,7 @@ function Entrance_drawServerList(serverInfos){ TemplateEngine(serverTextInfo, game) ); - if(result.me && result.me.length > 1){ + if(result.me && result.me.name){ var me = result.me; me.serverPath = serverPath; $serverHtml.append( diff --git a/twe/func_command.php b/twe/func_command.php index 80c705a8..7bbdc2a6 100644 --- a/twe/func_command.php +++ b/twe/func_command.php @@ -1,5 +1,5 @@ false, + 'reason'=>'logs, data 디렉토리를 생성할 권한이 없습니다.' + ]); + } + mkdir(__dir__.'/logs', 0644); + mkdir(__dir__.'/data', 0644); +} + +if(!is_writable(__dir__.'/logs')){ + Json::die([ + 'result'=>false, + 'reason'=>'logs 디렉토리의 쓰기 권한이 없습니다' + ]); +} + +if(!is_writable(__dir__.'/data')){ + Json::die([ + 'result'=>false, + 'reason'=>'data 디렉토리의 쓰기 권한이 없습니다' + ]); +} + +if(!file_exists(ROOT.'/logs/.htaccess')){ + @file_put_contents(ROOT.'/logs/.htaccess', 'Deny from all'); +} + +if(!file_exists(ROOT.'/data/.htaccess')){ + @file_put_contents(ROOT.'/data/.htaccess', 'Deny from all'); +} + + $db = DB::db(); $mysqli_obj = $db->get(); @@ -62,6 +96,9 @@ $mysqli_obj = $db->get(); $scenarioObj = new Scenario($scenario, false); $startyear = $scenarioObj->getYear(); +FileUtil::delInDir("logs"); +FileUtil::delInDir("data"); + if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/reset.sql'))){ while(true){ if (!$mysqli_obj->more_results()) { diff --git a/twe/j_server_basic_info.php b/twe/j_server_basic_info.php index b3aed371..741812fa 100644 --- a/twe/j_server_basic_info.php +++ b/twe/j_server_basic_info.php @@ -4,65 +4,29 @@ namespace sammo; include "lib.php"; include "func.php"; -if(!Session::getUserID()){ +$session = Session::Instance()->setReadOnly(); +if(!$session->userID){ Json::die([ 'game'=>'x', 'me'=>'no' ]); } -//FIXME:Name이 없는 동명의 함수가 있음 -function getScenarioName($scenario) { - switch($scenario) { - case 0: $str = "공백지모드"; break; - case 1: $str = "역사모드1 : 184년 황건적의 난"; break; - case 2: $str = "역사모드2 : 190년 반동탁연합"; break; - case 3: $str = "역사모드3 : 194년 군웅할거"; break; - case 4: $str = "역사모드4 : 196년 황제는 허도로"; break; - case 5: $str = "역사모드5 : 200년 관도대전"; break; - case 6: $str = "역사모드6 : 202년 원가의 분열"; break; - case 7: $str = "역사모드7 : 207년 적벽대전"; break; - case 8: $str = "역사모드8 : 213년 익주 공방전"; break; - case 9: $str = "역사모드9 : 219년 삼국정립"; break; - case 10: $str = "역사모드10 : 225년 칠종칠금"; break; - case 11: $str = "역사모드11 : 228년 출사표"; break; - - case 12: $str = "IF모드1 : 191년 백마장군의 위세"; break; - - case 20: $str = "가상모드1 : 180년 영웅 난무"; break; - case 21: $str = "가상모드1 : 180년 영웅 집결"; break; - case 22: $str = "가상모드2 : 179년 훼신 집결"; break; - case 23: $str = "가상모드3 : 180년 영웅 시대"; break; - case 24: $str = "가상모드4 : 180년 결사항전"; break; - case 25: $str = "가상모드5 : 180년 영웅독존"; break; - case 26: $str = "가상모드6 : 180년 무풍지대"; break; - case 27: $str = "가상모드7 : 180년 가요대잔치"; break; - case 28: $str = "가상모드8 : 180년 확산성 밀리언 아서"; break; - default: $str = "시나리오?"; break; - } - return $str; -} - -function getTurnTerm($term) { - return "{$term}분 턴 서버"; -} - $db = DB::db(); -$game = $db->queryFirstRow('SELECT isUnited, npcMode, year, month, scenario, maxgeneral as maxUserCnt, turnTerm from game where `no`=1'); +$game = $db->queryFirstRow('SELECT isUnited, npcMode, year, month, scenario, scenario_text, maxgeneral as maxUserCnt, turnTerm from game where `no`=1'); $nationCnt = $db->queryFirstField('SELECT count(`nation`) from nation where `level` > 0'); $genCnt = $db->queryFirstField('SELECT count(`no`) from general where `npc` < 2'); $npcCnt = $db->queryFirstField('SELECT count(`no`) from general where `npc` >= 2'); -$game['turnTerm'] = getTurnTerm($game['turnTerm']); -$game['scenario'] = getScenarioName($game['scenario']); +$game['scenario'] = $game['scenario_text']; $game['userCnt'] = $genCnt; $game['npcCnt'] = $npcCnt; $game['nationCnt'] = $nationCnt; $generalID = getGeneralID(false, false); -$userGrade = Session::getUserGrade(); +$userGrade = $session->userGrade; $me = [ ]; @@ -82,5 +46,5 @@ if($generalID){ //TODO: 이를 표현하는 방법은 '이전 버전'의 serverListPost.php를 참고할 것. Json::die([ 'game'=>$game, - 'me'=>$me?$me:null + 'me'=>$me?:null ]); \ No newline at end of file