Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[freddy再次测试成功!]贴子买卖 for 2.5F AND SP1 (简体)[3.28更新]

[复制链接]
freddy 发表于 2005-4-23 14:51:42 | 显示全部楼层 |阅读模式
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 版本安装过的则可省去此步骤)

  1. DROP TABLE IF EXISTS cdb_postpay;
  2. CREATE TABLE cdb_postpay (
  3.   id int(12) NOT NULL auto_increment,
  4.   tid mediumint(8) NOT NULL default '0',
  5.   pid int(10) unsigned NOT NULL default '0',
  6.   sellcount smallint(3) unsigned NOT NULL default '0',
  7.   author varchar(25) NOT NULL default '',
  8.   username varchar(25) NOT NULL default '',
  9.   money smallint(6) unsigned NOT NULL default '0',
  10.   dateline int(10) unsigned NOT NULL default '0',
  11.   PRIMARY KEY  (id),
  12.   KEY tid (tid)
  13. ) TYPE=MyISAM;
复制代码

在后台->附件功能设置->附件相关->将 "隐藏图片真实地址" 及"使用防盗链图片" 两项设定为 "否"
修改config.php
文件结尾处,增加以下内容

  1. // 贴子买卖配置-开始
  2. $hacktable_postpay = 'cdb_postpay';
  3. $allowpostpay =1;
  4. $cnteacher_postsell_maxprice =1000;
  5. $cnteacher_paylist_perpage =20;   
  6. //贴子买卖配置-结束
复制代码

修改 include/common.php (如安装银行插件时已修改此部份便不用再修改)


  1. m.uid AS discuz_uid,
复制代码

在后面插入

  1. m.bank as userbank,m.money as usermoney
复制代码

修改include/discuzcode.php
(SP1)找

  1. global $credit, $tid, $discuz_uid, $codehtml, $post_codecount, $thisbg, $highlight, $table_posts, $db, $searcharray, $replacearray, $ismoderator,$phpcodehtml,$post_phpcodecount;
复制代码

(2.5F)找

  1. global $credit, $tid, $discuz_uid, $codehtml, $post_codecount, $thisbg, $highlight, $table_posts, $db, $searcharray, $replacearray, $ismoderator,$phpcodehtml,$post_phpcodecount;

  2. $post_codecount = $post_phpcodecount = -1;
复制代码

更换为

  1. // 帖子买卖-start
  2.         global $credit, $tid, $discuz_uid, $discuz_user, $codehtml, $post_codecount, $thisbg, $highlight, $table_posts, $db, $searcharray, $replacearray, $sellmessage,$ismoderator,$post_sellcount,$phpcodehtml,$post_phpcodecount;
  3.         $post_sellcount=0;
  4.         $post_codecount = -1;
  5.         $post_phpcodecount = -1;
  6.         $message = preg_replace("/\[sell=(\d+)\]\s*(.+?)\s*\[\/sell\]/ies", "postsell(\\1,'\\2')", $message);
  7. // 帖子买卖-end
复制代码



  1. for($i = 0; $i <= $post_codecount; $i++) {
复制代码

在上面加入下列内容:

  1. // 帖子买卖--start
  2. for($si = 0; $si <= $post_sellcount; $si++) {
  3.   $message = str_replace("|\tDISCUZ_SELL_$si\t|", $sellmessage[$si], $message);
  4. }
  5. unset ($sellmessage);
  6. //--------------
复制代码

在文件底部 ?> 的上面加入下面的内容

  1. //贴子买卖funciton ========start
  2. function postsell($price, $message) {
  3.     global $thisbg, $post_sellcount,$db,$post, $sellmessage,$tid,$table_posts,$hacktable_postpay,$discuz_user,$issupermod,$ismoderator,$isadmin,$usermoney,$page;
  4.     //$message=stripslashes($message);
  5. $message = str_replace("\\"", """, preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1",
  6. $message));
  7.     $post_sellcount++;
  8.     $price=abs(intval($price));
  9.     $post['needmoney']=$post['needmoney']+$price;
  10.     $query = $db->query("SELECT COUNT(*) FROM $hacktable_postpay WHERE pid='$post[pid]' AND sellcount='$post_sellcount' ");
  11.     $payusercount=$db->result($query, 0);
  12.     if ($discuz_user){
  13.         if ($usermoney >= $price){
  14.             $paymessage="你的现金是:$usermoney ,可以<a href="postpay.php?action=pay&tid=$tid&pid=$post[pid]&sellcount=$post_sellcount&money=$price&page=$page">[立即付费]</a>。";
  15.         }else{
  16.             $paymessage="你的现金是:$usermoney ,无法付费。去[<a href='plugins.php?p=bank'>银行</a>]取款或者卖些积分吧。";
  17.         }
  18.     }else{
  19.             $paymessage= "非本站会员无权购买,请[<a href='logging.php?action=login'>登陆</a>],或者[<a href='register.php'>注册</a>]";
  20.     }
  21.      
  22. $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>&nbsp;&nbsp;收费单</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>&nbsp;<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>";
  23.      
  24. $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> &nbsp;&nbsp;付款证明</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>&nbsp;<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>";

  25.     if ($discuz_user){
  26.         $query = $db->query("SELECT COUNT(*) FROM $table_posts WHERE pid='$post[pid]' AND author='$discuz_user'");
  27.         $isauthor = $db->result($query, 0);
  28.         if($issupermod || $ismoderator || $isadmin || $isauthor ){
  29.             $post['paymoney']=$post['needmoney'];
  30.             $post['payed']=2;
  31.             $sellmessage[$post_sellcount]=$sm2;
  32.         } else {
  33.             $query = $db->query("SELECT COUNT(*) FROM $hacktable_postpay WHERE pid='$post[pid]' AND  sellcount='$post_sellcount' and money='$price' and username='$discuz_user'");
  34.             if($db->result($query, 0)) {
  35.                 $post['paymoney']=$post['paymoney']+$price;
  36.                 $post['payed']=2;
  37.                 $sellmessage[$post_sellcount]=$sm2;
  38.             }else{
  39.                 $post['payed']=1;
  40.                 $message='';
  41.                 $sellmessage[$post_sellcount]=$sm1;
  42.             }   
  43.         }
  44.     }else{
  45.         $post['payed']=1;
  46.         $message='';
  47.         $sellmessage[$post_sellcount]=$sm1;
  48.     }
  49.     return "|\tDISCUZ_SELL_$post_sellcount\t| ".$message;
  50. }
  51. //贴子买卖funciton ========end
