From cff76c9db947df7895f0657c7079f22a58cd6a50 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 7 Apr 2018 18:30:23 +0900 Subject: [PATCH] =?UTF-8?q?array=5Fmerge=20=EB=8C=80=EC=8B=A0=20+=20?= =?UTF-8?q?=EA=B8=B0=ED=98=B8=EB=A1=9C=20=EC=B6=A9=EB=B6=84=ED=95=9C=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0(dictionary)=20+=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=ED=95=A8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func.php | 4 +--- hwe/j_map.php | 2 +- hwe/join_post.php | 2 +- hwe/sammo/CityConst.php | 4 ++-- i_entrance/j_server_get_admin_status.php | 4 ++-- j_updateServer.php | 2 +- src/sammo/Session.php | 6 +++--- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/hwe/func.php b/hwe/func.php index 08bd4879..2bae6fab 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1613,9 +1613,7 @@ function checkTurn() { $action = Json::decode($rawEvent['action']); $event = new Event\EventHandler($cond, $action); - $event->tryRunEvent(array_merge([ - 'currentEventID'=>$eventID - ], $admin)); + $event->tryRunEvent(['currentEventID'=>$eventID] + $admin); } // 분기계산. 장수들 턴보다 먼저 있다면 먼저처리 diff --git a/hwe/j_map.php b/hwe/j_map.php index 6d636d7d..d365d665 100644 --- a/hwe/j_map.php +++ b/hwe/j_map.php @@ -13,7 +13,7 @@ $defaultPost = [ 'neutralView' => false, 'showMe' => true ]; -$post = array_merge($defaultPost, WebUtil::parseJsonPost()); +$post = WebUtil::parseJsonPost() + $defaultPost; if(!$session->isLoggedIn() || !$session->generalID){ $post['neutralView'] = true; diff --git a/hwe/join_post.php b/hwe/join_post.php index ff8d6007..31d3aa9e 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -4,7 +4,7 @@ namespace sammo; include "lib.php"; include "func.php"; -$v = new Validator(array_merge($_POST, $_GET)); +$v = new Validator($_GET + $_POST); $v ->rule('required', [ 'name', diff --git a/hwe/sammo/CityConst.php b/hwe/sammo/CityConst.php index b1df2a9c..d1b9d7ab 100644 --- a/hwe/sammo/CityConst.php +++ b/hwe/sammo/CityConst.php @@ -323,7 +323,7 @@ class CityConst{ $queries = array_map(function(CityInitialDetail $city){ $initValue = static::$buildInit[$city->level]; $path = join('|', array_keys($city->path)); - return array_merge(static::$buildInitCommon, $initValue, [ + return [ 'city'=>$city->id, 'name'=>$city->name, 'level'=>$city->level, @@ -335,7 +335,7 @@ class CityConst{ 'def2'=>$city->defence, 'wall2'=>$city->wall, 'region'=>$city->region - ]); + ] + $initValue + static::$buildInitCommon; }, array_values(static::$constID)); DB::db()->insert('city', $queries); diff --git a/i_entrance/j_server_get_admin_status.php b/i_entrance/j_server_get_admin_status.php index 255adf6e..2afb0d14 100644 --- a/i_entrance/j_server_get_admin_status.php +++ b/i_entrance/j_server_get_admin_status.php @@ -70,12 +70,12 @@ foreach (AppConf::getList() as $setting) { ]; } - $state = array_merge($state, [ + $state += [ 'name' => $serverDir, 'korName' => $serverKorName, 'color' => $serverColor, 'isRoot' => $serverDir == $rootServer - ]); + ]; $server[] = $state; } diff --git a/j_updateServer.php b/j_updateServer.php index c56e3801..6caf4ef4 100644 --- a/j_updateServer.php +++ b/j_updateServer.php @@ -26,7 +26,7 @@ if($session->userGrade < 6){ ]); } -$request = array_merge($_POST, $_GET); +$request = $_GET + $_POST; $tmpFile = 'd_log/arc.zip'; diff --git a/src/sammo/Session.php b/src/sammo/Session.php index d82ee4de..4934af2d 100644 --- a/src/sammo/Session.php +++ b/src/sammo/Session.php @@ -64,11 +64,11 @@ class Session 'reason'=>'로그인이 필요합니다.' ]; - if (is_array($result)) { - $jsonResult = array_merge($jsonResult, $result); + if (!is_array($result)) { + Json::die($jsonResult); } - Json::die($jsonResult); + Json::die($result + $jsonResult); } public static function requireLogin($result = '..'): Session