master
joey 2006-11-22 14:28:38 +00:00
parent 00c6f9e5cb
commit 04a9dbfe7d
10 changed files with 57 additions and 24 deletions

View File

@ -478,20 +478,13 @@ sub cgi_editpage ($$) { #{{{
$content=~s/\r/\n/g;
writefile($file, $config{srcdir}, $content);
my $message="web commit ";
if (defined $session->param("name") &&
length $session->param("name")) {
$message.="by ".$session->param("name");
}
else {
$message.="from $ENV{REMOTE_ADDR}";
}
if (defined $form->field('comments') &&
length $form->field('comments')) {
$message.=": ".$form->field('comments');
}
if ($config{rcs}) {
my $message="";
if (defined $form->field('comments') &&
length $form->field('comments')) {
$message=$form->field('comments');
}
if ($newfile) {
rcs_add($file);
}
@ -500,7 +493,8 @@ sub cgi_editpage ($$) { #{{{
# presumably the commit will trigger an update
# of the wiki
my $conflict=rcs_commit($file, $message,
$form->field("rcsinfo"));
$form->field("rcsinfo"),
$session->param("name"), $ENV{REMOTE_ADDR});
if (defined $conflict) {
$form->field(name => "rcsinfo", value => rcs_prepedit($file),

View File

@ -94,8 +94,11 @@ sub preprocess_toggleable (@) { #{{{
my $id=genid($params{page}, $params{id});
# Should really be a postprocessor directive, oh well. Work around
# markdown's dislike of markdown inside a <div>.
return "<div class=\"toggleable\" id=\"$id\"></div>\n\n$params{text}\n<div class=\"toggleableend\"></div>";
# markdown's dislike of markdown inside a <div> with various funky
# whitespace.
my ($indent)=$params{text}=~/( +)$/;
$indent="" unless defined $indent;
return "<div class=\"toggleable\" id=\"$id\"></div>\n\n$params{text}\n$indent<div class=\"toggleableend\"></div>";
} # }}}
sub format (@) { #{{{

View File

@ -20,7 +20,7 @@ sub rcs_prepedit ($) {
return ""
}
sub rcs_commit ($$$) {
sub rcs_commit ($$$;$$) {
# Tries to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on failure.
# The file is relative to the srcdir.

View File

@ -294,12 +294,19 @@ sub rcs_prepedit ($) { #{{{
return git_sha1($file);
} #}}}
sub rcs_commit ($$$) { #{{{
sub rcs_commit ($$$;$$) { #{{{
# Try to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on
# failure.
my ($file, $message, $rcstoken) = @_;
my ($file, $message, $rcstoken, $user, $ipaddr) = @_;
if (defined $user) {
$message="web commit by $user".(length $message ? ": $message" : "");
}
elsif (defined $ipaddr) {
$message="web commit from $ipaddr".(length $message ? ": $message" : "");
}
# XXX: Wiki directory is in the unlocked state when starting this
# action. But it takes time for a Git process to finish its job

View File

@ -66,7 +66,14 @@ sub rcs_prepedit ($) { #{{{
} #}}}
sub rcs_commit ($$$) { #{{{
my ($file, $message, $rcstoken) = @_;
my ($file, $message, $rcstoken, $user, $ipaddr) = @_;
if (defined $user) {
$message="web commit by $user".(length $message ? ": $message" : "");
}
elsif (defined $ipaddr) {
$message="web commit from $ipaddr".(length $message ? ": $message" : "");
}
$message = possibly_foolish_untaint($message);

View File

@ -60,13 +60,22 @@ sub rcs_prepedit ($) { #{{{
}
} #}}}
sub rcs_commit ($$$) { #{{{
sub rcs_commit ($$$;$$) { #{{{
# Tries to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on failure.
# The file is relative to the srcdir.
my $file=shift;
my $message=shift;
my $rcstoken=shift;
my $user=shift;
my $ipaddr=shift;
if (defined $user) {
$message="web commit by $user".(length $message ? ": $message" : "");
}
elsif (defined $ipaddr) {
$message="web commit from $ipaddr".(length $message ? ": $message" : "");
}
if (-d "$config{srcdir}/.svn") {
# Check to see if the page has been changed by someone

View File

@ -38,10 +38,19 @@ sub rcs_prepedit ($) { #{{{
}
} #}}}
sub rcs_commit ($$$) { #{{{
sub rcs_commit ($$$;$$) { #{{{
my $file=shift;
my $message=shift;
my $rcstoken=shift;
my $user=shift;
my $ipaddr=shift;
if (defined $user) {
$message="web commit by $user".(length $message ? ": $message" : "");
}
elsif (defined $ipaddr) {
$message="web commit from $ipaddr".(length $message ? ": $message" : "");
}
if (-d "$config{srcdir}/{arch}") {
# Check to see if the page has been changed by someone

5
debian/changelog vendored
View File

@ -40,8 +40,11 @@ ikiwiki (1.34) UNRELEASED; urgency=low
* Daemonize before sending commit mails, as that can also take a long
time/hang if the mail server is unhappy.
* Factor out commit mail sending code into new function.
* Change rcs_commit, it is now passed the name of the user doing the commit
and their IP address, and needs to construct its own commit message
containing them, or do something more appropriate for the given RCS.
-- Joey Hess <joeyh@debian.org> Tue, 21 Nov 2006 19:25:14 -0500
-- Joey Hess <joeyh@debian.org> Wed, 22 Nov 2006 09:08:37 -0500
ikiwiki (1.33) unstable; urgency=low

View File

@ -18,7 +18,8 @@ Thanks! --[[Joey]]
"""]]
* [[Setup]] has a tutorial for setting up ikiwiki, and [[Usage]] documents
the parameters and usage of the ikiwiki program.
the parameters and usage of the ikiwiki program. There are some
[[examples]] of things you can do with ikiwiki.
* [[Security]] lists potential security problems. ikiwiki is still being
developed, and is being written with security as a priority, so don't