3 #################################################################################
4 # Xestia Scanner Server Installer Script (install-multiuser.cgi) #
5 # Multiuser installation script for Xestia Scanner Server #
9 # Copyright (C) 2005-2011 Steve Brokenshire <sbrokenshire@xestia.co.uk> #
11 # This module is licensed under the same license as Xestia Scanner Server which #
12 # is licensed under the GPL version 3. #
14 # This program is free software: you can redistribute it and/or modify #
15 # it under the terms of the GNU General Public License as published by #
16 # the Free Software Foundation, version 3 of the License. #
18 # This program is distributed in the hope that it will be useful, #
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
21 # GNU General Public License for more details. #
23 # You should have received a copy of the GNU General Public License #
24 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
25 #################################################################################
27 use strict; # Throw errors if there's something wrong.
28 use warnings; # Write warnings to the HTTP Server Log file.
35 print "Content-type: text/html;\r\n\r\n";
36 print "The CGI::Lite Perl Module is not installed. Please install CGI::Lite and then run this installation script again. CGI::Lite can be installed through CPAN.";
40 my $modperlenabled = 0;
41 my $installscriptname = "install-multiuser.cgi";
42 my $originstallscriptname = "install.cgi";
43 my $xestiascanscriptname = "xsdss.cgi";
44 my $language_selected = "en-GB";
46 my %xestiascan_config;
56 font-family: sans-serif;
59 background-color: #402040;
61 background-image: url('/images/xestiascan/pagebackground.png');
62 background-repeat: repeat-x;
68 #background-color: #408080;
70 #border-color: #102020;
82 background-color: #204040;
88 background-color: #204040;
93 background-color: #703570;
96 background-image: url('/images/xestiascan/tabletop.png');
97 background-repeat: repeat-x;
101 background-color: #603060;
106 background-color: #753575;
107 border-bottom-style: solid;
108 border-bottom-width: 1px;
109 border-bottom-color: #EE70EE;
112 background-image: url('/images/xestiascan/menutop.png');
113 background-repeat: repeat-x;
138 background-color: #301530;
153 my $default_dbmodule = "PostgreSQL";
154 my $default_server = "localhost";
155 my $default_port = "5432";
156 my $default_protocol = "tcp";
157 my $default_name = "database";
158 my $default_username = "username";
159 my $default_prefix = "xestiascan";
161 my $default_adminusername = "Administrator";
162 my $default_adminpassword = "Password";
164 my $query_lite = new CGI::Lite;
165 my $form_data = $query_lite->parse_form_data;
167 my ($xestiascan_lang, %xestiascan_lang);
169 $xestiascan_lang{"en-GB"}{"languagename"} = "English (British)";
170 $xestiascan_lang{"en-GB"}{"testpass"} = "OK";
171 $xestiascan_lang{"en-GB"}{"testfail"} = "Error";
173 $xestiascan_lang{"en-GB"}{"invalidconfigfile"} = "An error occured whilst reading the configuration file. It may be in an invalid format, missings or that no permissions are set! You will need to enter these details manually below.";
175 $xestiascan_lang{"en-GB"}{"generic"} = "An error occured which is not known to the Xestia Scanner Server multiuser installer.";
176 $xestiascan_lang{"en-GB"}{"invalidvariable"} = "The variable given was invalid.";
177 $xestiascan_lang{"en-GB"}{"invalidvalue"} = "The value given was invalid.";
178 $xestiascan_lang{"en-GB"}{"invalidutf8"} = "The value given has does not contain valid UTF8.";
179 $xestiascan_lang{"en-GB"}{"invalidoption"} = "The option given was invalid.";
180 $xestiascan_lang{"en-GB"}{"variabletoolong"} = "The variable given is too long.";
181 $xestiascan_lang{"en-GB"}{"blankdirectory"} = "The directory name given is blank.";
182 $xestiascan_lang{"en-GB"}{"invaliddirectory"} = "The directory name given is invalid.";
183 $xestiascan_lang{"en-GB"}{"moduleblank"} = "The module filename given is blank.";
184 $xestiascan_lang{"en-GB"}{"moduleinvalid"} = "The module filename given is invalid.";
186 $xestiascan_lang{"en-GB"}{"dbdirectorytoolong"} = "The database directory name given is too long.";
187 $xestiascan_lang{"en-GB"}{"outputdirectorytoolong"} = "The output directory name given is too long.";
188 $xestiascan_lang{"en-GB"}{"imagesuripathtoolong"} = "The images URI path name given is too long.";
189 $xestiascan_lang{"en-GB"}{"dateformattoolong"} = "The date format given is too long.";
190 $xestiascan_lang{"en-GB"}{"customdateformattoolong"} = "The custom date format given is too long.";
191 $xestiascan_lang{"en-GB"}{"languagefilenametoolong"} = "The language filename given is too long.";
193 $xestiascan_lang{"en-GB"}{"authmoduleinvalidpermissions"} = "The authentication moudle has invalid file permissions set.";
195 $xestiascan_lang{"en-GB"}{"dateformatblank"} = "The date format given was blank.";
196 $xestiascan_lang{"en-GB"}{"dateformatinvalid"} = "The date format given is invalid.";
197 $xestiascan_lang{"en-GB"}{"languagefilenameinvalid"} = "The language filename given is invalid.";
199 $xestiascan_lang{"en-GB"}{"dbdirectoryblank"} = "The database directory name given is blank.";
200 $xestiascan_lang{"en-GB"}{"dbdirectoryinvalid"} = "The database directory name given is invalid.";
202 $xestiascan_lang{"en-GB"}{"outputdirectoryblank"} = "The output directory name given is blank.";
203 $xestiascan_lang{"en-GB"}{"outputdirectoryinvalid"} = "The output directory name given is invalid.";
205 $xestiascan_lang{"en-GB"}{"textarearowblank"} = "The text area row value given is blank.";
206 $xestiascan_lang{"en-GB"}{"textarearowtoolong"} = "The text area row value given is too long.";
207 $xestiascan_lang{"en-GB"}{"textarearowinvalid"} = "The text area row value given is invalid.";
209 $xestiascan_lang{"en-GB"}{"textareacolsblank"} = "The text area columns value given is blank.";
210 $xestiascan_lang{"en-GB"}{"textareacolstoolong"} = "The text area columns value given is too long.";
211 $xestiascan_lang{"en-GB"}{"textareacolsinvalid"} = "The text area columns value given is invalid.";
213 $xestiascan_lang{"en-GB"}{"presmoduleblank"} = "The presentation module name given is blank.";
214 $xestiascan_lang{"en-GB"}{"presmoduleinvalid"} = "The presentation module name given is invalid.";
216 $xestiascan_lang{"en-GB"}{"authmoduleblank"} = "The database module name given is blank.";
217 $xestiascan_lang{"en-GB"}{"dbmoduleinvalid"} = "The database module name given is invalid.";
219 $xestiascan_lang{"en-GB"}{"outputmoduleblank"} = "The output module name given is blank.";
220 $xestiascan_lang{"en-GB"}{"outputmoduleinvalid"} = "The output module name given is invalid.";
222 $xestiascan_lang{"en-GB"}{"presmodulemissing"} = "The presentation module with the filename given is missing.";
223 $xestiascan_lang{"en-GB"}{"outputmodulemissing"} = "The output module with the filename given is missing.";
224 $xestiascan_lang{"en-GB"}{"authmodulemissing"} = "The authentication module with the filename given is missing.";
225 $xestiascan_lang{"en-GB"}{"languagefilenamemissing"} = "The language file with the filename given is missing.";
227 $xestiascan_lang{"en-GB"}{"servernametoolong"} = "The database server name given is too long.";
228 $xestiascan_lang{"en-GB"}{"servernameinvalid"} = "The database server name given is invalid.";
229 $xestiascan_lang{"en-GB"}{"serverportnumbertoolong"} = "The database server port number given is too long.";
230 $xestiascan_lang{"en-GB"}{"serverportnumberinvalidcharacters"} = "The database server port number given contains invalid characters.";
231 $xestiascan_lang{"en-GB"}{"serverportnumberinvalid"} = "The database server port number given is invalid.";
232 $xestiascan_lang{"en-GB"}{"serverprotocolnametoolong"} = "The database server protocol name given is too long.";
233 $xestiascan_lang{"en-GB"}{"serverprotocolinvalid"} = "The database server protocol name is invalid.";
234 $xestiascan_lang{"en-GB"}{"serverdatabasenametoolong"} = "The database name given is too long.";
235 $xestiascan_lang{"en-GB"}{"serverdatabasenameinvalid"} = "The database name given is invalid.";
236 $xestiascan_lang{"en-GB"}{"serverdatabaseusernametoolong"} = "The database server username given is too long.";
237 $xestiascan_lang{"en-GB"}{"serverdatabaseusernameinvalid"} = "The database server username given is invalid.";
238 $xestiascan_lang{"en-GB"}{"serverdatabasepasswordtoolong"} = "The database server password is too long.";
239 $xestiascan_lang{"en-GB"}{"serverdatabasetableprefixtoolong"} = "The database server table prefix given is too long.";
240 $xestiascan_lang{"en-GB"}{"serverdatabasetableprefixinvalid"} = "The database server table prefix given is invalid.";
241 $xestiascan_lang{"en-GB"}{"createmodulestoolong"} = "The create modules value given is too long.";
242 $xestiascan_lang{"en-GB"}{"createscannerstoolong"} = "The create scanners value given is too long.";
243 $xestiascan_lang{"en-GB"}{"createsessionstoolong"} = "The create sessions value given is too long.";
244 $xestiascan_lang{"en-GB"}{"createuserstoolong"} = "The create users value given is too long.";
245 $xestiascan_lang{"en-GB"}{"forcerecreatetoolong"} = "The force recreate value given is too long.";
246 $xestiascan_lang{"en-GB"}{"deleteinstalltoolong"} = "The delete installer value given is too long.";
247 $xestiascan_lang{"en-GB"}{"deletemultiusertoolong"} = "The delete multiuser installer value given is too long.";
249 $xestiascan_lang{"en-GB"}{"notmultiuser"} = "The module given is not a multiuser module.";
251 $xestiascan_lang{"en-GB"}{"removeinstallscripttoolong"} = "The remove install script value given is too long.";
252 $xestiascan_lang{"en-GB"}{"cannotwriteconfigurationindirectory"} = "The configuration file cannot be written because the directory the install script is running from has invalid permissions.";
253 $xestiascan_lang{"en-GB"}{"configurationfilereadpermissionsinvalid"} = "The configuration that currently exists has invalid read permissions set.";
254 $xestiascan_lang{"en-GB"}{"configurationfilewritepermissionsinvalid"} = "The configuration that currently exists has invalid write permissions set.";
256 $xestiascan_lang{"en-GB"}{"errormessagetext"} = "Please press the back button on your browser or preform the command needed to return to the previous page.";
258 $xestiascan_lang{"en-GB"}{"switch"} = "Switch";
259 $xestiascan_lang{"en-GB"}{"setting"} = "Setting";
260 $xestiascan_lang{"en-GB"}{"value"} = "Value";
261 $xestiascan_lang{"en-GB"}{"filename"} = "Filename";
262 $xestiascan_lang{"en-GB"}{"module"} = "Module";
263 $xestiascan_lang{"en-GB"}{"result"} = "Result";
264 $xestiascan_lang{"en-GB"}{"error"} = "Error!";
265 $xestiascan_lang{"en-GB"}{"criticalerror"} = "Critical Error!";
266 $xestiascan_lang{"en-GB"}{"errormessage"} = "Error: ";
267 $xestiascan_lang{"en-GB"}{"warningmessage"} = "Warning: ";
269 $xestiascan_lang{"en-GB"}{"doesnotexist"} = "Does not exist.";
270 $xestiascan_lang{"en-GB"}{"invalidpermissionsset"} = "Invalid permissions set.";
272 $xestiascan_lang{"en-GB"}{"dependencyperlmodulesmissing"} = "One or more Perl modules that are needed by Xestia Scanner Server are not installed or has problems. See the Xestia Scanner Server documentation for more information on this.";
273 $xestiascan_lang{"en-GB"}{"databaseperlmodulesmissing"} = "One or more Perl modules that are needed by the Xestia Scanner Server database modules are not installed or has problems. See the Xestia Scanner Server 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.";
274 $xestiascan_lang{"en-GB"}{"filepermissionsinvalid"} = "One or more of the filenames checked does not exist or has invalid permissions set. See the Xestia Scanner Server documentation for more information on this.";
275 $xestiascan_lang{"en-GB"}{"dependencymodulesnotinstalled"} = "One of the required Perl modules is not installed or has errors. See the Xestia Scanner Server documentation for more information on this.";
276 $xestiascan_lang{"en-GB"}{"databasemodulesnotinstalled"} = "None of Perl modules that are used by the database modules are not installed. See the Xestia Scanner Server documentation for more information on this.";
277 $xestiascan_lang{"en-GB"}{"filepermissionerrors"} = "One or more filenames checked has errors. See the Xestia Scanner Server documentation for more information on this.",
279 $xestiascan_lang{"en-GB"}{"installertitle"} = "Xestia Scanner Server Multiuser Installer";
280 $xestiascan_lang{"en-GB"}{"installertext"} = "This installer script will setup the user and session tables needed for your multiuser installation of Xestia Scanner Server. If you already have user or session tables then they will be skipped unless you have selected the recreate table checkbox.";
281 $xestiascan_lang{"en-GB"}{"modperlnotice"} = "mod_perl has been detected. Please ensure that you have setup this script and the main Xestia Scanner Server script so that mod_perl can use Xestia Scanner Server properly. Please read the mod_perl specific part of Chapter 1: Installation in the Xestia Scanner Server documentation.";
282 $xestiascan_lang{"en-GB"}{"dependencytitle"} = "Dependency and file testing results";
283 $xestiascan_lang{"en-GB"}{"requiredmodules"} = "Required Modules";
284 $xestiascan_lang{"en-GB"}{"perlmodules"} = "These Perl modules are used internally by Xestia Scanner Server.";
285 $xestiascan_lang{"en-GB"}{"databasemodules"} = "Perl Database Modules";
286 $xestiascan_lang{"en-GB"}{"databasemodulestext"} = "These Perl modules are used by the database modules.";
287 $xestiascan_lang{"en-GB"}{"filepermissions"} = "File permissions";
288 $xestiascan_lang{"en-GB"}{"filepermissionstext"} = "The file permissions are for file and directories that are critical to Xestia Scanner Server such as module and language directories.";
290 $xestiascan_lang{"en-GB"}{"settingstitle"} = "Xestia Scanner Server Settings";
291 $xestiascan_lang{"en-GB"}{"settingstext"} = "The settings given here will be used by Xestia Scanner Server. Some default settings are given here. Certain database modules (like SQLite) do not need the database server settings and can be left alone.";
292 $xestiascan_lang{"en-GB"}{"directories"} = "Directories";
293 $xestiascan_lang{"en-GB"}{"databasedirectory"} = "Database Directory";
294 $xestiascan_lang{"en-GB"}{"outputdirectory"} = "Output Directory";
295 $xestiascan_lang{"en-GB"}{"imagesuripath"} = "Images (URI path)";
296 $xestiascan_lang{"en-GB"}{"display"} = "Display";
297 $xestiascan_lang{"en-GB"}{"textareacols"} = "Text Area Columns";
298 $xestiascan_lang{"en-GB"}{"textarearows"} = "Text Area Rows";
299 $xestiascan_lang{"en-GB"}{"date"} = "Date";
300 $xestiascan_lang{"en-GB"}{"dateformat"} = "Date Format";
301 $xestiascan_lang{"en-GB"}{"language"} = "Language";
302 $xestiascan_lang{"en-GB"}{"systemlanguage"} = "System Language";
303 $xestiascan_lang{"en-GB"}{"modules"} = "Modules";
304 $xestiascan_lang{"en-GB"}{"presentationmodule"} = "Presentation Module";
305 $xestiascan_lang{"en-GB"}{"outputmodule"} = "Output Module";
306 $xestiascan_lang{"en-GB"}{"authsettings"} = "Authentication Settings";
307 $xestiascan_lang{"en-GB"}{"authenticationmodule"} = "Authentication Module";
308 $xestiascan_lang{"en-GB"}{"multiuseronly"} = "Only multiuser-supported authentication modules are listed.";
309 $xestiascan_lang{"en-GB"}{"databaseserver"} = "Database Server";
310 $xestiascan_lang{"en-GB"}{"databaseport"} = "Database Port";
311 $xestiascan_lang{"en-GB"}{"databaseprotocol"} = "Database Protocol";
312 $xestiascan_lang{"en-GB"}{"databasename"} = "Database Name";
313 $xestiascan_lang{"en-GB"}{"databaseusername"} = "Database Username";
314 $xestiascan_lang{"en-GB"}{"databasepassword"} = "Database Password";
315 $xestiascan_lang{"en-GB"}{"databasetableprefix"} = "Database Table Prefix";
316 $xestiascan_lang{"en-GB"}{"adminuseraccountsettings"} = "Administrative User Account Settings";
317 $xestiascan_lang{"en-GB"}{"adminusername"} = "Username:";
318 $xestiascan_lang{"en-GB"}{"adminpassword"} = "Password:";
319 $xestiascan_lang{"en-GB"}{"installationoptions"} = "Installation Options";
320 $xestiascan_lang{"en-GB"}{"installoptions"} = "Install Options";
321 $xestiascan_lang{"en-GB"}{"installationoptions"} = "Installation Options";
322 $xestiascan_lang{"en-GB"}{"createtables"} = "Create tables";
323 $xestiascan_lang{"en-GB"}{"createtablemodulepermissions"} = "Create the modules permissions table.";
324 $xestiascan_lang{"en-GB"}{"createtablescannerspermissions"} = "Create the scanners permissions table.";
325 $xestiascan_lang{"en-GB"}{"createtablesessions"} = "Create the sessions table.";
326 $xestiascan_lang{"en-GB"}{"createtableusers"} = "Create the users table.";
327 $xestiascan_lang{"en-GB"}{"forcerecreate"} = "Force recreate";
328 $xestiascan_lang{"en-GB"}{"forcerecreatetables"} = "Force recreation of the selected tables.";
329 $xestiascan_lang{"en-GB"}{"deleteinstallscripts"} = "Delete install scripts";
330 $xestiascan_lang{"en-GB"}{"removeinstallscript"} = "Delete the Xestia Scanner Server Installer script.";
331 $xestiascan_lang{"en-GB"}{"removemultiuserinstallscript"} = "Delete the Xestia Scanner Server Multiuser Installer script.";
332 $xestiascan_lang{"en-GB"}{"recommendremoving"} = "Deleting the installer scripts after you have finished using them is strongly recommended to secure your Xestia Scanner Server multiuser installation!";
333 $xestiascan_lang{"en-GB"}{"savesettingsbutton"} = "Save Settings";
334 $xestiascan_lang{"en-GB"}{"resetsettingsbutton"} = "Reset Settings";
336 $xestiascan_lang{"en-GB"}{"adminaccountname"} = "Administrator";
337 $xestiascan_lang{"en-GB"}{"adminaccountpassword"} = "Password";
339 $xestiascan_lang{"en-GB"}{"installscriptkept"} = "Warning: The installer script has not been removed.";
340 $xestiascan_lang{"en-GB"}{"multiuserinstallscriptkept"} = "Warning: The multiuser installer script has not been removed.";
341 $xestiascan_lang{"en-GB"}{"multiuserscriptremoved"} = "The multiuser installer script was removed.";
342 $xestiascan_lang{"en-GB"}{"installscriptremoved"} = "The installer script was removed.";
343 $xestiascan_lang{"en-GB"}{"installedmessage"} = "The configuration file for Xestia Scanner Server 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 Xestia Scanner Server.";
344 $xestiascan_lang{"en-GB"}{"cannotremovemultiuserinstallerscript"} = "Unable to remove the multiuser installer script: %s. The multiuser installer script will have to be deleted manually.";
345 $xestiascan_lang{"en-GB"}{"cannotremoveinstallerscript"} = "Unable to remove the installer script: %s. The installer script will have to be deleted manually.";
346 $xestiascan_lang{"en-GB"}{"usexestiascannerservertext"} = "To use Xestia Scanner Server click or select the link below (will not work if the Xestia Scanner Server script is not called xsdss.cgi):";
347 $xestiascan_lang{"en-GB"}{"usexestiascannerserverlink"} = "Start using Xestia Scanner Server";
349 $xestiascan_lang{"en-GB"}{"multiuserresults"} = "The multiuser installer has preformed the following actions:";
350 $xestiascan_lang{"en-GB"}{"forciblyrecreated"} = "The tables will be forcibly recreated.";
351 $xestiascan_lang{"en-GB"}{"notforciblyrecreated"} = "The tables will not be forcibly recreated.";
352 $xestiascan_lang{"en-GB"}{"modulestableerror"} = "An error occured while creating the permissions table for modules: ";
353 $xestiascan_lang{"en-GB"}{"modulestablesuccess"} = "The permissions table for modules was created successfully.";
354 $xestiascan_lang{"en-GB"}{"scannerstableerror"} = "An error occured while creating the permissions table for scanners: ";
355 $xestiascan_lang{"en-GB"}{"scannerstablesuccess"} = "The permissions table for scanners was created successfully.";
356 $xestiascan_lang{"en-GB"}{"sessionstableerror"} = "An error occured while creating the permissions table for scanners: ";
357 $xestiascan_lang{"en-GB"}{"sessionstablesuccess"} = "The sessions table was created successfully.";
358 $xestiascan_lang{"en-GB"}{"userstableerror"} = "An error occured while creating the permissions table for users: ";
359 $xestiascan_lang{"en-GB"}{"userstablesuccess"} = "The users table was created successfully.";
360 $xestiascan_lang{"en-GB"}{"adminaccounterror"} = "An error occured whilst trying to create the administrative account: ";
361 $xestiascan_lang{"en-GB"}{"adminaccountsuccess"} = "The administrative account was created successfully.";
363 $xestiascan_lang{"en-GB"}{"autherroroccured"} = "An error occured whilst using the authentication module: ";
366 #################################################################################
367 # Begin list of subroutines. #
368 #################################################################################
370 sub xestiascan_variablecheck{
371 #################################################################################
372 # xestiascan_variablecheck: Check to see if the data passed is valid. #
376 # xestiascan_variablecheck(variablename, type, option, noerror); #
378 # variablename Specifies the variable to be checked. #
379 # type Specifies what type the variable is. #
380 # option Specifies the maximum/minimum length of the variable #
381 # (if minlength/maxlength is used) or if the filename should be #
382 # checked to see if it is blank. #
383 # noerror Specifies if Xestia Scanner Server should return an error or not#
384 # on certain values. #
385 #################################################################################
387 # Get the values that were passed to the subroutine.
389 my ($variable_data, $variable_type, $variable_option, $variable_noerror) = @_;
391 if ($variable_type eq "numbers"){
393 # Check for numbers and return an error if there is anything else than numebrs.
395 my $variable_data_validated = $variable_data; # Copy the variable_data to variable_data_validated.
396 $variable_data_validated =~ tr/0-9//d; # Take away all of the numbers and from the variable.
397 # If it only contains numbers then it should be blank.
399 if ($variable_data_validated eq ""){
400 # The validated variable is blank. So continue to the end of this section where the return function should be.
402 # The variable is not blank, so check if the no error value is set
405 if ($variable_noerror eq 1){
407 # The validated variable is not blank and the noerror
408 # value is set to 1. So return an value of 1.
409 # (meaning that the data is invalid).
413 } elsif ($variable_noerror eq 0) {
415 # The validated variable is not blank and the noerror
418 xestiascan_error("invalidvariable");
422 # The variable noerror value is something else
423 # pther than 1 or 0. So return an error.
425 xestiascan_error("invalidvariable");
433 } elsif ($variable_type eq "lettersnumbers"){
435 # Check for letters and numbers and return an error if there is anything else other
436 # than letters and numbers.
438 my $variable_data_validated = $variable_data; # Copy the variable_data to variable_data_validated
439 $variable_data_validated =~ tr/a-zA-Z0-9.//d;
440 $variable_data_validated =~ s/\s//g;
442 if ($variable_data_validated eq ""){
443 # The validated variable is blank. So continue to the end of this section where the return function should be.
445 # The variable is not blank, so check if the no error value is set
448 if ($variable_noerror eq 1){
450 # The validated variable is not blank and the noerror
451 # value is set to 1. So return an value of 1.
452 # (meaning that the data is invalid).
456 } elsif ($variable_noerror eq 0) {
458 # The validated variable is not blank and the noerror
461 xestiascan_error("invalidvariable");
465 # The variable noerror value is something else
466 # pther than 1 or 0. So return an error.
468 xestiascan_error("invalidvariable");
476 } elsif ($variable_type eq "maxlength"){
477 # Check for the length of the variable, return an error if it is longer than the length specified.
479 # Check if the variable_data string is blank, if it is then set the variable_data_length
482 my $variable_data_length = 0;
484 if (!$variable_data){
486 # Set variable_data_length to '0'.
487 $variable_data_length = 0;
491 # Get the length of the variable recieved.
492 $variable_data_length = length($variable_data);
498 if ($variable_data_length > $variable_option){
500 # The variable length is longer than it should be so check if
501 # the no error value is set 1.
503 if ($variable_noerror eq 1){
505 # The no error value is set to 1, so return an
506 # value of 1 (meaning tha the variable is
507 # too long to be used).
511 } elsif ($variable_noerror eq 0){
513 # The no error value is set to 0, so return
516 xestiascan_error("variabletoolong");
520 # The no error value is something else other
521 # than 0 or 1, so return an error.
523 xestiascan_error("variabletoolong");
529 # The variable length is exactly or shorter than specified, so continue to end of this section where
530 # the return function should be.
536 } elsif ($variable_type eq "datetime"){
537 # Check if the date and time setting format is valid.
539 if ($variable_data eq ""){
541 if ($variable_noerror eq 1){
543 # The no error value is set to 1 so return
544 # a value of 1 (meaning that the date and
545 # time format was blank).
549 } elsif ($variable_noerror eq 0){
551 # The no error value is set to 1 so return
554 xestiascan_error("dateformatblank");
558 # The no error value is something else other
559 # than 0 or 1, so return an error.
561 xestiascan_error("invalidvariable");
567 my $variable_data_validated = $variable_data;
568 $variable_data_validated =~ tr|dDmMyYhms/():[ ]||d;
570 if ($variable_data_validated eq ""){
572 # The date and time format is valid. So
577 # The validated data variable is not blank, meaning
578 # that it contains something else, so return an error
581 if ($variable_noerror eq 1){
583 # The no error value is set to 1 so return
584 # an value of 2. (meaning that the date and
585 # time format was invalid).
589 } elsif ($variable_noerror eq 0){
591 # The no error value is set to 0 so return
594 xestiascan_error("dateformatinvalid");
598 # The no error value is something else other
599 # than 0 or 1 so return an error.
601 xestiascan_error("invalidvariable");
609 } elsif ($variable_type eq "directory"){
610 # Check if the directory only contains letters and numbers and
611 # return an error if anything else appears.
613 my $variable_data_validated = $variable_data;
614 $variable_data_validated =~ tr/a-zA-Z0-9//d;
616 if ($variable_data eq ""){
618 if ($variable_noerror eq 1){
620 # The no error value is set to 1 so return
621 # a value of 1 (meaning that the directory
626 } elsif ($variable_noerror eq 0){
628 # The no error value is set to 1 so return
631 xestiascan_error("blankdirectory");
635 # The no error value is something else other
636 # than 0 or 1, so return an error.
638 xestiascan_error("invalidvariable");
644 if ($variable_data_validated eq ""){
646 # The validated data variable is blank, meaning that
647 # it only contains letters and numbers.
651 # The validated data variable is not blank, meaning
652 # that it contains something else, so return an error
655 if ($variable_noerror eq 1){
657 # The no error value is set to 1 so return
658 # an value of 2. (meaning that the directory
663 } elsif ($variable_noerror eq 0){
665 # The no error value is set to 0 so return
668 xestiascan_error("invaliddirectory");
672 # The no error value is something else other
673 # than 0 or 1 so return an error.
675 xestiascan_error("invalidvariable");
683 } elsif ($variable_type eq "language_filename"){
685 # The variable type is a language filename type.
686 # Check if the language file name is blank and
687 # if it is then return an error (or value).
689 if ($variable_data eq ""){
691 # The language filename is blank so check the
692 # no error value and return an error (or value).
694 if ($variable_noerror eq 1){
696 # Language filename is blank and the no error value
697 # is set as 1, so return a value of 1 (saying that
698 # the language filename is blank).
702 } elsif ($variable_noerror eq 0) {
704 # Language filename is blank and the no error value
705 # is not set as 1, so return an error.
707 xestiascan_error("languagefilenameblank");
711 # The noerror value is something else other
712 # than 0 or 1 so return an error.
714 xestiascan_error("invalidvariable");
720 # Set the following variables for later on.
722 my $variable_data_length = 0;
723 my $variable_data_char = "";
724 my $variable_data_seek = 0;
726 # Get the length of the language file name.
728 $variable_data_length = length($variable_data);
732 # Get a character from the language filename passed to this
733 # subroutine and the character the seek counter value is set
736 $variable_data_char = substr($variable_data, $variable_data_seek, 1);
738 # Check if the language filename contains a forward slash or a dot,
739 # if the selected character is a forward slash then return an error
742 if ($variable_data_char eq "/" || $variable_data_char eq "."){
744 # The language filename contains a forward slash or
745 # a dot so depending on the no error value, return
746 # an error or a value.
748 if ($variable_noerror eq 1){
750 # Language filename contains a forward slash or a dot
751 # and the no error value has been set to 1, so return
752 # an value of 2 (saying that the language file name is
757 } elsif ($variable_noerror eq 0) {
759 # Language filename contains a forward slash and the no
760 # error value has not been set to 1, so return an error.
762 xestiascan_error("languagefilenameinvalid");
766 # The noerror value is something else other than
767 # 1 or 0 so return an error.
769 xestiascan_error("invalidvariable");
775 # Increment the seek counter.
777 $variable_data_seek++;
779 } until ($variable_data_seek eq $variable_data_length);
783 } elsif ($variable_type eq "module"){
785 # The variable type is a presentation module filename.
787 # Check if the variable_data is blank and if it is
790 if ($variable_data eq ""){
792 # The presentation module is blank so check if an error
793 # value should be returned or a number should be
796 if ($variable_noerror eq 1){
798 # Module name is blank and the no error value
799 # is set to 1 so return a value of 2 (meaning
800 # that the page filename is blank).
804 } elsif ($variable_noerror eq 0) {
806 # Module name contains is blank and the no error
807 # value is set to 0 so return an error.
809 xestiascan_critical("moduleblank");
813 # The no error value is something else other
814 # than 0 or 1 so return an error.
816 xestiascan_critical("invalidvalue");
824 my $variable_data_validated = $variable_data;
825 $variable_data_validated =~ tr/a-zA-Z0-9//d;
827 if ($variable_data_validated eq ""){
831 if ($variable_noerror eq 1){
833 # Module name contains invalid characters and
834 # the no error value is set to 1 so return a
835 # value of 2 (meaning that the page filename
840 } elsif ($variable_noerror eq 0) {
842 # Module name contains invalid characters and
843 # the no error value is set to 0 so return an
846 xestiascan_critical("moduleinvalid");
850 # The no error value is something else other
851 # than 0 or 1 so return an error.
853 xestiascan_error("invalidvalue");
861 } elsif ($variable_type eq "serverprotocol"){
863 # Check if the server protocol is TCP or UDP and return
864 # an error if it isn't.
866 if ($variable_data ne "tcp" && $variable_data ne "udp"){
868 # The protocol given is not valid, check if the no
869 # error value is set to 1 and return an error if it isn't.
871 if ($variable_noerror eq 1){
873 # The no error value has been set to 1, so return a
874 # value of 1 (meaning that the server protocol is
879 } elsif ($variable_noerror eq 0){
881 # The no error value has been set to 0, so return
884 xestiascan_error("serverprotocolinvalid");
888 # The no error value is something else other than 0
889 # or 1, so return an error.
891 xestiascan_error("invalidoption");
899 } elsif ($variable_type eq "port"){
901 # Check if the port number given is less than 0 or more than 65535
902 # and return an error if it is.
904 if ($variable_data < 0 || $variable_data > 65535){
906 # The port number is less than 0 and more than 65535 so
907 # check if the no error value is set to 1 and return an
910 if ($variable_noerror eq 1){
912 # The no error value has been set to 1, so return a
913 # value of 1 (meaning that the port number is invalid).
917 } elsif ($variable_noerror eq 0){
919 # The no error value has been set to 0, so return
922 xestiascan_error("serverportnumberinvalid");
926 # The no error value is something else other than 0
927 # or 1, so return an error.
929 xestiascan_error("invalidoption");
937 } elsif ($variable_type eq "utf8"){
939 # The variable type is a UTF8 string.
941 if (!$variable_data){
952 while ($chunk < $length){
954 $chunkdata = substr($variable_data, $chunk, $process);
956 if ($chunkdata =~ m/\A(
957 [\x09\x0A\x0D\x20-\x7E] # ASCII
958 | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
959 | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
960 | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
961 | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
962 | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
963 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
964 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
967 # The UTF-8 string is valid.
971 # The UTF-8 string is not valid, check if the no error
972 # value is set to 1 and return an error if it isn't.
974 if ($variable_noerror eq 1){
976 # The no error value has been set to 1, so return
977 # a value of 1 (meaning that the UTF-8 string is
982 } elsif ($variable_noerror eq 0) {
984 # The no error value has been set to 0, so return
987 xestiascan_error("invalidutf8");
991 # The no error value is something else other than 0
992 # or 1, so return an error.
994 xestiascan_error("invalidoption");
1001 $chunk = $chunk + $process;
1009 # Another type than the valid ones above has been specified so return an error specifying an invalid option.
1010 xestiascan_error("invalidoption");
1014 sub xestiascan_error{
1015 #################################################################################
1016 # xestiascan_error: Subroutine for processing error messages. #
1020 # xestiascan_error(errortype); #
1022 # errortype Specifies the error type to use. #
1023 #################################################################################
1025 my $error_type = shift;
1027 # Load the list of error messages.
1029 my (%xestiascan_error, $xestiascan_error);
1031 %xestiascan_error = (
1033 # Generic Error Messages
1035 "generic" => $xestiascan_lang{$language_selected}{generic},
1037 "invalidvariable" => $xestiascan_lang{$language_selected}{invalidvariable},
1038 "invalidvalue" => $xestiascan_lang{$language_selected}{invalidvalue},
1039 "invalidoption" => $xestiascan_lang{$language_selected}{invalidoption},
1040 "variabletoolong" => $xestiascan_lang{$language_selected}{variabletoolong},
1041 "blankdirectory" => $xestiascan_lang{$language_selected}{blankdirectory},
1042 "invaliddirectory" => $xestiascan_lang{$language_selected}{invaliddirectory},
1043 "moduleblank" => $xestiascan_lang{$language_selected}{moduleblank},
1044 "moduleinvalid" => $xestiascan_lang{$language_selected}{moduleinvalid},
1046 # Specific Error Messages
1048 "dbdirectorytoolong" => $xestiascan_lang{$language_selected}{dbdirectorytoolong},
1049 "outputdirectorytoolong" => $xestiascan_lang{$language_selected}{outputdirectorytoolong},
1050 "imagesuripathtoolong" => $xestiascan_lang{$language_selected}{imagesuripathtoolong},
1051 "dateformattoolong" => $xestiascan_lang{$language_selected}{dateformattoolong},
1052 "customdateformattoolong" => $xestiascan_lang{$language_selected}{customdateformattoolong},
1053 "languagefilenametoolong" => $xestiascan_lang{$language_selected}{languagefilenametoolong},
1055 "dateformatblank" => $xestiascan_lang{$language_selected}{dateformatblank},
1056 "dateformatinvalid" => $xestiascan_lang{$language_selected}{dateformatinvalid},
1057 "languagefilenameinvalid" => $xestiascan_lang{$language_selected}{languagefilenameinvalid},
1059 "dbdirectoryblank" => $xestiascan_lang{$language_selected}{dbdirectoryblank},
1060 "dbdirectoryinvalid" => $xestiascan_lang{$language_selected}{dbdirectoryinvalid},
1062 "textarearowblank" => $xestiascan_lang{$language_selected}{textarearowblank},
1063 "textarearowtoolong" => $xestiascan_lang{$language_selected}{textarearowtoolong},
1064 "textarearowinvalid" => $xestiascan_lang{$language_selected}{textarearowinvalid},
1066 "textareacolsblank" => $xestiascan_lang{$language_selected}{textareacolsblank},
1067 "textareacolstoolong" => $xestiascan_lang{$language_selected}{textareacolstoolong},
1068 "textareacolsinvalid" => $xestiascan_lang{$language_selected}{textareacolsinvalid},
1070 "outputdirectoryblank" => $xestiascan_lang{$language_selected}{outputdirectoryblank},
1071 "outputdirectoryinvalid" => $xestiascan_lang{$language_selected}{outputdirectoryinvalid},
1073 "presmoduleblank" => $xestiascan_lang{$language_selected}{presmoduleblank},
1074 "presmoduleinvalid" => $xestiascan_lang{$language_selected}{presmoduleinvalid},
1076 "authmoduleblank" => $xestiascan_lang{$language_selected}{authmoduleblank},
1077 "authmoduleinvalid" => $xestiascan_lang{$language_selected}{authmoduleinvalid},
1078 "authmoduleinvalidpermissions" => $xestiascan_lang{$language_selected}{authmoduleinvalidpermissions},
1080 "presmodulemissing" => $xestiascan_lang{$language_selected}{presmodulemissing},
1081 "authmodulemissing" => $xestiascan_lang{$language_selected}{authmodulemissing},
1082 "languagefilenamemissing" => $xestiascan_lang{$language_selected}{languagefilenamemissing},
1084 "servernametoolong" => $xestiascan_lang{$language_selected}{servernametoolong},
1085 "servernameinvalid" => $xestiascan_lang{$language_selected}{servernameinvalid},
1086 "serverportnumbertoolong" => $xestiascan_lang{$language_selected}{serverportnumbertoolong},
1087 "serverportnumberinvalidcharacters" => $xestiascan_lang{$language_selected}{serverportnumberinvalidcharacters},
1088 "serverportnumberinvalid" => $xestiascan_lang{$language_selected}{serverportnumberinvalid},
1089 "serverprotocolnametoolong" => $xestiascan_lang{$language_selected}{serverprotocolnametoolong},
1090 "serverprotocolinvalid" => $xestiascan_lang{$language_selected}{serverprotocolinvalid},
1091 "serverdatabasenametoolong" => $xestiascan_lang{$language_selected}{serverdatabasenametoolong},
1092 "serverdatabasenameinvalid" => $xestiascan_lang{$language_selected}{serverdatabasenameinvalid},
1093 "serverdatabaseusernametoolong" => $xestiascan_lang{$language_selected}{serverdatabaseusernametoolong},
1094 "serverdatabaseusernameinvalid" => $xestiascan_lang{$language_selected}{serverdatabaseusernameinvalid},
1095 "serverdatabasepasswordtoolong" => $xestiascan_lang{$language_selected}{serverdatabasepasswordtoolong},
1096 "serverdatabasetableprefixtoolong" => $xestiascan_lang{$language_selected}{serverdatabasetableprefixtoolong},
1097 "serverdatabasetableprefixinvalid" => $xestiascan_lang{$language_selected}{serverdatabasetableprefixinvalid},
1098 "createmodulestoolong" => $xestiascan_lang{$language_selected}{createmodulestoolong},
1099 "createscannerstoolong" => $xestiascan_lang{$language_selected}{createscannerstoolong},
1100 "createsessionstoolong" => $xestiascan_lang{$language_selected}{createsessionstoolong},
1101 "createuserstoolong" => $xestiascan_lang{$language_selected}{createuserstoolong},
1102 "forcerecreatetoolong" => $xestiascan_lang{$language_selected}{forcerecreatetoolong},
1103 "deleteinstalltoolong" => $xestiascan_lang{$language_selected}{deleteinstalltoolong},
1104 "deletemultiusertoolong" => $xestiascan_lang{$language_selected}{deletemultiusertoolong},
1106 "removeinstallscripttoolong" => $xestiascan_lang{$language_selected}{removeinstallscripttoolong},
1107 "cannotwriteconfigurationindirectory" => $xestiascan_lang{$language_selected}{cannotwriteconfigurationindirectory},
1108 "configurationfilereadpermissionsinvalid" => $xestiascan_lang{$language_selected}{configurationfilereadpermissionsinvalid},
1109 "configurationfilewritepermissionsinvalid" => $xestiascan_lang{$language_selected}{configurationfilewritepermissionsinvalid},
1113 # Check if the specified error is blank and if it is
1114 # use the generic error messsage.
1116 if (!$xestiascan_error{$error_type}){
1117 $error_type = "generic";
1120 print "Content-type: text/html; charset=utf-8;\r\n\r\n";
1122 print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
1123 print "<head>\n<title>$xestiascan_lang{$language_selected}{installertitle}</title>\n<style type=\"text/css\" media=\"screen\">$cssstyle</style>\n</head>\n<body>\n";
1125 print "<h2>$xestiascan_lang{$language_selected}{error}</h2>";
1127 print $xestiascan_error{$error_type};
1129 print $xestiascan_lang{$language_selected}{errormessagetext};
1131 print "</body>\n</html>";
1137 sub xestiascan_processconfig{
1138 #################################################################################
1139 # xestiascan_processconfig: Processes an INI style configuration file. #
1143 # xestiascan_processconfig(data); #
1145 # data Specifies the data to process. #
1146 #################################################################################
1148 my (@settings) = @_;
1150 my ($settings_line, %settings, $settings, $sectionname, $setting_name, $setting_value);
1152 foreach $settings_line (@settings){
1154 next if !$settings_line;
1156 # Check if the first character is a bracket.
1158 if (substr($settings_line, 0, 1) eq "["){
1159 $settings_line =~ s/\[//;
1160 $settings_line =~ s/\](.*)//;
1161 $settings_line =~ s/\n//;
1162 $sectionname = $settings_line;
1166 $setting_name = $settings_line;
1167 $setting_value = $settings_line;
1168 $setting_name =~ s/\=(.*)//;
1169 $setting_name =~ s/\n//;
1170 $setting_value =~ s/(.*)\=//;
1171 $setting_value =~ s/\n//;
1173 # Remove the spacing before and after the '=' sign.
1175 $setting_name =~ s/\s+$//;
1176 $setting_value =~ s/^\s+//;
1177 $setting_value =~ s/\r//;
1179 $settings{$sectionname}{$setting_name} = $setting_value;
1187 sub xestiascan_fileexists{
1188 #################################################################################
1189 # xestiascan_fileexists: Check if a file exists and returns a value depending on #
1190 # if the file exists or not. #
1194 # xestiascan_fileexists(filename); #
1196 # filename Specifies the file name to check if it exists or not. #
1197 #################################################################################
1199 # Get the value that was passed to the subroutine.
1201 my ($filename) = @_;
1203 # Check if the filename exists, if it does, return a value of 0, else
1204 # return a value of 1, meaning that the file was not found.
1208 # Specified file does exist so return a value of 0.
1214 # Specified file does not exist so return a value of 1.
1222 sub xestiascan_filepermissions{
1223 #################################################################################
1224 # xestiascan_filepermissions: Check if the file permissions of a file and return #
1225 # either a 1 saying that the permissions are valid or return a 0 saying that #
1226 # the permissions are invalid. #
1230 # xestiascan_filepermissions(filename, [read], [write], [filemissingskip]); #
1232 # filename Specifies the filename to check for permissions. #
1233 # read Preform check that the file is readable. #
1234 # write Preform check that the file is writeable. #
1235 # filemissingskip Skip the check of seeing if it can read or write if the #
1236 # file is missing. #
1237 #################################################################################
1239 # Get the values that was passed to the subroutine.
1241 my ($filename, $readpermission, $writepermission, $ignorechecks) = @_;
1243 # Check to make sure that the read permission and write permission values
1244 # are only 1 character long.
1246 xestiascan_variablecheck($readpermission, "maxlength", 1, 0);
1247 xestiascan_variablecheck($writepermission, "maxlength", 1, 0);
1248 xestiascan_variablecheck($ignorechecks, "maxlength", 1, 0);
1250 my $ignorechecks_result = 0;
1252 # Check if the file should be ignored for read and write checking if
1259 # The file exists so the checks are to be done.
1261 $ignorechecks_result = 0;
1265 # The file does not exist so the checks don't need to
1266 # be done to prevent false positives.
1268 $ignorechecks_result = 1;
1274 $ignorechecks_result = 0;
1278 # Check if the file should be checked to see if it can be read.
1280 if ($readpermission && $ignorechecks_result eq 0){
1282 # The file should be checked to see if it does contain read permissions
1283 # and return a 0 if it is invalid.
1287 # The file is readable, so do nothing.
1291 # The file is not readable, so return 1.
1299 # Check if the file should be checked to see if it can be written.
1301 if ($writepermission && $ignorechecks_result eq 0){
1303 # The file should be checked to see if it does contain write permissions
1304 # and return a 0 if it is invalid.
1308 # The file is writeable, so do nothing.
1312 # The file is not writeable, so return 1.
1320 # No problems have occured, so return 0.
1326 sub xestiascan_settings_load{
1327 #################################################################################
1328 # xestiascan_settings_load: Load the configuration settings into the global #
1333 # xestiascan_settings_load(); #
1334 #################################################################################
1336 # Check if the Xestia Scanner Server configuration file exists before using it and
1337 # return an critical error if it doesn't exist.
1339 my ($xestiascan_settingsfilehandle, @config_data, %config, $config);
1340 my $xestiascan_conf_exist = xestiascan_fileexists("xsdss.cfg");
1342 if ($xestiascan_conf_exist eq 1){
1344 # The configuration really does not exist so return an critical error.
1350 # Check if the Xestia Scanner Server configuration file has valid permission settings
1351 # before using it and return an critical error if it doesn't have the
1352 # valid permission settings.
1354 my $xestiascan_conf_permissions = xestiascan_filepermissions("xsdss.cfg", 1, 0);
1356 if ($xestiascan_conf_permissions eq 1){
1358 # The permission settings for the Xestia Scanner Server configuration file are
1359 # invalid, so return an critical error.
1365 # Converts the file into meaningful data for later on in this subroutine.
1367 my $xestiascan_conf_file = 'xsdss.cfg';
1369 open($xestiascan_settingsfilehandle, $xestiascan_conf_file);
1370 binmode $xestiascan_settingsfilehandle, ':utf8';
1371 @config_data = <$xestiascan_settingsfilehandle>;
1372 %config = xestiascan_processconfig(@config_data);
1373 close($xestiascan_settingsfilehandle);
1375 # Go and fetch the settings and place them into a hash.
1377 %xestiascan_config = (
1379 "system_language" => $config{config}{system_language},
1380 "system_presmodule" => $config{config}{system_presmodule},
1381 "system_authmodule" => $config{config}{system_authmodule},
1382 "system_outputmodule" => $config{config}{system_outputmodule},
1383 "system_datetime" => $config{config}{system_datetime},
1385 "database_server" => $config{config}{database_server},
1386 "database_port" => $config{config}{database_port},
1387 "database_protocol" => $config{config}{database_protocol},
1388 "database_sqldatabase" => $config{config}{database_sqldatabase},
1389 "database_username" => $config{config}{database_username},
1390 "database_password" => $config{config}{database_password},
1391 "database_tableprefix" => $config{config}{database_tableprefix}
1395 # Do a validation check on all of the variables that were loaded into the global configuration hash.
1397 my $xestiascan_config_dbmodule_filename = xestiascan_variablecheck($xestiascan_config{"system_authmodule"}, "module", 0, 1);
1399 # Check if the database module name is valid.
1401 if ($xestiascan_config_dbmodule_filename eq 1){
1403 # The database module filename given is blank so return.
1409 if ($xestiascan_config_dbmodule_filename eq 2){
1411 # The database module filename given is invalid so return
1412 # an critical error.
1418 # Check if the database module does exist before loading it and return an critical error
1419 # if the database module does not exist.
1421 my $xestiascan_config_dbmodule_fileexists = xestiascan_fileexists("Modules/Auth/" . $xestiascan_config{"system_authmodule"} . ".pm");
1423 if ($xestiascan_config_dbmodule_fileexists eq 1){
1425 # Database module does not exist so return an critical error.
1431 # Check if the database module does have the valid permission settings and return an
1432 # critical error if the database module contains invalid permission settings.
1434 my $xestiascan_config_dbmodule_permissions = xestiascan_filepermissions("Modules/Auth/" . $xestiascan_config{"system_authmodule"} . ".pm", 1, 0);
1436 if ($xestiascan_config_dbmodule_permissions eq 1){
1438 # Presentation module contains invalid permissions so return an critical error.
1448 sub xestiascan_addtablerow{
1449 #################################################################################
1450 # xestiascan_addtablerow: Adds a table row. #
1454 # xestiascan_addtablerow(name, data); #
1456 # name Specifies the name of the table row. #
1457 # namestyle Specifies the style for the name of the table row. #
1458 # data Specifies the data to be used in the table row. #
1459 # datastyle Specifies the style for the data of the table row. #
1460 #################################################################################
1462 my ($name, $namestyle, $data, $datastyle) = @_;
1471 print "<td class=\"$namestyle\">$name</td>\n";
1472 print "<td class=\"$datastyle\">$data</td>\n";
1477 #################################################################################
1478 # End list of subroutines. #
1479 #################################################################################
1481 # Process the list of available languages.
1483 my $language_list_name;
1484 my @language_list_short;
1485 my @language_list_long;
1487 foreach my $language (keys %xestiascan_lang){
1489 $language_list_name = $xestiascan_lang{$language}{"languagename"} . " (" . $language . ")";
1490 push(@language_list_short, $language);
1491 push(@language_list_long, $language_list_name);
1495 my $http_query_confirm = $form_data->{'confirm'};
1497 $http_query_confirm = 0 if !$http_query_confirm;
1499 if ($http_query_confirm eq 1){
1501 # The action to create the tables has been confirmed. Get
1502 # the required values.
1504 my $http_query_authmodule = $form_data->{'authmodule'};
1506 my $http_query_databaseserver = $form_data->{'databaseserver'};
1507 my $http_query_databaseport = $form_data->{'databaseport'};
1508 my $http_query_databaseprotocol = $form_data->{'databaseprotocol'};
1509 my $http_query_databasename = $form_data->{'databasename'};
1510 my $http_query_databaseusername = $form_data->{'databaseusername'};
1511 my $http_query_databasepassword = $form_data->{'databasepassword'};
1512 my $http_query_databasetableprefix = $form_data->{'databasetableprefix'};
1514 my $http_query_adminusername = $form_data->{'multiuseradminusername'};
1515 my $http_query_adminpassword = $form_data->{'multiuseradminpassword'};
1517 my $http_query_createmodules = $form_data->{'createmodules'};
1518 my $http_query_createscanners = $form_data->{'createscanners'};
1519 my $http_query_createsessions = $form_data->{'createsessions'};
1520 my $http_query_createusers = $form_data->{'createusers'};
1522 my $http_query_forcerecreate = $form_data->{'forcerecreate'};
1524 my $http_query_deleteinstall = $form_data->{'deleteinstall'};
1525 my $http_query_deletemultiuser = $form_data->{'deleteinstallmultiuser'};
1527 # Check the data that has been passed to the multiuser installer.
1529 if (!$http_query_createmodules){
1531 $http_query_createmodules = "off";
1535 if (!$http_query_createscanners){
1537 $http_query_createscanners = "off";
1541 if (!$http_query_createsessions){
1543 $http_query_createsessions = "off";
1547 if (!$http_query_createusers){
1549 $http_query_createusers = "off";
1553 if (!$http_query_forcerecreate){
1555 $http_query_forcerecreate = "off";
1559 if (!$http_query_deleteinstall){
1561 $http_query_deleteinstall = "off";
1565 if (!$http_query_deletemultiuser){
1567 $http_query_deletemultiuser = "off";
1571 my $xestiascan_authmodule_modulename_check = xestiascan_variablecheck($http_query_authmodule, "module", 0, 1);
1572 my $xestiascan_databaseserver_length_check = xestiascan_variablecheck($http_query_databaseserver, "maxlength", 128, 1);
1573 my $xestiascan_databaseserver_lettersnumbers_check = xestiascan_variablecheck($http_query_databaseserver, "lettersnumbers", 0, 1);
1574 my $xestiascan_databaseport_length_check = xestiascan_variablecheck($http_query_databaseport, "maxlength", 5, 1);
1575 my $xestiascan_databaseport_numbers_check = xestiascan_variablecheck($http_query_databaseport, "numbers", 0, 1);
1576 my $xestiascan_databaseport_port_check = xestiascan_variablecheck($http_query_databaseport, "port", 0, 1);
1577 my $xestiascan_databaseprotocol_length_check = xestiascan_variablecheck($http_query_databaseprotocol, "maxlength", 5, 1);
1578 my $xestiascan_databaseprotocol_protocol_check = xestiascan_variablecheck($http_query_databaseprotocol, "serverprotocol", 0, 1);
1579 my $xestiascan_databasename_length_check = xestiascan_variablecheck($http_query_databasename, "maxlength", 32, 1);
1580 my $xestiascan_databasename_lettersnumbers_check = xestiascan_variablecheck($http_query_databasename, "lettersnumbers", 0, 1);
1581 my $xestiascan_databaseusername_length_check = xestiascan_variablecheck($http_query_databaseusername, "maxlength", 16, 1);
1582 my $xestiascan_databaseusername_lettersnumbers_check = xestiascan_variablecheck($http_query_databaseusername, "lettersnumbers", 0, 1);
1583 my $xestiascan_databasepassword_length_check = xestiascan_variablecheck($http_query_databasepassword, "maxlength", 64, 1);
1584 my $xestiascan_databasetableprefix_length_check = xestiascan_variablecheck($http_query_databasetableprefix, "maxlength", 16, 1);
1585 my $xestiascan_databasetableprefix_lettersnumbers_check = xestiascan_variablecheck($http_query_databasetableprefix, "lettersnumbers", 0, 1);
1587 if ($xestiascan_authmodule_modulename_check eq 1){
1589 # The database module name is blank, so return
1592 xestiascan_error("authmoduleblank");
1596 if ($xestiascan_authmodule_modulename_check eq 2){
1598 # The database module name is invalid, so return
1601 xestiascan_error("authmoduleinvalid");
1605 if (!-e "Modules/Auth/" . $http_query_authmodule . ".pm"){
1607 # The database module is missing so return an
1610 xestiascan_error("authmodulemissing");
1614 if ($xestiascan_databaseserver_length_check eq 1){
1616 # The length of the database server name is too long so
1619 xestiascan_error("servernametoolong");
1623 if ($xestiascan_databaseserver_lettersnumbers_check eq 1){
1625 # The database server name contains characters other
1626 # than letters and numbers, so return an error.
1628 xestiascan_error("servernameinvalid");
1632 if ($xestiascan_databaseport_length_check eq 1){
1634 # The database port number length is too long so return
1637 xestiascan_error("serverportnumbertoolong");
1641 if ($xestiascan_databaseport_numbers_check eq 1){
1643 # The database port number contains characters other
1644 # than numbers so return an error.
1646 xestiascan_error("serverportnumberinvalidcharacters");
1650 if ($xestiascan_databaseport_port_check eq 1){
1652 # The database port number given is invalid so return
1655 xestiascan_error("serverportnumberinvalid");
1659 if ($xestiascan_databaseprotocol_length_check eq 1){
1661 # The database protocol name given is too long so
1664 xestiascan_error("serverprotocolnametoolong");
1668 if ($xestiascan_databaseprotocol_protocol_check eq 1){
1670 # The server protcol given is invalid so return
1673 xestiascan_error("serverprotocolinvalid");
1677 if ($xestiascan_databasename_length_check eq 1){
1679 # The SQL database name is too long so return
1682 xestiascan_error("serverdatabasenametoolong");
1686 if ($xestiascan_databasename_lettersnumbers_check eq 1){
1688 # The database name contains invalid characters
1689 # so return an error.
1691 xestiascan_error("serverdatabasenameinvalid");
1695 if ($xestiascan_databaseusername_length_check eq 1){
1697 # The database username given is too long so
1700 xestiascan_error("serverdatabaseusernametoolong");
1704 if ($xestiascan_databaseusername_lettersnumbers_check eq 1){
1706 # The database username contains invalid characters
1707 # so return an error.
1709 xestiascan_error("serverdatabaseusernameinvalid");
1713 if ($xestiascan_databasepassword_length_check eq 1){
1715 # The database password given is too long so return
1718 xestiascan_error("serverdatabasepasswordtoolong");
1722 if ($xestiascan_databasetableprefix_length_check eq 1){
1724 # The database table prefix given is too long so
1727 xestiascan_error("serverdatabasetableprefixtoolong");
1731 if ($xestiascan_databasetableprefix_lettersnumbers_check eq 1){
1733 # The database table prefix given contains invalid
1734 # characters so return an error.
1736 xestiascan_error("serverdatabasetableprefixinvalid");
1740 # Check the admin username and password to make sure they have valid UTF-8.
1742 xestiascan_variablecheck($http_query_adminusername, "utf8", 0, 0);
1743 xestiascan_variablecheck($http_query_adminpassword, "utf8", 0, 0);
1745 # Check the checkable values.
1747 my $xestiascan_createmodules_length_check = xestiascan_variablecheck($http_query_createmodules, "maxlength", 3, 1);
1748 my $xestiascan_createscanners_length_check = xestiascan_variablecheck($http_query_createscanners, "maxlength", 3, 1);
1749 my $xestiascan_createsessions_length_check = xestiascan_variablecheck($http_query_createsessions, "maxlength", 3, 1);
1750 my $xestiascan_createusers_length_check = xestiascan_variablecheck($http_query_createusers, "maxlength", 3, 1);
1751 my $xestiascan_forcerecreate_length_check = xestiascan_variablecheck($http_query_forcerecreate, "maxlength", 3, 1);
1752 my $xestiascan_deleteinstall_length_check = xestiascan_variablecheck($http_query_deleteinstall, "maxlength", 3, 1);
1753 my $xestiascan_deletemultiuser_length_check = xestiascan_variablecheck($http_query_deletemultiuser, "maxlength", 3, 1);
1755 if ($xestiascan_createmodules_length_check eq 1){
1757 xestiascan_error("createmodulestoolong");
1761 if ($xestiascan_createscanners_length_check eq 1){
1763 xestiascan_error("createscannerstoolong");
1767 if ($xestiascan_createsessions_length_check eq 1){
1769 xestiascan_error("createsessionstoolong");
1773 if ($xestiascan_createusers_length_check eq 1){
1775 xestiascan_error("createuserstoolong");
1779 if ($xestiascan_forcerecreate_length_check eq 1){
1781 xestiascan_error("forcerecreatetoolong");
1785 if ($xestiascan_deleteinstall_length_check eq 1){
1787 xestiascan_error("deleteinstalltoolong");
1791 if ($xestiascan_deletemultiuser_length_check eq 1){
1793 xestiascan_error("deletemultiusertoolong");
1797 # Check to see if the tables need to be recreated forcibly.
1799 my $forcerecreate = 0;
1801 if ($http_query_forcerecreate eq "on"){
1807 # Load the authentication module. Double check to make sure
1808 # it really is a multiuser module and throw an error if not.
1810 my $authmodule_fullname = "Auth::" . $http_query_authmodule;
1811 ($authmodule_fullname) = $authmodule_fullname =~ m/^(.*)$/g; # CHECK THIS!!
1812 eval "use " . $authmodule_fullname;
1813 $authmodule_fullname = "Modules::Auth::" . $http_query_authmodule;
1814 my $authmodule = $authmodule_fullname->new();
1816 my %authmodule_capabilities = $authmodule->capabilities();
1818 if ($authmodule_capabilities{'multiuser'} ne 1){
1820 # Return an error, this module is not a multiuser module.
1822 xestiascan_error("notmultiuser");
1826 # Check if password value is blank and load settings files
1827 # if this is the case.
1829 if (!$http_query_databasepassword){
1831 if (xestiascan_settings_load eq 0){
1833 $http_query_databasepassword = $xestiascan_config{"database_password"};
1839 # Load the settings for the database server.
1841 $authmodule->loadsettings({ DateTime => "DD/MM/YY hh:mm:ss", Server => $http_query_databaseserver, Port => $http_query_databaseport, Protocol => $http_query_databaseprotocol, Database => $http_query_databasename, Username => $http_query_databaseusername, Password => $http_query_databasepassword, TablePrefix => $http_query_databasetableprefix });
1843 # Connect to the database server.
1845 $authmodule->connect();
1847 if ($authmodule->geterror eq "AuthConnectionError"){
1849 # A database connection error has occured so return
1852 print "Content-Type: text/html; charset=utf-8;\r\n\r\n";
1853 print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
1854 print "<head>\n<title>$xestiascan_lang{$language_selected}{installertitle}</title>\n";
1855 print "<style type=\"text/css\" media=\"screen\">$cssstyle</style>\n</head>\n<body>";
1857 print "<div class=\"topbar\">
1858 <span class=\"title\">" . $xestiascan_lang{$language_selected}{installertitle} . "</span>";
1861 print "<div class=\"pagespacing\">";
1862 print $xestiascan_lang{$language_selected}{autherroroccured} . $authmodule->geterror(1);
1869 # Print the header part.
1871 print "Content-type: text/html; charset=utf-8;\r\n\r\n";
1873 print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
1874 print "<head>\n<title>$xestiascan_lang{$language_selected}{installertitle}</title>\n";
1875 print "<style type=\"text/css\" media=\"screen\">$cssstyle</style>\n</head>\n<body>";
1877 print "<div class=\"topbar\">
1878 <span class=\"title\">" . $xestiascan_lang{$language_selected}{installertitle} . "</span>";
1881 print "<div class=\"pagespacing\">\n";
1882 print "<span class=\"pageheader\">$xestiascan_lang{$language_selected}{installertitle}</span><br /><br />\n";
1884 print $xestiascan_lang{$language_selected}{multiuserresults} . "<br /><br />";
1886 # Create/Recreate the tables as needed.
1888 if ($forcerecreate eq 1){
1890 print $xestiascan_lang{$language_selected}{forciblyrecreated};
1894 print $xestiascan_lang{$language_selected}{notforciblyrecreated};
1898 print "<br /><br />";
1900 # Create/Recreate the modules permissions table.
1902 if ($http_query_createmodules eq "on"){
1904 $authmodule->populatetables("modules", $forcerecreate);
1906 if ($authmodule->geterror eq "DatabaseError"){
1908 print $xestiascan_lang{$language_selected}{modulestableerror} . $authmodule->geterror(1) . "<br />";
1912 print $xestiascan_lang{$language_selected}{modulestablesuccess} . "<br />";
1918 # Create/Recreate the scanners permissions table.
1920 if ($http_query_createscanners eq "on"){
1922 $authmodule->populatetables("scanners", $forcerecreate);
1924 if ($authmodule->geterror eq "DatabaseError"){
1926 print $xestiascan_lang{$language_selected}{scannerstableerror} . $authmodule->geterror(1) . "<br />";
1930 print $xestiascan_lang{$language_selected}{scannerstablesuccess} . "<br />";
1936 # Create/Recreate the sessions permissions table.
1938 if ($http_query_createsessions eq "on"){
1940 $authmodule->populatetables("sessions", $forcerecreate);
1942 if ($authmodule->geterror eq "DatabaseError"){
1944 print $xestiascan_lang{$language_selected}{sessionstableerror} . $authmodule->geterror(1) . "<br />";
1948 print $xestiascan_lang{$language_selected}{sessionstablesuccess} . "<br />";
1954 # Create/Recreate the users table.
1956 if ($http_query_createusers eq "on"){
1958 $authmodule->populatetables("users", $forcerecreate);
1960 if ($authmodule->geterror eq "DatabaseError"){
1962 print $xestiascan_lang{$language_selected}{userstableerror} . $authmodule->geterror(1) . "<br />";
1966 print $xestiascan_lang{$language_selected}{userstablesuccess} . "<br />";
1968 # Since the users table was created, add the Administrative account.
1970 my (%userinfo, $userinfo);
1972 $userinfo{Username} = $http_query_adminusername;
1973 $userinfo{Name} = "Administrator";
1974 $userinfo{Password} = $http_query_adminpassword;
1975 $userinfo{Enabled} = "on";
1976 $userinfo{Admin} = "on";
1978 $authmodule->adduser($http_query_adminusername, %userinfo);
1980 if ($authmodule->geterror eq "DatabaseError"){
1982 print $xestiascan_lang{$language_selected}{adminaccounterror} . $authmodule->geterror(1) . "<br />";
1986 print $xestiascan_lang{$language_selected}{adminaccountsuccess} . "<br />";
1996 # Check if the scripts need deleting.
1998 my $installscriptmessage;
2000 if ($http_query_deleteinstall eq "on"){
2002 if (unlink($originstallscriptname)){
2004 print $xestiascan_lang{$language_selected}{installscriptremoved} . "<br />";
2008 $installscriptmessage = $xestiascan_lang{$language_selected}{cannotremoveinstallerscript};
2009 $installscriptmessage =~ s/%s/$!/g;
2011 print $installscriptmessage . "<br />";
2017 print $xestiascan_lang{$language_selected}{installscriptkept} . "<br />";
2021 if ($http_query_deletemultiuser eq "on"){
2023 if (unlink($installscriptname)){
2025 print $xestiascan_lang{$language_selected}{multiuserscriptremoved} . "<br />";
2029 $installscriptmessage = $xestiascan_lang{$language_selected}{cannotremovemultiuserinstallerscript};
2030 $installscriptmessage =~ s/%s/$!/g;
2032 print $installscriptmessage . "<br />";
2038 print $xestiascan_lang{$language_selected}{multiuserinstallscriptkept} . "<br />";
2044 print $xestiascan_lang{$language_selected}{usexestiascannerservertext} . "<br /><br />";
2046 print "<a href=\"" . $xestiascanscriptname . "\">$xestiascan_lang{$language_selected}{usexestiascannerserverlink}</a>";
2054 # Load the configuration file and get the required settings.
2056 # Check to see if the settings file is valid.
2058 # Get the list of database modules.
2060 opendir(DATABASEDIR, "Modules/Auth");
2061 my @dbmodule_directory = grep /m*\.pm$/, readdir(DATABASEDIR);
2062 closedir(DATABASEDIR);
2064 my @database_modules;
2066 foreach my $dbmodule_file (@dbmodule_directory){
2068 # Get the friendly name for the database module.
2070 next if $dbmodule_file =~ m/^\./;
2071 next if $dbmodule_file !~ m/.pm$/;
2072 $dbmodule_file =~ s/.pm$//g;
2073 push(@database_modules, $dbmodule_file);
2078 # Check to see if the database module does support a multiuser configuration.
2081 my $dbmodule_out = "";
2082 my @dbmodule_multiuser;
2083 my $dbmodule_fullname;
2084 my %dbmodule_capabilities;
2087 foreach my $dbmodule_file (@database_modules){
2089 # Load the module and see if has multiuser support and
2090 # if it has then add it to the list of multiuser supported
2091 # database modules and then unload it.
2093 my $dbmodule_fullname = "Auth::" . $dbmodule_file;
2094 ($dbmodule_fullname) = $dbmodule_fullname =~ m/^(.*)$/g; # CHECK THIS!!
2095 eval "use " . $dbmodule_fullname;
2096 $dbmodule_fullname = "Modules::Auth::" . $dbmodule_file;
2097 $dbmodule = $dbmodule_fullname->new();
2099 %dbmodule_capabilities = $dbmodule->capabilities();
2103 push(@dbmodule_multiuser, $dbmodule_file) if $dbmodule_capabilities{'multiuser'} eq 1;
2107 # Print out a form specifying if the users and/or sessions table should be created.
2109 my $config_fail = 0;
2111 if (xestiascan_settings_load ne 0){
2117 $default_dbmodule = $xestiascan_config{system_authmodule};
2118 $default_server = $xestiascan_config{database_server};
2119 $default_port = $xestiascan_config{database_port};
2120 $default_protocol = $xestiascan_config{database_protocol};
2121 $default_name = $xestiascan_config{database_sqldatabase};
2122 $default_username = $xestiascan_config{database_username};
2123 $default_prefix = $xestiascan_config{database_tableprefix};
2127 print "Content-type: text/html; charset=utf-8;\r\n\r\n";
2129 print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
2130 print "<head>\n<title>$xestiascan_lang{$language_selected}{installertitle}</title>\n";
2131 print "<style type=\"text/css\" media=\"screen\">$cssstyle</style>\n</head>\n<body>";
2133 # Start language bar.
2135 print "<div class=\"topbar\">
2136 <span class=\"title\">" . $xestiascan_lang{$language_selected}{installertitle} . "</span>";
2138 my $language_name_short;
2139 my $language_list_seek = 0;
2140 my $installlanguage_out = "";
2142 $installlanguage_out = "<select name=\"installlanguage\">\n";
2144 foreach $language_name_short (@language_list_short){
2146 $installlanguage_out = $installlanguage_out . "<option value=\"" . $language_name_short . "\">" . $language_list_long[$language_list_seek] . "</option>\n";
2147 $language_list_seek++;
2151 $installlanguage_out = $installlanguage_out . "</select>\n";
2153 print "<form action=\"" . $installscriptname . "\" method=\"POST\">\n$installlanguage_out\n<input type=\"submit\" value=\"$xestiascan_lang{$language_selected}{switch}\">\n</form>\n";
2156 print "<div class=\"pagespacing\">";
2158 print "<span class=\"pageheader\">$xestiascan_lang{$language_selected}{installertitle}</span><br /><br />\n";
2159 print $xestiascan_lang{$language_selected}{installertext};
2161 print "<br /><br />";
2163 if ($config_fail eq 1){
2165 print $xestiascan_lang{$language_selected}{invalidconfigfile};
2166 print "<br /><br />";
2170 print "<form action=\"" . $installscriptname . "\" method=\"POST\">";
2171 print "<input type=\"hidden\" name=\"confirm\" value=\"1\">\n<input type=\"hidden\" name=\"installlanguage\" value=\"$language_selected\">\n";
2173 # End of language bar, begin main installer part.
2175 print "<table width=\"100%\">";
2176 xestiascan_addtablerow($xestiascan_lang{$language_selected}{authsettings}, "tablecellheader", "", "tablecellheader");
2178 $dbmodule_out = "<select name=\"authmodule\">";
2180 foreach my $dbmodule_file (@dbmodule_multiuser){
2181 if ($default_dbmodule eq $dbmodule_file){
2182 $dbmodule_out = $dbmodule_out . "<option value=\"$dbmodule_file\" selected>$dbmodule_file</option>";
2184 $dbmodule_out = $dbmodule_out . "<option value=\"$dbmodule_file\">$dbmodule_file</option>";
2188 $dbmodule_out = $dbmodule_out . "</select><br />" . $xestiascan_lang{$language_selected}{multiuseronly};
2190 xestiascan_addtablerow($xestiascan_lang{$language_selected}{authenticationmodule}, "tablename", $dbmodule_out, "tabledata");
2191 xestiascan_addtablerow($xestiascan_lang{$language_selected}{databaseserver}, "tablename", "<input type=\"text\" name=\"databaseserver\" size=\"32\" maxlength=\"128\" value=\"$default_server\">\n", "tabledata");
2192 xestiascan_addtablerow($xestiascan_lang{$language_selected}{databaseport}, "tablename", "<input type=\"text\" name=\"databaseport\" maxlength=\"5\" size=\"5\" value=\"$default_port\">\n", "tabledata");
2193 xestiascan_addtablerow($xestiascan_lang{$language_selected}{databaseprotocol}, "tablename", "<select name=\"databaseprotocol\">\n<option value=\"tcp\">tcp</option>\n<option value=\"udp\">udp</option>\n</select>\n", "tabledata");
2194 xestiascan_addtablerow($xestiascan_lang{$language_selected}{databasename}, "tablename", "<input type=\"text\" name=\"databasename\" size=\"32\" maxlength=\"32\" value=\"$default_name\">\n", "tabledata");
2195 xestiascan_addtablerow($xestiascan_lang{$language_selected}{databaseusername}, "tablename", "<input type=\"text\" name=\"databaseusername\" size=\"16\" maxlength=\"16\" value=\"$default_username\">\n", "tabledata");
2196 xestiascan_addtablerow($xestiascan_lang{$language_selected}{databasepassword}, "tablename", "<input type=\"password\" name=\"databasepassword\" size=\"32\" maxlength=\"64\"><br />Leave password blank to use password in configuration file.\n", "tabledata");
2197 xestiascan_addtablerow($xestiascan_lang{$language_selected}{databasetableprefix}, "tablename", "<input type=\"text\" name=\"databasetableprefix\" size=\"32\" maxlength=\"32\" value=\"$default_prefix\">\n", "tabledata");
2199 xestiascan_addtablerow($xestiascan_lang{$language_selected}{adminuseraccountsettings}, "tablecellheader", "", "tablecellheader");
2200 xestiascan_addtablerow($xestiascan_lang{$language_selected}{adminusername}, "tablename", "<input type=\"text\" name=\"multiuseradminusername\" size=\"32\" maxlength=\"32\" value=\"$xestiascan_lang{$language_selected}{adminaccountname}\">", "tabledata");
2201 xestiascan_addtablerow($xestiascan_lang{$language_selected}{adminpassword}, "tablename", "<input type=\"password\" name=\"multiuseradminpassword\" size=\"32\" maxlength=\"128\" value=\"$xestiascan_lang{$language_selected}{adminaccountpassword}\">", "tabledata");
2203 xestiascan_addtablerow($xestiascan_lang{$language_selected}{installationoptions}, "tablecellheader", "", "tablecellheader");
2204 xestiascan_addtablerow($xestiascan_lang{$language_selected}{createtables}, "tablename", "<input type=\"checkbox\" name=\"createmodules\" checked>" . $xestiascan_lang{$language_selected}{createtablemodulepermissions} . "<br /><input type=\"checkbox\" name=\"createscanners\" checked>" . $xestiascan_lang{$language_selected}{createtablescannerspermissions} . "<br /><input type=\"checkbox\" name=\"createsessions\" checked>" . $xestiascan_lang{$language_selected}{createtablesessions} . "<br /><input type=\"checkbox\" name=\"createusers\" checked>" . $xestiascan_lang{$language_selected}{createtableusers} . "<br />", "tabledata");
2205 xestiascan_addtablerow($xestiascan_lang{$language_selected}{forcerecreate}, "tablename", "<input type=\"checkbox\" name=\"forcerecreate\">" . $xestiascan_lang{$language_selected}{forcerecreatetables}, "tabledata");
2206 xestiascan_addtablerow($xestiascan_lang{$language_selected}{deleteinstallscripts}, "tablename", "<input type=\"checkbox\" name=\"deleteinstall\" checked>" . $xestiascan_lang{$language_selected}{removeinstallscript} . "<br /><input type=\"checkbox\" name=\"deleteinstallmultiuser\" checked>" . $xestiascan_lang{$language_selected}{removemultiuserinstallscript} . "<br /><br /><b>" . $xestiascan_lang{$language_selected}{warningmessage} . $xestiascan_lang{$language_selected}{recommendremoving} . "</b>", "tabledata");
2210 print "<input type=\"submit\" value=\"Create tables\"> | <input type=\"reset\" value=\"Reset settings\">";
2212 print "</form></div>";
2214 print "</body></html>";