lionared 6 rokov pred
rodič
commit
3af982f078
1 zmenil súbory, kde vykonal 18 pridanie a 18 odobranie
  1. 18 18
      logmonitor.php

+ 18 - 18
logmonitor.php

@@ -208,28 +208,28 @@ class Parser
 {
     public static function parse($str)
     {
-        $pairs = self::matchPairs($str);
-        if ($pairs) {
-            $params = [];
-
-            $pattern_time_format = "/\d{4}\-\d{2}\-\d{2}\s+\d{2}\:\d{2}\:\d{2}/";
-            $matched = preg_match_all($pattern_time_format, $str, $matches);
-            if ($matched) {
-                if (isset($matches[0][0])) {
-                    $params['time'] = $matches[0][0];
-                }
-                unset($matches);
+        $params = [];
+        $pattern_time_format = "/\d{4}\-\d{2}\-\d{2}\s+\d{2}\:\d{2}\:\d{2}/";
+        $matched = preg_match_all($pattern_time_format, $str, $matches);
+        if ($matched) {
+            if (isset($matches[0][0])) {
+                $params['time'] = $matches[0][0];
             }
+            unset($matches);
+        }
 
-            $pattern_thead_id = "/^\[\d+/";
-            $matched = preg_match_all($pattern_thead_id, $str, $matches);
-            if ($matched) {
-                if (isset($matches[0][0])) {
-                    $params['thread_id'] = str_replace("[","", $matches[0][0]);
-                }
-                unset($matches);
+        $pattern_thead_id = "/^\[\d+/";
+        $matched = preg_match_all($pattern_thead_id, $str, $matches);
+        if ($matched) {
+            if (isset($matches[0][0])) {
+                $params['thread_id'] = str_replace("[","", $matches[0][0]);
             }
+            unset($matches);
+        }
 
+        $strings = substr($str, strpos($str, "content=") +8);
+        $pairs = self::matchPairs($strings);
+        if ($pairs) {
             foreach ($pairs as $pair)
             {
                 $kv = explode("=", $pair);