From 6f0e24c4207b1f76f1b4ae265b95d20f149212df Mon Sep 17 00:00:00 2001 From: rvogel Date: Wed, 30 Jan 2019 16:29:37 +0100 Subject: [PATCH] Make 'realname' and 'email' optional See https://github.com/NIIF/mediawiki-extensions-Shibboleth/issues/1 --- Shibboleth.class.php | 4 +- i18n/en.json | 2 - i18n/hu.json | 2 - skins/Vector/VectorTemplate.php | 558 ---------------------------- skins/Vector/VectorTemplate.php.ori | 542 --------------------------- 5 files changed, 2 insertions(+), 1106 deletions(-) delete mode 100644 skins/Vector/VectorTemplate.php delete mode 100644 skins/Vector/VectorTemplate.php.ori diff --git a/Shibboleth.class.php b/Shibboleth.class.php index c22a7d5..797f3e4 100644 --- a/Shibboleth.class.php +++ b/Shibboleth.class.php @@ -102,7 +102,7 @@ private function getDisplayName() { // Real name Shibboleth attribute check if (empty(filter_input(INPUT_SERVER, $displayName))) { - throw new Exception(wfMessage('shib-attr-empty-realname')->plain()); + return ''; } else { return filter_input(INPUT_SERVER, $displayName); } @@ -125,7 +125,7 @@ private function getEmail() { // E-mail shibboleth attribute check if (empty(filter_input(INPUT_SERVER, $mail))) { - throw new Exception(wfMessage('shib-attr-empty-email')->plain()); + return ''; } else { return filter_input(INPUT_SERVER, $mail); } diff --git a/i18n/en.json b/i18n/en.json index a6f94d5..0ed4ba4 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -9,8 +9,6 @@ "wg-empty-email": "The wgShibboleth_Email config is empty in LocalSettings.php", "wg-empty-username": "The wgShibboleth_Username config is empty in LocalSettings.php", "wg-empty-groupmap-attr": "A wgShibboleth_GroupMap config is empty in LocalSettings.php", - "shib-attr-empty-realname": "Shibboleth: real name attribute is not set", - "shib-attr-empty-mail": "Shibboleth: e-mail attribute is not set", "shib-attr-empty-username": "Shibboleth: username attribute is not set", "shib-attr-empty-groupmap-attr": "Shibboleth: cannot find GroupMap attribute" } diff --git a/i18n/hu.json b/i18n/hu.json index ac5def8..36c76d0 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -9,8 +9,6 @@ "wg-empty-email": "A wgShibboleth_Email paraméter üres a LocalSettings.php-ban", "wg-empty-username": "A wgShibboleth_Username paraméter üres a LocalSettings.php-ban", "wg-empty-groupmap-attr": "A wgShibboleth_GroupMap hibás vagy nem található a LocalSettings.php-ban", - "shib-attr-empty-realname": "Shibboleth: a valódi név attribútum nem található", - "shib-attr-empty-mail": "Shibboleth: e-mail attribútum nem található", "shib-attr-empty-username": "Shibboleth: felhasználónév attribútum nem található", "shib-attr-empty-groupmap-attr": "Shibboleth: a GroupMap-hez szükséges attribútum nem található vagy hibás" } diff --git a/skins/Vector/VectorTemplate.php b/skins/Vector/VectorTemplate.php deleted file mode 100644 index b426ddc..0000000 --- a/skins/Vector/VectorTemplate.php +++ /dev/null @@ -1,558 +0,0 @@ -data['namespace_urls'] = $this->data['content_navigation']['namespaces']; - $this->data['view_urls'] = $this->data['content_navigation']['views']; - $this->data['action_urls'] = $this->data['content_navigation']['actions']; - $this->data['variant_urls'] = $this->data['content_navigation']['variants']; - - // Move the watch/unwatch star outside of the collapsed "actions" menu to the main "views" menu - if ( $this->config->get( 'VectorUseIconWatch' ) ) { - $mode = $this->getSkin()->getUser()->isWatched( $this->getSkin()->getRelevantTitle() ) - ? 'unwatch' - : 'watch'; - - if ( isset( $this->data['action_urls'][$mode] ) ) { - $this->data['view_urls'][$mode] = $this->data['action_urls'][$mode]; - unset( $this->data['action_urls'][$mode] ); - } - } - $this->data['pageLanguage'] = - $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode(); - - // Output HTML Page - $this->html( 'headelement' ); - ?> -
-
-
- - data['sitenotice'] ) { - echo Html::rawElement( 'div', - [ - 'id' => 'siteNotice', - 'class' => 'mw-body-content', - ], - // Raw HTML - $this->get( 'sitenotice' ) - ); - } - if ( is_callable( [ $this, 'getIndicators' ] ) ) { - echo $this->getIndicators(); - } - // Loose comparison with '!=' is intentional, to catch null and false too, but not '0' - if ( $this->data['title'] != '' ) { - echo Html::rawElement( 'h1', - [ - 'id' => 'firstHeading', - 'class' => 'firstHeading', - 'lang' => $this->get( 'pageLanguage' ), - ], - // Raw HTML - $this->get( 'title' ) - ); - } - - $this->html( 'prebodyhtml' ); - ?> -
- data['isarticle'] ) { - echo Html::element( 'div', - [ - 'id' => 'siteSub', - 'class' => 'noprint', - ], - $this->getMsg( 'tagline' )->text() - ); - } - ?> -
html( 'userlangattributes' ) ?>>html( 'subtitle' ) - ?>
- data['undelete'] ) { - echo Html::rawElement( 'div', - [ 'id' => 'contentSub2' ], - // Raw HTML - $this->get( 'undelete' ) - ); - } - if ( $this->data['newtalk'] ) { - echo Html::rawElement( 'div', - [ 'class' => 'usermessage' ], - // Raw HTML - $this->get( 'newtalk' ) - ); - } - ?> -
- msg( 'jumpto' ) ?> - msg( 'jumptonavigation' ) - ?>msg( 'comma-separator' ) ?> - msg( 'jumptosearch' ) ?> -
- html( 'bodycontent' ); - - if ( $this->data['printfooter'] ) { - ?> -
- html( 'printfooter' ); ?> -
- data['catlinks'] ) { - $this->html( 'catlinks' ); - } - - if ( $this->data['dataAfterContent'] ) { - $this->html( 'dataAfterContent' ); - } - ?> -
- html( 'debughtml' ); ?> -
-
-
-

msg( 'navigation-heading' ) ?>

-
- renderNavigation( 'PERSONAL' ); ?> -
- renderNavigation( [ 'NAMESPACES', 'VARIANTS' ] ); ?> -
-
- renderNavigation( [ 'VIEWS', 'ACTIONS', 'SEARCH' ] ); ?> -
-
-
- - renderPortals( $this->data['sidebar'] ); ?> -
-
- - - printTrail(); ?> - - - - $content ) { - if ( $content === false ) { - continue; - } - - // Numeric strings gets an integer when set as key, cast back - T73639 - $name = (string)$name; - - switch ( $name ) { - case 'SEARCH': - break; - case 'TOOLBOX': - $this->renderPortal( 'tb', $this->getToolbox(), 'toolbox', 'SkinTemplateToolboxEnd' ); - Hooks::run( 'VectorAfterToolbox' ); - break; - case 'LANGUAGES': - if ( $this->data['language_urls'] !== false ) { - $this->renderPortal( 'lang', $this->data['language_urls'], 'otherlanguages' ); - } - break; - default: - $this->renderPortal( $name, $content ); - break; - } - } - } - - /** - * @param string $name - * @param array $content - * @param null|string $msg - * @param null|string|array $hook - */ - protected function renderPortal( $name, $content, $msg = null, $hook = null ) { - if ( $msg === null ) { - $msg = $name; - } - $msgObj = wfMessage( $msg ); - $labelId = Sanitizer::escapeId( "p-$name-label" ); - ?> - - $element ) { - switch ( $element ) { - case 'NAMESPACES': - ?> - - - - - - - - - - - - - - config->get( 'VectorUseIconWatch' ) - && ( $key === 'watch' || $key === 'unwatch' ) - ) { - $item['class'] = rtrim( 'icon ' . $item['class'], ' ' ); - $item['primary'] = true; - } - - // Add CSS class 'collapsible' to links which are not marked as "primary" - if ( - isset( $options['vector-collapsible'] ) && $options['vector-collapsible'] ) { - $item['class'] = rtrim( 'collapsible ' . $item['class'], ' ' ); - } - - // We don't use this, prevent it from popping up in HTML output - unset( $item['redundant'] ); - - return parent::makeListItem( $key, $item, $options ); - } -} - diff --git a/skins/Vector/VectorTemplate.php.ori b/skins/Vector/VectorTemplate.php.ori deleted file mode 100644 index e43e163..0000000 --- a/skins/Vector/VectorTemplate.php.ori +++ /dev/null @@ -1,542 +0,0 @@ -data['namespace_urls'] = $this->data['content_navigation']['namespaces']; - $this->data['view_urls'] = $this->data['content_navigation']['views']; - $this->data['action_urls'] = $this->data['content_navigation']['actions']; - $this->data['variant_urls'] = $this->data['content_navigation']['variants']; - - // Move the watch/unwatch star outside of the collapsed "actions" menu to the main "views" menu - if ( $this->config->get( 'VectorUseIconWatch' ) ) { - $mode = $this->getSkin()->getUser()->isWatched( $this->getSkin()->getRelevantTitle() ) - ? 'unwatch' - : 'watch'; - - if ( isset( $this->data['action_urls'][$mode] ) ) { - $this->data['view_urls'][$mode] = $this->data['action_urls'][$mode]; - unset( $this->data['action_urls'][$mode] ); - } - } - $this->data['pageLanguage'] = - $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode(); - - // Output HTML Page - $this->html( 'headelement' ); - ?> -
-
-
- - data['sitenotice'] ) { - echo Html::rawElement( 'div', - [ - 'id' => 'siteNotice', - 'class' => 'mw-body-content', - ], - // Raw HTML - $this->get( 'sitenotice' ) - ); - } - if ( is_callable( [ $this, 'getIndicators' ] ) ) { - echo $this->getIndicators(); - } - // Loose comparison with '!=' is intentional, to catch null and false too, but not '0' - if ( $this->data['title'] != '' ) { - echo Html::rawElement( 'h1', - [ - 'id' => 'firstHeading', - 'class' => 'firstHeading', - 'lang' => $this->get( 'pageLanguage' ), - ], - // Raw HTML - $this->get( 'title' ) - ); - } - - $this->html( 'prebodyhtml' ); - ?> -
- data['isarticle'] ) { - echo Html::element( 'div', - [ - 'id' => 'siteSub', - 'class' => 'noprint', - ], - $this->getMsg( 'tagline' )->text() - ); - } - ?> -
html( 'userlangattributes' ) ?>>html( 'subtitle' ) - ?>
- data['undelete'] ) { - echo Html::rawElement( 'div', - [ 'id' => 'contentSub2' ], - // Raw HTML - $this->get( 'undelete' ) - ); - } - if ( $this->data['newtalk'] ) { - echo Html::rawElement( 'div', - [ 'class' => 'usermessage' ], - // Raw HTML - $this->get( 'newtalk' ) - ); - } - ?> -
- msg( 'jumpto' ) ?> - msg( 'jumptonavigation' ) - ?>msg( 'comma-separator' ) ?> - msg( 'jumptosearch' ) ?> -
- html( 'bodycontent' ); - - if ( $this->data['printfooter'] ) { - ?> -
- html( 'printfooter' ); ?> -
- data['catlinks'] ) { - $this->html( 'catlinks' ); - } - - if ( $this->data['dataAfterContent'] ) { - $this->html( 'dataAfterContent' ); - } - ?> -
- html( 'debughtml' ); ?> -
-
-
-

msg( 'navigation-heading' ) ?>

-
- renderNavigation( 'PERSONAL' ); ?> -
- renderNavigation( [ 'NAMESPACES', 'VARIANTS' ] ); ?> -
-
- renderNavigation( [ 'VIEWS', 'ACTIONS', 'SEARCH' ] ); ?> -
-
-
- - renderPortals( $this->data['sidebar'] ); ?> -
-
- - - printTrail(); ?> - - - - $content ) { - if ( $content === false ) { - continue; - } - - // Numeric strings gets an integer when set as key, cast back - T73639 - $name = (string)$name; - - switch ( $name ) { - case 'SEARCH': - break; - case 'TOOLBOX': - $this->renderPortal( 'tb', $this->getToolbox(), 'toolbox', 'SkinTemplateToolboxEnd' ); - Hooks::run( 'VectorAfterToolbox' ); - break; - case 'LANGUAGES': - if ( $this->data['language_urls'] !== false ) { - $this->renderPortal( 'lang', $this->data['language_urls'], 'otherlanguages' ); - } - break; - default: - $this->renderPortal( $name, $content ); - break; - } - } - } - - /** - * @param string $name - * @param array $content - * @param null|string $msg - * @param null|string|array $hook - */ - protected function renderPortal( $name, $content, $msg = null, $hook = null ) { - if ( $msg === null ) { - $msg = $name; - } - $msgObj = wfMessage( $msg ); - $labelId = Sanitizer::escapeId( "p-$name-label" ); - ?> - - $element ) { - switch ( $element ) { - case 'NAMESPACES': - ?> - - - - - - - - - - - - - - config->get( 'VectorUseIconWatch' ) - && ( $key === 'watch' || $key === 'unwatch' ) - ) { - $item['class'] = rtrim( 'icon ' . $item['class'], ' ' ); - $item['primary'] = true; - } - - // Add CSS class 'collapsible' to links which are not marked as "primary" - if ( - isset( $options['vector-collapsible'] ) && $options['vector-collapsible'] ) { - $item['class'] = rtrim( 'collapsible ' . $item['class'], ' ' ); - } - - // We don't use this, prevent it from popping up in HTML output - unset( $item['redundant'] ); - - return parent::makeListItem( $key, $item, $options ); - } -} -