From fe6fc38d40d25f29685ce0948e301ac543c97b39 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Mon, 3 Mar 2008 10:00:03 +0000
Subject: [PATCH] Adding PHPinfo page

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@342 44740490-163a-0410-bde0-09ae8108e29a
---
 www/admin/phpinfo.php | 25 +++++++++++++++++++++++++
 www/index.php         |  4 ++++
 2 files changed, 29 insertions(+)
 create mode 100644 www/admin/phpinfo.php

diff --git a/www/admin/phpinfo.php b/www/admin/phpinfo.php
new file mode 100644
index 000000000..2ad9e6f3c
--- /dev/null
+++ b/www/admin/phpinfo.php
@@ -0,0 +1,25 @@
+<?php
+
+require_once('../_include.php');
+require_once('SimpleSAML/Configuration.php');
+require_once('SimpleSAML/Session.php');
+require_once('SimpleSAML/Utilities.php');
+
+try {
+
+	$config = SimpleSAML_Configuration::getInstance();
+	$session = SimpleSAML_Session::getInstance(true);
+
+	/* Make sure that the user has admin access rights. */
+	if (!isset($session) || !$session->isValid('login-admin') ) {
+		SimpleSAML_Utilities::redirect('/' . $config->getBaseURL() . 'auth/login-admin.php',
+		                               array('RelayState' => SimpleSAML_Utilities::selfURL())
+		                               );
+	}
+	phpinfo();
+
+} catch(Exception $e) {
+	SimpleSAML_Utilities::fatalError('na', NULL, $e);
+}
+
+?>
\ No newline at end of file
diff --git a/www/index.php b/www/index.php
index 51521117d..fd70caba7 100644
--- a/www/index.php
+++ b/www/index.php
@@ -50,6 +50,10 @@ $links[] = array(
 	'href' => 'example-simple/hostnames.php', 
 	'text' => 'Diagnostics on hostname, port and protocol');
 
+$links[] = array(
+	'href' => 'admin/phpinfo.php', 
+	'text' => 'PHPinfo');
+
 
 
 $linksmeta = array();
-- 
GitLab