作者归档:yuliang

pligg beta 9.8 (中文支持)中文乱码解决

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))&
nbsp;
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 +&nb
sp;
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;
}

Pligg 中文乱码和对中文用户名的支持

       昨天搞了一个下午的 PLIGG,如果用来建英文站的话 是一个不错的程序,但是用来建中文站,确实有很大的麻烦,首先他不支持中文用户名的注册,还有他对中文文章的乱码问题等等,对与文章的乱码问题好像不用理会,我试了9.8的安装,发布中文文章没有发现有乱码问题,但是中文用户名支持真是一个头痛的问题。昨天自己瞎忙乎着虽然可以中文用户名注册发帖等,就解决了。但是还有一个严重的问题就是 中文用户名的用户的个人资料管理里面,查询不到自己发布的文章,估计这个很编码问题有关,因为我看数据库了,用UTF-8连接前台是可以显示正常,但是数据库里面还是乱码的。。所以可能用中文用户名他查询搜索的时候就查找不到文章了,心理有点喜欢这个程序,但是这个东西不知道怎么解决了,看了如果不行的话也就只能放弃了

UTF-8编码 BOM的一些资料

UTF-8编码的文件中,BOM占三个字节。如果用记事本把一个文本文件另存为UTF-8编码方式的话,用UE打开这个文件,切换到十六进制编辑状态就可以看到开头的FFFE了。这是个标识UTF-8编码文件的好办法,软件通过BOM来识别这个文件是否是UTF-8编码,很多软件还要求读入的文件必须带BOM。可是,还是有很多软件不能识别BOM。我在研究Firefox的时候就知道,在Firefox早期的版本里,扩展是不能有BOM的,不过Firefox 1.5以后的版本已经开始支持BOM了。现在又发现,PHP也不支持BOM。PHP在设计时就没有考虑BOM的问题,也就是说他不会忽略UTF-8编码的文件开头BOM的那三个字符。由于必须在<?或者<?php后面的代码才会作为PHP代码执行,所以这三个字符将会直接输出。如果插件的文件有这个问题,将会导致在后台页面里激活或者不激活插件后显示白屏,如果是模版文件有这个问题,将会导致这三个字符直接输出,造成页面上方有一个小空行。国外的英文插件和模版一般都是用的ASCII码的编码方式,不会有BOM,只有国内的插件和模版会由于作者的不知情造成问题。还有,大家修改模版的时候,由于输出页面使用UTF-8编码,那么修改模版的时候如果有加入中文字符的话,必须把文件转成UTF-8编码才能正常显示,这个时候如果所使用的编辑器自动加上了BOM的话,将会造成在页面上输出这三个字符,显示效果就要看浏览器了,一般是一个空行或是一个乱码。

PLIGG 中文语言文件下载

   昨天弄了个PLIGG程序玩玩,用来建英文站可以说是不错的,但是用来建中文站好像有点问题了,主要是编码问题。下次好好解决下、

这个中文包,在 pligg 9.8 下使用,应该最新版下也支持。

765

pligg SEO 关键词设定 URL优化

pligg版本:Pligg_Beta_9.8.2

1、meta keywords和descriptions的配置

Pligg缺省情况下以提交digg内容时候定义的keywords和summary作为页面的keywords和description内容。对于一些站点缺省的keyword或description的维护,可以直接修改tempaltes/meta.tpl,但这样很麻烦,可以通过“后台管理”提供的对lang.conf维护工具来实现keyworkds和descriptions缺省值进行动态维护和修改。

方法如下:

  • 在libs/lang.conf中增加如下内容:

