diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2022-01-11 12:35:47 +0100 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2022-01-11 12:35:47 +0100 |
commit | 19985dbb8c0aa66dc4bf7905abc1148de909097d (patch) | |
tree | 2cd5a5d20d7e80fc2a51adf60d838d8a2c40999e /admin/survey/minify/builder/ocCheck.php | |
download | 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.gz 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.bz2 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.lz 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.xz 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.zst 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.zip |
Diffstat (limited to 'admin/survey/minify/builder/ocCheck.php')
-rw-r--r-- | admin/survey/minify/builder/ocCheck.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/admin/survey/minify/builder/ocCheck.php b/admin/survey/minify/builder/ocCheck.php new file mode 100644 index 0000000..85b272c --- /dev/null +++ b/admin/survey/minify/builder/ocCheck.php @@ -0,0 +1,37 @@ +<?php
+/**
+ * AJAX checks for zlib.output_compression
+ *
+ * @package Minify
+ */
+
+$app = (require __DIR__ . '/../bootstrap.php');
+/* @var \Minify\App $app */
+
+$_oc = ini_get('zlib.output_compression');
+
+// allow access only if builder is enabled
+if (!$app->config->enableBuilder) {
+ header('Location: /');
+ exit;
+}
+
+if ($app->env->get('hello')) {
+ // echo 'World!'
+
+ // try to prevent double encoding (may not have an effect)
+ ini_set('zlib.output_compression', '0');
+
+ HTTP_Encoder::$encodeToIe6 = true; // just in case
+ $he = new HTTP_Encoder(array(
+ 'content' => str_repeat('0123456789', 500),
+ 'method' => 'deflate',
+ ));
+ $he->encode();
+ $he->sendAll();
+
+} else {
+ // echo status "0" or "1"
+ header('Content-Type: text/plain');
+ echo (int)$_oc;
+}
|