# HG changeset patch # User Dan # Date 1251343539 14400 # Node ID c1be67a50d8180917d7732d750bcd8ef818e8a76 # Parent 2d37a11fabd8ee0350d85ddb7e3096378cc1e637 Removed the $userpage parameter from Namespace_Default::error_404(). It screwed up a couple plugins. (Thanks Mazza for discovering the issue) diff -r 2d37a11fabd8 -r c1be67a50d81 ajax.php --- a/ajax.php Wed Aug 26 13:43:11 2009 -0400 +++ b/ajax.php Wed Aug 26 23:25:39 2009 -0400 @@ -75,7 +75,7 @@ 'have_draft' => false ); - $return['page_format'] = $paths->cpage['page_format']; + $return['page_format'] = $page->ns->cdata['page_format']; if ( $return['page_format'] == 'xhtml' ) { // gently process headings to make tinymce format them correctly @@ -491,7 +491,7 @@ switch($_GET['to']) { case 'xhtml': - $result = RenderMan::render($_POST['text'], RENDER_WIKI_DEFAULT | RENDER_BLOCKONLY); + $result = RenderMan::render($_POST['text'], RENDER_BLOCK | RENDER_NOSMILIES, false); break; case 'wikitext': $result = RenderMan::reverse_render($_POST['text']); diff -r 2d37a11fabd8 -r c1be67a50d81 includes/namespaces/default.php --- a/includes/namespaces/default.php Wed Aug 26 13:43:11 2009 -0400 +++ b/includes/namespaces/default.php Wed Aug 26 23:25:39 2009 -0400 @@ -533,11 +533,13 @@ } } - public function error_404($userpage = false) + public function error_404() { global $db, $session, $paths, $template, $plugins; // Common objects global $lang, $output; + $userpage = $this->namespace == 'User'; + @header('HTTP/1.1 404 Not Found'); $msg = ( $pp = $paths->sysmsg('Page_not_found') ) ? $pp : '{STANDARD404}'; diff -r 2d37a11fabd8 -r c1be67a50d81 includes/namespaces/user.php --- a/includes/namespaces/user.php Wed Aug 26 13:43:11 2009 -0400 +++ b/includes/namespaces/user.php Wed Aug 26 23:25:39 2009 -0400 @@ -439,7 +439,7 @@ } else { - $this->error_404(true); + $this->error_404(); } echo ''; // tab:content diff -r 2d37a11fabd8 -r c1be67a50d81 includes/render.php --- a/includes/render.php Wed Aug 26 13:43:11 2009 -0400 +++ b/includes/render.php Wed Aug 26 23:25:39 2009 -0400 @@ -164,7 +164,7 @@ if ( !$smilies ) $flags |= RENDER_NOSMILIES; - if ( $flags & ~RENDER_NOSMILIES ) + if ( !($flags & RENDER_NOSMILIES) ) { $text = RenderMan::smilieyize($text); } @@ -217,6 +217,50 @@ { // FIXME: Where is noinclude/nodisplay being processed in the pipeline? (Seems to be processed, but not here) } + + // + // Set rules for the rendering process + // + + if ( $flags & RENDER_BLOCK && !($flags & RENDER_INLINE) ) + { + // block only + $carpenter->disable_all_rules(); + foreach ( array('blockquote', 'tables', 'heading', 'hr', 'multilist', 'bold', 'italic', 'underline', 'paragraph', 'blockquotepost') as $rule ) + { + $carpenter->enable_rule($rule); + } + + $code = $plugins->setHook('render_block_only'); + foreach ( $code as $cmd ) + { + eval($cmd); + } + } + else if ( $flags & RENDER_INLINE && !($flags & RENDER_BLOCK) ) + { + // inline only + $carpenter->disable_all_rules(); + foreach ( array('bold', 'italic', 'underline', 'externalwithtext', 'externalnotext', 'image', 'internallink') as $rule ) + { + $carpenter->enable_rule($rule); + } + + $code = $plugins->setHook('render_inline_only'); + foreach ( $code as $cmd ) + { + eval($cmd); + } + } + else + { + // full render + $code = $plugins->setHook('render_full'); + foreach ( $code as $cmd ) + { + eval($cmd); + } + } $text = $carpenter->render($text); // For plugin compat diff -r 2d37a11fabd8 -r c1be67a50d81 includes/wikiformat.php --- a/includes/wikiformat.php Wed Aug 26 13:43:11 2009 -0400 +++ b/includes/wikiformat.php Wed Aug 26 23:25:39 2009 -0400 @@ -316,6 +316,29 @@ } /** + * Disables all rules. + * @return null + */ + + public function disable_all_rules() + { + $this->rules = array(); + return null; + } + + /** + * Enables a rule + * @param string rule + * @return null + */ + + public function enable_rule($rule) + { + $this->rules[] = $rule; + return null; + } + + /** * Make a rule exclusive (the only one called) * @param string stage * @return null