//<SECTION>MISC</SECTION><ADDED>0.5</ADDED>
PLIGG_Meta_Description = “ENTER YOUR DESCRIPTION HERE”
//<SECTION>MISC</SECTION><ADDED>0.5</ADDED>
PLIGG_Meta_Keywords = “ENTER YOUR KEYWORD HERE”

  • 在templates/meta.tpl增加PLIGG_Meta_Description和PLIGG_Meta_Keywords
{* define your meta data here *}  {if $meta_description neq ""}         <meta name=”description” content=”{$meta_description},{#PLIGG_Meta_Description#}” /> {else}         <meta name=”description” content=”Yeeach.com” /> {/if}  {if $meta_keywords neq “”}         <meta name=”keywords” content=”{$meta_keywords},{#PLIGG_Meta_Keywords#}” /> {else}         <meta name=”keywords” content=”Yeeach.com” /> {/if}         <meta name=”Language” content=”{#PLIGG_Visual_Meta_Language#}” />         <meta name=”Robots” content=”All” />  {* the extra tabs are to make it lineup when viewing the source *}
 
  • 从“后台管理”->“设定配置”->“Modify Language”修改keyworkds和descriptions

2、URL搜索引擎友好

  • 从“后台管理”->“设定配置”->“Outgoing”将Outgoing links的值设定为id
  • 从“后台管理”->“设定配置”->“UrlMethod”将URL method将值设定为2
  • 从“后台管理”->“设定配置”->“FriendlyURLs”将Friendly URL’s for stories和Friendly URL’s for categories的值设定为false
  • cp htaccess.default .htaccess
  • 登录“后台管理”->“类别管理”,得到最下方自动生成的RewriteRule,拷贝到.htaccess,替代如下内容后面的内容##### You can find the below lines pre-made for you in the category management section of the admin panel
  • 如果新增了类别,需要重新到“后台管理”->“类别管理”得到新的RewriteRule,然后拷贝到.htaccess中。
  • 之所以将Friendly URL’s for stories和Friendly URL’s for categories的值设定为false,就是为了采用id号方式,避免中文编码urlencode后,mod_rewrite处理的问题。

http://forums.pligg.com/wiki-articles/8594-url-method.html

原文

Dynamic vs Static urls

Dynamic urls contain variables and are typically seen on database driven sites like blogs and forums. A static url does not contain any variables and does not change. Static urls are easier for your users to read. They are also sometimes ranked higher by search engines.
Examples
Dynamic url: yoursite.com/pligg/story.php?title=storytitle
Static url: yoursite.com/pligg/news/yourstorytitle

Url Method options

There are three options on the Url Method page in the admin panel. Choose Url Method 2 to enable static urls.

  • Method 1 = dynamic urls (default)
  • Method 2 = static urls

.htaccess

If you enable Url Method 2 in the admin panel you should see static urls on your site but when you click on an internal link you’ll probably get a 404 this page can not be found error. In order to work properly Url Method 2 requires modifications to your .htaccess file so that so that the new friendly urls are properly mapped to the actual files they refer to.
There is a default .htaccess file included in your Pligg installation called htaccess.default that contains a long list of rewrite commands that are meant to get you started. But you will probably need to modify this file in order to get static urls working properly on your site.

Step by Step Instructions
  1. Check with your host to see if mod rewrite is allowed. If not buy a DreamHost package to help pligg dev.
  2. Check with your host that Apache is configured to use .htaccess files (AllowOverride All)
  3. Get the latest htaccess.default from the SVN on sourceforge.
  4. Go to your admin panel/category management. At the bottom there is a rewrite rule for the categories. Copy this whole line and in htaccess.default paste over You need to copy the line for this whole thing to work right. Paste over the line: RewriteRule ^(all|pligg|category1|category2)/([a-zA-Z0-9-]+)/?$ story.php?title=$2 [L]
  5. Upload htaccess.default to your webserver in the root directory of your install. Overwrite the existing one.
  6. Rename “htaccess.default” to “.htaccess” (no quotes). Note the period in front. That period denotes a hidden file, and may cause it to disappear from some FTP clients. (You might need to enable showing of hidden files or call it by name when downloading).
  7. Turn on URL Method 2 in the admin panel.
  8. Enjoy friendly URL’s

If your Pligg is installed in a subfolder

If Pligg is installed in a subfolder: (ie : yourdomain.com/pligg/) then you will need to modify the RewriteBase in .htaccess:
Change RewriteBase / to RewriteBase /pligg/

Rewrite rule for categories

Every time you add a new category to your site you need to update the mod rewrite rules for the category urls. Simply go back to the admin panel / category management page copy the new rewrite rule and paste it on top of the old one in your .htaccess file.

It’s not working. How do i go back?

If this doesn’t work, mod_rewrite probably isn’t enabled on your webserver. You can go back to the admin panel and set Url Method to 1 again. No harm was done to any files during the instructions above and your site should operate fine without friendly urls.

163.com 163邮箱超级方便登陆技巧

1.在桌面上建个"文本文档".
2.将下面的内容复制进去;
3.将ID改为你邮箱的ID,密码改为你登录邮箱的密码
复制内容到剪贴板
代码:
@echo off
set "var=ID"
set "num=密码"
start "163邮箱登录中" "https://reg.163.com/logins.jsp?username=%var%&password=%num%&url=http://fm163.163.com/coremail/fcg/ntesdoor2"
4.最后保存文件名为***.bat

以后只要点击这个 .bat 文件就可以登陆邮箱了,如果遇到杀毒软件截栏,将这个文件添加到杀毒软件的信任区里面

6.14 世界无偿献血者日 由来

2001年在南非约翰内斯堡举办的第八届自愿无偿献血者招募国际大会上,世界卫生组织、红十字会与红新月会国际联合会、国际献血组织联合会、国际输血协会四家旨在提高全球血液安全的国际组织联合倡导将每年的614日取名为“世界献血者日”,建议从2004年起正式推行。614日是发现ABO血型系统的诺贝尔奖获得者卡尔·兰特斯坦纳的生日,将此日定为“世界献血者日”具有特殊纪念意义并为全球统一庆祝活动提供了特别的机会。

    建立“世界献血者日”的宗旨在于,首先通过这一特殊的日子感谢那些挽救数百万人生命的自愿无偿献血者,特别是多次定期捐献血液的个人,颂扬他们无偿捐助血液的无私奉献之举;同时希望无偿献血的重要意义和血液安全意识能够得到全社会更广泛的认同,进而唤起更多人,特别是青年人自觉加入到无偿献血的行列,最终成为固定的无偿献血者,为临床救助生命提供更充足、更安全的血液。

   

LINUX最受欢迎的版本,各版本排行

下面已经非常全了,这个排行应该是对于桌面版本来说的。

排名 发行版 关注度
1 Ubuntu 2613
2 PCLinuxOS 2467
3 openSUSE 1472
4 Fedora 1329
5 Sabayon 1161
6 Debian 1024
7 Mint 985
8 MEPIS 938
9 Mandriva 779
10 Damn Small 672
11 Slackware 597
12 CentOS 549
13 Gentoo 529
14 KNOPPIX 490
15 Zenwalk 477
16 Kubuntu 462
17 Puppy 430
18 Dreamlinux 400
19 Arch 397
20 Vector 391
21 Freespire 381
22 FreeBSD 362
23 sidux 304
24 Elive 284
25 Xubuntu 277
26 SLAX 272
27 Red Hat 272
28 Ubuntu CE 253
29 Ubuntu Studio 243
30 Foresight 217
31 DesktopBSD 214
32 Xandros 209
33 PC-BSD 205
34 SAM 203
35 Nexenta 191
36 64 Studio 177
37 BackTrack 170
38 Frugalware 167
39 Yoper 162
40 Pioneer 156
41 GeeXboX 153
42 Yellow Dog 143
43 Solaris 143
44 Absolute 139
45 Pardus 137
46 Scientific 134
47 GParted 133
48 Fluxbuntu 133
49 OpenBSD 128
50 Wolvix 123
51 Musix 119
52 -gamers 119
53 Ark 114
54 KANOTIX 112
55 Linspire 111
56 DragonFly 111
57 KateOS 108
58 SaxenOS 105
59 Novell SLE 105
60 SystemRescue 99
61 Parsix 97
62 IPCop 95
63 Berry 92
64 Linux XP 91
65 VideoLinux 89
66 SmoothWall 87
67 MCNLive 86
68 GoblinX 85
69 ClarkConnect 85
70 Devil 81
71 DeLi 81
72 dyne:bolic 80
73 AUSTRUMI 80
74 Feather 78
75 SME Server 77
76 m0n0wall 76
77 Lunar 76
78 ArtistX 76
79 BLAG 74
80 EnGarde 72
81 Bluewhite64 69
82 Helix 68
83 FreeNAS 68
84 CRUX 68
85 BeleniX 68
86 Edubuntu 67
87 Turbolinux 66
88 Symphony OS 66
89 NetBSD 66
90 FoX Desktop 66
91 Grafpup 65
92 Gentoox 65
93 LiveCD Router 64
94 aLinux 64
95 Pentoo 63
96 Skolelinux 62
97 Granular 62
98 Vine 61
99 Ulteo 61
100 StartCom 59

二手笔记本可靠吗?看看这里就知道了

每吨电子垃圾购买价格约在8000元到10000元,1吨大概能组装成600到700台笔记本。

在电脑城密集的广州岗顶,行人们很多时候都能看到一些地摊商贩,他们摊位前的白布上写着,回收出售二手笔记本、墨盒,也有不少神秘的卖主在向路人搭讪问要不要买IBM电脑,这种“路边生意”是如何运转的?

记者日前暗访二手笔记本的生产线,记者假称买主被摊主带到某电脑城附楼,在某个不到80平米房间里摆放着上百台二手品牌笔记本,例如,富士通四年前比较流行的型号为S2020和P7010等系列,当年售价为13000元左右,在这里被卖到4000多元。

三星的一款P系列的笔记本,在市场上价格万元左右,在这里不足四千元,更多的二手笔记本则是IBM的T系列。

卖主称这些笔记本主要是厂商的库存产品,由于上游芯片的不断更新换代,一款笔记本产品从推出到卖出只有不到90天的生命周期,如果90天内卖不出去就要积压库存,厂商还会为积压的库存支付费用。厂商们为了避免支付库存费用大多选择降价,如果降价后还是卖不出去,就只能流入二手市场了,专业二手电脑卖场应运而生。该卖主称,除了厂商库存品,部分二手笔记本是从普通用户或者企业用户手中回收而来。

翻新成本不足300元

据记者了解,目前消费者看到的二手笔记本极少数是原装库存机,大部分是通过和海外流入国内的电子垃圾翻新而成。

据深圳主要做电子垃圾分捡回收的内部人士透露,深圳有不少人从事该产业,已形成一条完整的产业链条,来自日韩,甚至欧美的洋垃圾以集装箱海运,通过广东、福建等沿海港口以电子垃圾的名义报关进口。

这些电子垃圾入境后,有专人进行分捡,翻新,加工,之后就流入了各地二手笔记本的经销商手里。据了解,每吨电子垃圾购买价格约在8000元到10000元,1吨大概能组装成600到700台笔记本。

加上人工运输等各种运营成本,这种垃圾回收笔记本成本大概在300元,而在市场上能卖到上千元的价格,不少做二手笔记本的商家认为自己的日子要比正牌商家更好过。

专业软件修改电脑属性

二手笔记本来源混杂,既有旧货,也有返修,更有翻新机,卖家自己如何区分呢?有经销商透露,二手笔记本是通过用A货、B货、C货来区分。A货是指内部手术动得最少,零部件都比较可靠的。B货就是除主板外基本都换了一遍,而C货就是电子垃圾了。

这些机器进入流通渠道后,主要是通过修改注册表或者使用专业软件,对电脑属性的“OEM信息”和WINXP的启动画面做修改,就能蒙混过关,“尽管是二手机,但从整机来看,这些奔三或奔四的产品完全能够胜任当前一些简单的应用需求,在性能上不会如你们想象的那么差。”这位经销商向记者强调。

色情与艺术的边缘

     发现现在有好多些艺术网站,里面全部都是美女裸体。这就是艺术了吗?艺术和色情,究竟怎么区分?两个人裸体就是色情?一个人裸体就是艺术?难道那些上艺术站的访问者,是心想着为着去欣赏艺术而去的?我想这样的人肯定很少吧,估计基本很多人都是去欣赏着美女裸体,窥探究竟去的吧?
     可以说我没品味,是一个不会欣赏艺术的人,但是为什么美女裸体的艺术站流量会很高呢?很多男人一间就想访问个不停呢?难道真的这是为了欣赏艺术?还有对于艺术网站和色情网站的鉴定究竟是怎么样的?这个都很难把握吧?如果我是裸体艺术站,基本是可以说叫你关就能关,说是你色情站你就变色情站了。。。。。。糊涂。。。真想不通一个全裸的女人,不管上面下面对着镜头的照片,能说他是艺术还是色情呢???