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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[原创] · 插件式鲜花鸡蛋送给作者 1.0 by oytktk

[复制链接]
 楼主| oytktk 发表于 2005-10-14 20:53:28 | 显示全部楼层
原帖由 wuming.china 于 2005-10-14 20:49 发表
忘记说一下,怎么导入plug_flegg.txt?我的后台没有导入这个选项


.............

后台.....插件管理, 添加插件...下面就是导入~
回复

使用道具 举报

wuming.china 发表于 2005-10-14 21:03:18 | 显示全部楼层
再问一下,装这个是不是需要先装社区银行
回复

使用道具 举报

 楼主| oytktk 发表于 2005-10-14 21:26:37 | 显示全部楼层
原帖由 wuming.china 于 2005-10-14 21:03 发表
再问一下,装这个是不是需要先装社区银行


是啊.因为有买东西用钱~
回复

使用道具 举报

jiayuan1 发表于 2005-10-17 17:03:55 | 显示全部楼层
主题后显示的是贴子里全部的鲜花和鸡蛋,可不可以改成只显示一楼的,这样免得有的好贴后面跟了鸡蛋...
自己改了几天,改不好.....
回复

使用道具 举报

 楼主| oytktk 发表于 2005-10-17 17:47:44 | 显示全部楼层
哦...可以的...你把你的文件弄上来我帮你改~
回复

使用道具 举报

jiayuan1 发表于 2005-10-28 18:46:23 | 显示全部楼层
原帖由 oytktk 于 2005-10-17 17:47 发表
哦...可以的...你把你的文件弄上来我帮你改~


