File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,9 @@ function index() {
97
97
$ this ->view ->redir = $ this ->request ->get ['module ' ];
98
98
}
99
99
100
- if (($ this ->request ->method == 'POST ' ) &&
100
+ $ method = $ this ->request ->getMethod ();
101
+
102
+ if (($ method == 'post ' ) &&
101
103
($ this ->view ->errors = $ validator ->validate ($ this ->request ->post )) === true ) {
102
104
$ user = $ this ->request ->post ['user ' ];
103
105
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ class Request {
35
35
36
36
public $ server = [];
37
37
38
- public $ method ;
38
+ private $ method ;
39
39
40
40
protected static $ instance ;
41
41
@@ -47,7 +47,7 @@ public static function getInstance() {
47
47
return static ::$ instance ;
48
48
}
49
49
50
- private function __construct () {
50
+ final private function __construct () {
51
51
$ this ->get = &$ _GET ;
52
52
$ this ->post = &$ _POST ;
53
53
$ this ->request = &$ _REQUEST ;
@@ -60,7 +60,7 @@ private function __construct() {
60
60
$ this ->request = $ this ->filter ($ this ->request );
61
61
$ this ->cookie = $ this ->filter ($ this ->cookie );
62
62
$ this ->files = $ this ->filter ($ this ->files );
63
- $ this ->method = $ _SERVER ['REQUEST_METHOD ' ] ?? 'GET ' ;
63
+ $ this ->method = strtolower ( $ _SERVER ['REQUEST_METHOD ' ] ?? 'GET ' ) ;
64
64
65
65
$ this ->request = array_merge ($ this ->request , $ this ->get , $ this ->post );
66
66
}
@@ -85,6 +85,10 @@ public function filter($data, $filterText = true) {
85
85
return $ data ;
86
86
}
87
87
88
+ public function getMethod () {
89
+ return $ this ->method ;
90
+ }
91
+
88
92
public function isAjax () {
89
93
return isset ($ this ->server ['HTTP_X_REQUESTED_WITH ' ]) && $ this ->server ['HTTP_X_REQUESTED_WITH ' ] == 'XMLHttpRequest ' ;
90
94
}
You can’t perform that action at this time.
0 commit comments