X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialPasswordPolicies.php;h=d09deabf27cf173db7f2156a8020ea529987b11b;hb=1f20098a8d41b19cb1d345d1a7fd13e55f7972e2;hp=0a3a6799a5f2128162b7db613fe3ac8be293cd2f;hpb=967a96e7fa5910f8fc451590decb381dbfb481ba;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialPasswordPolicies.php b/includes/specials/SpecialPasswordPolicies.php index 0a3a6799a5..d09deabf27 100644 --- a/includes/specials/SpecialPasswordPolicies.php +++ b/includes/specials/SpecialPasswordPolicies.php @@ -136,22 +136,39 @@ class SpecialPasswordPolicies extends SpecialPage { ); $ret = []; - foreach ( $groupPolicies as $gp => $val ) { - if ( $val === false ) { - // Policy isn't enabled, so no need to dislpay it + foreach ( $groupPolicies as $gp => $settings ) { + if ( !is_array( $settings ) ) { + $settings = [ 'value' => $settings ]; + } + $val = $settings['value']; + $flags = array_diff_key( $settings, [ 'value' => true ] ); + if ( !$val ) { + // Policy isn't enabled, so no need to display it continue; - } elseif ( $val === true ) { - $msg = $this->msg( 'passwordpolicies-policy-' . strtolower( $gp ) ); + } + $msg = $this->msg( 'passwordpolicies-policy-' . strtolower( $gp ) )->numParams( $val ); + $flagMsgs = []; + foreach ( array_filter( $flags ) as $flag => $value ) { + $flagMsg = $this->msg( 'passwordpolicies-policyflag-' . strtolower( $flag ) ); + $flagMsg->params( $value ); + $flagMsgs[] = $flagMsg; + } + if ( $flagMsgs ) { + $ret[] = $this->msg( + 'passwordpolicies-policy-displaywithflags', + $msg, + '' . $gp . '', + $this->getLanguage()->commaList( $flagMsgs ) + )->parse(); } else { - $msg = $this->msg( 'passwordpolicies-policy-' . strtolower( $gp ) )->numParams( $val ); + $ret[] = $this->msg( + 'passwordpolicies-policy-display', + $msg, + '' . $gp . '' + )->parse(); } - $ret[] = $this->msg( - 'passwordpolicies-policy-display', - $msg, - '' . $gp . '' - )->parse(); } - if ( !count( $ret ) ) { + if ( $ret === [] ) { return ''; } else { return '';