From: Andrew Engelbrecht Date: Fri, 19 Nov 2021 18:46:47 +0000 (-0500) Subject: create fsf theme with upstream header.php X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3a02034d1b2d63878b854deb5a0ee8b35d8e2076;p=fsfdrupalauth.git create fsf theme with upstream header.php https://simplesamlphp.org/docs/stable/simplesamlphp-theming --- diff --git a/themes/fsftheme/default/includes/header.php b/themes/fsftheme/default/includes/header.php new file mode 100644 index 0000000..208139d --- /dev/null +++ b/themes/fsftheme/default/includes/header.php @@ -0,0 +1,213 @@ +data['htmlinject'] = [ + 'htmlContentPre' => [], + 'htmlContentPost' => [], + 'htmlContentHead' => [], +]; + +$jquery = []; +if (array_key_exists('jquery', $this->data)) { + $jquery = $this->data['jquery']; +} + +if (array_key_exists('pageid', $this->data)) { + $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 - + +/** + * Do not allow to frame SimpleSAMLphp pages from another location. + * This prevents clickjacking attacks in modern browsers. + * + * If you don't want any framing at all you can even change this to + * 'DENY', or comment it out if you actually want to allow foreign + * sites to put SimpleSAMLphp in a frame. The latter is however + * probably not a good security practice. + */ +header('X-Frame-Options: SAMEORIGIN'); + +?> + + + + + +<?php +if (array_key_exists('header', $this->data)) { + echo $this->data['header']; +} else { + echo 'SimpleSAMLphp'; +} +?> + + + + +data['baseurlpath'].'resources/jquery-1.8.js">'."\n"; + } + + if (isset($jquery['ui']) && $jquery['ui']) { + echo ''."\n"; + } + + if (isset($jquery['css']) && $jquery['css']) { + echo ''."\n"; + } + } +} + +if (isset($this->data['clipboard.js'])) { + echo ''."\n"; +} + +if (!empty($this->data['htmlinject']['htmlContentHead'])) { + foreach ($this->data['htmlinject']['htmlContentHead'] as $c) { + echo $c; + } +} + +if ($this->isLanguageRTL()) { + ?> + + + + +data)) { + echo ''.$this->data['head'].''; +} +?> + +data)) { + $onLoad .= ' onload="SimpleSAML_focus(\''.$this->data['autofocus'].'\');"'; +} +?> +> + +
+ + + + + data['hideLanguageBar']) && $this->data['hideLanguageBar'] === true) { + $includeLanguageBar = false; + } + + if ($includeLanguageBar) { + $languages = $this->getLanguageList(); + ksort($languages); + if (count($languages) > 1) { + echo '
'; + $langnames = [ + 'no' => 'Bokmål', // Norwegian Bokmål + 'nn' => 'Nynorsk', // Norwegian Nynorsk + 'se' => 'Sámegiella', // Northern Sami + 'da' => 'Dansk', // Danish + 'en' => 'English', + 'de' => 'Deutsch', // German + 'sv' => 'Svenska', // Swedish + 'fi' => 'Suomeksi', // Finnish + 'es' => 'Español', // Spanish + 'ca' => 'Català', // Catalan + '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 + 'he' => 'עִבְרִית', // Hebrew + 'id' => 'Bahasa Indonesia', // Indonesian + 'sr' => 'Srpski', // Serbian + 'lv' => 'Latviešu', // Latvian + 'ro' => 'Românește', // Romanian + 'eu' => 'Euskara', // Basque + 'af' => 'Afrikaans', // Afrikaans + 'zu' => 'IsiZulu', // Zulu + 'xh' => 'isiXhosa', // Xhosa + 'st' => 'Sesotho', // Sesotho + ]; + + $textarray = []; + foreach ($languages as $lang => $current) { + $lang = strtolower($lang); + if ($current) { + $textarray[] = $langnames[$lang]; + } else { + $textarray[] = ''.$langnames[$lang].''; + } + } + echo join(' | ', $textarray); + echo '
'; + } + } + + ?> +
+ +data['htmlinject']['htmlContentPre'])) { + foreach ($this->data['htmlinject']['htmlContentPre'] as $c) { + echo $c; + } +} +$config = \SimpleSAML\Configuration::getInstance(); +if(! $config->getBoolean('production', true)) { + echo '
' . $this->t('{preprodwarning:warning:warning}'). '
'; +}