table_forum_threadhidelog.php
1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_forum_threadhidelog.php 33824 2013-08-19 08:26:11Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_forum_threadhidelog extends discuz_table
{
public function __construct() {
$this->_table = 'forum_threadhidelog';
$this->_pk = '';
parent::__construct();
}
public function insert($tid, $uid) {
if(!DB::fetch_first('SELECT * FROM %t WHERE tid=%d AND uid=%d', array($this->_table, $tid, $uid))) {
DB::insert($this->_table, array('tid' => $tid, 'uid' => $uid));
DB::query("UPDATE %t SET hidden=hidden+1 WHERE tid=%d", array('forum_thread', $tid));
}
}
public function resetshow($tid) {
$this->delete_by_tid($tid);
DB::update('forum_thread', array('hidden' => 0), DB::field('tid', $tid));
}
public function delete_by_uid($uid) {
return $uid ? DB::delete($this->_table, DB::field('uid', $uid)) : false;
}
public function delete_by_tid($tid) {
DB::query("UPDATE %t SET hidden=0 WHERE tid IN (%n)", array('forum_thread', $tid));
return $tid ? DB::delete($this->_table, DB::field('tid', $tid)) : false;
}
}
?>