Apache-MiniWiki

 view release on metacpan or  search on metacpan

MiniWiki.pm  view on Meta::CPAN

  }

  my $obj = Rcs->new;
  $obj->rcsdir($datadir);
  $obj->workdir($datadir);
  $obj->file($file);

  return $obj;
}

# This function allows the user to change his or her password, if
# the perl variable "authen" is configured in the Apache configuration
# and points to a valid htpasswd file which is writeable by the user
# executing MiniWiki.
sub newpassword_function {
  my ($r, $uri) = @_;

  if ($authen eq -1) {
    return &pretty_error($r, "Authentication has been disabled in Apache::MiniWiki.");
  }

  my $q = new CGI;
  my $text;

  if ($q->param() && ($q->param('password1') eq $q->param('password2'))) {
    my $pass1 = $q->param('password1');
    $pass1 =~ s/\r//g;
    eval {
      my $htp = new Apache::Htpasswd($authen);
      $htp->htpasswd($r->connection->user, $pass1, 1);
    };
    if ($@) {
      return fatal_error($r, "$@");
    }
    $text = "Password changed.\n";
  } elsif ($q->param() && ($q->param('password1') ne $q->param('password2'))) {
    $text = "The passwords doen't match each other.\n";
  } else {
    $text = <<END;
<form method="post" action="${vroot}/(newpassword)">
<fieldset>
 New password: <input type="password" name="password1"><br/>
 Again: <input type="password" name="password2"><p>
 <input type="submit" name="Change">
 </fieldset>
</form>
END
  }
  
  $template->param('vroot', $vroot);
  $template->param('title', 'New Password');
  $template->param('body', $text);
  

MiniWiki.pm  view on Meta::CPAN


=head1 DESCRIPTION

Apache::MiniWiki is a simplistic Wiki for Apache. It doesn't have 
much uses besides very simple installations where hardly any features
are needed. What is does support though is:

  - storage of Wiki pages in RCS
  - templates through HTML::Template
  - text to HTML conversion with HTML::FromText
  - basic authentication password changes
  - uploading of binary (pdf, doc, gz, zip, ps)
  - uploading of images (jpg, jpeg, gif, png)
  - automatic thumbnailing of large using ImageMagick
  - sub directories
  - view any revision of a page
  - revert back to any revision of the page
  - basic checks to keep search engine spiders from deleting 
    all the pages in the Wiki

=head1 DEPENDENCIES

MiniWiki.pm  view on Meta::CPAN


  <Location /wiki>
     PerlAddVar datadir "/home/foo/db/wiki/"
     PerlAddVar vroot "/wiki"
     SetHandler perl-script
     PerlHandler Apache::MiniWiki
  </Location>

=head1 AUTHENTICATION EXAMPLES

  Require a password to read/write any page:
  
  <Location /wiki>
     PerlAddVar datadir "/home/foo/db/wiki/"
     PerlAddVar vroot "/wiki"
     PerlAddVar authen "/home/foo/db/htpasswd"
     SetHandler perl-script
     PerlHandler Apache::MiniWiki

     AuthType Basic
     AuthName "Sample Wiki"
     AuthUserFile /home/foo/db/htpasswd 
     Require valid-user
  </Location>

  Public can read, but need password to edit/save/revert a page:
  
  <Location /wiki>
     PerlAddVar datadir "/home/foo/db/wiki/"
     PerlAddVar vroot "/wiki"
     PerlAddVar authen "/home/foo/db/htpasswd"
     SetHandler perl-script
     PerlHandler Apache::MiniWiki

     Require valid-user # or group foo or whatever you want
     PerlAccessHandler Apache::MiniWiki::access_handler

MiniWiki.pm  view on Meta::CPAN


If you don't install a template, a default one will be used.

The C<datadir> variable defines where in the filesystem that the RCS
files that MiniWiki uses should be stored. This is also where MiniWiki
looks for a template to use.

The C<vroot> should match the virtual directory that MiniWiki runs under.

If this variable is set, it should point to a standard htpasswd file
which MiniWiki has write access to. The function to change a users password
is then enabled.
  
(Optional) The default timezone is GMT-8 (PST). To change to a different timezone, 
use the C<timediff> variable. Eg, to change to Amsterdam / Rome:

  PerlAddVar timediff 1

(Optional) By default, only the template called template is used. This becomes 
the default template for every page. Use the C<templates> variable to specify
more then one template:

README  view on Meta::CPAN

    Apache::MiniWiki - Miniature Wiki for Apache

DESCRIPTION
    Apache::MiniWiki is a simplistic Wiki for Apache. It doesn't have much
    uses besides very simple installations where hardly any features are
    needed. What is does support though is:

      - storage of Wiki pages in RCS
      - templates through HTML::Template
      - text to HTML conversion with HTML::FromText
      - basic authentication password changes
      - uploading of binary (pdf, doc, gz, zip, ps)
      - uploading of images (jpg, jpeg, gif, png)
      - automatic thumbnailing of large using ImageMagick
      - sub directories
      - view any revision of a page
      - revert back to any revision of the page
      - basic checks to keep search engine spiders from deleting 
        all the pages in the Wiki

DEPENDENCIES

README  view on Meta::CPAN

    Add this to httpd.conf:

      <Location /wiki>
         PerlAddVar datadir "/home/foo/db/wiki/"
         PerlAddVar vroot "/wiki"
         SetHandler perl-script
         PerlHandler Apache::MiniWiki
      </Location>

AUTHENTICATION EXAMPLES
      Require a password to read/write any page:
  
      <Location /wiki>
         PerlAddVar datadir "/home/foo/db/wiki/"
         PerlAddVar vroot "/wiki"
         PerlAddVar authen "/home/foo/db/htpasswd"
         SetHandler perl-script
         PerlHandler Apache::MiniWiki

         AuthType Basic
         AuthName "Sample Wiki"
         AuthUserFile /home/foo/db/htpasswd 
         Require valid-user
      </Location>

      Public can read, but need password to edit/save/revert a page:
  
      <Location /wiki>
         PerlAddVar datadir "/home/foo/db/wiki/"
         PerlAddVar vroot "/wiki"
         PerlAddVar authen "/home/foo/db/htpasswd"
         SetHandler perl-script
         PerlHandler Apache::MiniWiki

         Require valid-user # or group foo or whatever you want
         PerlAccessHandler Apache::MiniWiki::access_handler

README  view on Meta::CPAN

    If you don't install a template, a default one will be used.

    The "datadir" variable defines where in the filesystem that the RCS
    files that MiniWiki uses should be stored. This is also where MiniWiki
    looks for a template to use.

    The "vroot" should match the virtual directory that MiniWiki runs under.

    If this variable is set, it should point to a standard htpasswd file
    which MiniWiki has write access to. The function to change a users
    password is then enabled.

    (Optional) The default timezone is GMT-8 (PST). To change to a different
    timezone, use the "timediff" variable. Eg, to change to Amsterdam /
    Rome:

      PerlAddVar timediff 1

    (Optional) By default, only the template called template is used. This
    becomes the default template for every page. Use the "templates"
    variable to specify more then one template:

conf/httpd-perl-startup.pl  view on Meta::CPAN


use Apache::MiniWiki;

=head2 $wikidir
The directory where all your Wikis are located,
in individual subdirectories of their own.
=cut
my $wikidir = '/var/www/MiniWiki';

=head2 $wikipasswdfile
Path to the httpd password file for Wiki authentication.
=cut
my $wikipasswdfile = '/etc/httpd/pw/passwd';

=head2 $wikigroupfile
Path to the httpd group file for Wiki authentication.
=cut
my $wikigroupfile = '/etc/httpd/pw/group';

=head2 %wikis
A hash listing all the available Wikis and their properties,

conf/httpd-perl-startup.pl  view on Meta::CPAN


  %wikis = (
    'wiki-name' => {
      _title => 'Wiki Title',
      _uri => '/wiki-uri',
      _public => 0|1
    }
  )

All the keys are optional. If _public is 0, the Wiki will be
password-protected. If 1, it will use Apache::MiniWiki::access_handler,
which allows public viewing, and requires a password to edit
(not entirely Wiki-nature, I know).

=cut
my %wikis = (
	'lit-review' => {
		_title => "Concept Formation Annotated Bibliography",
  	_public => 0
	},
	'perl-ai' => {
		_title => "AI-Perl Resources Page",

example/template,v  view on Meta::CPAN


<TABLE border=1 align=center width="100%" bgcolor="#eaeaea" cellpadding=2 cellspacing=0>
<tr>
 <td valign=top align=right bgcolor="#c8d2dc">
   <a href="<TMPL_VAR NAME=vroot>/">Home</a>,
   <a href="<TMPL_VAR NAME=vroot>/list">Pages</a>,
   <a href="<TMPL_VAR NAME=vroot>/listlinks">Links</a>,
   <a href="<TMPL_VAR NAME=vroot>/listchanges">Changes</a>,
   <a href="<TMPL_VAR NAME=vroot>/edit">Help</a>,
   <a href="<TMPL_VAR NAME=loglink>">Archive</a>,
   <a href="<TMPL_VAR NAME=vroot>/(newpassword)">Password<sup>1</sup></a>,
   <a href="<TMPL_VAR NAME=editlink>">Edit</a>
 </td>
</tr>
<tr>
 <td align=left valign=top>
  <TMPL_VAR NAME=BODY> 
<p><hr>
<sup>1</sup>This will only work if authentification is enabled in
Apache::MiniWiki. See the POD documentation, or the manual page for
more information.

example/template,v  view on Meta::CPAN

</tr>
<tr>
 <td valign=top align=right bgcolor="#c8d2dc">
   <a href="<TMPL_VAR NAME=vroot>/">Home</a>,
   <a href="<TMPL_VAR NAME=vroot>/Main">Map</a>,
   <a href="<TMPL_VAR NAME=vroot>/list">Pages</a>,
   <a href="<TMPL_VAR NAME=vroot>/listlinks">Links</a>,
   <a href="<TMPL_VAR NAME=vroot>/listchanges">Changes</a>,
   <a href="<TMPL_VAR NAME=vroot>/edit">Help</a>,
   <a href="<TMPL_VAR NAME=loglink>">Archive</a>,
   <a href="<TMPL_VAR NAME=vroot>/(newpassword)">Password<sup>1</sup></a>,
   <a href="<TMPL_VAR NAME=editlink>">Edit</a>
 </td>
</tr>
</TABLE>
<br><div align="right"><span style="bgcolor:black; color:white; font-weight:bold">
Last Modified: <TMPL_VAR NAME=lastmod></span></div>
</body></html>
@


example/template,v  view on Meta::CPAN

1.1
log
@Initial revision
@
text
@d2 51
a52 11
  <html>
    <head><title>Example MiniWiki</title></head>
    <body>
     [<a href="<TMPL_VAR NAME=editlink>">Edit</a>|<a href="/wiki/(newpassword)">Change Password<sup>1</sup></a>]<br>
<TMPL_VAR NAME=BODY>
<p><hr>
<sup>1</sup>This will only work if authentification is enabled in
Apache::MiniWiki. See the POD documentation, or the manual page for
more information.
    </body>
  </html>
@



( run in 0.905 second using v1.01-cache-2.11-cpan-49f99fa48dc )