2.5F 修改: alan888
简化修改: 54177
适用版本: Discuz! 2.5F
技术支持: http://www.alan888.com/Discuz/index.php
2.5 SP1
已经测试过了,可以用
演示地址:http://www.51happy365.com/bbs
已与lfly1573的全新完美银行结合
附件为简化后版本
注意 : 重复PLUS版简化买卖贴目的 -- 由于测试PLUS版简体买卖贴未成功 , 所以在CLUB版推出自修改且测试成功的简体买卖贴插件 . 若版主认为此贴还是重复贴或广告贴请经本人同意删贴. 本人没有任何商业目的或企图!!!
安装办法
请将压缩包文件展开,将discuz目录中的所有文件上传到你的论坛目录。
进入管理后台升级数据库,内容如下:(如曾经在其它 Discuz 版本安装过的则可省去此步骤)
- DROP TABLE IF EXISTS cdb_postpay;
- CREATE TABLE cdb_postpay (
- id int(12) NOT NULL auto_increment,
- tid mediumint(8) NOT NULL default '0',
- pid int(10) unsigned NOT NULL default '0',
- sellcount smallint(3) unsigned NOT NULL default '0',
- author varchar(25) NOT NULL default '',
- username varchar(25) NOT NULL default '',
- money smallint(6) unsigned NOT NULL default '0',
- dateline int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (id),
- KEY tid (tid)
- ) TYPE=MyISAM;
复制代码
在后台->附件功能设置->附件相关->将 "隐藏图片真实地址" 及"使用防盗链图片" 两项设定为 "否"
修改config.php
文件结尾处,增加以下内容
- // 贴子买卖配置-开始
- $hacktable_postpay = 'cdb_postpay';
- $allowpostpay =1;
- $cnteacher_postsell_maxprice =1000;
- $cnteacher_paylist_perpage =20;
- //贴子买卖配置-结束
复制代码
修改 include/common.php (如安装银行插件时已修改此部份便不用再修改)
找
在后面插入
- m.bank as userbank,m.money as usermoney
复制代码
修改include/discuzcode.php
(SP1)找
- global $credit, $tid, $discuz_uid, $codehtml, $post_codecount, $thisbg, $highlight, $table_posts, $db, $searcharray, $replacearray, $ismoderator,$phpcodehtml,$post_phpcodecount;
复制代码
(2.5F)找
- global $credit, $tid, $discuz_uid, $codehtml, $post_codecount, $thisbg, $highlight, $table_posts, $db, $searcharray, $replacearray, $ismoderator,$phpcodehtml,$post_phpcodecount;
- $post_codecount = $post_phpcodecount = -1;
复制代码
更换为
- // 帖子买卖-start
- global $credit, $tid, $discuz_uid, $discuz_user, $codehtml, $post_codecount, $thisbg, $highlight, $table_posts, $db, $searcharray, $replacearray, $sellmessage,$ismoderator,$post_sellcount,$phpcodehtml,$post_phpcodecount;
- $post_sellcount=0;
- $post_codecount = -1;
- $post_phpcodecount = -1;
- $message = preg_replace("/\[sell=(\d+)\]\s*(.+?)\s*\[\/sell\]/ies", "postsell(\\1,'\\2')", $message);
- // 帖子买卖-end
复制代码
找
- for($i = 0; $i <= $post_codecount; $i++) {
复制代码
在上面加入下列内容:
- // 帖子买卖--start
- for($si = 0; $si <= $post_sellcount; $si++) {
- $message = str_replace("|\tDISCUZ_SELL_$si\t|", $sellmessage[$si], $message);
- }
- unset ($sellmessage);
- //--------------
复制代码
在文件底部 ?> 的上面加入下面的内容
- //贴子买卖funciton ========start
- function postsell($price, $message) {
- global $thisbg, $post_sellcount,$db,$post, $sellmessage,$tid,$table_posts,$hacktable_postpay,$discuz_user,$issupermod,$ismoderator,$isadmin,$usermoney,$page;
- //$message=stripslashes($message);
- $message = str_replace("\\"", """, preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1",
- $message));
- $post_sellcount++;
- $price=abs(intval($price));
- $post['needmoney']=$post['needmoney']+$price;
- $query = $db->query("SELECT COUNT(*) FROM $hacktable_postpay WHERE pid='$post[pid]' AND sellcount='$post_sellcount' ");
- $payusercount=$db->result($query, 0);
- if ($discuz_user){
- if ($usermoney >= $price){
- $paymessage="你的现金是:$usermoney ,可以<a href="postpay.php?action=pay&tid=$tid&pid=$post[pid]&sellcount=$post_sellcount&money=$price&page=$page">[立即付费]</a>。";
- }else{
- $paymessage="你的现金是:$usermoney ,无法付费。去[<a href='plugins.php?p=bank'>银行</a>]取款或者卖些积分吧。";
- }
- }else{
- $paymessage= "非本站会员无权购买,请[<a href='logging.php?action=login'>登陆</a>],或者[<a href='register.php'>注册</a>]";
- }
-
- $sm1="<br><center><table style='background: threedface; color: windowtext; margin: 2px; BORDER-STYLE: none' width='90%'><tr><td><FIELDSET style='width: 100%; text-align: center'><LEGEND> 收费单</font></LEGEND><table border='0' width='98%' cellspacing='0' cellpadding='6' ><tr><td class='smalltxt'>编号:<input type='text'name='p101' value='$tid-$post[pid]-$post[postcount]'></td><td>价格:<input type=text name=p102 value='$price' size=5>金额</td><td align='right'>已付费人数:<input type=text name=p103 value='$payusercount' size=5> <a href='postpay.php?action=showpayuser&tid=$tid&pid=$post[pid]&sellcount=1'><font color=red>名单</font></a></td></tr><tr><td colspan='3'><hr><font color ='#000000'>请付费察看本帖隐藏内容,$paymessage</td></tr></table></FIELDSET></tr></table></center>";
-
- $sm2="<br><center><table style='background: threedface; color: windowtext; margin: 2px; BORDER-STYLE: none' width='90%'><tr><td><FIELDSET style='width: 100%; text-align: center'><LEGEND> 付款证明</font></LEGEND><table border='0' width='98%' cellspacing='0' cellpadding='6'><tr><td class='smalltxt'>编号:<input type='text' name='p101' value='$tid-$post[pid]-$post[postcount]'></td><td> 价格:<input type=text name=p102 value='$price' size=5> 金额</td><td align='right'>已付费人数:<input type=text name=p103 value='$payusercount' size=5> <a href= 'postpay.php?action=showpayuser&tid=$tid&pid=$post[pid]&sellcount=1'><font color=red>名单</font></a></td></tr><tr><td colspan='3'><hr><font color='#000000'>感谢您的付费!你可以观看以下付费内容了。如发现非法敛财,可以投诉给版主</td></tr></table></FIELDSET></tr></table></center>";
- if ($discuz_user){
- $query = $db->query("SELECT COUNT(*) FROM $table_posts WHERE pid='$post[pid]' AND author='$discuz_user'");
- $isauthor = $db->result($query, 0);
- if($issupermod || $ismoderator || $isadmin || $isauthor ){
- $post['paymoney']=$post['needmoney'];
- $post['payed']=2;
- $sellmessage[$post_sellcount]=$sm2;
- } else {
- $query = $db->query("SELECT COUNT(*) FROM $hacktable_postpay WHERE pid='$post[pid]' AND sellcount='$post_sellcount' and money='$price' and username='$discuz_user'");
- if($db->result($query, 0)) {
- $post['paymoney']=$post['paymoney']+$price;
- $post['payed']=2;
- $sellmessage[$post_sellcount]=$sm2;
- }else{
- $post['payed']=1;
- $message='';
- $sellmessage[$post_sellcount]=$sm1;
- }
- }
- }else{
- $post['payed']=1;
- $message='';
- $sellmessage[$post_sellcount]=$sm1;
- }
- return "|\tDISCUZ_SELL_$post_sellcount\t| ".$message;
- }
- //贴子买卖funciton ========end
复制代码
修改 include/newreply.php
找
- $message = preg_replace("/\[hide=?\d*\](.+?)\[\/hide\]/is", "[b]**** Hidden message by originally poster *****[/b]", $message);
复制代码
在下面加上
- $message = preg_replace("/\[sell=?\d*\](.+?)\[\/sell\]/is", "[b]**** 付费信息,已经隐藏 *****[/b]", $message);
复制代码
修改 include/printable.php
找
- while($post = $db->fetch_array($querypost)) {
复制代码
下面加上
修改attachment.php 该文件位于论坛根目录
找
在下面加上
- if ($discuz_user){
- $ismoderator = modcheck($discuz_user);
- }
复制代码
找
- showimgmessage('attachment_forum_nopermission');
- }
复制代码
下面加上
- function postsell($price, $message) {
- global $postmoney,$issellpost;
- $issellpost =1;
- $price=abs(intval($price));
- $postmoney=$postmoney+$price;
- }
- //======= cnteacher贴子支付下载=========START=============
- $query = $db->query("SELECT message,author,pid FROM $table_posts WHERE pid='$attach[pid]'");
- $post = $db->fetch_array($query);
- $downisok=0;
- if($adminid >0 || $isauthor){
- $downisok=1;
- }else{
- $postmoney=0;
- $issellpost=0;
- $post[message] = preg_replace("/\[sell=(\d+)\]\s*(.+?)\s*\[\/sell\]/ies", "postsell(\\1,'\\2')", $post[message]);
- if (!$issellpost || $discuz_user==$post[author]){
- $downisok=1;
- }else{
- if ($discuz_uid){
- $query = $db->query("SELECT sum(money)as paymoneys ,count(*) as count FROM $hacktable_postpay WHERE pid='$post[pid]' AND username='$discuz_user'");
- $userpay=$db->fetch_array($query);
- if (($userpay['paymoneys'] >= $postmoney) && ($userpay['count'] >0)){$downisok=1;
- }else{showmessage("下载本附件需要付费: $postmoney 个金币。<br>您目前尚未支付,无法下载。");exit;}
- }else{
- $downisok=0;
- }
- }
- }
- if(!$downisok){
- showmessage('本软件为付费软件,请登陆付费。');
- }
- //======= cnteacher贴子支付下载=========END======
复制代码
修改 viewthread.php
找
- $post['subject'] = $post['subject'] ? $post['subject'] : NULL;
复制代码
在下面加上
找
- $attach['attachicon'] = attachtype($extension."\t".$attach['filetype']);
复制代码
在下面加上
- $attach['attachtype'] = attachtype($extension."\t".$attach['filetype']);
- $attach['attachext'] = $extension;
- $attach['attachsize'] = sizecount($attach['filesize']);
复制代码
找
- $attaches['attachimg'] = 0;
- }
复制代码
将下一句删除
- $attach['attachsize'] = sizecount($attach['filesize']);
复制代码
修改模版 viewthread.htm
找
- <!--{if $attachelist[$post[pid]]}-->
- <!--{eval $attacount = 0; }-->
- <blockquote><!--{loop $attachelist[$post[pid]] $vkey $attach}-->
- {lang attachment} <!--{echo ++$attacount }--> : $attach[attachicon] <a href="attachment.php?aid=$attach[aid]&checkid=$attach[checkid]&download=1" target="_blank">$attach[filename]</a> ($attach['dateline'], $attach[attachsize]
- <!--{if $attach[creditsrequire]}-->, {lang creditsrequire_attach}{lang credit_title} $attach[creditsrequire] {lang credit_unit}<!--{/if}-->
- <!--{if $attach[downloads]}-->,{lang downloads}: $attach[downloads]<!--{/if}--> )
- <!--{if $attach['attachimg']}-->
- <br><br><!--{if !$attachimgcheck}-->
- <img src="$attachurl/$attach[attachment]" border="0" onload="if(this.width>screen.width*0.5) {this.resized=true; this.width=screen.width*0.6; this.alt='{lang click_open_newwindow}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(this.resized) window.open('$attachurl/$attach[attachment]');">
- <!--{else}-->
- <a href="attachment.php?aid=$attach[aid]&checkid=$attach[checkid]" target="_blank"><img src="attachment.php?aid=$attach[aid]&checkid=$attach[checkid]" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.6; this.alt='{lang click_open_newwindow}';}" onmouseover="if(this.resized) this.style.cursor='hand';"></a>
- <!--{/if}-->
- <!--{/if}-->
- <br><!--{/loop}--></blockquote>
- <!--{/if}-->
复制代码
更换为
- <!--{if $attachelist[$post[pid]]}-->
- <!--{if $post[payed]==0 || (($post['paymoney']>=$post['needmoney']) && ($post[payed]==2)) }-->
- <!--{eval $attacount = 0; }-->
- <blockquote>
- <!--{loop $attachelist[$post[pid]] $vkey $attach}-->
- {lang attachment} <!--{echo ++$attacount }--> : $attach[attachicon] <a href="attachment.php?aid=$attach[aid]&checkid=$attach[checkid]&download=1" target="_blank">$attach[filename]</a> ($attach['dateline'], $attach[attachsize]
- <!--{if $attach[creditsrequire]}-->, {lang creditsrequire_attach}{lang credit_title} $attach[creditsrequire] {lang credit_unit}<!--{/if}-->
- <!--{if $attach[downloads]}-->,{lang downloads}: $attach[downloads]<!--{/if}--> )
- <!--{if $attach['attachimg']}-->
- <br><br><!--{if !$attachimgcheck}-->
- <img src="$attachurl/$attach[attachment]" border="0" onload="if(this.width>screen.width*0.5) {this.resized=true; this.width=screen.width*0.6; this.alt='{lang click_open_newwindow}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(this.resized) window.open('$attachurl/$attach[attachment]');">
- <!--{else}-->
- <a href="attachment.php?aid=$attach[aid]&checkid=$attach[checkid]" target="_blank"><img src="attachment.php?aid=$attach[aid]&checkid=$attach [checkid]" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.6; this.alt='{lang click_open_newwindow}';}" onmouseover="if(this.resized) this.style.cursor='hand';"></a>
- <!--{/if}--><!--{/if}-->
- <br><!--{/loop}--></blockquote>
- <!--{else}-->
- <!--{eval $attacount = 0; }-->
- <blockquote>
- <!--{loop $attachelist[$post[pid]] $vkey $attach}-->
- {lang attachment} <!--{echo ++$attacount }--> : $attach[attachicon] $attach[filename] ($attach['dateline'], $attach[attachsize])<br> 您只有支付了贴子 中的所有资费才可以察看或者下载。<br>
- <!--{if $attach[creditsrequire]}-->, {lang creditsrequire_attach}{lang credit_title} $attach[creditsrequire] {lang credit_unit}<!--{/if}-->
- <!--{if $attach['attachimg']}-->
- <br><!--{if !$attachimgcheck}-->
- <!--{else}-->
- 您只有支付了贴子中的所有资费才可以察看或者下载。<br>
- <!--{/if}--><!--{/if}-->
- <br><!--{/loop}--></blockquote>
- <!--{/if}--><!--{/if}-->
复制代码
此贴装完后,最好再装这个:
买卖贴按钮(快捷方式)
这样就完美了!
[ Last edited by freddy on 2005-5-15 at 12:36 ]
[ 本帖最后由 freddy 于 2005-7-7 15:35 编辑 ] |