X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fblosxom-plugins.git;a=blobdiff_plain;f=general%2Fwhoami;h=0d4ef57f53716b1a9b40300eb5a210eafd0b7d17;hp=0caf82a8c5aa8311c77f71af42fae9462759ff36;hb=d3f68ae80b1153a95e918c057b6304063797efc3;hpb=ebb08aa6d3f16303068fc794c1135dcbc8a5be0e diff --git a/general/whoami b/general/whoami index 0caf82a..0d4ef57 100644 --- a/general/whoami +++ b/general/whoami @@ -1,6 +1,9 @@ # Blosxom Plugin: whoami # Author(s): Rael Dornfest -# Version: 2.0b4-5 +# Modified: Gerfried Fuchs +# Allows ?user=$whoami::username links to just request that user's entries +# $whoami::fullname is stripped off the GECOS stuff +# Version: 2.0b4-5.1 # Documentation: See the bottom of this file or type: perldoc whoami package whoami; @@ -12,7 +15,8 @@ package whoami; $fullname; $username; -use File::stat; +use File::stat qw(); +use CGI qw(param); sub start { 1; @@ -24,13 +28,23 @@ sub story { $username = $fullname = ''; if ( -e "$blosxom::datadir$path/$filename.$blosxom::file_extension" ) { - my @user_info = getpwuid( stat("$blosxom::datadir$path/$filename.$blosxom::file_extension")->uid ); - ($username, $fullname) = ($user_info[0],$user_info[6]); + my @user_info = getpwuid( File::stat::stat("$blosxom::datadir$path/$filename.$blosxom::file_extension")->uid ); + ($username, $fullname) = ($user_info[0],$user_info[6] =~ m/^([^,]*)/); }; 1; } +sub filter { + my $self = shift; + my ($files, $others) = @_; + if (param('user')) { + foreach (keys %$files) { + delete $files->{$_} if getpwuid((stat($_))[4]) ne param('user'); + } + } +} + 1; __END__ @@ -43,7 +57,9 @@ Blosxom Plug-in: whoami Populates $whoami::username and $whoami::$fullname with local username and full name, respectively, for each story. Useful -for group Blosxom blogs. +for group Blosxom blogs. You can also request just the blog entries +of a specific username by linking things like +$url?user=$whoami::username. =head1 VERSION @@ -56,16 +72,19 @@ current version was first bundled. Rael Dornfest , http://www.raelity.org/ +This plugin is now maintained by the Blosxom Sourceforge Team, +. + =head1 SEE ALSO -Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/ +Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/ -Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml +Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html =head1 BUGS -Address bug reports and comments to the Blosxom mailing list -[http://www.yahoogroups.com/group/blosxom]. +None known; please send bug reports and feedback to the Blosxom +development mailing list . =head1 LICENSE