3 #################################################################################
4 # Kiriwrite Installer Script (install.pl/install.cgi) #
5 # Installation script for Kiriwrite #
8 # mod_perl 2.x compatabile version #
10 # Copyright (C) 2005-2008 Steve Brokenshire <sbrokenshire@xestia.co.uk> #
12 # This program is free software; you can redistribute it and/or modify it under #
13 # the terms of the GNU General Public License as published by the Free #
14 # Software Foundation; as version 2 of the License. #
16 # This program is distributed in the hope that it will be useful, but WITHOUT #
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
18 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.#
20 # You should have received a copy of the GNU General Public License along with #
21 # this program; if not, write to the Free Software Foundation, Inc., 51 #
22 # Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
23 #################################################################################
25 use strict; # Throw errors if there's something wrong.
26 use warnings; # Write warnings to the HTTP Server Log file.
33 print "Content-type: text/html;\r\n\r\n";
34 print "The CGI::Lite Perl Module is not installed. Please install CGI::Lite and then run this installation script again. CGI::Lite can be installed through CPAN.";
38 # Check if mod_perl is running and if it is then add a notice to say
39 # that additional configuration has to be made.
41 my $modperlenabled = 0;
42 my $installscriptname = "install.cgi";
43 my $kiriwritescriptname = "kiriwrite.cgi";
45 if ($ENV{'MOD_PERL'}){
47 # MOD_PERL 2.X SPECIFIC SECTION.
53 $installscriptname = "install.pl";
54 $kiriwritescriptname = "kiriwrite.pl";
58 # Setup strings in specific languages. Style should be no spacing for
59 # language title and one tabbed spacing for each string.
61 # Define some default settings.
63 my $default_language = "en-GB";
64 my $default_dbdirectory = "db";
65 my $default_outputdirectory = "output";
66 my $default_imagesuri = "/images/kiriwrite";
68 my $default_textarearows = "10";
69 my $default_textareacols = "50";
71 my $default_outputmodule = "Normal";
73 my $default_server = "localhost";
74 my $default_port = "3306";
75 my $default_protocol = "tcp";
76 my $default_name = "database";
77 my $default_username = "username";
78 my $default_prefix = "kiriwrite";
80 my ($kiriwrite_lang, %kiriwrite_lang);
82 $kiriwrite_lang{"en-GB"}{"languagename"} = "English (British)";
83 $kiriwrite_lang{"en-GB"}{"testpass"} = "OK";
84 $kiriwrite_lang{"en-GB"}{"testfail"} = "Error";
86 $kiriwrite_lang{"en-GB"}{"generic"} = "An error occured which is not known to the Kiriwrite installer.";
87 $kiriwrite_lang{"en-GB"}{"invalidvariable"} = "The variable given was invalid.";
88 $kiriwrite_lang{"en-GB"}{"invalidvalue"} = "The value given was invalid.";
89 $kiriwrite_lang{"en-GB"}{"invalidoption"} = "The option given was invalid.";
90 $kiriwrite_lang{"en-GB"}{"variabletoolong"} = "The variable given is too long.";
91 $kiriwrite_lang{"en-GB"}{"blankdirectory"} = "The directory name given is blank.";
92 $kiriwrite_lang{"en-GB"}{"invaliddirectory"} = "The directory name given is invalid.";
93 $kiriwrite_lang{"en-GB"}{"moduleblank"} = "The module filename given is blank.";
94 $kiriwrite_lang{"en-GB"}{"moduleinvalid"} = "The module filename given is invalid.";
96 $kiriwrite_lang{"en-GB"}{"dbdirectorytoolong"} = "The database directory name given is too long.";
97 $kiriwrite_lang{"en-GB"}{"outputdirectorytoolong"} = "The output directory name given is too long.";
98 $kiriwrite_lang{"en-GB"}{"imagesuripathtoolong"} = "The images URI path name given is too long.";
99 $kiriwrite_lang{"en-GB"}{"dateformattoolong"} = "The date format given is too long.";
100 $kiriwrite_lang{"en-GB"}{"customdateformattoolong"} = "The custom date format given is too long.";
101 $kiriwrite_lang{"en-GB"}{"languagefilenametoolong"} = "The language filename given is too long.";
103 $kiriwrite_lang{"en-GB"}{"dateformatblank"} = "The date format given was blank.";
104 $kiriwrite_lang{"en-GB"}{"dateformatinvalid"} = "The date format given is invalid.";
105 $kiriwrite_lang{"en-GB"}{"languagefilenameinvalid"} = "The language filename given is invalid.";
107 $kiriwrite_lang{"en-GB"}{"dbdirectoryblank"} = "The database directory name given is blank.";
108 $kiriwrite_lang{"en-GB"}{"dbdirectoryinvalid"} = "The database directory name given is invalid.";
110 $kiriwrite_lang{"en-GB"}{"outputdirectoryblank"} = "The output directory name given is blank.";
111 $kiriwrite_lang{"en-GB"}{"outputdirectoryinvalid"} = "The output directory name given is invalid.";
113 $kiriwrite_lang{"en-GB"}{"textarearowblank"} = "The text area row value given is blank.";
114 $kiriwrite_lang{"en-GB"}{"textarearowtoolong"} = "The text area row value given is too long.";
115 $kiriwrite_lang{"en-GB"}{"textarearowinvalid"} = "The text area row value given is invalid.";
117 $kiriwrite_lang{"en-GB"}{"textareacolsblank"} = "The text area columns value given is blank.";
118 $kiriwrite_lang{"en-GB"}{"textareacolstoolong"} = "The text area columns value given is too long.";
119 $kiriwrite_lang{"en-GB"}{"textareacolsinvalid"} = "The text area columns value given is invalid.";
121 $kiriwrite_lang{"en-GB"}{"presmoduleblank"} = "The presentation module name given is blank.";
122 $kiriwrite_lang{"en-GB"}{"presmoduleinvalid"} = "The presentation module name given is invalid.";
124 $kiriwrite_lang{"en-GB"}{"dbmoduleblank"} = "The database module name given is blank.";
125 $kiriwrite_lang{"en-GB"}{"dbmoduleinvalid"} = "The database module name given is invalid.";
127 $kiriwrite_lang{"en-GB"}{"outputmoduleblank"} = "The output module name given is blank.";
128 $kiriwrite_lang{"en-GB"}{"outputmoduleinvalid"} = "The output module name given is invalid.";
130 $kiriwrite_lang{"en-GB"}{"presmodulemissing"} = "The presentation module with the filename given is missing.";
131 $kiriwrite_lang{"en-GB"}{"outputmodulemissing"} = "The output module with the filename given is missing.";
132 $kiriwrite_lang{"en-GB"}{"dbmodulemissing"} = "The database module with the filename given is missing.";
133 $kiriwrite_lang{"en-GB"}{"languagefilenamemissing"} = "The language file with the filename given is missing.";
135 $kiriwrite_lang{"en-GB"}{"servernametoolong"} = "The database server name given is too long.";
136 $kiriwrite_lang{"en-GB"}{"servernameinvalid"} = "The database server name given is invalid.";
137 $kiriwrite_lang{"en-GB"}{"serverportnumbertoolong"} = "The database server port number given is too long.";
138 $kiriwrite_lang{"en-GB"}{"serverportnumberinvalidcharacters"} = "The database server port number given contains invalid characters.";
139 $kiriwrite_lang{"en-GB"}{"serverportnumberinvalid"} = "The database server port number given is invalid.";
140 $kiriwrite_lang{"en-GB"}{"serverprotocolnametoolong"} = "The database server protocol name given is too long.";
141 $kiriwrite_lang{"en-GB"}{"serverprotocolinvalid"} = "The database server protocol name is invalid.";
142 $kiriwrite_lang{"en-GB"}{"serverdatabasenametoolong"} = "The database name given is too long.";
143 $kiriwrite_lang{"en-GB"}{"serverdatabasenameinvalid"} = "The database name given is invalid.";
144 $kiriwrite_lang{"en-GB"}{"serverdatabaseusernametoolong"} = "The database server username given is too long.";
145 $kiriwrite_lang{"en-GB"}{"serverdatabaseusernameinvalid"} = "The database server username given is invalid.";
146 $kiriwrite_lang{"en-GB"}{"serverdatabasepasswordtoolong"} = "The database server password is too long.";
147 $kiriwrite_lang{"en-GB"}{"serverdatabasetableprefixtoolong"} = "The database server table prefix given is too long.";
148 $kiriwrite_lang{"en-GB"}{"serverdatabasetableprefixinvalid"} = "The database server table prefix given is invalid.";
150 $kiriwrite_lang{"en-GB"}{"removeinstallscripttoolong"} = "The remove install script value given is too long.";
151 $kiriwrite_lang{"en-GB"}{"cannotwriteconfigurationindirectory"} = "The configuration file cannot be written because the directory the install script is running from has invalid permissions.";
152 $kiriwrite_lang{"en-GB"}{"configurationfilereadpermissionsinvalid"} = "The configuration that currently exists has invalid read permissions set.";
153 $kiriwrite_lang{"en-GB"}{"configurationfilewritepermissionsinvalid"} = "The configuration that currently exists has invalid write permissions set.";
155 $kiriwrite_lang{"en-GB"}{"errormessagetext"} = "Please press the back button on your browser or preform the command needed to return to the previous page.";
157 $kiriwrite_lang{"en-GB"}{"switch"} = "Switch";
158 $kiriwrite_lang{"en-GB"}{"setting"} = "Setting";
159 $kiriwrite_lang{"en-GB"}{"value"} = "Value";
160 $kiriwrite_lang{"en-GB"}{"filename"} = "Filename";
161 $kiriwrite_lang{"en-GB"}{"module"} = "Module";
162 $kiriwrite_lang{"en-GB"}{"result"} = "Result";
163 $kiriwrite_lang{"en-GB"}{"error"} = "Error!";
164 $kiriwrite_lang{"en-GB"}{"criticalerror"} = "Critical Error!";
165 $kiriwrite_lang{"en-GB"}{"errormessage"} = "Error: ";
166 $kiriwrite_lang{"en-GB"}{"warningmessage"} = "Warning: ";
168 $kiriwrite_lang{"en-GB"}{"doesnotexist"} = "Does not exist.";
169 $kiriwrite_lang{"en-GB"}{"invalidpermissionsset"} = "Invalid permissions set.";
171 $kiriwrite_lang{"en-GB"}{"dependencyperlmodulesmissing"} = "One or more Perl modules that are needed by Kiriwrite are not installed or has problems. See the Kiriwrite documentation for more information on this.";
172 $kiriwrite_lang{"en-GB"}{"databaseperlmodulesmissing"} = "One or more Perl modules that are needed by the Kiriwrite database modules are not installed or has problems. See the Kiriwrite documentation for more information on this. There should however, be no problems with the database modules which use the Perl modules that have been found.";
173 $kiriwrite_lang{"en-GB"}{"filepermissionsinvalid"} = "One or more of the filenames checked does not exist or has invalid permissions set. See the Kiriwrite documentation for more information on this.";
174 $kiriwrite_lang{"en-GB"}{"dependencymodulesnotinstalled"} = "One of the required Perl modules is not installed or has errors. See the Kiriwrite documentation for more information on this.";
175 $kiriwrite_lang{"en-GB"}{"databasemodulesnotinstalled"} = "None of Perl modules that are used by the database modules are not installed. See the Kiriwrite documentation for more information on this.";
176 $kiriwrite_lang{"en-GB"}{"filepermissionerrors"} = "One or more filenames checked has errors. See the Kiriwrite documentation for more information on this.",
178 $kiriwrite_lang{"en-GB"}{"installertitle"} = "Kiriwrite Installer";
179 $kiriwrite_lang{"en-GB"}{"installertext"} = "This installer script will setup the configuration file used for Kiriwrite. The settings displayed here can be changed at a later date by selecting the Edit Settings link in the View Settings sub-menu.";
180 $kiriwrite_lang{"en-GB"}{"modperlnotice"} = "mod_perl has been detected. Please ensure that you have setup this script and the main Kiriwrite script so that mod_perl can use Kiriwrite properly. Please read the mod_perl specific part of Chapter 1: Installation in the Kiriwrite documentation.";
181 $kiriwrite_lang{"en-GB"}{"dependencytitle"} = "Dependency and file testing results";
182 $kiriwrite_lang{"en-GB"}{"requiredmodules"} = "Required Modules";
183 $kiriwrite_lang{"en-GB"}{"perlmodules"} = "These Perl modules are used internally by Kiriwrite.";
184 $kiriwrite_lang{"en-GB"}{"databasemodules"} = "Perl Database Modules";
185 $kiriwrite_lang{"en-GB"}{"databasemodulestext"} = "These Perl modules are used by the database modules.";
186 $kiriwrite_lang{"en-GB"}{"filepermissions"} = "File permissions";
187 $kiriwrite_lang{"en-GB"}{"filepermissionstext"} = "The file permissions are for file and directories that are critical to Kiriwrite such as module and language directories.";
189 $kiriwrite_lang{"en-GB"}{"settingstitle"} = "Kiriwrite Settings";
190 $kiriwrite_lang{"en-GB"}{"settingstext"} = "The settings given here will be used by Kiriwrite. Some default settings are given here. Certain database modules (like SQLite) do not need the database server settings and can be left alone.";
191 $kiriwrite_lang{"en-GB"}{"directories"} = "Directories";
192 $kiriwrite_lang{"en-GB"}{"databasedirectory"} = "Database Directory";
193 $kiriwrite_lang{"en-GB"}{"outputdirectory"} = "Output Directory";
194 $kiriwrite_lang{"en-GB"}{"imagesuripath"} = "Images (URI path)";
195 $kiriwrite_lang{"en-GB"}{"display"} = "Display";
196 $kiriwrite_lang{"en-GB"}{"textareacols"} = "Text Area Columns";
197 $kiriwrite_lang{"en-GB"}{"textarearows"} = "Text Area Rows";
198 $kiriwrite_lang{"en-GB"}{"date"} = "Date";
199 $kiriwrite_lang{"en-GB"}{"dateformat"} = "Date Format";
200 $kiriwrite_lang{"en-GB"}{"language"} = "Language";
201 $kiriwrite_lang{"en-GB"}{"systemlanguage"} = "System Language";
202 $kiriwrite_lang{"en-GB"}{"modules"} = "Modules";
203 $kiriwrite_lang{"en-GB"}{"presentationmodule"} = "Presentation Module";
204 $kiriwrite_lang{"en-GB"}{"outputmodule"} = "Output Module";
205 $kiriwrite_lang{"en-GB"}{"databasemodule"} = "Database Module";
206 $kiriwrite_lang{"en-GB"}{"databaseserver"} = "Database Server";
207 $kiriwrite_lang{"en-GB"}{"databaseport"} = "Database Port";
208 $kiriwrite_lang{"en-GB"}{"databaseprotocol"} = "Database Protocol";
209 $kiriwrite_lang{"en-GB"}{"databasename"} = "Database Name";
210 $kiriwrite_lang{"en-GB"}{"databaseusername"} = "Database Username";
211 $kiriwrite_lang{"en-GB"}{"databasepassword"} = "Database Password";
212 $kiriwrite_lang{"en-GB"}{"databasetableprefix"} = "Database Table Prefix";
213 $kiriwrite_lang{"en-GB"}{"installationoptions"} = "Installation Options";
214 $kiriwrite_lang{"en-GB"}{"installoptions"} = "Install Options";
215 $kiriwrite_lang{"en-GB"}{"removeinstallscript"} = "Delete this installer script after configuration file has been written.";
216 $kiriwrite_lang{"en-GB"}{"savesettingsbutton"} = "Save Settings";
217 $kiriwrite_lang{"en-GB"}{"resetsettingsbutton"} = "Reset Settings";
219 $kiriwrite_lang{"en-GB"}{"installscriptremoved"} = "The installer script was removed.";
220 $kiriwrite_lang{"en-GB"}{"installedmessage"} = "The configuration file for Kiriwrite has been written. To change the settings in the configuration file at a later date use the Edit Settings link in the View Settings sub-menu at the top of the page when using Kiriwrite.";
221 $kiriwrite_lang{"en-GB"}{"cannotremovescript"} = "Unable to remove the installer script: %s. The installer script will have to be deleted manually.";
222 $kiriwrite_lang{"en-GB"}{"usekiriwritetext"} = "To use Kiriwrite click or select the link below (will not work if the Kiriwrite script is not called kiriwrite.cgi/kiriwrite.pl):";
223 $kiriwrite_lang{"en-GB"}{"usekiriwritelink"} = "Start using Kiriwrite.";
225 my $query_lite = new CGI::Lite;
226 my $form_data = $query_lite->parse_form_data;
228 my $language_selected = "";
229 my $http_query_confirm = $form_data->{'confirm'};
230 my $http_query_installlanguage = $form_data->{'installlanguage'};
232 if (!$http_query_installlanguage){
234 $language_selected = $default_language;
238 $language_selected = $http_query_installlanguage;
242 # Process the list of available languages.
244 my $language_list_name;
245 my @language_list_short;
246 my @language_list_long;
248 foreach my $language (keys %kiriwrite_lang){
250 $language_list_name = $kiriwrite_lang{$language}{"languagename"} . " (" . $language . ")";
251 push(@language_list_short, $language);
252 push(@language_list_long, $language_list_name);
256 # The CSS Stylesheet to use.
265 background-color: #408080;
267 font-family: sans-serif;
273 background-color: #408080;
275 border-color: #102020;
285 background-color: #408080;
287 border-color: #102020;
299 background-color: #204040;
305 background-color: #204040;
309 background-color: #204040;
314 background-color: #357070;
319 background-color: #306060;
326 #################################################################################
327 # Begin list of subroutines. #
328 #################################################################################
330 sub kiriwrite_variablecheck{
331 #################################################################################
332 # kiriwrite_variablecheck: Check to see if the data passed is valid. #
336 # kiriwrite_variablecheck(variablename, type, option, noerror); #
338 # variablename Specifies the variable to be checked. #
339 # type Specifies what type the variable is. #
340 # option Specifies the maximum/minimum length of the variable #
341 # (if minlength/maxlength is used) or if the filename should be #
342 # checked to see if it is blank. #
343 # noerror Specifies if Kiriwrite should return an error or not on #
345 #################################################################################
347 # Get the values that were passed to the subroutine.
349 my ($variable_data, $variable_type, $variable_option, $variable_noerror) = @_;
351 if ($variable_type eq "numbers"){
353 # Check for numbers and return an error if there is anything else than numebrs.
355 my $variable_data_validated = $variable_data; # Copy the variable_data to variable_data_validated.
356 $variable_data_validated =~ tr/0-9//d; # Take away all of the numbers and from the variable.
357 # If it only contains numbers then it should be blank.
359 if ($variable_data_validated eq ""){
360 # The validated variable is blank. So continue to the end of this section where the return function should be.
362 # The variable is not blank, so check if the no error value is set
365 if ($variable_noerror eq 1){
367 # The validated variable is not blank and the noerror
368 # value is set to 1. So return an value of 1.
369 # (meaning that the data is invalid).
373 } elsif ($variable_noerror eq 0) {
375 # The validated variable is not blank and the noerror
378 kiriwrite_error("invalidvariable");
382 # The variable noerror value is something else
383 # pther than 1 or 0. So return an error.
385 kiriwrite_error("invalidvariable");
393 } elsif ($variable_type eq "lettersnumbers"){
395 # Check for letters and numbers and return an error if there is anything else other
396 # than letters and numbers.
398 my $variable_data_validated = $variable_data; # Copy the variable_data to variable_data_validated
399 $variable_data_validated =~ tr/a-zA-Z0-9.//d;
400 $variable_data_validated =~ s/\s//g;
402 if ($variable_data_validated eq ""){
403 # The validated variable is blank. So continue to the end of this section where the return function should be.
405 # The variable is not blank, so check if the no error value is set
408 if ($variable_noerror eq 1){
410 # The validated variable is not blank and the noerror
411 # value is set to 1. So return an value of 1.
412 # (meaning that the data is invalid).
416 } elsif ($variable_noerror eq 0) {
418 # The validated variable is not blank and the noerror
421 kiriwrite_error("invalidvariable");
425 # The variable noerror value is something else
426 # pther than 1 or 0. So return an error.
428 kiriwrite_error("invalidvariable");
436 } elsif ($variable_type eq "maxlength"){
437 # Check for the length of the variable, return an error if it is longer than the length specified.
439 # Check if the variable_data string is blank, if it is then set the variable_data_length
442 my $variable_data_length = 0;
444 if (!$variable_data){
446 # Set variable_data_length to '0'.
447 $variable_data_length = 0;
451 # Get the length of the variable recieved.
452 $variable_data_length = length($variable_data);
458 if ($variable_data_length > $variable_option){
460 # The variable length is longer than it should be so check if
461 # the no error value is set 1.
463 if ($variable_noerror eq 1){
465 # The no error value is set to 1, so return an
466 # value of 1 (meaning tha the variable is
467 # too long to be used).
471 } elsif ($variable_noerror eq 0){
473 # The no error value is set to 0, so return
476 kiriwrite_error("variabletoolong");
480 # The no error value is something else other
481 # than 0 or 1, so return an error.
483 kiriwrite_error("variabletoolong");
489 # The variable length is exactly or shorter than specified, so continue to end of this section where
490 # the return function should be.
496 } elsif ($variable_type eq "datetime"){
497 # Check if the date and time setting format is valid.
499 if ($variable_data eq ""){
501 if ($variable_noerror eq 1){
503 # The no error value is set to 1 so return
504 # a value of 1 (meaning that the date and
505 # time format was blank).
509 } elsif ($variable_noerror eq 0){
511 # The no error value is set to 1 so return
514 kiriwrite_error("dateformatblank");
518 # The no error value is something else other
519 # than 0 or 1, so return an error.
521 kiriwrite_error("invalidvariable");
527 my $variable_data_validated = $variable_data;
528 $variable_data_validated =~ tr|dDmMyYhms/():[ ]||d;
530 if ($variable_data_validated eq ""){
532 # The date and time format is valid. So
537 # The validated data variable is not blank, meaning
538 # that it contains something else, so return an error
541 if ($variable_noerror eq 1){
543 # The no error value is set to 1 so return
544 # an value of 2. (meaning that the date and
545 # time format was invalid).
549 } elsif ($variable_noerror eq 0){
551 # The no error value is set to 0 so return
554 kiriwrite_error("dateformatinvalid");
558 # The no error value is something else other
559 # than 0 or 1 so return an error.
561 kiriwrite_error("invalidvariable");
569 } elsif ($variable_type eq "directory"){
570 # Check if the directory only contains letters and numbers and
571 # return an error if anything else appears.
573 my $variable_data_validated = $variable_data;
574 $variable_data_validated =~ tr/a-zA-Z0-9//d;
576 if ($variable_data eq ""){
578 if ($variable_noerror eq 1){
580 # The no error value is set to 1 so return
581 # a value of 1 (meaning that the directory
586 } elsif ($variable_noerror eq 0){
588 # The no error value is set to 1 so return
591 kiriwrite_error("blankdirectory");
595 # The no error value is something else other
596 # than 0 or 1, so return an error.
598 kiriwrite_error("invalidvariable");
604 if ($variable_data_validated eq ""){
606 # The validated data variable is blank, meaning that
607 # it only contains letters and numbers.
611 # The validated data variable is not blank, meaning
612 # that it contains something else, so return an error
615 if ($variable_noerror eq 1){
617 # The no error value is set to 1 so return
618 # an value of 2. (meaning that the directory
623 } elsif ($variable_noerror eq 0){
625 # The no error value is set to 0 so return
628 kiriwrite_error("invaliddirectory");
632 # The no error value is something else other
633 # than 0 or 1 so return an error.
635 kiriwrite_error("invalidvariable");
643 } elsif ($variable_type eq "language_filename"){
645 # The variable type is a language filename type.
646 # Check if the language file name is blank and
647 # if it is then return an error (or value).
649 if ($variable_data eq ""){
651 # The language filename is blank so check the
652 # no error value and return an error (or value).
654 if ($variable_noerror eq 1){
656 # Language filename is blank and the no error value
657 # is set as 1, so return a value of 1 (saying that
658 # the language filename is blank).
662 } elsif ($variable_noerror eq 0) {
664 # Language filename is blank and the no error value
665 # is not set as 1, so return an error.
667 kiriwrite_error("languagefilenameblank");
671 # The noerror value is something else other
672 # than 0 or 1 so return an error.
674 kiriwrite_error("invalidvariable");
680 # Set the following variables for later on.
682 my $variable_data_length = 0;
683 my $variable_data_char = "";
684 my $variable_data_seek = 0;
686 # Get the length of the language file name.
688 $variable_data_length = length($variable_data);
692 # Get a character from the language filename passed to this
693 # subroutine and the character the seek counter value is set
696 $variable_data_char = substr($variable_data, $variable_data_seek, 1);
698 # Check if the language filename contains a forward slash or a dot,
699 # if the selected character is a forward slash then return an error
702 if ($variable_data_char eq "/" || $variable_data_char eq "."){
704 # The language filename contains a forward slash or
705 # a dot so depending on the no error value, return
706 # an error or a value.
708 if ($variable_noerror eq 1){
710 # Language filename contains a forward slash or a dot
711 # and the no error value has been set to 1, so return
712 # an value of 2 (saying that the language file name is
717 } elsif ($variable_noerror eq 0) {
719 # Language filename contains a forward slash and the no
720 # error value has not been set to 1, so return an error.
722 kiriwrite_error("languagefilenameinvalid");
726 # The noerror value is something else other than
727 # 1 or 0 so return an error.
729 kiriwrite_error("invalidvariable");
735 # Increment the seek counter.
737 $variable_data_seek++;
739 } until ($variable_data_seek eq $variable_data_length);
743 } elsif ($variable_type eq "module"){
745 # The variable type is a presentation module filename.
747 # Check if the variable_data is blank and if it is
750 if ($variable_data eq ""){
752 # The presentation module is blank so check if an error
753 # value should be returned or a number should be
756 if ($variable_noerror eq 1){
758 # Module name is blank and the no error value
759 # is set to 1 so return a value of 2 (meaning
760 # that the page filename is blank).
764 } elsif ($variable_noerror eq 0) {
766 # Module name contains is blank and the no error
767 # value is set to 0 so return an error.
769 kiriwrite_critical("moduleblank");
773 # The no error value is something else other
774 # than 0 or 1 so return an error.
776 kiriwrite_critical("invalidvalue");
784 my $variable_data_validated = $variable_data;
785 $variable_data_validated =~ tr/a-zA-Z0-9//d;
787 if ($variable_data_validated eq ""){
791 if ($variable_noerror eq 1){
793 # Module name contains invalid characters and
794 # the no error value is set to 1 so return a
795 # value of 2 (meaning that the page filename
800 } elsif ($variable_noerror eq 0) {
802 # Module name contains invalid characters and
803 # the no error value is set to 0 so return an
806 kiriwrite_critical("moduleinvalid");
810 # The no error value is something else other
811 # than 0 or 1 so return an error.
813 kiriwrite_error("invalidvalue");
821 } elsif ($variable_type eq "serverprotocol"){
823 # Check if the server protocol is TCP or UDP and return
824 # an error if it isn't.
826 if ($variable_data ne "tcp" && $variable_data ne "udp"){
828 # The protocol given is not valid, check if the no
829 # error value is set to 1 and return an error if it isn't.
831 if ($variable_noerror eq 1){
833 # The no error value has been set to 1, so return a
834 # value of 1 (meaning that the server protocol is
839 } elsif ($variable_noerror eq 0){
841 # The no error value has been set to 0, so return
844 kiriwrite_error("serverprotocolinvalid");
848 # The no error value is something else other than 0
849 # or 1, so return an error.
851 kiriwrite_error("invalidoption");
859 } elsif ($variable_type eq "port"){
861 # Check if the port number given is less than 0 or more than 65535
862 # and return an error if it is.
864 if ($variable_data < 0 || $variable_data > 65535){
866 # The port number is less than 0 and more than 65535 so
867 # check if the no error value is set to 1 and return an
870 if ($variable_noerror eq 1){
872 # The no error value has been set to 1, so return a
873 # value of 1 (meaning that the port number is invalid).
877 } elsif ($variable_noerror eq 0){
879 # The no error value has been set to 0, so return
882 kiriwrite_error("serverportnumberinvalid");
886 # The no error value is something else other than 0
887 # or 1, so return an error.
889 kiriwrite_error("invalidoption");
899 # Another type than the valid ones above has been specified so return an error specifying an invalid option.
900 kiriwrite_error("invalidoption");
905 #################################################################################
906 # kiriwrite_error: Subroutine for processing error messages. #
910 # kiriwrite_error(errortype); #
912 # errortype Specifies the error type to use. #
913 #################################################################################
915 my $error_type = shift;
917 # Load the list of error messages.
919 my (%kiriwrite_error, $kiriwrite_error);
923 # Generic Error Messages
925 "generic" => $kiriwrite_lang{$language_selected}{generic},
927 "invalidvariable" => $kiriwrite_lang{$language_selected}{invalidvariable},
928 "invalidvalue" => $kiriwrite_lang{$language_selected}{invalidvalue},
929 "invalidoption" => $kiriwrite_lang{$language_selected}{invalidoption},
930 "variabletoolong" => $kiriwrite_lang{$language_selected}{variabletoolong},
931 "blankdirectory" => $kiriwrite_lang{$language_selected}{blankdirectory},
932 "invaliddirectory" => $kiriwrite_lang{$language_selected}{invaliddirectory},
933 "moduleblank" => $kiriwrite_lang{$language_selected}{moduleblank},
934 "moduleinvalid" => $kiriwrite_lang{$language_selected}{moduleinvalid},
936 # Specific Error Messages
938 "dbdirectorytoolong" => $kiriwrite_lang{$language_selected}{dbdirectorytoolong},
939 "outputdirectorytoolong" => $kiriwrite_lang{$language_selected}{outputdirectorytoolong},
940 "imagesuripathtoolong" => $kiriwrite_lang{$language_selected}{imagesuripathtoolong},
941 "dateformattoolong" => $kiriwrite_lang{$language_selected}{dateformattoolong},
942 "customdateformattoolong" => $kiriwrite_lang{$language_selected}{customdateformattoolong},
943 "languagefilenametoolong" => $kiriwrite_lang{$language_selected}{languagefilenametoolong},
945 "dateformatblank" => $kiriwrite_lang{$language_selected}{dateformatblank},
946 "dateformatinvalid" => $kiriwrite_lang{$language_selected}{dateformatinvalid},
947 "languagefilenameinvalid" => $kiriwrite_lang{$language_selected}{languagefilenameinvalid},
949 "dbdirectoryblank" => $kiriwrite_lang{$language_selected}{dbdirectoryblank},
950 "dbdirectoryinvalid" => $kiriwrite_lang{$language_selected}{dbdirectoryinvalid},
952 "textarearowblank" => $kiriwrite_lang{$language_selected}{textarearowblank},
953 "textarearowtoolong" => $kiriwrite_lang{$language_selected}{textarearowtoolong},
954 "textarearowinvalid" => $kiriwrite_lang{$language_selected}{textarearowinvalid},
956 "textareacolsblank" => $kiriwrite_lang{$language_selected}{textareacolsblank},
957 "textareacolstoolong" => $kiriwrite_lang{$language_selected}{textareacolstoolong},
958 "textareacolsinvalid" => $kiriwrite_lang{$language_selected}{textareacolsinvalid},
960 "outputdirectoryblank" => $kiriwrite_lang{$language_selected}{outputdirectoryblank},
961 "outputdirectoryinvalid" => $kiriwrite_lang{$language_selected}{outputdirectoryinvalid},
963 "presmoduleblank" => $kiriwrite_lang{$language_selected}{presmoduleblank},
964 "presmoduleinvalid" => $kiriwrite_lang{$language_selected}{presmoduleinvalid},
966 "dbmoduleblank" => $kiriwrite_lang{$language_selected}{dbmoduleblank},
967 "dbmoduleinvalid" => $kiriwrite_lang{$language_selected}{dbmoduleinvalid},
969 "presmodulemissing" => $kiriwrite_lang{$language_selected}{presmodulemissing},
970 "dbmodulemissing" => $kiriwrite_lang{$language_selected}{dbmodulemissing},
971 "languagefilenamemissing" => $kiriwrite_lang{$language_selected}{languagefilenamemissing},
973 "servernametoolong" => $kiriwrite_lang{$language_selected}{servernametoolong},
974 "servernameinvalid" => $kiriwrite_lang{$language_selected}{servernameinvalid},
975 "serverportnumbertoolong" => $kiriwrite_lang{$language_selected}{serverportnumbertoolong},
976 "serverportnumberinvalidcharacters" => $kiriwrite_lang{$language_selected}{serverportnumberinvalidcharacters},
977 "serverportnumberinvalid" => $kiriwrite_lang{$language_selected}{serverportnumberinvalid},
978 "serverprotocolnametoolong" => $kiriwrite_lang{$language_selected}{serverprotocolnametoolong},
979 "serverprotocolinvalid" => $kiriwrite_lang{$language_selected}{serverprotocolinvalid},
980 "serverdatabasenametoolong" => $kiriwrite_lang{$language_selected}{serverdatabasenametoolong},
981 "serverdatabasenameinvalid" => $kiriwrite_lang{$language_selected}{serverdatabasenameinvalid},
982 "serverdatabaseusernametoolong" => $kiriwrite_lang{$language_selected}{serverdatabaseusernametoolong},
983 "serverdatabaseusernameinvalid" => $kiriwrite_lang{$language_selected}{serverdatabaseusernameinvalid},
984 "serverdatabasepasswordtoolong" => $kiriwrite_lang{$language_selected}{serverdatabasepasswordtoolong},
985 "serverdatabasetableprefixtoolong" => $kiriwrite_lang{$language_selected}{serverdatabasetableprefixtoolong},
986 "serverdatabasetableprefixinvalid" => $kiriwrite_lang{$language_selected}{serverdatabasetableprefixinvalid},
988 "removeinstallscripttoolong" => $kiriwrite_lang{$language_selected}{removeinstallscripttoolong},
989 "cannotwriteconfigurationindirectory" => $kiriwrite_lang{$language_selected}{cannotwriteconfigurationindirectory},
990 "configurationfilereadpermissionsinvalid" => $kiriwrite_lang{$language_selected}{configurationfilereadpermissionsinvalid},
991 "configurationfilewritepermissionsinvalid" => $kiriwrite_lang{$language_selected}{configurationfilewritepermissionsinvalid},
995 # Check if the specified error is blank and if it is
996 # use the generic error messsage.
998 if (!$kiriwrite_error{$error_type}){
999 $error_type = "generic";
1002 print "Content-type: text/html;\r\n\r\n";
1004 print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
1005 print "<head>\n<title>$kiriwrite_lang{$language_selected}{installertitle}</title>\n<style type=\"text/css\" media=\"screen\">$cssstyle</style>\n</head>\n<body>\n";
1007 print "<h2>$kiriwrite_lang{$language_selected}{error}</h2>";
1009 print $kiriwrite_error{$error_type};
1011 print $kiriwrite_lang{$language_selected}{errormessagetext};
1013 print "</body>\n</html>";
1019 sub kiriwrite_writeconfig{
1020 #################################################################################
1021 # kiriwrite_writeconfig: Writes a configuration file. #
1025 # kiriwrite_writeconfig(); #
1026 #################################################################################
1028 my ($passedsettings) = @_;
1030 # Open the configuration file for writing.
1032 open (my $configfile, "> " . "kiriwrite.cfg");
1034 print $configfile "[config]
1035 directory_data_db = $passedsettings->{DatabaseDirectory}
1036 directory_data_output = $passedsettings->{OutputDirectory}
1037 directory_noncgi_images = $passedsettings->{ImagesURIPath}
1039 system_language = $passedsettings->{Language}
1040 system_presmodule = $passedsettings->{PresentationModule}
1041 system_outputmodule = $passedsettings->{OutputModule}
1042 system_dbmodule = $passedsettings->{DatabaseModule}
1043 system_datetime = $passedsettings->{DateFormat}
1045 display_textareacols = $passedsettings->{TextAreaCols}
1046 display_textarearows = $passedsettings->{TextAreaRows}
1047 display_pagecount = 50
1048 display_filtercount = 50
1049 display_templatecount = 50
1051 database_server = $passedsettings->{DatabaseServer}
1052 database_port = $passedsettings->{DatabasePort}
1053 database_protocol = $passedsettings->{DatabaseProtocol}
1054 database_sqldatabase = $passedsettings->{DatabaseName}
1055 database_username = $passedsettings->{DatabaseUsername}
1056 database_password = $passedsettings->{DatabasePassword}
1057 database_tableprefix = $passedsettings->{DatabaseTablePrefix}
1060 close ($configfile);
1064 sub kiriwrite_addtablerow{
1065 #################################################################################
1066 # kiriwrite_addtablerow: Adds a table row. #
1070 # kiriwrite_addtablerow(name, data); #
1072 # name Specifies the name of the table row. #
1073 # namestyle Specifies the style for the name of the table row. #
1074 # data Specifies the data to be used in the table row. #
1075 # datastyle Specifies the style for the data of the table row. #
1076 #################################################################################
1078 my ($name, $namestyle, $data, $datastyle) = @_;
1087 print "<td class=\"$namestyle\">$name</td>\n";
1088 print "<td class=\"$datastyle\">$data</td>\n";
1093 sub kiriwrite_processconfig{
1094 #################################################################################
1095 # kiriwrite_processconfig: Processes an INI style configuration file. #
1099 # kiriwrite_processconfig(data); #
1101 # data Specifies the data to process. #
1102 #################################################################################
1104 my (@settings) = @_;
1106 my ($settings_line, %settings, $settings, $sectionname, $setting_name, $setting_value);
1108 foreach $settings_line (@settings){
1110 next if !$settings_line;
1112 # Check if the first character is a bracket.
1114 if (substr($settings_line, 0, 1) eq "["){
1115 $settings_line =~ s/\[//;
1116 $settings_line =~ s/\](.*)//;
1117 $settings_line =~ s/\n//;
1118 $sectionname = $settings_line;
1122 $setting_name = $settings_line;
1123 $setting_value = $settings_line;
1124 $setting_name =~ s/\=(.*)//;
1125 $setting_name =~ s/\n//;
1126 $setting_value =~ s/(.*)\=//;
1127 $setting_value =~ s/\n//;
1129 # Remove the spacing before and after the '=' sign.
1131 $setting_name =~ s/\s+$//;
1132 $setting_value =~ s/^\s+//;
1133 $setting_value =~ s/\r//;
1135 $settings{$sectionname}{$setting_name} = $setting_value;
1143 #################################################################################
1144 # End list of subroutines. #
1145 #################################################################################
1147 if (!$http_query_confirm){
1149 $http_query_confirm = 0;
1153 if ($http_query_confirm eq 1){
1155 # The confirm value has been given so get the data from the query.
1157 my $http_query_dbdirectory = $form_data->{'dbdirectory'};
1158 my $http_query_outputdirectory = $form_data->{'outputdirectory'};
1159 my $http_query_imagesuripath = $form_data->{'imagesuripath'};
1161 my $http_query_textarearows = $form_data->{'textarearows'};
1162 my $http_query_textareacols = $form_data->{'textareacols'};
1164 my $http_query_dateformat = $form_data->{'dateformat'};
1165 my $http_query_customdateformat = $form_data->{'customdateformat'};
1167 my $http_query_language = $form_data->{'language'};
1169 my $http_query_presmodule = $form_data->{'presmodule'};
1170 my $http_query_outputmodule = $form_data->{'outputmodule'};
1171 my $http_query_dbmodule = $form_data->{'dbmodule'};
1173 my $http_query_databaseserver = $form_data->{'databaseserver'};
1174 my $http_query_databaseport = $form_data->{'databaseport'};
1175 my $http_query_databaseprotocol = $form_data->{'databaseprotocol'};
1176 my $http_query_databasename = $form_data->{'databasename'};
1177 my $http_query_databaseusername = $form_data->{'databaseusername'};
1178 my $http_query_databasepassword = $form_data->{'databasepassword'};
1179 my $http_query_databasetableprefix = $form_data->{'databasetableprefix'};
1180 my $http_query_removeinstallscript = $form_data->{'removeinstallscript'};
1182 # Check if the text area rows and column values are blank.
1184 if (!$http_query_textarearows){
1186 # The text area rows value is blank so return
1189 kiriwrite_error("textarearowblank");
1193 if (!$http_query_textareacols){
1195 # The text area columns value is blank so
1198 kiriwrite_error("textareacolsblank");
1202 # Check the length of the variables.
1204 my $kiriwrite_dbdirectory_length_check = kiriwrite_variablecheck($http_query_dbdirectory, "maxlength", 64, 1);
1205 my $kiriwrite_outputdirectory_length_check = kiriwrite_variablecheck($http_query_outputdirectory, "maxlength", 64, 1);
1206 my $kiriwrite_imagesuripath_length_check = kiriwrite_variablecheck($http_query_imagesuripath, "maxlength", 512, 1);
1207 my $kiriwrite_textarearow_length_check = kiriwrite_variablecheck($http_query_textarearows, "maxlength", 3, 1);
1208 my $kiriwrite_textareacols_length_check = kiriwrite_variablecheck($http_query_textareacols, "maxlength", 3, 1);
1209 my $kiriwrite_dateformat_length_check = kiriwrite_variablecheck($http_query_dateformat, "maxlength", 32, 1);
1210 my $kiriwrite_customdateformat_length_check = kiriwrite_variablecheck($http_query_customdateformat, "maxlength", 32, 1);
1211 my $kiriwrite_language_length_check = kiriwrite_variablecheck($http_query_language, "maxlength", 16, 1);
1213 # Check if any errors occured while checking the
1214 # length of the variables.
1216 if ($kiriwrite_dbdirectory_length_check eq 1){
1218 # The database directory given is too long
1219 # so return an error.
1221 kiriwrite_error("dbdirectorytoolong");
1225 if ($kiriwrite_outputdirectory_length_check eq 1){
1227 # The output directory given is too long
1228 # so return an error.
1230 kiriwrite_error("outputdirectorytoolong");
1234 if ($kiriwrite_imagesuripath_length_check eq 1){
1236 # The images URI path given is too long
1237 # so return an error.
1239 kiriwrite_error("imagesuripathtoolong");
1243 if ($kiriwrite_dateformat_length_check eq 1){
1245 # The date format given is too long
1246 # so return an error.
1248 kiriwrite_error("dateformattoolong");
1252 if ($kiriwrite_customdateformat_length_check eq 1){
1254 # The date format given is too long
1255 # so return an error.
1257 kiriwrite_error("customdateformattoolong");
1261 if ($kiriwrite_language_length_check eq 1){
1263 # The language filename given is too long
1264 # so return an error.
1266 kiriwrite_error("languagefilenametoolong");
1270 if ($kiriwrite_textarearow_length_check eq 1){
1272 # The text area rows length is too long
1273 # so return an error.
1275 kiriwrite_error("textarearowtoolong");
1279 if ($kiriwrite_textareacols_length_check eq 1){
1281 # The text area columns length is too long
1282 # so return an error.
1284 kiriwrite_error("textareacolstoolong");
1288 # Check if the custom date and time setting has anything
1289 # set and if it doesn't then use the predefined one set.
1291 my $finaldateformat = "";
1293 if ($http_query_customdateformat ne ""){
1295 $finaldateformat = $http_query_customdateformat;
1299 $finaldateformat = $http_query_dateformat;
1303 my $kiriwrite_datetime_check = kiriwrite_variablecheck($finaldateformat, "datetime", 0, 1);
1305 if ($kiriwrite_datetime_check eq 1){
1307 # The date and time format is blank so return
1310 kiriwrite_error("dateformatblank");
1312 } elsif ($kiriwrite_datetime_check eq 2){
1314 # The date and time format is invalid so
1317 kiriwrite_error("dateformatinvalid");
1321 # Check if the language filename given is valid.
1323 my $kiriwrite_language_languagefilename_check = kiriwrite_variablecheck($http_query_language, "language_filename", "", 1);
1325 if ($kiriwrite_language_languagefilename_check eq 1) {
1327 # The language filename given is blank so
1330 kiriwrite_error("languagefilenameblank");
1332 } elsif ($kiriwrite_language_languagefilename_check eq 2){
1334 # The language filename given is invalid so
1337 kiriwrite_error("languagefilenameinvalid");
1341 # Check if the directory names only contain letters and numbers and
1342 # return a specific error if they don't.
1344 my $kiriwrite_dbdirectory_check = kiriwrite_variablecheck($http_query_dbdirectory, "directory", 0, 1);
1345 my $kiriwrite_outputdirectory_check = kiriwrite_variablecheck($http_query_outputdirectory, "directory", 0, 1);
1347 if ($kiriwrite_dbdirectory_check eq 1){
1349 # The database directory name is blank, so return
1352 kiriwrite_error("dbdirectoryblank");
1354 } elsif ($kiriwrite_dbdirectory_check eq 2){
1356 # The database directory name is invalid, so return
1359 kiriwrite_error("dbdirectoryinvalid");
1363 if ($kiriwrite_outputdirectory_check eq 1){
1365 # The output directory name is blank, so return
1368 kiriwrite_error("outputdirectoryblank");
1370 } elsif ($kiriwrite_outputdirectory_check eq 2){
1372 # The output directory name is invalid, so return
1375 kiriwrite_error("outputdirectoryinvalid");
1379 if ($kiriwrite_dbdirectory_check eq 1){
1381 # The database directory name is blank, so return
1384 kiriwrite_error("dbdirectoryblank");
1386 } elsif ($kiriwrite_dbdirectory_check eq 2){
1388 # The database directory name is invalid, so return
1391 kiriwrite_error("dbdirectoryinvalid");
1395 if ($kiriwrite_outputdirectory_check eq 1){
1397 # The output directory name is blank, so return
1400 kiriwrite_error("outputdirectoryblank");
1402 } elsif ($kiriwrite_outputdirectory_check eq 2){
1404 # The output directory name is invalid, so return
1407 kiriwrite_error("outputdirectoryinvalid");
1411 # Check to see if the text area rows and column values
1414 my $kiriwrite_textarearow_number_check = kiriwrite_variablecheck($http_query_textarearows, "numbers", 0, 1);
1415 my $kiriwrite_textareacols_number_check = kiriwrite_variablecheck($http_query_textareacols, "numbers", 0, 1);
1417 if ($kiriwrite_textarearow_number_check eq 1){
1419 # The text area row value is invalid so return
1422 kiriwrite_error("textarearowinvalid");
1426 if ($kiriwrite_textareacols_number_check eq 1){
1428 # The text area columns value is invalid so return
1431 kiriwrite_error("textareacolsinvalid");
1435 # Check the module names to see if they're valid.
1437 my $kiriwrite_presmodule_modulename_check = kiriwrite_variablecheck($http_query_presmodule, "module", 0, 1);
1438 my $kiriwrite_outputmodule_modulename_check = kiriwrite_variablecheck($http_query_outputmodule, "module", 0, 1);
1439 my $kiriwrite_dbmodule_modulename_check = kiriwrite_variablecheck($http_query_dbmodule, "module", 0, 1);
1441 if ($kiriwrite_presmodule_modulename_check eq 1){
1443 # The presentation module name is blank, so return
1446 kiriwrite_error("presmoduleblank");
1450 if ($kiriwrite_presmodule_modulename_check eq 2){
1452 # The presentation module name is invalid, so return
1455 kiriwrite_error("presmoduleinvalid");
1459 if ($kiriwrite_outputmodule_modulename_check eq 1){
1461 # The output module name is blank, so return
1464 kiriwrite_error("outputmoduleblank");
1468 if ($kiriwrite_outputmodule_modulename_check eq 2){
1470 # The output module name is invalid, so return
1473 kiriwrite_error("outputmoduleinvalid");
1477 if ($kiriwrite_dbmodule_modulename_check eq 1){
1479 # The database module name is blank, so return
1482 kiriwrite_error("dbmoduleblank");
1486 if ($kiriwrite_dbmodule_modulename_check eq 2){
1488 # The database module name is invalid, so return
1491 kiriwrite_error("dbmoduleinvalid");
1495 # Check if the database module, presentation module,
1496 # output module and language file exists.
1498 if (!-e "Modules/Presentation/" . $http_query_presmodule . ".pm"){
1500 # The presentation module is missing so return an
1503 kiriwrite_error("presmodulemissing");
1507 if (!-e "Modules/Output/" . $http_query_outputmodule . ".pm"){
1509 # The database module is missing so return an
1512 kiriwrite_error("outputmodulemissing");
1516 if (!-e "Modules/Database/" . $http_query_dbmodule . ".pm"){
1518 # The database module is missing so return an
1521 kiriwrite_error("dbmodulemissing");
1525 if (!-e "lang/" . $http_query_language . ".lang"){
1527 # The language file is missing so return an
1530 kiriwrite_error("languagefilenamemissing");
1534 # Check the database server settings.
1536 my $kiriwrite_databaseserver_length_check = kiriwrite_variablecheck($http_query_databaseserver, "maxlength", 128, 1);
1537 my $kiriwrite_databaseserver_lettersnumbers_check = kiriwrite_variablecheck($http_query_databaseserver, "lettersnumbers", 0, 1);
1538 my $kiriwrite_databaseport_length_check = kiriwrite_variablecheck($http_query_databaseport, "maxlength", 5, 1);
1539 my $kiriwrite_databaseport_numbers_check = kiriwrite_variablecheck($http_query_databaseport, "numbers", 0, 1);
1540 my $kiriwrite_databaseport_port_check = kiriwrite_variablecheck($http_query_databaseport, "port", 0, 1);
1541 my $kiriwrite_databaseprotocol_length_check = kiriwrite_variablecheck($http_query_databaseprotocol, "maxlength", 5, 1);
1542 my $kiriwrite_databaseprotocol_protocol_check = kiriwrite_variablecheck($http_query_databaseprotocol, "serverprotocol", 0, 1);
1543 my $kiriwrite_databasename_length_check = kiriwrite_variablecheck($http_query_databasename, "maxlength", 32, 1);
1544 my $kiriwrite_databasename_lettersnumbers_check = kiriwrite_variablecheck($http_query_databasename, "lettersnumbers", 0, 1);
1545 my $kiriwrite_databaseusername_length_check = kiriwrite_variablecheck($http_query_databaseusername, "maxlength", 16, 1);
1546 my $kiriwrite_databaseusername_lettersnumbers_check = kiriwrite_variablecheck($http_query_databaseusername, "lettersnumbers", 0, 1);
1547 my $kiriwrite_databasepassword_length_check = kiriwrite_variablecheck($http_query_databasepassword, "maxlength", 64, 1);
1548 my $kiriwrite_databasetableprefix_length_check = kiriwrite_variablecheck($http_query_databasetableprefix, "maxlength", 16, 1);
1549 my $kiriwrite_databasetableprefix_lettersnumbers_check = kiriwrite_variablecheck($http_query_databasetableprefix, "lettersnumbers", 0, 1);
1551 if ($kiriwrite_databaseserver_length_check eq 1){
1553 # The length of the database server name is too long so
1556 kiriwrite_error("servernametoolong");
1560 if ($kiriwrite_databaseserver_lettersnumbers_check eq 1){
1562 # The database server name contains characters other
1563 # than letters and numbers, so return an error.
1565 kiriwrite_error("servernameinvalid");
1569 if ($kiriwrite_databaseport_length_check eq 1){
1571 # The database port number length is too long so return
1574 kiriwrite_error("serverportnumbertoolong");
1578 if ($kiriwrite_databaseport_numbers_check eq 1){
1580 # The database port number contains characters other
1581 # than numbers so return an error.
1583 kiriwrite_error("serverportnumberinvalidcharacters");
1587 if ($kiriwrite_databaseport_port_check eq 1){
1589 # The database port number given is invalid so return
1592 kiriwrite_error("serverportnumberinvalid");
1596 if ($kiriwrite_databaseprotocol_length_check eq 1){
1598 # The database protocol name given is too long so
1601 kiriwrite_error("serverprotocolnametoolong");
1605 if ($kiriwrite_databaseprotocol_protocol_check eq 1){
1607 # The server protcol given is invalid so return
1610 kiriwrite_error("serverprotocolinvalid");
1614 if ($kiriwrite_databasename_length_check eq 1){
1616 # The SQL database name is too long so return
1619 kiriwrite_error("serverdatabasenametoolong");
1623 if ($kiriwrite_databasename_lettersnumbers_check eq 1){
1625 # The database name contains invalid characters
1626 # so return an error.
1628 kiriwrite_error("serverdatabasenameinvalid");
1632 if ($kiriwrite_databaseusername_length_check eq 1){
1634 # The database username given is too long so
1637 kiriwrite_error("serverdatabaseusernametoolong");
1641 if ($kiriwrite_databaseusername_lettersnumbers_check eq 1){
1643 # The database username contains invalid characters
1644 # so return an error.
1646 kiriwrite_error("serverdatabaseusernameinvalid");
1650 if ($kiriwrite_databasepassword_length_check eq 1){
1652 # The database password given is too long so return
1655 kiriwrite_error("serverdatabasepasswordtoolong");
1659 if ($kiriwrite_databasetableprefix_length_check eq 1){
1661 # The database table prefix given is too long so
1664 kiriwrite_error("serverdatabasetableprefixtoolong");
1668 if ($kiriwrite_databasetableprefix_lettersnumbers_check eq 1){
1670 # The database table prefix given contains invalid
1671 # characters so return an error.
1673 kiriwrite_error("serverdatabasetableprefixinvalid");
1677 # Check the length of value of the checkboxes.
1679 my $kiriwrite_removeinstallscript_length_check = kiriwrite_variablecheck($http_query_removeinstallscript, "maxlength", 2, 1);
1681 if ($kiriwrite_removeinstallscript_length_check eq 1){
1683 # The remove install script value is too long
1684 # so return an error.
1686 kiriwrite_error("removeinstallscripttoolong");
1690 # Check if there is write permissions for the directory.
1694 # No write permissions for the directory the
1695 # script is running from so return an error.
1697 kiriwrite_error("cannotwriteconfigurationindirectory");
1701 # Check if the configuration file already exists.
1703 if (-e 'kiriwrite.cfg'){
1705 # Check if the configuration file has read permissions.
1707 if (!-r 'kiriwrite.cfg'){
1709 # The configuration file has invalid read permissions
1710 # set so return an error.
1712 kiriwrite("configurationfilereadpermissionsinvalid");
1716 # Check if the configuration file has write permissions.
1718 if (!-w 'kiriwrite.cfg'){
1720 # The configuration file has invalid write permissions
1721 # set so return an error.
1723 kiriwrite("configurationfilewritepermissionsinvalid");
1729 # Write the new configuration file.
1731 kiriwrite_writeconfig({ DatabaseDirectory => $http_query_dbdirectory, OutputDirectory => $http_query_outputdirectory, ImagesURIPath => $http_query_imagesuripath, TextAreaCols => $http_query_textareacols, TextAreaRows => $http_query_textarearows, DateFormat => $finaldateformat, Language => $http_query_language, PresentationModule => $http_query_presmodule, OutputModule => $http_query_outputmodule, DatabaseModule => $http_query_dbmodule, DatabaseServer => $http_query_databaseserver, DatabasePort => $http_query_databaseport, DatabaseProtocol => $http_query_databaseprotocol, DatabaseName => $http_query_databasename, DatabaseUsername => $http_query_databaseusername, DatabasePassword => $http_query_databasepassword, DatabaseTablePrefix => $http_query_databasetableprefix });
1733 my $installscriptmessage = "";
1735 # Check if the installation script should be deleted.
1737 if (!$http_query_removeinstallscript){
1739 $http_query_removeinstallscript = "off";
1743 if ($http_query_removeinstallscript eq "on"){
1745 if (unlink($installscriptname)){
1747 $installscriptmessage = $kiriwrite_lang{$language_selected}{installscriptremoved};
1751 $installscriptmessage = $kiriwrite_lang{$language_selected}{cannotremovescript};
1752 $installscriptmessage =~ s/%s/$!/g;
1758 print "Content-type: text/html\r\n\r\n";
1760 #print start_html({ -title => $kiriwrite_lang{$language_selected}{installertitle}, -style => { -code => $cssstyle }});
1761 print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
1762 print "<head>\n<title>$kiriwrite_lang{$language_selected}{installertitle}</title>\n<style type=\"text/css\" media=\"screen\">$cssstyle</style>\n</head>\n<body>\n";
1763 print "<h2>$kiriwrite_lang{$language_selected}{installertitle}</h2>";
1764 print $kiriwrite_lang{$language_selected}{installedmessage};
1766 if ($installscriptmessage){
1768 print "<br /><br />\n";
1769 print $installscriptmessage;
1773 print "<br /><br />\n";
1774 print $kiriwrite_lang{$language_selected}{usekiriwritetext};
1775 print "<br /><br />\n";
1776 print "<a href=\"" . $kiriwritescriptname . "\">$kiriwrite_lang{$language_selected}{usekiriwritelink}</a>";
1777 print "</body>\n</html>";
1783 # Create a list of common date and time formats.
1785 my @datetime_formats = (
1786 'DD/MM/YY (hh:mm:ss)', 'DD/MM/YY hh:mm:ss', 'D/M/Y (hh:mm:ss)',
1787 'D/M/Y hh:mm:ss', 'D/M/YY (hh:mm:ss)', 'D/M/YY hh:mm:ss',
1788 'DD/MM (hh:mm:ss)', 'D/M (hh:mm:ss)', 'DD/MM hh:mm:ss',
1789 'D/M hh:mm:ss', 'DD/MM hh:mm', 'D/M hh:mm',
1790 'DD/MM/YY', 'D/M/Y', 'DD/MM',
1792 'YY-MM-DD (hh:mm:ss)', 'YY-MM-DD hh:mm:ss', 'Y-M-D (hh:mm:ss)',
1793 'Y-M-D hh:mm:ss', 'M-D (hh:mm:ss)', 'M-D hh:mm:ss',
1797 # Create the list of tests to do.
1799 my ($test_list, %test_list);
1800 my %dependency_results;
1801 my %database_results;
1806 my $dependency_error = 0;
1807 my $database_onemodule = 0;
1808 my $database_error = 0;
1812 my $language_xml_data;
1813 my $language_file_friendly;
1815 my $presentation_file_friendly;
1817 # Check to see if the needed Perl modules are installed.
1819 $test_list{CheckDBI}{Name} = "DBI";
1820 $test_list{CheckDBI}{Type} = "dependency";
1821 $test_list{CheckDBI}{Code} = "DBI";
1823 $test_list{CheckCGILite}{Name} = "CGI::Lite";
1824 $test_list{CheckCGILite}{Type} = "dependency";
1825 $test_list{CheckCGILite}{Code} = "CGI::Lite";
1827 $test_list{Encode}{Name} = "Encode";
1828 $test_list{Encode}{Type} = "dependency";
1829 $test_list{Encode}{Code} = "Encode";
1831 $test_list{HashSearch}{Name} = "Hash::Search";
1832 $test_list{HashSearch}{Type} = "dependency";
1833 $test_list{HashSearch}{Code} = "Hash::Search";
1835 $test_list{CheckTieHash}{Name} = "Tie::IxHash";
1836 $test_list{CheckTieHash}{Type} = "dependency";
1837 $test_list{CheckTieHash}{Code} = "Tie::IxHash";
1839 $test_list{DBDmysql}{Name} = "DBD::mysql";
1840 $test_list{DBDmysql}{Type} = "database";
1841 $test_list{DBDmysql}{Code} = "DBD::mysql";
1843 $test_list{DBDSQLite}{Name} = "DBD::SQLite";
1844 $test_list{DBDSQLite}{Type} = "database";
1845 $test_list{DBDSQLite}{Code} = "DBD::SQLite";
1847 # Check the file and directory permissions to see if they are correct.
1849 $test_list{MainDirectory}{Name} = "Kiriwrite Directory (.)";
1850 $test_list{MainDirectory}{Type} = "file";
1851 $test_list{MainDirectory}{Code} = ".";
1852 $test_list{MainDirectory}{Writeable} = "1";
1854 $test_list{LanguageDirectory}{Name} = "Language Directory (lang)";
1855 $test_list{LanguageDirectory}{Type} = "file";
1856 $test_list{LanguageDirectory}{Code} = "lang";
1857 $test_list{LanguageDirectory}{Writeable} = "0";
1859 $test_list{ModulesDirectory}{Name} = "Modules Directory (Modules)";
1860 $test_list{ModulesDirectory}{Type} = "file";
1861 $test_list{ModulesDirectory}{Code} = "Modules";
1862 $test_list{ModulesDirectory}{Writeable} = "0";
1864 $test_list{DBModulesDirectory}{Name} = "Database Modules Directory (Modules/Database)";
1865 $test_list{DBModulesDirectory}{Type} = "file";
1866 $test_list{DBModulesDirectory}{Code} = "Modules/Database";
1867 $test_list{DBModulesDirectory}{Writeable} = "0";
1869 $test_list{PresModulesDirectory}{Name} = "Presentation Modules Directory (Modules/Presentation)";
1870 $test_list{PresModulesDirectory}{Type} = "file";
1871 $test_list{PresModulesDirectory}{Code} = "Modules/Presentation";
1872 $test_list{PresModulesDirectory}{Writeable} = "0";
1874 $test_list{SystemModulesDirectory}{Name} = "System Modules Directory (Modules/System)";
1875 $test_list{SystemModulesDirectory}{Type} = "file";
1876 $test_list{SystemModulesDirectory}{Code} = "Modules/System";
1877 $test_list{SystemModulesDirectory}{Writeable} = "0";
1879 # Preform those tests.
1881 foreach $test (keys %test_list){
1883 # Check the type of test.
1885 if ($test_list{$test}{Type} eq "dependency"){
1887 if (eval "require " . $test_list{$test}{Code}){
1889 # The module exists and is working correctly.
1891 $dependency_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{testpass};
1895 # The module does not exist or has an error.
1897 $dependency_error = 1;
1898 $dependency_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{testfail};
1902 } elsif ($test_list{$test}{Type} eq "database"){
1904 if (eval "require " . $test_list{$test}{Code}){
1906 # The module exists and it is working correctly.
1908 $database_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{testpass};
1909 $database_onemodule = 1;
1913 # The module does not exist or has an error.
1915 $database_error = 1;
1916 $database_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{testfail};
1920 } elsif ($test_list{$test}{Type} eq "file"){
1922 if (-e $test_list{$test}{Code}){
1924 # The filename given does exist.
1928 # the filename given does not exist.
1931 $file_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{errormessage} . $kiriwrite_lang{$language_selected}{doesnotexist};
1935 # Test to see if the filename given has read
1938 if (-r $test_list{$test}{Code}){
1940 # The filename given has valid permissions set.
1942 $file_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{testpass};
1946 # The filename given has invalid permissions set.
1949 $file_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{errormessage} . $kiriwrite_lang{$language_selected}{invalidpermissionsset};
1953 if ($test_list{$test}{Writeable} eq 1){
1955 # Test to see if the filename given has write
1958 if (-w $test_list{$test}{Code}){
1960 # The filename given has valid permissions set.
1962 $file_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{testpass};
1966 # The filename given has invalid permissions set.
1969 $file_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{errormessage} . $kiriwrite_lang{$language_selected}{invalidpermissionsset};
1981 print "Content-Type: text/html;\r\n\r\n";
1983 # Print the page for installing Kiriwrite.
1985 print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
1986 print "<head>\n<title>$kiriwrite_lang{$language_selected}{installertitle}</title>\n";
1987 print "<style type=\"text/css\" media=\"screen\">$cssstyle</style>\n</head>\n<body>";
1989 print "<table width=\"100%\">";
1990 my $language_name_short;
1991 my $language_list_seek = 0;
1992 my $installlanguage_out = "";
1994 $installlanguage_out = "<select name=\"installlanguage\">\n";
1996 foreach $language_name_short (@language_list_short){
1998 $installlanguage_out = $installlanguage_out . "<option value=\"" . $language_name_short . "\">" . $language_list_long[$language_list_seek] . "</option>\n";
1999 $language_list_seek++;
2003 $installlanguage_out = $installlanguage_out . "</select>\n";
2005 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{installertitle}, "languagebar", "<form action=\"" . $installscriptname . "\" method=\"POST\">\n$installlanguage_out\n<input type=\"submit\" value=\"$kiriwrite_lang{$language_selected}{switch}\">\n</form>\n", "languagebarselect");
2008 print "<h2>$kiriwrite_lang{$language_selected}{installertitle}</h2>\n";
2009 print $kiriwrite_lang{$language_selected}{installertext};
2011 if ($modperlenabled eq 1){
2012 print "<br /><br />";
2013 print $kiriwrite_lang{$language_selected}{modperlnotice};
2016 print "<h3>$kiriwrite_lang{$language_selected}{dependencytitle}</h3>\n";
2017 print "<h4>$kiriwrite_lang{$language_selected}{requiredmodules}</h4>\n";
2018 print $kiriwrite_lang{$language_selected}{perlmodules};
2019 print "<br /><br />\n";
2021 if ($dependency_error eq 1){
2023 print $kiriwrite_lang{$language_selected}{errormessage};
2024 print $kiriwrite_lang{$language_selected}{dependencyperlmodulesmissing};
2025 print "<br /><br />\n";
2031 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{module}, "tablecellheader", $kiriwrite_lang{$language_selected}{result}, "tablecellheader");
2033 foreach $test (keys %dependency_results) {
2035 kiriwrite_addtablerow($test, "tablename", $dependency_results{$test}{result}, "tabledata");
2041 print "<h4>$kiriwrite_lang{$language_selected}{databasemodules}</h4>\n";
2042 print $kiriwrite_lang{$language_selected}{databasemodulestext};
2043 print "<br /><br />\n";
2047 if ($database_error eq 1){
2049 print $kiriwrite_lang{$language_selected}{warningmessage};
2050 print $kiriwrite_lang{$language_selected}{databaseperlmodulesmissing};
2051 print "<br /><br />\n";
2055 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{module}, "tablecellheader", $kiriwrite_lang{$language_selected}{result}, "tablecellheader");
2057 foreach $test (keys %database_results) {
2059 kiriwrite_addtablerow($test, "tablename", $database_results{$test}{result}, "tabledata");
2065 print "<h4>$kiriwrite_lang{$language_selected}{filepermissions}</h4>\n";
2067 print $kiriwrite_lang{$language_selected}{filepermissionstext};
2068 print "<br /><br />\n";
2070 if ($file_error eq 1){
2072 print $kiriwrite_lang{$language_selected}{errormessage};
2073 print $kiriwrite_lang{$language_selected}{filepermissionsinvalid};
2074 print "<br /><br />\n";
2080 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{filename}, "tablecellheader", "Result", "tablecellheader");
2082 foreach $test (keys %file_results) {
2084 kiriwrite_addtablerow($test, "tablename", $file_results{$test}{result}, "tabledata");
2090 if ($dependency_error eq 1){
2093 print "<h4>$kiriwrite_lang{$language_selected}{criticalerror}</h4>\n";
2094 print $kiriwrite_lang{$language_selected}{dependencymodulesnotinstalled} . "\n";
2095 print "</body>\n</html>";
2100 if ($database_onemodule eq 0){
2103 print "<h4>$kiriwrite_lang{$language_selected}{criticalerror}</h4>\n";
2104 print $kiriwrite_lang{$language_selected}{databasemodulesnotinstalled} . "\n";
2105 print "</body>\n</html>";
2110 if ($file_error eq 1){
2113 print "<h4>$kiriwrite_lang{$language_selected}{criticalerror}</h4>\n";
2114 print $kiriwrite_lang{$language_selected}{filepermissionerrors} . "\n";
2115 print "</body>\n</html>";
2121 my (%available_languages, $available_languages);
2122 my @presentation_modules;
2124 my @database_modules;
2125 my $select_data = "";
2126 my (%language_data, $language_data);
2128 my $kiriwrite_languagefilehandle;
2129 my $language_out = "";
2130 my ($presmodule_name, $presmodule_out) = "";
2131 my ($dbmodule_name, $dbmodule_out) = "";
2132 my ($outputmodule_name, $outputmodule_out) = "";
2134 # Get the list of available languages.
2136 tie(%available_languages, 'Tie::IxHash');
2138 opendir(LANGUAGEDIR, "lang");
2139 my @language_directory = grep /m*\.lang$/, readdir(LANGUAGEDIR);
2140 closedir(LANGUAGEDIR);
2142 foreach my $language_file (@language_directory){
2144 # Load the language file.
2146 open ($kiriwrite_languagefilehandle, "lang/" . $language_file);
2147 @lang_data = <$kiriwrite_languagefilehandle>;
2148 %language_data = kiriwrite_processconfig(@lang_data);
2149 close ($kiriwrite_languagefilehandle);
2151 # Get the friendly name for the language file.
2153 $language_file_friendly = $language_file;
2154 $language_file_friendly =~ s/.lang$//g;
2156 $language_name = $language_data{about}{name};
2158 $available_languages{$language_file_friendly} = $language_name . " (" . $language_file_friendly . ")";
2162 # Get the list of presentation modules.
2164 opendir(OUTPUTSYSTEMDIR, "Modules/Presentation");
2165 my @presmodule_directory = grep /m*\.pm$/, readdir(OUTPUTSYSTEMDIR);
2166 closedir(OUTPUTSYSTEMDIR);
2168 foreach my $presmodule_file (@presmodule_directory){
2170 # Get the friendly name for the database module.
2172 $presmodule_file =~ s/.pm$//g;
2173 push(@presentation_modules, $presmodule_file);
2177 # Get the list of output modules.
2179 opendir(OUTPUTDIR, "Modules/Output");
2180 my @outputmodule_directory = grep /m*\.pm$/, readdir(OUTPUTDIR);
2181 closedir(OUTPUTDIR);
2183 foreach my $outputmodule_file (@outputmodule_directory){
2185 # Get the friendly name for the database module.
2187 $outputmodule_file =~ s/.pm$//g;
2188 push(@output_modules, $outputmodule_file);
2192 # Get the list of database modules.
2194 opendir(DATABASEDIR, "Modules/Database");
2195 my @dbmodule_directory = grep /m*\.pm$/, readdir(DATABASEDIR);
2196 closedir(DATABASEDIR);
2198 foreach my $dbmodule_file (@dbmodule_directory){
2200 # Get the friendly name for the database module.
2202 $dbmodule_file =~ s/.pm$//g;
2203 push(@database_modules, $dbmodule_file);
2207 print "<h3>$kiriwrite_lang{$language_selected}{settingstitle}</h3>";
2208 print $kiriwrite_lang{$language_selected}{settingstext};
2209 print "<br /><br />\n";
2211 print "<form action=\"" . $installscriptname . "\" method=\"POST\">";
2212 print "<input type=\"hidden\" name=\"confirm\" value=\"1\">\n<input type=\"hidden\" name=\"installlanguage\" value=\"$language_selected\">\n";
2214 print "<table width=\"100%\">";
2215 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{setting}, "tablecellheader", $kiriwrite_lang{$language_selected}{value}, "tablecellheader");
2216 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{directories}, "tablecellheader", "", "tablecellheader");
2217 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasedirectory}, "tablename", "<input type=\"text\" name=\"dbdirectory\" size=\"32\" maxlength=\"64\" value=\"$default_dbdirectory\">", "tabledata");
2218 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{outputdirectory}, "tablename", "<input type=\"text\" name=\"outputdirectory\" size=\"32\" maxlength=\"64\" value=\"$default_outputdirectory\">", "tabledata");
2219 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{imagesuripath}, "tablename", "<input type=\"text\" name=\"imagesuripath\" size=\"32\" maxlength=\"64\" value=\"$default_imagesuri\">", "tabledata");
2220 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{display}, "tablecellheader", "", "tablecellheader");
2221 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{textarearows}, "tablename", "<input type=\"text\" name=\"textarearows\" size=\"3\" maxlength=\"3\" value=\"$default_textarearows\">", "tabledata");
2222 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{textareacols}, "tablename", "<input type=\"text\" name=\"textareacols\" size=\"3\" maxlength=\"3\" value=\"$default_textareacols\">", "tabledata");
2223 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{date}, "tablecellheader", "", "tablecellheader");
2225 foreach my $select_name (@datetime_formats){
2226 $select_data = $select_data . "<option value=\"$select_name\">" . $select_name . "</option>\n";
2229 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{dateformat}, "tablename", "<select name=\"dateformat\">$select_data</select>\n<input type=\"text\" size=\"32\" maxlength=\"64\" name=\"customdateformat\">", "tabledata");
2230 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{language}, "tablecellheader", "", "tablecellheader");
2232 foreach my $language (keys %available_languages){
2233 if ($language eq $language_selected){
2234 $language_out = $language_out . "<option value=\"" . $language . "\" selected=selected>" . $available_languages{$language} . "</option>\n";
2236 $language_out = $language_out . "<option value=\"" . $language . "\">" . $available_languages{$language} . "</option>\n";
2240 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{systemlanguage}, "tablename", "<select name=\"language\">\r\n$language_out\r\n</select>", "tabledata");
2242 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{modules}, "tablecellheader", "", "tablecellheader");
2244 foreach $presmodule_name (@presentation_modules){
2245 $presmodule_out = $presmodule_out . "<option value=\"$presmodule_name\">$presmodule_name</option>";
2247 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{presentationmodule}, "tablename", "<select name=\"presmodule\">$presmodule_out</select>", "tabledata");
2249 foreach $dbmodule_name (@database_modules){
2250 $dbmodule_out = $dbmodule_out . "<option value=\"$dbmodule_name\">$dbmodule_name</option>";
2252 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasemodule}, "tablename", "<select name=\"dbmodule\">$dbmodule_out</select>", "tabledata");
2254 foreach $outputmodule_name (@output_modules){
2255 if ($default_outputmodule = $outputmodule_name){
2256 $outputmodule_out = $outputmodule_out . "<option value=\"$outputmodule_name\" selected>$outputmodule_name</option>";
2258 $outputmodule_out = $outputmodule_out . "<option value=\"$outputmodule_name\">$outputmodule_name</option>";
2261 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{outputmodule}, "tablename", "<select name=\"outputmodule\">$outputmodule_out</select>", "tabledata");
2263 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseserver}, "tablename", "<input type=\"text\" name=\"databaseserver\" size=\"32\" maxlength=\"128\" value=\"$default_server\">\n", "tabledata");
2264 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseport}, "tablename", "<input type=\"text\" name=\"databaseport\" maxlength=\"5\" size=\"5\" value=\"$default_port\">\n", "tabledata");
2265 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseprotocol}, "tablename", "<select name=\"databaseprotocol\">\n<option value=\"tcp\">tcp</option>\n<option value=\"udp\">udp</option>\n</select>\n", "tabledata");
2266 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasename}, "tablename", "<input type=\"text\" name=\"databasename\" size=\"32\" maxlength=\"32\" value=\"$default_name\">\n", "tabledata");
2267 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseusername}, "tablename", "<input type=\"text\" name=\"databaseusername\" size=\"16\" maxlength=\"16\" value=\"$default_username\">\n", "tabledata");
2268 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasepassword}, "tablename", "<input type=\"password\" name=\"databasepassword\" size=\"32\" maxlength=\"64\">\n", "tabledata");
2269 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasetableprefix}, "tablename", "<input type=\"text\" name=\"databasetableprefix\" size=\"32\" maxlength=\"32\" value=\"$default_prefix\">\n", "tabledata");
2270 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{installationoptions}, "tablecellheader", "", "tablecellheader");
2271 kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{installoptions}, "tablename", "<input type=\"checkbox\" name=\"removeinstallscript\" checked=checked value=\"on\"> $kiriwrite_lang{$language_selected}{removeinstallscript}\n", "tabledata");
2275 print "<br />\n<input type=\"submit\" value=\"$kiriwrite_lang{$language_selected}{savesettingsbutton}\"> | <input type=\"reset\" value=\"$kiriwrite_lang{$language_selected}{resetsettingsbutton}\">\n";
2277 print "</form>\n</body>\n</html>";