Tuesday, September 23rd, 2008
昨天把wiki升级下,感觉也没多大必要等待官方把那个漏洞修复后再升,顺便装上互动百科联盟插件,
刚去看共享协议用的cc协议 ,只是昨天去互动见用我创建的词条并没有在(像大多hdwiki样)词条下部明显标出出处,没有明文链接连回原百科网站,可互动百科协议清楚写的,注明出处和原作者信息,作为最大的互动联盟发起者为何不遵守这个协议呢!
难道就是做出这个不入流的“中文wiki”程序,来吸引更多的小站长为互动百科做贡献吗?虽说是可以从互动百科导入词条(对于空的站来说是好事吧?!),并且都很清楚的表明来自互动,以及具体链接地址等。
同时(不知道是不是在装起互动百科联盟插件成功开始),互动就在默默的把网站数据导入到互动,这个不是昨天刚好帐号在登录着,并且碰巧刷新啦下,还不知道呢,我还奇怪呢,说怎么刚建的号一会就几百条贡献!!仔细一查,才知道是我站的数据被导入到互动啦!
导入就导入吧,只是不注明出处就让人纳闷啦
PS:或许是我刚用起这个插件同时对官方互动百科不了解,有可能误会,现在数据都丢到互动啦,感觉有点可惜!!哪里说的不对或有误还希望能提出来。。。 :P
PS2:来呀,大家都来用hdwiki建垃圾站ing :)
Posted in Wiki支持, 今日一点 | No Comments »
Wednesday, September 17th, 2008
这里的变量索引很全的呢,忙着搞那个UCH,不翻译啦,直接出示地址以后参考ing
his is an index of all supported configuration options based on the DefaultSettings.php file.
Never edit DefaultSettings.php; copy appropriate lines to LocalSettings.php instead and amend them as appropriate.
维基百科地址:http://www.mediawiki.org/wiki/Manual:Configuration_settings
1 General Settings
2 Paths
3 Global Objects
4 Email settings
4.1 Email notification (Enotif) settings
5 Database settings
5.1 LoadBalancer settings
5.2 MySQL specific
5.3 PostgreSQL specific
5.4 SQLite specific
5.5 Shared DB settings
5.6 Sysop SQL queries
5.7 Compressed ...
Posted in Wiki支持, 今日一点 | No Comments »
Saturday, August 23rd, 2008
第一个问题:从"Form"获取的字符非得经历从gbk转到utf-8或者从utf-8转到gbk一次吗?
hdwiki4.0版本(8.21发布)的 string.class.php中的字符编码转换函数
function hiconv($str,$to='',$from='') {
global $encoding;
if(empty($to))$to=$encoding;
if(empty($from)){
if( strtolower($encoding)=='gbk' ){$from='utf-8';}else{$from='gbk';}
}
$to=strtolower($to);
$from=strtolower($from);
$isutf8=preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $str );
if( $isutf8 && $to=='utf-8' ) return $str;
if( !$isutf8 && $to=='gbk' ) return $str;
require_once('Chinese.class.php');
$ch = new chinese($from,$to);
$str= $ch->convert($str);
return $str;
}
为啥 if( strtolower($encoding)=='gbk' ){$from='utf-8';}else{$from='gbk';}
这样呢,非得经历从gbk转到utf-8或者从utf-8转到gbk一次吗?为什么呢?
相关帖子:
http://kaiyuan.hoodong.com/bbs/viewthread.php?tid=2870&extra=page%3D6
第二个问题:hdwiki的ie下查看页面源码出现“中文乱码”现象!
另外hdwiki的ie下查看页面源码出现“中文乱码”现象,问题原来越清晰啦,就是获取到多余的字符,最初发现是在页脚处的“友情链接说明”内容过多(两个未知字节),造成页脚错位,而后发现词条页面过多的“摘要”内容(同样是两个未知字节)导致词条页面,使用ie查看页面源码出现“中文乱码”现象(再重新编辑摘要,刷新页面后验证正常),目前首页剩下最后一处可能造成“错误”原因就是还有一处乱码没有清理(移到友情链接中间的一个友情链接的(多两个字节)说明内容)。
就目前来看问题应该是出在没有处理好读取到的多余的两个字节上。
PS:另外可能出问题的关键字可能还有:站名,文章标题,标签,分类说明
PS:从原来有数据并且编写的都不怎么规范升级到4.0就可能出现这个情况
PS:$summary默认的数据库长度是250字节(从upgrade13.php中得知)。。。
在doc.php中
$doc['summary']=trim(string::convercharacter(string::substring(strip_tags($doc['summary']),0,100)));
是不是说明$summary只正常接收100个字节呢,
顺便提一下,这个$summary在入库前没有经过检查,并且这个是管理员不可以控制的部分(只要是有编辑权限的都可以去写摘要吧),同时他会导致页面代码错乱(字符编码问题?还是字节超出问题?),那么有没有可能构造异常的摘要,而在其后放入不正常的代码呢?(因为数据库中的$summary部分还可以存入150字节呢),如果想办法让substring处理异常会有这个可能吧!!
doc.php中docreate函数
行108到124
if(@!(bool)$this->post['summary']){
$doc['summary']=trim(strip_tags($_ENV['doc']->replace_danger_word($this->post['summary'])));
}
$doc['letter']=string::getfirstletter($this->post['title']);
$doc['category']=$this->post['category'];
$doc['title']=string::substring(string::stripspecialcharacter(trim($this->post['title'])),0,80);
$doc['tags']=$_ENV['doc']->jointags($this->post['tags']);
$doc['content']=string::stripscript($_ENV['doc']->replace_danger_word($this->post['thcTextarea']));
$doc['summary']=trim(strip_tags($_ENV['doc']->replace_danger_word($this->post['summary'])));
$doc['summary']=(bool)$doc['summary']?$doc['summary']:$doc['content'];
$doc['summary']=trim(string::convercharacter(string::substring(strip_tags($doc['summary']),0,100)));
$doc['images']=util::getimagesnum($doc['content']);
$doc['time']=$this->time;
$doc['words']=string::hstrlen($doc['content']);
$doc['visible']=$this->setting['verify_doc']?'0':'1';
$result=$_ENV['doc']->add_doc($doc);
doc.class.php中add_doc函数
行107到123
function add_doc($doc) {
$this->db->query("insert into ".DB_TABLEPRE."doc
(cid,letter,title,tag ,summary ,content,author,authorid,time,lastedit,lasteditor,visible)
values ('".$doc['category']."','".$doc['letter']."','".$doc['title']."','".$doc['tags']."','".$doc['summary']."','".$doc['content']."',
'".$this->base->user['username']."','".$this->base->user['uid']."',
".$doc['time'].",".$doc['time'].",'".$this->base->user['username']."','".$doc['visible']."')");
$did=$this->db->insert_id();
$this->db->query("insert into ".DB_TABLEPRE."edition
(cid,did,author,authorid,time,ip,title,tag,summary,content,words,images )
values ('".$doc['category']."',$did,'".$this->base->user['username']."','".$this->base->user['uid']."',
'".$doc['time']."','".$this->base->ip."','".$doc['title']."','".$doc['tags']."','".$doc['summary']."','".$doc['content']."','".$doc['words']."','".$doc['images']."')");
return $did;
}
苦于对php不了解,上边的俩问题如果遇到大虾就别笑我呢!!
wiki地址:http://wiki.clin003.com/wiki/Hdwiki4
Posted in Wiki支持, 今日一点, 代码调试 | 1 Comment »
Sunday, August 10th, 2008
这里只是针对后台的keywords和description两项设置不强做的模板修改
模板文件:/view/default/header.htm
修改后代码为:
<meta name="keywords" content="{$setting[seo_keywords]}<!--{loop $doc['tag'] $key $tag}--> {$tag} <!--{/loop}-->,<!--{loop $navigation $key $category}-->{$category['name']}<!--{/loop}-->!" />
<meta name="description" content="<!--{if $edition['reason']!=''}-->{$edition['reason']}<!--{else}-->{$setting[seo_description]}<!--{/if}-->" />
标签关键字说明:
标签tag
<!--{loop $doc['tag'] $key $tag}--> {$tag} <!--{/loop}-->
分类名称
<!--{loop $navigation $key $category}-->{$category['name']}<!--{/loop}-->
修改原因
<!--{if $edition['reason']!=''}-->{$edition['reason']}<!--{else}-->{$setting[seo_description]}<!--{/if}-->
后台设置的description
{$setting[seo_description]}
后台设置的keywords
{$setting[seo_keywords]}
建议:直接在后台这两项留空,删掉这里的keywords和description两项
更多细节的说明可以参考:http://wiki.clin003.com/wiki/Hdwiki
Posted in Wiki支持, 今日一点 | No Comments »
Wednesday, August 6th, 2008
不清楚那个百科哪里跟六合彩搭边啦,隔段时间就个人去编辑词条添加六合彩地址链接!还好添加的不多,主题我也设置啦需要审核才发布,要不又要忙活啦!!
那人挺外行的!添加的链接都是论坛用的链接形式[url]*[/url],奇啦怪,他也不看看修改的效果!!
Posted in Wiki支持, 今日一点 | No Comments »