_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; } } ?>