--- RequireRegistrationPlugin.pm.bak 2011-08-03 01:32:34.000000000 +0200 +++ RequireRegistrationPlugin.pm 2012-08-16 13:37:46.443605420 +0200 @@ -2,6 +2,7 @@ # # Copyright (C) 2000-2003 Andrea Sterbini, a.sterbini@flashnet.it # Copyright (C) 2001-2011 Peter Thoeny, peter[at]thoeny.org +# Copyright (C) 2012 W. van Engen, wvengen+twiki@nikhef.nl # and TWiki Contributors. All Rights Reserved. TWiki Contributors # are listed in the AUTHORS file in the root of this distribution. # NOTE: Please extend that file, not this notice. @@ -43,8 +44,9 @@ use strict; # ========================= -our $VERSION = '1.3 - $Rev: 21876 (2011-08-02) $'; -our $RELEASE = '2011-08-02'; +our $VERSION = '1.4'; +our $RELEASE = '2012-08-16'; +our $NO_PREFS_IN_TOPIC = 1; my $refresh; my $debug; @@ -61,22 +63,27 @@ } # this doesn't really have any meaning if we aren't being called as a CGI - my $query = &TWiki::Func::getCgiQuery(); + my $query = TWiki::Func::getCgiQuery(); return 0 unless $query; # Get refresh - $refresh = int( &TWiki::Func::getPreferencesValue("\U$pluginName\E_REFRESH") ) || 0; + $refresh = $TWiki::cfg{Plugins}{$pluginName}{Refresh} || 0; # Get plugin debug flag - $debug = &TWiki::Func::getPreferencesFlag("\U$pluginName\E_DEBUG") || 0; + $debug = $TWiki::cfg{Plugins}{$pluginName}{Debug} || 0; my $regPage = 'TWikiRegistration'; my $twikiWeb = TWiki::Func::getTwikiWebname( ); my $url = TWiki::Func::getViewUrl( $twikiWeb, $regPage ); + my $action = $query->action(); + my @actionsOnly = split(',', $TWiki::cfg{Plugins}{$pluginName}{Actions} || ''); - if (($web ne $twikiWeb || $topic ne $regPage) && (! TWiki::Func::isValidWikiWord( TWiki::Func::getWikiName( ) ))) { + if (($action ne 'register') && + ($web ne $twikiWeb || $topic ne $regPage) && + (scalar(@actionsOnly)>0 && grep(/^$action$/, @actionsOnly)>0) && + (! TWiki::Func::isValidWikiWord( TWiki::Func::getWikiName( ) ))) { - &TWiki::Func::writeDebug( "- TWiki::Plugins::$pluginName Sending $user to $url with refresh $refresh" ) + TWiki::Func::writeDebug( "- TWiki::Plugins::$pluginName Sending $user to $url with refresh $refresh" ) if $debug; if( $refresh < 0 ) {