save.php 1.1 KB

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