Discuz getcurrentnav 函数 获得当前应用页面选中的导航id
/*** 获得当前应用页面选中的导航id
*/
function getcurrentnav() {
global $_G;
if(!empty($_G['mnid'])) {
return $_G['mnid'];
}
$mnid = '';
$_G['basefilename'] = $_G['basefilename'] == $_G['basescript'] ? $_G['basefilename'] : $_G['basescript'].'.php';
if(isset($_G['setting']['navmns'][$_G['basefilename']])) {
if($_G['basefilename'] == 'home.php' && $_GET['mod'] == 'space' && (empty($_GET['do']) || in_array($_GET['do'], array('follow', 'view')))) {
$_GET['mod'] = 'follow';
}
foreach($_G['setting']['navmns'][$_G['basefilename']] as $navmn) {
if($navmn == array_intersect_assoc($navmn, $_GET) || ($navmn['mod'] == 'space' && $_GET['mod'] == 'spacecp' && ($navmn['do'] == $_GET['ac'] || $navmn['do'] == 'album' && $_GET['ac'] == 'upload'))) {
$mnid = $navmn;
}
}
}
if(!$mnid && isset($_G['setting']['navdms'])) {
foreach($_G['setting']['navdms'] as $navdm => $navid) {
if(strpos(strtolower($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']), $navdm) !== false && strpos(strtolower($_SERVER['HTTP_HOST']), $navdm) === false) {
$mnid = $navid;
break;
}
}
}
if(!$mnid && isset($_G['setting']['navmn'][$_G['basefilename']])) {
$mnid = $_G['setting']['navmn'][$_G['basefilename']];
}
return $mnid;
}
页:
[1]