Merge branch 'contrib' into 'master'
[mailer.git] / contrib / autoreg_test.php
diff --git a/contrib/autoreg_test.php b/contrib/autoreg_test.php
new file mode 100644 (file)
index 0000000..76e51eb
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Test script for checking all requirements and optional PHP extensions for
+ * ext-autoreg. This is public domain software because I don't care what you do
+ * with it.
+ *
+ * If this script sets your computer on fire or eats your children, it is your
+ * OWN risk to use this software, but it may not do this.
+ */
+
+// Init counter variables
+$good = 0;
+$bad = 0;
+
+// Check for required base64_encode function
+if (function_exists('base64_encode')) {
+       // Required function exist
+       print basename(__FILE__) . ': BASE-64 support detected. <font color="green">Good!</font><br />';
+       $good++;
+} else {
+       print basename(__FILE__) . ': BASE-64 support <strong>NOT</strong> detected. <font color="red">Failed!</font> :-(<br />';
+       $bad++;
+}
+
+// Check for required urlencode function
+if (function_exists('urlencode')) {
+       // Required function exist
+       print basename(__FILE__) . ': URL encode support detected. <font color="green">Good!</font><br />';
+       $good++;
+} else {
+       print basename(__FILE__) . ': URL encode support <strong>NOT</strong> detected. <font color="red">Failed!</font> :-(<br />';
+       $bad++;
+}
+
+// Check for required gzcompress function
+if (function_exists('gzcompress')) {
+       // Required function exist
+       print basename(__FILE__) . ': GZIP support detected. <font color="green">Good!</font><br />';
+       $good++;
+} else {
+       print basename(__FILE__) . ': GZIP support <strong>NOT</strong> detected. <font color="red">Failed!</font> :-(<br />';
+       $bad++;
+}
+
+// Check for optional mcrypt_encrypt() function
+if (function_exists('mcrypt_encrypt')) {
+       // Optional function found, good!
+       print basename(__FILE__) . ': mcrypt support detected. <font color="green">Good</font>!<br />';
+       $good++;
+} else {
+       // Not detected, not bad but would be good to have
+       print basename(__FILE__) . ': mcrypt support <strong>NOT</strong> detected. <font color="yellow">Fix me!</font><br />';
+}
+
+// Output total result
+print '<br />';
+print 'Analysis summary: good=' . $good . ', bad=' . $bad . '<br />';
+print '<br />';
+print 'Result: ';
+
+// Is something missing?
+if ($bad > 0) {
+       // Some required functions not found!
+       print '<font color="red">Failed!</<font>';
+} else {
+       // All fine
+       print '<font color="green">Passed!</font>';
+}
+
+// [EOF]
+?>