diff --git a/CHANGELOG.md b/CHANGELOG.md index 86a37d9359ebd1137ff4c57f63037aa1ed9da97a..c78328e10c21d9668fe635460c4ffea14820c5a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,39 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v-egi-2.0.0](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/compare/v-egi-1.4.1...v-egi-2.0.0) - 2021-05-10 + +### Fixed + +- Added missing space in button text +- Fix undefined index error for `idps_in_searchable_list_index` +- Load JavaScript scripts with the new way +- Load jQuery CSS script +- Fix `translationParams` error in userid template + +### Changed + +- Renamed login_at variable to login_with and moved in the discopower dictionary +- Rename disco-tpl.php->disco.tpl.php +- Change discopower js files path +- Update translation functionality for SSP v1.17 +- Update language array +- Update templates of concent modules to support SSP v1.17 +- Update "no_state" template to support SSP v1.17 +- Update "disco" template to support SSP v1.17 +- Move `ribbon_text` definition to config file +- Comply to [PSR-4: Autoloader](https://www.php-fig.org/psr/psr-4/) guidelines +- Comply to [PSR-1: Basic Coding Standard](https://www.php-fig.org/psr/psr-1/) guidelines +- Comply to [PSR-12: Extended Coding Style](https://www.php-fig.org/psr/psr-12/) + guidelines +- Apply modern array syntax to comply with [SimpleSAMLphp v1.17](https://simplesamlphp.org/docs/stable/simplesamlphp-upgrade-notes-1.17) + +<!-- markdownlint-disable line-length --> + ## [v-egi-1.4.1](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/compare/v-egi-1.4.0...v-egi-1.4.1) - 2021-01-20 +<!-- markdownlint-enable line-length --> + ### Added - Added comanage loader spinner @@ -21,23 +52,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Made loader spinner configurable - Moved language bar into a shared, stand alone element +<!-- markdownlint-disable line-length --> + ## [v-egi-1.4.0](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/compare/v-egi-1.3.2...v-egi-1.4.0) - 2021-01-15 +<!-- markdownlint-enable line-length --> + ### Added - EGI wrapper template for simple html views +<!-- markdownlint-disable line-length --> + ## [v-egi-1.3.2](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/compare/v-egi-1.3.1...v-egi-1.3.2) - 2020-12-22 +<!-- markdownlint-enable line-length --> + ### Changed - `browser_tab_title` from EGI to Check-in in `default.definition.json` -- `%IDP%` to `%IDPNAME%` in `userid_error.definition.json`::`friendly_description` +- `%IDP%` to `%IDPNAME%` in `userid_error.definition.json`::`friendly_description` - Removed `<a href=\"%RETRY_URL%\">` from `userid_error.definition.json`::`resolution_description` - Removed redundant code from `conseform.php` +<!-- markdownlint-disable line-length --> + ## [v-egi-1.3.1](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/compare/v-egi-1.3.0...v-egi-1.3.1) - 2020-12-21 +<!-- markdownlint-enable line-length --> + ### Added - Exception template for attrauthcomanage module @@ -46,22 +89,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Custom EGI footer date +<!-- markdownlint-disable line-length --> + ## [v-egi-1.3.0](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/compare/v-egi-1.2.1...v-egi-1.3.0) - 2020-12-15 +<!-- markdownlint-enable line-length --> + ### Added - Static View with information for Email Confirmation - Add style rules and logos for the IdPs: - IDPOpen +<!-- markdownlint-disable line-length --> + ## [v-egi-1.2.1](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/compare/v-egi-1.2.0...v-egi-1.2.1) - 2019-09-13 +<!-- markdownlint-enable line-length --> + ### Fixed - Fix bug in IdPs buttons style caused by unclosed html element. +<!-- markdownlint-disable line-length --> + ## [v-egi-1.2.0](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/compare/v-egi-1.1.0...v-egi-1.2.0) - 2019-09-02 +<!-- markdownlint-enable line-length --> + ### Changed - Alter Google login button style due to Google+ deprecation. @@ -76,8 +131,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bitbucket - Github +<!-- markdownlint-disable line-length --> + ## [v-egi-1.1.0](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/compare/v-egi-1.0.0...v-egi-1.1.0) - 2018-10-30 +<!-- markdownlint-enable line-length --> + ### Added - Add banner and an extra view for cookies options @@ -94,16 +153,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update footer style - Render header logo link url customisable +<!-- markdownlint-disable line-length --> + ## [v-egi-1.0.0](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/compare/v2.0.0...v-egi-1.0.0) - 2018-05-07 +<!-- markdownlint-enable line-length --> + ### Changed - Replace themevanilla -> themeegi - Use EGI identity (logos, translations) - Use custom EGI footer +<!-- markdownlint-disable line-length --> + ## [v2.0.0](https://github.com/EGI-Foundation/simplesamlphp-module-themeegi/commits/v2.0.0) - 2018-04-17 +<!-- markdownlint-enable line-length --> + ### Added Create a new theme for SimpleSAMLphp. The theme is a fork from [simplesamlphp-module-themevanilla](https://github.com/rciam/simplesamlphp-module-themevanilla). diff --git a/README.md b/README.md index 4591502445988639a0d213aa676db9d1ef8b8eea..d52c0d434591935a0c14b837c1c2c61d77ec284f 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,27 @@ -<h1 align="center">EGI theme for SimpleSAMLphp</h1> +# EGI theme for SimpleSAMLphp - + A theme for the SimpleSAMLphp software that is used for the EGI Check-in service. The theme is based on the [RCIAM vanilla theme](https://github.com/rciam/simplesamlphp-module-themevanilla). Screenshots are available in [screenshots](screenshots/). -More information regarding the installation and the customisation of the theme can be found -in the [repository of the vanilla theme](https://github.com/rciam/simplesamlphp-module-themevanilla). +More information regarding the installation and the customisation of the theme +can be found in the [repository of the vanilla theme](https://github.com/rciam/simplesamlphp-module-themevanilla). ## Acknowledgement -This work has received funding from the [EGI Foundation (EGI.eu)](https://www.egi.eu/about/egi-foundation/) and the [EOSC-hub project](http://eosc-hub.eu/) (Horizon 2020) under Grant number 777536. +This work has received funding from the [EGI Foundation (EGI.eu)](https://www.egi.eu/about/egi-foundation/) +and the [EOSC-hub project](http://eosc-hub.eu/) (Horizon 2020) under Grant +number 777536. + +<!-- markdownlint-disable no-inline-html line-length --> + <img src="https://europa.eu/european-union/sites/europaeu/files/docs/body/flag_yellow_high.jpg" height="24"> +<!-- markdownlint-enable no-inline-html line-length --> + ## License Licensed under the Apache 2.0 license, for details see `LICENSE`. diff --git a/config-example/module_themeegi.php b/config-example/module_themeegi.php index 7746061ffc0e269059f3878315376f79fcb934fd..ca88473e9d1d97f9a8bfc8e8fb2c0d43e2c18a33 100644 --- a/config-example/module_themeegi.php +++ b/config-example/module_themeegi.php @@ -1,4 +1,5 @@ <?php + /** * This is example configuration of SimpleSAMLphp themevanila. * Copy this file to default config directory and edit the properties. @@ -6,22 +7,83 @@ * copy command (from SimpleSAML base dir) * cp modules/themeegi/module_themeegi.php config/ */ -$config = array( - 'cookiePolicy' => array( - array('type' => 'Session State', 'provider' => 'aai.egi.eu', 'name' => 'egi_proxy_authtoken, egi_google_proxy_authtoken, egi_google_proxy_authtoken, egi_facebook_proxy_authtoken, egi_linkedin_proxy_authtoken, egi_orcid_proxy_authtoken', 'thirdParty' => false, 'category' => 'Session', 'purpose' => 'Preserve user authentication token to prevent session fixation attacks'), - array('type' => 'Session State', 'provider' => 'aai.egi.eu', 'name' => 'egi_proxy_sid, egi_google_proxy_sid, egi_google_proxy_sid, egi_facebook_proxy_sid, egi_linkedin_proxy_sid, egi_orcid_proxy_sid', 'thirdParty' => false, 'category' => 'Session', 'purpose' => 'Preserve user session ID to retrieve session information'), - array('type' => 'Preferences', 'provider' => 'aai.egi.eu', 'name' => 'egi_poweridpdisco_lastidp', 'thirdParty' => false, 'category' => 'Persistent', 'purpose' => 'Preserve preferred IdP selection for SimpleSAMLphp IdP discovery service'), - array('type' => 'Preferences', 'provider' => 'aai.egi.eu', 'name' => 'egi_poweridpdisco_remember', 'thirdParty' => false, 'category' => 'Persistent', 'purpose' => 'Preserve preference whether to remember IdP selection for SimpleSAMLphp IdP discovery service'), - array('type' => 'Session State', 'provider' => 'aai.egi.eu', 'name' => 'egi_co_registry_sid', 'thirdParty' => false, 'category' => 'Session', 'purpose' => 'Preserve user session ID to retrieve session information'), - array('type' => 'Preferences', 'provider' => 'aai.egi.eu', 'name' => 'egi_co_registry_tz', 'thirdParty' => false, 'category' => 'Persistent', 'purpose' => 'Preserve preferred timezone selection for COmanage EGI Account Registry'), - array('type' => 'Preferences', 'provider' => 'aai.egi.eu', 'name' => 'i18next', 'thirdParty' => false, 'category' => 'Session', 'purpose' => 'Preserve preferred language for EGI AAI OpenID Connect Provider'), - array('type' => 'Session State', 'provider' => 'aai.egi.eu', 'name' => 'JSESSIONID', 'thirdParty' => false, 'category' => 'Session', 'purpose' => 'Preserve user session ID to retrieve session information') - ), - 'views' => array( - 'aup' => 'https://aai.egi.eu/aup/check-in.html', // Terms and Conditions URL. The key MUST BE `aup` - 'privacy' => 'https://aai.egi.eu/privacy.html', // Privace URL. The key MUST BE `privacy` - ), - 'loader' => 'loader', // Loading Spinner to use. Two options are available. `loader` or `cmg_loader` -); -?> \ No newline at end of file +$config = [ + 'cookiePolicy' => [ + [ + 'type' => 'Session State', + 'provider' => 'aai.egi.eu', + 'name' => 'egi_proxy_authtoken, egi_google_proxy_authtoken, egi_google_proxy_authtoken,' + . ' egi_facebook_proxy_authtoken, egi_linkedin_proxy_authtoken, egi_orcid_proxy_authtoken', + 'thirdParty' => false, + 'category' => 'Session', + 'purpose' => 'Preserve user authentication token to prevent session fixation attacks' + ], + [ + 'type' => 'Session State', + 'provider' => 'aai.egi.eu', + 'name' => 'egi_proxy_sid, egi_google_proxy_sid, egi_google_proxy_sid, egi_facebook_proxy_sid,' + , ' egi_linkedin_proxy_sid, egi_orcid_proxy_sid', + 'thirdParty' => false, + 'category' => 'Session', + 'purpose' => 'Preserve user session ID to retrieve session information' + ], + [ + 'type' => 'Preferences', + 'provider' => 'aai.egi.eu', + 'name' => 'egi_poweridpdisco_lastidp', + 'thirdParty' => false, + 'category' => 'Persistent', + 'purpose' => 'Preserve preferred IdP selection for SimpleSAMLphp IdP discovery service' + ], + [ + 'type' => 'Preferences', + 'provider' => 'aai.egi.eu', + 'name' => 'egi_poweridpdisco_remember', + 'thirdParty' => false, + 'category' => 'Persistent', + 'purpose' => 'Preserve preference whether to remember IdP selection for SimpleSAMLphp IdP discovery service' + ], + [ + 'type' => 'Session State', + 'provider' => 'aai.egi.eu', + 'name' => 'egi_co_registry_sid', + 'thirdParty' => false, + 'category' => 'Session', + 'purpose' => 'Preserve user session ID to retrieve session information' + ], + [ + 'type' => 'Preferences', + 'provider' => 'aai.egi.eu', + 'name' => 'egi_co_registry_tz', + 'thirdParty' => false, + 'category' => 'Persistent', + 'purpose' => 'Preserve preferred timezone selection for COmanage EGI Account Registry' + ], + [ + 'type' => 'Preferences', + 'provider' => 'aai.egi.eu', + 'name' => 'i18next', + 'thirdParty' => false, + 'category' => 'Session', + 'purpose' => 'Preserve preferred language for EGI AAI OpenID Connect Provider' + ], + [ + 'type' => 'Session State', + 'provider' => 'aai.egi.eu', + 'name' => 'JSESSIONID', + 'thirdParty' => false, + 'category' => 'Session', + 'purpose' => 'Preserve user session ID to retrieve session information' + ], + ], + 'views' => [ + // Terms and Conditions URL. The key MUST BE `aup` + 'aup' => 'https://aai.egi.eu/aup/check-in.html', + // Privace URL. The key MUST BE `privacy` + 'privacy' => 'https://aai.egi.eu/privacy.html', + ], + // Loading Spinner to use. Two options are available `loader` or `cmg_loader` + 'loader' => 'loader', + 'ribbon_text' => '', +]; diff --git a/dictionaries/discopower.definition.json b/dictionaries/discopower.definition.json index 14ea6a8d52358d43ec7d941a85ff65e61db7388f..f78a6b768870340209dd5146f89c6b8b2d3c075e 100644 --- a/dictionaries/discopower.definition.json +++ b/dictionaries/discopower.definition.json @@ -49,7 +49,8 @@ }, "login_help_option3_text": { "en": "Contact our <a href='mailto:checkin-support@mailman.egi.eu'>support</a>" + }, + "login_with": { + "en": "Log in with" } - - } diff --git a/templates/confirmemail.tpl.php b/templates/confirmemail.tpl.php index 60c442cebed63f08628f2ab278ed5d5ef5da434d..059221ac7dcb6d94756ac8a3ecbbc07070ee32cc 100644 --- a/templates/confirmemail.tpl.php +++ b/templates/confirmemail.tpl.php @@ -5,14 +5,14 @@ $this->includeAtTemplateBase('includes/header.php'); <div class="body-container" id="content"> <div class="message-container"> - <span class="head-title"> - <img class="email-gif" src="resources/icons/email.gif"> - <h2><span class="title-msg"><?php echo $this->t('{themeegi:default:message_title}'); ?></span></h2> - </span> - <div class="message"><?php echo $this->t('{themeegi:default:message_bd}'); ?></div> - <div class="subtitle"><?php echo $this->t('{themeegi:default:message_sub}'); ?></div> + <span class="head-title"> + <img class="email-gif" src="resources/icons/email.gif"> + <h2><span class="title-msg"><?= $this->t('{themeegi:default:message_title}') ?></span></h2> + </span> + <div class="message"><?= $this->t('{themeegi:default:message_bd}') ?></div> + <div class="subtitle"><?= $this->t('{themeegi:default:message_sub}') ?></div> </div> </div> <?php -$this->includeAtTemplateBase('includes/footer.php'); ?> +$this->includeAtTemplateBase('includes/footer.php'); diff --git a/templates/policy.tpl.php b/templates/policy.tpl.php index 7db5094d959da6ec8e1fdcd286c17ea83aa2be30..89b2756423b8cb3de357bfaa8483dfaf3447f623 100644 --- a/templates/policy.tpl.php +++ b/templates/policy.tpl.php @@ -1,63 +1,144 @@ <?php -$themeConfig = SimpleSAML_Configuration::getConfig('module_themeegi.php'); +$themeConfig = SimpleSAML\Configuration::getConfig('module_themeegi.php'); $cookies = $themeConfig->getValue('cookiePolicy'); -$this->data['header'] = (strpos($this->t('{themeegi:policy:page_title}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:page_title}') : ''); +$this->data['header'] = ( + strpos($this->t('{themeegi:policy:page_title}'), 'not translated') === false + ? $this->t('{themeegi:policy:page_title}') + : '' +); $this->includeAtTemplateBase('includes/header.php'); ?> -<h2><?php echo($this->data['header']); ?></h2> +<h2><?= $this->data['header'] ?></h2> <div> - <ol> - <li><?php echo(strpos($this->t('{themeegi:policy:purpose_head}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:purpose_head}') : ''); ?></li> - </ol> - <?php echo(strpos($this->t('{themeegi:policy:purpose_body}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:purpose_body}') : ''); ?> - - <ol start="2"> - <li><?php echo(strpos($this->t('{themeegi:policy:cookie_list_head}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:cookie_list_head}') : ''); ?></li> - </ol> - <?php echo(strpos($this->t('{themeegi:policy:cookie_list_body}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:cookie_list_body}') : ''); ?> - - <table class="table"> - <thead> - <tr> - <th><?php echo(strpos($this->t('{themeegi:policy:table_type}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:table_type}') : ''); ?></th> - <th><?php echo(strpos($this->t('{themeegi:policy:table_provider}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:table_provider}') : ''); ?></th> - <th><?php echo(strpos($this->t('{themeegi:policy:table_name}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:table_name}') : ''); ?></th> - <th><?php echo(strpos($this->t('{themeegi:policy:table_third_party}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:table_third_party}') : ''); ?></th> - <th><?php echo(strpos($this->t('{themeegi:policy:table_category}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:table_category}') : ''); ?></th> - <th><?php echo(strpos($this->t('{themeegi:policy:table_purpose}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:table_purpose}') : ''); ?></th> - </tr> - </thead> - <tbody> - <?php - foreach($cookies as $row) { + <ol> + <li> + <?= + strpos($this->t('{themeegi:policy:purpose_head}'), 'not translated') === false + ? $this->t('{themeegi:policy:purpose_head}') + : '' + ?> + </li> + </ol> + <?= + strpos($this->t('{themeegi:policy:purpose_body}'), 'not translated') === false + ? $this->t('{themeegi:policy:purpose_body}') + : '' ?> - <tr> - <td><?php echo(isset($row['type']) ? $row['type'] : '');?></td> - <td><u><?php echo(isset($row['provider']) ? $row['provider'] : '');?></u></td> - <td><?php echo(isset($row['name']) ? $row['name'] : '');?></td> - <td><?php echo(isset($row['thirdParty']) && $row['thirdParty'] ? 'Yes' : 'No' );?></td> - <td><?php echo(isset($row['category']) ? $row['category'] : '');?></td> - <td><?php echo(isset($row['purpose']) ? $row['purpose'] : '');?></td> - </tr> - <?php - } + + <ol start="2"> + <li> + <?= + strpos($this->t('{themeegi:policy:cookie_list_head}'), 'not translated') === false + ? $this->t('{themeegi:policy:cookie_list_head}') + : '' + ?> + </li> + </ol> + <?= + strpos($this->t('{themeegi:policy:cookie_list_body}'), 'not translated') === false + ? $this->t('{themeegi:policy:cookie_list_body}') + : '' + ?> + + <table class="table"> + <thead> + <tr> + <th> + <?= + strpos($this->t('{themeegi:policy:table_type}'), 'not translated') === false + ? $this->t('{themeegi:policy:table_type}') + : '' + ?> + </th> + <th> + <?= + strpos($this->t('{themeegi:policy:table_provider}'), 'not translated') === false + ? $this->t('{themeegi:policy:table_provider}') + : '' + ?> + </th> + <th> + <?= + strpos($this->t('{themeegi:policy:table_name}'), 'not translated') === false + ? $this->t('{themeegi:policy:table_name}') + : '' + ?> + </th> + <th> + <?= + strpos($this->t('{themeegi:policy:table_third_party}'), 'not translated') === false + ? $this->t('{themeegi:policy:table_third_party}') + : '' + ?> + </th> + <th> + <?= + strpos($this->t('{themeegi:policy:table_category}'), 'not translated') === false + ? $this->t('{themeegi:policy:table_category}') + : '' + ?> + </th> + <th> + <?= + strpos($this->t('{themeegi:policy:table_purpose}'), 'not translated') === false + ? $this->t('{themeegi:policy:table_purpose}') + : '' + ?> + </th> + </tr> + </thead> + <tbody> + <?php foreach ($cookies as $row) : ?> + <tr> + <td><?= isset($row['type']) ? $row['type'] : '' ?></td> + <td><u><?= isset($row['provider']) ? $row['provider'] : '' ?></u></td> + <td><?= isset($row['name']) ? $row['name'] : '' ?></td> + <td><?= isset($row['thirdParty']) && $row['thirdParty'] ? 'Yes' : 'No' ?></td> + <td><?= isset($row['category']) ? $row['category'] : '' ?></td> + <td><?= isset($row['purpose']) ? $row['purpose'] : '' ?></td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + + <ol start="3"> + <li> + <?= + strpos($this->t('{themeegi:policy:endurance_head}'), 'not translated') === false + ? $this->t('{themeegi:policy:endurance_head}') + : '' + ?> + </li> + </ol> + <?= + strpos($this->t('{themeegi:policy:endurance_body}'), 'not translated') === false + ? $this->t('{themeegi:policy:endurance_body}') + : '' + ?> + + <ol start="4"> + <li> + <?= + strpos($this->t('{themeegi:policy:disable_cookie_head}'), 'not translated') === false + ? $this->t('{themeegi:policy:disable_cookie_head}') + : '' + ?> + </li> + </ol> + <?= + strpos($this->t('{themeegi:policy:disable_cookie_body}'), 'not translated') === false + ? $this->t('{themeegi:policy:disable_cookie_body}') + : '' + ?> + <?= + strpos($this->t('{themeegi:policy:note}'), 'not translated') === false + ? $this->t('{themeegi:policy:note}') + : '' ?> - </tbody> - </table> - - <ol start="3"> - <li><?php echo(strpos($this->t('{themeegi:policy:endurance_head}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:endurance_head}') : ''); ?></li> - </ol> - <?php echo(strpos($this->t('{themeegi:policy:endurance_body}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:endurance_body}') : ''); ?> - - <ol start="4"> - <li><?php echo(strpos($this->t('{themeegi:policy:disable_cookie_head}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:disable_cookie_head}') : ''); ?></li> - </ol> - <?php echo(strpos($this->t('{themeegi:policy:disable_cookie_body}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:disable_cookie_body}') : ''); ?> - <?php echo(strpos($this->t('{themeegi:policy:note}'), 'not translated') === FALSE ? $this->t('{themeegi:policy:note}') : ''); ?> </div> -<?php $this->includeAtTemplateBase('includes/footer.php'); ?> +<?php +$this->includeAtTemplateBase('includes/footer.php'); diff --git a/templates/views.tpl.php b/templates/views.tpl.php index 0f45599662268daebaf604d487877bf4dcc9f085..f8d4ac40a65dcab5313cf4797e9530296e48c77f 100644 --- a/templates/views.tpl.php +++ b/templates/views.tpl.php @@ -1,37 +1,35 @@ <?php // Get Configuration -$themeConfig = SimpleSAML_Configuration::getConfig('module_themeegi.php'); +$themeConfig = SimpleSAML\Configuration::getConfig('module_themeegi.php'); $views = $themeConfig->getValue('views'); // Content $body = $this->t('{themeegi:default:no_content}'); // Get request parameter and load Content -if(!empty($_REQUEST['id']) && !empty($views)) { - $ld_view = $views[$_REQUEST['id']]; - $contextOptions = array( - 'ssl' => array( +if (!empty($_REQUEST['id']) && !empty($views)) { + $ldView = $views[$_REQUEST['id']]; + $contextOptions = [ + 'ssl' => [ 'verify_peer' => false, - ), - 'http' => array( + ], + 'http' => [ 'timeout' => 2, // 2 Seconds - ), - ); + ], + ]; $sslContext = stream_context_create($contextOptions); - $loaded_content = file_get_contents($ld_view, NULL, $sslContext); - if(!empty($loaded_content)) { - $body = $loaded_content; + $loadedContent = file_get_contents($ldView, null, $sslContext); + if (!empty($loadedContent)) { + $body = $loadedContent; } } // Load Head and Dependencies -$this->data['jquery'] = array('core' => TRUE, 'ui' => TRUE, 'css' => TRUE); +$this->data['jquery'] = ['core' => true, 'ui' => true, 'css' => true]; // Load Header $this->includeAtTemplateBase('includes/header.php'); // Load Body -print $body; +echo $body; // Load Footer $this->includeAtTemplateBase('includes/footer.php'); - -?> \ No newline at end of file diff --git a/themes/ssp/attrauthcomanage/exception.tpl.php b/themes/ssp/attrauthcomanage/exception.tpl.php index 49503b2ea03a34037aa9795d23b67d6fe3c89178..abad713d61b29cb8ab7daaa10bf83f1b7ae15439 100644 --- a/themes/ssp/attrauthcomanage/exception.tpl.php +++ b/themes/ssp/attrauthcomanage/exception.tpl.php @@ -3,13 +3,15 @@ $this->data['header'] = $this->t('{themeegi:attrauthcomanage:exception_header}') $this->includeAtTemplateBase('includes/header.php'); ?> -<h1><?php echo $this->t('{themeegi:attrauthcomanage:exception_title}');?></h1> +<h1><?= $this->t('{themeegi:attrauthcomanage:exception_title}') ?></h1> -<?php echo $this->t('{themeegi:attrauthcomanage:exception_description}');?> +<?= $this->t('{themeegi:attrauthcomanage:exception_description}') ?> <pre> <?php - $tag = preg_replace('/attrauthcomanage:/','themeegi:', $this->data['e'], 1); - echo (!empty($this->getTag('{'.$tag.'}')) ? $this->t('{'.$tag.'}', $this->data['parameters']) : $this->data['e']); + $tag = preg_replace('/attrauthcomanage:/', 'themeegi:', $this->data['e'], 1); + echo !empty($this->getTag('{' . $tag . '}')) + ? $this->t('{' . $tag . '}', $this->data['parameters']) + : $this->data['e']; ?> </pre> diff --git a/themes/ssp/authX509/X509error.php b/themes/ssp/authX509/X509error.php index b1e2f686b5b53a7330ace1da688813b009e6ee2a..8cbc5f3b992afe000346c50ffd48e7bb75ab55e8 100644 --- a/themes/ssp/authX509/X509error.php +++ b/themes/ssp/authX509/X509error.php @@ -5,37 +5,37 @@ $this->includeAtTemplateBase('includes/header.php'); ?> -<?php -if ($this->data['errorcode'] !== NULL) { -?> - <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px" alt="" /> - <h2><?php echo $this->t('{login:error_header}'); ?></h2> - <p><b><?php echo $this->t('{errors:title_' . $this->data['errorcode'] . '}'); ?></b></p> - <p><?php echo $this->t('{errors:descr_' . $this->data['errorcode'] . '}'); ?></p> - </div> -<?php -} -?> - <h2 style="break: both"><?php echo $this->t('{authX509:X509error:certificate_header}'); ?></h2> - - <p><?php echo $this->t('{authX509:X509error:certificate_text}'); ?></p> - - <a href="<?php echo htmlspecialchars(\SimpleSAML\Utils\HTTP::getSelfURL()); ?>"> - <?php echo $this->t('{login:login_button}'); ?> - </a> +<?php if ($this->data['errorcode'] !== null) : ?> + <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> + <img + src="/<?= $this->data['baseurlpath'] ?>resources/icons/experience/gtk-dialog-error.48x48.png" + class="float-l" + style="margin: 15px" + alt="" + /> + <h2><?= $this->t('{login:error_header}') ?></h2> + <p><b><?= $this->t('{errors:title_' . $this->data['errorcode'] . '}') ?></b></p> + <p><?= $this->t('{errors:descr_' . $this->data['errorcode'] . '}') ?></p> + </div> +<?php endif; ?> +<h2 style="break: both"><?= $this->t('{authX509:X509error:certificate_header}') ?></h2> + +<p><?= $this->t('{authX509:X509error:certificate_text}') ?></p> + +<a href="<?= htmlspecialchars(\SimpleSAML\Utils\HTTP::getSelfURL()) ?>"> + <?= $this->t('{login:login_button}') ?> +</a> <?php -if(!empty($this->data['links'])) { - echo '<ul class="links list-unstyled" style="margin-top: 2em">'; - foreach($this->data['links'] AS $l) { - echo '<li><a href="' . htmlspecialchars($l['href']) . '">' . htmlspecialchars($this->t($l['text'])) . '</a></li>'; - } - echo '</ul>'; +if (!empty($this->data['links'])) { + echo '<ul class="links list-unstyled" style="margin-top: 2em">'; + foreach ($this->data['links'] as $l) { + echo '<li><a href="' . htmlspecialchars($l['href']) . '">' + . htmlspecialchars($this->t($l['text'])) + . '</a></li>'; + } + echo '</ul>'; } - - - $this->includeAtTemplateBase('includes/footer.php'); diff --git a/themes/ssp/authorize/authorize_403.php b/themes/ssp/authorize/authorize_403.php index 08f8cadfa22fd1aca7db0128d537a840f109cb77..f0a811fb97d0e95317e02fe3e7987b43e01717c8 100644 --- a/themes/ssp/authorize/authorize_403.php +++ b/themes/ssp/authorize/authorize_403.php @@ -1,4 +1,5 @@ <?php + /** * Template which is shown when there is only a short interval since the user was last authenticated. * @@ -9,20 +10,16 @@ * @package SimpleSAMLphp */ - $this->data['403_header'] = $this->t('{authorize:Authorize:403_header}'); $this->data['403_text'] = $this->t('{authorize:Authorize:403_text}'); $this->includeAtTemplateBase('includes/header.php'); ?> -<h2><?php echo $this->data['403_header']; ?></h2> -<p><?php echo $this->data['403_text']; ?></p> -<?php -if (isset($this->data['LogoutURL'])) { -?> -<p><a href="<?php echo htmlspecialchars($this->data['LogoutURL']); ?>"><?php echo $this->t('{status:logout}'); ?></a></p> -<?php -} -?> +<h2><?= $this->data['403_header'] ?></h2> +<p><?= $this->data['403_text'] ?></p> +<?php if (isset($this->data['LogoutURL'])) : ?> + <p><a href="<?= htmlspecialchars($this->data['LogoutURL']) ?>"><?= $this->t('{status:logout}') ?></a></p> +<?php endif; ?> + <?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/themes/ssp/consent/consentform.php b/themes/ssp/consent/consentform.php index 0137493b8c99accba9ce48626f06d909eee26b1a..8eefa1269c6f958ca089b8d0bf332bf0746261a1 100644 --- a/themes/ssp/consent/consentform.php +++ b/themes/ssp/consent/consentform.php @@ -1,216 +1,211 @@ <?php + // Get Configuration and set the loader -$themeConfig = SimpleSAML_Configuration::getConfig('module_themeegi.php'); +$themeConfig = SimpleSAML\Configuration::getConfig('module_themeegi.php'); $loader = $themeConfig->getValue('loader'); -if(!empty($loader)) { +if (!empty($loader)) { $this->includeAtTemplateBase('includes/' . $loader . '.php'); } /** * Template form for giving consent. * * Parameters: - * - 'srcMetadata': Metadata/configuration for the source. - * - 'dstMetadata': Metadata/configuration for the destination. * - 'yesTarget': Target URL for the yes-button. This URL will receive a POST request. - * - 'yesData': Parameters which should be included in the yes-request. * - 'noTarget': Target URL for the no-button. This URL will receive a GET request. - * - 'noData': Parameters which should be included in the no-request. - * - 'attributes': The attributes which are about to be released. - * - 'sppp': URL to the privacy policy of the destination, or FALSE. + * - 'sppp': URL to the privacy policy of the destination, or false. * * @package SimpleSAMLphp */ -assert('is_array($this->data["srcMetadata"])'); -assert('is_array($this->data["dstMetadata"])'); -assert('is_string($this->data["yesTarget"])'); -assert('is_array($this->data["yesData"])'); -assert('is_string($this->data["noTarget"])'); -assert('is_array($this->data["noData"])'); -assert('is_array($this->data["attributes"])'); -assert('is_array($this->data["hiddenAttributes"])'); -assert('$this->data["sppp"] === false || is_string($this->data["sppp"])'); + +assert(is_string($this->data['yesTarget'])); +assert(is_string($this->data['noTarget'])); +assert($this->data['sppp'] === false || is_string($this->data['sppp'])); + +// Needed for present_attributes_ssp() +$globalConfig = \SimpleSAML\Configuration::getInstance(); +$t = new \SimpleSAML\XHTML\Template($globalConfig, 'consent:consentform.php'); // Parse parameters -if (array_key_exists('name', $this->data['srcMetadata'])) { - $srcName = $this->data['srcMetadata']['name']; -} elseif (array_key_exists('OrganizationDisplayName', $this->data['srcMetadata'])) { - $srcName = $this->data['srcMetadata']['OrganizationDisplayName']; -} else { - $srcName = $this->data['srcMetadata']['entityid']; -} +$dstName = $this->data['dstName']; +$srcName = $this->data['srcName']; -if (is_array($srcName)) { - $srcName = $this->t($srcName); -} +$id = $_REQUEST['StateId']; +$state = \SimpleSAML\Auth\State::loadState($id, 'consent:request'); -if (array_key_exists('name', $this->data['dstMetadata'])) { - $dstName = $this->data['dstMetadata']['name']; -} elseif (array_key_exists('OrganizationDisplayName', $this->data['dstMetadata'])) { - $dstName = $this->data['dstMetadata']['OrganizationDisplayName']; +if (array_key_exists('consent:hiddenAttributes', $state)) { + $t->data['hiddenAttributes'] = $state['consent:hiddenAttributes']; } else { - $dstName = $this->data['dstMetadata']['entityid']; -} - -if (is_array($dstName)) { - $dstName = $this->t($dstName); + $t->data['hiddenAttributes'] = []; } -$srcName = htmlspecialchars($srcName); -$dstName = htmlspecialchars($dstName); - $attributes = $this->data['attributes']; $this->data['header'] = $this->t('{consent:consent:consent_header}'); -$this->data['jquery'] = array('core' => TRUE); +$this->data['jquery'] = ['core' => true]; $this->includeAtTemplateBase('includes/header.php'); ?> - -<?php - -/** - * Recursive attribute array listing function - * - * @param SimpleSAML_XHTML_Template $t Template object - * @param array $attributes Attributes to be presented - * @param string $nameParent Name of parent element - * - * @return string HTML representation of the attributes - */ -function present_attributes($t, $attributes, $nameParent) -{ - $alternate = array('ssp-table--tr__odd', 'ssp-table--tr__even'); - $i = 0; - $summary = 'summary="' . $t->t('{consent:consent:table_summary}') . '"'; - - if (strlen($nameParent) > 0) { - $parentStr = strtolower($nameParent) . '_'; - $str = '<div class="ssp-attrs--container"><table class="table" ' . $summary . '>'; - } else { - $parentStr = ''; - $str = '<div class="ssp-attrs--container js-spread"><table id="table_with_attributes" class="table" '. $summary .'>'; - } - - foreach ($attributes as $name => $value) { - $nameraw = $name; - $name = $t->getAttributeTranslation($parentStr . $nameraw); - - if (preg_match('/^child_/', $nameraw)) { - // insert child table - $parentName = preg_replace('/^child_/', '', $nameraw); - foreach ($value as $child) { - $str .= "\n" . '<tr class="odd ssp--table--tr__odd"><td>' . - present_attributes($t, $child, $parentName) . '</td></tr>'; +<h2 class="text-center"><?= $this->data['consent_accept'] ?></h2> +<div class="row js-spread"> + <div class="col-sm-12 ssp-content-group js-spread"> + + <?php + echo $this->data['attributes_html'] = present_attributes_ssp($t, $attributes, ''); + + /** + * Recursive attribute array listing function + * + * @param \SimpleSAML\XHTML\Template $t Template object + * @param array $attributes Attributes to be presented + * @param string $nameParent Name of parent element + * + * @return string HTML representation of the attributes + */ + function present_attributes_ssp($t, $attributes, $nameParent) + { + $translator = $t->getTranslator(); + + $alternate = ['ssp-table--tr__odd', 'ssp-table--tr__even']; + $i = 0; + $summary = 'summary="' . $translator->t('{consent:consent:table_summary}') . '"'; + + if (strlen($nameParent) > 0) { + $parentStr = strtolower($nameParent) . '_'; + $str = '<div class="ssp-attrs--container"><table class="table" ' . $summary . '>'; + } else { + $parentStr = ''; + $str = '<div class="ssp-attrs--container js-spread"><table id="table_with_attributes" class="table" ' + . $summary . '>'; } - } else { - // insert values directly - $str .= "\n" . '<tr class="' . $alternate[($i++ % 2)] . - '"><td><div class="attrname ssp-table--attrname">' . htmlspecialchars($name) . '</div>'; + foreach ($attributes as $name => $value) { + $nameRaw = $name; + $name = $translator->getAttributeTranslation($parentStr . $nameRaw); - $isHidden = in_array($nameraw, $t->data['hiddenAttributes'], true); - if ($isHidden) { - $hiddenId = SimpleSAML\Utils\Random::generateID(); + if (preg_match('/^child_/', $nameRaw)) { + // insert child table + $parentName = preg_replace('/^child_/', '', $nameRaw); + foreach ($value as $child) { + $str .= "\n" . '<tr class="odd ssp--table--tr__odd"><td>' . + present_attributes_ssp($t, $child, $parentName) . '</td></tr>'; + } + } else { + // insert values directly - $str .= '<div class="attrvalue ssp-table--attrvalue" style="display: none;" id="hidden_' . $hiddenId . '">'; - } else { - $str .= '<div class="attrvalue ssp-table--attrvalue">'; - } + $str .= "\n" . '<tr class="' . $alternate[($i++ % 2)] . + '"><td><div class="attrname ssp-table--attrname">' . htmlspecialchars($name) . '</div>'; - if (sizeof($value) > 1) { - // we hawe several values - $str .= '<ul class="list-unstyled ssp-table--attrvalue--list">'; - foreach ($value as $listitem) { - if ($nameraw === 'jpegPhoto') { - $str .= '<li class="ssp-table--attrvalue--list--item"><img src="data:image/jpeg;base64,' . - htmlspecialchars($listitem) . - '" alt="User photo" /></li>'; + $isHidden = in_array($nameRaw, $t->data['hiddenAttributes'], true); + if ($isHidden) { + $hiddenId = \SimpleSAML\Utils\Random::generateID(); + $str .= '<div class="attrvalue ssp-table--attrvalue" style="display: none;" id="hidden_' + . $hiddenId . '">'; } else { - $str .= '<li class="ssp-table--attrvalue--list--item">' . htmlspecialchars($listitem) . '</li>'; + $str .= '<div class="attrvalue ssp-table--attrvalue">'; } - } - $str .= '</ul>'; - } elseif (isset($value[0])) { - // we hawe only one value - if ($nameraw === 'jpegPhoto') { - $str .= '<img src="data:image/jpeg;base64,' . - htmlspecialchars($value[0]) . - '" alt="User photo" />'; - } else { - $str .= htmlspecialchars($value[0]); - } - } // end of if multivalue - $str .= '</div>'; - - if ($isHidden) { - $str .= '<div class="attrvalue consent_showattribute" id="visible_' . $hiddenId . '">'; - $str .= '<a class="consent_showattributelink ssp-btn__show-more" href="javascript:SimpleSAML_show(\'hidden_' . $hiddenId; - $str .= '\'); SimpleSAML_hide(\'visible_' . $hiddenId . '\');"' - .' data-toggle="tooltip" data-placement="right" title="'. $t->t('{consent:consent:show_attribute}') .'">'; - $str .= '<span class="glyphicon glyphicon-eye-open ssp-show-more" aria-hidden="true"></span>'; - $str .= '</a>'; - $str .= '</div>'; - } - - $str .= '</td></tr>'; - } // end else: not child table - } // end foreach - $str .= isset($attributes)? '</table></div>':''; - return $str; -} - echo '<h2 class="text-center">' . - $this->t( - '{consent:consent:consent_accept}', - array( 'SPNAME' => $dstName, 'IDPNAME' => $srcName)). - '</h2> - <div class="row js-spread"> - <div class="col-sm-12 ssp-content-group js-spread">'; -?> + if (sizeof($value) > 1) { + // we have several values + $str .= '<ul class="list-unstyled ssp-table--attrvalue--list">'; + foreach ($value as $listItem) { + if ($nameRaw === 'jpegPhoto') { + $str .= '<li class="ssp-table--attrvalue--list--item">' + . '<img src="data:image/jpeg;base64,' + . htmlspecialchars($listItem) . '" alt="User photo" /></li>'; + } else { + $str .= '<li class="ssp-table--attrvalue--list--item">' + . htmlspecialchars($listItem) . '</li>'; + } + } + $str .= '</ul>'; + } elseif (isset($value[0])) { + // we have only one value + if ($nameRaw === 'jpegPhoto') { + $str .= '<img src="data:image/jpeg;base64,' . + htmlspecialchars($value[0]) . '" alt="User photo" />'; + } else { + $str .= htmlspecialchars($value[0]); + } + } // end of if multivalue + $str .= '</div>'; + + if ($isHidden) { + $str .= '<div class="attrvalue consent_showattribute" id="visible_' . $hiddenId . '">'; + $str .= '<a class="consent_showattributelink ssp-btn__show-more"' + . ' href="javascript:SimpleSAML_show(\'hidden_' . $hiddenId; + $str .= '\'); SimpleSAML_hide(\'visible_' . $hiddenId . '\');"' + . ' data-toggle="tooltip" data-placement="right" title="' + . $t->t('{consent:consent:show_attribute}') . '">'; + $str .= '<span class="glyphicon glyphicon-eye-open ssp-show-more" aria-hidden="true"></span>'; + $str .= '</a>'; + $str .= '</div>'; + } -<?php -echo present_attributes($this, $attributes, ''); -?> -<div class="ssp-btns-container"> -<form style="display: inline-block" - action="<?php echo htmlspecialchars($this->data['yesTarget']); ?>"> -<p class"ssp-btns-container--checkbox> + $str .= '</td></tr>'; + } // end else: not child table + } // end foreach + $str .= isset($attributes) ? '</table></div>' : ''; + return $str; + } + ?> + + + <?php + if (isset($this->data['consent_purpose'])) { + echo '<p>' . $this->data['consent_purpose'] . '</p>'; + } + ?> + + <div class="ssp-btns-container"> + <form + id="consent_yes" + action="<?= htmlspecialchars($this->data['yesTarget']) ?>" + style="display:inline-block;" + > + <p class="ssp-btns-container--checkbox"> + <?php + if ($this->data['usestorage']) { + $checked = ($this->data['checked'] ? 'checked="checked"' : ''); + echo '<input type="checkbox" name="saveconsent" ' . $checked . + ' value="1" /> ' . $this->t('{consent:consent:remember}'); + } // Embed hidden fields... + ?> + <input type="hidden" name="StateId" value="<?= htmlspecialchars($this->data['stateId']) ?>" /> + </p> + <button + type="submit" + name="yes" + class="ssp-btn btn ssp-btn__action ssp-btns-container--btn__left text-uppercase" + id="yesbutton" + > + <?= htmlspecialchars($this->t('{consent:consent:yes}')) ?> + </button> + </form> + + <form + id="consent_no" + action="<?= htmlspecialchars($this->data['noTarget']) ?>" + style="display:inline-block;" + > + <input type="hidden" name="StateId" value="<?= htmlspecialchars($this->data['stateId']) ?>" /> + <button + type="submit" + class="ssp-btn ssp-btn__secondary btn ssp-btns-container--btn__right text-uppercase" + name="no" + id="nobutton" + > + <?= htmlspecialchars($this->t('{consent:consent:no}')) ?> + </button> + </form> + </div> <!-- /ssp-btns-container --> + </div> <!-- /ssp-content-group --> +</div> <!-- /row --> <?php -if ($this->data['usestorage']) { - $checked = ($this->data['checked'] ? 'checked="checked"' : ''); - echo '<input type="checkbox" name="saveconsent" ' . $checked . - ' value="1" /> ' . $this->t('{consent:consent:remember}'); +if ($this->data['sppp'] !== false) { + echo "<p>" . htmlspecialchars($this->t('{consent:consent:consent_privacypolicy}')) . " "; + echo '<a target="_blank" href="' . htmlspecialchars($this->data['sppp']) . '">' . $dstName . "</a>"; + echo "</p>"; } -// Embed hidden fields... -foreach ($this->data['yesData'] as $name => $value) { - echo '<input type="hidden" name="' . htmlspecialchars($name) . - '" value="' . htmlspecialchars($value) . '" />'; -} -?> - </p> - <button type="submit" name="yes" class=" ssp-btn btn ssp-btn__action ssp-btns-container--btn__left text-uppercase" id="yesbutton"> - <?php echo htmlspecialchars($this->t('{consent:consent:yes}')) ?> - </button> -</form> - -<form style="display: inline-block;" action="<?php echo htmlspecialchars($this->data['noTarget']); ?>" - method="get"> - -<?php -foreach ($this->data['noData'] as $name => $value) { - echo('<input type="hidden" name="' . htmlspecialchars($name) . - '" value="' . htmlspecialchars($value) . '" />'); -} -?> - <button type="submit" class="ssp-btn ssp-btn__secondary btn ssp-btns-container--btn__right text-uppercase" name="no" id="nobutton"> - <?php echo htmlspecialchars($this->t('{consent:consent:no}')) ?> - </button> -</form> -</div> <!-- /ssp-btns-container --> -</div> <!-- /ssp-content-group --> -</div> <!-- /row --> -<?php $this->includeAtTemplateBase('includes/footer.php'); -?> diff --git a/themes/ssp/consent/logout_completed.php b/themes/ssp/consent/logout_completed.php index 978931c2bdf3aa8231a27cd824d2fec3b7ce9662..e3df5b7f5ce1195e341dd603640edb28387d6c61 100644 --- a/themes/ssp/consent/logout_completed.php +++ b/themes/ssp/consent/logout_completed.php @@ -1,9 +1,10 @@ <?php $this->data['header'] = $this->t('{logout:title}'); +$this->data['jquery'] = ['core' => true]; $this->includeAtTemplateBase('includes/header.php'); -echo('<h2>' . $this->data['header'] . '</h2>'); -echo('<p>' . $this->t('{logout:logged_out_text}') . '</p>'); +echo ('<h2>' . $this->data['header'] . '</h2>'); +echo ('<p>' . $this->t('{logout:logged_out_text}') . '</p>'); $this->includeAtTemplateBase('includes/footer.php'); diff --git a/themes/ssp/consent/noconsent.php b/themes/ssp/consent/noconsent.php index d4bc8fa8bf986e8d91ed6547c7a1afcc6ad13dcf..f99445f14a13b48fee147b1276163a3c6327df9e 100644 --- a/themes/ssp/consent/noconsent.php +++ b/themes/ssp/consent/noconsent.php @@ -1,38 +1,34 @@ <?php -if (array_key_exists('name', $this->data['dstMetadata'])) { - $dstName = $this->data['dstMetadata']['name']; -} elseif (array_key_exists('OrganizationDisplayName', $this->data['dstMetadata'])) { - $dstName = $this->data['dstMetadata']['OrganizationDisplayName']; -} else { - $dstName = $this->data['dstMetadata']['entityid']; -} -if (is_array($dstName)) { - $dstName = $this->t($dstName); -} -$dstName = htmlspecialchars($dstName); - - -$this->data['header'] = $this->t('{consent:consent:noconsent_title}');; +$this->data['header'] = $this->t('{consent:consent:noconsent_title}'); +$this->data['jquery'] = ['core' => true]; $this->includeAtTemplateBase('includes/header.php'); echo '<h3>' . $this->data['header'] . '</h3>'; -echo '<p>' . $this->t('{consent:consent:noconsent_text}', array('SPNAME' => $dstName)) . '</p>'; +echo '<p>' . $this->data['noconsent_text'] . '</p>'; echo '<div class="ssp-btns-container">'; if ($this->data['resumeFrom']) { - echo('<a href="' . htmlspecialchars($this->data['resumeFrom']) . '" class="ssp-btn btn ssp-btn__action ssp-btns-container--btn__left text-uppercase">'); - echo($this->t('{consent:consent:noconsent_return}')); - echo('</a>'); + echo ( + '<a href="' . htmlspecialchars($this->data['resumeFrom']) + . '" class="ssp-btn btn ssp-btn__action ssp-btns-container--btn__left text-uppercase">' + . $this->t('{consent:consent:noconsent_return}') + . '</a>' + ); } if ($this->data['aboutService']) { - echo('<a href="' . htmlspecialchars($this->data['aboutService']) . '" class="ssp-btn btn text-uppercase">'); - echo($this->t('{consent:consent:noconsent_goto_about}')); - echo('</a>'); + echo ('<a href="' . htmlspecialchars($this->data['aboutService']) . '" class="ssp-btn btn text-uppercase">'); + echo ($this->t('{consent:consent:noconsent_goto_about}')); + echo ('</a>'); } -echo('<a href="' . htmlspecialchars($this->data['logoutLink']) . '" class="ssp-btn btn ssp-btn__warning text-uppercase ssp-btns-container--btn__right">' . $this->t('{consent:consent:abort}', array('SPNAME' => $dstName)) . '</a>'); + +echo ( + '<a href="' . htmlspecialchars($this->data['logoutLink']) + . '" class="ssp-btn btn ssp-btn__warning text-uppercase ssp-btns-container--btn__right">' + . $this->data['noconsent_abort'] . '</a>' +); echo '</div>'; //ssp-btns-container $this->includeAtTemplateBase('includes/footer.php'); diff --git a/themes/ssp/core/no_cookie.tpl.php b/themes/ssp/core/no_cookie.tpl.php index 3836fa9a817b2e0aa0aecb1ce6f69cb8ba71bdd5..6dc24a42b6636671d3e0fde5dc7268875dfbfe16 100644 --- a/themes/ssp/core/no_cookie.tpl.php +++ b/themes/ssp/core/no_cookie.tpl.php @@ -9,14 +9,15 @@ $retry = htmlspecialchars($this->t('{core:no_cookie:retry}')); $this->data['header'] = $header; $this->includeAtTemplateBase('includes/header.php'); +?> -echo('<h2>' . $header . '</h2>'); -echo('<p>' . $description . '</p>'); +<h2><?= $header ?></h2> +<p><?= $description ?></p> -if ($retryURL !== NULL) { - echo('<ul class="list-unstyled">'); - echo('<li><a href="' . htmlspecialchars($retryURL) . '" id="retry">' . $retry . '</a></li>'); - echo('</ul>'); -} +<?php if ($retryURL !== null) : ?> + <ul class="list-unstyled"> + <li><a href="<?= htmlspecialchars($retryURL) ?>" id="retry"><?= $retry ?></a></li> + </ul> +<?php endif; $this->includeAtTemplateBase('includes/footer.php'); diff --git a/themes/ssp/core/no_metadata.tpl.php b/themes/ssp/core/no_metadata.tpl.php index dd383997e58eec55b4b557fa562f1f7b6a1d0647..8215f6c4be5839bb26c12f356605777ae8f7c87b 100644 --- a/themes/ssp/core/no_metadata.tpl.php +++ b/themes/ssp/core/no_metadata.tpl.php @@ -1,9 +1,6 @@ -<?php - -echo('<p>' . $this->t('{core:no_metadata:config_problem}') . '</p>'); - -echo('<ul class="list-unstyled">'); -echo('<li>' . $this->t('{core:no_metadata:suggestion_user_link}') . '</li>'); -echo('<li>' . $this->t('{core:no_metadata:suggestion_developer}') . '</li>'); -echo('</ul>'); +<p><?= $this->t('{core:no_metadata:config_problem}') ?></p> +<ul class="list-unstyled"> + <li><?= $this->t('{core:no_metadata:suggestion_user_link}') ?></li> + <li><?= $this->t('{core:no_metadata:suggestion_developer}') ?></li> +</ul> diff --git a/themes/ssp/core/no_state.tpl.php b/themes/ssp/core/no_state.tpl.php index f8ba2d622a14afe964bb37ddce51221190a3d57a..a8053e64d3d43653cfccfc803f3511c57033c07e 100644 --- a/themes/ssp/core/no_state.tpl.php +++ b/themes/ssp/core/no_state.tpl.php @@ -1,15 +1,14 @@ -<?php - -echo('<h2>' . $this->t('{core:no_state:suggestions}') . '</h2>'); -echo('<ul class="list-unstyled">'); -echo('<li>' . $this->t('{core:no_state:suggestion_goback}') . '</li>'); -echo('<li>' . $this->t('{core:no_state:suggestion_closebrowser}') . '</li>'); -echo('</ul>'); - -echo('<h3>' . $this->t('{core:no_state:causes}') . '</h3>'); -echo('<ul class="list-unstyled">'); -echo('<li>' . $this->t('{core:no_state:cause_backforward}') . '</li>'); -echo('<li>' . $this->t('{core:no_state:cause_openbrowser}') . '</li>'); -echo('<li>' . $this->t('{core:no_state:cause_nocookie}') . '</li>'); -echo('</ul>'); +<h2><?= $this->t('{core:no_state:suggestions}') ?></h2> +<ul class="list-nstyled"> + <li><?= $this->t('{core:no_state:suggestion_badlink}') ?></li> + <li><?= $this->t('{core:no_state:suggestion_goback}') ?></li> + <li><?= $this->t('{core:no_state:suggestion_closebrowser}') ?></li> +</ul> +<h3><?= $this->t('{core:no_state:causes}') ?></h3> +<ul class="list-nstyled"> + <li><?= $this->t('{core:no_state:cause_badlink}') ?></li> + <li><?= $this->t('{core:no_state:cause_backforward}') ?></li> + <li><?= $this->t('{core:no_state:cause_openbrowser}') ?></li> + <li><?= $this->t('{core:no_state:cause_nocookie}') ?></li> +</ul> diff --git a/themes/ssp/default/error.php b/themes/ssp/default/error.php index 30e3303b14d528fe8b46e1304e56d2d1d26c30ac..bea3569c8466a03a2a530a8e9842ca83c02b4e2b 100644 --- a/themes/ssp/default/error.php +++ b/themes/ssp/default/error.php @@ -1,6 +1,6 @@ <?php $this->data['header'] = $this->t($this->data['dictTitle']); -$this->data['jquery'] = array('core' => TRUE); +$this->data['jquery'] = ['core' => true]; $this->data['head'] = <<<EOF <meta name="robots" content="noindex, nofollow" /> @@ -9,7 +9,7 @@ EOF; $this->includeAtTemplateBase('includes/header.php'); ?> - <h2><?php echo $this->t($this->data['dictTitle']); ?></h2> +<h2><?= $this->t($this->data['dictTitle']) ?></h2> <?php echo htmlspecialchars($this->t($this->data['dictDescr'], $this->data['parameters'])); @@ -18,61 +18,61 @@ if (isset($this->data['includeTemplate'])) { $this->includeAtTemplateBase($this->data['includeTemplate']); } ?> - <div class="trackidtext"> - <p><?php echo $this->t('report_trackid'); ?></p> - <div class="input-group"> - <input class="form-control" type="text" readonly id="trackid" value="<?php echo $this->data['error']['trackId']; ?>"> - <span class="input-group-btn" aria-hidden="true"> +<div class="trackidtext"> + <p><?= $this->t('report_trackid') ?></p> + <div class="input-group"> + <input class="form-control" type="text" readonly id="trackid" value="<?= $this->data['error']['trackId'] ?>"> + <span class="input-group-btn" aria-hidden="true"> <button data-clipboard-target="#trackid" id="btntrackid" class="btn btn-default ssp-btn--copy"> - <img src="/<?php echo $this->data['baseurlpath'].'resources/icons/clipboard.svg'; ?>" - alt="Copy to clipboard" /> + <img + src="/<?= $this->data['baseurlpath'] . 'resources/icons/clipboard.svg' ?>" + alt="Copy to clipboard" + /> </button> - </span> + </span> - </div> </div> +</div> <?php // print out exception only if the exception is available -if ($this->data['showerrors']) { -?> - <h2><?php echo $this->t('debuginfo_header'); ?></h2> - <p><?php echo $this->t('debuginfo_text'); ?></p> +if ($this->data['showerrors']) : ?> + <h2><?= $this->t('debuginfo_header') ?></h2> + <p><?= $this->t('debuginfo_text') ?></p> <div style="border: 1px solid #eee; padding: 1em; font-size: x-small"> - <p style="margin: 1px"><?php echo htmlspecialchars($this->data['error']['exceptionMsg']); ?></p> - <pre style="padding: 1em; font-family: monospace;"><?php - echo htmlspecialchars($this->data['error']['exceptionTrace']); ?></pre> + <p style="margin: 1px"><?= htmlspecialchars($this->data['error']['exceptionMsg']) ?></p> + <pre style="padding: 1em; font-family: monospace;"> + <?= htmlspecialchars($this->data['error']['exceptionTrace']) ?> + </pre> </div> -<?php -} +<?php endif; /* Add error report submit section if we have a valid technical contact. 'errorreportaddress' will only be set if * the technical contact email address has been set. */ -if (isset($this->data['errorReportAddress'])) { -?> - <h2><?php echo $this->t('report_header'); ?></h2> - <form action="<?php echo htmlspecialchars($this->data['errorReportAddress']); ?>" method="post"> - <p><?php echo $this->t('report_text'); ?></p> - <p><?php echo $this->t('report_email'); ?> - <input type="text" size="25" name="email" value="<?php echo htmlspecialchars($this->data['email']); ?>" /> +if (isset($this->data['errorReportAddress'])) : ?> + <h2><?= $this->t('report_header') ?></h2> + <form action="<?= htmlspecialchars($this->data['errorReportAddress']) ?>" method="post"> + <p><?= $this->t('report_text') ?></p> + <p><?= $this->t('report_email') ?> + <input type="text" size="25" name="email" value="<?= htmlspecialchars($this->data['email']) ?>" /> </p> <p> - <textarea class="metadatabox" name="text" rows="6" cols="50" style="width: 100%; padding: 0.5em;"><?php - echo $this->t('report_explain'); ?></textarea> + <textarea class="metadatabox" name="text" rows="6" cols="50" style="width: 100%; padding: 0.5em;"> + <?= $this->t('report_explain') ?> + </textarea> </p> <p> - <input type="hidden" name="reportId" value="<?php echo $this->data['error']['reportId']; ?>"/> - <button type="submit" name="send" class="btn"><?php echo $this->t('report_submit'); ?></button> + <input type="hidden" name="reportId" value="<?= $this->data['error']['reportId'] ?>"/> + <button type="submit" name="send" class="btn"><?= $this->t('report_submit') ?></button> </p> </form> - <?php -} -?> - <h2 style="clear: both"><?php echo $this->t('howto_header'); ?></h2> - <p><?php echo $this->t('howto_text'); ?></p> - <script type="text/javascript"> - var clipboard = new Clipboard('#btntrackid'); - </script> +<?php endif; ?> +<h2 style="clear: both"><?= $this->t('howto_header') ?></h2> +<p><?= $this->t('howto_text') ?></p> +<script type="text/javascript"> + var clipboard = new Clipboard('#btntrackid'); +</script> + <?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/themes/ssp/default/includes/footer.php b/themes/ssp/default/includes/footer.php index e0a16e8b9879e0db89d06e27dbbba50577486e32..c9f1442381d113e8c7f603a48c027eb07aa56e57 100644 --- a/themes/ssp/default/includes/footer.php +++ b/themes/ssp/default/includes/footer.php @@ -1,86 +1,124 @@ - <?php -if(!empty($this->data['htmlinject']['htmlContentPost'])) { - foreach($this->data['htmlinject']['htmlContentPost'] as $c) { - print $c; - } +if (!empty($this->data['htmlinject']['htmlContentPost'])) { + foreach ($this->data['htmlinject']['htmlContentPost'] as $c) { + echo $c; + } } ?> </div><!-- /container --> </div><!-- /ssp-container --> -<?php if(strpos($this->t('{themeegi:discopower:cookies_text}'), 'not translated') === false || strpos($this->t('{themeegi:discopower:cookies_accept_btn_text}'), 'not translated') === false): ?> - <!-- cookies popup --> - <div id="cookies"> - <div id="cookies-wrapper"> - <p> - <?php print $this->t('{themeegi:discopower:cookies_text}'); ?> - <?php if(strpos($this->t('{themeegi:discopower:cookies_link_text}'), 'not translated') === false): ?> - <a href="<?php print $this->t('{themeegi:discopower:cookies_link_url}'); ?>" target="_blank"><?php print $this->t('{themeegi:discopower:cookies_link_text}'); ?></a> - <?php endif; ?> - </p> - <a id="js-accept-cookies" class="cookies-ok" href="#"> - <?php print $this->t('{themeegi:discopower:cookies_accept_btn_text}'); ?> - </a> +<?php +if ( + strpos($this->t('{themeegi:discopower:cookies_text}'), 'not translated') === false + || strpos($this->t('{themeegi:discopower:cookies_accept_btn_text}'), 'not translated') === false +) : ?> + <!-- cookies popup --> + <div id="cookies"> + <div id="cookies-wrapper"> + <p> + <?= $this->t('{themeegi:discopower:cookies_text}') ?> + <?php + if (strpos($this->t('{themeegi:discopower:cookies_link_text}'), 'not translated') === false) : ?> + <a + href="<?= $this->t('{themeegi:discopower:cookies_link_url}') ?>" + target="_blank" + > + <?= $this->t('{themeegi:discopower:cookies_link_text}') ?> + </a> + <?php endif; ?> + </p> + <a id="js-accept-cookies" class="cookies-ok" href="#"> + <?= $this->t('{themeegi:discopower:cookies_accept_btn_text}') ?> + </a> + </div> </div> - </div> - <!-- /cookies popup --> + <!-- /cookies popup --> <?php endif; ?> <footer class="ssp-footer text-center"> - <div class="container-fluid ssp-footer--container container"> - <div class="row ssp-content-group--footer"> - <!-- Add language bar --> - <?php - $includeLanguageBar = (!empty($_POST)) ? false : true; - $includeLanguageBar = (isset($this->data['hideLanguageBar']) && $this->data['hideLanguageBar'] === true) ? false : true; + <div class="container-fluid ssp-footer--container container"> + <div class="row ssp-content-group--footer"> + <!-- Add language bar --> + <?php + $includeLanguageBar = (!empty($_POST)) ? false : true; + $includeLanguageBar = ( + (isset($this->data['hideLanguageBar']) && $this->data['hideLanguageBar'] === true) + ? false + : true + ); + + if ($includeLanguageBar) { + $this->includeAtTemplateBase('includes/language_bar.php'); + } - if ($includeLanguageBar) { - $this->includeAtTemplateBase('includes/language_bar.php'); - } - ?> - <div class="col-sm-12 col-md-4 ssp-footer__item ssp-footer__item--images text-center"> - <a href="https://grnet.gr/"> - <img class="ssp-footer__item__logo" src="<?php print SimpleSAML_Module::getModuleURL('themeegi/resources/images/grnet_logo_en.svg'); ?>" alt="GRNET" /> - </a> - <img class="ssp-footer__item__logo--eu" src="<?php print SimpleSAML_Module::getModuleURL('themeegi/resources/images/eu.svg'); ?>" alt="European Union" /> - </div> - <div class="col-sm-12 col-md-4 ssp-footer__item"> - <div class="ssp-footer__item__links"> - <a class="ssp-footer__item__links__left_link" href="/proxy/module.php/themeegi/views.php?id=aup">Terms</a><a href="/proxy/module.php/themeegi/views.php?id=privacy">Privacy</a> + ?> + <div class="col-sm-12 col-md-4 ssp-footer__item ssp-footer__item--images text-center"> + <a href="https://grnet.gr/"> + <img + class="ssp-footer__item__logo" + src="<?= SimpleSAML\Module::getModuleURL('themeegi/resources/images/grnet_logo_en.svg') ?>" + alt="GRNET" + /> + </a> + <img + class="ssp-footer__item__logo--eu" + src="<?= SimpleSAML\Module::getModuleURL('themeegi/resources/images/eu.svg') ?>" + alt="European Union" + /> + </div> + <div class="col-sm-12 col-md-4 ssp-footer__item"> + <div class="ssp-footer__item__links"> + <a class="ssp-footer__item__links__left_link" href="/proxy/module.php/themeegi/views.php?id=aup"> + Terms + </a> + <a href="/proxy/module.php/themeegi/views.php?id=privacy">Privacy</a> + </div> + </div> + </div><!-- /row --> + <div class="row"> + <div class="col-sm-12 ssp-footer__item ssp-footer__item--ack text-center"> + Copyright ©<?= + ( + (strpos($this->t('{themeegi:discopower:copyright_year_start}'), 'not translated') === false) + ? $this->t('{themeegi:discopower:copyright_year_start}') . '-' + : '' + ) + . date("Y") ?> | Check-in is an EGI service provided by GRNET, receiving funding from the + <a href="https://www.egi.eu/about/egi-foundation/" target="_blank">EGI Foundation (EGI.eu)</a> + and the <a href="https://eosc-hub.eu" target="_blank">EOSC-hub project</a> + (Horizon 2020) under Grant number 777536 | Powered by <a href="https://github.com/rciam">RCIAM</a> + </div> </div> - </div> - </div><!-- /row --> - <div class="row"> - <div class="col-sm-12 ssp-footer__item ssp-footer__item--ack text-center"> - Copyright ©<?php - print (strpos($this->t('{themeegi:discopower:copyright_year_start}'), 'not translated') === false) - ? $this->t('{themeegi:discopower:copyright_year_start}') . '-' - : ''; - print date("Y"); - ?> | Check-in is an EGI service provided by GRNET, receiving funding from the - <a href="https://www.egi.eu/about/egi-foundation/" target="_blank">EGI Foundation (EGI.eu)</a> and the <a href="https://eosc-hub.eu" target="_blank">EOSC-hub project</a> (Horizon 2020) under Grant number 777536 | Powered by <a href="https://github.com/rciam">RCIAM</a> - </div> - </div> - </div> <!-- /container-fluid --> + </div> <!-- /container-fluid --> </footer> - <script type="text/javascript" - src="<?php print htmlspecialchars(SimpleSAML_Module::getModuleURL('themeegi/resources/js/cookie.js')); ?>"> - </script> - - <script type="text/javascript" - src="<?php print htmlspecialchars(SimpleSAML_Module::getModuleURL('themeegi/resources/js/dropdown.js')); ?>"> - </script> - <script type="text/javascript" - src="<?php print htmlspecialchars(SimpleSAML_Module::getModuleURL('themeegi/resources/js/modal.js')); ?>"> - </script> - <script type="text/javascript" - src="<?php print htmlspecialchars(SimpleSAML_Module::getModuleURL('themeegi/resources/js/tooltip.js')); ?>"> - </script> - <script type="text/javascript" - src="<?php print htmlspecialchars(SimpleSAML_Module::getModuleURL('themeegi/resources/js/theme.js')); ?>"> - </script> +<script + type="text/javascript" + src="<?= htmlspecialchars(SimpleSAML\Module::getModuleURL('themeegi/resources/js/cookie.js')) ?>" +> +</script> +<script + type="text/javascript" + src="<?= htmlspecialchars(SimpleSAML\Module::getModuleURL('themeegi/resources/js/dropdown.js')) ?>" +> +</script> +<script + type="text/javascript" + src="<?= htmlspecialchars(SimpleSAML\Module::getModuleURL('themeegi/resources/js/modal.js')) ?>" +> +</script> +<script + type="text/javascript" + src="<?= htmlspecialchars(SimpleSAML\Module::getModuleURL('themeegi/resources/js/tooltip.js')) ?>" +> +</script> +<script + type="text/javascript" + src="<?= htmlspecialchars(SimpleSAML\Module::getModuleURL('themeegi/resources/js/theme.js')) ?>" +> +</script> </body> + </html> diff --git a/themes/ssp/default/includes/header.php b/themes/ssp/default/includes/header.php index e26afb61f895fb563cc4fd8677fa0f367b624a3d..99a92b15e2975c3715a0c4d5b5534bef5215e054 100644 --- a/themes/ssp/default/includes/header.php +++ b/themes/ssp/default/includes/header.php @@ -1,30 +1,33 @@ <?php - +$themeConfig = SimpleSAML\Configuration::getConfig('module_themeegi.php'); +$ribbonText = $themeConfig->getValue('ribbon_text'); /** * Support the htmlinject hook, which allows modules to change header, pre and post body on all pages. */ -$this->data['htmlinject'] = array( - 'htmlContentPre' => array(), - 'htmlContentPost' => array(), - 'htmlContentHead' => array(), -); +$this->data['htmlinject'] = [ + 'htmlContentPre' => [], + 'htmlContentPost' => [], + 'htmlContentHead' => [], +]; -$jquery = array(); -if (array_key_exists('jquery', $this->data)) $jquery = $this->data['jquery']; +$jquery = []; +if (array_key_exists('jquery', $this->data)) { + $jquery = $this->data['jquery']; +} if (array_key_exists('pageid', $this->data)) { - $hookinfo = array( - 'pre' => &$this->data['htmlinject']['htmlContentPre'], - 'post' => &$this->data['htmlinject']['htmlContentPost'], - 'head' => &$this->data['htmlinject']['htmlContentHead'], - 'jquery' => &$jquery, - 'page' => $this->data['pageid'] - ); - - SimpleSAML_Module::callHooks('htmlinject', $hookinfo); + $hookinfo = [ + 'pre' => &$this->data['htmlinject']['htmlContentPre'], + 'post' => &$this->data['htmlinject']['htmlContentPost'], + 'head' => &$this->data['htmlinject']['htmlContentHead'], + 'jquery' => &$jquery, + 'page' => $this->data['pageid'] + ]; + + SimpleSAML\Module::callHooks('htmlinject', $hookinfo); } // - o - o - o - o - o - o - o - o - o - o - o - o - @@ -42,117 +45,162 @@ header('X-Frame-Options: SAMEORIGIN'); ?> <!DOCTYPE html> <html lang="en-US"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<meta http-equiv="X-UA-Compatible" content="IE=edge" /> -<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0" /> -<script type="text/javascript" src="/<?php echo $this->data['baseurlpath']; ?>resources/script.js"></script> -<title> - <?php - if (strpos($this->t('{themeegi:default:browser_tab_title}'), 'not translated') === FALSE) { - echo $this->t('{themeegi:default:browser_tab_title}'); - } - if(array_key_exists('header', $this->data)) { echo (' | ' . $this->data['header']); } - ?> -</title> - -<link rel="stylesheet" type="text/css" href="<?php echo htmlspecialchars(SimpleSAML_Module::getModuleURL('themeegi/resources/css/app.css')); ?>" /> - -<link rel="shortcut icon" type="image/x-icon" href="<?php echo htmlspecialchars(SimpleSAML_Module::getModuleURL('themeegi/resources/images/logo_site-300x300.png')); ?>" /> -<link rel="apple-touch-icon" href="<?php echo htmlspecialchars(SimpleSAML_Module::getModuleURL('themeegi/resources/images/logo_site-300x300.png')); ?>" /> - -<?php - -if(!empty($jquery)) { - $version = '1.8'; - if (array_key_exists('version', $jquery)) - $version = $jquery['version']; - - if ($version == '1.8') { - if (isset($jquery['core']) && $jquery['core']) - echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-1.8.js"></script>' . "\n"); - - if (isset($jquery['ui']) && $jquery['ui']) - echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-ui-1.8.js"></script>' . "\n"); - - if (isset($jquery['css']) && $jquery['css']) - echo('<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . - 'resources/uitheme1.8/jquery-ui.css" />' . "\n"); - } -} - -if (isset($this->data['clipboard.js'])) { - echo '<script type="text/javascript" src="/'. $this->data['baseurlpath'] . - 'resources/clipboard.min.js"></script>'."\n"; -} - -if(!empty($this->data['htmlinject']['htmlContentHead'])) { - foreach($this->data['htmlinject']['htmlContentHead'] AS $c) { - echo $c; - } -} - - - - -if ($this->isLanguageRTL()) { -?> - <link rel="stylesheet" type="text/css" href="/<?php echo $this->data['baseurlpath']; ?>resources/default-rtl.css" /> -<?php -} -?> - - <meta name="robots" content="noindex, nofollow" /> - - -<?php -if(array_key_exists('head', $this->data)) { - echo '<!-- head -->' . $this->data['head'] . '<!-- /head -->'; -} -?> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0" /> + <script type="text/javascript" src="/<?= $this->data['baseurlpath'] ?>resources/script.js"></script> + <title> + <?php + if (strpos($this->t('{themeegi:default:browser_tab_title}'), 'not translated') === false) { + echo $this->t('{themeegi:default:browser_tab_title}'); + } + if (array_key_exists('header', $this->data)) { + echo (' | ' . $this->data['header']); + } + ?> + </title> + + <link + rel="stylesheet" + type="text/css" + href="<?= htmlspecialchars(SimpleSAML\Module::getModuleURL('themeegi/resources/css/app.css')) ?>" + /> + <link + rel="shortcut icon" + type="image/x-icon" + href="<?= htmlspecialchars( + SimpleSAML\Module::getModuleURL('themeegi/resources/images/logo_site-300x300.png') + ) ?>" + /> + <link + rel="apple-touch-icon" + href="<?= htmlspecialchars( + SimpleSAML\Module::getModuleURL('themeegi/resources/images/logo_site-300x300.png') + ) ?>" + /> + + <?php + + if (!empty($jquery)) { + $version = '1.8'; + if (array_key_exists('version', $jquery)) { + $version = $jquery['version']; + } + + if ($version == '1.8') { + if (isset($jquery['core']) && $jquery['core']) { + echo ( + '<script type="text/javascript" src="/' . $this->data['baseurlpath'] + . 'resources/jquery-1.8.js"></script>' . "\n" + ); + } + if (isset($jquery['ui']) && $jquery['ui']) { + echo ( + '<script type="text/javascript" src="/' . $this->data['baseurlpath'] + . 'resources/jquery-ui-1.8.js"></script>' . "\n" + ); + } + if (isset($jquery['css']) && $jquery['css']) { + echo ( + '<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . + 'resources/uitheme1.8/jquery-ui.css" />' . "\n" + ); + } + } + } + + if (isset($this->data['clipboard.js'])) { + echo '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . + 'resources/clipboard.min.js"></script>' . "\n"; + } + + if (!empty($this->data['htmlinject']['htmlContentHead'])) { + foreach ($this->data['htmlinject']['htmlContentHead'] as $c) { + echo $c; + } + } + + + + + if ($this->isLanguageRTL()) : ?> + <link rel="stylesheet" type="text/css" href="/<?= $this->data['baseurlpath'] ?>resources/default-rtl.css" /> + <?php endif; ?> + + + <meta name="robots" content="noindex, nofollow" /> + + + <?php + if (array_key_exists('head', $this->data)) { + echo '<!-- head -->' . $this->data['head'] . '<!-- /head -->'; + } + ?> </head> <?php $onLoad = ''; -if(array_key_exists('autofocus', $this->data)) { - $onLoad .= 'SimpleSAML_focus(\'' . $this->data['autofocus'] . '\');'; +if (array_key_exists('autofocus', $this->data)) { + $onLoad .= 'SimpleSAML_focus(\'' . $this->data['autofocus'] . '\');'; } if (isset($this->data['onLoad'])) { - $onLoad .= $this->data['onLoad']; + $onLoad .= $this->data['onLoad']; } -if($onLoad !== '') { - $onLoad = ' onload="' . $onLoad . '"'; +if ($onLoad !== '') { + $onLoad = ' onload="' . $onLoad . '"'; } ?> -<body<?php echo $onLoad; ?>> - -<div class="header"> -<?php - if ($this->t('{themeegi:default:ribbon_text}')) { - echo '<div class="corner-ribbon red">'; - echo $this->t('{themeegi:default:ribbon_text}'); - echo '</div>'; - } - ?> - <div class="text-center ssp-logo"> - <a href="<?php echo $this->t('{themeegi:default:logo_link_url}'); ?>" title="<?php echo $this->t('{themeegi:default:header_title}'); ?>"> - <img src="<?php echo SimpleSAML_Module::getModuleURL('themeegi/resources/images/logo.svg'); ?>" alt="EGI" /> - </a> - </div> - <h1 class="text-center"> - <?php echo $this->t('{themeegi:default:header_title}'); ?> - <small><?php echo $this->t('{themeegi:default:header_subtitle}'); ?></small> - </h1> -</div> <!-- /header --> -<div class="ssp-container" id="content"> -<div class="container js-spread"> - - -<?php - -if(!empty($this->data['htmlinject']['htmlContentPre'])) { - foreach($this->data['htmlinject']['htmlContentPre'] AS $c) { - echo $c; - } -} +<body<?= $onLoad ?>> + + <div class="header"> + <?php + if (!empty($ribbonText)) { + echo '<div class="corner-ribbon red">'; + echo $ribbonText; + echo '</div>'; + } + ?> + <div class="text-center ssp-logo"> + <a + <?= + strpos($this->t('{themeegi:default:logo_link_url}'), 'not translated') === false + ? 'href="' . $this->t('{themeegi:default:logo_link_url}') . '"' + : '' + ?> + <?= + strpos($this->t('{themeegi:default:header_title}'), 'not translated') === false + ? 'title="' . $this->t('{themeegi:default:header_title}') . '"' + : '' + ?> + > + <img + src="<?= SimpleSAML\Module::getModuleURL('themeegi/resources/images/logo.svg') ?>" + alt="EGI" + /> + </a> + </div> + <h1 class="text-center"> + <?= + strpos($this->t('{themeegi:default:header_title}'), 'not translated') === false + ? $this->t('{themeegi:default:header_title}') + : '' + ?> + <small> + <?= + strpos($this->t('{themeegi:default:header_subtitle}'), 'not translated') === false + ? $this->t('{themeegi:default:header_subtitle}') + : '' + ?> + </small> + </h1> + </div> <!-- /header --> + <div class="ssp-container" id="content"> + <div class="container js-spread"> + <?php + if (!empty($this->data['htmlinject']['htmlContentPre'])) { + foreach ($this->data['htmlinject']['htmlContentPre'] as $c) { + echo $c; + } + } diff --git a/themes/ssp/default/includes/language_bar.php b/themes/ssp/default/includes/language_bar.php index f535623e5341cd9dd5eaede0584d644ffcfbee0e..64d617cbce2cd241fe073800beef0e2ea9c9669d 100644 --- a/themes/ssp/default/includes/language_bar.php +++ b/themes/ssp/default/includes/language_bar.php @@ -1,74 +1,86 @@ <?php // Language names dictionary -$langnames = array( - 'no' => 'BokmÃ¥l', // Norwegian BokmÃ¥l - 'nn' => 'Nynorsk', // Norwegian Nynorsk - 'se' => 'Sámegiella', // Northern Sami - 'sam' => 'Ã…arjelh-saemien giele', // Southern Sami - 'da' => 'Dansk', // Danish - 'en' => 'English', - 'de' => 'Deutsch', // German - 'sv' => 'Svenska', // Swedish - 'fi' => 'Suomeksi', // Finnish - 'es' => 'Español', // Spanish - 'fr' => 'Français', // French - 'it' => 'Italiano', // Italian - 'nl' => 'Nederlands', // Dutch - 'lb' => 'Lëtzebuergesch', // Luxembourgish - 'cs' => 'ÄŒeÅ¡tina', // Czech - 'sl' => 'SlovenÅ¡Äina', // Slovensk - 'lt' => 'Lietuvių kalba', // Lithuanian - 'hr' => 'Hrvatski', // Croatian - 'hu' => 'Magyar', // Hungarian - 'pl' => 'JÄ™zyk polski', // Polish - 'pt' => 'Português', // Portuguese - 'pt-br' => 'Português brasileiro', // Portuguese - 'ru' => 'руÑÑкий Ñзык', // Russian - 'et' => 'eesti keel', // Estonian - 'tr' => 'Türkçe', // Turkish - 'el' => 'ελληνικά', // Greek - 'ja' => '日本語', // Japanese - 'zh' => 'ç®€ä½“ä¸æ–‡', // Chinese (simplified) - 'zh-tw' => 'ç¹é«”䏿–‡', // Chinese (traditional) - 'ar' => 'العربية', // Arabic - 'fa' => 'پارسی', // Persian - 'ur' => 'اردو', // Urdu - 'he' => 'עִבְרִית', // Hebrew - 'id' => 'Bahasa Indonesia', // Indonesian - 'sr' => 'Srpski', // Serbian - 'lv' => 'LatvieÅ¡u', // Latvian - 'ro' => 'RomâneÈ™te', // Romanian - 'eu' => 'Euskara', // Basque -); +$langNames = [ + 'af' => 'Afrikaans', // Afrikaans + 'ar' => 'العربية', // Arabic + 'ca' => 'Català ', // Catalan + 'cs' => 'ÄŒeÅ¡tina', // Czech + 'da' => 'Dansk', // Danish + 'de' => 'Deutsch', // German + 'el' => 'ελληνικά', // Greek + 'en' => 'English', + 'es' => 'Español', // Spanish + 'et' => 'eesti keel', // Estonian + 'eu' => 'Euskara', // Basque + 'fi' => 'Suomeksi', // Finnish + 'fr' => 'Français', // French + 'he' => 'עִבְרִית', // Hebrew + 'hr' => 'Hrvatski', // Croatian + 'hu' => 'Magyar', // Hungarian + 'id' => 'Bahasa Indonesia', // Indonesian + 'it' => 'Italiano', // Italian + 'ja' => '日本語', // Japanese + 'lb' => 'Lëtzebuergesch', // Luxembourgish + 'lt' => 'Lietuvių kalba', // Lithuanian + 'lv' => 'LatvieÅ¡u', // Latvian + 'nl' => 'Nederlands', // Dutch + 'nn' => 'Nynorsk', // Norwegian Nynorsk + 'no' => 'BokmÃ¥l', // Norwegian BokmÃ¥l + 'pl' => 'JÄ™zyk polski', // Polish + 'pt' => 'Português', // Portuguese + 'pt-br' => 'Português brasileiro', // Portuguese + 'ro' => 'RomâneÈ™te', // Romanian + 'ru' => 'руÑÑкий Ñзык', // Russian + 'se' => 'Sámegiella', // Northern Sami + 'sl' => 'SlovenÅ¡Äina', // Slovensk + 'sr' => 'Srpski', // Serbian + 'sv' => 'Svenska', // Swedish + 'tr' => 'Türkçe', // Turkish + 'xh' => 'isiXhosa', // Xhosa + 'zh' => 'ç®€ä½“ä¸æ–‡', // Chinese (simplified) + 'zh-tw' => 'ç¹é«”䏿–‡', // Chinese (traditional) + 'zu' => 'IsiZulu', // Zulu +]; $languages = $this->getLanguageList(); ?> -<?php if ( count($languages) > 1 ): ?> -<div class="col-sm-12 col-md-4 ssp-footer__item"> - <div class="dropup ssp-footer__item__lang"> - <?php - $textarray = array(); +<?php if (count($languages) > 1) : ?> + <div class="col-sm-12 col-md-4 ssp-footer__item"> + <div class="dropup ssp-footer__item__lang"> + <?php + $textArray = []; foreach ($languages as $lang => $current) { $lang = strtolower($lang); if ($current) { - $lang_current = $langnames[$lang]; + $langCurrent = $langNames[$lang]; } else { - $textarray[] = + $textArray[] = '<li class="ssp-dropdown__two_cols--item">' - . '<a href="' . htmlspecialchars(\SimpleSAML\Utils\HTTP::addURLParameters(\SimpleSAML\Utils\HTTP::getSelfURL(), array($this->languageParameterName => $lang))) . '">' - . $langnames[$lang] + . '<a href="' . htmlspecialchars( + \SimpleSAML\Utils\HTTP::addURLParameters( + \SimpleSAML\Utils\HTTP::getSelfURL(), + [$this->getTranslator()->getLanguage()->getLanguageParameterName() => $lang] + ) + ) . '">' + . $langNames[$lang] . '</a>' . '</li>'; } } - ?> - <button class="ssp-btn btn ssp-btn__footer dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> - <?php print $lang_current; ?> - <span class="caret"></span> - </button> - <ul class="dropdown-menu dropdown-menu-left ssp-dropdown__two_cols" aria-labelledby="dropdownMenu1"> - <?php print implode(' ', $textarray); ?> - </ul> - </div> <!-- dropup --> -</div> <!-- col-sm-4 --> -<?php endif; ?> \ No newline at end of file + ?> + <button + class="ssp-btn btn ssp-btn__footer dropdown-toggle" + type="button" + data-toggle="dropdown" + aria-haspopup="true" + aria-expanded="true" + > + <?= $langCurrent ?> + <span class="caret"></span> + </button> + <ul class="dropdown-menu dropdown-menu-left ssp-dropdown__two_cols" aria-labelledby="dropdownMenu1"> + <?= implode(' ', $textArray) ?> + </ul> + </div> <!-- dropup --> + </div> <!-- col-sm-4 --> +<?php endif; diff --git a/themes/ssp/default/includes/login_help.php b/themes/ssp/default/includes/login_help.php index da0b1960c98a09a8a3c6d7e9c03dbd804b6c7dd6..1e215cf498306f91721083c14bdef12b92fc7100 100644 --- a/themes/ssp/default/includes/login_help.php +++ b/themes/ssp/default/includes/login_help.php @@ -1,35 +1,29 @@ -<?php - -echo(' - <div class="modal fade" id="login-help-modal" tabindex="-1" role="dialog"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="js-close-custom close"><span aria-hidden="true">×</span></button> - <h2 class="modal-title">' . $this->t('{themeegi:discopower:login_help_text}') . '</h2> - </div> - <div class="modal-body ssp-modal-body"> - <div class="row"> - <p>' . $this->t('{themeegi:discopower:login_help_intro}') . '</p> - <ul class="list-with-img"> - <li> - <div class="img"> ' . $this->t('{themeegi:discopower:login_help_option1_img}') . ' </div> - <div class="txt"> ' . $this->t('{themeegi:discopower:login_help_option1_text}') . ' </div> - </li> - <li> - <div class="img"> ' . $this->t('{themeegi:discopower:login_help_option2_img}') . ' </div> - <div class="txt"> ' . $this->t('{themeegi:discopower:login_help_option2_text}') . ' </div> - </li> - <li> - <div class="img"> ' . $this->t('{themeegi:discopower:login_help_option3_img}') . ' </div> - <div class="txt"> ' . $this->t('{themeegi:discopower:login_help_option3_text}') . ' </div> - </li> - </ul> - </div> - </div> <!-- /modal-body --> - </div> <!-- /modal-content --> - </div> <!-- /modal-dialog --> - </div> <!-- /modal --> -'); - -?> +<div class="modal fade" id="login-help-modal" tabindex="-1" role="dialog"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="js-close-custom close"><span aria-hidden="true">×</span></button> + <h2 class="modal-title"><?= $this->t('{themeegi:discopower:login_help_text}') ?></h2> + </div> + <div class="modal-body ssp-modal-body"> + <div class="row"> + <p><?= $this->t('{themeegi:discopower:login_help_intro}') ?></p> + <ul class="list-with-img"> + <li> + <div class="img"><?= $this->t('{themeegi:discopower:login_help_option1_img}') ?></div> + <div class="txt"><?= $this->t('{themeegi:discopower:login_help_option1_text}') ?></div> + </li> + <li> + <div class="img"><?= $this->t('{themeegi:discopower:login_help_option2_img}') ?></div> + <div class="txt"><?= $this->t('{themeegi:discopower:login_help_option2_text}') ?></div> + </li> + <li> + <div class="img"><?= $this->t('{themeegi:discopower:login_help_option3_img}') ?></div> + <div class="txt"><?= $this->t('{themeegi:discopower:login_help_option3_text}') ?></div> + </li> + </ul> + </div> + </div> <!-- /modal-body --> + </div> <!-- /modal-content --> + </div> <!-- /modal-dialog --> +</div> <!-- /modal --> diff --git a/themes/ssp/discopower/disco-tpl.php b/themes/ssp/discopower/disco-tpl.php deleted file mode 100644 index 773ee2f2430e289a77f91ae1c62201e9840626ce..0000000000000000000000000000000000000000 --- a/themes/ssp/discopower/disco-tpl.php +++ /dev/null @@ -1,229 +0,0 @@ -<?php -// Get Configuration and set the loader -$themeConfig = SimpleSAML_Configuration::getConfig('module_themeegi.php'); -$loader = $themeConfig->getValue('loader'); -if(!empty($loader)) { - $this->includeAtTemplateBase('includes/' . $loader . '.php'); -} - -$faventry = NULL; -foreach( $this->data['idplist'] AS $tab => $slist) { - if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $slist)) - $faventry = $slist[$this->data['preferredidp']]; -} - - -if(!array_key_exists('header', $this->data)) { - $this->data['header'] = 'selectidp'; -} -$this->data['header'] = $this->t($this->data['header']); -$this->data['jquery'] = array('core' => TRUE, 'ui' => TRUE, 'css' => TRUE); - - -$this->data['head'] = '<script type="text/javascript" src="' . SimpleSAML_Module::getModuleUrl('discopower/js/jquery.livesearch.js') . '"></script>'; -$this->data['head'] .= '<script type="text/javascript" src="' . SimpleSAML_Module::getModuleUrl('discopower/js/' . $this->data['score'] . '.js') . '"></script>'; - -$this->data['head'] .= '<script type="text/javascript"> - - $(document).ready(function() {'; - $i = 0; - foreach ($this->data['idplist'] AS $tab => $slist) { - if ($tab == 'idps_in_searchable_list') { - $this->data['head'] .= "\n" . '$("#query_' . $tab . '").liveUpdate("#list_' . $tab . '")' . - (($i++ == 0) && (empty($faventry)) ? '.focus()' : '') . ';'; - } - - - } - - $this->data['head'] .= ' -}); - -</script>'; - -if (!empty($faventry)) $this->data['autofocus'] = 'favouritesubmit'; - -$this->includeAtTemplateBase('includes/header.php'); - -function showEntry($t, $metadata, $favourite = FALSE, $withIcon = FALSE) { - - $basequerystring = '?' . - 'entityID=' . urlencode($t->data['entityID']) . '&' . - 'return=' . urlencode($t->data['return']) . '&' . - 'returnIDParam=' . urlencode($t->data['returnIDParam']) . '&idpentityid='; - - - - if($withIcon) { - if(isset($metadata['login_button']['label']) && !empty($metadata['login_button']['label'])) { - $label = $metadata['login_button']['label']; - } - $filename = $metadata['login_button']['icon_filename']; - $css_classname = $metadata['login_button']['css_classname']; - $css_button_type = ''; - - // is $label empty string - if(!isset($label) || trim($label) == '') { - $css_button_type = 'ssp-btn__icon-no-label'; - } - else { - $css_button_type = 'ssp-btn__icon-with-label'; - } - - $html = '<a class="metaentry ssp-btn ' . $css_button_type . ' ' . $css_classname . '" href="' . $basequerystring . urlencode($metadata['entityid']) . '">'; - $html .= '<img alt="Identity Provider" class="entryicon" src="' . SimpleSAML_Module::getModuleURL('themeegi/resources/images/' . $filename ) . '" />'; - if (isset($label)) { - $html .= '<span>' . $label . '</span>'; - } - $html .= '</a>'; - } - else { - $html = '<a class="metaentry " href="' . $basequerystring . urlencode($metadata['entityid']) . '">'; - $html .= htmlspecialchars(getTranslatedName($t, $metadata)) . ''; - - if(array_key_exists('icon', $metadata) && $metadata['icon'] !== NULL) { - $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($metadata['icon']); - $html .= '<img alt="Identity Provider" class="entryicon" src="' . htmlspecialchars($iconUrl) . '" />'; - } - - $html .= '</a>'; - } - - - - return $html; -} - -?> - - <h2 class="text-center"><?php print $this->t('{themeegi:discopower:title}'); ?></h2> - - -<?php - -function getTranslatedName($t, $metadata) { - if (isset($metadata['UIInfo']['DisplayName'])) { - $displayName = $metadata['UIInfo']['DisplayName']; - assert('is_array($displayName)'); // Should always be an array of language code -> translation - if (!empty($displayName)) { - return $t->getTranslation($displayName); - } - } - - if (array_key_exists('name', $metadata)) { - if (is_array($metadata['name'])) { - return $t->getTranslation($metadata['name']); - } else { - return $metadata['name']; - } - } - return $metadata['entityid']; -} - - -$this->includeAtTemplateBase('includes/login_help.php'); - -?> -<?php if (!empty($faventry)): ?> - <div class="modal fade" id="favourite-modal" tabindex="-1" role="dialog"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="js-close-custom close"><span aria-hidden="true">×</span></button> - <h2 class="modal-title"><?php print $this->t('{themeegi:discopower:favourite_dialog_title}'); ?></h2> - </div> - <div class="modal-body ssp-modal-body"> - <div class="row text-center"> - <form id="idpselectform" method="get" action="<?php print $this->data['urlpattern']; ?>" class="ssp-form-favourite"> - <input type="hidden" name="entityID" value="<?php print htmlspecialchars($this->data['entityID']); ?>" /> - <input type="hidden" name="return" value="<?php print htmlspecialchars($this->data['return']); ?>" /> - <input type="hidden" name="returnIDParam" value="<?php print htmlspecialchars($this->data['returnIDParam']); ?>" /> - <input type="hidden" name="idpentityid" value="<?php print htmlspecialchars($faventry['entityid']); ?>" /> - <input type="submit" - name="formsubmit" - id="favouritesubmit" - class="ssp-btn ssp-btn__action text-uppercase" - value="<?php print $this->t('login_at') . htmlspecialchars(getTranslatedName($this, $faventry)); ?>" /> - </form> - </div> - <div class="row text-center ssp-modal-or"><?php print $this->t('{themeegi:discopower:or}'); ?></div> - <div class="row text-center"> - <button class="ssp-btn text-uppercase ssp-btn ssp-btn__secondary js-close-custom"><?php print $this->t('{themeegi:discopower:favourite_dialog_button_close}'); ?></button> - </div> - </div> <!-- /modal-body --> - </div> <!-- /modal-content --> - </div> <!-- /modal-dialog --> - </div> <!-- /modal --> -<?php endif; ?> -<?php - -$idps_in_searchable_list_index; -$idps_with_logos_index; -foreach( $this->data['idplist'] AS $tab => $slist) { - if (!empty($slist)) { - if($tab == 'idps_in_searchable_list') { - $idps_in_searchable_list_index = array_search($tab, array_keys($this->data['idplist'])); - $top = '<div class="row ssp-content-group js-spread"> - <div class="col-sm-12 js-spread">'; - $search_name = 'query_' . $tab; - $search = '<div class="input-group"> - <span class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span> - <form id="idpselectform" action="?" method="get"> - <input class="form-control" aria-describedby="search institutions" placeholder="Search..." type="text" value="" name="' - . $search_name . '" id="' . $search_name . '" />' - . '</form>' - . '</div>'; - $list_open = '<div class="metalist ssp-content-group__provider-list ssp-content-group__provider-list--idps_in_searchable_list js-spread" id="list_' . $tab . '">'; - $list_items = ''; - $close = '</div></div></div>'; // /metalist /ssp-content-group /row - - if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $slist)) { - $idpentry = $slist[$this->data['preferredidp']]; - $list_items .= (showEntry($this, $idpentry, TRUE)); - } - - foreach ($slist AS $idpentry) { - if ($idpentry['entityid'] != $this->data['preferredidp']) { - $list_items .= (showEntry($this, $idpentry)); - } - } - print $top . $search . $list_open . $list_items . $close; - } - else if($tab == "idps_with_logos") { - $idps_with_logos_index = array_search($tab, array_keys($this->data['idplist'])); - $top = '<div class="row ssp-content-group"><div class="col-sm-12"> - '; - $list_open = '<div class="metalist ssp-content-group__provider-list ssp-content-group__provider-list--other js-idps">'; - $list_items = ''; - $close_list = '</div>'; // /metalist - $close = '</div></div>'; // /ssp-content-group /col-sm-12 - if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $slist)) { - $idpentry = $slist[$this->data['preferredidp']]; - $list_items .= (showEntry($this, $idpentry, TRUE, TRUE)); - } - - foreach ($slist AS $idpentry) { - if ($idpentry['entityid'] != $this->data['preferredidp']) { - $list_items .= (showEntry($this, $idpentry, FALSE, TRUE)); - } - } - $list_items .= '<p class="ssp-logos__help" id="js-open-help"><a href="#">' . $this->t('{themeegi:discopower:login_help_text}') .'</a></p>'; - if($idps_in_searchable_list_index < $idps_with_logos_index) { - $or = '<div class="text-center ssp-line-or-line ssp-line-or-line--top"><span class="ssp-line-or-line__or">' . $this->t('{themeegi:discopower:or}') . '</span></div>'; - print $top . $or . $list_open . $list_items . $close_list . $close; - } - else { - $or = '<div class="text-center ssp-line-or-line ssp-line-or-line--bottom"><span class="ssp-line-or-line__or">' . $this->t('{themeegi:discopower:or}') . '</span></div>'; - print $top . $list_open . $list_items . $close_list . $or . $close; - } - } - } -} - -?> - - - - - -<?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/themes/ssp/discopower/disco.tpl.php b/themes/ssp/discopower/disco.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..6ccacb44433f804c0dc0ae82574b075ed92289f9 --- /dev/null +++ b/themes/ssp/discopower/disco.tpl.php @@ -0,0 +1,288 @@ +<?php + +use Webmozart\Assert\Assert; + +// Get Configuration and set the loader +$themeConfig = SimpleSAML\Configuration::getConfig('module_themeegi.php'); +$loader = $themeConfig->getValue('loader'); +if (!empty($loader)) { + $this->includeAtTemplateBase('includes/' . $loader . '.php'); +} + +$favEntry = null; +foreach ($this->data['idplist'] as $tab => $sList) { + if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $sList)) { + $favEntry = $sList[$this->data['preferredidp']]; + } +} + +$this->data['header'] = $this->t('selectidp'); +$this->data['header'] = $this->t($this->data['header']); +$this->data['jquery'] = ['core' => true, 'ui' => false, 'css' => false]; + +$this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' . + SimpleSAML\Module::getModuleURL('discopower/assets/css/uitheme1.12.1/jquery-ui.min.css') . '" />'; + +if (!empty($favEntry)) { + $this->data['autofocus'] = 'favouritesubmit'; +} + +$this->includeAtTemplateBase('includes/header.php'); + +$this->data['htmlinject']['htmlContentPost'][] = '<script type="text/javascript" src="' . + SimpleSAML\Module::getModuleURL('discopower/assets/js/jquery-1.12.4.min.js') . '"></script>' . "\n"; +$this->data['htmlinject']['htmlContentPost'][] = '<script type="text/javascript" src="' . + SimpleSAML\Module::getModuleURL('discopower/assets/js/jquery-ui-1.12.1.min.js') . '"></script>' . "\n"; +$this->data['htmlinject']['htmlContentPost'][] = '<script type="text/javascript" src="' . + SimpleSAML\Module::getModuleURL('discopower/assets/js/jquery.livesearch.js') . '"></script>' . "\n"; +$this->data['htmlinject']['htmlContentPost'][] = '<script type="text/javascript" src="' . + SimpleSAML\Module::getModuleURL('discopower/assets/js/tablist.js') . '"></script>' . "\n"; +$this->data['htmlinject']['htmlContentPost'][] = '<script type="text/javascript" src="' . + SimpleSAML\Module::getModuleURL('discopower/assets/js/' . $this->data['score'] . '.js') . '"></script>' . "\n"; + +function showEntry($t, $metadata, $favourite = false, $withIcon = false) +{ + + $baseQueryString = '?' . + 'entityID=' . urlencode($t->data['entityID']) . '&' . + 'return=' . urlencode($t->data['return']) . '&' . + 'returnIDParam=' . urlencode($t->data['returnIDParam']) . '&idpentityid='; + + + + if ($withIcon) { + if (isset($metadata['login_button']['label']) && !empty($metadata['login_button']['label'])) { + $label = $metadata['login_button']['label']; + } + $fileName = $metadata['login_button']['icon_filename']; + $cssClassName = $metadata['login_button']['css_classname']; + $cssButtonType = ''; + + // is $label empty string + if (!isset($label) || trim($label) == '') { + $cssButtonType = 'ssp-btn__icon-no-label'; + } else { + $cssButtonType = 'ssp-btn__icon-with-label'; + } + + $html = '<a class="metaentry ssp-btn ' . $cssButtonType . ' ' . $cssClassName . '" href="' + . $baseQueryString . urlencode($metadata['entityid']) . '">'; + $html .= '<img alt="Identity Provider" class="entryicon" src="' + . SimpleSAML\Module::getModuleURL('themeegi/resources/images/' . $fileName) . '" />'; + if (isset($label)) { + $html .= '<span>' . $label . '</span>'; + } + $html .= '</a>'; + } else { + $html = '<a class="metaentry " href="' . $baseQueryString . urlencode($metadata['entityid']) . '">'; + $html .= htmlspecialchars(getTranslatedName($t, $metadata)) . ''; + + if (array_key_exists('icon', $metadata) && $metadata['icon'] !== null) { + $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($metadata['icon']); + $html .= '<img alt="Identity Provider" class="entryicon" src="' . htmlspecialchars($iconUrl) . '" />'; + } + + $html .= '</a>'; + } + + + + return $html; +} + +?> + +<h2 class="text-center"> + <?= + strpos($this->t('{themeegi:discopower:title}'), 'not translated') === false + ? $this->t('{themeegi:discopower:title}') + : '' + ?> +</h2> + + +<?php + +function getTranslatedName($t, $metadata) +{ + if (isset($metadata['UIInfo']['DisplayName'])) { + $displayName = $metadata['UIInfo']['DisplayName']; + Assert::isArray($displayName); // Should always be an array of language code -> translation + if (!empty($displayName)) { + return $t->getTranslator()->getPreferredTranslation($displayName); + } + } + + if (array_key_exists('name', $metadata)) { + if (is_array($metadata['name'])) { + return $t->getTranslator()->getPreferredTranslation($metadata['name']); + } else { + return $metadata['name']; + } + } + return $metadata['entityid']; +} + + +$this->includeAtTemplateBase('includes/login_help.php'); + +if (!empty($favEntry)) : ?> + <div class="modal fade" id="favourite-modal" tabindex="-1" role="dialog"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="js-close-custom close"><span aria-hidden="true">×</span></button> + <h2 class="modal-title"> + <?= + strpos($this->t('{themeegi:discopower:favourite_dialog_title}'), 'not translated') === false + ? $this->t('{themeegi:discopower:favourite_dialog_title}') + : '' + ?> + </h2> + </div> + <div class="modal-body ssp-modal-body"> + <div class="row text-center"> + <form + id="idpselectform" + method="get" + action="<?= $this->data['urlpattern'] ?>" + class="ssp-form-favourite" + > + <input + type="hidden" + name="entityID" + value="<?= htmlspecialchars($this->data['entityID']) ?>" + /> + <input type="hidden" name="return" value="<?= htmlspecialchars($this->data['return']) ?>" /> + <input + type="hidden" + name="returnIDParam" + value="<?= htmlspecialchars($this->data['returnIDParam']) ?>" + /> + <input + type="hidden" + name="idpentityid" + value="<?= htmlspecialchars($favEntry['entityid']) ?>" + /> + <input + type="submit" + name="formsubmit" + id="favouritesubmit" + class="ssp-btn ssp-btn__action text-uppercase" + value="<?= $this->t('{themeegi:discopower:login_with}') . ' ' + . htmlspecialchars(getTranslatedName($this, $favEntry)) ?>" + /> + </form> + </div> + <div class="row text-center ssp-modal-or"> + <?= + strpos($this->t('{themeegi:discopower:or}'), 'not translated') === false + ? $this->t('{themeegi:discopower:or}') + : '' + ?> + </div> + <div class="row text-center"> + <button class="ssp-btn text-uppercase ssp-btn ssp-btn__secondary js-close-custom"> + <?= + strpos( + $this->t('{themeegi:discopower:favourite_dialog_button_close}'), + 'not translated' + ) === false + ? $this->t('{themeegi:discopower:favourite_dialog_button_close}') + : '' + ?> + </button> + </div> + </div> <!-- /modal-body --> + </div> <!-- /modal-content --> + </div> <!-- /modal-dialog --> + </div> <!-- /modal --> +<?php endif; + +$idpsInSearchableListIndex; +$idpsWithLogosIndex; +foreach ($this->data['idplist'] as $tab => $sList) { + if (!empty($sList)) { + if ($tab == 'idps_in_searchable_list') { + $idpsInSearchableListIndex = array_search($tab, array_keys($this->data['idplist'])); + $top = '<div class="row ssp-content-group js-spread"> + <div class="col-sm-12 js-spread">'; + $searchName = 'query_' . $tab; + $search = '<div class="input-group"> + <span class="input-group-addon"> + <span class="glyphicon glyphicon-search" aria-hidden="true"></span> + </span> + <form id="idpselectform" action="?" method="get"> + <input + class="form-control" aria-describedby="search institutions" placeholder="Search..." + type="text" value="" name="' . $searchName . '" id="' . $searchName . '" + />' + . '</form>' + . '</div>'; + $listOpen = '<div class="metalist ssp-content-group__provider-list ' + . 'ssp-content-group__provider-list--idps_in_searchable_list js-spread" id="list_' . $tab . '">'; + $listItems = ''; + $close = '</div></div></div>'; // /metalist /ssp-content-group /row + + if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $sList)) { + $idpEntry = $sList[$this->data['preferredidp']]; + $listItems .= (showEntry($this, $idpEntry, true)); + } + + foreach ($sList as $idpEntry) { + if ($idpEntry['entityid'] != $this->data['preferredidp']) { + $listItems .= (showEntry($this, $idpEntry)); + } + } + echo ($top . $search . $listOpen . $listItems . $close); + } elseif ($tab == "idps_with_logos") { + $idpsWithLogosIndex = array_search($tab, array_keys($this->data['idplist'])); + $top = '<div class="row ssp-content-group"><div class="col-sm-12">'; + $listOpen = '<div class="metalist ssp-content-group__provider-list' + . ' ssp-content-group__provider-list--other js-idps">'; + $listItems = ''; + $closeList = '</div>'; // /metalist + $close = '</div></div>'; // /ssp-content-group /col-sm-12 + if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $sList)) { + $idpEntry = $sList[$this->data['preferredidp']]; + $listItems .= (showEntry($this, $idpEntry, true, true)); + } + + foreach ($sList as $idpEntry) { + if ($idpEntry['entityid'] != $this->data['preferredidp']) { + $listItems .= (showEntry($this, $idpEntry, false, true)); + } + } + $listItems .= '<p class="ssp-logos__help" id="js-open-help"><a href="#">' + . ( + strpos($this->t('{themeegi:discopower:login_help_text}'), 'not translated') === false + ? $this->t('{themeegi:discopower:login_help_text}') + : '' + ) + . '</a></p>'; + if (!empty($idpsInSearchableListIndex) && $idpsInSearchableListIndex < $idpsWithLogosIndex) { + $or = '<div class="text-center ssp-line-or-line ssp-line-or-line--top">' + . '<span class="ssp-line-or-line__or">' + . ( + strpos($this->t('{themeegi:discopower:or}'), 'not translated') === false + ? $this->t('{themeegi:discopower:or}') + : '' + ) + . '</span></div>'; + echo $top . $or . $listOpen . $listItems . $closeList . $close; + } else { + $or = '<div class="text-center ssp-line-or-line ssp-line-or-line--bottom">' + . '<span class="ssp-line-or-line__or">' + . ( + strpos($this->t('{themeegi:discopower:or}'), 'not translated') === false + ? $this->t('{themeegi:discopower:or}') + : '' + ) + . '</span></div>'; + echo $top . $listOpen . $listItems . $closeList . $or . $close; + } + } + } +} + +$this->includeAtTemplateBase('includes/footer.php'); diff --git a/themes/ssp/userid/error.tpl.php b/themes/ssp/userid/error.tpl.php index e08484119335d6304219cc89b22e214f5f091b53..ffad766620bb4425b1d6f1b0c1cc90286e67c759 100644 --- a/themes/ssp/userid/error.tpl.php +++ b/themes/ssp/userid/error.tpl.php @@ -1,6 +1,6 @@ <?php $this->data['header'] = $this->t('{userid:error:header}'); -$this->data['jquery'] = array('core' => TRUE); +$this->data['jquery'] = ['core' => true]; $this->data['head'] = <<<EOF <meta name="robots" content="noindex, nofollow" /> @@ -8,35 +8,63 @@ $this->data['head'] = <<<EOF EOF; $this->includeAtTemplateBase('includes/header.php'); -$retryUrl = $this->data['parameters']['%BASEDIR%'] . 'saml2/idp/initSLO.php?RelayState=' . urlencode($this->data['parameters']['%RESTARTURL%']); +$retryUrl = $this->data['parameters']['%BASEDIR%'] . 'saml2/idp/initSLO.php?RelayState=' +. urlencode($this->data['parameters']['%RESTARTURL%']); +$translationParams = [ + '%IDPNAME%' => $this->data['parameters']['%IDPNAME%'], +]; ?> <div class="row"> - <div class="col-sm-12"> - <?php - $friendly_title = '<h2>' . $this->t('{themeegi:userid_error:friendly_title}') . '</h2>'; - echo $friendly_title; - ?> - <p><?php echo $this->t('{themeegi:userid_error:friendly_description}', $this->data['parameters']); ?></p> - <p><?php echo $this->t('{themeegi:userid_error:resolution_description}', array('%RETRY_URL%' => $retryUrl)); ?></p> - </div> + <div class="col-sm-12"> + <h2> + <?= + strpos($this->t('{themeegi:userid_error:friendly_title}'), 'not translated') === false + ? $this->t('{themeegi:userid_error:friendly_title}') + : '' + ?> + </h2> + <p><?= $this->t('{themeegi:userid_error:friendly_description}', $translationParams) ?></p> + <p><?= $this->t('{themeegi:userid_error:resolution_description}', ['%RETRY_URL%' => $retryUrl]) ?></p> + </div> </div> <div class="row"> - <div class="col-sm-12"> - <div class="text-center"> - <a href="<?php echo $retryUrl; ?>" class="ssp-btn btn ssp-btn__action text-uppercase"> - <?php echo $this->t('{themeegi:userid_error:go2disco}'); ?> - </a> + <div class="col-sm-12"> + <div class="text-center"> + <a href="<?= $retryUrl ?>" class="ssp-btn btn ssp-btn__action text-uppercase"> + <?= + strpos($this->t('{themeegi:userid_error:go2disco}'), 'not translated') === false + ? $this->t('{themeegi:userid_error:go2disco}') + : '' + ?> + </a> + </div> </div> - </div> </div> <div class="row"> - <div class="col-sm-12"> - <h2><?php echo $this->t('{themeegi:userid_error:details_title}'); ?></h2> - <p><?php echo $this->t('{themeegi:userid_error:details_description}'); ?></p> - <pre class="ssp-error-code"> - <?php foreach ($this->data['parameters']['%ATTRIBUTES%'] as $attr) echo $attr . '<br>'; ?> - </pre> - </div> + <div class="col-sm-12"> + <h2> + <?= + strpos($this->t('{themeegi:userid_error:details_title}'), 'not translated') === false + ? $this->t('{themeegi:userid_error:details_title}') + : '' + ?> + </h2> + <p> + <?= + strpos($this->t('{themeegi:userid_error:details_description}'), 'not translated') === false + ? $this->t('{themeegi:userid_error:details_description}') + : '' + ?> + </p> + <pre class="ssp-error-code"> + <?php + foreach ($this->data['parameters']['%ATTRIBUTES%'] as $attr) { + echo $attr . '<br>'; + } + ?> + </pre> + </div> </div> + <?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/version.txt b/version.txt index b70b3386d213e038bd619d9c2f39067496c9b772..e597f07c82663a836cbe27d48a83fb750c73947f 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ simplesamlphp-module-themeegi -version egi-1.4.1 +version egi-2.0.0 diff --git a/www/confirmemail.php b/www/confirmemail.php index 73e3dff43470e03e7131fd0b2b63f5caa49419eb..f10710789b866d702b1a2d059a736275adef6635 100644 --- a/www/confirmemail.php +++ b/www/confirmemail.php @@ -1,6 +1,7 @@ <?php + // Get global config -$config = SimpleSAML_Configuration::getInstance(); +$config = SimpleSAML\Configuration::getInstance(); // Get the template -$template = new SimpleSAML_XHTML_Template($config, 'themeegi:confirmemail.tpl.php'); -$template->show(); \ No newline at end of file +$template = new SimpleSAML\XHTML\Template($config, 'themeegi:confirmemail.tpl.php'); +$template->show(); diff --git a/www/policy.php b/www/policy.php index 1b3c4cb46d7d56fdf118259cbffed8e9e4042e0e..360a5a1892ffbd75b3173c2d9f3799441672968f 100644 --- a/www/policy.php +++ b/www/policy.php @@ -1,7 +1,8 @@ <?php + // Load SimpleSAMLphp, configuration -$config = SimpleSAML_Configuration::getInstance(); +$config = SimpleSAML\Configuration::getInstance(); -$t = new SimpleSAML_XHTML_Template($config, 'themeegi:policy.tpl.php'); +$t = new SimpleSAML\XHTML\Template($config, 'themeegi:policy.tpl.php'); $t->data['pageid'] = 'policy'; $t->show(); diff --git a/www/views.php b/www/views.php index 5648b496709383d7c4103833d7c25a89bf3cd982..06628987ea91d3a06255a4efd089e0f7ccf94ada 100644 --- a/www/views.php +++ b/www/views.php @@ -1,6 +1,7 @@ <?php + // Get global config -$config = SimpleSAML_Configuration::getInstance(); +$config = SimpleSAML\Configuration::getInstance(); // Get the template -$template = new SimpleSAML_XHTML_Template($config, 'themeegi:views.tpl.php'); -$template->show(); \ No newline at end of file +$template = new SimpleSAML\XHTML\Template($config, 'themeegi:views.tpl.php'); +$template->show();