NobuNobu
nobun****@users*****
2006年 12月 3日 (日) 00:48:30 JST
Index: xoops2jp/html/class/smarty/plugins/function.xoops_dhtmltarea.php diff -u xoops2jp/html/class/smarty/plugins/function.xoops_dhtmltarea.php:1.1.2.4 xoops2jp/html/class/smarty/plugins/function.xoops_dhtmltarea.php:1.1.2.4.2.1 --- xoops2jp/html/class/smarty/plugins/function.xoops_dhtmltarea.php:1.1.2.4 Thu Jul 13 17:24:46 2006 +++ xoops2jp/html/class/smarty/plugins/function.xoops_dhtmltarea.php Sun Dec 3 00:48:30 2006 @@ -10,7 +10,7 @@ * used. For format xoops_xxxx functions, we may change XoopsForm class * group. * - * @version $Id: function.xoops_dhtmltarea.php,v 1.1.2.4 2006/07/13 08:24:46 minahito Exp $ + * @version $Id: function.xoops_dhtmltarea.php,v 1.1.2.4.2.1 2006/12/02 15:48:30 nobunobu Exp $ */ /* @@ -43,6 +43,8 @@ } $form = null; + $root =& XCube_Root::getSingleton(); + $textFilter =& $root->getTextFilter(); if (isset($params['name'])) { // // Fetch major elements from $params. @@ -51,13 +53,13 @@ $class = isset($params['class']) ? trim($params['class']) : null; $cols = isset($params['cols']) ? intval($params['cols']) : XOOPS_DHTMLTAREA_DEFAULT_COLS; $rows = isset($params['rows']) ? intval($params['rows']) : XOOPS_DHTMLTAREA_DEFAULT_ROWS; - $value = isset($params['value']) ? trim($params['value']) : null; + $value = isset($params['value']) ? $textFilter->ToEdit(trim($params['value'])) : null; $id = isset($params['id']) ? trim($params['id']) : XOOPS_DHTMLTAREA_DEFID_PREFIX . $name; // // Build the object for output. // - $form =& new XoopsFormDhtmlTextArea($name, $name, htmlspecialchars($value), $rows, $cols); + $form =& new XoopsFormDhtmlTextArea($name, $name, $value, $rows, $cols); $form->setId($id); if ($class != null) { $form->setClass($class); Index: xoops2jp/html/class/smarty/plugins/function.xoops_input.php diff -u xoops2jp/html/class/smarty/plugins/function.xoops_input.php:1.1.2.9.2.1 xoops2jp/html/class/smarty/plugins/function.xoops_input.php:1.1.2.9.2.2 --- xoops2jp/html/class/smarty/plugins/function.xoops_input.php:1.1.2.9.2.1 Sun Nov 12 14:11:24 2006 +++ xoops2jp/html/class/smarty/plugins/function.xoops_input.php Sun Dec 3 00:48:30 2006 @@ -8,7 +8,7 @@ * $params['script']... This function have not impletented that yet. At * implementing, we will have to define the rule about sanitizing. * - * @version $Id: function.xoops_input.php,v 1.1.2.9.2.1 2006/11/12 05:11:24 tom_g3x Exp $ + * @version $Id: function.xoops_input.php,v 1.1.2.9.2.2 2006/12/02 15:48:30 nobunobu Exp $ */ /* @@ -44,10 +44,12 @@ // // Fetch major elements from $params. // + $root =& XCube_Root::getSingleton(); + $textFilter =& $root->getTextFilter(); $name = trim($params['name']); $key = isset($params['key']) ? trim($params['key']) : null; $type = isset($params['type']) ? strtolower(trim($params['type'])) : "text"; - $value = isset($params['value']) ? htmlspecialchars($params['value'], ENT_QUOTES) : null; + $value = isset($params['value']) ? $textFilter->ToEdit($params['value']) : null; $class = isset($params['class']) ? trim($params['class']) : null; $id = isset($params['id']) ? trim($params['id']) : XOOPS_INPUT_DEFID_PREFIX . $name; $size = isset($params['size']) ? intval($params['size']) : null; Index: xoops2jp/html/class/smarty/plugins/function.xoops_optionsArray.php diff -u xoops2jp/html/class/smarty/plugins/function.xoops_optionsArray.php:1.1.2.4.2.2 xoops2jp/html/class/smarty/plugins/function.xoops_optionsArray.php:1.1.2.4.2.3 --- xoops2jp/html/class/smarty/plugins/function.xoops_optionsArray.php:1.1.2.4.2.2 Sun Nov 12 14:11:24 2006 +++ xoops2jp/html/class/smarty/plugins/function.xoops_optionsArray.php Sun Dec 3 00:48:30 2006 @@ -30,10 +30,11 @@ $objectArr =& $params['from']; $default = isset($params['default']) ? $params['default'] : null; $id = isset($params['id']) ? $params['id'] : null; - + $root =& XCube_Root::getSingleton(); + $textFilter =& $root->getTextFilter(); foreach ($objectArr as $object) { - $value = htmlspecialchars($object->get($params['value']), ENT_QUOTES); - $label = htmlspecialchars($object->get($params['label']), ENT_QUOTES); + $value = $textFilter->ToShow($object->get($params['value'])); + $label = $textFilter->ToShow($object->get($params['label'])); $selected = ""; if (is_array($default) && in_array($object->get($params['value']), $default)) { Index: xoops2jp/html/class/smarty/plugins/function.xoops_textarea.php diff -u xoops2jp/html/class/smarty/plugins/function.xoops_textarea.php:1.1.2.5 xoops2jp/html/class/smarty/plugins/function.xoops_textarea.php:1.1.2.5.2.1 --- xoops2jp/html/class/smarty/plugins/function.xoops_textarea.php:1.1.2.5 Tue Aug 8 17:29:00 2006 +++ xoops2jp/html/class/smarty/plugins/function.xoops_textarea.php Sun Dec 3 00:48:30 2006 @@ -7,7 +7,7 @@ * $params['script']... This function have not impletented that yet. At * implementing, we will have to define the rule about sanitizing. * - * @version $Id: function.xoops_textarea.php,v 1.1.2.5 2006/08/08 08:29:00 tom_g3x Exp $ + * @version $Id: function.xoops_textarea.php,v 1.1.2.5.2.1 2006/12/02 15:48:30 nobunobu Exp $ */ /* @@ -37,6 +37,8 @@ function smarty_function_xoops_textarea($params, &$smarty) { + $root =& XCube_Root::getSingleton(); + $textFilter =& $root->getTextFilter(); if (isset($params['name'])) { // // Fetch major elements from $params. @@ -45,7 +47,7 @@ $class = isset($params['class']) ? trim($params['class']) : null; $cols = isset($params['cols']) ? intval($params['cols']) : XOOPS_TEXTAREA_DEFAULT_COLS; $rows = isset($params['rows']) ? intval($params['rows']) : XOOPS_TEXTAREA_DEFAULT_ROWS; - $value = isset($params['value']) ? htmlspecialchars($params['value'], ENT_QUOTES) : null; + $value = isset($params['value']) ? $textFilter->ToEdit($params['value']) : null; $id = isset($params['id']) ? trim($params['id']) : XOOPS_TEXTAREA_DEFID_PREFIX . $name; $readonly = isset($params['readonly']) ? trim($params['readonly']) : null; Index: xoops2jp/html/class/smarty/plugins/modifier.xoops_escape.php diff -u /dev/null xoops2jp/html/class/smarty/plugins/modifier.xoops_escape.php:1.1.2.1 --- /dev/null Sun Dec 3 00:48:30 2006 +++ xoops2jp/html/class/smarty/plugins/modifier.xoops_escape.php Sun Dec 3 00:48:30 2006 @@ -0,0 +1,42 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/* + * Smarty plugin + * ------------------------------------------------------------- + * Type: modifier + * Name: xoops_escape + * Author: nobunobu + * Purpose: Escape the string according to escapement type(XOOPS custom version) + * @param string + * @param show|edit|plain|link + * @return string + * + * Examples: {$msg|xoops_excape} + * ------------------------------------------------------------- + */ + +function smarty_modifier_xoops_escape($string, $esc_type = 'show') +{ + $root =& XCube_Root::getSingleton(); + $textFilter =& $root->getTextFilter(); + switch ($esc_type) { + case 'show': + return $textFilter->ToShow($string); + + case 'edit': + return $textFilter->ToEdit($string); + + case 'plain': + case 'link': + return htmlspecialchars($string, ENT_QUOTES); + + default: + return $string; + } +} +?>