save.php 1.1 KB

123456789101112131415161718192021222324252627
  1. <?php
  2. function phorum_htmlpurifier_save_settings() {
  3. global $PHORUM;
  4. if (phorum_htmlpurifier_config_file_exists()) {
  5. echo "Cannot update settings, <code>mods/htmlpurifier/config.php</code> already exists. To change
  6. settings, edit that file. To use the web form, delete that file.<br />";
  7. } else {
  8. $config = phorum_htmlpurifier_get_config(true);
  9. if (!isset($_POST['reset'])) $config->mergeArrayFromForm($_POST, 'config', $PHORUM['mod_htmlpurifier']['directives']);
  10. $PHORUM['mod_htmlpurifier']['config'] = $config->getAll();
  11. }
  12. $PHORUM['mod_htmlpurifier']['wysiwyg'] = !empty($_POST['wysiwyg']);
  13. $PHORUM['mod_htmlpurifier']['suppress_message'] = !empty($_POST['suppress_message']);
  14. if(!phorum_htmlpurifier_commit_settings()){
  15. $error="Database error while updating settings.";
  16. } else {
  17. echo "Settings Updated<br />";
  18. }
  19. }
  20. function phorum_htmlpurifier_commit_settings() {
  21. global $PHORUM;
  22. return phorum_db_update_settings(array("mod_htmlpurifier"=>$PHORUM["mod_htmlpurifier"]));
  23. }
  24. // vim: et sw=4 sts=4