summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorSimon Rettberg2015-02-26 17:07:00 +0100
committerSimon Rettberg2015-02-26 17:07:00 +0100
commit59f17e9a1d1f6b1ef45a52cb59fa625551d3e357 (patch)
tree93d3eaf6c7919c295b08a748cdc5f8b3f00a4a8f /extras
parentRemove some debug messages, fix possible race condition in ImageProcessor (diff)
downloadmasterserver-59f17e9a1d1f6b1ef45a52cb59fa625551d3e357.tar.gz
masterserver-59f17e9a1d1f6b1ef45a52cb59fa625551d3e357.tar.xz
masterserver-59f17e9a1d1f6b1ef45a52cb59fa625551d3e357.zip
Stuff
Diffstat (limited to 'extras')
-rw-r--r--extras/import-idp.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/extras/import-idp.php b/extras/import-idp.php
index 6ea9cb6..0b9adf1 100644
--- a/extras/import-idp.php
+++ b/extras/import-idp.php
@@ -20,7 +20,12 @@ $db = new mysqli($settings['host'], $settings['user'], $settings['password'], $s
if ($db->connect_errno) die("Could not connect to db: " . $db->connect_error . "\n");
$db->set_charset("utf8");
-$url = 'https://www.aai.dfn.de/fileadmin/metadata/DFN-AAI-metadata.xml';
+if ($argc > 2) {
+ $url = $argv[2];
+} else {
+ $url = 'https://www.aai.dfn.de/fileadmin/metadata/DFN-AAI-metadata.xml';
+}
+echo "Using $url...\n";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
@@ -34,9 +39,15 @@ preg_match_all('#<EntityDescriptor.*?</EntityDescriptor>#s', $data, $out);
foreach ($out[0] as $data) {
$data = preg_replace('#<(/?)[a-zA-Z0-9]+:#', '<\1', $data);
$xml = json_decode(json_encode(simplexml_load_string('<?xml version="1.0" encoding="utf-8" standalone="yes" ?>' . $data)), true);
- if (!isset($xml["Extensions"]["EntityAttributes"]["Attribute"]["AttributeValue"])) continue;
- if (!isset($xml["IDPSSODescriptor"]["Extensions"]["Scope"])) continue;
- if ($xml["Extensions"]["EntityAttributes"]["Attribute"]["AttributeValue"] !== 'http://aai.dfn.de/category/bwidm-member') continue;
+ //if (!isset($xml["Extensions"]["EntityAttributes"]["Attribute"]["AttributeValue"])) {
+ // echo "no EntityAttributes.Attribute.AttributeValue!\n";
+ // continue;
+ //}
+ //if ($xml["Extensions"]["EntityAttributes"]["Attribute"]["AttributeValue"] !== 'http://aai.dfn.de/category/bwidm-member') continue;
+ if (!isset($xml["IDPSSODescriptor"]["Extensions"]["Scope"])) {
+ echo "No Extensions.Scope!\n";
+ continue;
+ }
$scope = $xml["IDPSSODescriptor"]["Extensions"]["Scope"];
if (!is_array($scope)) $scope = array($scope);
$name = $xml["IDPSSODescriptor"]["Extensions"]["UIInfo"]["DisplayName"];