修复启动命令不支持 + 的问题

pull/7/head
Akkariin Meiko 2018-10-20 17:26:14 +08:00
parent 4a2dedde78
commit 732a9add7f
1 changed files with 15 additions and 3 deletions

View File

@ -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,8 +339,10 @@ class Event {
if(!preg_match("/^[A-Za-z0-9\-\_\.]+$/", $data['jar'])) {
PHPMC::Error()->Println("请填写字段核心文件名字只能包含英文大小写、数字、_、. 和 -");
}
if(!preg_match("/^[A-Za-z0-9\-\_\.\{\}\:\/\\\= ]+$/", $data['startcommand'])) {
PHPMC::Error()->Println("请填写字段:核心启动命令");
// 改为黑名单机制 charBlackList
// preg_match("/^[A-Za-z0-9\-\_\.\{\}\:\/\\\=\+ ]+$/", $data['startcommand'])
if(!$this->charBlackList($data['startcommand'])) {
PHPMC::Error()->Println("请填写字段:核心启动命令: {$data['startcommand']}");
}
if(!preg_match("/^[A-Za-z0-9\-\_\.\{\} ]+$/", $data['stopcommand'])) {
PHPMC::Error()->Println("请填写字段:停止命令");
@ -375,6 +377,16 @@ class Event {
exit;
}
public function charBlackList($str) {
$list = Array("'", ">", "<", "&", "|");
foreach($list as $char) {
if(mb_stristr($str, $chat)) {
return false;
}
}
return true;
}
public function deleteServerEvent($data) {
if(!preg_match("/^[0-9]+$/", $data['id'])) {
PHPMC::Error()->Println("请填写字段:服务器 ID");