=================================================
Version: SmartSection 2.12 patch
Date:   2006-12-17
Author: Kenichi OHWADA
URL:    http://linux2.ohwada.net/
Email:  webmaster@ohwada.net
=================================================


* main change *
corrected following bug
(1) $max_imgsize is undefined
(2) Notice is showing when "Disable comments"
(3) character garble showing keyword in Japanese
(4) character garble showing PDF in Japanese
(5) character garble in "send article" in Japanese

added following
(6) import from XFsection


* datail *
(1) $max_imgsize is undefined
following Notice ocuuer
-----
Notice [PHP]: Undefined variable: max_imgsize in file smartsection/include/fileform.inc.php line 42
-----

include/fileform.inc.php
------
$max_imgsize = 0;	// add this line
$file_box = new XoopsFormFile(_MD_SSECTION_FILE_TO_UPLOAD, "userfile", $max_imgsize);
------

(2) Notice is showing when "Disable comments"
Notice is showing when set "Disable comments" in Preferences
------
Notice [PHP]: Undefined variable: com_itemid in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: com_order in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: com_mode in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: link_extra in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: com_itemid in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: com_order in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: com_mode in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: link_extra in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: com_itemid in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: com_order in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: com_mode in file smartsection/item.php line 192
Notice [PHP]: Undefined variable: link_extra in file smartsection/item.php line 192
Notice [PHP]: Undefined index: commentsnav in file smartsection/item.php line 193
------

The condition when using comment_view is wrong.
in comment_view.php,
comment is showing when not set "Disable comments"
u XOOPS_COMMENT_APPROVENONE !=
$xoopsModuleConfig['com_rule'] v
but in item.php
u smartsection_getConfig('com_rule') <> 0 visn't
included in the condition.
when u$itemObj->cancomment() == 1v

item.php
-----
// if (($itemObj->cancomment() == 1) || (!$xoopsModuleConfig['commentatarticlelevel'] && smartsection_getConfig('com_rule') <> 0)) {
 
if ( (($itemObj->cancomment() == 1) || !$xoopsModuleConfig['commentatarticlelevel'] ) && (smartsection_getConfig('com_rule') <> 0) ) {
-----

(3) character garble showing keyword in Japanese
reference [url=http://smartfactory.ca/modules/newbb/viewtopic.php?topic_id=1211&forum=5&post_id=5337]Bug: cannot show keyword in Japanese[/url]

class/keyhighlighter.php
------
function highlight ($buffer) {

// change following
 $this->preg_keywords = preg_replace ('/[^\w ]/si', '', $this->keywords);
 
  
 
 if ( XOOPS_USE_MULTIBYTES ) {
   $this->preg_keywords = trim($this->keywords);
  } else {
    $this->preg_keywords = preg_replace ('/[^\w ]/si', '', $this->keywords);
 }
 
}
------

(4) character garble showing PDF in Japanese
reference [url=http://xoopscube.jp/modules/xhnewbb/viewtopic.php?topic_id=3414&forum=5]SmartSection->pdf->Japanese[/url]

fpdf/language/japanese.php
------
// add following

// overwrite class PDF_Japanese in fpdf/japanese.php 
function SJISWrite($h,$txt,$link)
{
	$txt = $this->_jp_encoding($txt, 'SJIS-win', 'EUC-JP');
	parent::SJISWrite($h,$txt,$link);
}
 
// overwrite class FPDF in fpdf.php 
function _putinfo()
{
	$this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));
	if(!empty($this->title))
		$this->_out('/Title '. $this->_jp_putinfohexstring($this->title) );
	if(!empty($this->subject))
		$this->_out('/Subject '.$this->_jp_putinfohexstring($this->subject));
	if(!empty($this->author))
		$this->_out('/Author '.$this->_jp_putinfohexstring($this->author));
	if(!empty($this->keywords))
		$this->_out('/Keywords '.$this->_jp_putinfohexstring($this->keywords));
	if(!empty($this->creator))
		$this->_out('/Creator '.$this->_jp_putinfohexstring($this->creator));
	$this->_out('/CreationDate '.$this->_textstring('D:'.date('YmdHis')));
}
 
function _jp_putinfohexstring($s)
{
	//Format a text string
	//for infomation properties hex
	$s = $this->_jp_encoding($s , 'UTF-16BE', 'EUC-JP') ;
	$s = '<' . 'FEFF' . strtoupper(bin2hex($s)) . '>'; // FEFF is BOM
	return $s ;
}
 
function _jp_encoding(&$text, $out_charset, $in_charset)
{
	if ( function_exists('mb_convert_encoding') ) {
		$text = mb_convert_encoding($text, $out_charset, $in_charset);
	} elseif( function_exists('iconv') ) {
		$text = iconv($in_charset, $out_charset . "//TRANSLIT", $text);
	}
	return $text;
}
------

(5) character garble in "send article" in Japanese
reference [url=http://linux.ohwada.jp/modules/smartsection/item.php?itemid=159]XOOPS tel a friend module[/url]

class/item.php
------
function getAdminLinks()
{

// change followimg
//	$maillink = "mailto:?subject=" . sprintf(_MD_SSECTION_INTITEM, $xoopsConfig['sitename']) . "&amp;body=" . sprintf(_MD_SSECTION_INTITEMFOUND, $xoopsConfig['sitename']) . ": " . $this->getItemUrl();
 
	$subject = sprintf(_MD_SSECTION_INTITEM, $xoopsConfig['sitename']);
	$body    = sprintf(_MD_SSECTION_INTITEMFOUND, $xoopsConfig['sitename']) . ": \n" . $this->getItemUrl();
	$subject = $this->convert_for_japanese($subject);
	$body    = $this->convert_for_japanese($body);
	$maillink = "mailto:?subject=" . $subject . "&amp;body=" . $body;
}


// add followimg
function convert_for_japanese($str)
{
// no action, if not flag
	if ( ! _SSECTION_FLAG_JP_CONVERT )
	{
		return $str;
	}

// no action, if not Japanese
	global $xoopsConfig;
	if ( $xoopsConfig['language'] != 'japanese' )
	{
		return $str;
	}

// presume OS Browser
	$agent = $_SERVER["HTTP_USER_AGENT"];
	$os      = '';
	$browser = '';
	if (preg_match("/Win/i", $agent))
	{	$os = 'win';	}
	if (preg_match("/MSIE/i", $agent))
	{	$browser = 'msie';	}

// if msie
	if ( ($os == 'win') && ($browser == 'msie') )
	{
// if multibyte
		if ( function_exists('mb_convert_encoding') )
		{
			$str = mb_convert_encoding($str, 'SJIS', 'EUC-JP');
			$str = rawurlencode($str);
		}
	}

	return $str;
}
------

(6) Import from XFSection
reference [url=http://linux.ohwada.jp/modules/smartsection/item.php?itemid=309]Import from XFsection[/url]
This program is importing from XFSection 1.xx to SmartSection 2.1.

(a) usage
Copy this program to SmartSection directory. 
Click "Import" is clicked on SmartSection's administrator page. 
Select "XFsection" on "Import Articles" page. 
Click "Import" button on "Importing from XF-Section" page,
An import result is displayed. 

(b) importing information 
The tables which is succeeded 
- category
- article (items) 
- files  

The tables which is not succeeded 
- config 
- broken 
- votedata  

For details, look at import_xfsection.html. 
