diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index b9c3eb63d..f56f171a0 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -2204,7 +2204,8 @@ class e_admin_controller session_write_close(); // do redirect - header('Location: '.$url); + e107::redirect($url); + // header('Location: '.$url); exit; } diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index d04c6031f..35bb63b7b 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -3939,8 +3939,7 @@ TMPL; echo ""; - echo "

DB -> bbarea

"; - echo e107::getForm()->bbarea('name',$tp->toForm($dbText)); + } @@ -3959,6 +3958,10 @@ TMPL; echo $toFormRender; + + echo "

toDB ≫ bbarea

"; + echo e107::getForm()->bbarea('name',$toForm); + if(!empty($advanced)) { @@ -4167,7 +4170,9 @@ return; { $html = mb_convert_encoding($html, 'HTML-ENTITIES', "UTF-8"); } + @$doc->loadHTML($html); + // $doc->encoding = 'UTF-8'; // $doc->resolveExternals = true; @@ -4189,19 +4194,15 @@ return; // $tag = strval(basename($path)); - if(strpos($path,'/code/') !== false || strpos($path,'/pre/') !== false) // treat as html. + if(strpos($path,'/code') !== false || strpos($path,'/pre') !== false) // treat as html. { - $this->pathList[] = $path; - $this->nodesToConvert[] = $node->parentNode; // $node; + $this->pathList[] = $path; + // $this->nodesToConvert[] = $node->parentNode; // $node; + $this->nodesToDisableSC[] = $node; continue; } - if(substr($path,-4) == '/pre' || substr($path,-5) == '/code') - { - $this->pathList[] = $path; - $this->nodesToDisableSC[] = $node; - } - + $tag = preg_replace('/([a-z0-9\[\]\/]*)?\/([\w]*)(\[(\d)*\])?$/i', "$2", $path); if(!in_array($tag, $this->allowedTags)) { @@ -4264,24 +4265,43 @@ return; } // Disable Shortcodes in pre/code + foreach($this->nodesToDisableSC as $node) { - // $value = $node->C14N(); - $value = $node->nodeValue; - // $value = str_replace(" ","",$value); + $value = $node->C14N(); + $value = str_replace(" ","\r",$value); + + if($node->nodeName == 'pre') + { + $value = preg_replace('/^]*>/','',$value); + $value = str_replace("", "", $value); + } + + if($node->nodeName == 'code') + { + $value = preg_replace('/^]*>/','',$value); + $value = str_replace("", "", $value); + } + $value = str_replace('{','{{{',$value); // temporarily change {e_XXX} to {{{e_XXX}}} $value = str_replace('}','}}}',$value); // temporarily change {e_XXX} to {{{e_XXX}}} - $node->nodeValue = $value; + + // $value = htmlentities(htmlentities($value)); // Crashes apache. + $node->nodeValue = $value; // Crashes apache sometimes FIXME! . } - // Convert and
 Tags to Htmlentities. 
+
+        // Convert  and 
 Tags to Htmlentities.
+        /* TODO XXX Still necessary? Perhaps using bbcodes only?
         foreach($this->nodesToConvert as $node)  
         {
             $value = $node->C14N();
 
             $value = str_replace("
","",$value);
+
+        //    print_a("WOWOWO");
             
             if($node->nodeName == 'pre')
             {
@@ -4300,14 +4320,15 @@ return;
             $value = htmlentities(htmlentities($value)); // Needed
             $node->nodeValue = $value;
         }
-
+		*/
 
         $cleaned = $doc->saveHTML($doc->documentElement); // $doc->documentElement fixes utf-8/entities issue. @see http://stackoverflow.com/questions/8218230/php-domdocument-loadhtml-not-encoding-utf-8-correctly
 
 		$cleaned = str_replace('@nbsp;', ' ',  $cleaned); // prevent replacement of   with spaces. - convert back.
 
+
 		$cleaned = str_replace('{{{','{', $cleaned); // convert shortcode temporary triple-curly braces back to entities.
-	    $cleaned = str_replace('}}}','}', $cleaned); // convert shortcode temporary triple-curly braces back to entities.
+         $cleaned = str_replace('}}}','}', $cleaned); // convert shortcode temporary triple-curly braces back to entities.
 
         $cleaned = str_replace(array('','','','','','',''),'',$cleaned); // filter out tags.