NobuNobu
nobun****@users*****
2005年 11月 20日 (日) 17:05:54 JST
Index: xoops2jp/html/class/smarty/plugins/function.config_load.php diff -u xoops2jp/html/class/smarty/plugins/function.config_load.php:1.1 xoops2jp/html/class/smarty/plugins/function.config_load.php:1.1.8.1 --- xoops2jp/html/class/smarty/plugins/function.config_load.php:1.1 Fri Mar 18 21:56:02 2005 +++ xoops2jp/html/class/smarty/plugins/function.config_load.php Sun Nov 20 17:05:54 2005 @@ -26,7 +26,7 @@ { if ($smarty->debugging) { $_params = array(); - require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php'); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); $_debug_start_time = smarty_core_get_microtime($_params, $smarty); } @@ -101,7 +101,7 @@ $_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>'; } $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp'])); - require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_compiled_resource.php'); + require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php'); smarty_core_write_compiled_resource($_params, $smarty); } else { include($_compile_file); @@ -126,7 +126,7 @@ if ($smarty->debugging) { $_params = array(); - require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php'); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); $smarty->_smarty_debug_info[] = array('type' => 'config', 'filename' => $_file.' ['.$_section.'] '.$_scope, 'depth' => $smarty->_inclusion_depth, Index: xoops2jp/html/class/smarty/plugins/function.cycle.php diff -u xoops2jp/html/class/smarty/plugins/function.cycle.php:1.2 xoops2jp/html/class/smarty/plugins/function.cycle.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.cycle.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.cycle.php Sun Nov 20 17:05:54 2005 @@ -32,7 +32,7 @@ * </pre> * @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle} * (Smarty online manual) - * @author Monte Ohrt <monte****@ispi*****> + * @author Monte Ohrt <monte at ohrt dot com> * @author credit to Mark Priatel <mpria****@roger*****> * @author credit to Gerard <gerar****@inter*****> * @author credit to Jason Sweat <jsweat_php****@yahoo*****> Index: xoops2jp/html/class/smarty/plugins/function.debug.php diff -u xoops2jp/html/class/smarty/plugins/function.debug.php:1.2 xoops2jp/html/class/smarty/plugins/function.debug.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.debug.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.debug.php Sun Nov 20 17:05:54 2005 @@ -15,7 +15,7 @@ * Purpose: popup debug window * @link http://smarty.php.net/manual/en/language.function.debug.php {debug} * (Smarty online manual) - * @author Monte Ohrt <monte****@ispi*****> + * @author Monte Ohrt <monte at ohrt dot com> * @version 1.0 * @param array * @param Smarty @@ -26,7 +26,7 @@ if (isset($params['output'])) { $smarty->assign('_smarty_debug_output', $params['output']); } - require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.display_debug_console.php'); + require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); return smarty_core_display_debug_console(null, $smarty); } Index: xoops2jp/html/class/smarty/plugins/function.fetch.php diff -u xoops2jp/html/class/smarty/plugins/function.fetch.php:1.2 xoops2jp/html/class/smarty/plugins/function.fetch.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.fetch.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.fetch.php Sun Nov 20 17:05:54 2005 @@ -29,7 +29,7 @@ $content = ''; if ($smarty->security && !preg_match('!^(http|ftp)://!i', $params['file'])) { $_params = array('resource_type' => 'file', 'resource_name' => $params['file']); - require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.is_secure.php'); + require_once(SMARTY_CORE_DIR . 'core.is_secure.php'); if(!smarty_core_is_secure($_params, $smarty)) { $smarty->_trigger_fatal_error('[plugin] (secure mode) fetch \'' . $params['file'] . '\' is not allowed'); return; Index: xoops2jp/html/class/smarty/plugins/function.html_checkboxes.php diff -u xoops2jp/html/class/smarty/plugins/function.html_checkboxes.php:1.2 xoops2jp/html/class/smarty/plugins/function.html_checkboxes.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.html_checkboxes.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.html_checkboxes.php Sun Nov 20 17:05:54 2005 @@ -31,7 +31,7 @@ * @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} * (Smarty online manual) * @author Christopher Kvarme <chris****@flash*****> - * @author credits to Monte Ohrt <monte****@ispi*****> + * @author credits to Monte Ohrt <monte at ohrt dot com> * @version 1.0 * @param array * @param Smarty @@ -101,7 +101,7 @@ settype($selected, 'array'); $_html_result = array(); - if (is_array($options)) { + if (isset($options)) { foreach ($options as $_key=>$_val) $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); Index: xoops2jp/html/class/smarty/plugins/function.html_image.php diff -u xoops2jp/html/class/smarty/plugins/function.html_image.php:1.2 xoops2jp/html/class/smarty/plugins/function.html_image.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.html_image.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.html_image.php Sun Nov 20 17:05:54 2005 @@ -15,17 +15,16 @@ * Purpose: format HTML tags for the image<br> * Input:<br> * - file = file (and path) of image (required) - * - border = border width (optional, default 0) * - height = image height (optional, default actual height) - * - image =image width (optional, default actual width) + * - width = image width (optional, default actual width) * - basedir = base directory for absolute paths, default * is environment variable DOCUMENT_ROOT * * Examples: {html_image file="images/masthead.gif"} - * Output: <img src="images/masthead.gif" border=0 width=400 height=23> + * Output: <img src="images/masthead.gif" width=400 height=23> * @link http://smarty.php.net/manual/en/language.function.html.image.php {html_image} * (Smarty online manual) - * @author Monte Ohrt <monte****@ispi*****> + * @author Monte Ohrt <monte at ohrt dot com> * @author credits to Duda <duda****@big*****> - wrote first image function * in repository, helped with lots of functionality * @version 1.0 @@ -40,7 +39,6 @@ $alt = ''; $file = ''; - $border = 0; $height = ''; $width = ''; $extra = ''; @@ -51,7 +49,6 @@ foreach($params as $_key => $_val) { switch($_key) { case 'file': - case 'border': case 'height': case 'width': case 'dpi': @@ -97,7 +94,7 @@ if(!isset($params['width']) || !isset($params['height'])) { if ($smarty->security && ($_params = array('resource_type' => 'file', 'resource_name' => $_image_path)) && - (require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.is_secure.php')) && + (require_once(SMARTY_CORE_DIR . 'core.is_secure.php')) && (!smarty_core_is_secure($_params, $smarty)) ) { $smarty->trigger_error("html_image: (secure) '$_image_path' not in secure directory", E_USER_NOTICE); @@ -134,7 +131,7 @@ $height = round($height * $_resize); } - return $prefix . '<img src="'.$file.'" alt="'.$alt.'" border="'.$border.'" width="'.$width.'" height="'.$height.'"'.$extra.' />' . $suffix; + return $prefix . '<img src="'.$file.'" alt="'.$alt.'" width="'.$width.'" height="'.$height.'"'.$extra.' />' . $suffix; } /* vim: set expandtab: */ Index: xoops2jp/html/class/smarty/plugins/function.html_options.php diff -u xoops2jp/html/class/smarty/plugins/function.html_options.php:1.2 xoops2jp/html/class/smarty/plugins/function.html_options.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.html_options.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.html_options.php Sun Nov 20 17:05:54 2005 @@ -72,14 +72,14 @@ $_html_result = ''; - if (is_array($options)) { + if (isset($options)) { foreach ($options as $_key=>$_val) $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected); } else { - foreach ((array)$values as $_i=>$_key) { + foreach ($values as $_i=>$_key) { $_val = isset($output[$_i]) ? $output[$_i] : ''; $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected); } Index: xoops2jp/html/class/smarty/plugins/function.html_radios.php diff -u xoops2jp/html/class/smarty/plugins/function.html_radios.php:1.2 xoops2jp/html/class/smarty/plugins/function.html_radios.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.html_radios.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.html_radios.php Sun Nov 20 17:05:54 2005 @@ -31,7 +31,7 @@ * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios} * (Smarty online manual) * @author Christopher Kvarme <chris****@flash*****> - * @author credits to Monte Ohrt <monte****@ispi*****> + * @author credits to Monte Ohrt <monte at ohrt dot com> * @version 1.0 * @param array * @param Smarty @@ -48,6 +48,7 @@ $selected = null; $separator = ''; $labels = true; + $label_ids = false; $output = null; $extra = ''; @@ -68,6 +69,7 @@ break; case 'labels': + case 'label_ids': $$_key = (bool)$_val; break; @@ -103,16 +105,16 @@ $_html_result = array(); - if (isset($options) && is_array($options)) { + if (isset($options)) { - foreach ((array)$options as $_key=>$_val) - $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels); + foreach ($options as $_key=>$_val) + $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids); } else { - foreach ((array)$values as $_i=>$_key) { + foreach ($values as $_i=>$_key) { $_val = isset($output[$_i]) ? $output[$_i] : ''; - $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels); + $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids); } } @@ -125,14 +127,23 @@ } -function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels) { +function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) { $_output = ''; - if ($labels) $_output .= '<label>'; - $_output .= '<input type="radio" name="' + if ($labels) { + if($label_ids) { + $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value)); + $_output .= '<label for="' . $_id . '">'; + } else { + $_output .= '<label>'; + } + } + $_output .= '<input type="radio" name="' . smarty_function_escape_special_chars($name) . '" value="' . smarty_function_escape_special_chars($value) . '"'; - if ($value==$selected) { + if ($labels && $label_ids) $_output .= ' id="' . $_id . '"'; + + if ((string)$value==$selected) { $_output .= ' checked="checked"'; } $_output .= $extra . ' />' . $output; Index: xoops2jp/html/class/smarty/plugins/function.html_select_date.php diff -u xoops2jp/html/class/smarty/plugins/function.html_select_date.php:1.2 xoops2jp/html/class/smarty/plugins/function.html_select_date.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.html_select_date.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.html_select_date.php Sun Nov 20 17:05:54 2005 @@ -34,6 +34,7 @@ */ function smarty_function_html_select_date($params, &$smarty) { + require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); require_once $smarty->_get_plugin_filepath('shared','make_timestamp'); require_once $smarty->_get_plugin_filepath('function','html_options'); /* Default values. */ @@ -78,6 +79,7 @@ $day_empty = null; $month_empty = null; $year_empty = null; + $extra_attrs = ''; foreach ($params as $_key=>$_value) { switch ($_key) { @@ -119,8 +121,12 @@ break; default: - $smarty->trigger_error("[html_select_date] unknown parameter $_key", E_USER_WARNING); - + if(!is_array($_value)) { + $extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"'; + } else { + $smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + } + break; } } @@ -152,13 +158,15 @@ $start_year = strftime('%Y') - $match[2]; } } - if($start_year > $time[0] && !isset($params['start_year'])) { - // force start year to include given date if not explicitly set - $start_year = $time[0]; - } - if($end_year < $time[0] && !isset($params['end_year'])) { - // force end year to include given date if not explicitly set - $end_year = $time[0]; + if (strlen($time[0]) > 0) { + if ($start_year > $time[0] && !isset($params['start_year'])) { + // force start year to include given date if not explicitly set + $start_year = $time[0]; + } + if($end_year < $time[0] && !isset($params['end_year'])) { + // force end year to include given date if not explicitly set + $end_year = $time[0]; + } } $field_order = strtoupper($field_order); @@ -192,11 +200,11 @@ if (null !== $all_extra){ $month_result .= ' ' . $all_extra; } - $month_result .= '>'."\n"; + $month_result .= $extra_attrs . '>'."\n"; $month_result .= smarty_function_html_options(array('output' => $month_names, 'values' => $month_values, - 'selected' => $a=$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '', + 'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '', 'print_result' => false), $smarty); $month_result .= '</select>'; @@ -228,7 +236,7 @@ if (null !== $day_extra){ $day_result .= ' ' . $day_extra; } - $day_result .= '>'."\n"; + $day_result .= $extra_attrs . '>'."\n"; $day_result .= smarty_function_html_options(array('output' => $days, 'values' => $day_values, 'selected' => $time[2], @@ -251,11 +259,13 @@ if (null !== $year_extra){ $year_result .= ' ' . $year_extra; } - $year_result .= '>'; + $year_result .= ' />'; } else { $years = range((int)$start_year, (int)$end_year); if ($reverse_years) { rsort($years, SORT_NUMERIC); + } else { + sort($years, SORT_NUMERIC); } $yearvals = $years; if(isset($year_empty)) { @@ -272,7 +282,7 @@ if (null !== $year_extra){ $year_result .= ' ' . $year_extra; } - $year_result .= '>'."\n"; + $year_result .= $extra_attrs . '>'."\n"; $year_result .= smarty_function_html_options(array('output' => $years, 'values' => $yearvals, 'selected' => $time[0], Index: xoops2jp/html/class/smarty/plugins/function.html_table.php diff -u xoops2jp/html/class/smarty/plugins/function.html_table.php:1.2 xoops2jp/html/class/smarty/plugins/function.html_table.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.html_table.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.html_table.php Sun Nov 20 17:05:54 2005 @@ -33,7 +33,7 @@ * {table loop=$data cols=4 tr_attr='"bgcolor=red"'} * {table loop=$data cols=4 tr_attr=$colors} * </pre> - * @author Monte Ohrt <monte****@ispi*****> + * @author Monte Ohrt <monte at ohrt dot com> * @version 1.0 * @link http://smarty.php.net/manual/en/language.function.html.table.php {html_table} * (Smarty online manual) @@ -73,6 +73,7 @@ case 'trailpad': case 'hdir': case 'vdir': + case 'inner': $$_key = (string)$_value; break; Index: xoops2jp/html/class/smarty/plugins/function.mailto.php diff -u xoops2jp/html/class/smarty/plugins/function.mailto.php:1.2 xoops2jp/html/class/smarty/plugins/function.mailto.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.mailto.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.mailto.php Sun Nov 20 17:05:54 2005 @@ -20,6 +20,7 @@ * - encode = (optional) can be one of: * * none : no encoding (default) * * javascript : encode with javascript + * * javascript_charcode : encode with javascript charcode * * hex : encode with hexidecimal (no javascript) * - cc = (optional) address(es) to carbon copy * - bcc = (optional) address(es) to blind carbon copy @@ -40,7 +41,7 @@ * @link http://smarty.php.net/manual/en/language.function.mailto.php {mailto} * (Smarty online manual) * @version 1.2 - * @author Monte Ohrt <monte****@ispi*****> + * @author Monte Ohrt <monte at ohrt dot com> * @author credits to Jason Sweat (added cc, bcc and subject functionality) * @param array * @param Smarty @@ -92,7 +93,7 @@ $address .= $mail_parm_vals; $encode = (empty($params['encode'])) ? 'none' : $params['encode']; - if (!in_array($encode,array('javascript','hex','none')) ) { + if (!in_array($encode,array('javascript','javascript_charcode','hex','none')) ) { $smarty->trigger_error("mailto: 'encode' parameter must be none, javascript or hex"); return; } @@ -107,6 +108,25 @@ return '<script type="text/javascript">eval(unescape(\''.$js_encode.'\'))</script>'; + } elseif ($encode == 'javascript_charcode' ) { + $string = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>'; + + for($x = 0, $y = strlen($string); $x < $y; $x++ ) { + $ord[] = ord($string[$x]); + } + + $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n"; + $_ret .= "<!--\n"; + $_ret .= "{document.write(String.fromCharCode("; + $_ret .= implode(',',$ord); + $_ret .= "))"; + $_ret .= "}\n"; + $_ret .= "//-->\n"; + $_ret .= "</script>\n"; + + return $_ret; + + } elseif ($encode == 'hex') { preg_match('!^(.*)(\?.*)$!',$address,$match); Index: xoops2jp/html/class/smarty/plugins/function.math.php diff -u xoops2jp/html/class/smarty/plugins/function.math.php:1.2 xoops2jp/html/class/smarty/plugins/function.math.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.math.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.math.php Sun Nov 20 17:05:54 2005 @@ -35,12 +35,13 @@ } // match all vars in equation, make sure all are passed - preg_match_all("!\!(0x)([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match); + preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match); $allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10', 'max','min','pi','pow','rand','round','sin','sqrt','srand','tan'); - foreach($match[2] as $curr_var) { - if (!in_array($curr_var,array_keys($params)) && !in_array($curr_var, $allowed_funcs)) { - $smarty->trigger_error("math: parameter $curr_var not passed as argument"); + + foreach($match[1] as $curr_var) { + if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) { + $smarty->trigger_error("math: function call $curr_var not allowed"); return; } } Index: xoops2jp/html/class/smarty/plugins/function.popup.php diff -u xoops2jp/html/class/smarty/plugins/function.popup.php:1.2 xoops2jp/html/class/smarty/plugins/function.popup.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/function.popup.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/function.popup.php Sun Nov 20 17:05:54 2005 @@ -25,7 +25,11 @@ switch ($_key) { case 'text': case 'trigger': + case 'function': + case 'inarray': $$_key = (string)$_value; + if ($_key == 'function' || $_key == 'inarray') + $append .= ',' . strtoupper($_key) . ",'$_value'"; break; case 'caption': @@ -44,12 +48,10 @@ case 'closefont': case 'fgbackground': case 'bgbackground': - case 'inarray': case 'caparray': case 'capicon': case 'background': case 'frame': - case 'function': $append .= ',' . strtoupper($_key) . ",'$_value'"; break; @@ -84,6 +86,8 @@ case 'fullhtml': case 'hauto': case 'vauto': + case 'mouseoff': + case 'followmouse': if ($_value) $append .= ',' . strtoupper($_key); break; @@ -100,7 +104,10 @@ if (empty($trigger)) { $trigger = "onmouseover"; } $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; - $retval .= $append . ');" onmouseout="nd();"'; + $retval .= $append . ');"'; + if ($trigger == 'onmouseover') + $retval .= ' onmouseout="nd();"'; + return $retval; } Index: xoops2jp/html/class/smarty/plugins/modifier.cat.php diff -u xoops2jp/html/class/smarty/plugins/modifier.cat.php:1.2 xoops2jp/html/class/smarty/plugins/modifier.cat.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/modifier.cat.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/modifier.cat.php Sun Nov 20 17:05:54 2005 @@ -17,7 +17,7 @@ * Example: {$var|cat:"foo"} * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat * (Smarty online manual) - * @author Monte Ohrt <monte****@ispi*****> + * @author Monte Ohrt <monte at ohrt dot com> * @version 1.0 * @param string * @param string Index: xoops2jp/html/class/smarty/plugins/modifier.escape.php diff -u xoops2jp/html/class/smarty/plugins/modifier.escape.php:1.2 xoops2jp/html/class/smarty/plugins/modifier.escape.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/modifier.escape.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/modifier.escape.php Sun Nov 20 17:05:54 2005 @@ -28,7 +28,7 @@ return htmlentities($string, ENT_QUOTES); case 'url': - return urlencode($string); + return rawurlencode($string); case 'quotes': // escape unescaped single quotes Index: xoops2jp/html/class/smarty/plugins/modifier.nl2br.php diff -u xoops2jp/html/class/smarty/plugins/modifier.nl2br.php:1.2 xoops2jp/html/class/smarty/plugins/modifier.nl2br.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/modifier.nl2br.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/modifier.nl2br.php Sun Nov 20 17:05:54 2005 @@ -21,7 +21,7 @@ * @link http://smarty.php.net/manual/en/language.modifier.nl2br.php * nl2br (Smarty online manual) * @version 1.0 - * @author Monte Ohrt <monte****@ispi*****> + * @author Monte Ohrt <monte at ohrt dot com> * @param string * @return string */ Index: xoops2jp/html/class/smarty/plugins/modifier.regex_replace.php diff -u xoops2jp/html/class/smarty/plugins/modifier.regex_replace.php:1.2 xoops2jp/html/class/smarty/plugins/modifier.regex_replace.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/modifier.regex_replace.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/modifier.regex_replace.php Sun Nov 20 17:05:54 2005 @@ -21,6 +21,10 @@ */ function smarty_modifier_regex_replace($string, $search, $replace) { + if (preg_match('!\W(\w+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) { + /* remove eval-modifier from $search */ + $search = substr($search, 0, -strlen($match[1])) . str_replace('e', '', $match[1]); + } return preg_replace($search, $replace, $string); } Index: xoops2jp/html/class/smarty/plugins/modifier.strip.php diff -u xoops2jp/html/class/smarty/plugins/modifier.strip.php:1.2 xoops2jp/html/class/smarty/plugins/modifier.strip.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/modifier.strip.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/modifier.strip.php Sun Nov 20 17:05:54 2005 @@ -17,7 +17,7 @@ * Date: September 25th, 2002 * @link http://smarty.php.net/manual/en/language.modifier.strip.php * strip (Smarty online manual) - * @author Monte Ohrt <monte****@ispi*****> + * @author Monte Ohrt <monte at ohrt dot com> * @version 1.0 * @param string * @param string Index: xoops2jp/html/class/smarty/plugins/modifier.truncate.php diff -u xoops2jp/html/class/smarty/plugins/modifier.truncate.php:1.2 xoops2jp/html/class/smarty/plugins/modifier.truncate.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/modifier.truncate.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/modifier.truncate.php Sun Nov 20 17:05:54 2005 @@ -13,29 +13,35 @@ * Name: truncate<br> * Purpose: Truncate a string to a certain length if necessary, * optionally splitting in the middle of a word, and - * appending the $etc string. + * appending the $etc string or inserting $etc into the middle. * @link http://smarty.php.net/manual/en/language.modifier.truncate.php * truncate (Smarty online manual) * @param string * @param integer * @param string * @param boolean + * @param boolean * @return string */ function smarty_modifier_truncate($string, $length = 80, $etc = '...', - $break_words = false) + $break_words = false, $middle = false) { if ($length == 0) return ''; if (strlen($string) > $length) { $length -= strlen($etc); - if (!$break_words) + if (!$break_words && !$middle) { $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1)); - - return substr($string, 0, $length).$etc; - } else + } + if(!$middle) { + return substr($string, 0, $length).$etc; + } else { + return substr($string, 0, $length/2) . $etc . substr($string, -$length/2); + } + } else { return $string; + } } /* vim: set expandtab: */ Index: xoops2jp/html/class/smarty/plugins/outputfilter.trimwhitespace.php diff -u xoops2jp/html/class/smarty/plugins/outputfilter.trimwhitespace.php:1.2 xoops2jp/html/class/smarty/plugins/outputfilter.trimwhitespace.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/outputfilter.trimwhitespace.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/outputfilter.trimwhitespace.php Sun Nov 20 17:05:54 2005 @@ -19,7 +19,7 @@ * Install: Drop into the plugin directory, call * <code>$smarty->load_filter('output','trimwhitespace');</code> * from application. - * @author Monte Ohrt <monte****@ispi*****> + * @author Monte Ohrt <monte at ohrt dot com> * @author Contributions from Lars Noschinski <lars****@usene*****> * @version 1.3 * @param string Index: xoops2jp/html/class/smarty/plugins/shared.make_timestamp.php diff -u xoops2jp/html/class/smarty/plugins/shared.make_timestamp.php:1.2 xoops2jp/html/class/smarty/plugins/shared.make_timestamp.php:1.2.8.1 --- xoops2jp/html/class/smarty/plugins/shared.make_timestamp.php:1.2 Fri Mar 18 21:51:55 2005 +++ xoops2jp/html/class/smarty/plugins/shared.make_timestamp.php Sun Nov 20 17:05:54 2005 @@ -16,26 +16,28 @@ function smarty_make_timestamp($string) { if(empty($string)) { - $string = "now"; - } - $time = strtotime($string); - if (is_numeric($time) && $time != -1) - return $time; - - // is mysql timestamp format of YYYYMMDDHHMMSS? - if (preg_match('/^\d{14}$/', $string)) { - $time = mktime(substr($string,8,2),substr($string,10,2),substr($string,12,2), - substr($string,4,2),substr($string,6,2),substr($string,0,4)); + // use "now": + $time = time(); - return $time; + } elseif (preg_match('/^\d{14}$/', $string)) { + // it is mysql timestamp format of YYYYMMDDHHMMSS? + $time = mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2), + substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4)); + + } elseif (is_numeric($string)) { + // it is a numeric string, we handle it as timestamp + $time = (int)$string; + + } else { + // strtotime should handle it + $time = strtotime($string); + if ($time == -1 || $time === false) { + // strtotime() was not able to parse $string, use "now": + $time = time(); + } } + return $time; - // couldn't recognize it, try to return a time - $time = (int) $string; - if ($time > 0) - return $time; - else - return time(); } /* vim: set expandtab: */