summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander NeonXP Kiryukhin <frei@neonxp.info>2016-05-27 16:43:55 +0300
committerAlexander NeonXP Kiryukhin <frei@neonxp.info>2016-05-27 16:43:55 +0300
commit27d073de43597c6b164c12ec7cb8ad79c99a0227 (patch)
tree46b721bae4ae1e9de29c1b2d573843bd577ce569 /src
parent00ee85e81506694905b47086629652bbb2e23549 (diff)
Added DB search 8
Diffstat (limited to 'src')
-rw-r--r--src/NeonXP/BotScript.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/NeonXP/BotScript.php b/src/NeonXP/BotScript.php
index b4f6170..695d26a 100644
--- a/src/NeonXP/BotScript.php
+++ b/src/NeonXP/BotScript.php
@@ -101,20 +101,23 @@ class BotScript
$result = "$text | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL;
}
} else {
- foreach ($db as $key => $value) {
- if (mb_strtolower($value[0], 'utf8') == mb_strtolower($text)) {
- if ($key < 10) {
- $result = "0$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL;
- } else {
- $result = "$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL;
+ for ($i = 0; $i < mb_strlen($text, 'utf8'); $i++) {
+ $char = mb_substr($text, $i, 1, 'utf8');
+ foreach ($db as $key => $value) {
+ if (mb_strtolower($value[0], 'utf8') == mb_strtolower($char)) {
+ if ($key < 10) {
+ $result = "0$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL;
+ } else {
+ $result = "$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL;
+ }
}
- }
- if (strtolower($value[2]) == strtolower($text)) {
- if ($key < 10) {
- $result = "0$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL;
- } else {
- $result = "$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL;
+ if (strtolower($value[2]) == strtolower($char)) {
+ if ($key < 10) {
+ $result = "0$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL;
+ } else {
+ $result = "$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL;
+ }
}
}
}