From d4bc04c045486d89b200c45528f2d124ce94dcac Mon Sep 17 00:00:00 2001 From: KasuganoSoras Date: Sun, 16 Sep 2018 20:08:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=AD=A3=E5=88=99=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正了一些错误,创建和更新服务器时的启动命令判断问题 --- include/core/PHPMC/Event.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/core/PHPMC/Event.php b/include/core/PHPMC/Event.php index fc43e0d..afc1231 100644 --- a/include/core/PHPMC/Event.php +++ b/include/core/PHPMC/Event.php @@ -291,7 +291,7 @@ class Event { if(!preg_match("/^[A-Za-z0-9\-\_\.]+$/", $data['jar'])) { PHPMC::Error()->Println("请填写字段:核心文件名字,只能包含英文大小写、数字、_、. 和 -"); } - if(!preg_match("/^[A-Za-z0-9\-\_\.\{\} ]+$/", $data['startcommand'])) { + if(!preg_match("/^[A-Za-z0-9\-\_\.\{\}\:\/\\\= ]+$/", $data['startcommand'])) { PHPMC::Error()->Println("请填写字段:核心启动命令"); } if(!preg_match("/^[A-Za-z0-9\-\_\.\{\} ]+$/", $data['stopcommand'])) { @@ -339,7 +339,7 @@ class Event { if(!preg_match("/^[A-Za-z0-9\-\_\.]+$/", $data['jar'])) { PHPMC::Error()->Println("请填写字段:核心文件名字,只能包含英文大小写、数字、_、. 和 -"); } - if(!preg_match("/^[A-Za-z0-9\-\_\.\{\} ]+$/", $data['startcommand'])) { + if(!preg_match("/^[A-Za-z0-9\-\_\.\{\}\:\/\\\= ]+$/", $data['startcommand'])) { PHPMC::Error()->Println("请填写字段:核心启动命令"); } if(!preg_match("/^[A-Za-z0-9\-\_\.\{\} ]+$/", $data['stopcommand'])) { @@ -361,12 +361,12 @@ class Event { PHPMC::Error()->Println("Server Not Found"); } $Server2->setServer($data['name']); - if($Server2->uuid !== null) { + if($Server2->uuid !== null && $Server2->id !== $data['id']) { PHPMC::Error()->Println("相同名字的服务器已经存在。"); } $Server2->unselectServer(); $Server2->setServer($data['port'], $Server->daemon); - if($Server->uuid !== null) { + if($Server2->uuid !== null && $Server2->id !== $data['id']) { PHPMC::Error()->Println("相同端口、相同 Daemon 的服务器已经存在。"); } PHPMC::Server()->updateServer($data['id'], $data['name'], $data['maxram'], $data['jar'], $data['startcommand'],