function build_cache_usergroups() { global $_G; $data = array(); $query = DB::query("SELECT u.groupid, u.type, u.grouptitle, u.creditshigher, u.creditslower, u.stars, u.color, u.icon, uf.readaccess, uf.allowgetattach FROM " . DB::table('common_usergroup') . " u\r\n\t\tLEFT JOIN " . DB::table('common_usergroup_field') . " uf ON u.groupid=uf.groupid ORDER BY u.creditslower"); while ($group = DB::fetch($query)) { $groupid = $group['groupid']; $group['grouptitle'] = $group['color'] ? '<font color="' . $group['color'] . '">' . $group['grouptitle'] . '</font>' : $group['grouptitle']; if ($_G['setting']['userstatusby'] == 1) { $group['userstatusby'] = 1; } elseif ($_G['setting']['userstatusby'] == 2) { if ($group['type'] != 'member') { $group['userstatusby'] = 1; } else { $group['userstatusby'] = 2; } } if ($group['type'] != 'member') { unset($group['creditshigher'], $group['creditslower']); } unset($group['groupid']); $data[$groupid] = $group; } save_syscache('usergroups', $data); build_cache_usergroups_single(); $query = DB::query("SELECT * FROM " . DB::table('common_admingroup')); while ($data = DB::fetch($query)) { save_syscache('admingroup_' . $data['admingid'], $data); } }
function build_cache_usergroups() { global $_G; $data_uf = C::t('usergroup_field')->fetch_all(); foreach (C::t('usergroup')->range_orderby_creditshigher() as $key => $value) { $group = array_merge(array('groupid' => $value['groupid'], 'type' => $value['type'], 'grouptitle' => $value['grouptitle'], 'creditshigher' => $value['creditshigher'], 'creditslower' => $value['creditslower'], 'stars' => $value['stars'], 'color' => $value['color'], 'icon' => $value['icon'], 'system' => $value['system']), $data_uf[$key]); $groupid = $group['groupid']; $group['grouptitle'] = $group['color'] ? '<font color="' . $group['color'] . '">' . $group['grouptitle'] . '</font>' : $group['grouptitle']; unset($group['creditshigher'], $group['creditslower']); unset($group['groupid']); $data[$groupid] = $group; } savecache('usergroups', $data); build_cache_usergroups_single(); }
function build_cache_usergroups() { global $_G; $data_uf = C::t('common_usergroup_field')->fetch_all_fields(null, array('groupid', 'readaccess', 'allowgetattach', 'allowgetimage', 'allowmediacode', 'maxsigsize', 'allowbegincode')); foreach (C::t('common_usergroup')->range_orderby_creditshigher() as $key => $value) { $group = array_merge(array('groupid' => $value['groupid'], 'type' => $value['type'], 'grouptitle' => $value['grouptitle'], 'creditshigher' => $value['creditshigher'], 'creditslower' => $value['creditslower'], 'stars' => $value['stars'], 'color' => $value['color'], 'icon' => $value['icon'], 'system' => $value['system']), $data_uf[$key]); if ($group['type'] == 'special') { if ($group['system'] != 'private') { list($dailyprice) = explode("\t", $group['system']); $group['pubtype'] = $dailyprice > 0 ? 'buy' : 'free'; } } unset($group['system']); $groupid = $group['groupid']; $group['grouptitle'] = $group['color'] ? '<font color="' . $group['color'] . '">' . $group['grouptitle'] . '</font>' : $group['grouptitle']; if ($_G['setting']['userstatusby'] == 1) { $group['userstatusby'] = 1; } elseif ($_G['setting']['userstatusby'] == 2) { if ($group['type'] != 'member') { $group['userstatusby'] = 1; } else { $group['userstatusby'] = 2; } } if ($group['type'] != 'member') { unset($group['creditshigher'], $group['creditslower']); } unset($group['groupid']); $data[$groupid] = $group; } savecache('usergroups', $data); build_cache_usergroups_single(); foreach (C::t('common_admingroup')->range() as $data) { savecache('admingroup_' . $data['admingid'], $data); } }