Pages filter don't work
Lvl - February 10, 2009 - 11:37
| Project: | BUEditor |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
I note that my BUEditor ignores pages that he must be enabled. Then i try to hack bueditor_check_match:
function bueditor_check_match($needle, $haystack) {
ea($needle);
$needle = '/^'. preg_replace("/\r\n?|\n/", '|', str_replace(array('*', '-', '/'), array('.*', '\\-', '\\/'), $needle)) .'$/';
ea($needle);
ea($haystack);
ea(preg_match($needle, $haystack));
die();
return preg_match($needle, $haystack);
}ea is my function that dump variable.
It shows:
node/add/blog
node/add/forum
node/add/album
node/add/quotation
node/*
comment/reply/*
comment/edit/*
/^node\/add\/blog|node\/add\/forum|node\/add\/album|node\/add\/quotation|node\/.*|comment\/reply\/.*|comment\/edit\/.*|$/
complain/1005/38429
1And "|$" force always return 1 on preg_match(). Then i think you code needs a little patch:
$needle = '/^'. preg_replace("/\r\n?|\n/", '$|^', str_replace(array('*', '-', '/'), array('.*', '\\-', '\\/'), $needle)) .'$/';It works fine for me, but it's need more tests i think.
