Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
(no commit message)
[kiriwrite/.git] / cgi-files / install.cgi
1 #!/usr/bin/perl -Tw
3 #################################################################################
4 # Kiriwrite Installer Script (install.cgi)                                      #
5 # Installation script for Kiriwrite                                             #
6 #                                                                               #
7 # Version: 0.1.0                                                                #
8 #                                                                               #
9 # Copyright (C) 2005-2007 Steve Brokenshire <sbrokenshire@xestia.co.uk>         #
10 #                                                                               #
11 # This program is free software; you can redistribute it and/or modify it under #
12 # the terms of the GNU General Public License as published by the Free          #
13 # Software Foundation; as version 2 of the License.                             #
14 #                                                                               #
15 # This program is distributed in the hope that it will be useful, but WITHOUT   #
16 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
17 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.#
18 #                                                                               #
19 # You should have received a copy of the GNU General Public License along with  #
20 # this program; if not, write to the Free Software Foundation, Inc., 51         #
21 # Franklin St, Fifth Floor, Boston, MA 02110-1301 USA                           #
22 ################################################################################# 
24 use strict;                             # Throw errors if there's something wrong.
25 use warnings;                           # Write warnings to the HTTP Server Log file.
27 use utf8;
28 use CGI qw(:standard *table *Tr *td);
29 use CGI::Carp('fatalsToBrowser');       # Output errors to the browser.
31 # Setup strings in specific languages. Style should be no spacing for
32 # language title and one tabbed spacing for each string.
34 # Define some default settings.
36 my $default_language            = "en-GB";
37 my $default_dbdirectory         = "db";
38 my $default_outputdirectory     = "output";
39 my $default_imagesuri           = "/images/kiriwrite";
41 my $default_server              = "localhost";
42 my $default_port                = "3306";
43 my $default_protocol            = "tcp";
44 my $default_name                = "database";
45 my $default_username            = "username";
46 my $default_prefix              = "kiriwrite";
48 my ($kiriwrite_lang, %kiriwrite_lang);
50 $kiriwrite_lang{"en-GB"}{"languagename"}        = "English (British)";
51         $kiriwrite_lang{"en-GB"}{"testpass"}            = "OK";
52         $kiriwrite_lang{"en-GB"}{"testfail"}            = "Error";
54         $kiriwrite_lang{"en-GB"}{"generic"}                     = "An error occured which is not known to the Kiriwrite installer.";
55         $kiriwrite_lang{"en-GB"}{"invalidvariable"}             = "The variable given was invalid.";
56         $kiriwrite_lang{"en-GB"}{"invalidvalue"}                = "The value given was invalid.";
57         $kiriwrite_lang{"en-GB"}{"invalidoption"}               = "The option given was invalid.";
58         $kiriwrite_lang{"en-GB"}{"variabletoolong"}             = "The variable given is too long.";
59         $kiriwrite_lang{"en-GB"}{"blankdirectory"}              = "The directory name given is blank.";
60         $kiriwrite_lang{"en-GB"}{"invaliddirectory"}            = "The directory name given is invalid.";
61         $kiriwrite_lang{"en-GB"}{"moduleblank"}                 = "The module filename given is blank.";
62         $kiriwrite_lang{"en-GB"}{"moduleinvalid"}               = "The module filename given is invalid.";
64         $kiriwrite_lang{"en-GB"}{"dbdirectorytoolong"}          = "The database directory name given is too long.";
65         $kiriwrite_lang{"en-GB"}{"outputdirectorytoolong"}      = "The output directory name given is too long.";
66         $kiriwrite_lang{"en-GB"}{"imagesuripathtoolong"}        = "The images URI path name given is too long.";
67         $kiriwrite_lang{"en-GB"}{"dateformattoolong"}           = "The date format given is too long.";
68         $kiriwrite_lang{"en-GB"}{"customdateformattoolong"}     = "The custom date format given is too long.";
69         $kiriwrite_lang{"en-GB"}{"languagefilenametoolong"}     = "The language filename given is too long.";
71         $kiriwrite_lang{"en-GB"}{"dateformatblank"}             = "The date format given was blank.";
72         $kiriwrite_lang{"en-GB"}{"dateformatinvalid"}           = "The date format given is invalid.";
73         $kiriwrite_lang{"en-GB"}{"languagefilenameinvalid"}     = "The language filename given is invalid.";
75         $kiriwrite_lang{"en-GB"}{"dbdirectoryblank"}            = "The database directory name given is blank.";
76         $kiriwrite_lang{"en-GB"}{"dbdirectoryinvalid"}          = "The database directory name given is invalid.";
78         $kiriwrite_lang{"en-GB"}{"outputdirectoryblank"}        = "The output directory name given is blank.";
79         $kiriwrite_lang{"en-GB"}{"outputdirectoryinvalid"}      = "The output directory name given is invalid.";
81         $kiriwrite_lang{"en-GB"}{"presmoduleblank"}             = "The presentation module name given is blank.";
82         $kiriwrite_lang{"en-GB"}{"presmoduleinvalid"}           = "The presentation module name given is invalid.";
83  
84         $kiriwrite_lang{"en-GB"}{"dbmoduleblank"}               = "The database module name given is blank.";
85         $kiriwrite_lang{"en-GB"}{"dbmoduleinvalid"}             = "The database module name given is invalid.";
86  
87         $kiriwrite_lang{"en-GB"}{"presmodulemissing"}           = "The presentation module with the filename given is missing.";
88         $kiriwrite_lang{"en-GB"}{"dbmodulemissing"}             = "The database module with the filename given is missing.";
89         $kiriwrite_lang{"en-GB"}{"languagefilemissing"}         = "The language file with the filename given is missing.";
90  
91         $kiriwrite_lang{"en-GB"}{"servernametoolong"}           = "The database server name given is too long.";
92         $kiriwrite_lang{"en-GB"}{"servernameinvalid"}           = "The database server name given is invalid.";
93         $kiriwrite_lang{"en-GB"}{"serverportnumbertoolong"}     = "The database server port number given is too long.";
94         $kiriwrite_lang{"en-GB"}{"serverportnumberinvalidcharacters"}   = "The database server port number given contains invalid characters.";
95         $kiriwrite_lang{"en-GB"}{"serverportnumberinvalid"}     = "The database server port number given is invalid.";
96         $kiriwrite_lang{"en-GB"}{"serverprotocolnametoolong"}   = "The database server protocol name given is too long.";
97         $kiriwrite_lang{"en-GB"}{"serverprotocolinvalid"}               = "The database server protocol name is invalid.";
98         $kiriwrite_lang{"en-GB"}{"serverdatabasenametoolong"}   = "The database name given is too long.";
99         $kiriwrite_lang{"en-GB"}{"serverdatabasenameinvalid"}   = "The database name given is invalid.";
100         $kiriwrite_lang{"en-GB"}{"serverdatabaseusernametoolong"}       = "The database server username given is too long.";
101         $kiriwrite_lang{"en-GB"}{"serverdatabaseusernameinvalid"}       = "The database server username given is invalid.";
102         $kiriwrite_lang{"en-GB"}{"serverdatabasepasswordtoolong"}       = "The database server password is too long.";
103         $kiriwrite_lang{"en-GB"}{"serverdatabasetableprefixtoolong"}    = "The database server table prefix given is too long.";
104         $kiriwrite_lang{"en-GB"}{"serverdatabasetableprefixinvalid"}    = "The database server table prefix given is invalid.";
105  
106         $kiriwrite_lang{"en-GB"}{"removeinstallscripttoolong"}  = "The remove install script value given is too long.";
107         $kiriwrite_lang{"en-GB"}{"cannotwriteconfigurationindirectory"} = "The configuration file cannot be written because the directory the install script is running from has invalid permissions.";
108         $kiriwrite_lang{"en-GB"}{"configurationfilereadpermissionsinvalid"}     = "The configuration that currently exists has invalid read permissions set.";
109         $kiriwrite_lang{"en-GB"}{"configurationfilewritepermissionsinvalid"}    = "The configuration that currently exists has invalid write permissions set.";
111         $kiriwrite_lang{"en-GB"}{"errormessagetext"}    = "Please press the back button on your browser or preform the command needed to return to the previous page.";
113         $kiriwrite_lang{"en-GB"}{"switch"}              = "Switch";
114         $kiriwrite_lang{"en-GB"}{"setting"}             = "Setting";
115         $kiriwrite_lang{"en-GB"}{"value"}               = "Value";
116         $kiriwrite_lang{"en-GB"}{"filename"}            = "Filename";
117         $kiriwrite_lang{"en-GB"}{"module"}              = "Module";
118         $kiriwrite_lang{"en-GB"}{"result"}              = "Result";
119         $kiriwrite_lang{"en-GB"}{"error"}               = "Error!";
120         $kiriwrite_lang{"en-GB"}{"criticalerror"}       = "Critical Error!";
121         $kiriwrite_lang{"en-GB"}{"errormessage"}        = "Error: ";
122         $kiriwrite_lang{"en-GB"}{"warningmessage"}      = "Warning: ";
124         $kiriwrite_lang{"en-GB"}{"doesnotexist"}        = "Does not exist.";
125         $kiriwrite_lang{"en-GB"}{"invalidpermissionsset"}       = "Invalid permissions set.";
127         $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.";
128         $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.";
129         $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.";
130         $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.";
131         $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.";
132         $kiriwrite_lang{"en-GB"}{"filepermissionerrors"}        = "One or more filenames checked has errors. See the Kiriwrite documentation for more information on this.",
134         $kiriwrite_lang{"en-GB"}{"installertitle"}      = "Kiriwrite Installer";
135         $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.";
136         $kiriwrite_lang{"en-GB"}{"dependencytitle"}     = "Dependency and file testing results";
137         $kiriwrite_lang{"en-GB"}{"requiredmodules"}     = "Required Modules";
138         $kiriwrite_lang{"en-GB"}{"perlmodules"}         = "These Perl modules are used internally by Kiriwrite.";
139         $kiriwrite_lang{"en-GB"}{"databasemodules"}     = "Database Modules";
140         $kiriwrite_lang{"en-GB"}{"databasemodulestext"} = "These Perl modules are used by the database modules.";
141         $kiriwrite_lang{"en-GB"}{"filepermissions"}     = "File permissions";
142         $kiriwrite_lang{"en-GB"}{"filepermissionstext"} = "The file permissions are for file and directories that are critical to Kiriwrite such as module and language directories.";
143         
144         $kiriwrite_lang{"en-GB"}{"settingstitle"}       = "Kiriwrite Settings";
145         $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.";
146         $kiriwrite_lang{"en-GB"}{"directories"}         = "Directories";
147         $kiriwrite_lang{"en-GB"}{"databasedirectory"}   = "Database Directory";
148         $kiriwrite_lang{"en-GB"}{"outputdirectory"}     = "Output Directory";
149         $kiriwrite_lang{"en-GB"}{"imagesuripath"}       = "Images (URI path)";
150         $kiriwrite_lang{"en-GB"}{"date"}                = "Date";
151         $kiriwrite_lang{"en-GB"}{"dateformat"}          = "Date Format";
152         $kiriwrite_lang{"en-GB"}{"language"}            = "Language";
153         $kiriwrite_lang{"en-GB"}{"systemlanguage"}      = "System Language";
154         $kiriwrite_lang{"en-GB"}{"modules"}             = "Modules";
155         $kiriwrite_lang{"en-GB"}{"presentationmodule"}  = "Presentation Module";
156         $kiriwrite_lang{"en-GB"}{"databasemodule"}      = "Database Module";
157         $kiriwrite_lang{"en-GB"}{"databaseserver"}      = "Database Server";
158         $kiriwrite_lang{"en-GB"}{"databaseport"}        = "Database Port";
159         $kiriwrite_lang{"en-GB"}{"databaseprotocol"}    = "Database Protocol";
160         $kiriwrite_lang{"en-GB"}{"databasename"}        = "Database Name";
161         $kiriwrite_lang{"en-GB"}{"databaseusername"}    = "Database Username";
162         $kiriwrite_lang{"en-GB"}{"databasepassword"}    = "Database Password";
163         $kiriwrite_lang{"en-GB"}{"databasetableprefix"} = "Database Table Prefix";
164         $kiriwrite_lang{"en-GB"}{"installationoptions"} = "Installation Options";
165         $kiriwrite_lang{"en-GB"}{"installoptions"}      = "Install Options";
166         $kiriwrite_lang{"en-GB"}{"removeinstallscript"} = "Delete this installer script after configuration file has been written.";
167         $kiriwrite_lang{"en-GB"}{"savesettingsbutton"}  = "Save Settings";
168         $kiriwrite_lang{"en-GB"}{"resetsettingsbutton"} = "Reset Settings";
170         $kiriwrite_lang{"en-GB"}{"installscriptremoved"}        = "The installer script was removed.";
171         $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.";
172         $kiriwrite_lang{"en-GB"}{"cannotremovescript"}  = "Unable to remove the installer script: %s. The installer script will have to be deleted manually.";
173         $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):";
174         $kiriwrite_lang{"en-GB"}{"usekiriwritelink"}    = "Start using Kiriwrite.";
176 my $query = new CGI;
178 my $language_selected = "";
179 my $http_query_confirm = $query->param('confirm');
180 my $http_query_installlanguage = $query->param('installlanguage');
182 if (!$http_query_installlanguage){
184         $language_selected = $default_language;
186 } else {
188         $language_selected = $http_query_installlanguage;
192 # Process the list of available languages.
194 my $language_list_name;
195 my @language_list_short;
196 my @language_list_long;
198 foreach my $language (keys %kiriwrite_lang){
200         $language_list_name = $kiriwrite_lang{$language}{"languagename"} . " (" . $language .  ")";
201         push(@language_list_short, $language);
202         push(@language_list_long, $language_list_name);
206 # The CSS Stylesheet to use.
208 my $cssstyle = "
210 a {
211         color: #FFFFFF;
214 body {
215         background-color: #408080;
216         color: #FFFFFF;
217         font-family: sans-serif;
218         font-size: 12px;
221 input {
222         background-color: #408080;
223         color: #FFFFFF;
224         border-color: #102020;
225         border-style: solid;
226         border-width: 1px;
227         padding: 3px;
231 select {
232         padding: 3px;
233         background-color: #408080;
234         color: #FFFFFF;
235         border-color: #102020;
236         border-style: solid;
237         border-width: 1px;
238         padding: 3px;
241 td,table {
242         padding: 5px;
243         border-spacing: 0px;
246 .languagebar {
247         background-color: #204040;
248         vertical-align: top;
251 .languagebarselect {
252         text-align: right;
253         background-color: #204040;
256 .tablecellheader {
257         background-color: #204040;
258         font-weight: bold;
261 .tabledata {
262         background-color: #357070;
265 .tablename {
267         background-color: #306060;
271 ";
274 #################################################################################
275 # Begin list of subroutines.                                                    #
276 #################################################################################
278 sub kiriwrite_variablecheck{
279 #################################################################################
280 # kiriwrite_variablecheck: Check to see if the data passed is valid.            #
281 #                                                                               #
282 # Usage:                                                                        #
283 #                                                                               #
284 # kiriwrite_variablecheck(variablename, type, option, noerror);                 #
285 #                                                                               #
286 # variablename  Specifies the variable to be checked.                           #
287 # type          Specifies what type the variable is.                            #
288 # option        Specifies the maximum/minimum length of the variable            #
289 #               (if minlength/maxlength is used) or if the filename should be   #
290 #               checked to see if it is blank.                                  #
291 # noerror       Specifies if Kiriwrite should return an error or not on         #
292 #               certain values.                                                 #
293 #################################################################################
295         # Get the values that were passed to the subroutine.
297         my ($variable_data, $variable_type, $variable_option, $variable_noerror) = @_;
299         if ($variable_type eq "numbers"){
301                 # Check for numbers and return an error if there is anything else than numebrs.
303                 my $variable_data_validated = $variable_data;   # Copy the variable_data to variable_data_validated.
304                 $variable_data_validated =~ tr/0-9//d;          # Take away all of the numbers and from the variable. 
305                                                                 # If it only contains numbers then it should be blank.
307                 if ($variable_data_validated eq ""){
308                         # The validated variable is blank. So continue to the end of this section where the return function should be.
309                 } else {
310                         # The variable is not blank, so check if the no error value is set
311                         # to 1 or not.
313                         if ($variable_noerror eq 1){
315                                 # The validated variable is not blank and the noerror
316                                 # value is set to 1. So return an value of 1.
317                                 # (meaning that the data is invalid).
319                                 return 1;
321                         } elsif ($variable_noerror eq 0) {
323                                 # The validated variable is not blank and the noerror
324                                 # value is set to 0.
326                                 kiriwrite_error("invalidvariable");
328                         } else {
330                                 # The variable noerror value is something else
331                                 # pther than 1 or 0. So return an error.
333                                 kiriwrite_error("invalidvariable");
335                         }
337                 }
339                 return 0;
341         } elsif ($variable_type eq "lettersnumbers"){
343                 # Check for letters and numbers and return an error if there is anything else other
344                 # than letters and numbers.
346                 my $variable_data_validated = $variable_data;   # Copy the variable_data to variable_data_validated
347                 $variable_data_validated =~ tr/a-zA-Z0-9.//d;
348                 $variable_data_validated =~ s/\s//g;
350                 if ($variable_data_validated eq ""){
351                         # The validated variable is blank. So continue to the end of this section where the return function should be.
352                 } else {
353                         # The variable is not blank, so check if the no error value is set
354                         # to 1 or not.
356                         if ($variable_noerror eq 1){
358                                 # The validated variable is not blank and the noerror
359                                 # value is set to 1. So return an value of 1.
360                                 # (meaning that the data is invalid).
362                                 return 1;
364                         } elsif ($variable_noerror eq 0) {
366                                 # The validated variable is not blank and the noerror
367                                 # value is set to 0.
369                                 kiriwrite_error("invalidvariable");
371                         } else {
373                                 # The variable noerror value is something else
374                                 # pther than 1 or 0. So return an error.
376                                 kiriwrite_error("invalidvariable");
378                         }
380                 }
382                 return 0;
384         } elsif ($variable_type eq "maxlength"){
385                 # Check for the length of the variable, return an error if it is longer than the length specified.
387                 # Check if the variable_data string is blank, if it is then set the variable_data_length
388                 # to '0'.
390                 my $variable_data_length = 0;
392                 if (!$variable_data){
394                         # Set variable_data_length to '0'.
395                         $variable_data_length = 0;
397                 } else {
399                         # Get the length of the variable recieved.
400                         $variable_data_length = length($variable_data);
402                 }
406                 if ($variable_data_length > $variable_option){
408                         # The variable length is longer than it should be so check if
409                         # the no error value is set 1.
411                         if ($variable_noerror eq 1){
413                                 # The no error value is set to 1, so return an
414                                 # value of 1 (meaning tha the variable is
415                                 # too long to be used).
417                                 return 1;
419                         } elsif ($variable_noerror eq 0){
421                                 # The no error value is set to 0, so return
422                                 # an error.
424                                 kiriwrite_error("variabletoolong");
426                         } else {
428                                 # The no error value is something else other
429                                 # than 0 or 1, so return an error.
431                                 kiriwrite_error("variabletoolong");
433                         }
435                 } else {
437                         # The variable length is exactly or shorter than specified, so continue to end of this section where
438                         # the return function should be.
440                 }
442                 return 0;
444         } elsif ($variable_type eq "datetime"){
445                 # Check if the date and time setting format is valid.
447                 if ($variable_data eq ""){
449                         if ($variable_noerror eq 1){
451                                 # The no error value is set to 1 so return
452                                 # a value of 1 (meaning that the date and
453                                 # time format was blank).
455                                 return 1;
457                         } elsif ($variable_noerror eq 0){
459                                 # The no error value is set to 1 so return
460                                 # an error.
462                                 kiriwrite_error("dateformatblank");
464                         } else {
466                                 # The no error value is something else other
467                                 # than 0 or 1, so return an error.
469                                 kiriwrite_error("invalidvariable");
471                         }
473                 }
475                 my $variable_data_validated = $variable_data;
476                 $variable_data_validated =~ tr|dDmMyYhms/():[ ]||d;
478                 if ($variable_data_validated eq ""){
480                         # The date and time format is valid. So
481                         # skip this bit.
483                 } else {
485                         # The validated data variable is not blank, meaning 
486                         # that it contains something else, so return an error
487                         # (or a value).
489                         if ($variable_noerror eq 1){
491                                 # The no error value is set to 1 so return
492                                 # an value of 2. (meaning that the date and
493                                 # time format was invalid).
495                                 return 2;
497                         } elsif ($variable_noerror eq 0){
499                                 # The no error value is set to 0 so return
500                                 # an error.
502                                 kiriwrite_error("dateformatinvalid");
504                         } else {
506                                 # The no error value is something else other
507                                 # than 0 or 1 so return an error.
509                                 kiriwrite_error("invalidvariable");
511                         }
513                 }
515                 return 0;
517         } elsif ($variable_type eq "directory"){
518                 # Check if the directory only contains letters and numbers and
519                 # return an error if anything else appears.
521                 my $variable_data_validated = $variable_data;
522                 $variable_data_validated =~ tr/a-zA-Z0-9//d;
524                 if ($variable_data eq ""){
526                         if ($variable_noerror eq 1){
528                                 # The no error value is set to 1 so return
529                                 # a value of 1 (meaning that the directory
530                                 # name was blank).
532                                 return 1;
534                         } elsif ($variable_noerror eq 0){
536                                 # The no error value is set to 1 so return
537                                 # an error.
539                                 kiriwrite_error("blankdirectory");
541                         } else {
543                                 # The no error value is something else other
544                                 # than 0 or 1, so return an error.
546                                 kiriwrite_error("invalidvariable");
548                         }
550                 }
552                 if ($variable_data_validated eq ""){
554                         # The validated data variable is blank, meaning that
555                         # it only contains letters and numbers.
557                 } else {
559                         # The validated data variable is not blank, meaning 
560                         # that it contains something else, so return an error
561                         # (or a value).
563                         if ($variable_noerror eq 1){
565                                 # The no error value is set to 1 so return
566                                 # an value of 2. (meaning that the directory
567                                 # name is invalid).
569                                 return 2;
571                         } elsif ($variable_noerror eq 0){
573                                 # The no error value is set to 0 so return
574                                 # an error.
576                                 kiriwrite_error("invaliddirectory");
578                         } else {
580                                 # The no error value is something else other
581                                 # than 0 or 1 so return an error.
583                                 kiriwrite_error("invalidvariable");
585                         }
587                 }
589                 return 0;
591         } elsif ($variable_type eq "language_filename"){
593                 # The variable type is a language filename type.
594                 # Check if the language file name is blank and 
595                 # if it is then return an error (or value).
597                 if ($variable_data eq ""){
599                         # The language filename is blank so check the
600                         # no error value and return an error (or value).
602                         if ($variable_noerror eq 1){
604                                 # Language filename is blank and the no error value
605                                 # is set as 1, so return a value of 1 (saying that
606                                 # the language filename is blank).
608                                 return 1;
610                         } elsif ($variable_noerror eq 0) {
612                                 # Language filename is blank and the no error value
613                                 # is not set as 1, so return an error.
615                                 kiriwrite_error("languagefilenameblank");
617                         } else {
619                                 # The noerror value is something else other
620                                 # than 0 or 1 so return an error.
622                                 kiriwrite_error("invalidvariable");
624                         }
626                 }
628                 # Set the following variables for later on.
630                 my $variable_data_length = 0;
631                 my $variable_data_char = "";
632                 my $variable_data_seek = 0;
634                 # Get the length of the language file name.
636                 $variable_data_length = length($variable_data);
638                 do {
640                         # Get a character from the language filename passed to this 
641                         # subroutine and the character the seek counter value is set
642                         # to.
644                         $variable_data_char = substr($variable_data, $variable_data_seek, 1);
646                         # Check if the language filename contains a forward slash or a dot, 
647                         # if the selected character is a forward slash then return an error
648                         # (or value).
650                         if ($variable_data_char eq "/" || $variable_data_char eq "."){
652                                 # The language filename contains a forward slash or
653                                 # a dot so depending on the no error value, return
654                                 # an error or a value.
656                                 if ($variable_noerror eq 1){
658                                         # Language filename contains a forward slash or a dot
659                                         # and the no error value has been set to 1, so return 
660                                         # an value of 2 (saying that the language file name is 
661                                         # invalid).
663                                         return 2;
665                                 } elsif ($variable_noerror eq 0) {
667                                         # Language filename contains a forward slash and the no
668                                         # error value has not been set to 1, so return an error.
670                                         kiriwrite_error("languagefilenameinvalid");
672                                 } else {
674                                         # The noerror value is something else other than
675                                         # 1 or 0 so return an error.
677                                         kiriwrite_error("invalidvariable");
679                                 }
681                         }
683                         # Increment the seek counter.
685                         $variable_data_seek++;
687                 } until ($variable_data_seek eq $variable_data_length);
689                 return 0;
691         } elsif ($variable_type eq "module"){
693                 # The variable type is a presentation module filename.
695                 # Check if the variable_data is blank and if it is
696                 # return an error.
698                 if ($variable_data eq ""){
700                         # The presentation module is blank so check if an error
701                         # value should be returned or a number should be
702                         # returned.
704                         if ($variable_noerror eq 1){
706                                 # Module name is blank and the no error value 
707                                 # is set to 1 so return a value of 2 (meaning 
708                                 # that the page filename is blank).
710                                 return 1;
712                         } elsif ($variable_noerror eq 0) {
714                                 # Module name contains is blank and the no error 
715                                 # value is set to 0 so return an error.
717                                 kiriwrite_critical("moduleblank");
719                         } else {
721                                 # The no error value is something else other
722                                 # than 0 or 1 so return an error.
724                                 kiriwrite_critical("invalidvalue");
726                         }
728                 } else {
730                 }
732                 my $variable_data_validated = $variable_data;
733                 $variable_data_validated =~ tr/a-zA-Z0-9//d;
735                 if ($variable_data_validated eq ""){
737                 } else {
739                         if ($variable_noerror eq 1){
741                                 # Module name contains invalid characters and
742                                 # the no error value is set to 1 so return a 
743                                 # value of 2 (meaning that the page filename
744                                 # is invalid).
746                                 return 2;
748                         } elsif ($variable_noerror eq 0) {
750                                 # Module name contains invalid characters and
751                                 # the no error value is set to 0 so return an
752                                 # error.
754                                 kiriwrite_critical("moduleinvalid");
756                         } else {
758                                 # The no error value is something else other
759                                 # than 0 or 1 so return an error.
761                                 kiriwrite_error("invalidvalue");
763                         }
765                 }
767                 return 0;
769         } elsif ($variable_type eq "serverprotocol"){
771                 # Check if the server protocol is TCP or UDP and return
772                 # an error if it isn't.
774                 if ($variable_data ne "tcp" && $variable_data ne "udp"){
776                         # The protocol given is not valid, check if the no
777                         # error value is set to 1 and return an error if it isn't.
779                         if ($variable_noerror eq 1){
781                                 # The no error value has been set to 1, so return a
782                                 # value of 1 (meaning that the server protocol is
783                                 # invalid).
785                                 return 1;
787                         } elsif ($variable_noerror eq 0){
789                                 # The no error value has been set to 0, so return
790                                 # an error.
792                                 kiriwrite_error("serverprotocolinvalid");
794                         } else {
796                                 # The no error value is something else other than 0
797                                 # or 1, so return an error.
799                                 kiriwrite_error("invalidoption");
801                         }
803                 }
805                 return 0;
807         } elsif ($variable_type eq "port"){
809                 # Check if the port number given is less than 0 or more than 65535
810                 # and return an error if it is.
812                 if ($variable_data < 0 || $variable_data > 65535){
814                         # The port number is less than 0 and more than 65535 so
815                         # check if the no error value is set to 1 and return an
816                         # error if it isn't.
818                         if ($variable_noerror eq 1){
820                                 # The no error value has been set to 1, so return a
821                                 # value of 1 (meaning that the port number is invalid).
823                                 return 1;
825                         } elsif ($variable_noerror eq 0){
827                                 # The no error value has been set to 0, so return
828                                 # an error.
830                                 kiriwrite_error("serverportnumberinvalid");
832                         } else {
834                                 # The no error value is something else other than 0
835                                 # or 1, so return an error.
837                                 kiriwrite_error("invalidoption");
839                         }
841                 }
843                 return 0;
845         }
847         # Another type than the valid ones above has been specified so return an error specifying an invalid option.
848         kiriwrite_error("invalidoption");
852 sub kiriwrite_error{
853 #################################################################################
854 # kiriwrite_error: Subroutine for processing error messages.                    #
855 #                                                                               #
856 # Usage:                                                                        #
857 #                                                                               #
858 # kiriwrite_error(errortype);                                                   #
859 #                                                                               #
860 # errortype     Specifies the error type to use.                                #
861 #################################################################################
863         my $error_type = shift;
865         # Load the list of error messages.
867         my (%kiriwrite_error, $kiriwrite_error);
869         %kiriwrite_error = (
871                 # Generic Error Messages
873                 "generic"                       => $kiriwrite_lang{$language_selected}{generic},
875                 "invalidvariable"               => $kiriwrite_lang{$language_selected}{invalidvariable},
876                 "invalidvalue"                  => $kiriwrite_lang{$language_selected}{invalidvalue},
877                 "invalidoption"                 => $kiriwrite_lang{$language_selected}{invalidoption},
878                 "variabletoolong"               => $kiriwrite_lang{$language_selected}{variabletoolong},
879                 "blankdirectory"                => $kiriwrite_lang{$language_selected}{blankdirectory},
880                 "invaliddirectory"              => $kiriwrite_lang{$language_selected}{invaliddirectory},
881                 "moduleblank"                   => $kiriwrite_lang{$language_selected}{moduleblank},
882                 "moduleinvalid"                 => $kiriwrite_lang{$language_selected}{moduleinvalid},
884                 # Specific Error Messages
886                 "dbdirectorytoolong"            => $kiriwrite_lang{$language_selected}{dbdirectorytoolong},
887                 "outputdirectorytoolong"        => $kiriwrite_lang{$language_selected}{outputdirectorytoolong},
888                 "imagesuripathtoolong"          => $kiriwrite_lang{$language_selected}{imagesuripathtoolong},
889                 "dateformattoolong"             => $kiriwrite_lang{$language_selected}{dateformattoolong},
890                 "customdateformattoolong"       => $kiriwrite_lang{$language_selected}{customdateformattoolong},
891                 "languagefilenametoolong"       => $kiriwrite_lang{$language_selected}{languagefilenametoolong},
892                 
893                 "dateformatblank"               => $kiriwrite_lang{$language_selected}{dateformatblank},
894                 "dateformatinvalid"             => $kiriwrite_lang{$language_selected}{dateformatinvalid},
895                 "languagefilenameinvalid"       => $kiriwrite_lang{$language_selected}{languagefilenameinvalid},
896                 
897                 "dbdirectoryblank"              => $kiriwrite_lang{$language_selected}{dbdirectoryblank},
898                 "dbdirectoryinvalid"            => $kiriwrite_lang{$language_selected}{dbdirectoryinvalid},
900                 "outputdirectoryblank"          => $kiriwrite_lang{$language_selected}{outputdirectoryblank},
901                 "outputdirectoryinvalid"        => $kiriwrite_lang{$language_selected}{outputdirectoryinvalid},
903                 "presmoduleblank"               => $kiriwrite_lang{$language_selected}{presmoduleblank},
904                 "presmoduleinvalid"             => $kiriwrite_lang{$language_selected}{presmoduleinvalid},
906                 "dbmoduleblank"                 => $kiriwrite_lang{$language_selected}{dbmoduleblank},
907                 "dbmoduleinvalid"               => $kiriwrite_lang{$language_selected}{dbmoduleinvalid},
909                 "presmodulemissing"             => $kiriwrite_lang{$language_selected}{presmodulemissing},
910                 "dbmodulemissing"               => $kiriwrite_lang{$language_selected}{dbmodulemissing},
911                 "languagefilemissing"           => $kiriwrite_lang{$language_selected}{languagefilemissing},
913                 "servernametoolong"             => $kiriwrite_lang{$language_selected}{servernametoolong},
914                 "servernameinvalid"             => $kiriwrite_lang{$language_selected}{servernameinvalid},
915                 "serverportnumbertoolong"       => $kiriwrite_lang{$language_selected}{serverportnumbertoolong},
916                 "serverportnumberinvalidcharacters"     => $kiriwrite_lang{$language_selected}{serverportnumberinvalidcharacters},
917                 "serverportnumberinvalid"       => $kiriwrite_lang{$language_selected}{serverportnumberinvalid},
918                 "serverprotocolnametoolong"     => $kiriwrite_lang{$language_selected}{serverprotocolnametoolong},
919                 "serverprotocolinvalid"         => $kiriwrite_lang{$language_selected}{serverprotocolinvalid},
920                 "serverdatabasenametoolong"     => $kiriwrite_lang{$language_selected}{serverdatabasenametoolong},
921                 "serverdatabasenameinvalid"     => $kiriwrite_lang{$language_selected}{serverdatabasenameinvalid},
922                 "serverdatabaseusernametoolong" => $kiriwrite_lang{$language_selected}{serverdatabaseusernametoolong},
923                 "serverdatabaseusernameinvalid" => $kiriwrite_lang{$language_selected}{serverdatabaseusernameinvalid},
924                 "serverdatabasepasswordtoolong" => $kiriwrite_lang{$language_selected}{serverdatabasepasswordtoolong},
925                 "serverdatabasetableprefixtoolong"      => $kiriwrite_lang{$language_selected}{serverdatabasetableprefixtoolong},
926                 "serverdatabasetableprefixinvalid"      => $kiriwrite_lang{$language_selected}{serverdatabasetableprefixinvalid},
928                 "removeinstallscripttoolong"    => $kiriwrite_lang{$language_selected}{removeinstallscripttoolong},
929                 "cannotwriteconfigurationindirectory"   => $kiriwrite_lang{$language_selected}{cannotwriteconfigurationindirectory},
930                 "configurationfilereadpermissionsinvalid"       => $kiriwrite_lang{$language_selected}{configurationfilereadpermissionsinvalid},
931                 "configurationfilewritepermissionsinvalid"      => $kiriwrite_lang{$language_selected}{configurationfilewritepermissionsinvalid},
933         );
935         # Check if the specified error is blank and if it is
936         # use the generic error messsage.
938         if (!$kiriwrite_error{$error_type}){
939                 $error_type = "generic";
940         }
942         print header();
944         print start_html({ -title => $kiriwrite_lang{$language_selected}{error}, -style => { -code => $cssstyle }});
946         print h2($kiriwrite_lang{$language_selected}{error});
948         print $kiriwrite_error{$error_type};
949         print br();
950         print $kiriwrite_lang{$language_selected}{errormessagetext};
952         print end_html();
954         exit;
958 sub kiriwrite_writeconfig{
959 #################################################################################
960 # kiriwrite_writeconfig: Writes a configuration file.                           #
961 #                                                                               #
962 # Usage:                                                                        #
963 #                                                                               #
964 # kiriwrite_writeconfig();                                                      #
965 #################################################################################
967         my ($passedsettings) = @_;
969         # Open the configuration file for writing.
971         open (my $configfile, "> " . "kiriwrite.xml");
973         print $configfile "<?xml version=\"1.0\"?>
975 <kiriwrite-config>
976 <!-- This file was automatically generated by Kiriwrite, please feel free to edit to your own needs. -->
977         <settings>
978                 <directories>
979                         <database>" . $passedsettings->{DatabaseDirectory} . "</database>
980                         <output>" . $passedsettings->{OutputDirectory} . "</output>
981                         <images>" . $passedsettings->{ImagesURIPath} . "</images>
982                 </directories>
983                 <language>
984                         <lang>" . $passedsettings->{Language} . "</lang>
985                 </language>
986                 <system>
987                         <presentation>" . $passedsettings->{PresentationModule} . "</presentation>
988                         <database>" . $passedsettings->{DatabaseModule} . "</database>
989                         <datetime>" . $passedsettings->{DateFormat} . "</datetime>
990                 </system>
991                 <database>
992                         <server>" . $passedsettings->{DatabaseServer} . "</server>
993                         <port>" . $passedsettings->{DatabasePort} . "</port>
994                         <protocol>" . $passedsettings->{DatabaseProtocol} . "</protocol>
995                         <database>" . $passedsettings->{DatabaseName} . "</database>
996                         <username>" . $passedsettings->{DatabaseUsername} . "</username>
997                         <password>" . $passedsettings->{DatabasePassword} . "</password>
998                         <prefix>" . $passedsettings->{DatabaseTablePrefix} . "</prefix>
999                 </database>
1000         </settings>
1001 </kiriwrite-config>
1002         ";
1004         close ($configfile);
1008 #################################################################################
1009 # End list of subroutines.                                                      #
1010 #################################################################################
1012 if (!$http_query_confirm){
1014         $http_query_confirm = 0;
1018 if ($http_query_confirm eq 1){
1020         # The confirm value has been given so get the data from the query.
1022         my $http_query_dbdirectory              = $query->param('dbdirectory');
1023         my $http_query_outputdirectory          = $query->param('outputdirectory');
1024         my $http_query_imagesuripath            = $query->param('imagesuripath');
1026         my $http_query_dateformat               = $query->param('dateformat');
1027         my $http_query_customdateformat         = $query->param('customdateformat');
1029         my $http_query_language                 = $query->param('language');
1031         my $http_query_presmodule               = $query->param('presmodule');
1032         my $http_query_dbmodule                 = $query->param('dbmodule');
1034         my $http_query_databaseserver           = $query->param('databaseserver');
1035         my $http_query_databaseport             = $query->param('databaseport');
1036         my $http_query_databaseprotocol         = $query->param('databaseprotocol');
1037         my $http_query_databasename             = $query->param('databasename');
1038         my $http_query_databaseusername         = $query->param('databaseusername');
1039         my $http_query_databasepassword         = $query->param('databasepassword');
1040         my $http_query_databasetableprefix      = $query->param('databasetableprefix');
1041         my $http_query_removeinstallscript      = $query->param('removeinstallscript');
1043         # Check the length of the variables.
1045         my $kiriwrite_dbdirectory_length_check          = kiriwrite_variablecheck($http_query_dbdirectory, "maxlength", 64, 1);
1046         my $kiriwrite_outputdirectory_length_check      = kiriwrite_variablecheck($http_query_outputdirectory, "maxlength", 64, 1);
1047         my $kiriwrite_imagesuripath_length_check        = kiriwrite_variablecheck($http_query_imagesuripath, "maxlength", 512, 1);
1048         my $kiriwrite_dateformat_length_check           = kiriwrite_variablecheck($http_query_dateformat, "maxlength", 32, 1);
1049         my $kiriwrite_customdateformat_length_check     = kiriwrite_variablecheck($http_query_customdateformat, "maxlength", 32, 1);
1050         my $kiriwrite_language_length_check             = kiriwrite_variablecheck($http_query_language, "maxlength", 16, 1);
1052         # Check if any errors occured while checking the
1053         # length of the variables.
1055         if ($kiriwrite_dbdirectory_length_check eq 1){
1057                 # The database directory given is too long
1058                 # so return an error.
1060                 kiriwrite_error("dbdirectorytoolong");
1062         }
1064         if ($kiriwrite_outputdirectory_length_check eq 1){
1066                 # The output directory given is too long
1067                 # so return an error.
1069                 kiriwrite_error("outputdirectorytoolong");
1071         }
1073         if ($kiriwrite_imagesuripath_length_check eq 1){
1075                 # The images URI path given is too long
1076                 # so return an error.
1078                 kiriwrite_error("imagesuripathtoolong");
1080         }
1082         if ($kiriwrite_dateformat_length_check eq 1){
1084                 # The date format given is too long
1085                 # so return an error.
1087                 kiriwrite_error("dateformattoolong");
1089         }
1091         if ($kiriwrite_customdateformat_length_check eq 1){
1093                 # The date format given is too long
1094                 # so return an error.
1096                 kiriwrite_error("customdateformattoolong");
1098         }
1100         if ($kiriwrite_language_length_check eq 1){
1102                 # The language filename given is too long
1103                 # so return an error.
1105                 kiriwrite_error("languagefilenametoolong");
1107         }
1109         # Check if the custom date and time setting has anything
1110         # set and if it doesn't then use the predefined one set.
1112         my $finaldateformat = "";
1114         if ($http_query_customdateformat ne ""){
1116                 $finaldateformat = $http_query_customdateformat;
1118         } else {
1120                 $finaldateformat = $http_query_dateformat;
1122         }
1124         my $kiriwrite_datetime_check            = kiriwrite_variablecheck($finaldateformat, "datetime", 0, 1);
1126         if ($kiriwrite_datetime_check eq 1){
1128                 # The date and time format is blank so return
1129                 # an error.
1131                 kiriwrite_error("dateformatblank");
1133         } elsif ($kiriwrite_datetime_check eq 2){
1135                 # The date and time format is invalid so
1136                 # return an error.
1138                 kiriwrite_error("dateformatinvalid");
1140         }
1142         # Check if the language filename given is valid.
1144         my $kiriwrite_language_languagefilename_check = kiriwrite_variablecheck($http_query_language, "language_filename", "", 1);
1146         if ($kiriwrite_language_languagefilename_check eq 1) {
1148                 # The language filename given is blank so
1149                 # return an error.
1151                 kiriwrite_error("languagefilenameblank");
1153         } elsif ($kiriwrite_language_languagefilename_check eq 2){
1155                 # The language filename given is invalid so
1156                 # return an error.
1158                 kiriwrite_error("languagefilenameinvalid");
1160         }
1162         # Check if the directory names only contain letters and numbers and
1163         # return a specific error if they don't.
1165         my $kiriwrite_dbdirectory_check         = kiriwrite_variablecheck($http_query_dbdirectory, "directory", 0, 1);
1166         my $kiriwrite_outputdirectory_check     = kiriwrite_variablecheck($http_query_outputdirectory, "directory", 0, 1);
1168         if ($kiriwrite_dbdirectory_check eq 1){
1170                 # The database directory name is blank, so return
1171                 # an error.
1173                 kiriwrite_error("dbdirectoryblank");
1175         } elsif ($kiriwrite_dbdirectory_check eq 2){
1177                 # The database directory name is invalid, so return
1178                 # an error.
1180                 kiriwrite_error("dbdirectoryinvalid");
1182         }
1184         if ($kiriwrite_outputdirectory_check eq 1){
1186                 # The output directory name is blank, so return
1187                 # an error.
1189                 kiriwrite_error("outputdirectoryblank");
1191         } elsif ($kiriwrite_outputdirectory_check eq 2){
1193                 # The output directory name is invalid, so return
1194                 # an error.
1196                 kiriwrite_error("outputdirectoryinvalid");
1198         }
1200         if ($kiriwrite_dbdirectory_check eq 1){
1202                 # The database directory name is blank, so return
1203                 # an error.
1205                 kiriwrite_error("dbdirectoryblank");
1207         } elsif ($kiriwrite_dbdirectory_check eq 2){
1209                 # The database directory name is invalid, so return
1210                 # an error.
1212                 kiriwrite_error("dbdirectoryinvalid");
1214         }
1216         if ($kiriwrite_outputdirectory_check eq 1){
1218                 # The output directory name is blank, so return
1219                 # an error.
1221                 kiriwrite_error("outputdirectoryblank");
1223         } elsif ($kiriwrite_outputdirectory_check eq 2){
1225                 # The output directory name is invalid, so return
1226                 # an error.
1228                 kiriwrite_error("outputdirectoryinvalid");
1230         }
1232         # Check the module names to see if they're valid.
1234         my $kiriwrite_presmodule_modulename_check       = kiriwrite_variablecheck($http_query_presmodule, "module", 0, 1);
1235         my $kiriwrite_dbmodule_modulename_check         = kiriwrite_variablecheck($http_query_dbmodule, "module", 0, 1);
1237         if ($kiriwrite_presmodule_modulename_check eq 1){
1239                 # The presentation module name is blank, so return
1240                 # an error.
1242                 kiriwrite_error("presmoduleblank");
1244         }
1246         if ($kiriwrite_presmodule_modulename_check eq 2){
1248                 # The presentation module name is invalid, so return
1249                 # an error.
1251                 kiriwrite_error("presmoduleinvalid");
1253         }
1255         if ($kiriwrite_dbmodule_modulename_check eq 1){
1257                 # The database module name is blank, so return
1258                 # an error.
1260                 kiriwrite_error("dbmoduleblank");
1262         }
1264         if ($kiriwrite_dbmodule_modulename_check eq 2){
1266                 # The database module name is invalid, so return
1267                 # an error.
1269                 kiriwrite_error("dbmoduleinvalid");
1271         }
1273         # Check if the database module, presentation module and
1274         # language file exists.
1276         if (!-e "Modules/Presentation/" . $http_query_presmodule . ".pm"){
1278                 # The presentation module is missing so return an
1279                 # error.
1281                 kiriwrite_error("presmodulemissing");
1283         }
1285         if (!-e "Modules/Database/" . $http_query_dbmodule . ".pm"){
1287                 # The database module is missing so return an
1288                 # error.
1290                 kiriwrite_error("dbmodulemissing");
1292         }
1294         if (!-e "lang/" . $http_query_language . ".xml"){
1296                 # The language file is missing so return an
1297                 # error.
1299                 kiriwrite_error("languagefilenamemissing");
1301         }
1303         # Check the database server settings.
1305         my $kiriwrite_databaseserver_length_check               = kiriwrite_variablecheck($http_query_databaseserver, "maxlength", 128, 1);
1306         my $kiriwrite_databaseserver_lettersnumbers_check       = kiriwrite_variablecheck($http_query_databaseserver, "lettersnumbers", 0, 1);
1307         my $kiriwrite_databaseport_length_check                 = kiriwrite_variablecheck($http_query_databaseport, "maxlength", 5, 1);
1308         my $kiriwrite_databaseport_numbers_check                = kiriwrite_variablecheck($http_query_databaseport, "numbers", 0, 1);
1309         my $kiriwrite_databaseport_port_check                   = kiriwrite_variablecheck($http_query_databaseport, "port", 0, 1);
1310         my $kiriwrite_databaseprotocol_length_check             = kiriwrite_variablecheck($http_query_databaseprotocol, "maxlength", 5, 1);
1311         my $kiriwrite_databaseprotocol_protocol_check           = kiriwrite_variablecheck($http_query_databaseprotocol, "serverprotocol", 0, 1);
1312         my $kiriwrite_databasename_length_check                 = kiriwrite_variablecheck($http_query_databasename, "maxlength", 32, 1);
1313         my $kiriwrite_databasename_lettersnumbers_check         = kiriwrite_variablecheck($http_query_databasename, "lettersnumbers", 0, 1);
1314         my $kiriwrite_databaseusername_length_check             = kiriwrite_variablecheck($http_query_databaseusername, "maxlength", 16, 1);
1315         my $kiriwrite_databaseusername_lettersnumbers_check     = kiriwrite_variablecheck($http_query_databaseusername, "lettersnumbers", 0, 1);
1316         my $kiriwrite_databasepassword_length_check             = kiriwrite_variablecheck($http_query_databasepassword, "maxlength", 64, 1);
1317         my $kiriwrite_databasetableprefix_length_check          = kiriwrite_variablecheck($http_query_databasetableprefix, "maxlength", 16, 1);
1318         my $kiriwrite_databasetableprefix_lettersnumbers_check  = kiriwrite_variablecheck($http_query_databasetableprefix, "lettersnumbers", 0, 1);
1320         if ($kiriwrite_databaseserver_length_check eq 1){
1322                 # The length of the database server name is too long so
1323                 # return an error.
1325                 kiriwrite_error("servernametoolong");
1327         }
1329         if ($kiriwrite_databaseserver_lettersnumbers_check eq 1){
1331                 # The database server name contains characters other
1332                 # than letters and numbers, so return an error.
1334                 kiriwrite_error("servernameinvalid");
1336         }
1338         if ($kiriwrite_databaseport_length_check eq 1){
1340                 # The database port number length is too long so return
1341                 # an error.
1343                 kiriwrite_error("serverportnumbertoolong");
1345         }
1347         if ($kiriwrite_databaseport_numbers_check eq 1){
1349                 # The database port number contains characters other
1350                 # than numbers so return an error.
1352                 kiriwrite_error("serverportnumberinvalidcharacters");
1354         }
1356         if ($kiriwrite_databaseport_port_check eq 1){
1358                 # The database port number given is invalid so return
1359                 # an error.
1361                 kiriwrite_error("serverportnumberinvalid");
1363         }
1365         if ($kiriwrite_databaseprotocol_length_check eq 1){
1367                 # The database protocol name given is too long so
1368                 # return an error.
1370                 kiriwrite_error("serverprotocolnametoolong");
1372         }
1374         if ($kiriwrite_databaseprotocol_protocol_check eq 1){
1376                 # The server protcol given is invalid so return
1377                 # an error.
1379                 kiriwrite_error("serverprotocolinvalid");
1381         }
1383         if ($kiriwrite_databasename_length_check eq 1){
1385                 # The SQL database name is too long so return
1386                 # an error.
1388                 kiriwrite_error("serverdatabasenametoolong");
1390         }
1392         if ($kiriwrite_databasename_lettersnumbers_check eq 1){
1394                 # The database name contains invalid characters
1395                 # so return an error.
1397                 kiriwrite_error("serverdatabasenameinvalid");
1399         }
1401         if ($kiriwrite_databaseusername_length_check eq 1){
1403                 # The database username given is too long so
1404                 # return an error.
1406                 kiriwrite_error("serverdatabaseusernametoolong");
1408         }
1410         if ($kiriwrite_databaseusername_lettersnumbers_check eq 1){
1412                 # The database username contains invalid characters
1413                 # so return an error.
1415                 kiriwrite_error("serverdatabaseusernameinvalid");
1417         }
1419         if ($kiriwrite_databasepassword_length_check eq 1){
1421                 # The database password given is too long so return
1422                 # an error.
1424                 kiriwrite_error("serverdatabasepasswordtoolong");
1426         }
1428         if ($kiriwrite_databasetableprefix_length_check eq 1){
1430                 # The database table prefix given is too long so
1431                 # return an error.
1433                 kiriwrite_error("serverdatabasetableprefixtoolong");
1435         }
1437         if ($kiriwrite_databasetableprefix_lettersnumbers_check eq 1){
1439                 # The database table prefix given contains invalid
1440                 # characters so return an error.
1442                 kiriwrite_error("serverdatabasetableprefixinvalid");
1444         }
1446         # Check the length of value of the checkboxes.
1448         my $kiriwrite_removeinstallscript_length_check  = kiriwrite_variablecheck($http_query_removeinstallscript, "maxlength", 2, 1);
1450         if ($kiriwrite_removeinstallscript_length_check eq 1){
1452                 # The remove install script value is too long
1453                 # so return an error.
1455                 kiriwrite_error("removeinstallscripttoolong");
1457         }
1459         # Check if there is write permissions for the directory.
1461         if (!-w '.'){
1463                 # No write permissions for the directory the
1464                 # script is running from so return an error.
1466                 kiriwrite_error("cannotwriteconfigurationindirectory");
1468         }
1470         # Check if the configuration file already exists.
1472         if (-e 'kiriwrite.xml'){
1474                 # Check if the configuration file has read permissions.
1476                 if (!-r 'kiriwrite.xml'){
1478                         # The configuration file has invalid read permissions
1479                         # set so return an error.
1481                         kiriwrite("configurationfilereadpermissionsinvalid");
1483                 }
1485                 # Check if the configuration file has write permissions.
1487                 if (!-w 'kiriwrite.xml'){
1489                         # The configuration file has invalid write permissions
1490                         # set so return an error.
1492                         kiriwrite("configurationfilewritepermissionsinvalid");
1494                 }
1496         }
1498         # Write the new configuration file.
1500         kiriwrite_writeconfig({ DatabaseDirectory => $http_query_dbdirectory, OutputDirectory => $http_query_outputdirectory, ImagesURIPath => $http_query_imagesuripath, DateFormat => $finaldateformat, Language => $http_query_language, PresentationModule => $http_query_presmodule, 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 });
1502         my $installscriptmessage        = "";
1504         # Check if the installation script should be deleted.
1506         if (!$http_query_removeinstallscript){
1508                 $http_query_removeinstallscript = "off";
1510         }
1512         if ($http_query_removeinstallscript eq "on"){
1514                 if (unlink("install.cgi")){
1516                         $installscriptmessage = $kiriwrite_lang{$language_selected}{installscriptremoved};
1518                 } else {
1520                         $installscriptmessage = $kiriwrite_lang{$language_selected}{cannotremovescript};
1521                         $installscriptmessage =~ s/%s/$!/g;
1523                         # FINISH THIS! >O
1525                         #"Unable to remove the installer script: " . $! . " The installer script will have to be deleted manually.";
1527                 }
1529         }
1531         print header();
1533         print start_html({ -title => $kiriwrite_lang{$language_selected}{installertitle}, -style => { -code => $cssstyle }});
1534         print h2($kiriwrite_lang{$language_selected}{installertitle});
1535         print $kiriwrite_lang{$language_selected}{installedmessage};
1537         if ($installscriptmessage){
1539                 print br();
1540                 print br();
1541                 print $installscriptmessage;
1543         }
1545         print br();
1546         print br();
1547         print $kiriwrite_lang{$language_selected}{usekiriwritetext};
1548         print br();
1549         print br();
1550         print a({-href=>'kiriwrite.cgi'}, $kiriwrite_lang{$language_selected}{usekiriwritelink});
1552         exit;
1556 # Create a list of common date and time formats.
1558 my @datetime_formats = [ 
1559         'DD/MM/YY (hh:mm:ss)', 'DD/MM/YY hh:mm:ss', 'D/M/Y (hh:mm:ss)',
1560         'D/M/Y hh:mm:ss', 'D/M/YY (hh:mm:ss)', 'D/M/YY hh:mm:ss',
1561         'DD/MM (hh:mm:ss)', 'D/M (hh:mm:ss)', 'DD/MM hh:mm:ss', 
1562         'D/M hh:mm:ss', 'DD/MM hh:mm', 'D/M hh:mm',
1563         'DD/MM/YY', 'D/M/Y', 'DD/MM',
1565         'YY-MM-DD (hh:mm:ss)', 'YY-MM-DD hh:mm:ss', 'Y-M-D (hh:mm:ss)',
1566         'Y-M-D hh:mm:ss', 'M-D (hh:mm:ss)', 'M-D hh:mm:ss',
1567         'YY-MM-DD', 'MM-DD' 
1568 ];
1570 # Create the list of tests to do.
1572 my ($test_list, %test_list);
1573 my %dependency_results;
1574 my %database_results;
1575 my %file_results;
1576 my $test;
1577 my $date;
1579 my $dependency_error = 0;
1580 my $database_onemodule = 0;
1581 my $database_error = 0;
1582 my $file_error = 0;
1584 my $language_name;
1585 my $language_xml_data;
1586 my $language_file_friendly;
1588 my $presentation_file_friendly;
1590 # Check to see if the needed Perl modules are installed.
1592 $test_list{CheckDBI}{Name}              = "DBI";
1593 $test_list{CheckDBI}{Type}              = "dependency";
1594 $test_list{CheckDBI}{Code}              = "DBI";
1596 $test_list{CheckXMLSimple}{Name}        = "XML::Simple";
1597 $test_list{CheckXMLSimple}{Type}        = "dependency";
1598 $test_list{CheckXMLSimple}{Code}        = "XML::Simple";
1600 $test_list{CheckTieHash}{Name}          = "Tie::IxHash";
1601 $test_list{CheckTieHash}{Type}          = "dependency";
1602 $test_list{CheckTieHash}{Code}          = "Tie::IxHash";
1604 $test_list{Encode}{Name}                = "Encode";
1605 $test_list{Encode}{Type}                = "dependency";
1606 $test_list{Encode}{Code}                = "Encode";
1608 $test_list{DBDmysql}{Name}              = "DBD::mysql";
1609 $test_list{DBDmysql}{Type}              = "database";
1610 $test_list{DBDmysql}{Code}              = "DBD::mysql";
1612 $test_list{DBDSQLite}{Name}             = "DBD::SQLite";
1613 $test_list{DBDSQLite}{Type}             = "database";
1614 $test_list{DBDSQLite}{Code}             = "DBD::SQLite";
1616 # Check the file and directory permissions to see if they are correct.
1618 $test_list{MainDirectory}{Name}         = "Kiriwrite Directory (.)";
1619 $test_list{MainDirectory}{Type}         = "file";
1620 $test_list{MainDirectory}{Code}         = ".";
1621 $test_list{MainDirectory}{Writeable}    = "1";
1623 $test_list{LanguageDirectory}{Name}             = "Language Directory (lang)";
1624 $test_list{LanguageDirectory}{Type}             = "file";
1625 $test_list{LanguageDirectory}{Code}             = "lang";
1626 $test_list{LanguageDirectory}{Writeable}        = "0";
1628 $test_list{ModulesDirectory}{Name}              = "Modules Directory (Modules)";
1629 $test_list{ModulesDirectory}{Type}              = "file";
1630 $test_list{ModulesDirectory}{Code}              = "Modules";
1631 $test_list{ModulesDirectory}{Writeable}         = "0";
1633 $test_list{DBModulesDirectory}{Name}            = "Database Modules Directory (Modules/Database)";
1634 $test_list{DBModulesDirectory}{Type}            = "file";
1635 $test_list{DBModulesDirectory}{Code}            = "Modules/Database";
1636 $test_list{DBModulesDirectory}{Writeable}       = "0";
1638 $test_list{PresModulesDirectory}{Name}          = "Presentation Modules Directory (Modules/Presentation)";
1639 $test_list{PresModulesDirectory}{Type}          = "file";
1640 $test_list{PresModulesDirectory}{Code}          = "Modules/Presentation";
1641 $test_list{PresModulesDirectory}{Writeable}     = "0";
1643 # Preform those tests.
1645 foreach $test (keys %test_list){
1647         # Check the type of test.
1649         if ($test_list{$test}{Type} eq "dependency"){
1651                 if (eval "require " . $test_list{$test}{Code}){
1653                         # The module exists and is working correctly.
1655                         $dependency_results{$test_list{$test}{Name}}{result}    = $kiriwrite_lang{$language_selected}{testpass};
1657                 } else {
1659                         # The module does not exist or has an error.
1661                         $dependency_error = 1;
1662                         $dependency_results{$test_list{$test}{Name}}{result}    = $kiriwrite_lang{$language_selected}{testfail};
1664                 }
1666         } elsif ($test_list{$test}{Type} eq "database"){
1668                 if (eval "require " . $test_list{$test}{Code}){
1670                         # The module exists and it is working correctly.
1672                         $database_results{$test_list{$test}{Name}}{result}      = $kiriwrite_lang{$language_selected}{testpass};
1673                         $database_onemodule = 1;
1675                 } else {
1677                         # The module does not exist or has an error.
1679                         $database_error = 1;
1680                         $database_results{$test_list{$test}{Name}}{result}      = $kiriwrite_lang{$language_selected}{testfail};
1682                 }
1684         } elsif ($test_list{$test}{Type} eq "file"){
1686                 if (-e $test_list{$test}{Code}){
1688                         # The filename given does exist.
1690                 } else {
1692                         # the filename given does not exist.
1694                         $file_error = 1;
1695                         $file_results{$test_list{$test}{Name}}{result}  = $kiriwrite_lang{$language_selected}{errormessage} . $kiriwrite_lang{$language_selected}{doesnotexist};
1697                 }       
1699                 # Test to see if the filename given has read
1700                 # permissions.
1702                 if (-r $test_list{$test}{Code}){
1704                         # The filename given has valid permissions set.
1706                         $file_results{$test_list{$test}{Name}}{result}  = $kiriwrite_lang{$language_selected}{testpass};
1708                 } else {
1710                         # The filename given has invalid permissions set.
1712                         $file_error = 1;
1713                         $file_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{errormessage} . $kiriwrite_lang{$language_selected}{invalidpermissionsset};
1715                 }
1717                 if ($test_list{$test}{Writeable} eq 1){
1719                         # Test to see if the filename given has write
1720                         # permissions.
1722                         if (-w $test_list{$test}{Code}){
1724                                 # The filename given has valid permissions set.
1726                                 $file_results{$test_list{$test}{Name}}{result}  = $kiriwrite_lang{$language_selected}{testpass};
1728                         } else {
1730                                 # The filename given has invalid permissions set.
1732                                 $file_error = 1;
1733                                 $file_results{$test_list{$test}{Name}}{result}  = $kiriwrite_lang{$language_selected}{errormessage} . $kiriwrite_lang{$language_selected}{invalidpermissionsset};
1735                         }
1737                 }
1739         }
1743 # Print the header.
1745 print header();
1747 # Print the page for installing Kiriwrite.
1749 print start_html( -title=> $kiriwrite_lang{$language_selected}{installertitle}, -style => { -code => $cssstyle });
1751 print start_table( { -width=> "100%" } );
1752 print start_Tr();
1753 print start_td({ -class => "languagebar" });
1754 print $kiriwrite_lang{$language_selected}{installertitle};
1755 print end_td();
1756 print start_td({ -class => "languagebarselect" });
1757 print start_form("POST", "install.cgi");
1759 # This is a bodge for the language list.
1761 my $language_name_short;
1762 my $language_list_seek = 0;
1764 print "<select name=\"installlanguage\">";
1766 foreach $language_name_short (@language_list_short){
1768         print "<option value=\"" . $language_name_short . "\">" . $language_list_long[$language_list_seek] . "</option>";
1769         $language_list_seek++;
1773 print "</select> ";
1774 print submit($kiriwrite_lang{$language_selected}{switch});
1776 print end_form;
1777 print end_td();
1778 print end_Tr();
1779 print end_table();
1781 print h2($kiriwrite_lang{$language_selected}{installertitle});
1783 print $kiriwrite_lang{$language_selected}{installertext};
1785 print h3($kiriwrite_lang{$language_selected}{dependencytitle});
1786 print h4($kiriwrite_lang{$language_selected}{requiredmodules});
1787 print $kiriwrite_lang{$language_selected}{perlmodules};
1788 print br();;
1789 print br();;
1791 if ($dependency_error eq 1){
1793         print $kiriwrite_lang{$language_selected}{errormessage};
1794         print $kiriwrite_lang{$language_selected}{dependencyperlmodulesmissing};
1795         print br();
1796         print br();
1800 print start_table();
1801 print start_Tr();
1802 print start_td({ -class => "tablecellheader" });
1803 print $kiriwrite_lang{$language_selected}{module};
1804 print end_td();
1805 print start_td({ -class => "tablecellheader" });
1806 print $kiriwrite_lang{$language_selected}{result};
1807 print end_td();
1808 print end_Tr();
1810 foreach $test (keys %dependency_results) {
1812         print start_Tr();
1813         print start_td({ -class => "tablename" });
1814                 print $test;
1815         print end_td();
1816         print start_td({ -class => "tabledata" });
1817                 print $dependency_results{$test}{result};
1818         print end_td();
1819         print end_Tr();
1823 print end_table();
1825 print h4($kiriwrite_lang{$language_selected}{databasemodules});
1826 print $kiriwrite_lang{$language_selected}{databasemodulestext};
1827 print br();
1828 print br();
1830 if ($database_error eq 1){
1832         print $kiriwrite_lang{$language_selected}{warningmessage};
1833         print $kiriwrite_lang{$language_selected}{databaseperlmodulesmissing};
1834         print br();
1835         print br();
1839 print start_table();
1840 print start_Tr();
1841 print start_td({ -class => "tablecellheader" });
1842 print $kiriwrite_lang{$language_selected}{module};
1843 print end_td();
1844 print start_td({ -class => "tablecellheader" });
1845 print $kiriwrite_lang{$language_selected}{result};
1846 print end_td();
1847 print end_Tr();
1849 foreach $test (keys %database_results) {
1851         print start_Tr();
1852         print start_td({ -class => "tablename" });
1853                 print $test;
1854         print end_td();
1855         print start_td({ -class => "tabledata" });
1856                 print $database_results{$test}{result};
1857         print end_td();
1858         print end_Tr();
1862 print end_table();
1864 print h4($kiriwrite_lang{$language_selected}{filepermissions});
1866 print $kiriwrite_lang{$language_selected}{filepermissionstext};
1867 print br();
1868 print br();
1870 if ($file_error eq 1){
1872         print $kiriwrite_lang{$language_selected}{errormessage};
1873         print $kiriwrite_lang{$language_selected}{filepermissionsinvalid};
1874         print br();
1875         print br();
1879 print start_table();
1880 print start_Tr();
1881 print start_td({ -class => "tablecellheader" });
1882 print "Filename";
1883 print end_td();
1884 print start_td({ -class => "tablecellheader" });
1885 print "Result";
1886 print end_td();
1887 print end_Tr();
1889 foreach $test (keys %file_results) {
1891         print start_Tr();
1892         print start_td({ -class => "tablename" });
1893                 print $test;
1894         print end_td();
1895         print start_td({ -class => "tabledata" });
1896                 print $file_results{$test}{result};
1897         print end_td();
1898         print end_Tr();
1902 print end_table();
1904 if ($dependency_error eq 1){
1906         print hr();
1907         print h4($kiriwrite_lang{$language_selected}{criticalerror});
1908         print $kiriwrite_lang{$language_selected}{dependencymodulesnotinstalled};
1909         print end_html;
1910         exit;
1914 if ($database_onemodule eq 0){
1916         print hr();
1917         print h4($kiriwrite_lang{$language_selected}{criticalerror});
1918         print $kiriwrite_lang{$language_selected}{databasemodulesnotinstalled};
1919         print end_html;
1920         exit;
1924 if ($file_error eq 1){
1926         print hr();
1927         print h4($kiriwrite_lang{$language_selected}{criticalerror});
1928         print $kiriwrite_lang{$language_selected}{filepermissionerrors};
1929         print end_html;
1930         exit;
1934 my @language_short;
1935 my (%available_languages, $available_languages);
1936 my @presentation_modules;
1937 my @database_modules;
1939 my $presentation_modules_ref = \@presentation_modules;
1940 my $database_modules_ref = \@database_modules;
1942 # Get the list of available languages.
1944 tie(%available_languages, 'Tie::IxHash');
1946 opendir(LANGUAGEDIR, "lang");
1947 my @language_directory = grep /m*\.xml$/, readdir(LANGUAGEDIR);
1948 closedir(LANGUAGEDIR);
1950 my $xsl = XML::Simple->new();
1952 foreach my $language_file (@language_directory){
1954         # Load the XML data.
1956         $language_xml_data = $xsl->XMLin("lang/" . $language_file);
1958         # Get the friendly name for the language file.
1960         $language_file_friendly = $language_file;
1961         $language_file_friendly =~ s/.xml$//g;
1963         $language_name = $language_xml_data->{about}->{name};
1965         $available_languages{$language_file_friendly} = $language_name . " (" . $language_file_friendly . ")";
1969 # Get the list of presentation modules.
1971 opendir(OUTPUTSYSTEMDIR, "Modules/Presentation");
1972 my @presmodule_directory = grep /m*\.pm$/, readdir(OUTPUTSYSTEMDIR);
1973 closedir(OUTPUTSYSTEMDIR);
1975 foreach my $presmodule_file (@presmodule_directory){
1977         # Get the friendly name for the database module.
1979         $presmodule_file =~ s/.pm$//g;
1981         push(@presentation_modules, $presmodule_file);
1985 # Get the list of database modules.
1987 opendir(DATABASEDIR, "Modules/Database");
1988 my @dbmodule_directory = grep /m*\.pm$/, readdir(DATABASEDIR);
1989 closedir(DATABASEDIR);
1991 foreach my $dbmodule_file (@dbmodule_directory){
1993         # Get the friendly name for the database module.
1995         $dbmodule_file =~ s/.pm$//g;
1997         push(@database_modules, $dbmodule_file);
2001 print h3($kiriwrite_lang{$language_selected}{settingstitle});
2003 print $kiriwrite_lang{$language_selected}{settingstext};
2004 print br();
2005 print br();
2007 print start_form("POST", "install.cgi");
2008 print hidden( -name => 'confirm', -default => '1');
2009 print hidden( -name => 'installlanguage', -default => $language_selected);
2011 print start_table({ -width => "100%" });
2013 print start_Tr();
2014 print start_td({ -class => "tablecellheader" });
2015 print $kiriwrite_lang{$language_selected}{setting};
2016 print end_td();
2017 print start_td({ -class => "tablecellheader" });
2018 print $kiriwrite_lang{$language_selected}{value};
2019 print end_td();
2020 print end_Tr();
2022 print start_Tr();
2023 print start_td({ -class => "tablecellheader" });
2024 print $kiriwrite_lang{$language_selected}{directories};
2025 print end_td();
2026 print start_td({ -class => "tablecellheader" });
2027 print end_td();
2028 print end_Tr();
2030 print start_Tr();
2031 print start_td({ -class => "tablename" });
2032 print $kiriwrite_lang{$language_selected}{databasedirectory};
2033 print end_td();
2034 print start_td({ -class => "tabledata" });
2035 print textfield({ -name => "dbdirectory", -size => 32, -maxlength => 64, -value => $default_dbdirectory });
2036 print end_td();
2037 print end_Tr();
2039 print start_Tr();
2040 print start_td({ -class => "tablename" });
2041 print $kiriwrite_lang{$language_selected}{outputdirectory};
2042 print end_td();
2043 print start_td({ -class => "tabledata" });
2044 print textfield({ -name => "outputdirectory", -size => 32, -maxlength => 64, -value => $default_outputdirectory });
2045 print end_td();
2046 print end_Tr();
2048 print start_Tr();
2049 print start_td({ -class => "tablename" });
2050 print $kiriwrite_lang{$language_selected}{imagesuripath};
2051 print end_td();
2052 print start_td({ -class => "tabledata" });
2053 print textfield({ -name => "imagesuripath", -size => 32, -maxlength => 64, -value => $default_imagesuri });
2054 print end_td();
2055 print end_Tr();
2057 print start_Tr();
2058 print start_td({ -class => "tablecellheader" });
2059 print $kiriwrite_lang{$language_selected}{date};
2060 print end_td();
2061 print start_td({ -class => "tablecellheader" });
2062 print "";
2063 print end_td();
2064 print end_Tr();
2066 print start_Tr();
2067 print start_td({ -class => "tablename" });
2068 print $kiriwrite_lang{$language_selected}{dateformat};
2069 print end_td();
2070 print start_td({ -class => "tabledata" });
2072 print popup_menu( -name => "dateformat", -values => @datetime_formats );
2073 print textfield({ -name => "customdateformat", -size => 32, -maxlength => 64, });
2075 print end_td();
2076 print end_Tr();
2078 print start_Tr();
2079 print start_td({ -class => "tablecellheader" });
2080 print $kiriwrite_lang{$language_selected}{language};
2081 print end_td();
2082 print start_td({ -class => "tablecellheader" });
2083 print end_td();
2084 print end_Tr();
2086 print start_Tr();
2087 print start_td({ -class => "tablename" });
2088 print $kiriwrite_lang{$language_selected}{systemlanguage};
2089 print end_td();
2090 print start_td({ -class => "tabledata" });
2092 # Note: This the following code is bodge. If anyone can fix it so that it all works
2093 # with popup_menu properly it will be appriciated.
2095 print "<select name=\"language\">";
2097 foreach my $language (keys %available_languages){
2099         if ($language eq $language_selected){
2101                 print "<option value=\"" . $language . "\" selected=selected>" . $available_languages{$language} . "</option>";
2103         } else {
2105                 print "<option value=\"" . $language . "\">" . $available_languages{$language} . "</option>";
2107         }
2111 print "</select>";
2113 print end_td();
2114 print end_Tr();
2116 print start_Tr();
2117 print start_td({ -class => "tablecellheader" });
2118 print $kiriwrite_lang{$language_selected}{modules};
2119 print end_td();
2120 print start_td({ -class => "tablecellheader" });
2121 print "";
2122 print end_td();
2123 print end_Tr();
2125 print start_Tr();
2126 print start_td({ -class => "tablename" });
2127 print $kiriwrite_lang{$language_selected}{presentationmodule};
2128 print end_td();
2129 print start_td({ -class => "tabledata" });
2130 print popup_menu({ -name => 'presmodule', -values => $presentation_modules_ref });
2131 print end_td();
2132 print end_Tr();
2134 print start_Tr();
2135 print start_td({ -class => "tablename" });
2136 print $kiriwrite_lang{$language_selected}{databasemodule};
2137 print end_td();
2138 print start_td({ -class => "tabledata" });
2139 print popup_menu({ -name => 'dbmodule', -values => $database_modules_ref });
2140 print end_td();
2141 print end_Tr();
2143 print start_Tr();
2144 print start_td({ -class => "tablename" });
2145 print $kiriwrite_lang{$language_selected}{databaseserver};
2146 print end_td();
2147 print start_td({ -class => "tabledata" });
2148 print textfield({ -name => "databaseserver", -size => 32, -maxlength => 128, -value => $default_server });
2149 print end_td();
2150 print end_Tr();
2152 print start_Tr();
2153 print start_td({ -class => "tablename" });
2154 print $kiriwrite_lang{$language_selected}{databaseport};
2155 print end_td();
2156 print start_td({ -class => "tabledata" });
2157 print textfield({ -name => "databaseport", -maxlength => 5, -size => 5, -value => $default_port });
2158 print end_td();
2159 print end_Tr();
2161 print start_Tr();
2162 print start_td({ -class => "tablename" });
2163 print $kiriwrite_lang{$language_selected}{databaseprotocol};
2164 print end_td();
2165 print start_td({ -class => "tabledata" });
2166 print popup_menu( -name => "databaseprotocol", -values => [ 'tcp', 'udp' ], -default => $default_protocol);
2167 print end_td();
2168 print end_Tr();
2170 print start_Tr();
2171 print start_td({ -class => "tablename" });
2172 print $kiriwrite_lang{$language_selected}{databasename};
2173 print end_td();
2174 print start_td({ -class => "tabledata" });
2175 print textfield({ -name => "databasename", -size => 32, -maxlength => 32, -default => $default_name });
2176 print end_td();
2177 print end_Tr();
2179 print start_Tr();
2180 print start_td({ -class => "tablename" });
2181 print $kiriwrite_lang{$language_selected}{databaseusername};
2182 print end_td();
2183 print start_td({ -class => "tabledata" });
2184 print textfield({ -name => "databaseusername", -size => 16, -maxlength => 16, -default => $default_username });
2185 print end_td();
2186 print end_Tr();
2188 print start_Tr();
2189 print start_td({ -class => "tablename" });
2190 print $kiriwrite_lang{$language_selected}{databasepassword};
2191 print end_td();
2192 print start_td({ -class => "tabledata" });
2193 print password_field({ -name => "databasepassword", -size => 32, -maxlength => 64 });
2194 print end_td();
2195 print end_Tr();
2197 print start_Tr();
2198 print start_td({ -class => "tablename" });
2199 print $kiriwrite_lang{$language_selected}{databasetableprefix};
2200 print end_td();
2201 print start_td({ -class => "tabledata" });
2202 print textfield({ -name => "databasetableprefix", -size => 32, -maxlength => 32, -default => $default_prefix });
2203 print end_td();
2204 print end_Tr();
2206 print start_Tr();
2207 print start_td({ -class => "tablecellheader" });
2208 print $kiriwrite_lang{$language_selected}{installationoptions};
2209 print end_td();
2210 print start_td({ -class => "tablecellheader" });
2211 print "";
2212 print end_td();
2213 print end_Tr();
2215 print start_Tr();
2216 print start_td({ -class => "tablename" });
2217 print $kiriwrite_lang{$language_selected}{installoptions};
2218 print end_td();
2219 print start_td({ -class => "tabledata" });
2220 print checkbox( -name => 'removeinstallscript', -checked => 1, -label => " " . $kiriwrite_lang{$language_selected}{removeinstallscript});
2221 print end_td();
2222 print end_Tr();
2224 print end_table();
2226 print br();
2227 print submit($kiriwrite_lang{$language_selected}{savesettingsbutton});
2228 print " | ";
2229 print reset($kiriwrite_lang{$language_selected}{resetsettingsbutton});
2231 print end_form();
2233 print end_html;
2234 exit;
2236 __END__
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy