includes/namespaces/default.php
changeset 832 7152ca0a0ce9
parent 801 eb8b23f11744
child 866 0a691138a1e5
--- a/includes/namespaces/default.php	Mon Feb 16 16:04:54 2009 -0500
+++ b/includes/namespaces/default.php	Mon Feb 16 16:17:25 2009 -0500
@@ -353,6 +353,17 @@
                   'restore_onclick' => 'ajaxEditor(\''.$this->revision_id.'\'); return false;',
                 )) . '
             </div>';
+      $q = $db->sql_query('SELECT page_format FROM ' . table_prefix . "logs WHERE log_id = {$this->revision_id};");
+      if ( !$q )
+        $db->_die();
+      
+      list($page_format) = $db->fetchrow_num();
+      $db->free_result();
+    }
+    else
+    {
+      $pathskey = $paths->nslist[ $this->namespace ] . $paths->page_id;
+      $page_format = $paths->pages[$pathskey]['page_format'];
     }
     
     if ( $redir_enabled )
@@ -368,7 +379,17 @@
     
     if ( $incl_inner_headers )
     {
-      $text = '?>' . RenderMan::render($text);
+      if ( $page_format === 'wikitext' )
+      {
+        $text = '?>' . RenderMan::render($text);
+      }
+      else
+      {
+        // Page format is XHTML. This means we want to disable functionality that MCE takes care of, while still retaining
+        // the ability to wikilink, the ability to use images, etc. Basically, RENDER_INLINEONLY disables all behavior in
+        // the rendering engine/Text_Wiki that conflicts with MCE.
+        $text = '?>' . RenderMan::render($text, RENDER_WIKI_DEFAULT | RENDER_INLINEONLY);
+      }
     }
     else
     {