1
andrey3761
dhtmltextarea and preview

Hello!
Has updated XOOPS from version 2.4.2 to version 2.4.3. When in the editor dhtmltextarea I press "Preliminary viewing" Russian letters are not present. Instead of Russian letters - html the coding...
How to correct?

Resized Image

2
alfred
Re: dhtmltextarea and preview
  • 2010/1/3 19:49

  • alfred

  • Quite a regular

  • Posts: 249

  • Since: 2005/10/29


open the /include/formdhtmltextarea_preview.php
Line 24:

From:
$content = $myts->stripSlashesGPC(xoops_convert_encoding($_GET['text']));

To

$content = $myts->stripSlashesGPC($_GET['text']);

3
andrey3761
Re: dhtmltextarea and preview

Has replaced this line, does not work...

4
andrey3761
Re: dhtmltextarea and preview

Letters are converted before sending in a file formdhtmltextarea_preview.php. Has made such contents - an error did not disappear.

<?php
include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mainfile.php';

$xoopsLogger->activated = false;
$myts =& MyTextSanitizer::getInstance();
//$content = $myts->stripSlashesGPC(xoops_convert_encoding($_GET['text']));

$content = $myts->stripSlashesGPC($_GET['text']);
echo 
"<div>" . $content . "</div>";
?>

The problem in java script means?

5
andrey3761
Re: dhtmltextarea and preview

Can help?

6
alfred
Re: dhtmltextarea and preview
  • 2010/1/4 19:44

  • alfred

  • Quite a regular

  • Posts: 249

  • Since: 2005/10/29


only for test!

replace

$content = $myts->stripSlashesGPC($_GET['text']);

witdh

$content = trim($_GET['text']);

7
andrey3761
Re: dhtmltextarea and preview

@alfred
Has replaced, the error remained...

Has cleaned everything, the error remained:

formdhtmltextarea_preview.php
<?php
include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mainfile.php';

$xoopsLogger->activated = false;
echo 
"<div>" . trim($_GET['text']) . "</div>";
?>

8
trabis
Re: dhtmltextarea and preview
  • 2010/1/9 17:19

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Not perfect but:
include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mainfile.php';

$xoopsLogger->activated = false;
$myts =& MyTextSanitizer::getInstance();
$content = $myts->stripSlashesGPC($_GET['text']);
$html = empty($_GET['html']) ? 0 : 1;
if (
preg_match_all('/%u([[:alnum:]]{4})/', $content, $matches)) {
    foreach (
$matches[1] as $uniord) {
        
$utf = '&#x' . $uniord . ';';
        
$content = str_replace('%u' . $uniord, $utf, $content);
    }
    
$content = urldecode($content);
}

$result = $myts->displayTarea($content, $html, 1, 1, 1, 1);
if (!
$html) $result = $myts->undoHtmlSpecialChars($result);
echo 
"<div>" . $result . "</div>";

9
trabis
Re: dhtmltextarea and preview
  • 2010/1/9 17:40

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


This is more like it:
$xoopsLogger->activated = false;
$myts =& MyTextSanitizer::getInstance();
$content = $myts->stripSlashesGPC($_GET['text']);
$html = empty($_GET['html']) ? 0 : 1;
$content = $myts->displayTarea($content, $html, 1, 1, 1, 1);
if (
preg_match_all('/%u([[:alnum:]]{4})/', $content, $matches)) {
    foreach (
$matches[1] as $uniord) {
        
$utf = '&#x' . $uniord . ';';
        
$content = str_replace('%u' . $uniord, $utf, $content);
    }
    
$content = urldecode($content);
}

echo 
"<div>" . $content . "</div>";

10
andrey3761
Re: dhtmltextarea and preview

Thanks.