本帖最后由 unity.kaka 于 2008-11-4 21:39 编辑
第一次发教程```大家多多担待```此插件经过6.0改良```
原帖https://discuz.dismall.com/thread-807794-1-2.html,原帖适合6.0,6.1无法安装,我将其升级程序剥离出来,经测试无误!下面看教程!
1.上传images、plugins、templates三个文件夹到bbs根目录,管理后台导入discuz_plugin_pig.txt,
2.在数据库升级处升级如下语句
- DROP TABLE IF EXISTS cdb_pig;
- CREATE TABLE cdb_pig (
- id mediumint(8) NOT NULL auto_increment,
- usera char(15) NOT NULL default '',
- userb char(15) NOT NULL default '',
- type tinyint(2) NOT NULL default '0',
- time tinyint(2) NOT NULL default '0',
- status tinyint(1) NOT NULL default '0',
- notools tinyint(1) NOT NULL default '0',
- cdtime int(10) NOT NULL default '0',
- starttime int(10) NOT NULL default '0',
- overtime int(10) NOT NULL default '0',
- KEY id (id),
- KEY userb (userb)
- ) ENGINE=MyISAM DEFAULT CHARACTER SET gbk ;
- DROP TABLE IF EXISTS cdb_piglog;
- CREATE TABLE cdb_piglog (
- uid mediumint(8) unsigned NOT NULL DEFAULT '0',
- pigusername char(15) NOT NULL DEFAULT '',
- action tinyint(1) NOT NULL DEFAULT '0',
- dateline int(10) unsigned NOT NULL DEFAULT '0',
- price smallint(6) NOT NULL DEFAULT '0',
- status tinyint(1) NOT NULL DEFAULT '0',
- KEY uid (uid,action)
- ) ENGINE=MyISAM DEFAULT CHARACTER SET gbk ;
- ALTER TABLE cdb_memberfields ADD pighead varchar(15) NOT NULL DEFAULT '';
复制代码 数据库升级代码由26楼 『葬月』更改```谢谢『葬月』 的更改```解决无法对中文用户名使用猪头术的错误````猪头术终于出6.1的了``
以上由建站资源吧提供 http://www.oyesk.com.cn/viewthread.php?tid=897&pid=8122&page=1&extra=page%3D3#pid8122
以下由https://discuz.dismall.com/thread-807794-1-2.html 更改
3、修改 viewthread.php
找到记得前面有空格
在空格前面加继续搜索,找到- $post['avatar'] = '<div class="avatar">'.discuz_uc_avatar($post['authorid']);
复制代码 在下面插入:- global $timestamp;
- if($post['pighead']) {//判断是否有猪头
- @include DISCUZ_ROOT.'./forumdata/cache/plugin_pig.php';
- if($_DPLUGIN['pig']['vars']['pig_status']) {
- $post['pigheadarray'] = explode("\t", $post['pighead']);
- $post['pigheadtype'] = $post['pigheadarray'][0];
- $post['pigheadovertime'] = $post['pigheadarray'][1];
- }
- }
- if($post['pigheadtype'] && $post['pigheadovertime'] > $timestamp + $_DCACHE['settings']['timeoffset'] * 3600) {//判断是否显示猪头
- $post['avatar'] = '<div class="avatar"><img src="./images/plugins/pig/'.$post['pigheadtype'].'.gif" width="100" height="160" border="0" alt="我是猪头

被诅咒中....
恢复时间:'.gmdate('Y-n-d H:i', $post['pigheadovertime']).'" />';
- } else
复制代码 4.修改 space.php
找到在下面插入- if($member['pighead']) {//增加猪头显示
- @include DISCUZ_ROOT.'./forumdata/cache/plugin_pig.php';
- if($_DPLUGIN['pig']['vars']['pig_status']) {
- $member['pigheadarray'] = explode("\t", $member['pighead']);
- $member['pigheadtype'] = $member['pigheadarray'][0];
- $member['pigheadovertime'] = $member['pigheadarray'][1];
- if($member['pigheadtype'] && $member['pigheadovertime'] > $timestamp + $_DCACHE['settings']['timeoffset'] * 3600) {
- $member['avatar'] = './images/plugins/pig/'.$member['pigheadtype'].'.gif';
- $member['avatarwidth'] = '100';
- $member['avatarheight'] = '160';
- }
- }
- }
复制代码 5.设置插件参数,更新缓存,查看效果!
6.删除插件执行反安装过程``并执行数据库语句- DROP TABLE cdb_pig;
- DROP TABLE cdb_piglog;
- ALTER TABLE cdb_memberfields DROP pighead;
复制代码 附件:
[ 本帖最后由 unity.kaka 于 2008-8-24 00:11 编辑 ] |