From 169e250bd17fb2353a5a88db10b5810a7de3b587 Mon Sep 17 00:00:00 2001 From: dennydai Date: Tue, 8 Mar 2016 16:55:42 +0800 Subject: [PATCH] Bug fixed: Plugin Names Conflict --- QUERY_BOT.php | 15 +++------------ VAR_BOT.php | 15 +++------------ index.php | 15 +++------------ 3 files changed, 9 insertions(+), 36 deletions(-) diff --git a/QUERY_BOT.php b/QUERY_BOT.php index 4dd3e9b..4e095ec 100644 --- a/QUERY_BOT.php +++ b/QUERY_BOT.php @@ -20,20 +20,11 @@ foreach ($TAGs as $TAG) { if (preg_match("/^(".preg_quote($TAG, '/').$plugin_name."|".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.") (.*)$/", $text, $matches)) { $plugin_text = $matches[2]; $plugin_sendto = $from; - if (!empty($plugin_text)){ - require_once $value; - }else{ - $BOT->msg($plugin_sendto, "Missing argument(s)"); - } + require_once $value; break; - }elseif (preg_match("/^(".preg_quote($TAG, '/').$plugin_name.")|(".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.")$/", $text)) { - $plugin_text = $matches[2]; + }elseif ($TAG.$plugin_name == $text or $TAG.$plugin_name.'@'.BOT_NAME == $text) { $plugin_sendto = $from; - if (!empty($plugin_text)){ - require_once $value; - }else{ - $BOT->msg($plugin_sendto, "Missing argument(s)"); - } + $BOT->msg($plugin_sendto, "Missing argument(s)"); break; } } diff --git a/VAR_BOT.php b/VAR_BOT.php index 7ede1a9..c5598ca 100644 --- a/VAR_BOT.php +++ b/VAR_BOT.php @@ -20,20 +20,11 @@ foreach ($TAGs as $TAG) { if (preg_match("/^(".preg_quote($TAG, '/').$plugin_name."|".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.") (.*)$/", $text, $matches)) { $plugin_text = $matches[2]; $plugin_sendto = $from; - if (!empty($plugin_text)){ - require_once $value; - }else{ - $BOT->msg($plugin_sendto, "Missing argument(s)"); - } + require_once $value; break; - }elseif (preg_match("/^(".preg_quote($TAG, '/').$plugin_name.")|(".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.")$/", $text)) { - $plugin_text = $matches[2]; + }elseif ($TAG.$plugin_name == $text or $TAG.$plugin_name.'@'.BOT_NAME == $text) { $plugin_sendto = $from; - if (!empty($plugin_text)){ - require_once $value; - }else{ - $BOT->msg($plugin_sendto, "Missing argument(s)"); - } + $BOT->msg($plugin_sendto, "Missing argument(s)"); break; } } diff --git a/index.php b/index.php index 721c2fc..7879976 100644 --- a/index.php +++ b/index.php @@ -20,20 +20,11 @@ foreach ($TAGs as $TAG) { if (preg_match("/^(".preg_quote($TAG, '/').$plugin_name."|".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.") (.*)$/", $text, $matches)) { $plugin_text = $matches[2]; $plugin_sendto = $from; - if (!empty($plugin_text)){ - require_once $value; - }else{ - $BOT->msg($plugin_sendto, "Missing argument(s)"); - } + require_once $value; break; - }elseif (preg_match("/^(".preg_quote($TAG, '/').$plugin_name.")|(".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.")$/", $text)) { - $plugin_text = $matches[2]; + }elseif ($TAG.$plugin_name == $text or $TAG.$plugin_name.'@'.BOT_NAME == $text) { $plugin_sendto = $from; - if (!empty($plugin_text)){ - require_once $value; - }else{ - $BOT->msg($plugin_sendto, "Missing argument(s)"); - } + $BOT->msg($plugin_sendto, "Missing argument(s)"); break; } }