复制代码

修改 include/newreply.php


  1. $message = preg_replace("/\[hide=?\d*\](.+?)\[\/hide\]/is", "[b]**** Hidden message by originally poster *****[/b]", $message);
复制代码

在下面加上

  1. $message = preg_replace("/\[sell=?\d*\](.+?)\[\/sell\]/is", "[b]**** 付费信息,已经隐藏 *****[/b]", $message);
复制代码

修改 include/printable.php


  1. while($post = $db->fetch_array($querypost)) {
复制代码

下面加上

  1. $post['payed'] = 0 ;
复制代码

修改attachment.php 该文件位于论坛根目录


  1. $discuz_action = 14;
复制代码

在下面加上

  1. if ($discuz_user){
  2. $ismoderator = modcheck($discuz_user);
  3. }
复制代码



  1. showimgmessage('attachment_forum_nopermission');
  2.         }
复制代码

下面加上

  1. function postsell($price, $message) {
  2.         global $postmoney,$issellpost;
  3.         $issellpost =1;
  4.         $price=abs(intval($price));
  5.         $postmoney=$postmoney+$price;
  6. }
  7. //======= cnteacher贴子支付下载=========START=============
  8. $query = $db->query("SELECT message,author,pid FROM $table_posts WHERE pid='$attach[pid]'");
  9. $post = $db->fetch_array($query);
  10. $downisok=0;
  11. if($adminid >0 || $isauthor){
  12.         $downisok=1;
  13. }else{
  14.         $postmoney=0;
  15.         $issellpost=0;
  16.         $post[message] = preg_replace("/\[sell=(\d+)\]\s*(.+?)\s*\[\/sell\]/ies", "postsell(\\1,'\\2')", $post[message]);
  17.         if (!$issellpost || $discuz_user==$post[author]){
  18.                 $downisok=1;
  19.         }else{
  20.                 if ($discuz_uid){
  21.                         $query = $db->query("SELECT sum(money)as paymoneys ,count(*) as count FROM $hacktable_postpay WHERE pid='$post[pid]' AND  username='$discuz_user'");
  22.                          $userpay=$db->fetch_array($query);
  23.                         if (($userpay['paymoneys'] >= $postmoney) && ($userpay['count'] >0)){$downisok=1;
  24.                                 }else{showmessage("下载本附件需要付费: $postmoney 个金币。<br>您目前尚未支付,无法下载。");exit;}
  25.                 }else{
  26.                         $downisok=0;
  27.                 }
  28.         }
  29. }

  30. if(!$downisok){
  31.         showmessage('本软件为付费软件,请登陆付费。');
  32. }
  33. //======= cnteacher贴子支付下载=========END======
复制代码

修改 viewthread.php


  1. $post['subject'] = $post['subject'] ? $post['subject'] : NULL;
复制代码

在下面加上

  1. $post['payed'] = 0 ;
复制代码



  1. $attach['attachicon'] = attachtype($extension."\t".$attach['filetype']);
复制代码

在下面加上

  1. $attach['attachtype'] = attachtype($extension."\t".$attach['filetype']);
  2. $attach['attachext'] = $extension;
  3. $attach['attachsize'] = sizecount($attach['filesize']);
复制代码



  1. $attaches['attachimg'] = 0;

  2.                         }
复制代码