是在那个注释的地方吧?


  1. ......
  2.                         $thread['views'] = $thread['replies'];
  3.                 }
  4.                 if($thread['replies'] >= $hottopic) {
  5.                         $thread['folder'] = 'hot_'.$thread['folder'];
  6.                 }
  7.         }

  8.         if($thread['attachment']) {
  9.                 require_once DISCUZ_ROOT.'./include/attachment.php';
  10.                 $thread['attachment'] = attachtype($thread['attachment']).' ';
  11.         } else {
  12.                 $thread['attachment'] = '';
  13.         }
  14.         $thread[subject] = cutstr($thread[subject],77);
  15.         $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);
  16.         $thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);

  17.         /*就是在这下面吧,SQL的语句不太熟,oytktk 老大帮忙改改,谢谢啦!*/

  18.                 $thread['flower']=$thread['flower']>0?$thread['flower']="<img border=0 title='鲜花数:".$thread['flower']."' src='images/common/flower.gif' align=absmiddle>":'';
  19.         $thread['egg']=$thread['egg']>0?$thread['egg']="<img border=0 title='鸡蛋数:".$thread['egg']."' src='images/common/eggs.gif' align=absmiddle>":'';
  20.         //start
  21. if((!$forum['viewperm'] && !$allowview) || ($forum['viewperm'] && !strstr($forum['viewperm'], "\t$groupid\t"))) {
  22.         $thread['message'] = "谢谢您的访问!由于权限不够,您仅可浏览本版主题标题。";
  23.     } elseif($thread['creditsrequire'] && $thread['creditsrequire'] > $credit && !$ismoderator) {
  24.         include language('messages');
  25.         eval("\$show_message = "".$language[thread_nopermission]."";");
  26.         $thread['message'] =  $show_message;
  27.     } else {
  28.         $thread['message']  = preg_replace("/\[hide=?\d*\](.+?)\[\/hide\]/is", "**** 回复后才可查看信息 *****", $thread['message'] );
  29.         $thread['message']  = preg_replace("/\[sell=?\d*\](.+?)\[\/sell\]/is", "**** 付費信息,已經隱藏 *****", $thread['message'] );
  30.                 $thread['message']  = preg_replace("/\[rm=?(.+?)\](.+?)\[\/rm\]/is", "**** 此处为视频音频 *****", $thread['message'] );
  31.                 $thread['message']  = preg_replace("/\[wmv=?(.+?)\](.+?)\[\/wmv\]/is", "**** 此处为视频音频 *****", $thread['message'] );
  32.         $thread['message']  = preg_replace("/\[php](.+?)\[\/php\]/is", "**** 内容为PHP代码 *****", $thread['message'] );
  33.         $thread['message']  = preg_replace("/\[code](.+?)\[\/code\]/is", "**** 内容为普通代码 *****", $thread['message'] );
  34.         $thread['message']  = preg_replace("/\[quote](.+?)\[\/quote\]/is", "**** 内容为引用信息 *****", $thread['message'] );
  35.         $thread['message']  = preg_replace("/\[url=?(.+?)\](.+?)\[\/url\]/is", "**** 此处为超级链接 *****", $thread['message'] );
  36.         $thread['message']  = preg_replace("/\[img](.+?)\[\/img\]/is", "**** 此处为图片链接 *****", $thread['message'] );
  37.         $thread['message']  = preg_replace("/\[iframe](.+?)\[\/iframe\]/is", "**** 此处为引用页 *****", $thread['message'] );
  38.                 $thread['message']  =preg_replace("/\[\/?(.+?)]/is","",$thread['message'] );//去掉其他UBB代码 fix by jia
  39.         $thread['message'] = str_replace('"', ' &quot;', $thread['message']);
  40.         $thread['message'] = str_replace('<', '&lt;', $thread['message']);
  41.         $thread['message'] = str_replace('>', '&gt;', $thread['message']);
  42.         $thread['message'] = str_replace("\r\n", " ◇ ", $thread['message']);    //去掉回车,紧凑显示
  43.         $thread['message'] = cutstr($thread['message'],60);        //截断
  44.         }
  45.     if($thread[replies]) {
  46.         $thread['shortmsg'] = '<b>主题:'.$thread[subject].'</b><br><b>回复:</b>'.$thread[re_subject].'<br><font color=red>'.$thread[message].'</font>'.'<br><font class=numtxt>最后发表:'.$thread[lastposter].'<br>主题作者:'.$thread[author].'&nbsp; 发表时间:'.$thread[dateline].'</font>';
  47.     } else {
  48.         $thread['shortmsg'] = '<b>主题:'.$thread[subject].'</b><br><font color=red>'.$thread[message].'</font>'.'<br>主题作者:'.$thread[author].'&nbsp; 发表时间:'.$thread[dateline].'</font>';
  49.     }
  50.     //end  

  51.         if($thread['displayorder'] > 0) {
  52.                 $separatepos++;
  53.         }
  54.         $threadlist[] = $thread;

  55. }

  56. $check[$filter] = 'selected="selected"';
  57. $ascdesc == 'ASC' ? $check['asc'] = 'selected="selected"' : $check['desc'] = 'selected="selected"';

  58. $forumselect = $forumjump ? forumselect() : NULL;

  59. $usesigcheck = $signature ? 'checked' : NULL;
  60. $allowpost = (!$forum['postperm'] && $allowpost) || ($forum['postperm'] && strstr($forum['postperm'], "\t$groupid\t")) || $forum['allowpost'];

  61. include template('forumdisplay');

  62. ?>
复制代码
回复

使用道具 举报

 楼主| oytktk 发表于 2005-10-28 19:53:29 | 显示全部楼层
flegg.php文件~
回复

使用道具 举报

xilu168 发表于 2005-10-29 18:15:20 | 显示全部楼层

55555555装不了!!!!!!!

一导入插件,就出来个:::" 插件数据版本错误!请确认你使用的论坛版本!"
回复

使用道具 举报

jiayuan1 发表于 2005-10-31 17:47:30 | 显示全部楼层
原帖由 oytktk 于 2005-10-28 19:53 发表
flegg.php文件~

哦,我的意思是直接在注释的地方加个查询把
$thread['flower']和$thread['egg']的值覆盖掉

