From f14b0f4962c37571d20e91db78667f6b124ef38d Mon Sep 17 00:00:00 2001 From: nao-pon Date: Sat, 24 Aug 2013 09:43:29 +0900 Subject: [PATCH] correction of htmlspecialchars() for PHP 5.4 on non UTF-8 --- .../xpwiki/skin/pukiwiki/pukiwiki.skin.php | 2 +- .../VerUp/3/skin/pukiwiki/pukiwiki.skin.php | 2 +- .../modules/xpwiki/blocks/block_functions.php | 16 +-- .../modules/xpwiki/class/attach.php | 38 +++--- .../modules/xpwiki/class/convert_html.php | 10 +- .../modules/xpwiki/class/ext_autolink.php | 6 +- .../xpwiki/class/extension/xoopsSearch.php | 2 +- .../modules/xpwiki/class/func/base_func.php | 2 +- .../xpwiki/class/func/pukiwiki_func.php | 120 +++++++++--------- .../xpwiki/class/func/xoops_wrapper.php | 10 +- .../modules/xpwiki/class/func/xpwiki_func.php | 64 ++++++---- .../modules/xpwiki/class/include/init.php | 13 +- .../modules/xpwiki/class/make_link.php | 30 ++--- .../modules/xpwiki/class/xpwiki.php | 16 ++- .../xpwiki/include/DifferenceEngine.php | 2 +- .../modules/xpwiki/include/check.func.php | 2 +- .../xpwiki/include/stand_alone_functions.php | 4 +- .../modules/xpwiki/ini/rules.ini.php | 2 +- xoops_trust_path/modules/xpwiki/loader.php | 2 +- xoops_trust_path/modules/xpwiki/oninstall.php | 18 +-- .../modules/xpwiki/onuninstall.php | 6 +- xoops_trust_path/modules/xpwiki/onupdate.php | 18 +-- .../modules/xpwiki/plugin/addline.inc.php | 12 +- .../modules/xpwiki/plugin/ajaxtree.inc.php | 12 +- .../modules/xpwiki/plugin/amazon.inc.php | 10 +- .../modules/xpwiki/plugin/aname.inc.php | 8 +- .../modules/xpwiki/plugin/areaedit.inc.php | 22 ++-- .../modules/xpwiki/plugin/article.inc.php | 10 +- .../modules/xpwiki/plugin/attach.inc.php | 22 ++-- .../modules/xpwiki/plugin/aws.inc.php | 2 +- .../modules/xpwiki/plugin/back.inc.php | 2 +- .../modules/xpwiki/plugin/backup.inc.php | 30 ++--- .../modules/xpwiki/plugin/bitly.inc.php | 6 +- .../modules/xpwiki/plugin/boxdate.inc.php | 2 +- .../modules/xpwiki/plugin/bugtrack.inc.php | 40 +++--- .../modules/xpwiki/plugin/build_js.inc.php | 4 +- .../modules/xpwiki/plugin/calendar.inc.php | 2 +- .../modules/xpwiki/plugin/calendar2.inc.php | 12 +- .../modules/xpwiki/plugin/calendar9.inc.php | 14 +- .../xpwiki/plugin/calendar_viewer.inc.php | 12 +- .../modules/xpwiki/plugin/code.inc.php | 20 +-- .../xpwiki/plugin/code/codehighlight.php | 52 ++++---- .../modules/xpwiki/plugin/color.inc.php | 6 +- .../modules/xpwiki/plugin/comment.inc.php | 2 +- .../modules/xpwiki/plugin/conf.inc.php | 8 +- .../modules/xpwiki/plugin/dbsync.inc.php | 4 +- .../modules/xpwiki/plugin/deldel.inc.php | 28 ++-- .../modules/xpwiki/plugin/diff.inc.php | 8 +- .../modules/xpwiki/plugin/dump.inc.php | 16 +-- .../modules/xpwiki/plugin/edit.inc.php | 24 ++-- .../xpwiki/plugin/exifshowcase.inc.php | 2 +- .../modules/xpwiki/plugin/font.inc.php | 14 +- .../modules/xpwiki/plugin/footnotes.inc.php | 2 +- .../modules/xpwiki/plugin/freeze.inc.php | 2 +- .../modules/xpwiki/plugin/fusen.inc.php | 6 +- .../modules/xpwiki/plugin/gmap.inc.php | 14 +- .../modules/xpwiki/plugin/gmap_draw.inc.php | 2 +- .../modules/xpwiki/plugin/gmap_icon.inc.php | 2 +- .../xpwiki/plugin/gmap_insertmarker.inc.php | 14 +- .../modules/xpwiki/plugin/gmap_mark.inc.php | 4 +- .../modules/xpwiki/plugin/gmap_street.inc.php | 2 +- .../modules/xpwiki/plugin/googlemaps2.inc.php | 10 +- .../xpwiki/plugin/googlemaps2_draw.inc.php | 2 +- .../xpwiki/plugin/googlemaps2_icon.inc.php | 2 +- .../plugin/googlemaps2_insertmarker.inc.php | 14 +- .../xpwiki/plugin/googlemaps2_mark.inc.php | 4 +- .../modules/xpwiki/plugin/gsearch.inc.php | 12 +- .../modules/xpwiki/plugin/html.inc.php | 2 +- .../modules/xpwiki/plugin/iframe.inc.php | 6 +- .../modules/xpwiki/plugin/import.inc.php | 12 +- .../modules/xpwiki/plugin/include.inc.php | 4 +- .../xpwiki/plugin/includesubmenu.inc.php | 2 +- .../modules/xpwiki/plugin/insert.inc.php | 10 +- .../modules/xpwiki/plugin/interwiki.inc.php | 2 +- .../modules/xpwiki/plugin/isbn.inc.php | 12 +- .../modules/xpwiki/plugin/jsmath.inc.php | 4 +- .../modules/xpwiki/plugin/lookup.inc.php | 10 +- .../modules/xpwiki/plugin/ls2.inc.php | 10 +- .../modules/xpwiki/plugin/lsx.inc.php | 18 ++- .../modules/xpwiki/plugin/map.inc.php | 2 +- .../modules/xpwiki/plugin/md5.inc.php | 2 +- .../modules/xpwiki/plugin/memo.inc.php | 12 +- .../modules/xpwiki/plugin/menu.inc.php | 8 +- .../modules/xpwiki/plugin/navi.inc.php | 16 +-- .../modules/xpwiki/plugin/new.inc.php | 2 +- .../modules/xpwiki/plugin/newpage.inc.php | 8 +- .../xpwiki/plugin/page_comments.inc.php | 2 +- .../modules/xpwiki/plugin/paint.inc.php | 6 +- .../modules/xpwiki/plugin/pcomment.inc.php | 14 +- .../modules/xpwiki/plugin/pginfo.inc.php | 12 +- .../modules/xpwiki/plugin/random.inc.php | 2 +- .../modules/xpwiki/plugin/read.inc.php | 2 +- .../modules/xpwiki/plugin/recent.inc.php | 2 +- .../xpwiki/plugin/recentchanges.inc.php | 2 +- .../modules/xpwiki/plugin/redirect.inc.php | 10 +- .../modules/xpwiki/plugin/ref.inc.php | 48 +++---- .../modules/xpwiki/plugin/referer.inc.php | 8 +- .../modules/xpwiki/plugin/related.inc.php | 2 +- .../modules/xpwiki/plugin/relatedview.inc.php | 2 +- .../modules/xpwiki/plugin/rename.inc.php | 32 ++--- .../modules/xpwiki/plugin/replacer.inc.php | 10 +- .../modules/xpwiki/plugin/rss.inc.php | 18 +-- .../modules/xpwiki/plugin/rsslink.inc.php | 4 +- .../modules/xpwiki/plugin/ruby.inc.php | 2 +- .../modules/xpwiki/plugin/rws.inc.php | 2 +- .../modules/xpwiki/plugin/search.inc.php | 6 +- .../xpwiki/plugin/setlinebreak.inc.php | 2 +- .../modules/xpwiki/plugin/showrss.inc.php | 12 +- .../modules/xpwiki/plugin/siteimage.inc.php | 4 +- .../modules/xpwiki/plugin/sitemap.inc.php | 2 +- .../xpwiki/plugin/skin_changer.inc.php | 14 +- .../modules/xpwiki/plugin/skype.inc.php | 2 +- .../modules/xpwiki/plugin/source.inc.php | 2 +- .../modules/xpwiki/plugin/stationary.inc.php | 4 +- .../modules/xpwiki/plugin/sub.inc.php | 2 +- .../modules/xpwiki/plugin/subnote.inc.php | 8 +- .../modules/xpwiki/plugin/sup.inc.php | 2 +- .../modules/xpwiki/plugin/tag.inc.php | 4 +- .../modules/xpwiki/plugin/tb.inc.php | 4 +- .../modules/xpwiki/plugin/template.inc.php | 6 +- .../modules/xpwiki/plugin/topicpath.inc.php | 6 +- .../modules/xpwiki/plugin/tracker.inc.php | 62 ++++----- .../modules/xpwiki/plugin/twitter.inc.php | 2 +- .../modules/xpwiki/plugin/ucomedit.inc.php | 2 +- .../modules/xpwiki/plugin/unfreeze.inc.php | 2 +- .../modules/xpwiki/plugin/urlbookmark.inc.php | 2 +- .../modules/xpwiki/plugin/user_pref.inc.php | 10 +- .../modules/xpwiki/plugin/versionlist.inc.php | 4 +- .../modules/xpwiki/plugin/vote.inc.php | 8 +- .../modules/xpwiki/plugin/xoopsblock.inc.php | 2 +- .../modules/xpwiki/plugin/yahoo.inc.php | 14 +- .../modules/xpwiki/plugin/yetlist.inc.php | 4 +- .../modules/xpwiki/skin/keitai.skin.php | 4 +- .../modules/xpwiki/skin/print.skin.php | 8 +- .../modules/xpwiki/skin/pukiwiki.skin.php | 4 +- .../modules/xpwiki/skin/tdiary.skin.php | 10 +- .../modules/xpwiki/util/plugin_conv/index.php | 9 +- .../modules/xpwiki/util/skin_conv/index.php | 3 +- .../modules/xpwiki/ways/redirect_SJIS.php | 2 +- .../modules/xpwiki/ways/w2x_php5.php | 50 +++++--- 140 files changed, 765 insertions(+), 722 deletions(-) diff --git a/html/modules/xpwiki/skin/pukiwiki/pukiwiki.skin.php b/html/modules/xpwiki/skin/pukiwiki/pukiwiki.skin.php index 755d5ea4..d5e752f1 100644 --- a/html/modules/xpwiki/skin/pukiwiki/pukiwiki.skin.php +++ b/html/modules/xpwiki/skin/pukiwiki/pukiwiki.skin.php @@ -86,7 +86,7 @@ root->nofollow || ! $is_read) {?> cont['PKWK_ALLOW_JAVASCRIPT'] && isset($this->root->javascript)) {?> - <?php echo htmlspecialchars($this->root->pagetitle) ?> - <?php echo $this->root->siteinfo['sitename'] ?> + <?php echo htmlspecialchars($this->root->pagetitle, ENT_COMPAT, $this->cont['SOURCE_ENCODING']) ?> - <?php echo $this->root->siteinfo['sitename'] ?> root->nofollow || ! $is_read) {?> cont['PKWK_ALLOW_JAVASCRIPT'] && isset($this->root->javascript)) {?> - <?php echo htmlspecialchars($this->root->pagetitle) ?> - <?php echo $this->root->siteinfo['sitename'] ?> + <?php echo $this->htmlspecialchars($this->root->pagetitle) ?> - <?php echo $this->root->siteinfo['sitename'] ?>  : - ( {$defs[1]} ) + ( {$defs[1]} )
\n" ; @@ -162,13 +162,13 @@ function b_xpwiki_a_page_edit( $options ) ( {$defs[2]} )
 : - ( {$defs[3]} ) + ( {$defs[3]} )
 : - ( {$defs[4]} ) + ( {$defs[4]} )
 : - ( {$defs[5]} ) + ( {$defs[5]} )
 : Yes   No   ( {$defs[6]} ) @@ -177,7 +177,7 @@ function b_xpwiki_a_page_edit( $options )    
( {$defs[7]} )
 : -
( \"PageName\" or \"xpWiki module dirname::PageName\" ) +
( \"PageName\" or \"xpWiki module dirname::PageName\" )
\n" ; return $form; @@ -283,13 +283,13 @@ function b_xpwiki_block_edit( $options ) ( {$defs[1]} )
 : - ( {$defs[2]} ) + ( {$defs[2]} )
 : - ( {$defs[3]} ) + ( {$defs[3]} )
 : - ( {$defs[4]} ) + ( {$defs[4]} )
 :     diff --git a/xoops_trust_path/modules/xpwiki/class/attach.php b/xoops_trust_path/modules/xpwiki/class/attach.php index b1bdd62b..79ef9f54 100644 --- a/xoops_trust_path/modules/xpwiki/class/attach.php +++ b/xoops_trust_path/modules/xpwiki/class/attach.php @@ -182,7 +182,7 @@ function getstatus() $user = $user['uname_s']; if (!$this->status['owner']) { if ($this->status['uname']) { - $user = htmlspecialchars($this->status['uname']); + $user = $this->func->htmlspecialchars($this->status['uname']); } $user = $user . " [".$this->status['ucd'] . "]"; } @@ -254,7 +254,7 @@ function toString($showicon,$showinfo,$mode="") . '&'; $param2 = 'file='.$file_e; $title = $this->time_str.' '.$this->size_str; - $label = ($showicon ? $this->cont['FILE_ICON'] : '').htmlspecialchars($this->status['org_fname']); + $label = ($showicon ? $this->cont['FILE_ICON'] : '').$this->func->htmlspecialchars($this->status['org_fname']); if ($this->age) { if ($mode == "imglist"){ $label = 'backup No.'.$this->age; @@ -275,7 +275,7 @@ function toString($showicon,$showinfo,$mode="") if ($is_owner) $info .= ' &build_js(attachDel,'.str_replace('|', '|', $this->page).','.str_replace('|', '|', $this->file).','.$this->age.','.$returi.');'; } else { $info = "\n[root->script}?plugin=attach&pcmd=info{$param}{$param2}\" title=\"$_title\">{$this->root->_attach_messages['btn_info']}]"; - if ($is_owner) $info .= ''.$this->root->_btn_delete.''; + if ($is_owner) $info .= ''.$this->root->_btn_delete.''; } } $count = ($showicon and !empty($this->status['count'][$this->age])) ? @@ -308,8 +308,8 @@ function toString($showicon,$showinfo,$mode="") function info($err) { $r_page = rawurlencode($this->page); - $s_page = htmlspecialchars($this->page); - $s_file = htmlspecialchars($this->file); + $s_page = $this->func->htmlspecialchars($this->page); + $s_file = $this->func->htmlspecialchars($this->file); $s_err = ($err == '') ? '' : '

'.$this->root->_attach_messages[$err].'

'; $ref = ""; $img_info = ""; @@ -423,7 +423,7 @@ function info($err) { ' ' . '
'; + ($this->func->htmlspecialchars(empty($this->status['org_fname'])? $this->file : $this->status['org_fname'])) . '" />
'; } if ($this->status['copyright']) { $msg_copyright = ''; @@ -447,7 +447,7 @@ function info($err) { $info = $this->toString(TRUE,FALSE); $copyright = ($this->status['copyright'])? ' checked=TRUE' : ''; - $retval = array('msg'=>sprintf($this->root->_attach_messages['msg_info'],htmlspecialchars($this->file))); + $retval = array('msg'=>sprintf($this->root->_attach_messages['msg_info'],$this->func->htmlspecialchars($this->file))); $page_link = $this->func->make_pagelink($s_page); $ex_tags = ''; if ($this->status['imagesize']) { @@ -609,7 +609,7 @@ function delete($pass) $this->putstatus(TRUE); } if ($this->func->is_page($this->page)) { - $this->root->rtf['esummary'] = 'Deleted an attach file: ' . htmlspecialchars($this->file); + $this->root->rtf['esummary'] = 'Deleted an attach file: ' . $this->func->htmlspecialchars($this->file); $this->func->touch_page($this->page, NULL, TRUE); } @@ -781,7 +781,7 @@ function reinfo() { ($this->age ? '&age='.$this->age : ''); $redirect = "{$this->root->script}?plugin=attach&pcmd=info$param"; - $msg = str_replace('$1', htmlspecialchars($this->status['org_fname']), $this->root->_title_updated); + $msg = str_replace('$1', $this->func->htmlspecialchars($this->status['org_fname']), $this->root->_title_updated); return array('msg' => $msg, 'redirect' => $redirect); @@ -1109,7 +1109,7 @@ function toString($flat,$fromall=FALSE,$mode="") if ($this->is_popup) { continue; } - $_files[0] = htmlspecialchars($file); + $_files[0] = $this->func->htmlspecialchars($file); } ksort($_files); $_file = $_files[0]; @@ -1170,7 +1170,7 @@ function toString($flat,$fromall=FALSE,$mode="") $showall = ($fromall && $this->max < $this->count)? " [ Show All ]" : ""; if ($this->is_popup) { if ($fromall) { - $showall = "
" . htmlspecialchars($this->page) . '' . $filecount . '' . $showall . '
'; + $showall = "
" . $this->func->htmlspecialchars($this->page) . '' . $filecount . '' . $showall . '
'; } else { $showall = ''; } @@ -1338,11 +1338,11 @@ function toString($page='',$flat=FALSE) $hiddens = array(); $hiddens['plugin'] = 'attach'; $hiddens['pcmd'] = $pcmd; - $hiddens['refer'] = (isset($this->root->vars['refer']))? htmlspecialchars($this->root->vars['refer']) : ''; + $hiddens['refer'] = (isset($this->root->vars['refer']))? $this->func->htmlspecialchars($this->root->vars['refer']) : ''; foreach($otherkeys as $key) { if (isset($this->root->vars[$key])) { $otherprams[] = rawurlencode($key) . '=' . rawurlencode($this->root->vars[$key]); - $hiddens[htmlspecialchars($key)] = htmlspecialchars($this->root->vars[$key]); + $hiddens[$this->func->htmlspecialchars($key)] = $this->func->htmlspecialchars($this->root->vars[$key]); } } @@ -1372,7 +1372,7 @@ function toString($page='',$flat=FALSE) if ($this->root->vars['basedir'] === $dir) { $defaultpage = $this->root->vars['base']; } - $otherDirs[] = ''; + $otherDirs[] = ''; } $otherDir = '
Dir
'; } @@ -1412,7 +1412,7 @@ function toString($page='',$flat=FALSE) $_class = 'attachable'; if ($this->cont['UA_PROFILE'] !== 'default') $_attachable = '↑'; } - $otherPages[] = ''; + $otherPages[] = ''; } } $otherPages[] = ''; @@ -1425,14 +1425,14 @@ function toString($page='',$flat=FALSE) if ($this->func->check_readable($row[0], false, false)) { if (in_array($row[0], $shown)) continue; $selected = ($row[0] === $page)? ' selected="selected"' : ''; - $_page = htmlspecialchars($row[0]); + $_page = $this->func->htmlspecialchars($row[0]); $_attachable = ''; $_class = 'readable'; if ($attach->attachable($_page)) { $_class = 'attachable'; if ($this->cont['UA_PROFILE'] !== 'default') $_attachable = '↑'; } - $otherPages[] = ''; + $otherPages[] = ''; } } $otherPages[] = ''; @@ -1441,7 +1441,7 @@ function toString($page='',$flat=FALSE) $thisPage = ''; if ($this->root->vars['basedir'] === $this->root->mydirname) { $selected = ($this->root->vars['base'] === $page)? ' selected="selected"' : ''; - $thisPage .= ''; + $thisPage .= ''; } if (! empty($this->root->vars['refer'])) $thisPage .= ''; $base = rawurlencode($this->root->vars['base']); @@ -1470,7 +1470,7 @@ function xpwiki_dir_selector_change(dir) { EOD; } - $sword = (isset($this->root->vars['word']))? htmlspecialchars($this->root->vars['word']) : ''; + $sword = (isset($this->root->vars['word']))? $this->func->htmlspecialchars($this->root->vars['word']) : ''; $hidden = ''; unset($hiddens['word']); foreach($hiddens as $key=> $val) { diff --git a/xoops_trust_path/modules/xpwiki/class/convert_html.php b/xoops_trust_path/modules/xpwiki/class/convert_html.php index 8df7b5a6..06eb5298 100644 --- a/xoops_trust_path/modules/xpwiki/class/convert_html.php +++ b/xoops_trust_path/modules/xpwiki/class/convert_html.php @@ -391,11 +391,11 @@ function XpWikiTableCell(& $xpwiki, $text, $is_template = FALSE) { } else if ($matches[3]) { $name = $matches[2] ? 'background-color' : 'color'; - $this->style[$name] = $name.':'.htmlspecialchars($matches[3]).';'; + $this->style[$name] = $name.':'.$this->func->htmlspecialchars($matches[3]).';'; $text = $matches[5]; } else if ($matches[4]) { - $this->style['size'] = 'font-size:'.htmlspecialchars($matches[4]).'px;'; + $this->style['size'] = 'font-size:'.$this->func->htmlspecialchars($matches[4]).'px;'; $text = $matches[5]; } } @@ -504,7 +504,7 @@ function get_cell_style($string) { // セル背景画 if (preg_match("/(?:[SCB]C):\(([^),]*)(,once|,1)?\) ?/i",$cells[0],$tmp)) { if (strpos($tmp[1], $this->cont['ROOT_URL']) === 0) { - $tmp[1] = htmlspecialchars($tmp[1]); + $tmp[1] = $this->func->htmlspecialchars($tmp[1]); $this->style['background-image'] .= "background-image: url(".$tmp[1].");"; if (!empty($tmp[2])) $this->style['background-image'] .= "background-repeat: no-repeat;"; } @@ -813,7 +813,7 @@ function get_table_style($string) { // テーブル背景画像指定 if (preg_match("/TC:\(([^),]*)(,(?:no|one(?:ce)?|1))?\) ?/i",$string,$reg)) { if (strpos($reg[1], $this->cont['ROOT_URL']) === 0) { - $reg[1] = htmlspecialchars($reg[1]); + $reg[1] = $this->func->htmlspecialchars($reg[1]); $this->table_sheet .= "background-image: url(".$reg[1].");"; if (!empty($reg[2])) $this->table_sheet .= "background-repeat: no-repeat;"; } @@ -926,7 +926,7 @@ function toString() { class XpWikiPre extends XpWikiElement { function XpWikiPre(& $root, $text) { parent :: XpWikiElement($root->xpwiki); - $this->elements[] = htmlspecialchars((!$this->root->preformat_ltrim || $text === '' || $text { + $this->elements[] = $this->func->htmlspecialchars((!$this->root->preformat_ltrim || $text === '' || $text { 0} != ' ') ? $text : substr($text, 1)); } diff --git a/xoops_trust_path/modules/xpwiki/class/ext_autolink.php b/xoops_trust_path/modules/xpwiki/class/ext_autolink.php index 9046de8b..f25be5af 100644 --- a/xoops_trust_path/modules/xpwiki/class/ext_autolink.php +++ b/xoops_trust_path/modules/xpwiki/class/ext_autolink.php @@ -49,7 +49,7 @@ function ext_autolink_replace($match) { if (strlen($name) < $this->ext_autolink_len) {return $match[0];} $page = $this->ext_autolink_base.$name; - $title = htmlspecialchars(str_replace('[KEY]', $this->ext_autolink_base.$name, $this->ext_autolink_title)); + $title = $this->func->htmlspecialchars(str_replace('[KEY]', $this->ext_autolink_base.$name, $this->ext_autolink_title)); if ($this->ext_autolink_own !== false) { // own site @@ -69,9 +69,9 @@ function ext_autolink_replace($match) { if (isset($this->ext_autolink_replace['from'])) { $_url = str_replace($this->ext_autolink_replace['from'], $this->ext_autolink_replace['func']($page), $this->ext_autolink_pat); } - return ''.htmlspecialchars($name).''; + return ''.$this->func->htmlspecialchars($name).''; } else { - return ''.htmlspecialchars($name).''; + return ''.$this->func->htmlspecialchars($name).''; } } } diff --git a/xoops_trust_path/modules/xpwiki/class/extension/xoopsSearch.php b/xoops_trust_path/modules/xpwiki/class/extension/xoopsSearch.php index bc12bd97..49eb9473 100644 --- a/xoops_trust_path/modules/xpwiki/class/extension/xoopsSearch.php +++ b/xoops_trust_path/modules/xpwiki/class/extension/xoopsSearch.php @@ -89,7 +89,7 @@ function get ($keywords , $andor , $limit , $offset , $userid) { $link = $this->func->get_page_uri($myrow['name']); $ret[] = array( 'link' => $link . ((strpos($link, '?') === false)? '?' : '&') . 'word=' . $sword, - 'title' => htmlspecialchars($myrow['name'].$title, ENT_QUOTES), + 'title' => htmlspecialchars($myrow['name'].$title, ENT_QUOTES ,_CHARSET), 'image' => 'skin/loader.php?src=xoops_search.png', 'time' => $myrow['editedtime'] + $this->cont['LOCALZONE'], 'uid' => $myrow['uid'], diff --git a/xoops_trust_path/modules/xpwiki/class/func/base_func.php b/xoops_trust_path/modules/xpwiki/class/func/base_func.php index 6f7a35d2..ce7e1514 100644 --- a/xoops_trust_path/modules/xpwiki/class/func/base_func.php +++ b/xoops_trust_path/modules/xpwiki/class/func/base_func.php @@ -44,7 +44,7 @@ function get_userinfo_by_id ($uid, $defname=NULL) { 'admin' => FALSE, 'uid' => 0, 'uname' => $defname, - 'uname_s' => htmlspecialchars($defname), + 'uname_s' => $this->htmlspecialchars($defname), 'email' => '', 'gids' => array(), ); diff --git a/xoops_trust_path/modules/xpwiki/class/func/pukiwiki_func.php b/xoops_trust_path/modules/xpwiki/class/func/pukiwiki_func.php index d3efe6d0..a7270820 100644 --- a/xoops_trust_path/modules/xpwiki/class/func/pukiwiki_func.php +++ b/xoops_trust_path/modules/xpwiki/class/func/pukiwiki_func.php @@ -180,7 +180,7 @@ function page_write($page, $postdata, $notimestamp = FALSE) if ($this->root->vars['cmd'] === 'edit' && isset($this->root->vars['esummary'])) { $esummary = $this->root->vars['esummary']; $esummary = str_replace(array("\r", "\n", "\t"), ' ', $esummary); - $esummary = htmlspecialchars($esummary); + $esummary = $this->htmlspecialchars($esummary); } else { if (! empty($this->root->rtf['esummary'])) { $esummary = $this->root->rtf['esummary']; @@ -252,7 +252,7 @@ function page_write($page, $postdata, $notimestamp = FALSE) $pginfo['lastucd'] = $this->root->userinfo['ucd']; $pginfo['lastuname'] = $this->root->userinfo['uname_s']; if ($this->root->cookie['name'] && $this->root->userinfo['uname'] !== $this->root->cookie['name']) { - $pginfo['lastuname'] = htmlspecialchars($this->root->cookie['name']); + $pginfo['lastuname'] = $this->htmlspecialchars($this->root->cookie['name']); if ($mode === 'insert') { $pginfo['uname'] = $pginfo['lastuname']; } @@ -260,7 +260,7 @@ function page_write($page, $postdata, $notimestamp = FALSE) $pginfo['lastuname'] .= '('.$pginfo['lastuname'].')'; } } - $pginfo['lastuname'] = htmlspecialchars($pginfo['lastuname']); + $pginfo['lastuname'] = $this->htmlspecialchars($pginfo['lastuname']); if (! is_null($pgorder)) $pginfo['pgorder'] = $pgorder; $pginfo['esummary'] = $esummary; $pginfo_str = '#pginfo('.join("\t",$pginfo).')'."\n"; @@ -655,7 +655,7 @@ function file_write($dir, $page, $str, $notimestamp = FALSE) // File replacement (Edit) if (! $this->is_pagename($page)) - $this->die_message(str_replace('$1', htmlspecialchars($page), + $this->die_message(str_replace('$1', $this->htmlspecialchars($page), str_replace('$2', 'WikiName', $this->root->_msg_invalidiwn))); $str = rtrim(preg_replace('/' . "\r" . '/', '', $str)) . "\n"; @@ -663,12 +663,12 @@ function file_write($dir, $page, $str, $notimestamp = FALSE) if (! HypCommonFunc::flock_put_contents($file, $str)) { die('fopen() failed: ' . - htmlspecialchars(basename($dir) . '/' . $this->encode($page) . '.txt') . + $this->htmlspecialchars(basename($dir) . '/' . $this->encode($page) . '.txt') . '
' . "\n" . 'Maybe permission is not writable or filename is too long'); } // $fp = fopen($file, 'a') or die('fopen() failed: ' . -// htmlspecialchars(basename($dir) . '/' . $this->encode($page) . '.txt') . +// $this->htmlspecialchars(basename($dir) . '/' . $this->encode($page) . '.txt') . // '
' . "\n" . // 'Maybe permission is not writable or filename is too long'); // set_file_buffer($fp, 0); @@ -722,7 +722,7 @@ function add_recent($page, $recentpage, $subject = '', $limit = 0) // Add array_unshift($lines, '-' . $this->format_date($this->cont['UTIME']) . ' - ' . $_page . - htmlspecialchars($subject) . "\n"); + $this->htmlspecialchars($subject) . "\n"); // Get latest $limit reports $lines = array_splice($lines, 0, $limit); @@ -1016,7 +1016,7 @@ function pkwk_chown($filename, $preserve_time = TRUE) // Check owner $stat = stat($filename) or - die('pkwk_chown(): stat() failed for: ' . basename(htmlspecialchars($filename))); + die('pkwk_chown(): stat() failed for: ' . basename($this->htmlspecialchars($filename))); if ($stat[4] === $php_uid) { // NOTE: Windows always here $result = TRUE; // Seems the same UID. Nothing to do @@ -1033,10 +1033,10 @@ function pkwk_chown($filename, $preserve_time = TRUE) if ($donot) { if (filemtime($tmp) + 30 < time()) { if (! @ unlink($tmp)) { - die('pkwk_chown(): failed. Not writable a flie. "'.basename(htmlspecialchars($tmp)).'"'); + die('pkwk_chown(): failed. Not writable a flie. "'.basename($this->htmlspecialchars($tmp)).'"'); } } else { - die('pkwk_chown(): failed. Already exists "'.basename(htmlspecialchars($tmp)).'"'); + die('pkwk_chown(): failed. Already exists "'.basename($this->htmlspecialchars($tmp)).'"'); } } @@ -1045,7 +1045,7 @@ function pkwk_chown($filename, $preserve_time = TRUE) // NOTE: Not 'r+'. Don't check write permission here $ffile = fopen($filename, 'r') or die('pkwk_chown(): fopen() failed for: ' . - basename(htmlspecialchars($filename))); + basename($this->htmlspecialchars($filename))); // Try to chown by re-creating files // NOTE: @@ -1068,7 +1068,7 @@ function pkwk_chown($filename, $preserve_time = TRUE) fclose($ffile); @unlink($tmp); die('pkwk_chown(): flock() failed for: ' . - basename(htmlspecialchars($filename))); + basename($this->htmlspecialchars($filename))); } } @@ -1090,7 +1090,7 @@ function pkwk_touch_file($filename, $time = FALSE, $atime = FALSE) return $result; } else { die('pkwk_touch_file(): Invalid UID and (not writable for the directory or not a flie): ' . - htmlspecialchars(basename($filename))); + $this->htmlspecialchars(basename($filename))); } } //----- End file.php -----// @@ -1495,12 +1495,12 @@ function is_freeze($page, $clearcache = FALSE) return FALSE; } else { $fp = fopen($this->get_filename($page), 'rb') or - die('is_freeze(): fopen() failed: ' . htmlspecialchars($page)); + die('is_freeze(): fopen() failed: ' . $this->htmlspecialchars($page)); flock($fp, LOCK_SH); rewind($fp); $buffer = fgets($fp, 9); flock($fp, LOCK_UN); - fclose($fp) or die('is_freeze(): fclose() failed: ' . htmlspecialchars($page)); + fclose($fp) or die('is_freeze(): fclose() failed: ' . $this->htmlspecialchars($page)); $is_freeze[$this->root->mydirname][$page] = ($buffer !== FALSE && rtrim($buffer, "\r\n") === '#freeze'); return $is_freeze[$this->root->mydirname][$page]; @@ -1613,7 +1613,7 @@ function get_search_words($words = array(), $do_escape = FALSE) $char = mb_substr($word_nm, $pos, 1, $this->cont['SOURCE_ENCODING']); // Just normalized one? (ASCII char or Zenkaku-Katakana?) - $or = array(preg_quote($do_escape ? htmlspecialchars($char) : $char, $quote)); + $or = array(preg_quote($do_escape ? $this->htmlspecialchars($char) : $char, $quote)); if (strlen($char) === 1) { // An ASCII (single-byte) character foreach (array(strtoupper($char), strtolower($char)) as $_char) { @@ -1690,7 +1690,7 @@ function do_search($word, $type = 'AND', $non_format = FALSE, $base = '') if ($non_format) return array_keys($pages); $r_word = rawurlencode($word); - $s_word = htmlspecialchars($word); + $s_word = $this->htmlspecialchars($word); if (empty($pages)) return str_replace('$1', $s_word, $this->root->_msg_notfoundresult); @@ -1699,7 +1699,7 @@ function do_search($word, $type = 'AND', $non_format = FALSE, $base = '') $retval = '