PluginProbe
WebTotem Security / 2.4.4
WebTotem Security v2.4.4
3.0.1 3.0.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.1 2.2.2 2.2.3 2.2.4 All 109 releases
wt-security / lib / Request.php

Request.php in WebTotem Security 2.4.4, at lib/Request.php

87 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('WEBTOTEM_INIT') || WEBTOTEM_INIT !== true) {
4 if (!headers_sent()) {
5 header('HTTP/1.1 403 Forbidden');
6 }
7 die("Protected By WebTotem!");
8 }
9
10 /**
11 * HTTP request handler.
12 *
13 */
14 class WebTotemRequest extends WebTotem {
15
16 /**
17 * Returns the value of the _GET, _POST or _REQUEST key.
18 *
19 * @param array $list
20 * The array where the specified key will be searched.
21 * @param string $key
22 * Name of the variable contained in _POST.
23 *
24 * @return array|string|bool Value from the global _GET or _POST variable.
25 */
26 private static function request($list = array(), $key = '') {
27 if (!is_array($list) || !isset($list[$key])) {
28 return false;
29 }
30
31 // raw request parameter
32 $key_value = $list[$key];
33
34 if(is_array($key_value)){
35
36 foreach ($key_value as $key => $value){
37 $key_value[$key] = self::escape($value);
38 }
39
40 return $key_value;
41 }
42 else {
43 return self::escape($key_value);
44 }
45
46 }
47
48 /**
49 * Returns the value stored in the index in the global variable _GET.
50 *
51 * @param string $key
52 * Name of the variable contained in _GET.
53 *
54 * @return array|string
55 * Value from the global _GET variable.
56 */
57 public static function get($key = '') {
58 return self::request($_GET, $key);
59 }
60
61 /**
62 * Returns the value stored in the index in the global _POST variable.
63 *
64 * @param string $key
65 * Name of the variable contained in _POST.
66 *
67 * @return array|string
68 * Value from the global _POST variable.
69 */
70 public static function post($key = '') {
71 return self::request($_POST, $key);
72 }
73
74 /**
75 * Returns the value stored in the index in the global _REQUEST variable.
76 *
77 * @param string $key
78 * Name of the variable contained in _REQUEST.
79 *
80 * @return array|string
81 * Value from the global _REQUEST variable.
82 */
83 public static function getOrPost($key = '') {
84 return self::request($_REQUEST, $key);
85 }
86 }
87