From: kirinji <kirinji@b7d4c41f-bb2b-0410-be1d-d0fb2b8774c1>
Date: Wed, 29 Aug 2007 23:02:56 +0000 (+0000)
Subject: More alterations made.
X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=1553f195cb1ca50f1409afec52b29002e03b4511;p=kiriwrite%2F.git

More alterations made.
---

diff --git a/cgi-files/Modules/Database/MySQL5.pm b/cgi-files/Modules/Database/MySQL5.pm
index d2c9c17..c398c6d 100644
--- a/cgi-files/Modules/Database/MySQL5.pm
+++ b/cgi-files/Modules/Database/MySQL5.pm
@@ -27,7 +27,7 @@ package Kiriwrite::Database::MySQL5;
 
 use strict;
 use warnings;
-use Encode qw();
+use Encode qw(decode_utf8);
 
 # Load the following Perl modules.
 
@@ -625,49 +625,6 @@ sub getdblist{
 
 }
 
-sub getseconddatabaseinfo{
-#################################################################################
-# getseconddatabaseinfo: Get information about the database that pages will be	#
-# moved or copied to.								#
-#										#
-# Usage:									#
-#										#
-# $dbmodule->getseconddatabaseinfo();						#
-#################################################################################
-
-
-	# Get the database information.
-
-	my $class = shift;
-	my ($databaseinfo, %databaseinfo);
-	my ($sqldata, @sqldata);
-
-	$error = "";
-	$errorext = "";
-
-	$string_handle = $database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return );
-	$string_handle->execute();
-
-	@sqldata = $string_handle->fetchrow_array();
-
-	# Process the database information into a hash.
-
-	%databaseinfo = (
-		"DatabaseName"	=> decode_utf8($sqldata[0]),
-		"Description"	=> decode_utf8($sqldata[1]),
-		"Notes"		=> decode_utf8($sqldata[2]),
-		"Categories"	=> decode_utf8($sqldata[3]),
-		"Major"		=> decode_utf8($sqldata[4]),
-		"Minor"		=> decode_utf8($sqldata[5]),
-		"Revision"	=> decode_utf8($sqldata[6])
-	);
-
-	$string_handle->finish();
-
-	return %databaseinfo;
-
-}
-
 sub selectdb{
 #################################################################################
 # selectdb: Selects the Kiriwrite database.					#
@@ -708,6 +665,48 @@ sub selectdb{
 
 }
 
+sub getdatabaseinfo{
+#################################################################################
+# getdatabaseinfo: Get information about the database.				#
+#										#
+# Usage:									#
+#										#
+# $dbmodule->getdatabaseinfo();							#
+#################################################################################
+
+	# Get the database information.
+
+	$error = "";
+	$errorext = "";
+
+	my $class = shift;
+	my ($databaseinfo, %databaseinfo);
+	my ($sqldata, @sqldata);
+
+	$string_handle = $database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return );
+	$string_handle->execute();
+
+	@sqldata = $string_handle->fetchrow_array();
+
+	# Process the database information into a hash.
+
+	%databaseinfo = (
+
+		"DatabaseName"	=> decode_utf8($sqldata[0]),
+		"Description"	=> decode_utf8($sqldata[1]),
+		"Notes"		=> decode_utf8($sqldata[2]),
+		"Categories"	=> decode_utf8($sqldata[3]),
+		"Major"		=> decode_utf8($sqldata[4]),
+		"Minor"		=> decode_utf8($sqldata[5]),
+		"Revision"	=> decode_utf8($sqldata[6])
+	);
+
+	$string_handle->finish();
+
+	return %databaseinfo;
+
+}
+
 sub selectseconddb{
 #################################################################################
 # selectseconddb: Selects a second Kiriwrite database for moving and copying 	#
@@ -754,25 +753,27 @@ sub selectseconddb{
 
 }
 
-sub getdatabaseinfo{
+sub getseconddatabaseinfo{
 #################################################################################
-# getdatabaseinfo: Get information about the database.				#
+# getseconddatabaseinfo: Get information about the database that pages will be	#
+# moved or copied to.								#
 #										#
 # Usage:									#
 #										#
-# $dbmodule->getdatabaseinfo();							#
+# $dbmodule->getseconddatabaseinfo();						#
 #################################################################################
 
-	# Get the database information.
 
-	$error = "";
-	$errorext = "";
+	# Get the database information.
 
 	my $class = shift;
 	my ($databaseinfo, %databaseinfo);
 	my ($sqldata, @sqldata);
 
-	$string_handle = $database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return );
+	$error = "";
+	$errorext = "";
+
+	$string_handle = $database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return );
 	$string_handle->execute();
 
 	@sqldata = $string_handle->fetchrow_array();
@@ -780,7 +781,6 @@ sub getdatabaseinfo{
 	# Process the database information into a hash.
 
 	%databaseinfo = (
-
 		"DatabaseName"	=> decode_utf8($sqldata[0]),
 		"Description"	=> decode_utf8($sqldata[1]),
 		"Notes"		=> decode_utf8($sqldata[2]),
@@ -1211,7 +1211,7 @@ sub addtemplate{
 #										#
 # Usage:									#
 #										#
-# $dbmodule->addtemplate();							#
+# $dbmodule->addtemplate(options);						#
 #										#
 # options	Specifies the following options in any order.			#
 #										#
@@ -1325,58 +1325,6 @@ sub addtemplate{
 
 }
 
-sub deletetemplate{
-#################################################################################
-# deletetemplate: Deletes a template from the template database.		#
-#										#
-# Usage:									#
-#										#
-# $dbmodule->deletetemplate(options);						#
-#										#
-# options	Specifies the following options in any order.			#
-#										#
-# TemplateFilename	Specifies the template filename to delete.		#
-#################################################################################
-
-	$error = "";
-	$errorext = "";
-
-	# Get the data passed to the subroutine.
-
-	my $class = shift;
-	my ($passedoptions) = @_;
-
-	my @pagedata;
-	my $template_filename = $passedoptions->{"TemplateFilename"};
-	my $template_count = 0;
-
-	# Check if the template exists.
-
-	$string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return );
-	$string_handle->execute();
-
-	while (@pagedata = $string_handle->fetchrow_array()){
-
-		$template_count++;
-
-	}
-
-	if ($template_count eq 0){
-
-		# No pages were returned so return an error value.
-
-		$error = "TemplateDoesNotExist";
-		return;
-
-	}
-
-	# Delete the template from the template database.
-
-	$string_handle = $database_handle->prepare('DELETE FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return );
-	$string_handle->execute();
-
-}
-
 sub edittemplate{
 #################################################################################
 # editttemplate: Edits a Kiriwrite template.					#
@@ -1449,6 +1397,58 @@ sub edittemplate{
 
 }
 
+sub deletetemplate{
+#################################################################################
+# deletetemplate: Deletes a template from the template database.		#
+#										#
+# Usage:									#
+#										#
+# $dbmodule->deletetemplate(options);						#
+#										#
+# options	Specifies the following options in any order.			#
+#										#
+# TemplateFilename	Specifies the template filename to delete.		#
+#################################################################################
+
+	$error = "";
+	$errorext = "";
+
+	# Get the data passed to the subroutine.
+
+	my $class = shift;
+	my ($passedoptions) = @_;
+
+	my @pagedata;
+	my $template_filename = $passedoptions->{"TemplateFilename"};
+	my $template_count = 0;
+
+	# Check if the template exists.
+
+	$string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return );
+	$string_handle->execute();
+
+	while (@pagedata = $string_handle->fetchrow_array()){
+
+		$template_count++;
+
+	}
+
+	if ($template_count eq 0){
+
+		# No pages were returned so return an error value.
+
+		$error = "TemplateDoesNotExist";
+		return;
+
+	}
+
+	# Delete the template from the template database.
+
+	$string_handle = $database_handle->prepare('DELETE FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return );
+	$string_handle->execute();
+
+}
+
 #################################################################################
 # Page subroutines.								#
 #################################################################################
@@ -1794,6 +1794,33 @@ sub editpage{
 
 	}
 
+	# Check if there is a page that already exists with the new
+	# filename.
+
+	if ($page_filename ne $page_newfilename){
+
+		$string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_newfilename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return );
+		$string_handle->execute();
+
+		# Check if a page really is using the new filename.
+
+		while (@page_info = $string_handle->fetchrow_array()){
+
+			# The page information is found.
+
+			$page_found = 1;
+
+		}
+
+		if ($page_found eq 1){
+
+			$error = "PageAlreadyExists";
+			return;
+
+		}
+
+	}
+
 	# Get the current date.
 
  	my ($created_second, $created_minute, $created_hour, $created_day, $created_month, $created_year, $created_weekday, $created_yearday, $created_dst) = localtime;
@@ -2072,7 +2099,7 @@ sub connectfilter{
 
 	# Check if the template database exists.
 
-	$string_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_filters\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return );
+	$string_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_filters\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return );
 	$string_handle->execute();
 
 	while (@filterdb_check = $string_handle->fetchrow_array()){
diff --git a/cgi-files/Modules/Database/SQLite.pm b/cgi-files/Modules/Database/SQLite.pm
index 270f8fa..31d0dee 100644
--- a/cgi-files/Modules/Database/SQLite.pm
+++ b/cgi-files/Modules/Database/SQLite.pm
@@ -38,10 +38,12 @@ our $VERSION 	= "0.1.0";
 my ($options, %options);
 my $database_handle;
 my $string_handle;
-my $second_database_handle;
-my $second_string_handle;
+my $error = "";
+my $errorext = "";
 my $database_filename;
 my $second_database_filename;
+my $second_database_handle;
+my $second_string_handle;
 my $templatedb_loaded = 0;
 my $templatedb_exists = 1;
 my $template_string_handle;
@@ -50,8 +52,7 @@ my $filterdb_loaded = 0;
 my $filterdb_exists = 1;
 my $filterdb_string_handle;
 my $filterdb_database_handle;
-my $error = "";
-my $errorext = "";
+
 
 #################################################################################
 # Generic Subroutines.								#
@@ -1481,6 +1482,33 @@ sub editpage{
 
 	}
 
+	# Check if there is a page that already exists with the new
+	# filename.
+
+	if ($page_filename ne $page_newfilename){
+
+		$string_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_newfilename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return );
+		$string_handle->execute();
+
+		# Check if a page really is using the new filename.
+
+		while (@page_info = $string_handle->fetchrow_array()){
+
+			# The page information is found.
+
+			$page_found = 1;
+
+		}
+
+		if ($page_found eq 1){
+
+			$error = "PageExists";
+			return;
+
+		}
+
+	}
+
 	# Get the current date.
 
  	my ($created_second, $created_minute, $created_hour, $created_day, $created_month, $created_year, $created_weekday, $created_yearday, $created_dst) = localtime;
diff --git a/cgi-files/Modules/Presentation/HTML4S.pm b/cgi-files/Modules/Presentation/HTML4S.pm
index 74d7004..3e7e92c 100644
--- a/cgi-files/Modules/Presentation/HTML4S.pm
+++ b/cgi-files/Modules/Presentation/HTML4S.pm
@@ -44,7 +44,7 @@ sub new{
 # 										#
 # Usage:									#
 #										#
-# $presmodule = Modules::Output::HTML4S->new();					#
+# $presmodule = Kiriwrite::Presentation::HTML4S->new();				#
 #################################################################################
 	
 	# Get the perl module name.
@@ -736,7 +736,7 @@ sub addcheckbox{
 	}
 
 	if ($linebreak eq 1){
-		$tagdata = $tagdata . "<br>";
+		addlinebreak();
 	}
 
 	$tagdata = $tagdata . "\r\n";
@@ -1242,7 +1242,7 @@ sub addtextbox{
 	}	
 
 	$tagdata = $tagdata . ">";
-	$tagdata = $tagdata . $value;
+	$tagdata = $tagdata . $class->convert($value, "content");
 	$tagdata = $tagdata . "</textarea>" . "\r\n";
 
 	# Append the tag data to the page data.
@@ -1785,7 +1785,7 @@ sub addboldtext{
 	# Add some bold text.
 
 	if ($style ne ""){
-		$tagdata = $tagdata . "<span class=\"\">" . $class->convert($text, "content") . "</span>";
+		$tagdata = $tagdata . "<span class=\"" . $style . "\">" . $class->convert($text, "content") . "</span>";
 	} else {
 		$tagdata = $tagdata . "<b>" . $class->convert($text, "content") . "</b>";
 	}
diff --git a/cgi-files/kiriwrite.cgi b/cgi-files/kiriwrite.cgi
index 267277e..85d6a2d 100755
--- a/cgi-files/kiriwrite.cgi
+++ b/cgi-files/kiriwrite.cgi
@@ -583,12 +583,14 @@ sub kiriwrite_page_add{
 		# write out the form for adding a page.
 
 		$kiriwrite_presmodule->addtext($kiriwrite_lang->{pages}->{addpage}, { Style => "pageheader" });
-		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");#
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "page");
 		$kiriwrite_presmodule->addhiddendata("action", "add");
  		$kiriwrite_presmodule->addhiddendata("database", $pagedatabase);
 		$kiriwrite_presmodule->addhiddendata("confirm", "1");
 		$kiriwrite_presmodule->addlinebreak();
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->starttable("", { CellPadding => 5, CellSpacing => 0 });
 
 		$kiriwrite_presmodule->startheader();
@@ -727,14 +729,17 @@ sub kiriwrite_page_add{
 
 		$kiriwrite_presmodule->endtable();
 
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{pages}->{addpagebutton});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addreset($kiriwrite_lang->{common}->{clearvalues});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=page&action=view&database=" . $pagedatabase, { Text => kiriwrite_language($kiriwrite_lang->{pages}->{returnpagelist}, $database_name) });
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
+
 		return $kiriwrite_presmodule->grab();
 
 	} else {
@@ -1034,6 +1039,7 @@ sub kiriwrite_page_delete{
 
 		$kiriwrite_presmodule->addtext(kiriwrite_language($kiriwrite_lang->{pages}->{deletepage}, $page_name), { Style => "pageheader" });
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "page");
 		$kiriwrite_presmodule->addhiddendata("action", "delete");
 		$kiriwrite_presmodule->addhiddendata("database", $database);
@@ -1046,6 +1052,7 @@ sub kiriwrite_page_delete{
 		$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{pages}->{deletepagebutton});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=page&action=view&database=" . $database, { Text => kiriwrite_language($kiriwrite_lang->{pages}->{deletepagesreturnlink}, $database_name)});
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
@@ -1066,7 +1073,7 @@ sub kiriwrite_page_edit{
 #										#
 # Usage:									#
 #										#
-# kiriwrite_page_edit(database, filename, newname, newfilename, newdescription, #
+# kiriwrite_page_edit(database, filename, newfilename, newname, newdescription, #
 #			newsection, newtemplate,  newsettings, newpagecontent	#
 #			confirm);						#
 #										#
@@ -1367,6 +1374,12 @@ sub kiriwrite_page_edit{
 
 			kiriwrite_error("pagefilenamedoesnotexist");
 
+		} elsif ($kiriwrite_dbmodule->geterror eq "PageExists"){
+
+			# A page already exists with the new filename.
+
+			kiriwrite_error("pagefilenameexists");
+
 		}
 
 		# Disconnect from the database server.
@@ -1618,11 +1631,13 @@ sub kiriwrite_page_edit{
 		$kiriwrite_presmodule->addlinebreak();
 
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "page");
 		$kiriwrite_presmodule->addhiddendata("action", "edit");
 		$kiriwrite_presmodule->addhiddendata("database", $database);
 		$kiriwrite_presmodule->addhiddendata("page", $pagefilename);
 		$kiriwrite_presmodule->addhiddendata("confirm", 1);
+		$kiriwrite_presmodule->endbox();
 
 		$kiriwrite_presmodule->starttable("", { CellPadding => 5, CellSpacing => 0 });
 
@@ -1813,12 +1828,14 @@ sub kiriwrite_page_edit{
 		$kiriwrite_presmodule->endrow();
 		$kiriwrite_presmodule->endtable();
 
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{pages}->{editpagebutton});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addreset($kiriwrite_lang->{common}->{restorecurrent});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=page&action=view&database=" . $database, { Text => kiriwrite_language($kiriwrite_lang->{pages}->{returnpagelist}, $database_name) } );
+		$kiriwrite_presmodule->endbox();
 
 		$kiriwrite_presmodule->endform();
 
@@ -2087,7 +2104,6 @@ sub kiriwrite_page_multidelete{
 		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=page&action=view&database=" . $database, { Text => kiriwrite_language($kiriwrite_lang->{pages}->{returnpagelist}, $database_name)});
-		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
 
@@ -2232,6 +2248,7 @@ sub kiriwrite_page_multidelete{
 
 		$kiriwrite_presmodule->addtext($kiriwrite_lang->{pages}->{deletemultiplepages}, { Style => "pageheader" });
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "page");
 		$kiriwrite_presmodule->addhiddendata("action", "multidelete");
 		$kiriwrite_presmodule->addhiddendata("database", $database);
@@ -2272,6 +2289,7 @@ sub kiriwrite_page_multidelete{
 		$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{pages}->{deletepagesbutton});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=page&action=view&database=" . $database, { Text => kiriwrite_language($kiriwrite_lang->{pages}->{deletepagesreturnlink}, $database_name)});
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
@@ -2889,6 +2907,7 @@ sub kiriwrite_page_multimove{
 
 		$kiriwrite_presmodule->addtext($kiriwrite_lang->{pages}->{movepages}, { Style => "pageheader" });
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "page");
 		$kiriwrite_presmodule->addhiddendata("action", "multimove");
 		$kiriwrite_presmodule->addhiddendata("database", $database);
@@ -2937,6 +2956,7 @@ sub kiriwrite_page_multimove{
 		$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{pages}->{movepagesbutton});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=page&action=view&database=" . $database, { Text => kiriwrite_language($kiriwrite_lang->{pages}->{returnpagelist}, $database_name)});
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
@@ -3358,7 +3378,6 @@ sub kiriwrite_page_multicopy{
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=page&action=view&database=" . $database, { Text => kiriwrite_language($kiriwrite_lang->{pages}->{returnpagelist}, $olddatabase_name)});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=page&action=view&database=" . $newdatabase, { Text => kiriwrite_language($kiriwrite_lang->{pages}->{viewpagelist}, $newdatabase_name)});
-		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
 
@@ -3573,6 +3592,7 @@ sub kiriwrite_page_multicopy{
 
 		$kiriwrite_presmodule->addtext($kiriwrite_lang->{pages}->{copypages}, { Style => "pageheader" });
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "page");
 		$kiriwrite_presmodule->addhiddendata("action", "multicopy");
 		$kiriwrite_presmodule->addhiddendata("database", $database);
@@ -3623,6 +3643,8 @@ sub kiriwrite_page_multicopy{
 		$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{pages}->{copypagesbutton});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=page&action=view&database=" . $database, { Text => kiriwrite_language($kiriwrite_lang->{pages}->{returnpagelist}, $database_name) });
+
+		$kiriwrite_presmodule->endbox();		
 		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
@@ -4004,6 +4026,12 @@ sub kiriwrite_page_multiedit{
 				$warning_count++;
 				next;
 
+			} elsif ($kiriwrite_dbmodule->geterror eq "PageExists"){
+
+				# A page already exists with the new filename.
+
+				kiriwrite_error("pagefilenameexists");
+
 			}
 
 			# The page has been edited so write a message saying that the page
@@ -4050,7 +4078,7 @@ sub kiriwrite_page_multiedit{
 
 				if (!$edited_list{$page}{Name}){
 
-					$kiriwrite_presmodule->additalictext($kiriwrite_lang->{pages}->{noname});
+					$kiriwrite_presmodule->additalictext($kiriwrite_lang->{blank}->{noname});
 					$kiriwrite_presmodule->addtext(" (" . $edited_list{$page}{Filename} . ")");
 
 				} else {
@@ -4330,6 +4358,7 @@ sub kiriwrite_page_multiedit{
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "page");
 		$kiriwrite_presmodule->addhiddendata("action", "multiedit");
 		$kiriwrite_presmodule->addhiddendata("database", $database);
@@ -4442,6 +4471,7 @@ sub kiriwrite_page_multiedit{
 		$kiriwrite_presmodule->addreset($kiriwrite_lang->{common}->{clearvalues});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=page&action=view&database=" . $database, { Text => kiriwrite_language($kiriwrite_lang->{pages}->{returnpagelist}, $database_name) });
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
@@ -4599,6 +4629,7 @@ sub kiriwrite_page_list{
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"});
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "page");
 		$kiriwrite_presmodule->addhiddendata("action", "view");
 		$kiriwrite_presmodule->addselectbox("database");
@@ -4610,6 +4641,7 @@ sub kiriwrite_page_list{
 		$kiriwrite_presmodule->endselectbox();
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{pages}->{viewbutton});
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
@@ -4723,6 +4755,7 @@ sub kiriwrite_page_list{
 			$kiriwrite_presmodule->addlinebreak();
 			$kiriwrite_presmodule->addlinebreak();
 			$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+			$kiriwrite_presmodule->startbox();
 			$kiriwrite_presmodule->addhiddendata("mode", "page");
 			$kiriwrite_presmodule->addhiddendata("database", $database_file);
 			$kiriwrite_presmodule->addhiddendata("type", "multiple");
@@ -4741,6 +4774,7 @@ sub kiriwrite_page_list{
 
 			$kiriwrite_presmodule->addlinebreak();
 			$kiriwrite_presmodule->addlinebreak();
+			$kiriwrite_presmodule->endbox();
 
 			# Write the table header.
 
@@ -4863,8 +4897,10 @@ sub kiriwrite_page_list{
 
 		$kiriwrite_dbmodule->disconnect();
 
-		$kiriwrite_presmodule->addhiddendata("count", $page_count);
 		$kiriwrite_presmodule->endtable();
+		$kiriwrite_presmodule->startbox();
+		$kiriwrite_presmodule->addhiddendata("count", $page_count);
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 		if (!@database_pages || !$page_count){
@@ -4890,67 +4926,6 @@ sub kiriwrite_page_list{
 
 }
 
-sub kiriwrite_page_multipleselect{
-#################################################################################
-# kiriwrite_page_multipleselect: Gets the multiple page selections from a 	#
-# database and processes them into a single which can be used in the		#
-# kiriwrite_page_delete.							#
-#										#
-# Usage:									#
-#										#
-# kiriwrite_page_multipleselect();						#
-#################################################################################
-
-	# Load the required perl modules for this subroutine.
-
-	my $query = new CGI;
-
-	# Setup some variables that will be used later on.
-
-	my $page_select_seek = 1;
-	my $page_current_value = "";
-	my $selectionlist = "";
-
-	# Get the required variables from the HTTP query.
-
-	my $page_count = $query->param('count');
-
-	do {
-
-		# Get the current value of the selected page's checkbox.
-
-		$page_current_value = $query->param('name[' . $page_select_seek . ']');
-
-		# If page_current_value is undefinied or blank, set page_current_value
-		# to off.
-
-		if (!$page_current_value){
-
-			$page_current_value = "off";
-
-		}
-
-		# Check if the page_current_value is set to 'on' if it is append the
-		# current page seek value to the selection list.
-
-		if ($page_current_value eq "on"){
-
-			# Append the current seek value to the selection list.
-
-			$selectionlist = $selectionlist . $page_select_seek . "|";
-
-		}
-
-		# Increment the page selection seeking counter.
-
-		$page_select_seek++;
-
-	} until ($page_select_seek eq $page_count);
-
-	return $selectionlist;
-
-}
-
 sub kiriwrite_template_add{
 #################################################################################
 # kiriwrite_template_add: Add a template to the template folder			#
@@ -5101,6 +5076,7 @@ sub kiriwrite_template_add{
 
 		$kiriwrite_presmodule->addtext($kiriwrite_lang->{template}->{addtemplate}, { Style => "pageheader" });
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "template");
 		$kiriwrite_presmodule->addhiddendata("action", "add");
 		$kiriwrite_presmodule->addhiddendata("confirm", 1);
@@ -5176,6 +5152,7 @@ sub kiriwrite_template_add{
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=template" , { Text => $kiriwrite_lang->{template}->{returntemplatelist} });
 
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
@@ -5399,6 +5376,7 @@ sub kiriwrite_template_edit{
  		$kiriwrite_presmodule->addlinebreak();
  		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "template");
 		$kiriwrite_presmodule->addhiddendata("action", "edit");
 		$kiriwrite_presmodule->addhiddendata("confirm", 1);
@@ -5476,6 +5454,7 @@ sub kiriwrite_template_edit{
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=template", { Text => $kiriwrite_lang->{template}->{returntemplatelist} });
 
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 	}
@@ -5697,6 +5676,7 @@ sub kiriwrite_template_delete{
 
 		$kiriwrite_presmodule->addtext($kiriwrite_lang->{template}->{deletetemplate}, { Style => "pageheader" });
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "template");
 		$kiriwrite_presmodule->addhiddendata("template", $template_filename);
 		$kiriwrite_presmodule->addhiddendata("action", "delete");
@@ -5708,6 +5688,7 @@ sub kiriwrite_template_delete{
 		$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{template}->{deletetemplatebutton});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=template", { Text => $kiriwrite_lang->{template}->{deletetemplatereturntolist} });
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
@@ -5931,7 +5912,6 @@ sub kiriwrite_template_list{
 		}
 
 		$kiriwrite_presmodule->endtable();
-		$kiriwrite_presmodule->endform();
 
 	}
 
@@ -5951,11 +5931,14 @@ sub kiriwrite_database_add{
 # 										#
 # Usage:									#
 #										#
-# kiriwrite_database_add(filename, name, description, [confirm]);		#
+# kiriwrite_database_add(filename, name, description, notes, categories, 	#
+#				[confirm]);					#
 #										#
 # filename	Specifies the filename for the database.			#
 # name		Specifies a (friendly) name for the database.			#
 # description	Specifies a description for the database.			#
+# notes		Specifies the notes for the database.				#
+# categories	Specifies the categories for the database.			#
 # confirm	Confirms the action to create a database.			#
 #################################################################################
 
@@ -6117,9 +6100,11 @@ sub kiriwrite_database_add{
 	$kiriwrite_presmodule->addlinebreak();
 	$kiriwrite_presmodule->addlinebreak();
 	$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+	$kiriwrite_presmodule->startbox();	
 	$kiriwrite_presmodule->addhiddendata("mode", "db");
 	$kiriwrite_presmodule->addhiddendata("action", "new");
 	$kiriwrite_presmodule->addhiddendata("confirm", "1");
+	$kiriwrite_presmodule->endbox();
 	$kiriwrite_presmodule->starttable("", { CellPadding => 5, CellSpacing => 0 });
 
 	$kiriwrite_presmodule->startheader();
@@ -6179,12 +6164,14 @@ sub kiriwrite_database_add{
 	$kiriwrite_presmodule->endrow();
 
 	$kiriwrite_presmodule->endtable();
+	$kiriwrite_presmodule->startbox();
 	$kiriwrite_presmodule->addlinebreak();
 	$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{database}->{adddatabasebutton});
 	$kiriwrite_presmodule->addtext("|");
 	$kiriwrite_presmodule->addreset($kiriwrite_lang->{database}->{clearvaluesbutton});
 	$kiriwrite_presmodule->addtext("| ");
 	$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=db", { Text => $kiriwrite_lang->{database}->{databaselistreturnlink} });
+	$kiriwrite_presmodule->endbox();
 	$kiriwrite_presmodule->endform();
 
 	# Exit the subroutine taking the data in the pagadata variable with it.
@@ -6199,12 +6186,10 @@ sub kiriwrite_database_edit{
 #										#
 # Usage:									#
 # 										#
-# kiriwrite_database_edit(filename, name, description, newfilename, newname,	#
-#				newdescription, notes, categories, [confirm]);	#
+# kiriwrite_database_edit(filename, newfilename, newname, newdescription, 	#
+#				notes, categories, [confirm]);			#
 #										#
 # filename		Specifies the filename of the database.			#
-# name			Specifies the name of the database.			#
-# description		Specifies the description of the database.		#
 # newfilename		Specifies the new filename of the database.		#
 # newname		Specifies the new name of the database.			#
 # newdescription	Specifies the new description of the database.		#
@@ -6215,7 +6200,7 @@ sub kiriwrite_database_edit{
 
 	# First, get all the variables passed to the subroutine.
 
-	my ($database_shortname, $database_name, $database_description, $database_newfilename, $database_newname, $database_newdescription, $database_notes, $database_categories, $database_confirm) = @_;
+	my ($database_shortname, $database_newfilename, $database_newname, $database_newdescription, $database_notes, $database_categories, $database_confirm) = @_;
 
 	# Check if the database confirm value is blank and if it is
 	# set the confirm value to 0.
@@ -6226,6 +6211,11 @@ sub kiriwrite_database_edit{
 
 	}
 
+	# Check if the database filename given is valid and return an error
+	# if it isn't.
+
+	kiriwrite_variablecheck($database_shortname, "filename", "", 0);
+
 	# Check if the confirm variable has a value in it, if it has, check again to make sure it really is the correct value (Perl moans
 	# if $database_confirm was used directly).
 
@@ -6245,11 +6235,6 @@ sub kiriwrite_database_edit{
 		$database_notes			= kiriwrite_utf8convert($database_notes);
 		$database_categories		= kiriwrite_utf8convert($database_categories);
 
-		# Check if the database filename given is valid and return an error
-		# if it isn't.
-
-		kiriwrite_variablecheck($database_shortname, "filename", "", 0);
-
 		# Preform the following tests.
 
 		my $database_filename_check_length 	= kiriwrite_variablecheck($database_newfilename, "maxlength", 32, 1);
@@ -6466,12 +6451,12 @@ sub kiriwrite_database_edit{
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "db");
 		$kiriwrite_presmodule->addhiddendata("action", "edit");
 		$kiriwrite_presmodule->addhiddendata("database", $database_shortname);
 		$kiriwrite_presmodule->addhiddendata("confirm", "1");
-		$kiriwrite_presmodule->addhiddendata("olddatabasename", $database_oldname);
-		$kiriwrite_presmodule->addhiddendata("olddatabasedescription", $database_olddescription);
+		$kiriwrite_presmodule->endbox();
 
 		$kiriwrite_presmodule->starttable("", { CellPadding => 5, CellSpacing => 0 });
 		$kiriwrite_presmodule->startheader();
@@ -6526,14 +6511,14 @@ sub kiriwrite_database_edit{
 
 		$kiriwrite_presmodule->endtable();
 
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addlinebreak();
-
 		$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{database}->{editdatabasebutton});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addreset($kiriwrite_lang->{common}->{restorecurrent});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=db", { Text => $kiriwrite_lang->{database}->{databaselistreturnlink} });
-
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab();
@@ -6720,6 +6705,7 @@ sub kiriwrite_database_delete{
 
 	$kiriwrite_presmodule->addtext($kiriwrite_lang->{database}->{deletedatabase}, { Style => "pageheader" });
 	$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+	$kiriwrite_presmodule->startbox();
 	$kiriwrite_presmodule->addhiddendata("mode", "db");
 	$kiriwrite_presmodule->addhiddendata("action", "delete");
 	$kiriwrite_presmodule->addhiddendata("database", $database_filename);
@@ -6731,6 +6717,7 @@ sub kiriwrite_database_delete{
 	$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{database}->{deletedatabasebutton});
 	$kiriwrite_presmodule->addtext(" | ");
 	$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=db", { Text => $kiriwrite_lang->{database}->{deletedatabasereturn} });
+	$kiriwrite_presmodule->endbox();
 	$kiriwrite_presmodule->endform();
 
 	return $kiriwrite_presmodule->grab();
@@ -7028,6 +7015,12 @@ sub kiriwrite_filter_list{
 
 		kiriwrite_error("filtersdbpermissions");
 
+	} elsif ($kiriwrite_dbmodule->geterror eq "FilterDatabaseError"){
+
+		# A database error has occured with the filter database.
+
+		kiriwrite_error("filtersdbdatabaseerror", $kiriwrite_dbmodule->geterror(1));
+
 	}
 
 	# Define some variables required for processing the filters list.
@@ -7498,6 +7491,7 @@ sub kiriwrite_filter_add{
 	$kiriwrite_presmodule->addlinebreak();
 	$kiriwrite_presmodule->addlinebreak();
 	$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+	$kiriwrite_presmodule->startbox();
 	$kiriwrite_presmodule->addhiddendata("mode", "filter");
 	$kiriwrite_presmodule->addhiddendata("action", "add");
 	$kiriwrite_presmodule->addhiddendata("confirm", 1);
@@ -7556,6 +7550,7 @@ sub kiriwrite_filter_add{
 	$kiriwrite_presmodule->addtext(" | ");
 	$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=filter", { Text => $kiriwrite_lang->{filter}->{returnfilterlist} });
 
+	$kiriwrite_presmodule->endbox();
 	$kiriwrite_presmodule->endform();
 
 	return $kiriwrite_presmodule->grab();
@@ -7785,6 +7780,12 @@ sub kiriwrite_filter_edit{
 
 			kiriwrite_error("filtersdbpermissions");
 
+		} elsif ($kiriwrite_dbmodule->geterror eq "FilterDatabaseError"){
+
+			# A database error has occured with the filter database.
+
+			kiriwrite_error("filtersdbdatabaseerror", $kiriwrite_dbmodule->geterror(1));
+
 		}
 
 		# Edit the selected filter in the filter database.
@@ -7890,6 +7891,12 @@ sub kiriwrite_filter_edit{
 
 			kiriwrite_error("filtersdbpermissions");
 
+		} elsif ($kiriwrite_dbmodule->geterror eq "FilterDatabaseError"){
+
+			# A database error has occured with the filter database.
+
+			kiriwrite_error("filtersdbdatabaseerror", $kiriwrite_dbmodule->geterror(1));
+
 		}
 
 		# Get information about the filter.
@@ -7932,6 +7939,7 @@ sub kiriwrite_filter_edit{
 
 		$kiriwrite_presmodule->addtext($kiriwrite_lang->{filter}->{editfilter}, { Style => "pageheader" });
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "filter");
 		$kiriwrite_presmodule->addhiddendata("action", "edit");
 		$kiriwrite_presmodule->addhiddendata("filter", $filter_id);
@@ -7992,6 +8000,8 @@ sub kiriwrite_filter_edit{
 		$kiriwrite_presmodule->addreset($kiriwrite_lang->{common}->{restorecurrent});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=filter", { Text => $kiriwrite_lang->{filter}->{returnfilterlist} });
+		$kiriwrite_presmodule->endbox();
+		$kiriwrite_presmodule->endform();
 
 		return $kiriwrite_presmodule->grab(); 
 
@@ -8012,9 +8022,9 @@ sub kiriwrite_filter_delete{
 # 										#
 # Usage:									#
 # 										#
-# kiriwrite_filter_delete(number, confirm);					#
+# kiriwrite_filter_delete(filterid, confirm);					#
 #										#
-# number	Specifies the filter line number to delete.			#
+# filterid	Specifies the filter line number to delete.			#
 # confirm	Confirms the deletion of the selected filter.			#
 #################################################################################
 
@@ -8122,6 +8132,12 @@ sub kiriwrite_filter_delete{
 
 			kiriwrite_error("filtersdbpermissions");
 
+		} elsif ($kiriwrite_dbmodule->geterror eq "FilterDatabaseError"){
+
+			# A database error has occured with the filter database.
+
+			kiriwrite_error("filtersdbdatabaseerror", $kiriwrite_dbmodule->geterror(1));
+
 		}
 
 		# Delete the filter from the filter database.
@@ -8201,6 +8217,12 @@ sub kiriwrite_filter_delete{
 
 			kiriwrite_error("filtersdbpermissions");
 
+		} elsif ($kiriwrite_dbmodule->geterror eq "FilterDatabaseError"){
+
+			# A database error has occured with the filter database.
+
+			kiriwrite_error("filtersdbdatabaseerror", $kiriwrite_dbmodule->geterror(1));
+
 		}
 
 		# Get information about the filter (to check if it exists).
@@ -8241,6 +8263,7 @@ sub kiriwrite_filter_delete{
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "filter");
 		$kiriwrite_presmodule->addhiddendata("action", "delete");
 		$kiriwrite_presmodule->addhiddendata("filter", $filter_id);
@@ -8248,6 +8271,7 @@ sub kiriwrite_filter_delete{
 		$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{filter}->{deletefilterbutton});
 		$kiriwrite_presmodule->addtext(" | ");
 		$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=filter", { Text => $kiriwrite_lang->{filter}->{deletefilterreturn} });
+ 		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 	} else {
@@ -9135,6 +9159,7 @@ sub kiriwrite_compile_makepages{
 
 			$kiriwrite_presmodule->addtext($kiriwrite_lang->{compile}->{compiledatabase}, { Style => "pageheader" });
 			$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+			$kiriwrite_presmodule->startbox();
 			$kiriwrite_presmodule->addhiddendata("mode", "compile");
 			$kiriwrite_presmodule->addhiddendata("action", "compile");
 			$kiriwrite_presmodule->addhiddendata("type", "multiple");
@@ -9148,6 +9173,8 @@ sub kiriwrite_compile_makepages{
 			$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{compile}->{compiledatabasebutton});
 			$kiriwrite_presmodule->addtext(" | ");
 			$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=compile", { Text => $kiriwrite_lang->{compile}->{returncompilelist} });
+			$kiriwrite_presmodule->endbox();
+			$kiriwrite_presmodule->endform();
 
 			return $kiriwrite_presmodule->grab();
 
@@ -9258,6 +9285,7 @@ sub kiriwrite_compile_makepages{
 			$kiriwrite_presmodule->addlinebreak();
 			$kiriwrite_presmodule->addlinebreak();
 			$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+			$kiriwrite_presmodule->startbox();
 			$kiriwrite_presmodule->addhiddendata("mode", "compile");
 			$kiriwrite_presmodule->addhiddendata("action", "compile");
 			$kiriwrite_presmodule->addhiddendata("type", "multiple");
@@ -9302,6 +9330,7 @@ sub kiriwrite_compile_makepages{
 			$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{compile}->{compileselecteddatabasesbutton});
 			$kiriwrite_presmodule->addtext(" | ");
 			$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=compile", { Text => $kiriwrite_lang->{compile}->{returncompilelist} });
+			$kiriwrite_presmodule->endbox();
 			$kiriwrite_presmodule->endform();
 
 			return $kiriwrite_presmodule->grab();
@@ -9396,6 +9425,7 @@ sub kiriwrite_compile_all{
 	$kiriwrite_presmodule->addlinebreak();
 
 	$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+	$kiriwrite_presmodule->startbox();
 	$kiriwrite_presmodule->addhiddendata("mode", "compile");
 	$kiriwrite_presmodule->addhiddendata("action", "compile");
 	$kiriwrite_presmodule->addhiddendata("type", "multiple");
@@ -9447,6 +9477,8 @@ sub kiriwrite_compile_all{
 	$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{compile}->{compilealldatabasesbutton});
 	$kiriwrite_presmodule->addtext(" | ");
 	$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=compile", { Text => $kiriwrite_lang->{compile}->{returncompilelist} });
+	$kiriwrite_presmodule->endbox();
+	$kiriwrite_presmodule->endform();
 
 	return $kiriwrite_presmodule->grab();
 
@@ -9698,6 +9730,7 @@ sub kiriwrite_compile_list{
 	} else {
 
 		$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+		$kiriwrite_presmodule->startbox();
 		$kiriwrite_presmodule->addhiddendata("mode", "compile");
 		$kiriwrite_presmodule->addhiddendata("action", "compile");
 		$kiriwrite_presmodule->addhiddendata("type", "multiple");
@@ -9778,6 +9811,7 @@ sub kiriwrite_compile_list{
 		}
 
 		$kiriwrite_presmodule->endtable();
+		$kiriwrite_presmodule->endbox();
 		$kiriwrite_presmodule->endform();
 
 	}
@@ -9889,13 +9923,6 @@ sub kiriwrite_compile_clean{
 
 			$file_permissions = kiriwrite_compile_clean_helper($kiriwrite_config{"directory_data_output"}, 1);
 
-			if ($file_permissions eq 1){
-
-				# One of the files or directories has invalid
-				# permissions set so write a warning message.
-
-			}
-
 			$kiriwrite_presmodule->addtext($kiriwrite_lang->{compile}->{cleanoutputdirectory}, { Style => "pageheader" });
 
 			if ($file_permissions eq 1){
@@ -9937,6 +9964,7 @@ sub kiriwrite_compile_clean{
 	$kiriwrite_presmodule->addlinebreak();
 	$kiriwrite_presmodule->addlinebreak();
 	$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+	$kiriwrite_presmodule->startbox();
 	$kiriwrite_presmodule->addhiddendata("mode", "compile");
 	$kiriwrite_presmodule->addhiddendata("action", "clean");
 	$kiriwrite_presmodule->addhiddendata("confirm", 1);
@@ -9946,6 +9974,7 @@ sub kiriwrite_compile_clean{
 	$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{compile}->{cleanoutputdirectorybutton});
 	$kiriwrite_presmodule->addtext(" | ");
 	$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=compile", { Text => $kiriwrite_lang->{compile}->{returncompilelist}});
+	$kiriwrite_presmodule->endbox();
 	$kiriwrite_presmodule->endform();
 
 	return $kiriwrite_presmodule->grab();
@@ -10587,7 +10616,7 @@ sub kiriwrite_settings_edit{
 
 		# Write a confirmation message.
 
-		$kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{settingsedited}, { Style => "pageheadeR" });
+		$kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{settingsedited}, { Style => "pageheader" });
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->addlinebreak();
 		$kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{settingseditedmessage});
@@ -10936,6 +10965,7 @@ sub kiriwrite_settings_edit{
 	$kiriwrite_presmodule->addlinebreak();
 
 	$kiriwrite_presmodule->startform($kiriwrite_env{"script_filename"}, "POST");
+	$kiriwrite_presmodule->startbox();
 	$kiriwrite_presmodule->addhiddendata("mode", "settings");
 	$kiriwrite_presmodule->addhiddendata("action", "edit");
 	$kiriwrite_presmodule->addhiddendata("confirm", 1);
@@ -11250,7 +11280,7 @@ sub kiriwrite_settings_edit{
 	$kiriwrite_presmodule->addreset($kiriwrite_lang->{common}->{restorecurrent});
 	$kiriwrite_presmodule->addtext(" | ");
 	$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=settings", { Text => $kiriwrite_lang->{setting}->{returnsettingslist} });
-
+	$kiriwrite_presmodule->endbox();
 	$kiriwrite_presmodule->endform();
 
 	return $kiriwrite_presmodule->grab();
@@ -11511,9 +11541,9 @@ sub kiriwrite_variablecheck{
 #										#
 # Usage:									#
 #										#
-# kiriwrite_variablecheck(variablename, type, length, noerror);			#
+# kiriwrite_variablecheck(variable, type, length, noerror);			#
 #										#
-# variablename	Specifies the variable to be checked.				#
+# variable	Specifies the variable to be checked.				#
 # type		Specifies what type the variable is.				#
 # option	Specifies the maximum/minimum length of the variable		#
 #		(if minlength/maxlength is used) or if the filename should be   #
@@ -12641,17 +12671,12 @@ sub kiriwrite_output_header{
 #										#
 # Usage:									#
 #										#
-# kiriwrite_output_header(mimetype);						#
-# 										#
-# mimetype	Specifies the mime type of the header.				#
+# kiriwrite_output_header();							#
 #################################################################################
 
 	# Print a header saying that the page expires immediately since the
 	# date is set in the past.
 
-	#print "Expires: Sunday, 01-Jan-06 00:00:00 GMT\n";
-	#print "Content-Type: text/html; charset=utf-8\n";
-	#print header();
 	print header(-Expires=>'Sunday, 01-Jan-06 00:00:00 GMT', -charset=>'utf-8');
 	return;
 }
@@ -12725,7 +12750,7 @@ sub kiriwrite_processfilename{
 
 sub kiriwrite_language{
 #################################################################################
-# kiriwrite_language: Process language strings that need certain text inserted.	#
+# kiriwrite_language: Process language strings that needs certain text inserted.#
 #										#
 # Usage:									#
 #										#
@@ -13091,8 +13116,7 @@ sub kiriwrite_filepermissions{
 
 sub kiriwrite_utf8convert{
 #################################################################################
-# kiriwrite_utf8convert: Properly converts values into UTF-8 and make sure	#
-# that the size of the string is correct when doing input validation.		#
+# kiriwrite_utf8convert: Properly converts values into UTF-8 values.		#
 #										#
 # Usage:									#
 #										#
@@ -13515,8 +13539,6 @@ if ($query->param('mode')){
 							my $newdatabasename 		= $query->param('databasename');
 							my $newdatabasedescription 	= $query->param('databasedescription');
 							my $newdatabasefilename 	= $query->param('databasefilename');
-							my $databasename		= $query->param('olddatabasename');
-							my $databasedescription 	= $query->param('olddatabasedescription');
 							my $databaseshortname 		= $query->param('database');
 							my $databasenotes		= $query->param('databasenotes');
 							my $databasecategories		= $query->param('databasecategories');
@@ -13526,7 +13548,7 @@ if ($query->param('mode')){
 	
 							# Pass the variables to the database editing subroutine.
 
-							my $pagedata = kiriwrite_database_edit($databaseshortname, $databasename, $databasedescription, $newdatabasefilename, $newdatabasename, $newdatabasedescription, $databasenotes, $databasecategories, 1);
+							my $pagedata = kiriwrite_database_edit($databaseshortname, $newdatabasefilename, $newdatabasename, $newdatabasedescription, $databasenotes, $databasecategories, 1);
 	
 							kiriwrite_output_header;
 							kiriwrite_output_page($kiriwrite_lang->{database}->{editdatabasetitle}, $pagedata, "database");
diff --git a/cgi-files/lang/en-GB.xml b/cgi-files/lang/en-GB.xml
index aa769e0..9281cea 100644
--- a/cgi-files/lang/en-GB.xml
+++ b/cgi-files/lang/en-GB.xml
@@ -444,7 +444,7 @@
 		<presmoduleinvalid>The presentation module name given is invalid.</presmoduleinvalid>
 		<presmodulemissing>The presentation module with the filename given is missing.</presmodulemissing>
 		<pagefilenamedoesnotexist>The page with the filename given does not exist.</pagefilenamedoesnotexist>
-		<pagefilenameexists>The page filename given already exists</pagefilenameexists>
+		<pagefilenameexists>The page filename given already exists.</pagefilenameexists>
 		<pagefilenameinvalid>The page filename given is invalid.</pagefilenameinvalid>
 		<pagefilenametoolong>The page filename given is too long.</pagefilenametoolong>
 		<pagefilenameblank>The page filename given is blank.</pagefilenameblank>
diff --git a/cgi-files/page.html b/cgi-files/page.html
index 5c6a8c1..314eecf 100644
--- a/cgi-files/page.html
+++ b/cgi-files/page.html
@@ -1,4 +1,4 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html>
 	<head>
 		<title>Kiriwrite<kiriwrite:title></title>