table_forum_threadhidelog.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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_threadhidelog.php 33824 2013-08-19 08:26:11Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_forum_threadhidelog extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'forum_threadhidelog';
  15. $this->_pk = '';
  16. parent::__construct();
  17. }
  18. public function insert($tid, $uid) {
  19. if(!DB::fetch_first('SELECT * FROM %t WHERE tid=%d AND uid=%d', array($this->_table, $tid, $uid))) {
  20. DB::insert($this->_table, array('tid' => $tid, 'uid' => $uid));
  21. DB::query("UPDATE %t SET hidden=hidden+1 WHERE tid=%d", array('forum_thread', $tid));
  22. }
  23. }
  24. public function resetshow($tid) {
  25. $this->delete_by_tid($tid);
  26. DB::update('forum_thread', array('hidden' => 0), DB::field('tid', $tid));
  27. }
  28. public function delete_by_uid($uid) {
  29. return $uid ? DB::delete($this->_table, DB::field('uid', $uid)) : false;
  30. }
  31. public function delete_by_tid($tid) {
  32. DB::query("UPDATE %t SET hidden=0 WHERE tid IN (%n)", array('forum_thread', $tid));
  33. return $tid ? DB::delete($this->_table, DB::field('tid', $tid)) : false;
  34. }
  35. }
  36. ?>