merge stable

This commit is contained in:
following
2013-04-01 00:30:06 +02:00
2 changed files with 18 additions and 6 deletions

View File

@ -778,7 +778,7 @@ class Okapi
{ {
public static $data_store; public static $data_store;
public static $server; public static $server;
public static $revision = 646; # This gets replaced in automatically deployed packages public static $revision = 651; # This gets replaced in automatically deployed packages
private static $okapi_vars = null; private static $okapi_vars = null;
/** Get a variable stored in okapi_vars. If variable not found, return $default. */ /** Get a variable stored in okapi_vars. If variable not found, return $default. */

View File

@ -165,21 +165,33 @@ class WebService
if ($comment_format == 'plaintext') if ($comment_format == 'plaintext')
{ {
# If we would like to be compatible with old OCDE/OC.nl installation,
# "$comment_format == 'auto'" should go here, too. But we must choose
# to resemble either old OCDE or OCPL behaviour and opt for OCPL compatibility.
$formatted_comment = htmlspecialchars($comment, ENT_QUOTES); $formatted_comment = htmlspecialchars($comment, ENT_QUOTES);
$formatted_comment = nl2br($formatted_comment); $formatted_comment = nl2br($formatted_comment);
$value_for_text_html_field = 0; $value_for_text_html_field = 0;
} }
else else
{ {
if ($comment_format == 'auto')
{
# This does not make sense on HTML comments, but it resembles the
# OCPL implementation and is needed for full compatibility with existing
# OKAPI clients.
$formatted_comment = nl2br($comment);
}
else
$formatted_comment = $comment;
# NOTICE: We are including EXTERNAL OCDE library here! This # NOTICE: We are including EXTERNAL OCDE library here! This
# code does not belong to OKAPI! # code does not belong to OKAPI!
require_once $GLOBALS['rootpath'] . '../lib/htmlpurifier-4.2.0/library/HTMLPurifier.auto.php'; require_once $GLOBALS['rootpath'] . '../lib/htmlpurifier-4.2.0/library/HTMLPurifier.auto.php';
$config = \HTMLPurifier_Config::createDefault(); $purifier = new \HTMLPurifier();
if ($comment_format == 'auto') $formatted_comment = $purifier->purify($formatted_comment);
$config->set('AutoFormat', 'AutoParagraph', true);
$purifier = new \HTMLPurifier($config);
$formatted_comment = $purifier->purify($comment);
$value_for_text_html_field = 1; $value_for_text_html_field = 1;
} }
} }