0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-08 06:48:42 +00:00

Use default configuration when resetting; prevents zombie defaults for encodings from carrying over.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang 2009-01-30 14:41:28 -08:00
parent bfe474042f
commit 0c9dc02d4a
2 changed files with 3 additions and 3 deletions

View File

@ -5,10 +5,10 @@
* or a module configuration value * or a module configuration value
* @return Instance of HTMLPurifier_Config * @return Instance of HTMLPurifier_Config
*/ */
function phorum_htmlpurifier_get_config() { function phorum_htmlpurifier_get_config($default = false) {
global $PHORUM; global $PHORUM;
$config_exists = phorum_htmlpurifier_config_file_exists(); $config_exists = phorum_htmlpurifier_config_file_exists();
if ($config_exists || !isset($PHORUM['mod_htmlpurifier']['config'])) { if ($default || $config_exists || !isset($PHORUM['mod_htmlpurifier']['config'])) {
$config = HTMLPurifier_Config::createDefault(); $config = HTMLPurifier_Config::createDefault();
include(dirname(__FILE__) . '/config.default.php'); include(dirname(__FILE__) . '/config.default.php');
if ($config_exists) { if ($config_exists) {

View File

@ -6,7 +6,7 @@ function phorum_htmlpurifier_save_settings() {
echo "Cannot update settings, <code>mods/htmlpurifier/config.php</code> already exists. To change echo "Cannot update settings, <code>mods/htmlpurifier/config.php</code> already exists. To change
settings, edit that file. To use the web form, delete that file.<br />"; settings, edit that file. To use the web form, delete that file.<br />";
} else { } else {
$config = phorum_htmlpurifier_get_config(); $config = phorum_htmlpurifier_get_config(true);
if (!isset($_POST['reset'])) $config->mergeArrayFromForm($_POST, 'config', $PHORUM['mod_htmlpurifier']['directives']); if (!isset($_POST['reset'])) $config->mergeArrayFromForm($_POST, 'config', $PHORUM['mod_htmlpurifier']['directives']);
$PHORUM['mod_htmlpurifier']['config'] = $config->getAll(); $PHORUM['mod_htmlpurifier']['config'] = $config->getAll();
} }