X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=cgi-files%2Fkiriwrite.cgi;h=83c80e44a4ebfe9c049aeed4def2fd8727f20efd;hb=1a2430bc24c3a226970f143e589734d77f78d765;hp=74c16714e7166711953102ec4cd0e9ce41acc7af;hpb=11cedbfb093405bd9c45440398c4dd83e0b49625;p=kiriwrite%2F.git diff --git a/cgi-files/kiriwrite.cgi b/cgi-files/kiriwrite.cgi index 74c1671..83c80e4 100755 --- a/cgi-files/kiriwrite.cgi +++ b/cgi-files/kiriwrite.cgi @@ -25,13 +25,16 @@ use strict; # Throw errors if there's something wrong. use warnings; # Write warnings to the HTTP Server Log file. use utf8; -use CGI qw(:standard); -use CGI::Carp('fatalsToBrowser'); # Output errors to the browser. +use CGI qw(header); use Tie::IxHash; +# This is commented out because it uses a fair bit of CPU usage. + +#use CGI::Carp('fatalsToBrowser'); # Output errors to the browser. + # Declare global variables for Kiriwrite settings and languages. -my ($kiriwrite_config, %kiriwrite_config, $kiriwrite_lang, $kiriwrite_version, %kiriwrite_version, $kiriwrite_env, %kiriwrite_env, $kiriwrite_presmodule, $kiriwrite_dbmodule); +my ($kiriwrite_config, %kiriwrite_config, $kiriwrite_lang, $kiriwrite_version, %kiriwrite_version, $kiriwrite_env, %kiriwrite_env, $kiriwrite_presmodule, $kiriwrite_dbmodule, $xsl); # Setup the version information for Kiriwrite. @@ -75,6 +78,8 @@ sub BEGIN{ "script_filename" => $script_filename, ); + $ENV{XML_SIMPLE_PREFERRED_PARSER} = "XML::Parser"; + } ################################################################################# @@ -583,12 +588,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 +734,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 +1044,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 +1057,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 +1078,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 +1379,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 +1636,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 +1833,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->addsubmit($kiriwrite_lang->{common}->{clearvalues}); + $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 +2109,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 +2253,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 +2294,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 +2912,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 +2961,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(); @@ -3132,34 +3157,20 @@ sub kiriwrite_page_multicopy{ my @newdatabase_page; my $filename; - my $filename_sql; - my $filename_out; - my $olddatabase_database_handle; - my $olddatabase_string_handle; my $olddatabase_name; - my $newdatabase_database_handle; - my $newdatabase_string_handle; my $newdatabase_name; my $page; my $warning; my $page_filename; - my $page_filename_sql; my $page_name; - my $page_name_sql; my $page_description; - my $page_description_sql; my $page_section; - my $page_section_sql; my $page_template; - my $page_template_sql; my $page_data; - my $page_data_sql; my $page_settings; - my $page_settings_sql; my $page_lastmodified; - my $page_lastmodified_sql; my $page_seek = 0; my $warning_count = 0; @@ -3358,7 +3369,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 +3583,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 +3634,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 +4017,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 +4069,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 +4349,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 +4462,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 +4620,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 +4632,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(); @@ -4617,7 +4640,7 @@ sub kiriwrite_page_list{ } else { my %database_info; - my %template_info; + my %page_info; my @database_pages; my $pagemultioptions = ""; my $db_name = ""; @@ -4633,7 +4656,7 @@ sub kiriwrite_page_list{ my $db_file_notblank = 0; tie(%database_info, 'Tie::IxHash'); - tie(%template_info, 'Tie::IxHash'); + tie(%page_info, 'Tie::IxHash'); # The database_file variable is not blank, so print out a list of pages from # the selected database. @@ -4723,6 +4746,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 +4765,7 @@ sub kiriwrite_page_list{ $kiriwrite_presmodule->addlinebreak(); $kiriwrite_presmodule->addlinebreak(); + $kiriwrite_presmodule->endbox(); # Write the table header. @@ -4758,7 +4783,7 @@ sub kiriwrite_page_list{ foreach $page_filename (@database_pages){ - %template_info = $kiriwrite_dbmodule->getpageinfo({ PageFilename => $page_filename }); + %page_info = $kiriwrite_dbmodule->getpageinfo({ PageFilename => $page_filename, Reduced => 1 }); # Check if any errors have occured. @@ -4779,10 +4804,10 @@ sub kiriwrite_page_list{ $page_count++; - $page_filename = $template_info{"PageFilename"}; - $page_name = $template_info{"PageName"}; - $page_description = $template_info{"PageDescription"}; - $page_modified = $template_info{"PageLastModified"}; + $page_filename = $page_info{"PageFilename"}; + $page_name = $page_info{"PageName"}; + $page_description = $page_info{"PageDescription"}; + $page_modified = $page_info{"PageLastModified"}; # Set the table cell style. @@ -4863,8 +4888,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 +4917,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 +5067,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 +5143,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 +5367,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 +5445,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 +5667,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 +5679,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 +5903,6 @@ sub kiriwrite_template_list{ } $kiriwrite_presmodule->endtable(); - $kiriwrite_presmodule->endform(); } @@ -5951,11 +5922,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 +6091,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 +6155,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 +6177,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 +6191,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 +6202,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 +6226,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 +6442,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 +6502,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 +6696,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 +6708,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 +7006,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. @@ -7048,8 +7032,8 @@ sub kiriwrite_filter_list{ $kiriwrite_presmodule->addlinebreak(); $kiriwrite_presmodule->addlinebreak(); - # If the filters database exists then get the list of filters, - # otherwise write a message saying that the filters database + # If the filter database exists then get the list of filters, + # otherwise write a message saying that the filter database # does not exist and will be created when a filter is added. if ($filtersdb_notexist eq 0){ @@ -7062,7 +7046,7 @@ sub kiriwrite_filter_list{ if ($kiriwrite_dbmodule->geterror eq "FilterDatabaseError"){ - # A database error has occured with the filters database. + # A database error has occured with the filter database. kiriwrite_error("filtersdbdatabaseerror", $kiriwrite_dbmodule->geterror(1)); @@ -7114,12 +7098,12 @@ sub kiriwrite_filter_list{ } - # Check if there are filters in the filters database and + # Check if there are filters in the filter database and # write a message if there isn't. if ($filter_count eq 0){ - # There are no filters in the filters database. + # There are no filters in the filter database. $filterswarning = $kiriwrite_lang->{filter}->{nofiltersavailable}; @@ -7134,7 +7118,7 @@ sub kiriwrite_filter_list{ if ($filtersdb_notexist eq 1){ - # The filters database doesn't exist so write + # The filter database doesn't exist so write # a message. $filterswarning = $kiriwrite_lang->{filter}->{filterdatabasedoesnotexist}; @@ -7154,7 +7138,7 @@ sub kiriwrite_filter_list{ } else { - # The filters database exists so write out the + # The filter database exists so write out the # list of filters. if ($blankfindfilter eq 1){ @@ -7411,7 +7395,7 @@ sub kiriwrite_filter_add{ } - # Connect to the filters database. + # Connect to the filter database. $kiriwrite_dbmodule->connectfilter(1); @@ -7470,7 +7454,7 @@ sub kiriwrite_filter_add{ $kiriwrite_dbmodule->disconnect(); # Write out a message saying that the filter was added to the - # filters database. + # filter database. $kiriwrite_presmodule->addtext($kiriwrite_lang->{filter}->{filteradded}, { Style => "pageheader" }); $kiriwrite_presmodule->addlinebreak(); @@ -7498,6 +7482,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 +7541,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(); @@ -7572,7 +7558,7 @@ sub kiriwrite_filter_edit{ # newfilterpriority, newfilternotes, confirm); # # # # filterid Specifies the filter number (line number) in the # -# filters database. # +# filter database. # # newfilterfind Specifies the new word to find. # # newfilterreplace Specifies the new word to replace. # # newfilterpriority Specifies the new filter priority. # @@ -7765,7 +7751,7 @@ sub kiriwrite_filter_edit{ } - # Connect to the filters database. + # Connect to the filter database. $kiriwrite_dbmodule->connectfilter(); @@ -7785,6 +7771,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. @@ -7802,7 +7794,7 @@ sub kiriwrite_filter_edit{ } elsif ($kiriwrite_dbmodule->geterror eq "FilterDatabaseError"){ - # A database error has occured while using the filters database + # A database error has occured while using the filter database # so return an error. kiriwrite_error("filtersdbdatabaseerror", $kiriwrite_dbmodule->geterror(1)); @@ -7870,7 +7862,7 @@ sub kiriwrite_filter_edit{ } - # Connect to the filters database. + # Connect to the filter database. $kiriwrite_dbmodule->connectfilter(); @@ -7890,6 +7882,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 +7930,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 +7991,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 +8013,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 +8123,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. @@ -8154,7 +8161,7 @@ sub kiriwrite_filter_delete{ $kiriwrite_dbmodule->disconnect(); # Write a message saying that the filter was deleted - # from the filters database. + # from the filter database. $kiriwrite_presmodule->addtext($kiriwrite_lang->{filter}->{deletedfilter}, { Style => "pageheader" }); $kiriwrite_presmodule->addlinebreak(); @@ -8201,6 +8208,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 +8254,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 +8262,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 { @@ -8466,7 +8481,7 @@ sub kiriwrite_compile_makepages{ } - # Load the filters database (if the filters skip + # Load the filter database (if the filters skip # value isn't set to 1). if ($filters_skip eq 0){ @@ -8479,7 +8494,7 @@ sub kiriwrite_compile_makepages{ if ($kiriwrite_dbmodule->geterror eq "FilterDatabaseError"){ - # A database error has occured with the filters database. + # A database error has occured with the filter database. $kiriwrite_presmodule->addtext($error_prefix . kiriwrite_language($kiriwrite_lang->{compile}->{filterdatabaseerror}, $kiriwrite_dbmodule->geterror(1))); $kiriwrite_presmodule->addlinebreak(); @@ -8635,7 +8650,7 @@ sub kiriwrite_compile_makepages{ # Place each template file into the hash. - $templatefiles{$template_info{"TemplateFilename"}}{template} = $template_info{"TemplateFilename"}; + $templatefiles{$template_info{"TemplateFilename"}}{template} = $template_info{"TemplateLayout"}; $templatefiles{$template_info{"TemplateFilename"}}{valid} = 1; } @@ -8806,13 +8821,14 @@ sub kiriwrite_compile_makepages{ } else { - if ($page_content){ - - $page_final = $templatefiles{$page_template}{template}; - $page_final =~ s//$page_content/g; + $page_final = $templatefiles{$page_template}{template}; + if (!$page_final){ + $page_final = ""; } + $page_final =~ s//$page_content/g; + } # Create the combined page title (if needed). @@ -8997,7 +9013,15 @@ sub kiriwrite_compile_makepages{ ($page_filename) = $page_filename =~ m/^(.*)$/g; ($kiriwrite_config{"directory_data_output"}) = $kiriwrite_config{"directory_data_output"} =~ m/^(.*)$/g; - open($filehandle_page, ">:utf8 ", $kiriwrite_config{"directory_data_output"} . '/' . $page_filename) or ($kiriwrite_presmodule->addtext($error_prefix . kiriwrite_language($kiriwrite_lang->{compile}->{pagenotwritten}, $page_filename, $!)), $kiriwrite_presmodule->addlinebreak(), $error_count++, next); + + open($filehandle_page, "> ", $kiriwrite_config{"directory_data_output"} . '/' . $page_filename) or ($kiriwrite_presmodule->addtext($error_prefix . kiriwrite_language($kiriwrite_lang->{compile}->{pagenotwritten}, $page_filename, $!)), $kiriwrite_presmodule->addlinebreak(), $error_count++, next); + + if (!$page_final){ + + $page_final = ""; + + } + binmode $filehandle_page, ':utf8'; print $filehandle_page $page_final; close($filehandle_page); @@ -9126,6 +9150,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"); @@ -9139,6 +9164,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(); @@ -9249,6 +9276,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"); @@ -9293,6 +9321,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(); @@ -9387,6 +9416,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"); @@ -9438,6 +9468,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(); @@ -9689,6 +9721,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"); @@ -9769,6 +9802,7 @@ sub kiriwrite_compile_list{ } $kiriwrite_presmodule->endtable(); + $kiriwrite_presmodule->endbox(); $kiriwrite_presmodule->endform(); } @@ -9880,13 +9914,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){ @@ -9928,6 +9955,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); @@ -9937,6 +9965,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(); @@ -10271,10 +10300,6 @@ sub kiriwrite_settings_edit{ my $confirm = $passedoptions->{"Confirm"}; - # Load the required Perl modules. - - my $xsl = XML::Simple->new(); - if (!$confirm){ # If the confirm value is blank, then set the confirm @@ -10578,7 +10603,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}); @@ -10927,6 +10952,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); @@ -11241,7 +11267,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(); @@ -11260,8 +11286,8 @@ sub kiriwrite_settings_load{ # Load the required Perl modules. - use XML::Simple; - my $xsl = XML::Simple->new(); + use XML::Simple qw(XMLin); + $xsl = XML::Simple->new(); # Check if the Kiriwrite configuration file exists before using it and # return an critical error if it doesn't exist. @@ -11502,9 +11528,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 # @@ -12632,17 +12658,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; } @@ -12716,7 +12737,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: # # # @@ -13082,8 +13103,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: # # # @@ -13096,7 +13116,7 @@ sub kiriwrite_utf8convert{ # Load the Encode perl module. - use Encode; + use Encode qw(decode_utf8); # Convert the string. @@ -13384,15 +13404,32 @@ sub kiriwrite_output_xml{ # Convert the password to make sure it can be read properly. - $settings_database_password =~ s/\0//g; - $settings_database_password =~ s//>/g; + if ($settings_database_password){ + + $settings_database_password =~ s/\0//g; + $settings_database_password =~ s//>/g; + + } # Convert the less than and greater than characters are there and # convert them. - $settings_imagesuri =~ s//>/g; + if ($settings_imagesuri){ + + $settings_imagesuri =~ s//>/g; + + } + + # Check if the database password value is undefined and if it is then + # set it blank. + + if (!$settings_database_password){ + + $settings_database_password = ""; + + } # Create the XML data layout. @@ -13501,18 +13538,11 @@ if ($query->param('mode')){ if ($http_query_confirm eq 1){ # Value is correct, collect the variables to pass onto the database variable. - # Load the XML::Simple module. - - use XML::Simple; - my $xsl = XML::Simple->new(); - # Get the variables from the HTTP query. 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'); @@ -13522,7 +13552,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"); @@ -13962,7 +13992,7 @@ if ($query->param('mode')){ if ($http_query_action eq "add"){ # The action the user requested is to add a filter to the - # filters database. + # filter database. # Check if there is a value in confirm and if there is # then pass it on to the new find and replace words @@ -13974,7 +14004,7 @@ if ($query->param('mode')){ # There is a value in http_query_confirm, so pass on the # new find and replace words so that they can be added - # to the filters database. + # to the filter database. my $http_query_findwords = $query->param('findword'); my $http_query_replacewords = $query->param('replaceword'); @@ -13998,7 +14028,7 @@ if ($query->param('mode')){ } elsif ($http_query_action eq "edit"){ # The action the user requested is to edit an filter from - # the filters database. + # the filter database. my $http_query_number = $query->param('filter'); my $http_query_confirm = $query->param('confirm'); @@ -14006,7 +14036,7 @@ if ($query->param('mode')){ if ($http_query_confirm){ # There is a value in http_query_confirm, so pass on the - # new find and replace words so that the filters database + # new find and replace words so that the filter database # can be edited. my $http_query_findwords = $query->param('filterfind'); @@ -14031,7 +14061,7 @@ if ($query->param('mode')){ } elsif ($http_query_action eq "delete"){ # The action the user requested is to delete an filter - # from the filters database. + # from the filter database. my $http_query_number = $query->param('filter'); my $http_query_confirm = $query->param('confirm');