• 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

Revision249cd0dfa66426b1e2c49f89dc16cf59f94800b8 (tree)
Time2006-10-03 23:16:31
Authorhenoheno <henoheno>
Commiterhenoheno

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
@@ -1,6 +1,6 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone
3-// $Id: pcomment.inc.php,v 1.43 2005/10/04 14:31:22 henoheno Exp $
3+// $Id: pcomment.inc.php,v 1.44 2006/10/03 14:16:31 henoheno Exp $
44 //
55 // pcomment plugin - Show/Insert comments into specified (another) page
66 //
@@ -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))
@@ -122,7 +118,6 @@ function plugin_pcomment_convert()
122118 $s_page = htmlspecialchars($page);
123119 $s_refer = htmlspecialchars($vars_page);
124120 $s_nodate = htmlspecialchars($params['nodate']);
125- $s_count = htmlspecialchars($count);
126121
127122 $form_start = '<form action="' . get_script_uri() . '" method="post">' . "\n";
128123 $form = <<<EOD
@@ -171,8 +166,7 @@ EOD;
171166
172167 function plugin_pcomment_insert()
173168 {
174- global $script, $vars, $now;
175- global $_title_updated, $_no_name, $_pcmt_messages;
169+ global $vars, $now, $_title_updated, $_no_name, $_pcmt_messages;
176170
177171 $refer = isset($vars['refer']) ? $vars['refer'] : '';
178172 $page = isset($vars['page']) ? $vars['page'] : '';
@@ -303,7 +297,7 @@ function plugin_pcomment_auto_log($page, $dir, $count, & $postdata)
303297 }
304298
305299 // Check arguments
306-function plugin_pcomment_check_arg($val, $key, & $params)
300+function plugin_pcomment_check_arg($val, & $params)
307301 {
308302 if ($val != '') {
309303 $l_val = strtolower($val);