Skip to content

Commit

Permalink
Update patterns.class.php
Browse files Browse the repository at this point in the history
Fix of details not getting passed to the pattern in common context.
  • Loading branch information
sergejey committed Jun 5, 2023
1 parent ee204e8 commit c2ec81b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions modules/patterns/patterns.class.php
Expand Up @@ -253,7 +253,6 @@ function edit_patterns(&$out, $id)
function checkAllPatterns($from_user_id = 0, $details = 0)
{
$current_context = context_getcurrent($from_user_id);
//DebMes("current context:".$current_context);
if ($from_user_id && preg_match('/^ext(\d+)/', $current_context, $m)) {
$res = $this->checkExtPatterns($m[1], $from_user_id);
} else {
Expand All @@ -278,7 +277,7 @@ function checkAllPatterns($from_user_id = 0, $details = 0)
$total = count($patterns);
$res = 0;
for ($i = 0; $i < $total; $i++) {
$res = $this->checkPattern($patterns[$i]['ID'], $from_user_id);
$res = $this->checkPattern($patterns[$i]['ID'], $from_user_id, $details);
}
if (!$res && $from_user_id) {
$res = $this->checkExtPatterns(0);
Expand Down Expand Up @@ -335,9 +334,7 @@ function checkExtPatterns($ext_context_id, $user_id = 0)
$fields = array(
'data' => urlencode(serialize($data))
);
//DebMes("Sending data: ".serialize($data));

//url-ify the data for the POST
foreach ($fields as $key => $value) {
$fields_string .= $key . '=' . $value . '&';
}
Expand Down Expand Up @@ -764,6 +761,7 @@ function checkPattern($id, $from_user_id = 0, $details = 0)
}

$rec['LOG'] = date('Y-m-d H:i:s') . ' Pattern matched' . "\n" . $rec['LOG'];

if (strlen($rec['LOG']) > 65000) {
$rec['LOG'] = substr($rec['LOG'], 0, 65000);
}
Expand Down

0 comments on commit c2ec81b

Please sign in to comment.