$opts->setValue( 'month', '' );
}
- // Reset the log type to default (nothing) if it's invalid or if the
- // user does not possess the right to view it
+ // If the user doesn't have the right permission to view the specific
+ // log type, throw a PermissionsError
+ // If the log type is invalid, just show all public logs
$type = $opts->getValue( 'type' );
- if ( !LogPage::isLogType( $type )
- || ( isset( $wgLogRestrictions[$type] )
- && !$this->getUser()->isAllowed( $wgLogRestrictions[$type] ) )
- ) {
+ if ( !LogPage::isLogType( $type ) ) {
$opts->setValue( 'type', '' );
+ } elseif ( isset( $wgLogRestrictions[$type] ) && !$this->getUser()->isAllowed( $wgLogRestrictions[$type] ) ) {
+ throw new PermissionsError( $wgLogRestrictions[$type] );
}
# Handle type-specific inputs
# Some log types are only for a 'User:' title but we might have been given
# only the username instead of the full title 'User:username'. This part try
# to lookup for a user by that name and eventually fix user input. See bug 1697.
+ wfRunHooks( 'GetLogTypesOnUser', array( &$this->typeOnUser ) );
if ( in_array( $opts->getValue( 'type' ), $this->typeOnUser ) ) {
# ok we have a type of log which expect a user title.
$target = Title::newFromText( $opts->getValue( 'page' ) );