From 4eff1e02df18795c07a5c4069ea7fd344170e9a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Wed, 1 Jul 2009 07:05:59 +0000
Subject: [PATCH] Support machine readable output on single host ldapstatus
 check...

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1543 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/ldapstatus/www/index.php | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/modules/ldapstatus/www/index.php b/modules/ldapstatus/www/index.php
index d83d71c7d..bc8883f3b 100644
--- a/modules/ldapstatus/www/index.php
+++ b/modules/ldapstatus/www/index.php
@@ -177,6 +177,30 @@ if (array_key_exists('orgtest', $_REQUEST)) {
 			$orgconfig);
 			
 	$res = $tester->test();
+	
+	if(array_key_exists('output', $_REQUEST) && $_REQUEST['output'] === 'text') {
+		
+		$ok = TRUE;
+		foreach ($res AS $tag => $resEntry) {
+			if ($tag == 'time') continue;
+			if ($resEntry[0] == 0) {
+				$ok = FALSE;
+				echo("Error (" . $tag . ") : " . $resEntry[1] . "\n");
+			}
+		}
+		
+		if ($ok) {
+			echo('OOOKKK');
+		}
+		
+		// print_r($res);
+		// print_r($orgs[$_REQUEST['orgtest']]);
+		
+		exit;
+		
+		
+	}
+	
 
 	$t = new SimpleSAML_XHTML_Template($config, 'ldapstatus:ldapsinglehost.php');
 	
-- 
GitLab