Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Forked Xestia Scanner Server!
[xestiascansrv/.git] / cgi-files / xsdss.cgi
1 #!/usr/bin/perl -w
3 #################################################################################
4 # Xestia Scanner Server (xsdss.cgi)                                             #
5 # Main program script                                                           #
6 #                                                                               #
7 # Version: 0.1.0                                                                #
8 #                                                                               #
9 # Copyright (C) 2005-2011 Steve Brokenshire <sbrokenshire@xestia.co.uk>         #
10 #                                                                               #
11 # This code has been forked from Kiriwrite <http://xestia.co.uk/kiriwrite>.     #
12 # Save development time, recycle your code where possible!                      #
13 #                                                                               #
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.                       #
17 #                                                                               #
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.                                  #
22 #                                                                               #
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;
28 use warnings;
30 use utf8;
31 use CGI::Lite;
32 use Tie::IxHash;
33 use MIME::Base64 3.13 qw(decode_base64url);
35 binmode STDOUT, ':utf8';
37 # This is commented out because it uses a fair bit of CPU usage.
39 #use CGI::Carp('fatalsToBrowser');      # Output errors to the browser.
41 # Declare global variables for Xestia Scanner Server settings and languages.
43 our ($xestiascan_config, %xestiascan_config, %xestiascan_lang, $xestiascan_lang, $xestiascan_version, %xestiascan_version, $xestiascan_env, %xestiascan_env, $xestiascan_presmodule, $xestiascan_authmodule, $xestiascan_script_name, $xestiascan_env_path);
44 our ($form_data, %form_data);
45 our ($loggedin_user);
46 our $successful_auth = 0;
48 # If you are using mod_perl please change these settings to the correct
49 # directory where this script is being run from.
51 use lib '.';
52 chdir('.');
54 # Load the common functions module.
56 use Modules::System::Common;
58 # Setup the version information for Xestia Scanner Version.
60 %xestiascan_version = (
61         "major"         => 0,
62         "minor"         => 1,
63         "revision"      => 0
64 );
66 xestiascan_initialise;          # Initialise the Xestia Scanner Server enviroment.
67 xestiascan_settings_load;       # Load the configuration options.
69 my $query_lite = new CGI::Lite;
70 $form_data = $query_lite->parse_form_data();
72 # Check to see if the user is logged in and present a form if not.
74 use Modules::System::Auth;
76 # Check to see if the module is a multiuser module.
78 my %authmodule_capabilities = $xestiascan_authmodule->capabilities();
80 if ($authmodule_capabilities{'multiuser'} eq 0){
81         
82         # Module does not have multiuser support so don't do
83         # any authentication.
84         
85         $successful_auth = 1;
86         
87 }
89 my $auth_username = "";
90 my $auth_password = "";
91 my $auth_seed = "";
92 my $auth_stayloggedin = "";
93 my $auth_validinput = 1;
94 my $cookie_expirestime = 0;
95 my $auth_failure = int(0);
96 my $print_cookie = 0;
97 my $auth_result = "none";
98         
99 my $cookie_data = $query_lite->parse_cookies;
101 $auth_username  = decode_base64url($cookie_data->{ $main::xestiascan_config{'database_tableprefix'} . '_auth_username'});
102 $auth_seed      = $cookie_data->{ $main::xestiascan_config{'database_tableprefix'} . '_auth_seed'};
104 if (!$auth_username || !$auth_seed){
106         # The authentication data contains invalid input.
107         
108         $auth_validinput = 0;
109         
112 # Check to see if the username and seed are valid and
113 # skip to the login form if it isn't.
114         
115 if ($auth_validinput eq 1){
116         
117         # Connect to the database server and authenticate.
118         
119         $xestiascan_authmodule->connect();
121         # Check if any errors occured while connecting to the database server.
122         
123         if ($main::xestiascan_authmodule->geterror eq "AuthConnectionError"){
124                 
125                 # A database connection error has occured so return
126                 # an error.
127                 
128                 xestiascan_error("authconnectionerror", $main::xestiascan_authmodule->geterror(1));
129                 
130         }
131         
132         $auth_result = $xestiascan_authmodule->userauth("seed", $auth_username, $auth_seed);
133         
134         if ($xestiascan_authmodule->geterror eq "DatabaseError"){
135                         
136                 # A database error has occured so return an error with
137                 # the extended error information.
138                         
139                 xestiascan_error("autherror", $main::xestiascan_authmodule->geterror(1));
140                         
141         }
142                 
143         $successful_auth = 1 if $auth_result eq 1;
144         $auth_failure = 1 if $auth_result ne 1;
145         $auth_failure = 0 if (!$auth_seed || $auth_seed eq "");
146         
147         # Disconnect from the database server.
148         
149         #$xestiascan_authmodule->disconnect();
150                 
153 if ($form_data->{'mode'} && $form_data->{'mode'} eq "auth" && $successful_auth eq 0){
154         
155         $auth_username          = $form_data->{'username'};
156         $auth_password          = $form_data->{'password'};
157         $auth_stayloggedin      = $form_data->{'stayloggedin'};
158         
159         if (!$auth_stayloggedin || $auth_stayloggedin ne "on"){
160                 
161                 $auth_stayloggedin = 0;
162                 $cookie_expirestime = 10800;
163                 
164         } else {
165                 
166                 $auth_stayloggedin = 1;
167                 $cookie_expirestime = 31536000;
168                 
169         }
171         $xestiascan_authmodule->connect();
173         # Check if any errors occured while connecting to the database server.
174         
175         if ($main::xestiascan_authmodule->geterror eq "AuthConnectionError"){
176                 
177                 # A database connection error has occured so return
178                 # an error.
179                 
180                 xestiascan_error("authconnectionerror", $main::xestiascan_authmodule->geterror(1));
181                 
182         }
183         
184         ($auth_result, $auth_seed)      = $xestiascan_authmodule->userauth("password", $auth_username, $auth_password, $auth_stayloggedin);
185         
186         if ($xestiascan_authmodule->geterror eq "DatabaseError"){
187                 
188                 # A database error has occured so return an error with
189                 # the extended error information.
190                 
191                 xestiascan_error("autherror", $main::xestiascan_authmodule->geterror(1));
192                 
193         }
194         
195         $successful_auth = 1 if $auth_result eq 1;
196         $auth_failure = 1 if $auth_result ne 1;
198         # Disconnect from the database server.
199         
200         #$xestiascan_authmodule->disconnect();
201         
202         $form_data->{'mode'} = "";
204         $print_cookie = 1;
205         
208 if ($successful_auth eq 0) {
210         # No valid authenication credentials are available so write a form.
211         
212         my $authpagedata = xestiascan_auth_authenticate($auth_failure);
214         xestiascan_output_header;
215         xestiascan_output_page("Login", $authpagedata, "none");
216         exit;
217         
220 if ($successful_auth eq 1){
222         $loggedin_user = $auth_username;
223         
226 # endif
228 # Check if a mode has been specified and if a mode has been specified, continue
229 # and work out what mode has been specified.
231 if ($form_data->{'mode'}){
232         my $http_query_mode = $form_data->{'mode'};
234         if ($http_query_mode eq "scan"){
236                 use Modules::System::Scan;
237                 
238                 if ($form_data->{'action'}){
239                 
240                         my $http_query_action = $form_data->{'action'};
241                         
242                         if ($http_query_action eq "scan"){
243                         
244                                 my $http_query_previewdocument = $form_data->{'previewdocument'};
245                                 my $http_query_switch = $form_data->{'switch'};
247                                 $http_query_previewdocument = "no" if !$http_query_previewdocument;
248                                 $http_query_switch = "no" if !$http_query_switch;
249                                 
250                                 # Get the variables needed for the subroutine.
251                                 
252                                 my %previewoptions;
253                                 
254                                 $previewoptions{ScannerID} = $form_data->{'scanner'};
255                                 $previewoptions{Brightness} = $form_data->{'brightness'};
256                                 $previewoptions{Contrast} = $form_data->{'contrast'};
257                                 $previewoptions{Rotate} = $form_data->{'rotate'};
258                                 $previewoptions{Colour} = $form_data->{'colourtype'};
259                                 $previewoptions{Resolution} = $form_data->{'imagedpi'};
260                                 $previewoptions{TopLeftX} = $form_data->{'topleftx'};
261                                 $previewoptions{TopLeftY} = $form_data->{'toplefty'};
262                                 $previewoptions{BottomRightX} = $form_data->{'bottomrightx'};
263                                 $previewoptions{BottomRightY} = $form_data->{'bottomrighty'};
264                                 
265                                 $previewoptions{TopLeftX} = "0" if !$previewoptions{TopLeftX};
266                                 
267                                 if ($http_query_switch eq "switched"){
268                                 
269                                         # Switching scanners so don't need to scan.
270                                         
271                                         my $pagedata = xestiascan_scan_preview("off", %previewoptions);
273                                         # Output the header to browser/console/stdout.
274                                         
275                                         xestiascan_output_header;
276                                         xestiascan_output_page($xestiascan_lang{scan}{scanconfig}, $pagedata, "database");      # Output the page to browser/console/stdout.
277                                         exit;   # End the script.
278                                         
279                                 }
280                                 
281                                 if ($http_query_previewdocument eq "on"){
282                                         
283                                         # No action specified so write out default form.
284                                         
285                                         my $pagedata = xestiascan_scan_preview("on", %previewoptions);
286                                         
287                                         # Output the header to browser/console/stdout.
288                                         
289                                         xestiascan_output_header;
290                                         xestiascan_output_page($xestiascan_lang{scan}{scanconfig}, $pagedata, "database");      # Output the page to browser/console/stdout.
291                                         exit;   # End the script.
292                         
293                                 } else {
295                                         my $http_query_outputformat = $form_data->{'outputformat'};
296                                         my $http_query_formatswitch = $form_data->{'formatswitch'};
297                                         my $http_query_confirm = $form_data->{'confirm'};
298                                         my $http_query_imagehex = $form_data->{'imagehex'};
299                                         
300                                         $http_query_formatswitch = "no" if !$http_query_formatswitch;
301                                         $previewoptions{Switched} = $http_query_formatswitch;
302                                         
303                                         if (!$http_query_confirm){
304                                                 $http_query_confirm = 0;
305                                         }
306                                         
307                                         if ($http_query_formatswitch eq "yes"){
308                                                 $http_query_confirm = 0;
309                                         }
310                                         
311                                         $previewoptions{ImageHex} = $http_query_imagehex if $http_query_imagehex;
312                                         $previewoptions{OutputFormat} = $http_query_outputformat if $http_query_outputformat;
313                                         
314                                         my $pagedata = xestiascan_scan_final($http_query_confirm, %previewoptions);
315                         
316                                         xestiascan_output_header;
317                                         xestiascan_output_page($xestiascan_lang{scan}{picturesettings}, $pagedata, "database"); # Output the page to browser/console/stdout.
318                                         exit;   # End the script.
319                                         
320                                 }
321                                 
322                         } elsif ($http_query_action eq "getpreviewimage"){
323                         
324                                 my $http_query_pictureid = $form_data->{'pictureid'};
325                                 my $http_query_dontclear = $form_data->{'dontclear'};
326                                 
327                                 if (!$http_query_dontclear){
328                                         $http_query_dontclear = 0;
329                                 }
330                                 
331                                 xestiascan_scan_getpreviewimage($http_query_pictureid, $http_query_dontclear);
332                                 exit;
333                                 
334                         }
335                                 
336                 }
337                         
338                 # No action specified so write out default form.
339                         
340                 my $pagedata = xestiascan_scan_preview();
341                         
342                 # Output the header to browser/console/stdout.
343                         
344                 xestiascan_output_header;
345                 xestiascan_output_page($xestiascan_lang{scan}{scanconfig}, $pagedata, "database");      # Output the page to browser/console/stdout.
346                 exit;   # End the script.
347                 
348         } elsif ($http_query_mode eq "users"){
350                 use Modules::System::Users;
352                 if ($form_data->{'action'}){
354                         my $http_query_action = $form_data->{'action'};
356                         if ($http_query_action eq "add"){
358                                 my $http_query_confirm = $form_data->{'confirm'};
359                                 
360                                 if (!$http_query_confirm){
361                                         
362                                         # The http_query_confirm variable is uninitialised, so place a
363                                         # '0' (meaning an unconfirmed action).
364                                         
365                                         $http_query_confirm = 0;
366                                         
367                                 }
368                                 
369                                 if ($http_query_confirm eq 1){
370                                 
371                                         use Hash::Search;
372                                         my $hs = new Hash::Search;
373                                         my %http_userinfo;
374                                         %form_data = $query_lite->parse_form_data();
375                                         
376                                         $http_userinfo{'Username'}              = $form_data->{'username'};
377                                         $http_userinfo{'Name'}                  = $form_data->{'name'};
378                                         $http_userinfo{'Password'}              = $form_data->{'password'};
379                                         $http_userinfo{'ConfirmPassword'}       = $form_data->{'confirmpassword'};
380                                         $http_userinfo{'Admin'}                 = $form_data->{'admin'};
381                                         $http_userinfo{'Enabled'}               = $form_data->{'enabled'};
382                                         
383                                         # Get the list of scanners from the query.
384                                         
385                                         $hs->hash_search("^scanner_", %form_data);
386                                         my %http_scanner = $hs->hash_search_resultdata;
387                                         
388                                         # Get the list of output modules from the query.
389                                         
390                                         $hs->hash_search("^outputmodule_", %form_data);
391                                         my %http_outputmodules = $hs->hash_search_resultdata;
392                                         
393                                         # Get the list of export modules from the query.
394                                         
395                                         $hs->hash_search("^exportmodule_", %form_data);
396                                         my %http_exportmodules = $hs->hash_search_resultdata;
397                                         
398                                         my $pagedata = xestiascan_users_add($http_userinfo{Username}, \%http_userinfo, \%http_scanner, \%http_outputmodules, \%http_exportmodules, $http_query_confirm);
399                                         
400                                         xestiascan_output_header;       # Output the header to browser/console/stdout;
401                                         xestiascan_output_page($xestiascan_lang{users}{adduser}, $pagedata, "users");   # Output the page to browser/console/stdout;
402                                         exit;                           # End the script.
403                                         
404                                 }
406                                 my $pagedata = xestiascan_users_add;
408                                 xestiascan_output_header;       # Output the header to browser/console/stdout;
409                                 xestiascan_output_page($xestiascan_lang{users}{adduser}, $pagedata, "users");   # Output the page to browser/console/stdout;
410                                 exit;                           # End the script.                               
412                         } elsif ($http_query_action eq "edit"){
413                                 
414                                 my $http_query_confirm  = $form_data->{'confirm'};
415                                 my $http_query_username = $form_data->{'user'};
417                                 if (!$http_query_confirm){
418                                         
419                                         # The http_query_confirm variable is uninitialised, so place a
420                                         # '0' (meaning an unconfirmed action).
421                                         
422                                         $http_query_confirm = 0;
423                                         
424                                 }                               
425                                 
426                                 if ($http_query_confirm eq 1){
427                                 
428                                         # The action to edit the user has been confirmed so collect
429                                         # the information needed for the xestiascan_users_edit
430                                         # subroutine.
431                                         
432                                         use Hash::Search;
433                                         my $hs = new Hash::Search;
434                                         my %http_userinfo;
435                                         my %form_data = $query_lite->parse_form_data();
436                                         
437                                         my $confirm                             = $form_data->{'confirm'};
438                                         $http_userinfo{'OriginalUsername'}      = $form_data->{'username_original'};
439                                         $http_userinfo{'NewUsername'}           = $form_data->{'username'};
440                                         $http_userinfo{'Name'}                  = $form_data->{'name'};
441                                         $http_userinfo{'Password'}              = $form_data->{'password'};
442                                         $http_userinfo{'ConfirmPassword'}       = $form_data->{'confirmpassword'};
443                                         $http_userinfo{'Admin'}                 = $form_data->{'admin'};
444                                         $http_userinfo{'Enabled'}               = $form_data->{'enabled'};
445                                         
446                                         # Get the list of scanners from the query.
447                                         
448                                         $hs->hash_search("^scanner_", %form_data);
449                                         my %http_scanner = $hs->hash_search_resultdata;
450                                         
451                                         # Get the list of output modules from the query.
452                                         
453                                         $hs->hash_search("^outputmodule_", %form_data);
454                                         my %http_outputmodules = $hs->hash_search_resultdata;
455                                         
456                                         # Get the list of export modules from the query.
457                                         
458                                         $hs->hash_search("^exportmodule_", %form_data);
459                                         my %http_exportmodules = $hs->hash_search_resultdata;
460                                         
461                                         my $pagedata = xestiascan_users_edit($http_userinfo{OriginalUsername}, \%http_userinfo, \%http_scanner, \%http_outputmodules, \%http_exportmodules, $confirm);
462                                         
463                                         xestiascan_output_header;       # Output the header to browser/console/stdout;
464                                         xestiascan_output_page($xestiascan_lang{users}{edituser}, $pagedata, "users");  # Output the page to browser/console/stdout;
465                                         exit;                           # End the script.                                       
466                                         
467                                 }
468                                 
469                                 my $pagedata = xestiascan_users_edit($http_query_username);
470                                 
471                                 xestiascan_output_header;       # Output the header to browser/console/stdout;
472                                 xestiascan_output_page($xestiascan_lang{users}{edituser}, $pagedata, "users");  # Output the page to browser/console/stdout;
473                                 exit;                           # End the script.                               
474                                 
475                         } elsif ($http_query_action eq "delete"){
477                                 my $http_query_confirm  = $form_data->{'confirm'};
478                                 my $http_query_username = $form_data->{'user'};
479                                 
480                                 if (!$http_query_confirm){
481                                         
482                                         # The http_query_confirm variable is uninitialised, so place a
483                                         # '0' (meaning an unconfirmed action).
484                                         
485                                         $http_query_confirm = 0;
486                                         
487                                 }
488                                 
489                                 if ($http_query_confirm eq 1){
490                                 
491                                         # The action to delete a user has been confirmed.
492                                         
493                                         my $pagedata = xestiascan_users_delete($http_query_username, $http_query_confirm);
494                                         
495                                         xestiascan_output_header;       # Output the header to browser/console/stdout;
496                                         xestiascan_output_page($xestiascan_lang{users}{deleteuser}, $pagedata, "users");        # Output the page to browser/console/stdout;
497                                         exit;                           # End the script.
498                                         
499                                 }
500                                 
501                                 my $pagedata = xestiascan_users_delete($http_query_username);
502                                 
503                                 xestiascan_output_header;       # Output the header to browser/console/stdout;
504                                 xestiascan_output_page($xestiascan_lang{users}{deleteuser}, $pagedata, "users");        # Output the page to browser/console/stdout;
505                                 exit;                           # End the script.
506                                 
507                         } elsif ($http_query_action eq "flush"){
508                                 
509                                 my $http_query_confirm = $form_data->{'confirm'};
510                                 
511                                 $http_query_confirm = 0 if !$http_query_confirm;
512                                 
513                                 my $pagedata = xestiascan_users_flush($http_query_confirm);
514                                 
515                                 xestiascan_output_header;       # Output the header to browser/console/stdout;
516                                 xestiascan_output_page($xestiascan_lang{users}{logoutallusers}, $pagedata, "users");    # Output the page to browser/console/stdout;
517                                 exit;                           # End the script.
518                                 
519                         } else {
520                 
521                                 # The action specified was something else other than those
522                                 # above, so return an error.
523                 
524                                 xestiascan_error("invalidaction");
526                         }               
528                 }               
530                 my $showdeactivated = 0;
532                 if ($form_data->{'showdeactivated'} && $form_data->{'showdeactivated'} eq "on"){
533                         
534                         $showdeactivated = 1;
536                 }
538                 my $pagedata = xestiascan_users_list({ ShowDeactivatedUsers => $showdeactivated });
540                 xestiascan_output_header;       # Output the header to browser/console/stdout;
541                 xestiascan_output_page($xestiascan_lang{users}{userslist}, $pagedata, "users"); # Output the page to browser/console/stdout;
542                 exit;                           # End the script.
544         } elsif ($http_query_mode eq "settings"){
546                 use Modules::System::Settings;
548                 if ($form_data->{'action'}){
549                         my $http_query_action = $form_data->{'action'};
550                 
551                         if ($http_query_action eq "edit"){
552                 
553                                 # The action specified is to edit the settings. Check if the action
554                                 # to edit the settings has been confirmed.
555                 
556                                 my $http_query_confirm = $form_data->{'confirm'};
557                 
558                                 if (!$http_query_confirm){
559                 
560                                         # The confirm value is blank, so set it to 0.
561                 
562                                         $http_query_confirm = 0;
563                 
564                                 }
565                 
566                                 if ($http_query_confirm eq 1){
567                 
568                                         # The action to edit the settings has been confirmed. Get the
569                                         # required settings from the HTTP query.
570                 
571                                         my $http_query_imagesuri        = $form_data->{'imagesuripath'};
572                                         my $http_query_scansuri         = $form_data->{'scansuripath'};
573                                         my $http_query_scansfs          = $form_data->{'scansfspath'};
574                                         my $http_query_datetimeformat   = $form_data->{'datetime'};
575                                         my $http_query_systemlanguage   = $form_data->{'language'};
576                                         my $http_query_presmodule       = $form_data->{'presmodule'};
577                                         my $http_query_authmodule       = $form_data->{'authmodule'};
578                                         my $http_query_outputmodule     = $form_data->{'outputmodule'};
579                 
580                                         my $http_query_database_server          = $form_data->{'database_server'};
581                                         my $http_query_database_port            = $form_data->{'database_port'};
582                                         my $http_query_database_protocol        = $form_data->{'database_protocol'};
583                                         my $http_query_database_sqldatabase     = $form_data->{'database_sqldatabase'};
584                                         my $http_query_database_username        = $form_data->{'database_username'};
585                                         my $http_query_database_passwordkeep    = $form_data->{'database_password_keep'};
586                                         my $http_query_database_password        = $form_data->{'database_password'};
587                                         my $http_query_database_tableprefix     = $form_data->{'database_tableprefix'};
588                 
589                                         my $pagedata = xestiascan_settings_edit({ ImagesURIPath => $http_query_imagesuri, ScansURIPath => $http_query_scansuri, ScansFSPath => $http_query_scansfs, DateTimeFormat => $http_query_datetimeformat, SystemLanguage => $http_query_systemlanguage, PresentationModule => $http_query_presmodule, OutputModule => $http_query_outputmodule, AuthModule => $http_query_authmodule, DatabaseServer => $http_query_database_server, DatabasePort => $http_query_database_port, DatabaseProtocol => $http_query_database_protocol, DatabaseSQLDatabase => $http_query_database_sqldatabase, DatabaseUsername => $http_query_database_username, DatabasePasswordKeep => $http_query_database_passwordkeep, DatabasePassword => $http_query_database_password, DatabaseTablePrefix => $http_query_database_tableprefix, Confirm => 1 });
590                 
591                                         xestiascan_output_header;       # Output the header to browser/console/stdout.
592                                         xestiascan_output_page($xestiascan_lang{setting}{editsettings}, $pagedata, "settings"); # Output the page to browser/console/stdout.
593                                         exit;                           # End the script.
594                 
595                                 }
596                 
597                                 # The action to edit the settings has not been confirmed.
598                 
599                                 my $pagedata = xestiascan_settings_edit();
600                 
601                                 xestiascan_output_header;       # Output the header to browser/console/stdout.
602                                 xestiascan_output_page($xestiascan_lang{setting}{editsettings}, $pagedata, "settings"); # Output the page to browser/console/stdout.
603                                 exit;                           # End the script.
604                 
605                         } else {
606                 
607                                 # The action specified was something else other than those
608                                 # above, so return an error.
609                 
610                                 xestiascan_error("invalidaction");
611                 
612                         }
613                 
614                 }
615                 
616                 # No action has been specified, so print out the list of settings currently being used.
617                 
618                 my $pagedata = xestiascan_settings_view();
619                 
620                 xestiascan_output_header;               # Output the header to browser/console/stdout.
621                 xestiascan_output_page($xestiascan_lang{setting}{viewsettings}, $pagedata, "settings"); # Output the page to browser/console/stdout.
622                 exit;                                   # End the script.
624         } elsif ($http_query_mode eq "logout"){
625                 
626                 # The mode selected is to logout the user.
627                 
628                 my $pagedata = xestiascan_auth_logout();
629                 
630                 xestiascan_output_header("cookie_logout");      # Output the header to browser/console/stdout.
631                 xestiascan_output_page($xestiascan_lang{setting}{logout}, $pagedata, "settings");       # Output the page to browser/console/stdout.
632                 exit;                                           # End the script.
633                 
634         } else {
636                 # An invalid mode has been specified so return
637                 # an error.
639                 xestiascan_error("invalidmode");
641         }
642         
643 } else {
645         # No mode has been specified, so print the default "first-run" view of the
646         # scanning setup.
648         use Modules::System::Scan;
649                 
650         my $pagedata = xestiascan_scan_preview();
652         # Output the header to browser/console/stdout.
654         if ($print_cookie eq 1){
655                 xestiascan_output_header("cookie", $auth_username, $auth_seed, $cookie_expirestime);
656         } else {
657                 xestiascan_output_header;
658         }
660         xestiascan_output_page($xestiascan_lang{scan}{scanconfig}, $pagedata, "database");      # Output the page to browser/console/stdout.
661         exit;   # End the script.
662         
665 __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