<?php // ====================================================================== // // AAI LOGIN WITH SHIBBOLETH HANDLING MULTIPLE ORGANIZATIONS // // included functions // // License: GNU GPL 3.0 // Source: https://git-repo.iml.unibe.ch/iml-open-source/login-aai // ====================================================================== // ---------------------------------------------------------------------- // INIT // ---------------------------------------------------------------------- require 'classes/shibd_discofeed.class.php'; require 'classes/lang.class.php'; // get the user config if (!file_exists('config.php')) { die("ERROR: file config.php does not exist yet."); } $aConfig = require 'config.php'; $SELFURL = isset($_SERVER['SERVER_NAME']) ? "https://" . $_SERVER['SERVER_NAME'] : ''; $oDiscofeed = new shibd_discofeed($aConfig, $SELFURL); $aIdplist = $oDiscofeed->getIdps(); $L = new lang($aConfig['lang'] ?? 'en'); // ---------------------------------------------------------------------- // functions // ---------------------------------------------------------------------- /** * Show a info or error message * * @param string $sLevel level: one of "info", "error" * @param string $sMessage Message to show * @return void */ function showMessage(string $sLevel, string $sMessage) { echo "<div class=\"msg $sLevel\">$sMessage</div>"; } /** * Get a list of static links for browsers without javascript * see also https://help.switch.ch/aai/guides/discovery/login-link-composer/ * * @param array $aIdplist * @return string */ function getStaticlinks($aIdplist){ $sReturn=''; foreach ($aIdplist as $aEntry) { $sReturn .= '<a href="' . $aEntry['_url']. '">' . $aEntry['_label'] . '</a><br>' . "\n"; } return $sReturn; } // ----------------------------------------------------------------------