digg_frame.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. *
  4. * 文档digg处理iframe文件
  5. *
  6. * @version $Id: digg_frame.php 1 21:17 2010年7月8日Z tianya $
  7. * @package DedeCMS.Plus
  8. * @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
  9. * @license http://help.dedecms.com/usersguide/license.html
  10. * @link http://www.dedecms.com
  11. */
  12. require_once(dirname(__FILE__)."/../include/common.inc.php");
  13. $action = isset($action) ? trim($action) : '';
  14. $id = empty($id)? 0 : intval(preg_replace("/[^\d]/",'', $id));
  15. $maintable = '#@__archives';
  16. if($action == 'good')
  17. {
  18. $dsql->ExecuteNoneQuery("UPDATE `$maintable` SET scores = scores + {$cfg_caicai_add},goodpost=goodpost+1,lastpost=".time()." WHERE id='$id'");
  19. }
  20. else if($action=='bad')
  21. {
  22. $dsql->ExecuteNoneQuery("UPDATE `$maintable` SET scores = scores - {$cfg_caicai_sub},badpost=badpost+1,lastpost=".time()." WHERE id='$id'");
  23. }
  24. $digg = '';
  25. $row = $dsql->GetOne("SELECT goodpost,badpost,scores FROM `$maintable` WHERE id='$id' ");
  26. if($row['goodpost']+$row['badpost'] == 0)
  27. {
  28. $row['goodper'] = $row['badper'] = 0;
  29. }
  30. else
  31. {
  32. $row['goodper'] = number_format($row['goodpost']/($row['goodpost']+$row['badpost']),3)*100;
  33. $row['badper'] = 100-$row['goodper'];
  34. }
  35. $digg = '<div class="diggbox digg_good" onmousemove="this.style.backgroundPosition=\'left bottom\';" onmouseout="this.style.backgroundPosition=\'left top\';" onclick="postDigg(\'good\','.$id.')">
  36. <div class="digg_act">顶一下</div>
  37. <div class="digg_num">('.$row['goodpost'].')</div>
  38. <div class="digg_percent">
  39. <div class="digg_percent_bar"><span style="width:'.$row['goodper'].'%"></span></div>
  40. <div class="digg_percent_num">'.$row['goodper'].'%</div>
  41. </div>
  42. </div>
  43. <div class="diggbox digg_bad" onmousemove="this.style.backgroundPosition=\'right bottom\';" onmouseout="this.style.backgroundPosition=\'right top\';" onclick="postDigg(\'bad\','.$id.')">
  44. <div class="digg_act">踩一下</div>
  45. <div class="digg_num">('.$row['badpost'].')</div>
  46. <div class="digg_percent">
  47. <div class="digg_percent_bar"><span style="width:'.$row['badper'].'%"></span></div>
  48. <div class="digg_percent_num">'.$row['badper'].'%</div>
  49. </div>
  50. </div>';
  51. include DEDEROOT.'/templets/plus/digg_frame.htm';