• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoapythonrubywindowsphpgameguibathyscaphec翻訳omegatframework計画中(planning stage)twitterdombtronvb.nettestarduinodirectxpreviewerゲームエンジン

PukiWiki


Commit MetaInfo

Revision7300ab9e8a0931e6e5742152b7e6cc5adc98b59a (tree)
Time2014-06-02 06:20:29
Authorhenoheno <henoheno>
Commiterumorigu

Log Message

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

'Warning: Call-time pass-by-reference has been deprecated'
with array_walk (Patched by Ratbeta)

Change Summary

Incremental Difference

--- a/plugin/pcomment.inc.php
+++ b/plugin/pcomment.inc.php
@@ -67,8 +67,6 @@ function plugin_pcomment_convert()
6767 global $vars;
6868 global $_pcmt_messages;
6969
70- $ret = '';
71-
7270 $params = array(
7371 'noname'=>FALSE,
7472 'nodate'=>FALSE,
@@ -78,16 +76,14 @@ function plugin_pcomment_convert()
7876 '_args' =>array()
7977 );
8078
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);
8481
8582 $vars_page = isset($vars['page']) ? $vars['page'] : '';
8683 $page = (isset($params['_args'][0]) && $params['_args'][0] != '') ? $params['_args'][0] :
8784 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;
9187
9288 $_page = get_fullname(strip_bracket($page), $vars_page);
9389 if (!is_pagename($_page))
@@ -171,8 +167,7 @@ EOD;
171167
172168 function plugin_pcomment_insert()
173169 {
174- global $script, $vars, $now;
175- global $_title_updated, $_no_name, $_pcmt_messages;
170+ global $vars, $now, $_title_updated, $_no_name, $_pcmt_messages;
176171
177172 $refer = isset($vars['refer']) ? $vars['refer'] : '';
178173 $page = isset($vars['page']) ? $vars['page'] : '';
@@ -303,7 +298,7 @@ function plugin_pcomment_auto_log($page, $dir, $count, & $postdata)
303298 }
304299
305300 // Check arguments
306-function plugin_pcomment_check_arg($val, $key, & $params)
301+function plugin_pcomment_check_arg($val, & $params)
307302 {
308303 if ($val != '') {
309304 $l_val = strtolower($val);