table_forum_poststick.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_poststick.php 27806 2012-02-15 03:20:46Z svn_project_zhangjie $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_forum_poststick extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'forum_poststick';
  15. $this->_pk = '';
  16. parent::__construct();
  17. }
  18. public function fetch_all_by_tid($tid) {
  19. return DB::fetch_all('SELECT * FROM %t WHERE tid=%d ORDER BY dateline DESC', array($this->_table, $tid), 'pid');
  20. }
  21. public function count_by_pid($pid) {
  22. return DB::result_first('SELECT count(*) FROM %t WHERE pid=%d ', array($this->_table, $pid));
  23. }
  24. public function delete_by_pid($pids) {
  25. if(empty($pids)) {
  26. return false;
  27. }
  28. return DB::query('DELETE FROM %t WHERE '.DB::field('pid', $pids), array($this->_table));
  29. }
  30. public function delete_by_tid($tids) {
  31. if(empty($tids)) {
  32. return false;
  33. }
  34. return DB::query('DELETE FROM %t WHERE '.DB::field('tid', $tids), array($this->_table));
  35. }
  36. public function delete($tid, $pid) {
  37. return DB::query('DELETE FROM %t WHERE tid=%d AND pid=%d', array($this->_table, $tid, $pid));
  38. }
  39. public function count_by_tid($tid) {
  40. return DB::result_first('SELECT COUNT(*) FROM %t WHERE tid=%d', array($this->_table, $tid));
  41. }
  42. }
  43. ?>