将下一句删除

  1. $attach['attachsize'] = sizecount($attach['filesize']);
复制代码

修改模版 viewthread.htm


  1. <!--{if $attachelist[$post[pid]]}-->
  2.         <!--{eval $attacount = 0; }-->
  3.         <blockquote><!--{loop $attachelist[$post[pid]] $vkey $attach}-->
  4.                         {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'],&nbsp;$attach[attachsize]
  5.                         <!--{if $attach[creditsrequire]}-->, {lang creditsrequire_attach}{lang credit_title} $attach[creditsrequire] {lang credit_unit}<!--{/if}-->
  6.                         <!--{if $attach[downloads]}-->,{lang downloads}: $attach[downloads]<!--{/if}--> )
  7.                 <!--{if $attach['attachimg']}-->
  8.                         <br><br><!--{if !$attachimgcheck}-->
  9.                                 <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]');">
  10.                         <!--{else}-->
  11.                                 <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>

  12.                         <!--{/if}-->
  13.                 <!--{/if}-->
  14.         <br><!--{/loop}--></blockquote>
  15. <!--{/if}-->
复制代码

更换为

  1. <!--{if $attachelist[$post[pid]]}-->
  2. <!--{if $post[payed]==0 || (($post['paymoney']>=$post['needmoney']) && ($post[payed]==2)) }-->
  3. <!--{eval $attacount = 0; }-->
  4. <blockquote>
  5. <!--{loop $attachelist[$post[pid]] $vkey $attach}-->
  6. {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'],&nbsp;$attach[attachsize]
  7. <!--{if $attach[creditsrequire]}-->, {lang creditsrequire_attach}{lang credit_title} $attach[creditsrequire] {lang credit_unit}<!--{/if}-->
  8. <!--{if $attach[downloads]}-->,{lang downloads}: $attach[downloads]<!--{/if}--> )
  9. <!--{if $attach['attachimg']}-->
  10. <br><br><!--{if !$attachimgcheck}-->
  11. <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]');">
  12. <!--{else}-->
  13. <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>
  14. <!--{/if}--><!--{/if}-->
  15. <br><!--{/loop}--></blockquote>
  16. <!--{else}-->
  17. <!--{eval $attacount = 0; }-->
  18. <blockquote>
  19. <!--{loop $attachelist[$post[pid]] $vkey $attach}-->
  20. {lang attachment} <!--{echo ++$attacount }--> : $attach[attachicon] $attach[filename] ($attach['dateline'],&nbsp;$attach[attachsize])<br> 您只有支付了贴子 中的所有资费才可以察看或者下载。<br>
  21. <!--{if $attach[creditsrequire]}-->, {lang creditsrequire_attach}{lang credit_title} $attach[creditsrequire] {lang credit_unit}<!--{/if}-->
  22. <!--{if $attach['attachimg']}-->
  23. <br><!--{if !$attachimgcheck}-->
  24. <!--{else}-->
  25. 您只有支付了贴子中的所有资费才可以察看或者下载。<br>
  26. <!--{/if}--><!--{/if}-->
  27. <br><!--{/loop}--></blockquote>
  28. <!--{/if}--><!--{/if}-->
复制代码



此贴装完后,最好再装这个:

买卖贴按钮(快捷方式)

这样就完美了!


[ Last edited by freddy on 2005-5-15 at 12:36 ]

[ 本帖最后由 freddy 于 2005-7-7 15:35 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
桃源 发表于 2005-4-23 16:04:18 | 显示全部楼层
好东西   
回复

使用道具 举报

 楼主| freddy 发表于 2005-4-23 16:09:24 | 显示全部楼层
呵呵~谢谢支持
回复

使用道具 举报

omi543 发表于 2005-4-23 23:08:02 | 显示全部楼层
比較想要能夠增加買賣上限金額
不知道樓主是不是能新增呀~
回复

使用道具 举报

 楼主| freddy 发表于 2005-4-24 04:18:02 | 显示全部楼层
可能原作者还没实现这个吧~
回复

使用道具 举报

c2c3 发表于 2005-4-24 12:43:36 | 显示全部楼层
好东西  
回复

使用道具 举报

pani 发表于 2005-4-24 13:15:51 | 显示全部楼层
怎么使用。发帖子没有选项啊?!
回复

使用道具 举报

pani 发表于 2005-4-24 13:17:26 | 显示全部楼层
请老大解决
回复

使用道具 举报

pani 发表于 2005-4-24 14:34:40 | 显示全部楼层
搜索了一下用sell可以
但是可以把买帖子的标签插到发帖子的上面吗
另外附件怎么买卖
回复

使用道具 举报

pani 发表于 2005-4-24 14:43:39 | 显示全部楼层
原来是支付了才可以下载的
呵呵
就还有一个问题就是把他的快捷方式搞到上面的加粗的那些上面就好了
就是一键卖帖子
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-9-28 00:04 , Processed in 0.128668 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表