Pligg beta9.7升级到pligg beta 9.8过程遇到的(中文支持)问题解决

Pligg beta9.7升级到pligg beta 9.8过程遇到的(中文支持)问题解决

刚升级完会出现乱码(比如很多问号),这因该是升级前没有修改/libs/db.php文件中数据库连接限定连接字符集导致(如果默认的数据库连接就为utf8的就不会出现问题,这个主要跟空间商的mysql有关。)
下边说具体需要做什么:
我的因为没有做的很好,升级心切解决数据丢失!!,这次留个教训下次一定要在测试站点上测试后在做进一步活动,希望其它朋友在升级前也做好备份准备(这个pligg备份不知道怎么了,数据库恢复不了!老提示重复复制什么!提示忘掉啦,再试试吧)

并且这次决定不去汉化前台显示啦,直接使用英文的站,只是修改支持中文的功能,不再做表面工作。


by clin003 at 20070914 from:http://clin003.com/或http://blog.csdn.net/clin003/

1,升级办法我就不说啦在readme文件中说的很详细啦
2,升级前基本的注意事项(readme文档中提到的)我就不说啦
2,升级前推荐修改/libs/db.php
这个可以参考9.7中修改办法:http://blog.csdn.net/clin003/archive/2007/08/16/1745853.aspx
大致在:202行回车添加代码
$dbcharset = ' utf8 ' ;
mysql_query ( " SETcharacter_set_connection=$dbcharset,character_set_results=$dbcharset,character_set_client=binary " );

这部分添加后的样子是这样的:
if ( ! isset ( $this -> dbh) || ! $this -> dbh)
{
$this -> connect( $this -> dbuser , $this -> dbpassword , $this -> dbhost);
$dbcharset = ' utf8 ' ;
mysql_query ( " SETcharacter_set_connection=$dbcharset,character_set_results=$dbcharset,character_set_client=binary " );
$this -> select( $this -> dbname);
}

这是解决中文文章乱码问题。

----------------------------
另外一个问题是:9.8升级后查看文章内容后,在 Pligg beta 9 Home » About i0Day »后便显示的文章标题会变成乱码的

这个解决办法目前我就知道一个:
这个问题的解决办法参考自:http://forums.pligg.com/bug-report/8793-chinese-characters-bug.html

