table_forum_warning.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_warning.php 27800 2012-02-15 02:13:57Z svn_project_zhangjie $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_forum_warning extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'forum_warning';
  15. $this->_pk = 'wid';
  16. parent::__construct();
  17. }
  18. public function count_by_author($authors = null) {
  19. return DB::result_first('SELECT COUNT(*) FROM %t '.($authors ? 'WHERE '.DB::field('author', $authors) : ''), array($this->_table));
  20. }
  21. public function count_by_authorid_dateline($authorid, $dateline = null) {
  22. return DB::result_first('SELECT COUNT(*) FROM %t WHERE authorid=%d '.($dateline ? ' AND '.DB::field('dateline', dintval($dateline), '>=') : ''), array($this->_table, $authorid));
  23. }
  24. public function fetch_all_by_author($authors, $start, $limit) {
  25. return DB::fetch_all('SELECT * FROM %t '.($authors ? 'WHERE '.DB::field('author', $authors) : '').' ORDER BY wid DESC '.DB::limit($start, $limit), array($this->_table));
  26. }
  27. public function fetch_all_by_authorid($authorid) {
  28. return DB::fetch_all('SELECT * FROM %t WHERE authorid=%d', array($this->_table, $authorid));
  29. }
  30. public function delete_by_pid($pids) {
  31. if(empty($pids)) {
  32. return false;
  33. }
  34. return DB::query('DELETE FROM %t WHERE '.DB::field('pid', $pids), array($this->_table), false, true);
  35. }
  36. }
  37. ?>