refactor php8 to use native str_starts_with();

This commit is contained in:
2023-10-16 13:52:58 +03:00
parent 53f0e1108f
commit 4113c4a1da
3 changed files with 147 additions and 70 deletions
+5 -5
View File
@@ -369,7 +369,7 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
$msg['type'] = -3;
}
$msw = $chat->smileText($_POST['msg'], $msg['to'], $u->info['room'], $u->info['city']);
$msw = $chat->smileText($_POST['msg'], $msg['to'], $u->info['room']);
$nosend = 0;
if ($msw) {
$_POST['msg'] = $msw;
@@ -379,16 +379,16 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>Персонажа нет в данной комнате.</small>","Black","1","1","0"]);';
$nosend = 1;
}
} elseif ($chat->str_count($_POST['msg'], 3) == '/e ') {
} elseif (str_starts_with($_POST['msg'], '/e ')) {
$msg['type'] = 21;
$_POST['msg'] = ltrim($_POST['msg'], '/e ');
} elseif ($chat->str_count($_POST['msg'], 3) == '/е ') {
} elseif (str_starts_with($_POST['msg'], '/е ')) { // это кириллица!!
$msg['type'] = 21;
$_POST['msg'] = ltrim($_POST['msg'], '/е ');
} elseif ($chat->str_count($_POST['msg'], 4) == ' /e ') {
} elseif (str_starts_with($_POST['msg'], ' /e ')) {
$msg['type'] = 21;
$_POST['msg'] = ltrim($_POST['msg'], ' /e ');
} elseif ($chat->str_count($_POST['msg'], 4) == ' /е ') {
} elseif (str_starts_with($_POST['msg'], ' /е ')) { // это кириллица!!
$msg['type'] = 21;
$_POST['msg'] = ltrim($_POST['msg'], ' /е ');
}