| @@ 34-46 (lines=13) @@ | ||
| 31 | $log_file = substr(PSI_LOG, 1); |
|
| 32 | if (file_exists($log_file)) { |
|
| 33 | $contents = @file_get_contents($log_file); |
|
| 34 | if ($contents && preg_match("/^\-\-\-[^-\r\n]+\-\-\- ".preg_quote($string, '/')."\r?\n/m", $contents, $matches, PREG_OFFSET_CAPTURE)) { |
|
| 35 | $findIndex = $matches[0][1]; |
|
| 36 | if (preg_match("/\r?\n/m", $contents, $matches, PREG_OFFSET_CAPTURE, $findIndex)) { |
|
| 37 | $startIndex = $matches[0][1]+1; |
|
| 38 | if (preg_match("/^\-\-\-[^-\r\n]+\-\-\- /m", $contents, $matches, PREG_OFFSET_CAPTURE, $startIndex)) { |
|
| 39 | $stopIndex = $matches[0][1]; |
|
| 40 | ||
| 41 | return substr($contents, $startIndex, $stopIndex-$startIndex); |
|
| 42 | } else { |
|
| 43 | return substr($contents, $startIndex); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | } |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||
| @@ 47-59 (lines=13) @@ | ||
| 44 | if (file_exists($log_file)) { |
|
| 45 | $contents = @file_get_contents($log_file); |
|
| 46 | $contents = preg_replace("/\r\n/", "\n", $contents); |
|
| 47 | if ($contents && preg_match("/^\-\-\-\-\-\-\-\-\-\-".preg_quote($string, '/')."\-\-\-\-\-\-\-\-\-\-\n/m", $contents, $matches, PREG_OFFSET_CAPTURE)) { |
|
| 48 | $findIndex = $matches[0][1]; |
|
| 49 | if (preg_match("/\n/m", $contents, $matches, PREG_OFFSET_CAPTURE, $findIndex)) { |
|
| 50 | $startIndex = $matches[0][1]+1; |
|
| 51 | if (preg_match("/^\-\-\-\-\-\-\-\-\-\-/m", $contents, $matches, PREG_OFFSET_CAPTURE, $startIndex)) { |
|
| 52 | $stopIndex = $matches[0][1]; |
|
| 53 | ||
| 54 | return substr($contents, $startIndex, $stopIndex-$startIndex); |
|
| 55 | } else { |
|
| 56 | return substr($contents, $startIndex); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| 62 | return false; |
|