Revert rss20 to using $ENV{PATH_INFO} in self link.
[blosxom-plugins.git] / general / whoami
blob0d4ef57f53716b1a9b40300eb5a210eafd0b7d17
1 # Blosxom Plugin: whoami
2 # Author(s): Rael Dornfest <rael@oreilly.com> 
3 #  Modified: Gerfried Fuchs <alfie@ist.org>
4 #      Allows ?user=$whoami::username links to just request that user's entries
5 #      $whoami::fullname is stripped off the GECOS stuff
6 # Version: 2.0b4-5.1
7 # Documentation: See the bottom of this file or type: perldoc whoami
9 package whoami;
11 # --- Configurable variables -----
13 # --------------------------------
15 $fullname;
16 $username;
18 use File::stat qw();
19 use CGI qw(param);
21 sub start {
22   1;
25 sub story {
26   my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
28   $username = $fullname = '';
30   if ( -e "$blosxom::datadir$path/$filename.$blosxom::file_extension" ) {
31     my @user_info = getpwuid( File::stat::stat("$blosxom::datadir$path/$filename.$blosxom::file_extension")->uid );
32     ($username, $fullname) = ($user_info[0],$user_info[6] =~ m/^([^,]*)/);
33   };
35   1;
38 sub filter {
39   my $self = shift;
40   my ($files, $others) = @_;
41   if (param('user')) {
42     foreach (keys %$files) {
43       delete $files->{$_} if getpwuid((stat($_))[4]) ne param('user');
44       }
45   }
50 __END__
52 =head1 NAME
54 Blosxom Plug-in: whoami
56 =head1 SYNOPSIS
58 Populates $whoami::username and $whoami::$fullname with 
59 local username and full name, respectively, for each story.  Useful
60 for group Blosxom blogs. You can also request just the blog entries
61 of a specific username by linking things like
62 $url?user=$whoami::username.
64 =head1 VERSION
66 2.0b4-5
68 Version number coincides with the version of Blosxom with which the 
69 current version was first bundled.
71 =head1 AUTHOR
73 Rael Dornfest  <rael@oreilly.com>, http://www.raelity.org/
75 This plugin is now maintained by the Blosxom Sourceforge Team,
76 <blosxom-devel@lists.sourceforge.net>.
78 =head1 SEE ALSO
80 Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
82 Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html
84 =head1 BUGS
86 None known; please send bug reports and feedback to the Blosxom
87 development mailing list <blosxom-devel@lists.sourceforge.net>.
89 =head1 LICENSE
91 Blosxom and this Blosxom Plug-in
92 Copyright 2003, Rael Dornfest 
94 Permission is hereby granted, free of charge, to any person obtaining a
95 copy of this software and associated documentation files (the "Software"),
96 to deal in the Software without restriction, including without limitation
97 the rights to use, copy, modify, merge, publish, distribute, sublicense,
98 and/or sell copies of the Software, and to permit persons to whom the
99 Software is furnished to do so, subject to the following conditions:
101 The above copyright notice and this permission notice shall be included
102 in all copies or substantial portions of the Software.
104 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
107 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
108 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
109 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
110 OTHER DEALINGS IN THE SOFTWARE.