X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=cgi-files%2Fkiriwrite.cgi;h=267277e345b107856e9fa29a5eedec14f2c05979;hb=1bc9b960f2ef4fabbe92febc316a11fb2d7d7a18;hp=74c16714e7166711953102ec4cd0e9ce41acc7af;hpb=11cedbfb093405bd9c45440398c4dd83e0b49625;p=kiriwrite%2F.git diff --git a/cgi-files/kiriwrite.cgi b/cgi-files/kiriwrite.cgi index 74c1671..267277e 100755 --- a/cgi-files/kiriwrite.cgi +++ b/cgi-files/kiriwrite.cgi @@ -25,7 +25,7 @@ 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 qw(header); use CGI::Carp('fatalsToBrowser'); # Output errors to the browser. use Tie::IxHash; @@ -1816,7 +1816,7 @@ sub kiriwrite_page_edit{ $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) } ); @@ -7048,8 +7048,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 +7062,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 +7114,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 +7134,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 +7154,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 +7411,7 @@ sub kiriwrite_filter_add{ } - # Connect to the filters database. + # Connect to the filter database. $kiriwrite_dbmodule->connectfilter(1); @@ -7470,7 +7470,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(); @@ -7572,7 +7572,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 +7765,7 @@ sub kiriwrite_filter_edit{ } - # Connect to the filters database. + # Connect to the filter database. $kiriwrite_dbmodule->connectfilter(); @@ -7802,7 +7802,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 +7870,7 @@ sub kiriwrite_filter_edit{ } - # Connect to the filters database. + # Connect to the filter database. $kiriwrite_dbmodule->connectfilter(); @@ -8154,7 +8154,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(); @@ -8466,7 +8466,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 +8479,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 +8635,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 +8806,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 +8998,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); @@ -11260,7 +11269,7 @@ sub kiriwrite_settings_load{ # Load the required Perl modules. - use XML::Simple; + use XML::Simple qw(XMLin); my $xsl = XML::Simple->new(); # Check if the Kiriwrite configuration file exists before using it and @@ -13096,7 +13105,7 @@ sub kiriwrite_utf8convert{ # Load the Encode perl module. - use Encode; + use Encode qw(decode_utf8); # Convert the string. @@ -13501,11 +13510,6 @@ 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'); @@ -13962,7 +13966,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 +13978,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 +14002,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 +14010,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 +14035,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');