Revisão | 7e3ba7d55bf0faf44eae960b141ca1ea76cb9b91 (tree) |
---|---|
Hora | 2022-01-24 02:06:51 |
Autor | hai-fun <haifun129@gmai...> |
Commiter | hai-fun |
PHP8
@@ -16,9 +16,12 @@ | ||
16 | 16 | * @license http://www.gnu.org/licenses/gpl.html GPL2 |
17 | 17 | * @link http://lsx.sourceforge.jp/?Plugin%2Fvotex |
18 | 18 | */ |
19 | + | |
20 | + // v1.51 PHP8.0対応 2021-12-15 byはいふん | |
21 | + | |
19 | 22 | class PluginVotex |
20 | 23 | { |
21 | - function PluginVotex() | |
24 | + function __construct() | |
22 | 25 | { |
23 | 26 | // static |
24 | 27 | static $CONF = array(); |
@@ -47,6 +50,10 @@ class PluginVotex | ||
47 | 50 | textdomain('vote'); // use i18n msgs of vote.inc.php |
48 | 51 | } |
49 | 52 | } |
53 | + | |
54 | + function PluginVotex() { | |
55 | + $this->__construct(); | |
56 | + } | |
50 | 57 | |
51 | 58 | // static |
52 | 59 | var $CONF; |
@@ -388,9 +395,9 @@ class PluginVotex | ||
388 | 395 | function show_preview_form($msg = '', $body = '') |
389 | 396 | { |
390 | 397 | global $vars, $rows, $cols; |
391 | - $s_refer = htmlspecialchars($vars['refer']); | |
392 | - $s_digest = htmlspecialchars($vars['digest']); | |
393 | - $s_body = htmlspecialchars($body); | |
398 | + $s_refer = htmlsc($vars['refer']); | |
399 | + $s_digest = htmlsc($vars['digest']); | |
400 | + $s_body = htmlsc($body); | |
394 | 401 | $form = ''; |
395 | 402 | $form .= $msg . "\n"; |
396 | 403 | $form .= '<form action="' . get_script_uri() . '?cmd=preview" method="post">' . "\n"; |
@@ -467,8 +474,8 @@ class PluginVotex | ||
467 | 474 | $r_choice_id = rawurlencode($choice_id); |
468 | 475 | $r_choice = rawurlencode($choice); |
469 | 476 | $r_count = rawurlencode($count); |
470 | - $s_choice = htmlspecialchars($choice); | |
471 | - $s_count = htmlspecialchars($count); | |
477 | + $s_choice = htmlsc($choice); | |
478 | + $s_count = htmlsc($count); | |
472 | 479 | if ($this->options['readonly']) { |
473 | 480 | $form .= $s_choice . '<span> ' . $s_count . ' </span>'; |
474 | 481 | } else { |
@@ -517,7 +524,7 @@ class PluginVotex | ||
517 | 524 | function &restore_args_inline(&$votes, &$options, &$default_options) |
518 | 525 | { |
519 | 526 | // currently same |
520 | - return $this->restore_args_convert($votes, $options, &$default_options); | |
527 | + return $this->restore_args_convert($votes, $options, $default_options); | |
521 | 528 | } |
522 | 529 | |
523 | 530 | /** |
@@ -578,7 +585,10 @@ class PluginVotex | ||
578 | 585 | foreach ($args as $arg) { |
579 | 586 | $arg = trim($arg); |
580 | 587 | list($key, $val) = array_pad(explode('=', $arg, 2), 2, TRUE); |
581 | - if (array_key_exists($key, $options)) { | |
588 | + if (empty($options)) { | |
589 | + | |
590 | + } | |
591 | + else if (array_key_exists($key, $options)) { | |
582 | 592 | $options[$key] = $val; |
583 | 593 | continue; |
584 | 594 | } |
@@ -648,8 +658,8 @@ class PluginVotex | ||
648 | 658 | global $vars, $defaultpage; |
649 | 659 | global $digest; |
650 | 660 | $page = isset($vars['page']) ? $vars['page'] : $defaultpage; |
651 | - $s_page = htmlspecialchars($page); | |
652 | - $s_digest = htmlspecialchars($digest); | |
661 | + $s_page = htmlsc($page); | |
662 | + $s_digest = htmlsc($digest); | |
653 | 663 | $script = ($this->options['readonly']) ? '' : get_script_uri(); |
654 | 664 | $submit = ($this->options['readonly']) ? 'hidden' : 'submit'; |
655 | 665 | $choicestyle = 'padding-left:1em;padding-right:1em;'; |
@@ -697,7 +707,7 @@ class PluginVotex | ||
697 | 707 | list($choice, $count) = $vote; |
698 | 708 | $class = ($choice_id % 2) ? 'vote_td1' : 'vote_td2'; |
699 | 709 | $s_choice = make_link($choice); |
700 | - $s_count = htmlspecialchars($count); | |
710 | + $s_count = htmlsc($count); | |
701 | 711 | $choice_key = $this->encode_choice($choice_id); |
702 | 712 | if ($this->options['barchart']) { |
703 | 713 | $percent = (int)(($count / $max) * 100); // / $sum |