Removed the $userpage parameter from Namespace_Default::error_404(). It screwed up a couple plugins. (Thanks Mazza for discovering the issue)
authorDan
Wed, 26 Aug 2009 23:25:39 -0400
changeset 1108 c1be67a50d81
parent 1107 2d37a11fabd8
child 1109 c424a15a1656
Removed the $userpage parameter from Namespace_Default::error_404(). It screwed up a couple plugins. (Thanks Mazza for discovering the issue)
ajax.php
includes/namespaces/default.php
includes/namespaces/user.php
includes/render.php
includes/wikiformat.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']);
--- 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}';
--- 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 '</div>'; // tab:content
--- 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
--- 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