X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/54f600af14bf6dc067ffc30ec6f22d517001fe99..dae4a144e7219ce596f9d96206176a3d1d1ad4a5:/IkiWiki/Plugin/rename.pm

diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
index 1a9da6363..a05e85be0 100644
--- a/IkiWiki/Plugin/rename.pm
+++ b/IkiWiki/Plugin/rename.pm
@@ -63,9 +63,8 @@ sub check_canrename ($$$$$$) {
 			error(gettext("no change to the file name was specified"));
 		}
 
-		# Must be a legal filename, and not absolute.
-		if (IkiWiki::file_pruned($destfile, $config{srcdir}) || 
-		    $destfile=~/^\//) {
+		# Must be a legal filename.
+		if (IkiWiki::file_pruned($destfile)) {
 			error(sprintf(gettext("illegal name")));
 		}
 
@@ -109,6 +108,7 @@ sub check_canrename ($$$$$$) {
 			}
 		}
 	});
+	return defined $canrename ? $canrename : 1;
 }
 
 sub rename_form ($$$) {
@@ -127,11 +127,13 @@ sub rename_form ($$$) {
 		javascript => 0,
 		params => $q,
 		action => $config{cgiurl},
-		stylesheet => IkiWiki::baseurl()."style.css",
+		stylesheet => 1,
 		fields => [qw{do page new_name attachment}],
 	);
 	
 	$f->field(name => "do", type => "hidden", value => "rename", force => 1);
+	$f->field(name => "sid", type => "hidden", value => $session->id,
+		force => 1);
 	$f->field(name => "page", type => "hidden", value => $page, force => 1);
 	$f->field(name => "new_name", value => pagetitle($page, 1), size => 60);
 	if (!$q->param("attachment")) {
@@ -287,6 +289,8 @@ sub sessioncgi ($$) {
 			postrename($session);
 		}
 		elsif ($form->submitted eq 'Rename' && $form->validate) {
+			IkiWiki::checksessionexpiry($q, $session, $q->param('sid'));
+
 			# Queue of rename actions to perfom.
 			my @torename;
 
@@ -346,8 +350,9 @@ sub sessioncgi ($$) {
 				$pagesources{$rename->{src}}=$rename->{destfile};
 			}
 			IkiWiki::rcs_commit_staged(
-				sprintf(gettext("rename %s to %s"), $srcfile, $destfile),
-				$session->param("name"), $ENV{REMOTE_ADDR}) if $config{rcs};
+				message => sprintf(gettext("rename %s to %s"), $srcfile, $destfile),
+				session => $session,
+			) if $config{rcs};
 
 			# Then link fixups.
 			foreach my $rename (@torename) {
@@ -569,11 +574,10 @@ sub fixlinks ($$$) {
 				eval { writefile($file, $config{srcdir}, $content) };
 				next if $@;
 				my $conflict=IkiWiki::rcs_commit(
-					$file,
-					sprintf(gettext("update for rename of %s to %s"), $rename->{srcfile}, $rename->{destfile}),
-					$token,
-					$session->param("name"), 
-					$ENV{REMOTE_ADDR}
+					file => $file,
+					message => sprintf(gettext("update for rename of %s to %s"), $rename->{srcfile}, $rename->{destfile}),
+					token => $token,
+					session => $session,
 				);
 				push @fixedlinks, $page if ! defined $conflict;
 			}