cache_founder.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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: cache_founder.php 25782 2011-11-22 05:29:19Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. function build_cache_founder() {
  12. global $_G;
  13. $allowadmincp = $status0 = $status1 = array();
  14. $founders = explode(',', str_replace(' ', '', $_G['config']['admincp']['founder']));
  15. if($founders) {
  16. foreach($founders as $founder) {
  17. if(is_numeric($founder)) {
  18. $fuid[] = $founder;
  19. } else {
  20. $fuser[] = $founder;
  21. }
  22. }
  23. if($fuid) {
  24. $allowadmincp = C::t('common_member')->fetch_all($fuid, false, 0);
  25. }
  26. if($fuser) {
  27. $allowadmincp = $allowadmincp + C::t('common_member')->fetch_all_by_username($fuser);
  28. }
  29. }
  30. $allowadmincp = $allowadmincp + C::t('common_admincp_member')->range();
  31. $allallowadmincp = C::t('common_member')->fetch_all_by_allowadmincp('0', '>') + C::t('common_member')->fetch_all(array_keys($allowadmincp), false, 0);
  32. foreach($allallowadmincp as $uid => $user) {
  33. if(isset($allowadmincp[$uid]) && !getstatus($user['allowadmincp'], 1)) {
  34. $status1[$uid] = $uid;
  35. } elseif(!isset($allowadmincp[$uid]) && getstatus($user['allowadmincp'], 1)) {
  36. $status0[$uid] = $uid;
  37. }
  38. }
  39. if(!empty($status0)) {
  40. C::t('common_member')->clean_admincp_manage($status0);
  41. }
  42. if(!empty($status1)) {
  43. C::t('common_member')->update_admincp_manage($status1);
  44. }
  45. }
  46. ?>