fixed regex detection of scratch team members with asterisk in username

This commit is contained in:
Jacob G 2016-01-11 20:06:53 -05:00
parent 60576cf843
commit 6d719cfd47

View file

@ -112,14 +112,14 @@ class AccountRequestSubmission {
return; return;
} }
$success = false; $success = false;
preg_match_all('%<div id="comments-\d+" class="comment +" data-comment-id="\d+">.*?<div class="actions-wrap">.*?<div class="name">\s+<a href="/users/(([a-zA-Z0-9]|-|_)+)">(([a-zA-Z0-9]|-|_)+)</a>\s+</div>\s+<div class="content">(.*?)</div>%ms', $data, $matches); preg_match_all('%<div id="comments-\d+" class="comment +" data-comment-id="\d+">.*?<div class="actions-wrap">.*?<div class="name">\s+<a href="/users/(([a-zA-Z0-9]|-|_)+)">(([a-zA-Z0-9]|-|_|\*)+)</a>\s+</div>\s+<div class="content">(.*?)</div>%ms', $data, $matches);
unset($matches[2]); unset($matches[2]);
unset($matches[3]); unset($matches[3]);
unset($matches[4]); unset($matches[4]);
foreach ($matches[5] as $key => $val) { foreach ($matches[5] as $key => $val) {
$user = $matches[1][$key]; $user = $matches[1][$key];
$comment = trim($val); $comment = trim($val);
if (strtolower($user) == strtolower(htmlspecialchars($this->userName)) && $this->stringContainsArray($comment, $codes)) { if ((strtolower($user) == strtolower(htmlspecialchars($this->userName)) && $this->stringContainsArray($comment, $codes)) {
$success = true; $success = true;
break; break;
} }