common.php 1013 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. header('Content-type: text/html; charset=UTF-8');
  3. require_once __DIR__.'/../vendor/autoload.php';
  4. if (!isset($_GET['standalone'])) {
  5. require_once '../library/HTMLPurifier.auto.php';
  6. } else {
  7. require_once '../library/HTMLPurifier.standalone.php';
  8. }
  9. error_reporting(E_ALL);
  10. function escapeHTML($string)
  11. {
  12. $string = HTMLPurifier_Encoder::cleanUTF8($string);
  13. $string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
  14. return $string;
  15. }
  16. if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
  17. function fix_magic_quotes(&$array)
  18. {
  19. foreach ($array as $k => $val) {
  20. if (!is_array($val)) {
  21. $array[$k] = stripslashes($val);
  22. } else {
  23. fix_magic_quotes($array[$k]);
  24. }
  25. }
  26. }
  27. fix_magic_quotes($_GET);
  28. fix_magic_quotes($_POST);
  29. fix_magic_quotes($_COOKIE);
  30. fix_magic_quotes($_REQUEST);
  31. fix_magic_quotes($_ENV);
  32. fix_magic_quotes($_SERVER);
  33. }
  34. // vim: et sw=4 sts=4