table_forum_warning.php
1.49 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
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_forum_warning.php 27800 2012-02-15 02:13:57Z svn_project_zhangjie $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_forum_warning extends discuz_table
{
public function __construct() {
$this->_table = 'forum_warning';
$this->_pk = 'wid';
parent::__construct();
}
public function count_by_author($authors = null) {
return DB::result_first('SELECT COUNT(*) FROM %t '.($authors ? 'WHERE '.DB::field('author', $authors) : ''), array($this->_table));
}
public function count_by_authorid_dateline($authorid, $dateline = null) {
return DB::result_first('SELECT COUNT(*) FROM %t WHERE authorid=%d '.($dateline ? ' AND '.DB::field('dateline', dintval($dateline), '>=') : ''), array($this->_table, $authorid));
}
public function fetch_all_by_author($authors, $start, $limit) {
return DB::fetch_all('SELECT * FROM %t '.($authors ? 'WHERE '.DB::field('author', $authors) : '').' ORDER BY wid DESC '.DB::limit($start, $limit), array($this->_table));
}
public function fetch_all_by_authorid($authorid) {
return DB::fetch_all('SELECT * FROM %t WHERE authorid=%d', array($this->_table, $authorid));
}
public function delete_by_pid($pids) {
if(empty($pids)) {
return false;
}
return DB::query('DELETE FROM %t WHERE '.DB::field('pid', $pids), array($this->_table), false, true);
}
}
?>