This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @package fwolflib |
||
4 | * @subpackage func |
||
5 | * @copyright Copyright 2007-2012, Fwolf |
||
6 | * @author Fwolf <[email protected]> |
||
7 | * @since 2007-01-21 |
||
8 | */ |
||
9 | |||
10 | |||
11 | require_once(dirname(__FILE__) . '/../fwolflib.php'); |
||
12 | require_once(dirname(__FILE__) . '/string.php'); |
||
13 | |||
14 | |||
15 | /** |
||
16 | * Get variant from $_COOKIE |
||
17 | * |
||
18 | * @deprecated Use Fwlib\Util\HttpUtil::getCookie() |
||
19 | * @param string $var Name of variant |
||
20 | * @param mixed $default If variant is not given, return this. |
||
21 | * @return mixed |
||
22 | */ |
||
23 | function GetCookie($var, $default='') |
||
24 | { |
||
25 | return GetRequest($_COOKIE, $var, $default); |
||
0 ignored issues
–
show
|
|||
26 | } // end of func GetCookie |
||
27 | |||
28 | |||
29 | /** |
||
30 | * Get variant from $_GET |
||
31 | * |
||
32 | * @deprecated Use Fwlib\Util\HttpUtil::getGet() |
||
33 | * @param string $var Name of variant |
||
34 | * @param mixed $default If variant is not given, return this. |
||
35 | * @return mixed |
||
36 | */ |
||
37 | function GetGet ($var, $default='') { |
||
38 | return GetRequest($_GET, $var, $default); |
||
0 ignored issues
–
show
The function
GetRequest() has been deprecated with message: Use Fwlib\Util\HttpUtil::getRequest()
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
39 | /* |
||
40 | if (isset($_GET[$var])) |
||
41 | $val = $_GET[$var]; |
||
42 | else |
||
43 | $val = $default; |
||
44 | return $val; |
||
45 | */ |
||
46 | } // end of func GetGet |
||
47 | |||
48 | |||
49 | /** |
||
50 | * Get and return modified url param |
||
51 | * |
||
52 | * If $k is string, then $v is string too and means add $k=$v. |
||
53 | * if $k is array, then $v is array to, |
||
54 | * and k-v/values in $k/$v is added/removed to/from url param. |
||
55 | * |
||
56 | * @deprecated Use Fwlib\Util\HttpUtil::getUrlParam() |
||
57 | * @param mixed $k |
||
58 | * @param mixed $v |
||
59 | * @param boolean $b_with_url If true, return value include self url. |
||
60 | * @return string '?' and '&' included. |
||
61 | */ |
||
62 | function GetParam ($k = '', $v = '', $b_with_url = false) { |
||
63 | $ar_param = $_GET; |
||
64 | if (!empty($ar_param) && !get_magic_quotes_gpc()) { |
||
65 | foreach ($ar_param as &$p) { |
||
66 | $p = addslashes($p); |
||
67 | } |
||
68 | } |
||
69 | |||
70 | // $k $v is string |
||
71 | View Code Duplication | if (!is_array($k) && !is_array($v) && '' != $k) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
72 | $ar_param[addslashes($k)] = addslashes($v); |
||
73 | } |
||
74 | |||
75 | // $k $v is array |
||
76 | if (is_array($k)) { |
||
77 | foreach ($k as $key => $val) |
||
78 | $ar_param[addslashes($key)] = addslashes($val); |
||
79 | if (!is_array($v)) |
||
80 | $v = array($v); |
||
81 | foreach ($v as $val) |
||
82 | if (isset($ar_param[$val])) |
||
83 | unset($ar_param[$val]); |
||
84 | } |
||
85 | |||
86 | // Combine param |
||
87 | $s = ''; |
||
88 | if (!empty($ar_param)) |
||
89 | foreach ($ar_param as $k => $v) |
||
90 | $s .= "&$k=$v"; |
||
91 | if (!empty($s)) |
||
92 | $s{0} = '?'; |
||
93 | |||
94 | // Add self url |
||
95 | if (true == $b_with_url) |
||
0 ignored issues
–
show
|
|||
96 | $s = GetSelfUrl(false) . $s; |
||
0 ignored issues
–
show
The function
GetSelfUrl() has been deprecated with message: Use Fwlib\Util\HttpUtil::getSelfUrl()
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
97 | |||
98 | return $s; |
||
99 | } // end of func GetParam |
||
100 | |||
101 | |||
102 | /** |
||
103 | * Get variant from $_POST |
||
104 | * |
||
105 | * @deprecated Use Fwlib\Util\HttpUtil::getPost() |
||
106 | * @param string $var Name of variant |
||
107 | * @param mixed $default If variant is not given, return this. |
||
108 | * @return mixed |
||
109 | */ |
||
110 | function GetPost ($var, $default='') { |
||
111 | return GetRequest($_POST, $var, $default); |
||
0 ignored issues
–
show
The function
GetRequest() has been deprecated with message: Use Fwlib\Util\HttpUtil::getRequest()
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
112 | /* |
||
113 | if (isset($_POST[$var])) |
||
114 | $val = $_POST[$var]; |
||
115 | else |
||
116 | $val = $default; |
||
117 | return $val; |
||
118 | */ |
||
119 | } // end of func GetPost |
||
120 | |||
121 | |||
122 | /** |
||
123 | * Get variant from $_REQUEST |
||
124 | * |
||
125 | * @deprecated Use Fwlib\Util\HttpUtil::getRequest() |
||
126 | * @param array $r Request, $_GET/$_POST etc... |
||
127 | * @param string $var Name of variant |
||
128 | * @param mixed $default If variant is not given, return this |
||
129 | * @return mixed |
||
130 | */ |
||
131 | function GetRequest (&$r, $var, $default = null) |
||
132 | { |
||
133 | if (isset($r[$var])) { |
||
134 | $val = $r[$var]; |
||
135 | |||
136 | $filter = FILTER_SANITIZE_SPECIAL_CHARS; |
||
137 | if (is_array($val)) { |
||
138 | $val = filter_var_array($val, $filter); |
||
139 | } else { |
||
140 | $val = filter_var($val, $filter); |
||
141 | } |
||
142 | |||
143 | // Deal with special chars in parameters |
||
144 | // magic_quotes_gpc is deprecated from php 5.4.0 |
||
145 | // if (version_compare(PHP_VERSION, '5.4.0', '>=') |
||
146 | // || !get_magic_quotes_gpc()) |
||
147 | // $val = AddslashesRecursive($val); |
||
148 | } |
||
149 | else { |
||
150 | $val = $default; |
||
151 | } |
||
152 | |||
153 | return $val; |
||
154 | } |
||
155 | |||
156 | |||
157 | /** |
||
158 | * Get self url which user visit |
||
159 | * |
||
160 | * @deprecated Use Fwlib\Util\HttpUtil::getSelfUrl() |
||
161 | * @param boolean $with_get_param // Include get param in url, default yes. |
||
162 | * @return string |
||
163 | */ |
||
164 | function GetSelfUrl($with_get_param = true) { |
||
165 | if (isset($_SERVER["HTTPS"]) && 'on' == $_SERVER["HTTPS"]) |
||
166 | $url = 'https://'; |
||
167 | else |
||
168 | $url = 'http://'; |
||
169 | |||
170 | $s_t = ($with_get_param) ? $_SERVER['REQUEST_URI'] : $_SERVER["SCRIPT_NAME"]; |
||
171 | |||
172 | $url .= $_SERVER["HTTP_HOST"] . $s_t; |
||
173 | return $url; |
||
174 | } // end of func GetSelfUrl |
||
175 | |||
176 | |||
177 | /** |
||
178 | * Get variant from $_SESSION,will also rewrite SESSION to keep it |
||
179 | * |
||
180 | * @deprecated Use Fwlib\Util\HttpUtil::getSession() |
||
181 | * @param string $var Name of variant |
||
182 | * @param mixed $default If variant is not given, return this. |
||
183 | * @return mixed |
||
184 | */ |
||
185 | function GetSession($var, $default='') { |
||
186 | $_SESSION[$var] = GetRequest($_SESSION, $var, $default); |
||
0 ignored issues
–
show
The function
GetRequest() has been deprecated with message: Use Fwlib\Util\HttpUtil::getRequest()
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
187 | return $_SESSION[$var]; |
||
188 | } // end of func GetSession |
||
189 | |||
190 | |||
191 | /** |
||
192 | * Get url plan from url or self |
||
193 | * |
||
194 | * eg: http://www.google.com/, plan = http |
||
195 | * |
||
196 | * @deprecated Use Fwlib\Util\HttpUtil::getUrlPlan() |
||
197 | * @param string $url Default: self url |
||
198 | * @return string |
||
199 | */ |
||
200 | function GetUrlPlan($url = '') { |
||
201 | if (empty($url)) |
||
202 | $url = GetSelfUrl(); |
||
0 ignored issues
–
show
The function
GetSelfUrl() has been deprecated with message: Use Fwlib\Util\HttpUtil::getSelfUrl()
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
203 | $i = preg_match('/^(\w+):\/\//', $url, $ar); |
||
204 | if (1 == $i) |
||
205 | return $ar[1]; |
||
206 | else |
||
207 | return ''; |
||
208 | } // end of func GetUrlPlan |
||
209 | |||
210 | ?> |
||
0 ignored issues
–
show
It is not recommended to use PHP's closing tag
?> in files other than templates.
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore. A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever. ![]() |
|||
211 |
This function has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.