use strict;
use warnings;
-use Encode qw();
+use Encode qw(decode_utf8);
# Load the following Perl modules.
}
-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. #
}
+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 #
}
-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();
# Process the database information into a hash.
%databaseinfo = (
-
"DatabaseName" => decode_utf8($sqldata[0]),
"Description" => decode_utf8($sqldata[1]),
"Notes" => decode_utf8($sqldata[2]),
# #
# Usage: #
# #
-# $dbmodule->addtemplate(); #
+# $dbmodule->addtemplate(options); #
# #
# options Specifies the following options in any order. #
# #
}
-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. #
}
+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. #
#################################################################################
}
+ # 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;
# 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()){
# 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();
$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 {
$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);
$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();
# #
# Usage: #
# #
-# kiriwrite_page_edit(database, filename, newname, newfilename, newdescription, #
+# kiriwrite_page_edit(database, filename, newfilename, newname, newdescription, #
# newsection, newtemplate, newsettings, newpagecontent #
# confirm); #
# #
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.
$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 });
$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();
$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();
$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);
$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();
$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);
$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();
$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();
$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);
$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();
$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
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 {
$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);
$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();
$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");
$kiriwrite_presmodule->endselectbox();
$kiriwrite_presmodule->addtext(" | ");
$kiriwrite_presmodule->addsubmit($kiriwrite_lang->{pages}->{viewbutton});
+ $kiriwrite_presmodule->endbox();
$kiriwrite_presmodule->endform();
return $kiriwrite_presmodule->grab();
$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");
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->addlinebreak();
+ $kiriwrite_presmodule->endbox();
# Write the table header.
$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){
}
-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 #
$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);
$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();
$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);
$kiriwrite_presmodule->addtext(" | ");
$kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=template", { Text => $kiriwrite_lang->{template}->{returntemplatelist} });
+ $kiriwrite_presmodule->endbox();
$kiriwrite_presmodule->endform();
}
$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");
$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();
}
$kiriwrite_presmodule->endtable();
- $kiriwrite_presmodule->endform();
}
# #
# 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. #
#################################################################################
$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();
$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.
# #
# 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. #
# 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.
}
+ # 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).
$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);
$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();
$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();
$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);
$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();
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.
$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);
$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();
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.
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.
$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);
$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();
# #
# 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. #
#################################################################################
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.
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).
$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);
$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 {
$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");
$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();
$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");
$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();
$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");
$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();
} 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");
}
$kiriwrite_presmodule->endtable();
+ $kiriwrite_presmodule->endbox();
$kiriwrite_presmodule->endform();
}
$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){
$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);
$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();
# 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});
$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);
$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();
# #
# 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 #
# #
# 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;
}
sub kiriwrite_language{
#################################################################################
-# kiriwrite_language: Process language strings that need certain text inserted. #
+# kiriwrite_language: Process language strings that needs certain text inserted.#
# #
# Usage: #
# #
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: #
# #
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');
# 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");