flegg.php(自己加了点改动):
  1. <?
  2. $fe = getconfig('flegg');
  3. $fes = $_DCACHE['plugins'][$p];
  4. $navtitle = $fes['plug_title'];

  5. if(!$discuz_user)showmessage("请先登录!","javascript:history.go(-1)");

  6. $query = $db->query("SELECT username, money FROM $table_members WHERE username='$discuz_user'");
  7. $fuser=$db->fetch_array($query);

  8. if($action && !$pid){
  9.         if(!$username)showmessage("参数不足, 无法进行!","javascript:history.go(-1)");
  10.         $query = $db->query("SELECT username, uid FROM $table_members WHERE username='$username'");
  11.         $tuser=$db->fetch_array($query);
  12.         $touser=$tuser['username'];
  13.         $touid=$tuser['uid'];
  14. }else{
  15.         $query = $db->query("SELECT author, authorid, tid FROM $table_posts WHERE pid='$pid'");
  16.         $fpost=$db->fetch_array($query);
  17.         $touser=$fpost['author'];
  18.         $touid=$fpost['authorid'];
  19.         $tid=$fpost['tid'];
  20. }

  21. $muchflower='';
  22. for($i=2;$i<=$fe['much'];$i++){
  23.         $muchflower.='<option value='.$i.'>&nbsp;&nbsp;'.$i.'&nbsp;&nbsp;</option>';
  24. }

  25. $mucheggs='';
  26. for($i=2;$i<=$fe['much'];$i++){
  27.         $mucheggs.='<option value='.$i.'>&nbsp;&nbsp;'.$i.'&nbsp;&nbsp;</option>';
  28. }

  29. if($action=='flower' && ($flowers*$fe['flower']) > $fuser['money'])showmessage("对不起, 您的现金已经买不起鲜花了!","javascript:history.go(-1)");
  30. if($action=='eggs' && ($eggss*$fe['eggs']) > $fuser['money'])showmessage("对不起, 您的现金已经买不起鸡蛋了!","javascript:history.go(-1)");

  31. $moneyadd=$fe['moneyadd']*$flowers;
  32. $moneydec=$fe['moneydec']*$eggss;
  33. $credadd=$fe['credadd']*$flowers;
  34. $creddec=$fe['creddec']*$eggss;
  35. $flowers=$flowers?$flowers:0;
  36. $eggss=$eggss?$eggss:0;

  37. $flowerss=$flowers*$fe['flower'];
  38. $eggsss=$eggss*$fe['eggs'];


  39. if($flowers>$fe['much'] || $eggss>$fe['much'])showmessage("超过指定的数量, 请不要耍花招!","javascript:history.go(-1)");

  40. $msg_1="

  41. 恭喜您, 社区会员 [b]".$discuz_user."[/b] 送了您 [color=red]".$flowers."[/color] 束鲜花!

  42. 贴子地址: [url=".$boardurl."viewthread.php?tid=".$tid."][b]单击打开贴子连接[/b][/url]

  43. 由此对您的影响是:

  44. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  45. &
  46. &&   [color=blue]论坛积分:[/color] [color=red][b] + ".$credadd."[/b][/color]
  47. &
  48. &&   [color=blue]论坛币:[/color] [color=red][b] + ".$moneyadd."[/b][/color]
  49. &
  50. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

  51. ";


  52. $msg_2="

  53. 恭喜您, 社区会员 [b]".$discuz_user."[/b] 送了你 [color=red]".$flowers."[/color] 束鲜花!

  54. 由此对您的影响是:

  55. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  56. &
  57. &&   [color=blue]论坛积分:[/color] [color=red][b] + ".$credadd."[/b][/color]
  58. &
  59. &&   [color=blue]论坛币:[/color] [color=red][b] + ".$moneyadd."[/b][/color]
  60. &
  61. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

  62. ";



  63. $msg_3="

  64. 请注意, 社区会员 [b]".$discuz_user."[/b] 向你扔了 [color=red]".$eggss."[/color] 个鸡蛋!

  65. 贴子地址: [url=".$boardurl."viewthread.php?tid=".$tid."][b]单击打开贴子连接[/b][/url]

  66. 由此对您的影响是:

  67. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  68. &
  69. &&   [color=blue]论坛积分:[/color] [color=red][b] - ".$creddec."[/b][/color]
  70. &
  71. &&   [color=blue]论坛币:[/color] [color=red][b] - ".$moneydec."[/b][/color]
  72. &
  73. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

  74. ";


  75. $msg_4="

  76. 请注意, 社区会员 [b]".$discuz_user."[/b] 向你扔了 [color=red]".$eggss."[/color] 个鸡蛋!

  77. 由此对您的影响是:

  78. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  79. &
  80. &&   [color=blue]论坛积分:[/color] [color=red][b] - ".$creddec."[/b][/color]
  81. &
  82. &&   [color=blue]论坛币:[/color] [color=red][b] - ".$moneydec."[/b][/color]
  83. &
  84. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

  85. ";

  86. $aswhat=dhtmlspecialchars($aswhat);

  87. if($start=='yes' && $action=='flower'){
  88.         $query = $db->query("SELECT * FROM $table_felog WHERE asfe='flower' and fromuser='$discuz_user' and touser='$touser' and tid='$tid'");
  89.         if(dhtmlspecialchars($aswhat)=='')showmessage("对不起, 您必须说明送鲜花的理由!","javascript:history.go(-1)");
  90.         if($asone=$db->fetch_array($query))showmessage("对不起, 请不要重复送鲜花!","javascript:history.go(-1)");
  91.         $msg=$msg_2;
  92.         if($discuz_user==$touser)showmessage("自己送自己鲜花?!~~没必要这样吧?!","javascript:history.go(-1)");
  93.         if($tid){
  94.         $msg=$msg_1;
  95.         $db->query("UPDATE $table_posts SET flower=flower+$flowers WHERE pid='$pid'");
  96.         $db->query("UPDATE $table_threads SET flower=flower+$flowers WHERE tid='$tid'");}
  97.         $db->query("UPDATE $table_members SET flowers=flowers+$flowers,money=money+$moneyadd,credit=credit+$credadd WHERE username='$touser'");
  98.         $db->query("UPDATE $table_members SET money=money-$flowerss WHERE username='$discuz_user'");              
  99.         $db->query("INSERT INTO $table_pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message) VALUES('$discuz_user', '$discuz_uid', '$touid', 'inbox', '1', '恭喜, 有人送鲜花给你啦!', '$timestamp', '$msg')");
  100.         $db->query("INSERT INTO $table_felog (fromuser, touser, asfe, score, tid, aswhat) VALUES ('$discuz_user', '$touser', 'flower', '$flowers', '$tid', '$aswhat')");
  101.         $db->query("UPDATE LOW_PRIORITY $table_members SET newpm='1' WHERE uid='$touid'", 'UNBUFFERED');
  102.         if($tid)showmessage("您已经成功的向 <b>".$touser."</b> 送了 <font color=red>".$flowers."</font> 束鲜花!","viewthread.php?tid=$tid");
  103.         showmessage("您已经成功的向 <b>".$touser."</b> 送了 <font color=red>".$flowers."</font> 束鲜花!","plugins.php?p=flegg");
  104. }elseif($start=='yes' && $action=='eggs'){
  105.         $query = $db->query("SELECT * FROM $table_felog WHERE asfe='eggs' and fromuser='$discuz_user' and touser='$touser' and tid='$tid'");
  106.         if(dhtmlspecialchars($aswhat)=='')showmessage("对不起, 您必须说明丢鸡蛋的理由!","javascript:history.go(-1)");
  107.         if($asone=$db->fetch_array($query))showmessage("对不起, 请不要重复扔鸡蛋!","javascript:history.go(-1)");
  108.         if($discuz_user==$touser)showmessage("自己扔自己鸡蛋?!~~您受了什么刺激了?!","javascript:history.go(-1)");
  109.         $msg=$msg_4;
  110.         if($tid){
  111.         $msg=$msg_3;
  112.         $db->query("UPDATE $table_posts SET egg=egg+$eggss WHERE pid='$pid'");
  113.         $db->query("UPDATE $table_threads SET egg=egg+$eggss WHERE tid='$tid'");}
  114.         $db->query("UPDATE $table_members SET eggs=eggs+$eggss,money=money-$moneydec,credit=credit-$creddec WHERE username='$touser'");
  115.         $db->query("UPDATE $table_members SET money=money-$eggsss WHERE username='$discuz_user'");              
  116.         $db->query("INSERT INTO $table_pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message) VALUES('$discuz_user', '$discuz_uid', '$touid', 'inbox', '1', '请注意, 有人向你扔鸡蛋啦!', '$timestamp', '$msg')");
  117.         $db->query("INSERT INTO $table_felog (fromuser, touser, asfe, score, tid, aswhat) VALUES ('$discuz_user', '$touser', 'eggs', '$eggss', '$tid', '$aswhat')");
  118.         $db->query("UPDATE LOW_PRIORITY $table_members SET newpm='1' WHERE uid='$touid'", 'UNBUFFERED');
  119.         if($tid)showmessage("您已经成功的向 <b>".$touser."</b> 扔了 <font color=red>".$eggss."</font> 个鸡蛋!","plugins.php?p=flegg");
  120. }else{
  121. //记录...排行...

  122. $query = $db->query("SELECT uid, username, flowers FROM $table_members WHERE flowers>0 ORDER BY flowers DESC LIMIT 10");
  123. $ii=0;
  124. while($flist=$db->fetch_array($query)){
  125.         for($i=0;$i<$flist['flowers'];$i++){
  126.                 if($i<10)$flpk[$flist['uid']].="<img border=0 src='images/common/flower.gif'>";
  127.         }
  128.         if($i>=10)$flpk[$flist['uid']].="......共 <font color=red>".$flist['flowers']."</font> 束鲜花!";
  129.         $ii++;
  130.         $floop[]=$flist;
  131. }
  132. if($ii==0)$emptyf="目前没有人得到鲜花!";


  133. $query = $db->query("SELECT uid, username, eggs FROM $table_members WHERE eggs>0 ORDER BY eggs DESC LIMIT 10");
  134. $ii=0;
  135. while($elist=$db->fetch_array($query)){
  136.         for($i=0;$i<$elist['eggs'];$i++){
  137.         if($i<10)$egpk[$elist['uid']].="<img border=0 src='images/common/eggs.gif'>";
  138.         }
  139.         if($i>=10)$egpk[$elist['uid']].="......共 <font color=red>".$elist['eggs']."</font> 个鸡蛋!";
  140.         $ii++;
  141.         $eloop[]=$elist;
  142. }
  143. if($ii==0)$emptye="目前没有人得到鸡蛋!";
  144. if($discuz_uid==1)$fe['felist']=1;//fix by jia($discuz_uid==1为可以查看鲜花鸡蛋记录的UID,要改为多人,自己改...)
  145. if($fe['felist']){


  146.         //页数处理
  147.                 $query = $db->query("SELECT COUNT(*) FROM $table_felog");
  148.                 $count = $db->result($query, 0);
  149.                 $pagenum = 30;
  150.                 $page = intval($page) ? intval($page) : 1;
  151.                 $start = ($page - 1) * $pagenum;
  152.                 $multipage = multi($count, $pagenum, $page, "plugins.php?p=flegg");
  153.         //-----------

  154. $liststart=$start+1;
  155. $listend=$liststart+$pagenum-1;



  156. $query = $db->query("SELECT fromuser, id, touser, asfe, score, tid, aswhat FROM $table_felog ORDER BY id DESC LIMIT $start , $pagenum");
  157. $ii=0;
  158. while($felist=$db->fetch_array($query)){
  159. $fepk[$felist['id']]='';
  160. for($i=0;$i<$felist['score'];$i++){
  161.         $fepk[$felist['id']].="<img border=0 src='images/common/".$felist['asfe'].".gif'>";
  162.         }
  163. $ii++;
  164. $felist['tid']=$felist['tid']?"<a href='viewthread.php?tid=".$felist['tid']."' title='点击打开送礼的贴子'>贴子位置</a>":'';
  165. $felist['what']=cutstr($felist['aswhat'],90);
  166. $feloop[]=$felist;
  167. }
  168. }

  169. $fekf=$ii!=0?"以下是送鲜花和扔鸡蛋的记录":"目前还没有任何鲜花和鸡蛋的记录!";

  170. }
  171. include template('flower');
  172. ?>
复制代码

[ 本帖最后由 jiayuan1 于 2005-10-31 17:48 编辑 ]
回复

使用道具 举报

kian87 发表于 2005-11-1 22:48:20 | 显示全部楼层
有个小小的问题~

被送花或扔蛋的贴子在这符号#2 旁边是有个“花的图像”

但我安装后,在这“花的图像”旁多了个“?”出来
请问是那里出错了?
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-2 14:46 , Processed in 0.129596 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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