Add a bunch of Rael plugins.
[matthijs/upstream/blosxom-plugins.git] / general / isp
1 # Blosxom Plugin: isp
2 # Author(s): Rael Dornfest <rael@oreilly.com> 
3 # Version: 2.0b3
4 # Documentation: See the bottom of this file or type: perldoc readme
5
6 package isp;
7
8 # --- Configurable variables -----
9
10 # What bit of the URL should I treat as username?
11 # Be sure the username bit is caught by the first () in the regular expression,
12 # e.g. /~(.*)/weblog matches "sam" in http://www.example/~sam/weblog
13
14 my $url_match = q!/~(.*?)/weblog!;
15
16 # Where should I look for the user's Blosxom data directory ($datadir)?
17 # Assume $username is populated by the results of the regular expression match
18 # above, e.g. /home/sam/weblog
19
20 my $user_datadir = q!/home/$username/weblog!;
21
22 # Where should plug-ins keep their state for each user?
23 # You should create this directory for them or no state will be saved.
24
25 my $user_plugin_state_dir = q!/home/$username/.weblog/plugins/state!;
26
27 # --------------------------------
28
29 use CGI qw/:standard/;
30
31 sub start {
32   url() =~ /$url_match/ or return 0;
33   my $username = $1;
34   
35   $blosxom::datadir = $user_datadir and $blosxom::datadir =~ s!\$username!$username!;
36   $blosxom::plugin_state_dir = $user_plugin_state_dir and $blosxom::plugin_state_dir =~ s!\$username!$username!;
37
38   
39   1;
40 }
41
42 1;
43
44 __END__
45
46 =head1 NAME
47
48 Blosxom Plug-in: isp
49
50 =head1 SYNOPSIS
51
52 This plug-in is designed for the ISP looking to provide Blosxom weblogs to all of its users.
53
54 It traps URLs of the form /~username/weblog (as defined by $url_match), setting
55 $blosxom::datadir to an appropriate directory (as defined by $user_datadir) in
56 "username"'s home directory.
57
58 =head2 Usage
59
60 Be sure this plug-in sits BEFORE all other plug-ins.  To force this, rename it 
61 to 00isp.
62  
63 This plugin works in concert with the "config" plug-in, without which it
64 won't allow individual users to override the global Blosxom configuration by
65 placing config files in their $datadir.
66
67 Aside from this simple renaming, about all that should be needed is to 
68 ScriptAlias /~username/weblog to /cgi-bin/blosxom.cgi, replacing the paths as 
69 appropriate to your particular setup, of course.
70
71 =head2 Warning
72
73 Be sure to choose a $user_datadir _outside_ of the user's personal 
74 Web-accessible document-root.  In other words, don't use a $user_datadir of
75 /home/$username/www/weblog or the like, where anything under /home/$username/www
76 is world-readable.
77
78 =head2 Limitations
79
80 This plug-in doesn't allow for users to add their own plug-ins to their own plugin directories.  There's a race condition in this I've not yet worked my way around, but I have it in mind.
81
82 =head1 VERSION
83
84 2.0b3
85
86 Version number coincides with the version of Blosxom with which the 
87 current version was first bundled.
88
89 =head1 AUTHOR
90
91 Rael Dornfest  <rael@oreilly.com>, http://www.raelity.org/
92
93 =head1 SEE ALSO
94
95 Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
96
97 Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
98
99 =head1 BUGS
100
101 Address bug reports and comments to the Blosxom mailing list 
102 [http://www.yahoogroups.com/group/blosxom].
103
104 =head1 LICENSE
105
106 Blosxom and this Blosxom Plug-in
107 Copyright 2003, Rael Dornfest 
108
109 Permission is hereby granted, free of charge, to any person obtaining a
110 copy of this software and associated documentation files (the "Software"),
111 to deal in the Software without restriction, including without limitation
112 the rights to use, copy, modify, merge, publish, distribute, sublicense,
113 and/or sell copies of the Software, and to permit persons to whom the
114 Software is furnished to do so, subject to the following conditions:
115
116 The above copyright notice and this permission notice shall be included
117 in all copies or substantial portions of the Software.
118
119 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
120 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
121 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
122 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
123 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
124 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
125 OTHER DEALINGS IN THE SOFTWARE.