Révision | 7300ab9e8a0931e6e5742152b7e6cc5adc98b59a (tree) |
---|---|
l'heure | 2014-06-02 06:20:29 |
Auteur | henoheno <henoheno> |
Commiter | umorigu |
A little cleanup:
* Remove unused variable
* Use intval() to say why it's safe without htmlspecialchars() clearly
* BugTrack2/182: With php.ini: allow_call_time_pass_reference = Off
@@ -67,8 +67,6 @@ function plugin_pcomment_convert() | ||
67 | 67 | global $vars; |
68 | 68 | global $_pcmt_messages; |
69 | 69 | |
70 | - $ret = ''; | |
71 | - | |
72 | 70 | $params = array( |
73 | 71 | 'noname'=>FALSE, |
74 | 72 | 'nodate'=>FALSE, |
@@ -78,16 +76,14 @@ function plugin_pcomment_convert() | ||
78 | 76 | '_args' =>array() |
79 | 77 | ); |
80 | 78 | |
81 | - // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5 | |
82 | - $args = func_get_args(); // with array_walk() | |
83 | - array_walk($args, 'plugin_pcomment_check_arg', & $params); | |
79 | + foreach(func_get_args() as $arg) | |
80 | + plugin_pcomment_check_arg($arg, $params); | |
84 | 81 | |
85 | 82 | $vars_page = isset($vars['page']) ? $vars['page'] : ''; |
86 | 83 | $page = (isset($params['_args'][0]) && $params['_args'][0] != '') ? $params['_args'][0] : |
87 | 84 | sprintf(PLUGIN_PCOMMENT_PAGE, strip_bracket($vars_page)); |
88 | - $count = (isset($params['_args'][1]) && $params['_args'][1] != '') ? $params['_args'][1] : 0; | |
89 | - if ($count == 0 && $count !== '0') | |
90 | - $count = PLUGIN_PCOMMENT_NUM_COMMENTS; | |
85 | + $count = isset($params['_args'][1]) ? intval($params['_args'][1]) : 0; | |
86 | + if ($count == 0) $count = PLUGIN_PCOMMENT_NUM_COMMENTS; | |
91 | 87 | |
92 | 88 | $_page = get_fullname(strip_bracket($page), $vars_page); |
93 | 89 | if (!is_pagename($_page)) |
@@ -171,8 +167,7 @@ EOD; | ||
171 | 167 | |
172 | 168 | function plugin_pcomment_insert() |
173 | 169 | { |
174 | - global $script, $vars, $now; | |
175 | - global $_title_updated, $_no_name, $_pcmt_messages; | |
170 | + global $vars, $now, $_title_updated, $_no_name, $_pcmt_messages; | |
176 | 171 | |
177 | 172 | $refer = isset($vars['refer']) ? $vars['refer'] : ''; |
178 | 173 | $page = isset($vars['page']) ? $vars['page'] : ''; |
@@ -303,7 +298,7 @@ function plugin_pcomment_auto_log($page, $dir, $count, & $postdata) | ||
303 | 298 | } |
304 | 299 | |
305 | 300 | // Check arguments |
306 | -function plugin_pcomment_check_arg($val, $key, & $params) | |
301 | +function plugin_pcomment_check_arg($val, & $params) | |
307 | 302 | { |
308 | 303 | if ($val != '') { |
309 | 304 | $l_val = strtolower($val); |