table_forum_groupfield.php 1.1 KB

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_groupfield.php 27763 2012-02-14 03:42:56Z liulanbo $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_forum_groupfield extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'forum_groupfield';
  15. $this->_pk = 'fid';
  16. parent::__construct();
  17. }
  18. public function truncate() {
  19. DB::query("TRUNCATE ".DB::table('forum_groupfield'));
  20. }
  21. public function delete_by_type($types, $fid = 0) {
  22. if(empty($types)) {
  23. return false;
  24. }
  25. $addfid = $fid ? " AND fid='".intval($fid)."'" : '';
  26. DB::query("DELETE FROM ".DB::table('forum_groupfield')." WHERE ".DB::field('type', $types).$addfid);
  27. }
  28. public function fetch_all_group_cache($fid, $types = array(), $privacy = 0) {
  29. $typeadd = $types && is_array($types) ? "AND ".DB::field('type', $types) : '';
  30. return DB::fetch_all("SELECT fid, dateline, type, data FROM ".DB::table('forum_groupfield')." WHERE fid=%d AND privacy=%d $typeadd", array($fid, $privacy));
  31. }
  32. }
  33. ?>