Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.13 diff -u -p -r1.13 path.inc --- includes/path.inc 23 Dec 2006 22:04:52 -0000 1.13 +++ includes/path.inc 3 Jan 2007 14:50:24 -0000 @@ -54,11 +54,18 @@ function drupal_lookup_path($action, $pa $no_src = array(); } elseif ($count > 0 && $path != '') { + static $skiplist; + + // Use $skiplist to avoid retrieving the skiplist every time in subsequent calls + if (!isset($skiplist)) { + $skiplist = variable_get('path_skiplist', ''); + } + if ($action == 'alias') { if (isset($map[$path])) { return $map[$path]; } - $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path)); + $alias = drupal_path_match_patterns($path, $skiplist) ? FALSE : db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path)); $map[$path] = $alias; return $alias; } @@ -67,7 +74,10 @@ function drupal_lookup_path($action, $pa elseif ($action == 'source' && !isset($no_src[$path])) { // Look for the value $path within the cached $map if (!$src = array_search($path, $map)) { - if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s'", $path))) { + if (drupal_path_match_patterns($path, $skiplist)) { + $map[$src] = $path; + } + elseif ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s'", $path))) { $map[$src] = $path; } else { @@ -205,3 +215,19 @@ function drupal_is_front_page() { // we can check it against the 'site_frontpage' variable. return $_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node')); } + +/** + * Check if a path matches a path in the skiplist. + * + * @param $path + * The path to match. + * @param $patterns + * String containing patterns separated by \n, \r or \r\n. + * + * @return + * Boolean value: TRUE if the path matches a path in the skiplist, FALSE if otherwise. + */ +function drupal_path_match_patterns($path, $patterns) { + $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($patterns, '/')) .')$/'; + return preg_match($regexp, $path); +} \ No newline at end of file Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.245 diff -u -p -r1.245 block.module --- modules/block/block.module 18 Dec 2006 21:49:39 -0000 1.245 +++ modules/block/block.module 3 Jan 2007 14:50:25 -0000 @@ -663,11 +663,10 @@ function block_list($region) { if ($block->pages) { if ($block->visibility < 2) { $path = drupal_get_path_alias($_GET['q']); - $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($block->pages, '/')) .')$/'; // Compare with the internal and path alias (if any). - $page_match = preg_match($regexp, $path); + $page_match = drupal_path_match_patterns($path, $block->pages); if ($path != $_GET['q']) { - $page_match = $page_match || preg_match($regexp, $_GET['q']); + $page_match = $page_match || drupal_path_match_patterns($_GET['q'], $block->pages); } // When $block->visibility has a value of 0, the block is displayed on // all pages except those listed in $block->pages. When set to 1, it