https://gitee.com/Discuz/DiscuzX/pulls/1826
打开
source/function/function_portal.php
找到
- function category_remake($catid) {
- global $_G;
- $cat = $_G['cache']['portalcategory'][$catid];
- if(empty($cat)) return array();
- foreach ($_G['cache']['portalcategory'] as $value) {
- if($value['catid'] == $cat['upid']) {
- $cat['ups'][$value['catid']] = $value;
- $upid = $value['catid'];
- while(!empty($upid)) {
- if(!empty($_G['cache']['portalcategory'][$upid]['upid'])) {
- $upid = $_G['cache']['portalcategory'][$upid]['upid'];
- $cat['ups'][$upid] = $_G['cache']['portalcategory'][$upid];
- } else {
- $upid = 0;
- }
- }
- } elseif($value['upid'] == $cat['catid']) {
- $cat['subs'][$value['catid']] = $value;
- } elseif($value['upid'] == $cat['upid']) {
- $cat['others'][$value['catid']] = $value;
- }
- }
- if(!empty($cat['ups'])) $cat['ups'] = array_reverse($cat['ups'], TRUE);
- return $cat;
- }
复制代码替换为
- function category_remake($catid) {
- global $_G;
- $cat = $_G['cache']['portalcategory'][$catid];
- if(empty($cat)) return array();
- require_once libfile('function/portalcp');
- $categoryperm = getallowcategory($_G['uid']);
- foreach ($_G['cache']['portalcategory'] as $value) {
- if($value['catid'] == $cat['upid']) {
- $cat['ups'][$value['catid']] = $value;
- $upid = $value['catid'];
- while(!empty($upid)) {
- if(!empty($_G['cache']['portalcategory'][$upid]['upid'])) {
- $upid = $_G['cache']['portalcategory'][$upid]['upid'];
- $cat['ups'][$upid] = $_G['cache']['portalcategory'][$upid];
- } else {
- $upid = 0;
- }
- }
- } elseif($value['upid'] == $cat['catid']) {
- $cat['subs'][$value['catid']] = $value;
- } elseif($value['upid'] == $cat['upid']) {
- if (!$value['closed'] || $_G['group']['allowdiy'] || $categoryperm[$value['catid']]['allowmanage']) {
- $cat['others'][$value['catid']] = $value;
- }
- }
- }
- if(!empty($cat['ups'])) $cat['ups'] = array_reverse($cat['ups'], TRUE);
- return $cat;
- }
复制代码 修改后,没权限的用户,不会显示未启用的分类