table_common_admincp_perm.php 1015 B

12345678910111213141516171819202122232425262728293031323334353637
  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_common_admincp_perm.php 27773 2012-02-14 06:49:55Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_common_admincp_perm extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'common_admincp_perm';
  15. $this->_pk = '';
  16. parent::__construct();
  17. }
  18. public function fetch_all_by_cpgroupid($cpgroupid) {
  19. return $cpgroupid ? DB::fetch_all('SELECT * FROM %t WHERE cpgroupid=%d', array($this->_table, $cpgroupid)) : array();
  20. }
  21. public function delete_by_cpgroupid_perm($cpgroupid, $perm = null) {
  22. return $cpgroupid ? DB::delete($this->_table, DB::field('cpgroupid', $cpgroupid).($perm ? ' AND '.DB::field('perm', $perm) : '')) : false;
  23. }
  24. public function fetch_all_by_perm($perm) {
  25. return $perm ? DB::fetch_all('SELECT * FROM %t WHERE `perm`=%s', array($this->_table, $perm), 'cpgroupid') : array();
  26. }
  27. }
  28. ?>