Select Git revision
check_backup_one
-
Hahn Axel (hahn) authoredHahn Axel (hahn) authored
inc_functions.php 2.08 KiB
<?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
// ----------------------------------------------------------------------
/**
* 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;
}
function getCustomCss()
{
foreach([
'screen_custom.css'
] as $sCustomCss ){
if(file_exists($sCustomCss)){
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$sCustomCss\" media=\"screen\" />";
}
}
}
/**
* 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>";
}
// ----------------------------------------------------------------------