aboutsummaryrefslogtreecommitdiffstats
path: root/mod/authtest.php
diff options
context:
space:
mode:
authorChristian Vogeley <christian.vogeley@hotmail.de>2013-12-22 14:31:27 +0100
committerChristian Vogeley <christian.vogeley@hotmail.de>2013-12-22 14:31:27 +0100
commit870df76463a1cc9823b364db0bfb387f3f46664f (patch)
treea8c7391bfe799703aa0a8f26b9ee788f1204e8be /mod/authtest.php
parent25a533bd72c34e9775af71c010a39db6caf7b633 (diff)
parent7e7b5bfa4930493a8feae10b0550e29797956c70 (diff)
downloadvolse-hubzilla-870df76463a1cc9823b364db0bfb387f3f46664f.tar.gz
volse-hubzilla-870df76463a1cc9823b364db0bfb387f3f46664f.tar.bz2
volse-hubzilla-870df76463a1cc9823b364db0bfb387f3f46664f.zip
Merge remote-tracking branch 'upstream/master' into bootstrap
Conflicts: view/php/theme_init.php
Diffstat (limited to 'mod/authtest.php')
-rw-r--r--mod/authtest.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/mod/authtest.php b/mod/authtest.php
new file mode 100644
index 000000000..7747ea504
--- /dev/null
+++ b/mod/authtest.php
@@ -0,0 +1,50 @@
+<?php
+
+require_once('include/zot.php');
+require_once('mod/magic.php');
+
+function authtest_content(&$a) {
+
+
+ $auth_success = false;
+ $o .= '<h3>Magic-Auth Diagnostic</h3>';
+
+ if(! local_user()) {
+ notice( t('Permission denied.') . EOL);
+ return $o;
+ }
+
+ $o .= '<form action="authtest" method="get">';
+ $o .= 'Target URL: <input type="text" style="width: 250px;" name="dest" value="' . $_GET['dest'] .'" />';
+ $o .= '<input type="submit" name="submit" value="Submit" /></form>';
+
+ $o .= '<br /><br />';
+
+ if(x($_GET,'dest')) {
+ $_REQUEST['test'] = 1;
+ $x = magic_init($a);
+ $o .= 'Local Setup returns: ' . print_r($x,true);
+
+
+
+ if($x['url']) {
+ $z = z_fetch_url($x['url'] . '&test=1');
+ if($z['success']) {
+ $j = json_decode($z['body'],true);
+ if(! $j)
+ $o .= 'json_decode failure from remote site. ' . print_r($z['body'],true);
+ $o .= 'Remote site responded: ' . print_r($j,true);
+ if(strpos($j,'Authentication Success'))
+ $auth_success = true;
+ }
+ else {
+ $o .= 'fetch url failure.' . print_r($z,true);
+ }
+ }
+
+ if(! $auth_success)
+ $o .= 'Authentication Failed!' . EOL;
+ }
+
+ return str_replace("\n",'<br />',$o);
+}