aboutsummaryrefslogtreecommitdiffstats
path: root/public/system/library/request.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/system/library/request.php')
-rw-r--r--public/system/library/request.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/public/system/library/request.php b/public/system/library/request.php
new file mode 100644
index 0000000..9b63a31
--- /dev/null
+++ b/public/system/library/request.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * @package OpenCart
+ * @author Daniel Kerr
+ * @copyright Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/)
+ * @license https://opensource.org/licenses/GPL-3.0
+ * @link https://www.opencart.com
+*/
+
+/**
+* Request class
+*/
+class Request {
+ public $get = array();
+ public $post = array();
+ public $cookie = array();
+ public $files = array();
+ public $server = array();
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+ $this->get = $this->clean($_GET);
+ $this->post = $this->clean($_POST);
+ $this->request = $this->clean($_REQUEST);
+ $this->cookie = $this->clean($_COOKIE);
+ $this->files = $this->clean($_FILES);
+ $this->server = $this->clean($_SERVER);
+ }
+
+ /**
+ *
+ * @param array $data
+ *
+ * @return array
+ */
+ public function clean($data) {
+ if (is_array($data)) {
+ foreach ($data as $key => $value) {
+ unset($data[$key]);
+
+ $data[$this->clean($key)] = $this->clean($value);
+ }
+ } else {
+ $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
+ }
+
+ return $data;
+ }
+} \ No newline at end of file