table_forum_promotion.php 852 B

123456789101112131415161718192021222324252627282930313233343536373839
  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_promotion.php 27863 2012-02-16 02:53:12Z zhengqingpeng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_forum_promotion extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'forum_promotion';
  15. $this->_pk = 'ip';
  16. parent::__construct();
  17. }
  18. public function count_by_uid($uid) {
  19. $uid = dintval($uid, is_array($uid) ? true : false);
  20. if(!empty($uid)) {
  21. $parameter = array($this->_table, $uid);
  22. $where = is_array($uid) ? 'uid IN(%n)' : 'uid=%d';
  23. return DB::result_first("SELECT COUNT(*) FROM %t WHERE $where", $parameter);
  24. }
  25. return 0;
  26. }
  27. public function delete_all() {
  28. return DB::query("DELETE FROM %t", array($this->_table));
  29. }
  30. }
  31. ?>