|
2 | 2 |
|
3 | 3 | use SimpleSAML\Auth\State; |
4 | 4 | use SimpleSAML\Configuration; |
| 5 | +use SimpleSAML\Logger; |
| 6 | +use SimpleSAML\Module\perun\Auth\Process\WarningTestSP; |
5 | 7 | use SimpleSAML\XHTML\Template; |
6 | 8 |
|
7 | 9 | $id = $_REQUEST['StateId']; |
|
10 | 12 | $config = Configuration::getInstance(); |
11 | 13 |
|
12 | 14 | $t = new Template($config, 'perun:warning-test-sp-tpl.php'); |
| 15 | +$t->data[WarningTestSP::CUSTOM_TEXT_ENABLED] = false; |
| 16 | + |
| 17 | + |
| 18 | +$perunModuleConfig = null; |
| 19 | +try { |
| 20 | + $perunModuleConfig = Configuration::getConfig(WarningTestSP::CONFIG_FILE_NAME); |
| 21 | +} catch (\Exception $ex) { |
| 22 | + Logger::warning("perun:warning_test_sp_page: missing or invalid '" . |
| 23 | + WarningTestSP::CONFIG_FILE_NAME . "' config file"); |
| 24 | +} |
| 25 | +if ($perunModuleConfig != null) { |
| 26 | + $testSpWarningConfig = $perunModuleConfig->getConfigItem(WarningTestSP::TEST_SP_CONFIG, null); |
| 27 | + if ($testSpWarningConfig != null) { |
| 28 | + $header = $testSpWarningConfig->getArray(WarningTestSP::TEST_SP_CONFIG_HEADER, []); |
| 29 | + if (!empty($header)) { |
| 30 | + $t->includeInlineTranslation(WarningTestSP::CUSTOM_HEADER_KEY, $header); |
| 31 | + $t->data[WarningTestSP::CUSTOM_HEADER_ENABLED] = true; |
| 32 | + } |
| 33 | + $text = $testSpWarningConfig->getArray(WarningTestSP::TEST_SP_CONFIG_TEXT, []); |
| 34 | + if (!empty($text)) { |
| 35 | + $t->includeInlineTranslation(WarningTestSP::CUSTOM_TEXT_KEY, $text); |
| 36 | + $t->data[WarningTestSP::CUSTOM_TEXT_ENABLED] = true; |
| 37 | + } |
| 38 | + } |
| 39 | +} |
| 40 | + |
13 | 41 | $t->show(); |
0 commit comments