Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

added getMethod to request

givanz2142ed304524
diff --git a/admin/controller/user/login.php b/admin/controller/user/login.php
index 4ce30fd..148c594 100755
--- a/admin/controller/user/login.php
+++ b/admin/controller/user/login.php
@@ -97,7 +97,9 @@ class Login {
$this->view->redir = $this->request->get['module'];
}
- if (($this->request->method == 'POST') &&
+ $method = $this->request->getMethod();
+
+ if (($method == 'post') &&
($this->view->errors = $validator->validate($this->request->post)) === true) {
$user = $this->request->post['user'];
diff --git a/system/core/request.php b/system/core/request.php
index dd3c679..c49de45 100755
--- a/system/core/request.php
+++ b/system/core/request.php
@@ -35,7 +35,7 @@ class Request {
public $server = [];
- public $method;
+ private $method;
protected static $instance;
@@ -47,7 +47,7 @@ class Request {
return static::$instance;
}
- private function __construct() {
+ final private function __construct() {
$this->get = &$_GET;
$this->post = &$_POST;
$this->request = &$_REQUEST;
@@ -60,7 +60,7 @@ class Request {
$this->request = $this->filter($this->request);
$this->cookie = $this->filter($this->cookie);
$this->files = $this->filter($this->files);
- $this->method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
+ $this->method = strtolower($_SERVER['REQUEST_METHOD'] ?? 'GET');
$this->request = array_merge($this->request, $this->get, $this->post);
}
@@ -85,6 +85,10 @@ class Request {
return $data;
}
+ public function getMethod() {
+ return $this->method;
+ }
+
public function isAjax() {
return isset($this->server['HTTP_X_REQUESTED_WITH']) && $this->server['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
}