aboutsummaryrefslogtreecommitdiffstats
path: root/lib/htmlpurifier/smoketests/common.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-05-12 17:57:41 -0700
committerfriendica <info@friendica.com>2012-07-18 20:40:31 +1000
commit7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a (patch)
treea9c3d91209cff770bb4b613b1b95e61a7bbc5a2b /lib/htmlpurifier/smoketests/common.php
parentcd727cb26b78a1dade09d510b071446898477356 (diff)
downloadvolse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.tar.gz
volse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.tar.bz2
volse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.zip
some important stuff we'll need
Diffstat (limited to 'lib/htmlpurifier/smoketests/common.php')
-rw-r--r--lib/htmlpurifier/smoketests/common.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/htmlpurifier/smoketests/common.php b/lib/htmlpurifier/smoketests/common.php
new file mode 100644
index 000000000..c4e5eb388
--- /dev/null
+++ b/lib/htmlpurifier/smoketests/common.php
@@ -0,0 +1,37 @@
+<?php
+
+header('Content-type: text/html; charset=UTF-8');
+
+if (!isset($_GET['standalone'])) {
+ require_once '../library/HTMLPurifier.auto.php';
+} else {
+ require_once '../library/HTMLPurifier.standalone.php';
+}
+error_reporting(E_ALL);
+
+function escapeHTML($string) {
+ $string = HTMLPurifier_Encoder::cleanUTF8($string);
+ $string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
+ return $string;
+}
+
+if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
+ function fix_magic_quotes(&$array) {
+ foreach ($array as $k => $val) {
+ if (!is_array($val)) {
+ $array[$k] = stripslashes($val);
+ } else {
+ fix_magic_quotes($array[$k]);
+ }
+ }
+ }
+
+ fix_magic_quotes($_GET);
+ fix_magic_quotes($_POST);
+ fix_magic_quotes($_COOKIE);
+ fix_magic_quotes($_REQUEST);
+ fix_magic_quotes($_ENV);
+ fix_magic_quotes($_SERVER);
+}
+
+// vim: et sw=4 sts=4