打开/libs/html1.php在大致124行找到函数function do_sidebar($var_smarty)使用9.7中的相应函数替换即可。
替换前的9.8的样子是这样的:
function do_sidebar( $var_smarty ){
// showthecategoriesinthesidebar
global $db , $dblang , $globals , $the_cats , $navwhere ;

// fixfor'undefinedindex'errors
if ( ! isset ( $navwhere [ ' text4 ' ])){ $navwhere [ ' text4 ' ] = '' ;} else { $navwhere [ ' text4 ' ] = htmlentities ( $navwhere [ ' text4 ' ]);}
if ( ! isset ( $navwhere [ ' text3 ' ])){ $navwhere [ ' text3 ' ] = '' ;} else { $navwhere [ ' text3 ' ] = htmlentities ( $navwhere [ ' text3 ' ]);}
if ( ! isset ( $navwhere [ ' text2 ' ])){ $navwhere [ ' text2 ' ] = '' ;} else { $navwhere [ ' text2 ' ] = htmlentities ( $navwhere [ ' text2 ' ]);}
if ( ! isset ( $navwhere [ ' text1 ' ])){ $navwhere [ ' text1 ' ] = '' ;} else { $navwhere [ ' text1 ' ] = htmlentities ( $navwhere [ ' text1 ' ]);}
if ( ! isset ( $navwhere [ ' link4 ' ])){ $navwhere [ ' link4 ' ] = '' ;}
if ( ! isset ( $navwhere [ ' link3 ' ])){ $navwhere [ ' link3 ' ] = '' ;}
if ( ! isset ( $navwhere [ ' link2 ' ])){ $navwhere [ ' link2 ' ] = '' ;}
if ( ! isset ( $navwhere [ ' link1 ' ])){ $navwhere [ ' link1 ' ] = '' ;}
$var_smarty -> assign( ' navbar_where ' , $navwhere );

$var_smarty -> assign( ' body_args ' , '' );
// fixfor'undefinedindex'errors

$_caching = $var_smarty -> cache; // getthecurrentcachesettings
$var_smarty -> cache = true ; // cachehastobeonotherwiseis_cachedwillalwaysbefalse
$var_smarty -> cache_lifetime = - 1 ; // lifetimehastobesettosomethingotherwiseis_cachedwillalwaysbefalse
$thetpl = $var_smarty -> get_template_vars( ' the_template_sidebar_modules ' ) . ' /categories.tpl ' ;

// checktoseeifthecategorysidebarmoduleisalreadycached
//ifitis,useit


if ( isset ( $_REQUEST [ ' category ' ])){
$thecat = sanitize( $_REQUEST [ ' category ' ] , 3 );
}
else {
$thecat = '' ;
}
if ( $var_smarty -> is_cached( $thetpl , ' sidebar|category| ' . $thecat )){
$var_smarty -> assign( ' cat_array ' , ' x ' ); // thisisneeded.sidebar.tplwon'tincludethecategorymoduleifcat_arraydoesnthavesomedata
} else {
if ( isset ( $_REQUEST [ ' category ' ])){ $thecat = $db -> get_var( " SELECTcategory_nameFROM " . table_categories . " WHERE`category_safe_name`=' " . urlencode (sanitize( $_REQUEST [ ' category ' ] , 1 )) . " '; " );}

if ( ! empty ( $_REQUEST [ ' id ' ])){
$doing_story = true ;
}
else {
$doing_story = false ;
}

$var_smarty -> assign( ' UrlMethod ' , urlmethod);

foreach ( $the_cats as $cat ){
if ( $cat -> category_id == $thecat && $cat -> category_lang == $dblang && $cat -> category_parent == 0 )
{
$globals [ ' category_id ' ] = $cat -> category_id;
$globals [ ' category_name ' ] = $cat -> category_name;
}
}

$pos = strrpos ( $_SERVER [ " SCRIPT_NAME " ] , " / " );
$script_name = substr ( $_SERVER [ " SCRIPT_NAME " ] , $pos + 1 , 100 );
$script_name = str_replace ( " .php " , "" , $script_name );

include_once ( ' dbtree.php ' );
$array = tree_to_array( 0 , table_categories);
$var_smarty -> assign( ' lastspacer ' , 0 );
$var_smarty -> assign( ' cat_array ' , $array );

// usethe'totals'tablenow
$published_count = get_story_count( ' published ' );

$var_smarty -> assign( ' published_count ' , $published_count );
$categories = mysql_query ( " select*,count(*)ascountfrom " . table_links . " , " . table_categories . " wherecategory_lang='$dblang'andcategory_id=link_categorygroupbylink_categoryORDERBYcategory_nameASC " );

$categorylist = array ();
while ( $rows = mysql_fetch_array ( $categories , MYSQL_ASSOC)) array_push ( $categorylist , $rows );
$var_smarty -> assign( ' categorylist ' , $categorylist );
$var_smarty -> assign( ' category_url ' , getmyurl( ' maincategory ' ));

}

$var_smarty -> cache = $_caching ; // setcachebacktooriginalvalue

check_actions(
' do_sidebar ' );

return $var_smarty ;
}

替换后的为9.7中的对应函数样子是这样的:
function do_sidebar( $var_smarty ){
// showthecategoriesinthesidebar
global $db , $dblang , $globals , $the_cats ;

$_caching = $var_smarty -> cache; // getthecurrentcachesettings
$var_smarty -> cache = true ; // cachehastobeonotherwiseis_cachedwillalwaysbefalse
$var_smarty -> cache_lifetime = - 1 ; // lifetimehastobesettosomethingotherwiseis_cachedwillalwaysbefalse
$thetpl = $var_smarty -> get_template_vars( ' the_template_sidebar_modules ' ) . ' /categories.tpl ' ;

// checktoseeifthecategorysidebarmoduleisalreadycached
//ifitis,useit


if ( isset ( $_REQUEST [ ' category ' ])){
$thecat = sanitize( $_REQUEST [ ' category ' ] , 3 );
}
else {
$thecat = '' ;
}
if ( $var_smarty -> is_cached( $thetpl , ' sidebar|category| ' . $thecat )){
$var_smarty -> assign( ' cat_array ' , ' x ' ); // thisisneeded.sidebar.tplwon'tincludethecategorymoduleifcat_arraydoesnthavesomedata
} else {
if ( isset ( $_REQUEST [ ' category ' ])){ $thecat = $db -> get_var( " SELECTcategory_nameFROM " . table_categories . " WHERE`category_safe_name`=' " . urlencode (sanitize( $_REQUEST [ ' category ' ] , 1 )) . " '; " );}

if ( ! empty ( $_REQUEST [ ' id ' ])){
$doing_story = true ;
}
else {
$doing_story = false ;
}

$var_smarty -> assign( ' UrlMethod ' , urlmethod);

foreach ( $the_cats as $cat ){
if ( $cat -> category_id == $thecat && $cat -> category_lang == $dblang && $cat -> category_parent == 0 )
{
$globals
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值