# HG changeset patch # User Dan # Date 1253992911 14400 # Node ID 777f32ac6b7c626d60f1d35989997db20c320cff # Parent e1606c85e93704598020d3ff5fe715bf19157739 More blank-urlname bugfixes, this time involving internal links diff -r e1606c85e937 -r 777f32ac6b7c includes/functions.php --- a/includes/functions.php Sat Sep 26 15:14:15 2009 -0400 +++ b/includes/functions.php Sat Sep 26 15:21:51 2009 -0400 @@ -293,7 +293,16 @@ return ( $sanitize ) ? sanitize_page_id($title) : $title; } - + +/** + * Returns true if we are allowed to have a page with a fully blank URL string. This page magically exists when you set the main page to blank. + * @return bool + */ + +function have_blank_urlname_page() +{ + return getConfig('main_page', 'Main_Page') == '' || getConfig('main_page', getConfig('main_page', 'Main_Page')) == ''; +} /** * Enano replacement for date(). Accounts for individual users' timezone preferences. diff -r e1606c85e937 -r 777f32ac6b7c includes/paths.php --- a/includes/paths.php Sat Sep 26 15:14:15 2009 -0400 +++ b/includes/paths.php Sat Sep 26 15:21:51 2009 -0400 @@ -135,7 +135,7 @@ if ( empty($title) ) $title = get_title(); - if ( empty($title) && getConfig('main_page', 'Main_Page') != '' && getConfig('main_page', getConfig('main_page', 'Main_Page')) != '' ) + if ( empty($title) && !have_blank_urlname_page() ) { $this->main_page(); } diff -r e1606c85e937 -r 777f32ac6b7c includes/render.php --- a/includes/render.php Sat Sep 26 15:14:15 2009 -0400 +++ b/includes/render.php Sat Sep 26 15:21:51 2009 -0400 @@ -664,8 +664,11 @@ $parser = is_string($tplcode) ? $template->makeParserText($tplcode) : false; + // allow blank urlname? + $repeater = have_blank_urlname_page() ? '*' : '+'; + // stage 1 - links with alternate text - preg_match_all('/\[\[([^\[\]<>\{\}\|]+)\|(.+?)\]\]/', $text, $matches); + preg_match_all('/\[\[([^\[\]<>\{\}\|]' . $repeater . ')\|(.+?)\]\]/', $text, $matches); foreach ( $matches[0] as $i => $match ) { list($page_id, $namespace) = RenderMan::strToPageID($matches[1][$i]); @@ -674,7 +677,7 @@ } // stage 2 - links with no alternate text - preg_match_all('/\[\[([^\[\]<>\{\}\|]+)\]\]/', $text, $matches); + preg_match_all('/\[\[([^\[\]<>\{\}\|]' . $repeater . ')\]\]/', $text, $matches); foreach ( $matches[0] as $i => $match ) { list($page_id, $namespace) = RenderMan::strToPageID($matches[1][$i]);