Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Forgot installer script too.
[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.0.2                                                                #
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"}{"setting"}             = "Setting";
114         $kiriwrite_lang{"en-GB"}{"value"}               = "Value";
115         $kiriwrite_lang{"en-GB"}{"filename"}            = "Filename";
116         $kiriwrite_lang{"en-GB"}{"module"}              = "Module";
117         $kiriwrite_lang{"en-GB"}{"result"}              = "Result";
118         $kiriwrite_lang{"en-GB"}{"error"}               = "Error!";
119         $kiriwrite_lang{"en-GB"}{"criticalerror"}       = "Critical Error!";
120         $kiriwrite_lang{"en-GB"}{"errormessage"}        = "Error: ";
121         $kiriwrite_lang{"en-GB"}{"warningmessage"}      = "Warning: ";
123         $kiriwrite_lang{"en-GB"}{"doesnotexist"}        = "Does not exist.";
124         $kiriwrite_lang{"en-GB"}{"invalidpermissionsset"}       = "Invalid permissions set.";
126         $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.";
127         $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.";
128         $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.";
129         $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.";
130         $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.";
131         $kiriwrite_lang{"en-GB"}{"filepermissionerrors"}        = "One or more filenames checked has errors. See the Kiriwrite documentation for more information on this.",
133         $kiriwrite_lang{"en-GB"}{"installertitle"}      = "Kiriwrite Installer";
134         $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.";
135         $kiriwrite_lang{"en-GB"}{"dependencytitle"}     = "Dependency and file testing results";
136         $kiriwrite_lang{"en-GB"}{"requiredmodules"}     = "Required Modules";
137         $kiriwrite_lang{"en-GB"}{"perlmodules"}         = "These Perl modules are used internally by Kiriwrite.";
138         $kiriwrite_lang{"en-GB"}{"databasemodules"}     = "Database Modules";
139         $kiriwrite_lang{"en-GB"}{"databasemodulestext"} = "These Perl modules are used by the database modules.";
140         $kiriwrite_lang{"en-GB"}{"filepermissions"}     = "File permissions";
141         $kiriwrite_lang{"en-GB"}{"filepermissionstext"} = "The file permissions are for file and directories that are critical to Kiriwrite such as module and language directories.";
142         
143         $kiriwrite_lang{"en-GB"}{"settingstitle"}       = "Kiriwrite Settings";
144         $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.";
145         $kiriwrite_lang{"en-GB"}{"directories"}         = "Directories";
146         $kiriwrite_lang{"en-GB"}{"databasedirectory"}   = "Database Directory";
147         $kiriwrite_lang{"en-GB"}{"outputdirectory"}     = "Output Directory";
148         $kiriwrite_lang{"en-GB"}{"imagesuripath"}       = "Images (URI path)";
149         $kiriwrite_lang{"en-GB"}{"date"}                = "Date";
150         $kiriwrite_lang{"en-GB"}{"dateformat"}          = "Date Format";
151         $kiriwrite_lang{"en-GB"}{"language"}            = "Language";
152         $kiriwrite_lang{"en-GB"}{"systemlanguage"}      = "System Language";
153         $kiriwrite_lang{"en-GB"}{"modules"}             = "Modules";
154         $kiriwrite_lang{"en-GB"}{"presentationmodule"}  = "Presentation Module";
155         $kiriwrite_lang{"en-GB"}{"databasemodule"}      = "Database Module";
156         $kiriwrite_lang{"en-GB"}{"databaseserver"}      = "Database Server";
157         $kiriwrite_lang{"en-GB"}{"databaseport"}        = "Database Port";
158         $kiriwrite_lang{"en-GB"}{"databaseprotocol"}    = "Database Protocol";
159         $kiriwrite_lang{"en-GB"}{"databasename"}        = "Database Name";
160         $kiriwrite_lang{"en-GB"}{"databaseusername"}    = "Database Username";
161         $kiriwrite_lang{"en-GB"}{"databasepassword"}    = "Database Password";
162         $kiriwrite_lang{"en-GB"}{"databasetableprefix"} = "Database Table Prefix";
163         $kiriwrite_lang{"en-GB"}{"installationoptions"} = "Installation Options";
164         $kiriwrite_lang{"en-GB"}{"installoptions"}      = "Install Options";
165         $kiriwrite_lang{"en-GB"}{"removeinstallscript"} = "Delete this installer script after configuration file has been written.";
166         $kiriwrite_lang{"en-GB"}{"savesettingsbutton"}  = "Save Settings";
167         $kiriwrite_lang{"en-GB"}{"resetsettingsbutton"} = "Reset Settings";
169         $kiriwrite_lang{"en-GB"}{"installscriptremoved"}        = "The installer script was removed.";
170         $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.";
171         $kiriwrite_lang{"en-GB"}{"cannotremovescript"}  = "Unable to remove the installer script: %s. The installer script will have to be deleted manually.";
172         $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):";
173         $kiriwrite_lang{"en-GB"}{"usekiriwritelink"}    = "Start using Kiriwrite.";
175 my $query = new CGI;
177 my $language_selected = "";
178 my $http_query_confirm = $query->param('confirm');
179 my $http_query_installlanguage = $query->param('installlanguage');
181 if (!$http_query_installlanguage){
183         $language_selected = $default_language;
185 } else {
187         $language_selected = $http_query_installlanguage;
191 # Process the list of available languages.
193 my $language_list_name;
194 my @language_list_short;
195 my @language_list_long;
197 foreach my $language (keys %kiriwrite_lang){
199         $language_list_name = $kiriwrite_lang{$language}{"languagename"} . " (" . $language .  ")";
200         push(@language_list_short, $language);
201         push(@language_list_long, $language_list_name);
205 # The CSS Stylesheet to use.
207 my $cssstyle = "
209 a {
210         color: #FFFFFF;
213 body {
214         background-color: #408080;
215         color: #FFFFFF;
216         font-family: sans-serif;
217         font-size: 12px;
220 input {
221         background-color: #408080;
222         color: #FFFFFF;
223         border-color: #102020;
224         border-style: solid;
225         border-width: 1px;
226         padding: 3px;
230 select {
231         padding: 3px;
232         background-color: #408080;
233         color: #FFFFFF;
234         border-color: #102020;
235         border-style: solid;
236         border-width: 1px;
237         padding: 3px;
240 td,table {
241         padding: 5px;
242         border-spacing: 0px;
245 .languagebar {
246         background-color: #204040;
247         vertical-align: top;
250 .languagebarselect {
251         text-align: right;
252         background-color: #204040;
255 .tablecellheader {
256         background-color: #204040;
257         font-weight: bold;
260 .tabledata {
261         background-color: #357070;
264 .tablename {
266         background-color: #306060;
270 ";
273 #################################################################################
274 # Begin list of subroutines.                                                    #
275 #################################################################################
277 sub kiriwrite_variablecheck{
278 #################################################################################
279 # kiriwrite_variablecheck: Check to see if the data passed is valid.            #
280 #                                                                               #
281 # Usage:                                                                        #
282 #                                                                               #
283 # kiriwrite_variablecheck(variablename, type, option, noerror);                 #
284 #                                                                               #
285 # variablename  Specifies the variable to be checked.                           #
286 # type          Specifies what type the variable is.                            #
287 # option        Specifies the maximum/minimum length of the variable            #
288 #               (if minlength/maxlength is used) or if the filename should be   #
289 #               checked to see if it is blank.                                  #
290 # noerror       Specifies if Kiriwrite should return an error or not on         #
291 #               certain values.                                                 #
292 #################################################################################
294         # Get the values that were passed to the subroutine.
296         my ($variable_data, $variable_type, $variable_option, $variable_noerror) = @_;
298         if ($variable_type eq "numbers"){
300                 # Check for numbers and return an error if there is anything else than numebrs.
302                 my $variable_data_validated = $variable_data;   # Copy the variable_data to variable_data_validated.
303                 $variable_data_validated =~ tr/0-9//d;          # Take away all of the numbers and from the variable. 
304                                                                 # If it only contains numbers then it should be blank.
306                 if ($variable_data_validated eq ""){
307                         # The validated variable is blank. So continue to the end of this section where the return function should be.
308                 } else {
309                         # The variable is not blank, so check if the no error value is set
310                         # to 1 or not.
312                         if ($variable_noerror eq 1){
314                                 # The validated variable is not blank and the noerror
315                                 # value is set to 1. So return an value of 1.
316                                 # (meaning that the data is invalid).
318                                 return 1;
320                         } elsif ($variable_noerror eq 0) {
322                                 # The validated variable is not blank and the noerror
323                                 # value is set to 0.
325                                 kiriwrite_error("invalidvariable");
327                         } else {
329                                 # The variable noerror value is something else
330                                 # pther than 1 or 0. So return an error.
332                                 kiriwrite_error("invalidvariable");
334                         }
336                 }
338                 return 0;
340         } elsif ($variable_type eq "lettersnumbers"){
342                 # Check for letters and numbers and return an error if there is anything else other
343                 # than letters and numbers.
345                 my $variable_data_validated = $variable_data;   # Copy the variable_data to variable_data_validated
346                 $variable_data_validated =~ tr/a-zA-Z0-9.//d;
347                 $variable_data_validated =~ s/\s//g;
349                 if ($variable_data_validated eq ""){
350                         # The validated variable is blank. So continue to the end of this section where the return function should be.
351                 } else {
352                         # The variable is not blank, so check if the no error value is set
353                         # to 1 or not.
355                         if ($variable_noerror eq 1){
357                                 # The validated variable is not blank and the noerror
358                                 # value is set to 1. So return an value of 1.
359                                 # (meaning that the data is invalid).
361                                 return 1;
363                         } elsif ($variable_noerror eq 0) {
365                                 # The validated variable is not blank and the noerror
366                                 # value is set to 0.
368                                 kiriwrite_error("invalidvariable");
370                         } else {
372                                 # The variable noerror value is something else
373                                 # pther than 1 or 0. So return an error.
375                                 kiriwrite_error("invalidvariable");
377                         }
379                 }
381                 return 0;
383         } elsif ($variable_type eq "maxlength"){
384                 # Check for the length of the variable, return an error if it is longer than the length specified.
386                 # Check if the variable_data string is blank, if it is then set the variable_data_length
387                 # to '0'.
389                 my $variable_data_length = 0;
391                 if (!$variable_data){
393                         # Set variable_data_length to '0'.
394                         $variable_data_length = 0;
396                 } else {
398                         # Get the length of the variable recieved.
399                         $variable_data_length = length($variable_data);
401                 }
405                 if ($variable_data_length > $variable_option){
407                         # The variable length is longer than it should be so check if
408                         # the no error value is set 1.
410                         if ($variable_noerror eq 1){
412                                 # The no error value is set to 1, so return an
413                                 # value of 1 (meaning tha the variable is
414                                 # too long to be used).
416                                 return 1;
418                         } elsif ($variable_noerror eq 0){
420                                 # The no error value is set to 0, so return
421                                 # an error.
423                                 kiriwrite_error("variabletoolong");
425                         } else {
427                                 # The no error value is something else other
428                                 # than 0 or 1, so return an error.
430                                 kiriwrite_error("variabletoolong");
432                         }
434                 } else {
436                         # The variable length is exactly or shorter than specified, so continue to end of this section where
437                         # the return function should be.
439                 }
441                 return 0;
443         } elsif ($variable_type eq "datetime"){
444                 # Check if the date and time setting format is valid.
446                 if ($variable_data eq ""){
448                         if ($variable_noerror eq 1){
450                                 # The no error value is set to 1 so return
451                                 # a value of 1 (meaning that the date and
452                                 # time format was blank).
454                                 return 1;
456                         } elsif ($variable_noerror eq 0){
458                                 # The no error value is set to 1 so return
459                                 # an error.
461                                 kiriwrite_error("dateformatblank");
463                         } else {
465                                 # The no error value is something else other
466                                 # than 0 or 1, so return an error.
468                                 kiriwrite_error("invalidvariable");
470                         }
472                 }
474                 my $variable_data_validated = $variable_data;
475                 $variable_data_validated =~ tr|dDmMyYhms/():[ ]||d;
477                 if ($variable_data_validated eq ""){
479                         # The date and time format is valid. So
480                         # skip this bit.
482                 } else {
484                         # The validated data variable is not blank, meaning 
485                         # that it contains something else, so return an error
486                         # (or a value).
488                         if ($variable_noerror eq 1){
490                                 # The no error value is set to 1 so return
491                                 # an value of 2. (meaning that the date and
492                                 # time format was invalid).
494                                 return 2;
496                         } elsif ($variable_noerror eq 0){
498                                 # The no error value is set to 0 so return
499                                 # an error.
501                                 kiriwrite_error("dateformatinvalid");
503                         } else {
505                                 # The no error value is something else other
506                                 # than 0 or 1 so return an error.
508                                 kiriwrite_error("invalidvariable");
510                         }
512                 }
514                 return 0;
516         } elsif ($variable_type eq "directory"){
517                 # Check if the directory only contains letters and numbers and
518                 # return an error if anything else appears.
520                 my $variable_data_validated = $variable_data;
521                 $variable_data_validated =~ tr/a-zA-Z0-9//d;
523                 if ($variable_data eq ""){
525                         if ($variable_noerror eq 1){
527                                 # The no error value is set to 1 so return
528                                 # a value of 1 (meaning that the directory
529                                 # name was blank).
531                                 return 1;
533                         } elsif ($variable_noerror eq 0){
535                                 # The no error value is set to 1 so return
536                                 # an error.
538                                 kiriwrite_error("blankdirectory");
540                         } else {
542                                 # The no error value is something else other
543                                 # than 0 or 1, so return an error.
545                                 kiriwrite_error("invalidvariable");
547                         }
549                 }
551                 if ($variable_data_validated eq ""){
553                         # The validated data variable is blank, meaning that
554                         # it only contains letters and numbers.
556                 } else {
558                         # The validated data variable is not blank, meaning 
559                         # that it contains something else, so return an error
560                         # (or a value).
562                         if ($variable_noerror eq 1){
564                                 # The no error value is set to 1 so return
565                                 # an value of 2. (meaning that the directory
566                                 # name is invalid).
568                                 return 2;
570                         } elsif ($variable_noerror eq 0){
572                                 # The no error value is set to 0 so return
573                                 # an error.
575                                 kiriwrite_error("invaliddirectory");
577                         } else {
579                                 # The no error value is something else other
580                                 # than 0 or 1 so return an error.
582                                 kiriwrite_error("invalidvariable");
584                         }
586                 }
588                 return 0;
590         } elsif ($variable_type eq "language_filename"){
592                 # The variable type is a language filename type.
593                 # Check if the language file name is blank and 
594                 # if it is then return an error (or value).
596                 if ($variable_data eq ""){
598                         # The language filename is blank so check the
599                         # no error value and return an error (or value).
601                         if ($variable_noerror eq 1){
603                                 # Language filename is blank and the no error value
604                                 # is set as 1, so return a value of 1 (saying that
605                                 # the language filename is blank).
607                                 return 1;
609                         } elsif ($variable_noerror eq 0) {
611                                 # Language filename is blank and the no error value
612                                 # is not set as 1, so return an error.
614                                 kiriwrite_error("languagefilenameblank");
616                         } else {
618                                 # The noerror value is something else other
619                                 # than 0 or 1 so return an error.
621                                 kiriwrite_error("invalidvariable");
623                         }
625                 }
627                 # Set the following variables for later on.
629                 my $variable_data_length = 0;
630                 my $variable_data_char = "";
631                 my $variable_data_seek = 0;
633                 # Get the length of the language file name.
635                 $variable_data_length = length($variable_data);
637                 do {
639                         # Get a character from the language filename passed to this 
640                         # subroutine and the character the seek counter value is set
641                         # to.
643                         $variable_data_char = substr($variable_data, $variable_data_seek, 1);
645                         # Check if the language filename contains a forward slash or a dot, 
646                         # if the selected character is a forward slash then return an error
647                         # (or value).
649                         if ($variable_data_char eq "/" || $variable_data_char eq "."){
651                                 # The language filename contains a forward slash or
652                                 # a dot so depending on the no error value, return
653                                 # an error or a value.
655                                 if ($variable_noerror eq 1){
657                                         # Language filename contains a forward slash or a dot
658                                         # and the no error value has been set to 1, so return 
659                                         # an value of 2 (saying that the language file name is 
660                                         # invalid).
662                                         return 2;
664                                 } elsif ($variable_noerror eq 0) {
666                                         # Language filename contains a forward slash and the no
667                                         # error value has not been set to 1, so return an error.
669                                         kiriwrite_error("languagefilenameinvalid");
671                                 } else {
673                                         # The noerror value is something else other than
674                                         # 1 or 0 so return an error.
676                                         kiriwrite_error("invalidvariable");
678                                 }
680                         }
682                         # Increment the seek counter.
684                         $variable_data_seek++;
686                 } until ($variable_data_seek eq $variable_data_length);
688                 return 0;
690         } elsif ($variable_type eq "module"){
692                 # The variable type is a presentation module filename.
694                 # Check if the variable_data is blank and if it is
695                 # return an error.
697                 if ($variable_data eq ""){
699                         # The presentation module is blank so check if an error
700                         # value should be returned or a number should be
701                         # returned.
703                         if ($variable_noerror eq 1){
705                                 # Module name is blank and the no error value 
706                                 # is set to 1 so return a value of 2 (meaning 
707                                 # that the page filename is blank).
709                                 return 1;
711                         } elsif ($variable_noerror eq 0) {
713                                 # Module name contains is blank and the no error 
714                                 # value is set to 0 so return an error.
716                                 kiriwrite_critical("moduleblank");
718                         } else {
720                                 # The no error value is something else other
721                                 # than 0 or 1 so return an error.
723                                 kiriwrite_critical("invalidvalue");
725                         }
727                 } else {
729                 }
731                 my $variable_data_validated = $variable_data;
732                 $variable_data_validated =~ tr/a-zA-Z0-9//d;
734                 if ($variable_data_validated eq ""){
736                 } else {
738                         if ($variable_noerror eq 1){
740                                 # Module name contains invalid characters and
741                                 # the no error value is set to 1 so return a 
742                                 # value of 2 (meaning that the page filename
743                                 # is invalid).
745                                 return 2;
747                         } elsif ($variable_noerror eq 0) {
749                                 # Module name contains invalid characters and
750                                 # the no error value is set to 0 so return an
751                                 # error.
753                                 kiriwrite_critical("moduleinvalid");
755                         } else {
757                                 # The no error value is something else other
758                                 # than 0 or 1 so return an error.
760                                 kiriwrite_error("invalidvalue");
762                         }
764                 }
766                 return 0;
768         } elsif ($variable_type eq "serverprotocol"){
770                 # Check if the server protocol is TCP or UDP and return
771                 # an error if it isn't.
773                 if ($variable_data ne "tcp" && $variable_data ne "udp"){
775                         # The protocol given is not valid, check if the no
776                         # error value is set to 1 and return an error if it isn't.
778                         if ($variable_noerror eq 1){
780                                 # The no error value has been set to 1, so return a
781                                 # value of 1 (meaning that the server protocol is
782                                 # invalid).
784                                 return 1;
786                         } elsif ($variable_noerror eq 0){
788                                 # The no error value has been set to 0, so return
789                                 # an error.
791                                 kiriwrite_error("serverprotocolinvalid");
793                         } else {
795                                 # The no error value is something else other than 0
796                                 # or 1, so return an error.
798                                 kiriwrite_error("invalidoption");
800                         }
802                 }
804                 return 0;
806         } elsif ($variable_type eq "port"){
808                 # Check if the port number given is less than 0 or more than 65535
809                 # and return an error if it is.
811                 if ($variable_data < 0 || $variable_data > 65535){
813                         # The port number is less than 0 and more than 65535 so
814                         # check if the no error value is set to 1 and return an
815                         # error if it isn't.
817                         if ($variable_noerror eq 1){
819                                 # The no error value has been set to 1, so return a
820                                 # value of 1 (meaning that the port number is invalid).
822                                 return 1;
824                         } elsif ($variable_noerror eq 0){
826                                 # The no error value has been set to 0, so return
827                                 # an error.
829                                 kiriwrite_error("serverportnumberinvalid");
831                         } else {
833                                 # The no error value is something else other than 0
834                                 # or 1, so return an error.
836                                 kiriwrite_error("invalidoption");
838                         }
840                 }
842                 return 0;
844         }
846         # Another type than the valid ones above has been specified so return an error specifying an invalid option.
847         kiriwrite_error("invalidoption");
851 sub kiriwrite_error{
852 #################################################################################
853 # kiriwrite_error: Subroutine for processing error messages.                    #
854 #                                                                               #
855 # Usage:                                                                        #
856 #                                                                               #
857 # kiriwrite_error(errortype);                                                   #
858 #                                                                               #
859 # errortype     Specifies the error type to use.                                #
860 #################################################################################
862         my $error_type = shift;
864         # Load the list of error messages.
866         my (%kiriwrite_error, $kiriwrite_error);
868         %kiriwrite_error = (
870                 # Generic Error Messages
872                 "generic"                       => $kiriwrite_lang{$language_selected}{generic},
874                 "invalidvariable"               => $kiriwrite_lang{$language_selected}{invalidvariable},
875                 "invalidvalue"                  => $kiriwrite_lang{$language_selected}{invalidvalue},
876                 "invalidoption"                 => $kiriwrite_lang{$language_selected}{invalidoption},
877                 "variabletoolong"               => $kiriwrite_lang{$language_selected}{variabletoolong},
878                 "blankdirectory"                => $kiriwrite_lang{$language_selected}{blankdirectory},
879                 "invaliddirectory"              => $kiriwrite_lang{$language_selected}{invaliddirectory},
880                 "moduleblank"                   => $kiriwrite_lang{$language_selected}{moduleblank},
881                 "moduleinvalid"                 => $kiriwrite_lang{$language_selected}{moduleinvalid},
883                 # Specific Error Messages
885                 "dbdirectorytoolong"            => $kiriwrite_lang{$language_selected}{dbdirectorytoolong},
886                 "outputdirectorytoolong"        => $kiriwrite_lang{$language_selected}{outputdirectorytoolong},
887                 "imagesuripathtoolong"          => $kiriwrite_lang{$language_selected}{imagesuripathtoolong},
888                 "dateformattoolong"             => $kiriwrite_lang{$language_selected}{dateformattoolong},
889                 "customdateformattoolong"       => $kiriwrite_lang{$language_selected}{customdateformattoolong},
890                 "languagefilenametoolong"       => $kiriwrite_lang{$language_selected}{languagefilenametoolong},
891                 
892                 "dateformatblank"               => $kiriwrite_lang{$language_selected}{dateformatblank},
893                 "dateformatinvalid"             => $kiriwrite_lang{$language_selected}{dateformatinvalid},
894                 "languagefilenameinvalid"       => $kiriwrite_lang{$language_selected}{languagefilenameinvalid},
895                 
896                 "dbdirectoryblank"              => $kiriwrite_lang{$language_selected}{dbdirectoryblank},
897                 "dbdirectoryinvalid"            => $kiriwrite_lang{$language_selected}{dbdirectoryinvalid},
899                 "outputdirectoryblank"          => $kiriwrite_lang{$language_selected}{outputdirectoryblank},
900                 "outputdirectoryinvalid"        => $kiriwrite_lang{$language_selected}{outputdirectoryinvalid},
902                 "presmoduleblank"               => $kiriwrite_lang{$language_selected}{presmoduleblank},
903                 "presmoduleinvalid"             => $kiriwrite_lang{$language_selected}{presmoduleinvalid},
905                 "dbmoduleblank"                 => $kiriwrite_lang{$language_selected}{dbmoduleblank},
906                 "dbmoduleinvalid"               => $kiriwrite_lang{$language_selected}{dbmoduleinvalid},
908                 "presmodulemissing"             => $kiriwrite_lang{$language_selected}{presmodulemissing},
909                 "dbmodulemissing"               => $kiriwrite_lang{$language_selected}{dbmodulemissing},
910                 "languagefilemissing"           => $kiriwrite_lang{$language_selected}{languagefilemissing},
912                 "servernametoolong"             => $kiriwrite_lang{$language_selected}{servernametoolong},
913                 "servernameinvalid"             => $kiriwrite_lang{$language_selected}{servernameinvalid},
914                 "serverportnumbertoolong"       => $kiriwrite_lang{$language_selected}{serverportnumbertoolong},
915                 "serverportnumberinvalidcharacters"     => $kiriwrite_lang{$language_selected}{serverportnumberinvalidcharacters},
916                 "serverportnumberinvalid"       => $kiriwrite_lang{$language_selected}{serverportnumberinvalid},
917                 "serverprotocolnametoolong"     => $kiriwrite_lang{$language_selected}{serverprotocolnametoolong},
918                 "serverprotocolinvalid"         => $kiriwrite_lang{$language_selected}{serverprotocolinvalid},
919                 "serverdatabasenametoolong"     => $kiriwrite_lang{$language_selected}{serverdatabasenametoolong},
920                 "serverdatabasenameinvalid"     => $kiriwrite_lang{$language_selected}{serverdatabasenameinvalid},
921                 "serverdatabaseusernametoolong" => $kiriwrite_lang{$language_selected}{serverdatabaseusernametoolong},
922                 "serverdatabaseusernameinvalid" => $kiriwrite_lang{$language_selected}{serverdatabaseusernameinvalid},
923                 "serverdatabasepasswordtoolong" => $kiriwrite_lang{$language_selected}{serverdatabasepasswordtoolong},
924                 "serverdatabasetableprefixtoolong"      => $kiriwrite_lang{$language_selected}{serverdatabasetableprefixtoolong},
925                 "serverdatabasetableprefixinvalid"      => $kiriwrite_lang{$language_selected}{serverdatabasetableprefixinvalid},
927                 "removeinstallscripttoolong"    => $kiriwrite_lang{$language_selected}{removeinstallscripttoolong},
928                 "cannotwriteconfigurationindirectory"   => $kiriwrite_lang{$language_selected}{cannotwriteconfigurationindirectory},
929                 "configurationfilereadpermissionsinvalid"       => $kiriwrite_lang{$language_selected}{configurationfilereadpermissionsinvalid},
930                 "configurationfilewritepermissionsinvalid"      => $kiriwrite_lang{$language_selected}{configurationfilewritepermissionsinvalid},
932         );
934         # Check if the specified error is blank and if it is
935         # use the generic error messsage.
937         if (!$kiriwrite_error{$error_type}){
938                 $error_type = "generic";
939         }
941         print header();
943         print start_html({ -title => $kiriwrite_lang{$language_selected}{error}, -style => { -code => $cssstyle }});
945         print h2($kiriwrite_lang{$language_selected}{error});
947         print $kiriwrite_error{$error_type};
948         print br();
949         print $kiriwrite_lang{$language_selected}{errormessagetext};
951         print end_html();
953         exit;
957 sub kiriwrite_writeconfig{
958 #################################################################################
959 # kiriwrite_writeconfig: Writes a configuration file.                           #
960 #                                                                               #
961 # Usage:                                                                        #
962 #                                                                               #
963 # kiriwrite_writeconfig();                                                      #
964 #################################################################################
966         my ($passedsettings) = @_;
968         # Open the configuration file for writing.
970         open (my $configfile, "> " . "kiriwrite.xml");
972         print $configfile "<?xml version=\"1.0\"?>
974 <kiriwrite-config>
975 <!-- This file was automatically generated by Kiriwrite, please feel free to edit to your own needs. -->
976         <settings>
977                 <directories>
978                         <database>" . $passedsettings->{DatabaseDirectory} . "</database>
979                         <output>" . $passedsettings->{OutputDirectory} . "</output>
980                         <images>" . $passedsettings->{ImagesURIPath} . "</images>
981                 </directories>
982                 <language>
983                         <lang>" . $passedsettings->{Language} . "</lang>
984                 </language>
985                 <system>
986                         <presentation>" . $passedsettings->{PresentationModule} . "</presentation>
987                         <database>" . $passedsettings->{DatabaseModule} . "</database>
988                         <datetime>" . $passedsettings->{DateFormat} . "</datetime>
989                 </system>
990                 <database>
991                         <server>" . $passedsettings->{DatabaseServer} . "</server>
992                         <port>" . $passedsettings->{DatabasePort} . "</port>
993                         <protocol>" . $passedsettings->{DatabaseProtocol} . "</protocol>
994                         <database>" . $passedsettings->{DatabaseName} . "</database>
995                         <username>" . $passedsettings->{DatabaseUsername} . "</username>
996                         <password>" . $passedsettings->{DatabasePassword} . "</password>
997                         <prefix>" . $passedsettings->{DatabaseTablePrefix} . "</prefix>
998                 </database>
999         </settings>
1000 </kiriwrite-config>
1001         ";
1003         close ($configfile);
1007 #################################################################################
1008 # End list of subroutines.                                                      #
1009 #################################################################################
1011 if (!$http_query_confirm){
1013         $http_query_confirm = 0;
1017 if ($http_query_confirm eq 1){
1019         # The confirm value has been given so get the data from the query.
1021         my $http_query_dbdirectory              = $query->param('dbdirectory');
1022         my $http_query_outputdirectory          = $query->param('outputdirectory');
1023         my $http_query_imagesuripath            = $query->param('imagesuripath');
1025         my $http_query_dateformat               = $query->param('dateformat');
1026         my $http_query_customdateformat         = $query->param('customdateformat');
1028         my $http_query_language                 = $query->param('language');
1030         my $http_query_presmodule               = $query->param('presmodule');
1031         my $http_query_dbmodule                 = $query->param('dbmodule');
1033         my $http_query_databaseserver           = $query->param('databaseserver');
1034         my $http_query_databaseport             = $query->param('databaseport');
1035         my $http_query_databaseprotocol         = $query->param('databaseprotocol');
1036         my $http_query_databasename             = $query->param('databasename');
1037         my $http_query_databaseusername         = $query->param('databaseusername');
1038         my $http_query_databasepassword         = $query->param('databasepassword');
1039         my $http_query_databasetableprefix      = $query->param('databasetableprefix');
1040         my $http_query_removeinstallscript      = $query->param('removeinstallscript');
1042         # Check the length of the variables.
1044         my $kiriwrite_dbdirectory_length_check          = kiriwrite_variablecheck($http_query_dbdirectory, "maxlength", 64, 1);
1045         my $kiriwrite_outputdirectory_length_check      = kiriwrite_variablecheck($http_query_outputdirectory, "maxlength", 64, 1);
1046         my $kiriwrite_imagesuripath_length_check        = kiriwrite_variablecheck($http_query_imagesuripath, "maxlength", 512, 1);
1047         my $kiriwrite_dateformat_length_check           = kiriwrite_variablecheck($http_query_dateformat, "maxlength", 32, 1);
1048         my $kiriwrite_customdateformat_length_check     = kiriwrite_variablecheck($http_query_customdateformat, "maxlength", 32, 1);
1049         my $kiriwrite_language_length_check             = kiriwrite_variablecheck($http_query_language, "maxlength", 16, 1);
1051         # Check if any errors occured while checking the
1052         # length of the variables.
1054         if ($kiriwrite_dbdirectory_length_check eq 1){
1056                 # The database directory given is too long
1057                 # so return an error.
1059                 kiriwrite_error("dbdirectorytoolong");
1061         }
1063         if ($kiriwrite_outputdirectory_length_check eq 1){
1065                 # The output directory given is too long
1066                 # so return an error.
1068                 kiriwrite_error("outputdirectorytoolong");
1070         }
1072         if ($kiriwrite_imagesuripath_length_check eq 1){
1074                 # The images URI path given is too long
1075                 # so return an error.
1077                 kiriwrite_error("imagesuripathtoolong");
1079         }
1081         if ($kiriwrite_dateformat_length_check eq 1){
1083                 # The date format given is too long
1084                 # so return an error.
1086                 kiriwrite_error("dateformattoolong");
1088         }
1090         if ($kiriwrite_customdateformat_length_check eq 1){
1092                 # The date format given is too long
1093                 # so return an error.
1095                 kiriwrite_error("customdateformattoolong");
1097         }
1099         if ($kiriwrite_language_length_check eq 1){
1101                 # The language filename given is too long
1102                 # so return an error.
1104                 kiriwrite_error("languagefilenametoolong");
1106         }
1108         # Check if the custom date and time setting has anything
1109         # set and if it doesn't then use the predefined one set.
1111         my $finaldateformat = "";
1113         if ($http_query_customdateformat ne ""){
1115                 $finaldateformat = $http_query_customdateformat;
1117         } else {
1119                 $finaldateformat = $http_query_dateformat;
1121         }
1123         my $kiriwrite_datetime_check            = kiriwrite_variablecheck($finaldateformat, "datetime", 0, 1);
1125         if ($kiriwrite_datetime_check eq 1){
1127                 # The date and time format is blank so return
1128                 # an error.
1130                 kiriwrite_error("dateformatblank");
1132         } elsif ($kiriwrite_datetime_check eq 2){
1134                 # The date and time format is invalid so
1135                 # return an error.
1137                 kiriwrite_error("dateformatinvalid");
1139         }
1141         # Check if the language filename given is valid.
1143         my $kiriwrite_language_languagefilename_check = kiriwrite_variablecheck($http_query_language, "language_filename", "", 1);
1145         if ($kiriwrite_language_languagefilename_check eq 1) {
1147                 # The language filename given is blank so
1148                 # return an error.
1150                 kiriwrite_error("languagefilenameblank");
1152         } elsif ($kiriwrite_language_languagefilename_check eq 2){
1154                 # The language filename given is invalid so
1155                 # return an error.
1157                 kiriwrite_error("languagefilenameinvalid");
1159         }
1161         # Check if the directory names only contain letters and numbers and
1162         # return a specific error if they don't.
1164         my $kiriwrite_dbdirectory_check         = kiriwrite_variablecheck($http_query_dbdirectory, "directory", 0, 1);
1165         my $kiriwrite_outputdirectory_check     = kiriwrite_variablecheck($http_query_outputdirectory, "directory", 0, 1);
1167         if ($kiriwrite_dbdirectory_check eq 1){
1169                 # The database directory name is blank, so return
1170                 # an error.
1172                 kiriwrite_error("dbdirectoryblank");
1174         } elsif ($kiriwrite_dbdirectory_check eq 2){
1176                 # The database directory name is invalid, so return
1177                 # an error.
1179                 kiriwrite_error("dbdirectoryinvalid");
1181         }
1183         if ($kiriwrite_outputdirectory_check eq 1){
1185                 # The output directory name is blank, so return
1186                 # an error.
1188                 kiriwrite_error("outputdirectoryblank");
1190         } elsif ($kiriwrite_outputdirectory_check eq 2){
1192                 # The output directory name is invalid, so return
1193                 # an error.
1195                 kiriwrite_error("outputdirectoryinvalid");
1197         }
1199         if ($kiriwrite_dbdirectory_check eq 1){
1201                 # The database directory name is blank, so return
1202                 # an error.
1204                 kiriwrite_error("dbdirectoryblank");
1206         } elsif ($kiriwrite_dbdirectory_check eq 2){
1208                 # The database directory name is invalid, so return
1209                 # an error.
1211                 kiriwrite_error("dbdirectoryinvalid");
1213         }
1215         if ($kiriwrite_outputdirectory_check eq 1){
1217                 # The output directory name is blank, so return
1218                 # an error.
1220                 kiriwrite_error("outputdirectoryblank");
1222         } elsif ($kiriwrite_outputdirectory_check eq 2){
1224                 # The output directory name is invalid, so return
1225                 # an error.
1227                 kiriwrite_error("outputdirectoryinvalid");
1229         }
1231         # Check the module names to see if they're valid.
1233         my $kiriwrite_presmodule_modulename_check       = kiriwrite_variablecheck($http_query_presmodule, "module", 0, 1);
1234         my $kiriwrite_dbmodule_modulename_check         = kiriwrite_variablecheck($http_query_dbmodule, "module", 0, 1);
1236         if ($kiriwrite_presmodule_modulename_check eq 1){
1238                 # The presentation module name is blank, so return
1239                 # an error.
1241                 kiriwrite_error("presmoduleblank");
1243         }
1245         if ($kiriwrite_presmodule_modulename_check eq 2){
1247                 # The presentation module name is invalid, so return
1248                 # an error.
1250                 kiriwrite_error("presmoduleinvalid");
1252         }
1254         if ($kiriwrite_dbmodule_modulename_check eq 1){
1256                 # The database module name is blank, so return
1257                 # an error.
1259                 kiriwrite_error("dbmoduleblank");
1261         }
1263         if ($kiriwrite_dbmodule_modulename_check eq 2){
1265                 # The database module name is invalid, so return
1266                 # an error.
1268                 kiriwrite_error("dbmoduleinvalid");
1270         }
1272         # Check if the database module, presentation module and
1273         # language file exists.
1275         if (!-e "Modules/Presentation/" . $http_query_presmodule . ".pm"){
1277                 # The presentation module is missing so return an
1278                 # error.
1280                 kiriwrite_error("presmodulemissing");
1282         }
1284         if (!-e "Modules/Database/" . $http_query_dbmodule . ".pm"){
1286                 # The database module is missing so return an
1287                 # error.
1289                 kiriwrite_error("dbmodulemissing");
1291         }
1293         if (!-e "lang/" . $http_query_language . ".xml"){
1295                 # The language file is missing so return an
1296                 # error.
1298                 kiriwrite_error("languagefilenamemissing");
1300         }
1302         # Check the database server settings.
1304         my $kiriwrite_databaseserver_length_check               = kiriwrite_variablecheck($http_query_databaseserver, "maxlength", 128, 1);
1305         my $kiriwrite_databaseserver_lettersnumbers_check       = kiriwrite_variablecheck($http_query_databaseserver, "lettersnumbers", 0, 1);
1306         my $kiriwrite_databaseport_length_check                 = kiriwrite_variablecheck($http_query_databaseport, "maxlength", 5, 1);
1307         my $kiriwrite_databaseport_numbers_check                = kiriwrite_variablecheck($http_query_databaseport, "numbers", 0, 1);
1308         my $kiriwrite_databaseport_port_check                   = kiriwrite_variablecheck($http_query_databaseport, "port", 0, 1);
1309         my $kiriwrite_databaseprotocol_length_check             = kiriwrite_variablecheck($http_query_databaseprotocol, "maxlength", 5, 1);
1310         my $kiriwrite_databaseprotocol_protocol_check           = kiriwrite_variablecheck($http_query_databaseprotocol, "serverprotocol", 0, 1);
1311         my $kiriwrite_databasename_length_check                 = kiriwrite_variablecheck($http_query_databasename, "maxlength", 32, 1);
1312         my $kiriwrite_databasename_lettersnumbers_check         = kiriwrite_variablecheck($http_query_databasename, "lettersnumbers", 0, 1);
1313         my $kiriwrite_databaseusername_length_check             = kiriwrite_variablecheck($http_query_databaseusername, "maxlength", 16, 1);
1314         my $kiriwrite_databaseusername_lettersnumbers_check     = kiriwrite_variablecheck($http_query_databaseusername, "lettersnumbers", 0, 1);
1315         my $kiriwrite_databasepassword_length_check             = kiriwrite_variablecheck($http_query_databasepassword, "maxlength", 64, 1);
1316         my $kiriwrite_databasetableprefix_length_check          = kiriwrite_variablecheck($http_query_databasetableprefix, "maxlength", 16, 1);
1317         my $kiriwrite_databasetableprefix_lettersnumbers_check  = kiriwrite_variablecheck($http_query_databasetableprefix, "lettersnumbers", 0, 1);
1319         if ($kiriwrite_databaseserver_length_check eq 1){
1321                 # The length of the database server name is too long so
1322                 # return an error.
1324                 kiriwrite_error("servernametoolong");
1326         }
1328         if ($kiriwrite_databaseserver_lettersnumbers_check eq 1){
1330                 # The database server name contains characters other
1331                 # than letters and numbers, so return an error.
1333                 kiriwrite_error("servernameinvalid");
1335         }
1337         if ($kiriwrite_databaseport_length_check eq 1){
1339                 # The database port number length is too long so return
1340                 # an error.
1342                 kiriwrite_error("serverportnumbertoolong");
1344         }
1346         if ($kiriwrite_databaseport_numbers_check eq 1){
1348                 # The database port number contains characters other
1349                 # than numbers so return an error.
1351                 kiriwrite_error("serverportnumberinvalidcharacters");
1353         }
1355         if ($kiriwrite_databaseport_port_check eq 1){
1357                 # The database port number given is invalid so return
1358                 # an error.
1360                 kiriwrite_error("serverportnumberinvalid");
1362         }
1364         if ($kiriwrite_databaseprotocol_length_check eq 1){
1366                 # The database protocol name given is too long so
1367                 # return an error.
1369                 kiriwrite_error("serverprotocolnametoolong");
1371         }
1373         if ($kiriwrite_databaseprotocol_protocol_check eq 1){
1375                 # The server protcol given is invalid so return
1376                 # an error.
1378                 kiriwrite_error("serverprotocolinvalid");
1380         }
1382         if ($kiriwrite_databasename_length_check eq 1){
1384                 # The SQL database name is too long so return
1385                 # an error.
1387                 kiriwrite_error("serverdatabasenametoolong");
1389         }
1391         if ($kiriwrite_databasename_lettersnumbers_check eq 1){
1393                 # The database name contains invalid characters
1394                 # so return an error.
1396                 kiriwrite_error("serverdatabasenameinvalid");
1398         }
1400         if ($kiriwrite_databaseusername_length_check eq 1){
1402                 # The database username given is too long so
1403                 # return an error.
1405                 kiriwrite_error("serverdatabaseusernametoolong");
1407         }
1409         if ($kiriwrite_databaseusername_lettersnumbers_check eq 1){
1411                 # The database username contains invalid characters
1412                 # so return an error.
1414                 kiriwrite_error("serverdatabaseusernameinvalid");
1416         }
1418         if ($kiriwrite_databasepassword_length_check eq 1){
1420                 # The database password given is too long so return
1421                 # an error.
1423                 kiriwrite_error("serverdatabasepasswordtoolong");
1425         }
1427         if ($kiriwrite_databasetableprefix_length_check eq 1){
1429                 # The database table prefix given is too long so
1430                 # return an error.
1432                 kiriwrite_error("serverdatabasetableprefixtoolong");
1434         }
1436         if ($kiriwrite_databasetableprefix_lettersnumbers_check eq 1){
1438                 # The database table prefix given contains invalid
1439                 # characters so return an error.
1441                 kiriwrite_error("serverdatabasetableprefixinvalid");
1443         }
1445         # Check the length of value of the checkboxes.
1447         my $kiriwrite_removeinstallscript_length_check  = kiriwrite_variablecheck($http_query_removeinstallscript, "maxlength", 2, 1);
1449         if ($kiriwrite_removeinstallscript_length_check eq 1){
1451                 # The remove install script value is too long
1452                 # so return an error.
1454                 kiriwrite_error("removeinstallscripttoolong");
1456         }
1458         # Check if there is write permissions for the directory.
1460         if (!-w '.'){
1462                 # No write permissions for the directory the
1463                 # script is running from so return an error.
1465                 kiriwrite_error("cannotwriteconfigurationindirectory");
1467         }
1469         # Check if the configuration file already exists.
1471         if (-e 'kiriwrite.xml'){
1473                 # Check if the configuration file has read permissions.
1475                 if (!-r 'kiriwrite.xml'){
1477                         # The configuration file has invalid read permissions
1478                         # set so return an error.
1480                         kiriwrite("configurationfilereadpermissionsinvalid");
1482                 }
1484                 # Check if the configuration file has write permissions.
1486                 if (!-w 'kiriwrite.xml'){
1488                         # The configuration file has invalid write permissions
1489                         # set so return an error.
1491                         kiriwrite("configurationfilewritepermissionsinvalid");
1493                 }
1495         }
1497         # Write the new configuration file.
1499         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 });
1501         my $installscriptmessage        = "";
1503         # Check if the installation script should be deleted.
1505         if (!$http_query_removeinstallscript){
1507                 $http_query_removeinstallscript = "off";
1509         }
1511         if ($http_query_removeinstallscript eq "on"){
1513                 if (unlink("install.cgi")){
1515                         $installscriptmessage = $kiriwrite_lang{$language_selected}{installscriptremoved};
1517                 } else {
1519                         $installscriptmessage = $kiriwrite_lang{$language_selected}{cannotremovescript};
1520                         $installscriptmessage =~ s/%s/$!/g;
1522                         # FINISH THIS! >O
1524                         #"Unable to remove the installer script: " . $! . " The installer script will have to be deleted manually.";
1526                 }
1528         }
1530         print header();
1532         print start_html({ -title => $kiriwrite_lang{$language_selected}{installertitle}, -style => { -code => $cssstyle }});
1533         print h2($kiriwrite_lang{$language_selected}{installertitle});
1534         print $kiriwrite_lang{$language_selected}{installedmessage};
1536         if ($installscriptmessage){
1538                 print br();
1539                 print br();
1540                 print $installscriptmessage;
1542         }
1544         print br();
1545         print br();
1546         print $kiriwrite_lang{$language_selected}{usekiriwritetext};
1547         print br();
1548         print br();
1549         print a({-href=>'kiriwrite.cgi'}, $kiriwrite_lang{$language_selected}{usekiriwritelink});
1551         exit;
1555 # Create a list of common date and time formats.
1557 my @datetime_formats = [ 
1558         'DD/MM/YY (hh:mm:ss)', 'DD/MM/YY hh:mm:ss', 'D/M/Y (hh:mm:ss)',
1559         'D/M/Y hh:mm:ss', 'D/M/YY (hh:mm:ss)', 'D/M/YY hh:mm:ss',
1560         'DD/MM (hh:mm:ss)', 'D/M (hh:mm:ss)', 'DD/MM hh:mm:ss', 
1561         'D/M hh:mm:ss', 'DD/MM hh:mm', 'D/M hh:mm',
1562         'DD/MM/YY', 'D/M/Y', 'DD/MM',
1564         'YY-MM-DD (hh:mm:ss)', 'YY-MM-DD hh:mm:ss', 'Y-M-D (hh:mm:ss)',
1565         'Y-M-D hh:mm:ss', 'M-D (hh:mm:ss)', 'M-D hh:mm:ss',
1566         'YY-MM-DD', 'MM-DD' 
1567 ];
1569 # Create the list of tests to do.
1571 my ($test_list, %test_list);
1572 my %dependency_results;
1573 my %database_results;
1574 my %file_results;
1575 my $test;
1576 my $date;
1578 my $dependency_error = 0;
1579 my $database_onemodule = 0;
1580 my $database_error = 0;
1581 my $file_error = 0;
1583 my $language_name;
1584 my $language_xml_data;
1585 my $language_file_friendly;
1587 my $presentation_file_friendly;
1589 # Check to see if the needed Perl modules are installed.
1591 $test_list{CheckDBI}{Name}              = "DBI";
1592 $test_list{CheckDBI}{Type}              = "dependency";
1593 $test_list{CheckDBI}{Code}              = "DBI";
1595 $test_list{CheckXMLSimple}{Name}        = "XML::Simple";
1596 $test_list{CheckXMLSimple}{Type}        = "dependency";
1597 $test_list{CheckXMLSimple}{Code}        = "XML::Simple";
1599 $test_list{CheckTieHash}{Name}          = "Tie::IxHash";
1600 $test_list{CheckTieHash}{Type}          = "dependency";
1601 $test_list{CheckTieHash}{Code}          = "Tie::IxHash";
1603 $test_list{Encode}{Name}                = "Encode";
1604 $test_list{Encode}{Type}                = "dependency";
1605 $test_list{Encode}{Code}                = "Encode";
1607 $test_list{DBDmysql}{Name}              = "DBD::mysql";
1608 $test_list{DBDmysql}{Type}              = "database";
1609 $test_list{DBDmysql}{Code}              = "DBD::mysql";
1611 $test_list{DBDSQLite}{Name}             = "DBD::SQLite";
1612 $test_list{DBDSQLite}{Type}             = "database";
1613 $test_list{DBDSQLite}{Code}             = "DBD::SQLite";
1615 # Check the file and directory permissions to see if they are correct.
1617 $test_list{MainDirectory}{Name}         = "Kiriwrite Directory (.)";
1618 $test_list{MainDirectory}{Type}         = "file";
1619 $test_list{MainDirectory}{Code}         = ".";
1620 $test_list{MainDirectory}{Writeable}    = "1";
1622 $test_list{LanguageDirectory}{Name}             = "Language Directory (lang)";
1623 $test_list{LanguageDirectory}{Type}             = "file";
1624 $test_list{LanguageDirectory}{Code}             = "lang";
1625 $test_list{LanguageDirectory}{Writeable}        = "0";
1627 $test_list{ModulesDirectory}{Name}              = "Modules Directory (Modules)";
1628 $test_list{ModulesDirectory}{Type}              = "file";
1629 $test_list{ModulesDirectory}{Code}              = "Modules";
1630 $test_list{ModulesDirectory}{Writeable}         = "0";
1632 $test_list{DBModulesDirectory}{Name}            = "Database Modules Directory (Modules/Database)";
1633 $test_list{DBModulesDirectory}{Type}            = "file";
1634 $test_list{DBModulesDirectory}{Code}            = "Modules/Database";
1635 $test_list{DBModulesDirectory}{Writeable}       = "0";
1637 $test_list{PresModulesDirectory}{Name}          = "Presentation Modules Directory (Modules/Presentation)";
1638 $test_list{PresModulesDirectory}{Type}          = "file";
1639 $test_list{PresModulesDirectory}{Code}          = "Modules/Presentation";
1640 $test_list{PresModulesDirectory}{Writeable}     = "0";
1642 # Preform those tests.
1644 foreach $test (keys %test_list){
1646         # Check the type of test.
1648         if ($test_list{$test}{Type} eq "dependency"){
1650                 if (eval "require " . $test_list{$test}{Code}){
1652                         # The module exists and is working correctly.
1654                         $dependency_results{$test_list{$test}{Name}}{result}    = $kiriwrite_lang{$language_selected}{testpass};
1656                 } else {
1658                         # The module does not exist or has an error.
1660                         $dependency_error = 1;
1661                         $dependency_results{$test_list{$test}{Name}}{result}    = $kiriwrite_lang{$language_selected}{testfail};
1663                 }
1665         } elsif ($test_list{$test}{Type} eq "database"){
1667                 if (eval "require " . $test_list{$test}{Code}){
1669                         # The module exists and it is working correctly.
1671                         $database_results{$test_list{$test}{Name}}{result}      = $kiriwrite_lang{$language_selected}{testpass};
1672                         $database_onemodule = 1;
1674                 } else {
1676                         # The module does not exist or has an error.
1678                         $database_error = 1;
1679                         $database_results{$test_list{$test}{Name}}{result}      = $kiriwrite_lang{$language_selected}{testfail};
1681                 }
1683         } elsif ($test_list{$test}{Type} eq "file"){
1685                 if (-e $test_list{$test}{Code}){
1687                         # The filename given does exist.
1689                 } else {
1691                         # the filename given does not exist.
1693                         $file_error = 1;
1694                         $file_results{$test_list{$test}{Name}}{result}  = $kiriwrite_lang{$language_selected}{errormessage} . $kiriwrite_lang{$language_selected}{doesnotexist};
1696                 }       
1698                 # Test to see if the filename given has read
1699                 # permissions.
1701                 if (-r $test_list{$test}{Code}){
1703                         # The filename given has valid permissions set.
1705                         $file_results{$test_list{$test}{Name}}{result}  = $kiriwrite_lang{$language_selected}{testpass};
1707                 } else {
1709                         # The filename given has invalid permissions set.
1711                         $file_error = 1;
1712                         $file_results{$test_list{$test}{Name}}{result} = $kiriwrite_lang{$language_selected}{errormessage} . $kiriwrite_lang{$language_selected}{invalidpermissionsset};
1714                 }
1716                 if ($test_list{$test}{Writeable} eq 1){
1718                         # Test to see if the filename given has write
1719                         # permissions.
1721                         if (-w $test_list{$test}{Code}){
1723                                 # The filename given has valid permissions set.
1725                                 $file_results{$test_list{$test}{Name}}{result}  = $kiriwrite_lang{$language_selected}{testpass};
1727                         } else {
1729                                 # The filename given has invalid permissions set.
1731                                 $file_error = 1;
1732                                 $file_results{$test_list{$test}{Name}}{result}  = $kiriwrite_lang{$language_selected}{errormessage} . $kiriwrite_lang{$language_selected}{invalidpermissionsset};
1734                         }
1736                 }
1738         }
1742 # Print the header.
1744 print header();
1746 # Print the page for installing Kiriwrite.
1748 print start_html( -title=> $kiriwrite_lang{$language_selected}{installertitle}, -style => { -code => $cssstyle });
1750 print start_table( { -width=> "100%" } );
1751 print start_Tr();
1752 print start_td({ -class => "languagebar" });
1753 print $kiriwrite_lang{$language_selected}{installertitle};
1754 print end_td();
1755 print start_td({ -class => "languagebarselect" });
1756 print start_form("POST", "install.cgi");
1758 # This is a bodge for the language list.
1760 my $language_name_short;
1761 my $language_list_seek = 0;
1763 print "<select name=\"installlanguage\">";
1765 foreach $language_name_short (@language_list_short){
1767         print "<option value=\"" . $language_name_short . "\">" . $language_list_long[$language_list_seek] . "</option>";
1768         $language_list_seek++;
1772 print "</select> ";
1773 print submit('Switch');
1775 print end_form;
1776 print end_td();
1777 print end_Tr();
1778 print end_table();
1780 print h2($kiriwrite_lang{$language_selected}{installertitle});
1782 print $kiriwrite_lang{$language_selected}{installertext};
1784 print h3($kiriwrite_lang{$language_selected}{dependencytitle});
1785 print h4($kiriwrite_lang{$language_selected}{requiredmodules});
1786 print $kiriwrite_lang{$language_selected}{perlmodules};
1787 print br();;
1788 print br();;
1790 if ($dependency_error eq 1){
1792         print $kiriwrite_lang{$language_selected}{errormessage};
1793         print $kiriwrite_lang{$language_selected}{dependencyperlmodulesmissing};
1794         print br();
1795         print br();
1799 print start_table();
1800 print start_Tr();
1801 print start_td({ -class => "tablecellheader" });
1802 print $kiriwrite_lang{$language_selected}{module};
1803 print end_td();
1804 print start_td({ -class => "tablecellheader" });
1805 print $kiriwrite_lang{$language_selected}{result};
1806 print end_td();
1807 print end_Tr();
1809 foreach $test (keys %dependency_results) {
1811         print start_Tr();
1812         print start_td({ -class => "tablename" });
1813                 print $test;
1814         print end_td();
1815         print start_td({ -class => "tabledata" });
1816                 print $dependency_results{$test}{result};
1817         print end_td();
1818         print end_Tr();
1822 print end_table();
1824 print h4($kiriwrite_lang{$language_selected}{databasemodules});
1825 print $kiriwrite_lang{$language_selected}{databasemodulestext};
1826 print br();
1827 print br();
1829 if ($database_error eq 1){
1831         print $kiriwrite_lang{$language_selected}{warningmessage};
1832         print $kiriwrite_lang{$language_selected}{databaseperlmodulesmissing};
1833         print br();
1834         print br();
1838 print start_table();
1839 print start_Tr();
1840 print start_td({ -class => "tablecellheader" });
1841 print $kiriwrite_lang{$language_selected}{module};
1842 print end_td();
1843 print start_td({ -class => "tablecellheader" });
1844 print $kiriwrite_lang{$language_selected}{result};
1845 print end_td();
1846 print end_Tr();
1848 foreach $test (keys %database_results) {
1850         print start_Tr();
1851         print start_td({ -class => "tablename" });
1852                 print $test;
1853         print end_td();
1854         print start_td({ -class => "tabledata" });
1855                 print $database_results{$test}{result};
1856         print end_td();
1857         print end_Tr();
1861 print end_table();
1863 print h4($kiriwrite_lang{$language_selected}{filepermissions});
1865 print $kiriwrite_lang{$language_selected}{filepermissionstext};
1866 print br();
1867 print br();
1869 if ($file_error eq 1){
1871         print $kiriwrite_lang{$language_selected}{errormessage};
1872         print $kiriwrite_lang{$language_selected}{filepermissionsinvalid};
1873         print br();
1874         print br();
1878 print start_table();
1879 print start_Tr();
1880 print start_td({ -class => "tablecellheader" });
1881 print "Filename";
1882 print end_td();
1883 print start_td({ -class => "tablecellheader" });
1884 print "Result";
1885 print end_td();
1886 print end_Tr();
1888 foreach $test (keys %file_results) {
1890         print start_Tr();
1891         print start_td({ -class => "tablename" });
1892                 print $test;
1893         print end_td();
1894         print start_td({ -class => "tabledata" });
1895                 print $file_results{$test}{result};
1896         print end_td();
1897         print end_Tr();
1901 print end_table();
1903 if ($dependency_error eq 1){
1905         print hr();
1906         print h4($kiriwrite_lang{$language_selected}{criticalerror});
1907         print $kiriwrite_lang{$language_selected}{dependencymodulesnotinstalled};
1908         print end_html;
1909         exit;
1913 if ($database_onemodule eq 0){
1915         print hr();
1916         print h4($kiriwrite_lang{$language_selected}{criticalerror});
1917         print $kiriwrite_lang{$language_selected}{databasemodulesnotinstalled};
1918         print end_html;
1919         exit;
1923 if ($file_error eq 1){
1925         print hr();
1926         print h4($kiriwrite_lang{$language_selected}{criticalerror});
1927         print $kiriwrite_lang{$language_selected}{filepermissionerrors};
1928         print end_html;
1929         exit;
1933 my @language_short;
1934 my (%available_languages, $available_languages);
1935 my @presentation_modules;
1936 my @database_modules;
1938 my $presentation_modules_ref = \@presentation_modules;
1939 my $database_modules_ref = \@database_modules;
1941 # Get the list of available languages.
1943 tie(%available_languages, 'Tie::IxHash');
1945 opendir(LANGUAGEDIR, "lang");
1946 my @language_directory = grep /m*\.xml$/, readdir(LANGUAGEDIR);
1947 closedir(LANGUAGEDIR);
1949 my $xsl = XML::Simple->new();
1951 foreach my $language_file (@language_directory){
1953         # Load the XML data.
1955         $language_xml_data = $xsl->XMLin("lang/" . $language_file);
1957         # Get the friendly name for the language file.
1959         $language_file_friendly = $language_file;
1960         $language_file_friendly =~ s/.xml$//g;
1962         $language_name = $language_xml_data->{about}->{name};
1964         $available_languages{$language_file_friendly} = $language_name . " (" . $language_file_friendly . ")";
1968 # Get the list of presentation modules.
1970 opendir(OUTPUTSYSTEMDIR, "Modules/Presentation");
1971 my @presmodule_directory = grep /m*\.pm$/, readdir(OUTPUTSYSTEMDIR);
1972 closedir(OUTPUTSYSTEMDIR);
1974 foreach my $presmodule_file (@presmodule_directory){
1976         # Get the friendly name for the database module.
1978         $presmodule_file =~ s/.pm$//g;
1980         push(@presentation_modules, $presmodule_file);
1984 # Get the list of database modules.
1986 opendir(DATABASEDIR, "Modules/Database");
1987 my @dbmodule_directory = grep /m*\.pm$/, readdir(DATABASEDIR);
1988 closedir(DATABASEDIR);
1990 foreach my $dbmodule_file (@dbmodule_directory){
1992         # Get the friendly name for the database module.
1994         $dbmodule_file =~ s/.pm$//g;
1996         push(@database_modules, $dbmodule_file);
2000 print h3($kiriwrite_lang{$language_selected}{settingstitle});
2002 print $kiriwrite_lang{$language_selected}{settingstext};
2003 print br();
2004 print br();
2006 print start_form("POST", "install.cgi");
2007 print hidden( -name => 'confirm', -default => '1');
2008 print hidden( -name => 'installlanguage', -default => $language_selected);
2010 print start_table({ -width => "100%" });
2012 print start_Tr();
2013 print start_td({ -class => "tablecellheader" });
2014 print $kiriwrite_lang{$language_selected}{setting};
2015 print end_td();
2016 print start_td({ -class => "tablecellheader" });
2017 print $kiriwrite_lang{$language_selected}{value};
2018 print end_td();
2019 print end_Tr();
2021 print start_Tr();
2022 print start_td({ -class => "tablecellheader" });
2023 print $kiriwrite_lang{$language_selected}{directories};
2024 print end_td();
2025 print start_td({ -class => "tablecellheader" });
2026 print end_td();
2027 print end_Tr();
2029 print start_Tr();
2030 print start_td({ -class => "tablename" });
2031 print $kiriwrite_lang{$language_selected}{databasedirectory};
2032 print end_td();
2033 print start_td({ -class => "tabledata" });
2034 print textfield({ -name => "dbdirectory", -size => 32, -maxlength => 64, -value => $default_dbdirectory });
2035 print end_td();
2036 print end_Tr();
2038 print start_Tr();
2039 print start_td({ -class => "tablename" });
2040 print $kiriwrite_lang{$language_selected}{outputdirectory};
2041 print end_td();
2042 print start_td({ -class => "tabledata" });
2043 print textfield({ -name => "outputdirectory", -size => 32, -maxlength => 64, -value => $default_outputdirectory });
2044 print end_td();
2045 print end_Tr();
2047 print start_Tr();
2048 print start_td({ -class => "tablename" });
2049 print $kiriwrite_lang{$language_selected}{imagesuripath};
2050 print end_td();
2051 print start_td({ -class => "tabledata" });
2052 print textfield({ -name => "imagesuripath", -size => 32, -maxlength => 64, -value => $default_imagesuri });
2053 print end_td();
2054 print end_Tr();
2056 print start_Tr();
2057 print start_td({ -class => "tablecellheader" });
2058 print $kiriwrite_lang{$language_selected}{date};
2059 print end_td();
2060 print start_td({ -class => "tablecellheader" });
2061 print "";
2062 print end_td();
2063 print end_Tr();
2065 print start_Tr();
2066 print start_td({ -class => "tablename" });
2067 print $kiriwrite_lang{$language_selected}{dateformat};
2068 print end_td();
2069 print start_td({ -class => "tabledata" });
2071 print popup_menu( -name => "dateformat", -values => @datetime_formats );
2072 print textfield({ -name => "customdateformat", -size => 32, -maxlength => 64, });
2074 print end_td();
2075 print end_Tr();
2077 print start_Tr();
2078 print start_td({ -class => "tablecellheader" });
2079 print $kiriwrite_lang{$language_selected}{language};
2080 print end_td();
2081 print start_td({ -class => "tablecellheader" });
2082 print end_td();
2083 print end_Tr();
2085 print start_Tr();
2086 print start_td({ -class => "tablename" });
2087 print $kiriwrite_lang{$language_selected}{systemlanguage};
2088 print end_td();
2089 print start_td({ -class => "tabledata" });
2091 # Note: This the following code is bodge. If anyone can fix it so that it all works
2092 # with popup_menu properly it will be appriciated.
2094 print "<select name=\"language\">";
2096 foreach my $language (keys %available_languages){
2098         if ($language eq $language_selected){
2100                 print "<option value=\"" . $language . "\" selected=selected>" . $available_languages{$language} . "</option>";
2102         } else {
2104                 print "<option value=\"" . $language . "\">" . $available_languages{$language} . "</option>";
2106         }
2110 print "</select>";
2112 print end_td();
2113 print end_Tr();
2115 print start_Tr();
2116 print start_td({ -class => "tablecellheader" });
2117 print $kiriwrite_lang{$language_selected}{modules};
2118 print end_td();
2119 print start_td({ -class => "tablecellheader" });
2120 print "";
2121 print end_td();
2122 print end_Tr();
2124 print start_Tr();
2125 print start_td({ -class => "tablename" });
2126 print $kiriwrite_lang{$language_selected}{presentationmodule};
2127 print end_td();
2128 print start_td({ -class => "tabledata" });
2129 print popup_menu({ -name => 'presmodule', -values => $presentation_modules_ref });
2130 print end_td();
2131 print end_Tr();
2133 print start_Tr();
2134 print start_td({ -class => "tablename" });
2135 print $kiriwrite_lang{$language_selected}{databasemodule};
2136 print end_td();
2137 print start_td({ -class => "tabledata" });
2138 print popup_menu({ -name => 'dbmodule', -values => $database_modules_ref });
2139 print end_td();
2140 print end_Tr();
2142 print start_Tr();
2143 print start_td({ -class => "tablename" });
2144 print $kiriwrite_lang{$language_selected}{databaseserver};
2145 print end_td();
2146 print start_td({ -class => "tabledata" });
2147 print textfield({ -name => "databaseserver", -size => 32, -maxlength => 128, -value => $default_server });
2148 print end_td();
2149 print end_Tr();
2151 print start_Tr();
2152 print start_td({ -class => "tablename" });
2153 print $kiriwrite_lang{$language_selected}{databaseport};
2154 print end_td();
2155 print start_td({ -class => "tabledata" });
2156 print textfield({ -name => "databaseport", -maxlength => 5, -size => 5, -value => $default_port });
2157 print end_td();
2158 print end_Tr();
2160 print start_Tr();
2161 print start_td({ -class => "tablename" });
2162 print $kiriwrite_lang{$language_selected}{databaseprotocol};
2163 print end_td();
2164 print start_td({ -class => "tabledata" });
2165 print popup_menu( -name => "databaseprotocol", -values => [ 'tcp', 'udp' ], -default => $default_protocol);
2166 print end_td();
2167 print end_Tr();
2169 print start_Tr();
2170 print start_td({ -class => "tablename" });
2171 print $kiriwrite_lang{$language_selected}{databasename};
2172 print end_td();
2173 print start_td({ -class => "tabledata" });
2174 print textfield({ -name => "databasename", -size => 32, -maxlength => 32, -default => $default_name });
2175 print end_td();
2176 print end_Tr();
2178 print start_Tr();
2179 print start_td({ -class => "tablename" });
2180 print $kiriwrite_lang{$language_selected}{databaseusername};
2181 print end_td();
2182 print start_td({ -class => "tabledata" });
2183 print textfield({ -name => "databaseusername", -size => 16, -maxlength => 16, -default => $default_username });
2184 print end_td();
2185 print end_Tr();
2187 print start_Tr();
2188 print start_td({ -class => "tablename" });
2189 print $kiriwrite_lang{$language_selected}{databasepassword};
2190 print end_td();
2191 print start_td({ -class => "tabledata" });
2192 print password_field({ -name => "databasepassword", -size => 32, -maxlength => 64 });
2193 print end_td();
2194 print end_Tr();
2196 print start_Tr();
2197 print start_td({ -class => "tablename" });
2198 print $kiriwrite_lang{$language_selected}{databasetableprefix};
2199 print end_td();
2200 print start_td({ -class => "tabledata" });
2201 print textfield({ -name => "databasetableprefix", -size => 32, -maxlength => 32, -default => $default_prefix });
2202 print end_td();
2203 print end_Tr();
2205 print start_Tr();
2206 print start_td({ -class => "tablecellheader" });
2207 print $kiriwrite_lang{$language_selected}{installationoptions};
2208 print end_td();
2209 print start_td({ -class => "tablecellheader" });
2210 print "";
2211 print end_td();
2212 print end_Tr();
2214 print start_Tr();
2215 print start_td({ -class => "tablename" });
2216 print $kiriwrite_lang{$language_selected}{installoptions};
2217 print end_td();
2218 print start_td({ -class => "tabledata" });
2219 print checkbox( -name => 'removeinstallscript', -checked => 1, -label => " " . $kiriwrite_lang{$language_selected}{removeinstallscript});
2220 print end_td();
2221 print end_Tr();
2223 print end_table();
2225 print br();
2226 print submit($kiriwrite_lang{$language_selected}{savesettingsbutton});
2227 print " | ";
2228 print reset($kiriwrite_lang{$language_selected}{resetsettingsbutton});
2230 print end_form();
2232 print end_html;
2233 exit;
2235 __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