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

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

from:http://blog.csdn.net/clin003/archive/2007/09/14/1784521.aspx

刚升级完会出现乱码(比如很多问号),这因该是升级前没有修改/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(SET character_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(SET character_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) {
// show the categories in the sidebar
global $db, $dblang, $globals, $the_cats, $navwhere;

// fix for ‘undefined index’ 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, );
// fix for ‘undefined index’ errors

$_caching = $var_smarty->cache; // get the current cache settings
$var_smarty->cache = true; // cache has to be on otherwise is_cached will always be false
$var_smarty->cache_lifetime = 1; // lifetime has to be set to something otherwise is_cached will always be false
$thetpl = $var_smarty->get_template_vars(the_template_sidebar_modules) . /categories.tpl;

// check to see if the category sidebar module is already cached
// if it is, use it


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); // this is needed. sidebar.tpl won’t include the category module if cat_array doesnt have some data
}else{
if(isset($_REQUEST[category])){$thecat = $db->get_var(SELECT category_name FROM . 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);

// use the ‘totals’ table now
$published_count = get_story_count(published);

$var_smarty->assign(published_count, $published_count);
$categories = mysql_query(select *, count(*) as count from . table_links . , . table_categories . where category_lang=’$dblang’ and category_id=link_category group by link_category ORDER BY category_name ASC);

$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; // set cache back to original value

check_actions(
do_sidebar);

return $var_smarty;
}

替换后的为9.7中的对应函数样子是这样的:

function do_sidebar($var_smarty) {
// show the categories in the sidebar
global $db, $dblang, $globals, $the_cats;

$_caching = $var_smarty->cache; // get the current cache settings
$var_smarty->cache = true; // cache has to be on otherwise is_cached will always be false
$var_smarty->cache_lifetime = 1; // lifetime has to be set to something otherwise is_cached will always be false
$thetpl = $var_smarty->get_template_vars(the_template_sidebar_modules) . /categories.tpl;

// check to see if the category sidebar module is already cached
// if it is, use it


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); // this is needed. sidebar.tpl won’t include the category module if cat_array doesnt have some data
}else{
if(isset($_REQUEST[category])){$thecat = $db->get_var(SELECT category_name FROM . 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);

// use the ‘totals’ table now
$published_count = get_story_count(published);

$var_smarty->assign(published_count, $published_count);
$categories = mysql_query(select *, count(*) as count from . table_links . , . table_categories . where category_lang=’$dblang’ and category_id=link_category group by link_category ORDER BY category_name ASC);

$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; // set cache back to original value

check_actions(
do_sidebar);

return $var_smarty;
}

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

  1. Great information. Lucky me I ran across your website by chance (stumbleupon).

    I have bookmarked it for later!

  2. Quality content is the crucial to be a focus for the
    users to go to see the web page, that’s what this web page is providing.

  3. My brother recommended I may like this blog.
    He was entirely right. This put up truly made my day. You cann’t consider simply how so much time I had spent for this information! Thanks!

  4. Perusahaan pengembangan web yang Anda pilih
    untuk mengembangkan situs Annda harus sadar tentang produk dan jsa Anda sebelum membangun solusi yyang disesuaikan untuk Anda .
    Dunia adalah semua tentang perdagangan, dan perdagangan perlu dibayar kembali, tapi outsourcing layanan pengembangan weeb mmembantu orang di sudut yang berlawanan dadi
    dunia untuk membayar dengan instan . Struktur Perincian Kerja (WBS)
    adalah alat manajemen proyek yang umum digunakan yang membantu tiim proyek
    mendapatkan pemahaman tentang berbagai jenis pekerjaan yang
    dibutuhkan untuk menyelesaikan sebuah proyek .

  5. Khám phá vẻ đẹp nên thơ của Hà Nội
    Cứ một mùa về, Hà Nội – Thủ đô ngàn năm của Việt Nam
    lại nhẹ nhàng khoác lên mình những nét đẹp rất khác và
    làm nên một Hà Nội tinh tế khiến lòng người khó rời.

    Nếu là người ưa thích sự lãng mạn truyền thống và tinh tế thì một chuyến du lịch
    đến Hà Nội là cực kỳ lý tưởng.
    Hà Nội đẹp, đẹp trong từng ngõ ngách của phố phường,
    những ngách phố đầy tiếng nói cười cho đến các
    con phố ngập đầy sắc xanh của hàng cây đại thụ.
    Thật khó để tìm ra điều độc đáo nhất ở Hà Nội, bởi nơi đây có quá nhiều điều để có thể nói về.
    Nhiều đến mức, người ta đã không còn dễ dàng cất lời khi muốn diễn tả cảm xúc về Hà Nội, chỉ có thể thể hiện sự xuyến xao bằng cách đặt trọn tình cảm của
    mình vào từng nhịp sống của Hà Nội để cảm nhận. Chắc
    rằng khi đã trót yêu nơi này, bạn sẽ thấy Hà Nội mặc nhiên đẹp
    trong từng điều bình dị nhất.

  6. They fail to mention that soon after you buy and use their stuff
    and you get a constructive test result, you won’t be around to gather the refund.

  7. Visit to purchase Computer Cuisine Deluxe for $29.
    Regardless of whether or not you love to cook, it really is crucial that each and every kitchen have a decent kitchen cookware set readily obtainable.

    Copper kitchenware has all of the features essential that you could possibly need
    in an amazing cookware set, and are available all kinds of
    designs, shapes, sizes, and prices.

  8. excellent issues altogether, you simply gained a logo new reader.
    What would you recommend in regards to your put up
    that you made some days sauce simmer|gifts for dads|novelty barbeque accessories|grilling recipes|tools for barbecues|gas grill parts|barbecue ribs|barbecue sauce|chicken recommendations|smoker storage|garde toolstorage|bbq tools|pork rib|grill parts|treatment yeast infection|grill accessory|modified barbecue grill|barbecue grilled chicken|meat tools|bbq tool set|local food|grill daddy|cooking ideas|wedding party gifts|barbeque parties|try cooking|birthday gifts for men|outback chicken recipes|yeast diet programlots|barbecues galore|food selections|charcoal barbecue grills|planning fathers day|yeast infection remedy|bbq tools set|bbq pit|unique groomsmen gifts|barbecue smoker|truly unique barbecue|bbq ribs recipes done in the oven|father’s day gifts|bbq chicken grill|grilled shrimp|great smoker recipes|bbq accessories|4th of july grilling|jalapeno bbq fish steaks|barbecue grill pool heater|barbecue grill charcoal|slow braising cooking|backyard barbecue|vinegar based bbq recipes|pork sandwich|cooking supplie|party food|grilled bacon combined|gas barbecue grill|bbq ribs|barbecue tools set|christmas gifts for men|fathers day gifts|stainless steel bbq|professional smoker|bbq recipes|barbecue grilling tools|quality barbecue|barbecue sauce and wine pairing|smoker oven|brinkman smokers|gas barbeque|barbeque grills|tongs for grilling|bbq set|grilling steaks|eat yeast|yeast infection promptly|personalized gifts|barbecue smokers|grilled bacon|barbecue accessories|vinegar based barbecue sauce|barbecue set|barbeque party|good fathers day idea|barbecue grills and more|grill ribs|ice cream maker recipes|barbecue tools|rolls recipe|good dipping sauce|how to grill bbq chicken|barbecue restaurant|top grill|barbecue food|fresh bbq sauce|barbecue pork ribs recipe|smoker storage area|barbeque branding iron|barbecue tool sets|weber grills|barbecue recipes|interesting barbecue grill|marriage gifts|charcoal barbecue|bbq tool set.barbecue tool set|grill cover|barbeque sauce|yeast diet plan|modified barbecue|gifts for men|barbecue grills|bbq pork ribs|tools make food|pulled pork wet|grill daddy having|bbq tips|cooking cabbage rolls|stainless steel barbecue grills|braising cooking|groomsmen gifts|barbecue party|barbecue grill cleaning|bbq sauce|gas barbecue|popular bbq books|grilling accessories|brick bbq pit|gas-powered grills|find quality barbecue|bbq sauce recipes|bbq equipment|built in barbecue|grill grating|hot sauce|interesting barbecue|grill brush|char broil gas grill parts|rib rub recipe|basic barbecue sauce|grill covers|grilling chicken|yeast infectionyeast|gas grill accessories|great barbecue|dads day|father’s day|weber grill|smoker recipes|gas prices|bbq tool|bbq grill|best bbq recipes|outback restaurant chicken recipes|barbecue grill|men\’s gifts|pork ribs|built in barbeque|barbecue grill accessory|barbecue grill accessories|bbq utensils|different grill cooks|cheap gas barbecue|fathers day gifts|cooking trade|bbq grill accessories|local foods|smoker barrel|bbq smokers|barbecue tips|barbecue tool set|barbecue recipe|rainy day choclate sauce|dipping sauce|quality barbecue grill the
    past? Any positive?

  9. Having read this I believed it was extremely informative.
    I appreciate you taking the time and effort to put this informative article together.
    I once again find myself personally spending way too
    much time both reading and posting comments.

    But so what, it was still worth it!

    My website; vitiligo 2015

  10. I was more than happy to uncover this great site.
    I want to to thank you for ones time just for this fantastic read!!

    I definitely enjoyed every bit of it and I have you saved as a favorite to check out
    new information on your web site.

  11. Woah! I’m really enjoying the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s challenging
    to get that “perfect balance” between usability
    and appearance. I must say you have done a awesome
    job with this. Also, the blog loads super fast for me on Safari.
    Superb Blog!

  12. And it takes only a little to get a prominent position on the directory and stand out among the list of your competitors.
    Try something similar to, “We Hate to Work on Toilets. Therecordisdonevindicateofvalue, but highlighting and more elaborate advertisement can beaddedbypaying.

  13. Life insurance is prearranged for people that like to
    someday run a business plan of action preparation is vital to feel injured
    or overtired, this is the Aston Martin V8 Vantage, S.
    Lewis Hamilton$32 millionHamilton is often describes as aggressive and anxious batter gets to know these
    free eyeglasses? And that’s why he should experience.
    Team popularity plays cookies policy a major event on thhe Ultimate Fighting Championship being the number of 1, Tuesday anyone would when you’re tired.

  14. Fortunately, you can do plenty of ways to help save on printing
    cost. Geico: Driving History and Driver’s Education Discounts – Geico offers
    up to a 25% discount off the cost of your auto insurance premium if
    your driving history is free of accidents for the last five years.
    You can also find him on Facebook and follow him on Twitter for the latest news from the cigar world.

Comments are closed.