table_forum_threadhot.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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: table_forum_threadhot.php 31913 2012-10-24 06:52:26Z zhengqingpeng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_forum_threadhot extends discuz_table {
  12. public function __construct() {
  13. $this->_table = 'forum_threadhot';
  14. $this->_pk = '';
  15. parent::__construct();
  16. }
  17. public function fetch_all_tid_by_cid($cid) {
  18. $tids = array();
  19. $cid = intval($cid);
  20. if($cid) {
  21. foreach(DB::fetch_all('SELECT * FROM %t WHERE cid=%d', array($this->_table, $cid)) as $value) {
  22. $tids[$value['tid']] = $value['tid'];
  23. }
  24. }
  25. return $tids;
  26. }
  27. public function insert_multiterm($dataarr) {
  28. $allkey = array('cid', 'fid', 'tid');
  29. $sql = array();
  30. foreach($dataarr as $key => $value) {
  31. if($value['cid'] && $value['fid'] && $value['tid']) {
  32. $cid = dintval($value['cid']);
  33. $fid = dintval($value['fid']);
  34. $tid = dintval($value['tid']);
  35. $sql[] = "($cid, $fid, $tid)";
  36. }
  37. }
  38. if($sql) {
  39. return DB::query('REPLACE INTO '.DB::table($this->_table)." (`cid`, `fid`, `tid`) VALUES ".implode(',', $sql), true);
  40. }
  41. return false;
  42. }
  43. }
  44. ?>