jkenters/EventsX — Issue #25: Bugs preg_match in plugin & snippet
Author: tonisch
Created: 2012-02-14 14:47:33+00:00
State: open

Hi,

I found some Bugs in the Plugin and Snippet. Since I am new to github, I don't know how exactly I put in the corrections, I simply post them here:

in the plugin EventX line 9:
old: $eventsPageRegex = preg_quote(trim($modx->makeUrl($eventsPage), '/'));
new: $eventsPageRegex = preg_quote(trim($modx->makeUrl($eventsPage)), '/');
(moved the '/' after the bracket)

And in Line 62, the result of the preg_math should be tested on !== false =>
elseif ($modx->event->name == 'OnPageNotFound' && (preg_match('/'.$eventsPageRegex.'\/.*\/[0-9]+$/', $_SERVER['REQUEST_URI']) !== false))

Same goes for the snippet.