-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.pl
51 lines (42 loc) · 1.31 KB
/
index.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! C:\strawberry\perl\bin\perl.exe -w
use File::Basename;
use lib (dirname(__FILE__)); #Корень сайта.
use folder_config;
use lib (APP_CONTROLLERS_PATH, APP_CONTROLLERS_INDEX_PATH,
APP_CONTROLLERS_ADMIN_PATH, FRAMEWORK_CLASSES_PATH,
APP_CONFIG_PATH, APP_MODELS_PATH, APP_CLASSES_PATH,
APP_WIDGETS_PATH, APP_JSON_PATH, APP_I10N_PATH);
use config_route;
use CGI 3.47;
use CGI::Cookie;
#use strict;
my $q = CGI->new;
my %_params = $q->Vars;
my @_files = $q->upload('multiple_files');
my %_cookies = CGI::Cookie->fetch;
my $controller_name = 'controller_'
. ($q->url_param('controller') ?
($q->url_param('panel') ? $q->url_param('panel') . '_' : '') . $q->url_param('controller') :
DEFAULT_ROUTE_CONTROLLER
);
my $action = $q->url_param('action') ? $q->url_param('action') : DEFAULT_ROUTE_ACTION;
eval {
require "$controller_name.pm";
};
if ($@) {
print $q->header(-status=>'404',-type=>'text/html');
print $@;
}
my $controller = $controller_name->new(\%_params, \%_cookies, \@_files);
eval {
{no warnings 'once';
"${controller_name}::action_$action"->($controller);};
};
if ($@) {
print $q->header(-status=>'404',-type=>'text/html');
print $@;
}
else {
$controller->render();
}
#if (*{"${controller_name}::action_$action"}{CODE}) {