table_forum_activityapply.php
1.82 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
49
50
51
52
53
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_forum_activityapply.php 28709 2012-03-08 08:53:48Z liulanbo $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_forum_activityapply extends discuz_table
{
public function __construct() {
$this->_table = 'forum_activityapply';
$this->_pk = 'applyid';
parent::__construct();
}
public function fetch_info_for_user($uid, $tid) {
return DB::fetch_first("SELECT * FROM %t WHERE tid=%d AND uid=%d", array($this->_table, $tid, $uid));
}
public function delete_for_user($uid, $tid) {
DB::query("DELETE FROM %t WHERE tid=%d AND uid=%d", array($this->_table, $tid, $uid));
}
public function delete_by_tid($tids) {
return DB::delete($this->_table, DB::field('tid', $tids));
}
public function delete_for_thread($tid, $applyids = array()) {
if($applyids) {
$pksql = " AND ".DB::field('applyid', $applyids);
}
DB::query("DELETE FROM %t WHERE tid=%d $pksql", array($this->_table, $tid));
}
public function fetch_count_for_thread($tid) {
return DB::result_first("SELECT COUNT(*) FROM %t WHERE tid=%d AND verified='1'", array($this->_table, $tid));
}
public function fetch_all_for_thread($tid, $start = 0, $limit = 100, $uid = 0, $master = 0) {
$verifiedsql = empty($master) ? ' AND verified=1' : '';
if(intval($uid)) {
$verifiedsql .= ' AND uid='.intval($uid);
}
return DB::fetch_all("SELECT * FROM %t WHERE tid=%d $verifiedsql ORDER BY dateline DESC".DB::limit($start, $limit), array($this->_table, $tid));
}
public function update_verified_for_thread($verified, $tid, $applyid) {
DB::query("UPDATE %t SET verified=%d WHERE tid=%d AND applyid IN (%n)", array($this->_table, $verified, $tid, $applyid));
}
}
?>