magic_hot.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: magic_hot.php 26749 2011-12-22 07:38:37Z chenmengshu $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class magic_hot {
  12. var $version = '1.0';
  13. var $name = 'hot_name';
  14. var $description = 'hot_desc';
  15. var $price = '20';
  16. var $weight = '20';
  17. var $useevent = 0;
  18. var $targetgroupperm = false;
  19. var $copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>';
  20. var $magic = array();
  21. var $parameters = array();
  22. function getsetting(&$magic) {}
  23. function setsetting(&$magicnew, &$parameters) {}
  24. function usesubmit() {
  25. global $_G;
  26. $id = intval($_GET['id']);
  27. $idtype = $_GET['idtype'];
  28. $blog = magic_check_idtype($id, $idtype);
  29. if(C::t('common_magiclog')->count_by_action_uid_targetid_idtype_magicid(2, $_G['uid'], $id, $idtype, $this->magic['magicid'])) {
  30. showmessage('magicuse_object_once_limit');
  31. }
  32. $num = !empty($_G['setting']['feedhotmin']) ? intval($_G['setting']['feedhotmin']) : 3;
  33. C::t('home_feed')->update_hot_by_id($id, $idtype, $_G['uid'], $num);
  34. C::t('home_blog')->increase($id, $_G['uid'], array('hot' => $num));
  35. usemagic($this->magic['magicid'], $this->magic['num']);
  36. updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
  37. showmessage('magics_use_success', '', array('magicname'=>$_G['setting']['magics']['hot']), array('alert' => 'right', 'showdialog' => 1));
  38. }
  39. function show() {
  40. global $_G;
  41. $id = intval($_GET['id']);
  42. $idtype = $_GET['idtype'];
  43. $blog = magic_check_idtype($id, $idtype);
  44. if(C::t('common_magiclog')->count_by_action_uid_targetid_idtype_magicid(2, $_G['uid'], $id, $idtype, $this->magic['magicid'])) {
  45. showmessage('magicuse_object_once_limit');
  46. }
  47. $num = !empty($_G['setting']['feedhotmin']) ? intval($_G['setting']['feedhotmin']) : 3;
  48. magicshowtips(lang('magic/hot', 'hot_info', array('num'=>$num)));
  49. echo <<<HTML
  50. <p>
  51. <input type="hidden" name="id" value="'.$id.'" />
  52. <input type="hidden" name="idtype" value="'.$idtype.'" />
  53. </p>
  54. HTML;
  55. }
  56. }
  57. ?>