<?php
# MetInfo Enterprise Content Management System
# Copyright (C) MetInfo Co.,Ltd (http://www.metinfo.cn). All rights reserved.
defined('IN_MET') or exit('No permission');
// 判断来源页面是否有pageset=1 ，如果有而本页url没有pageset=1，则本页加上pageset=1跳转
if(strpos($_SERVER['HTTP_REFERER'], 'pageset=1')!==false && !$_M['form']['pageset'] && !$_M['form']['nopageset'] && strpos($_SERVER['HTTP_REFERER'], 'nopageset=1')===false){
    echo '<script>
        var newurl=location.href;
        if(location.search!=""){
            newurl+="&pageset=1";
        }else{
            newurl+="?pageset=1";
        }
        location.href=newurl;
    </script>';
    die;
}
if($_M['word']['metinfo']){
    $met_title.='-'.$_M['word']['metinfo'];
}
$met_file_version=str_replace('.','',$_M['config']['metcms_v']).$_M['config']['met_patch'];
$is_lte_ie9=strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 9")!==false || strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 8")!==false;
if($is_lte_ie9){
    $basic_admin_css_filemtime_1 = filemtime(PATH_WEB.'public/ui/v2/static/css/basic_admin-lteie9-1.css');
    $basic_admin_css_filemtime_2 = filemtime(PATH_WEB.'public/ui/v2/static/css/basic_admin-lteie9-2.css');
}else{
    $basic_admin_css_filemtime = filemtime(PATH_WEB.'public/ui/v2/static/css/basic_admin.css');
}
?>
<!DOCTYPE HTML>
<html class="{$_M['html_class']}">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta name="robots" content="noindex,nofllow">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0,minimal-ui">
<meta name="format-detection" content="telephone=no">
<title>{$met_title}</title>
<meta name="generator" content="MetInfo {$_M['config']['metcms_v']}" data-variable="{$_M['url']['site']}|{$_M['lang']}|{$_M['config']['met_skin_user']}||||" data-m_type="{$_M['config']['m_type']}">
<link href="{$_M['url']['site']}favicon.ico" rel="shortcut icon" type="image/x-icon">
<?php
if($is_lte_ie9){
?>
<link href="{$url.site}public/ui/v2/static/css/basic_admin-lteie9-1.css?{$basic_admin_css_filemtime_1}" rel="stylesheet" type="text/css">
<link href="{$url.site}public/ui/v2/static/css/basic_admin-lteie9-2.css?{$basic_admin_css_filemtime_2}" rel="stylesheet" type="text/css">
<?php
}else{
?>
<link href="{$_M['url']['site']}public/ui/v2/static/css/basic_admin.css?{$basic_admin_css_filemtime}" rel='stylesheet' type='text/css'>
<?php
}
if(file_exists(PATH_OWN_FILE.'templates/css/metinfo.css')){
    $own_metinfo_css_filemtime = filemtime(PATH_OWN_FILE.'templates/css/metinfo.css');
?>
<link href="{$_M['url']['own_tem']}css/metinfo.css?{$own_metinfo_css_filemtime}" rel='stylesheet' type='text/css'>
<?php } ?>
<!--['if lte IE 9']>
<script src="{$_M['url']['site']}public/ui/v2/static/js/lteie9.js"></script>
<!['endif']-->
</head>
<!--['if lte IE 8']>
<div class="text-xs-center m-b-0 bg-blue-grey-100 alert">
    <button type="button" class="close" data-dismiss="alert">
        <span aria-hidden="true">×</span>
    </button>
    {$_M['word']['browserupdatetips']}
</div>
<!['endif']-->
<body class="{$_M['body_class']}">
<?php
if(!$head_no && !$_M['head_no']){
    $privilege = background_privilege();
    if(!$_M['form']['pageset']){
        $met_agents_metmsg=$_M['config']['met_agents_metmsg']?'':'hidden';
        $msecount = DB::counter($_M['table']['infoprompt'], "WHERE (lang='".$_M['lang']."' or lang='metinfo') and see_ok='0'", "*");
        $navigation=$privilege['navigation'];
        $arrlanguage=explode('|', $navigation);
        if(in_array('metinfo',$arrlanguage) || in_array('1002',$arrlanguage)){
            $langprivelage=1;
        }else{
            $langprivelage=0;
        }
        if($_M['form']['iframeurl']){
            function get($str){
                $data = array();
                $parameter = explode('&',end(explode('?',$str)));
                foreach($parameter as $val){
                    $tmp = explode('=',$val);
                    $data[$tmp['0']] = $tmp['1'];
                }
                return $data;
            }
            $str = $_M['form']['iframeurl'];
            $data = get($str);
            $_M['form']['anyid'] = $data['anyid'];
            $_M['form']['n'] = $data['n'];
        }
        $lang_name=$_M['langlist']['web'][$_M['lang']]['name'];
        $adminnav = get_adminnav();
        $adminapp = load::mod_class('myapp/class/getapp', 'new');
        $adminapplist = $adminapp->get_app();
        if($_M['form']['anyid'] == '44'){
            foreach ($adminapplist as $key => $val) {
                if ($val['m_name'] == $_M['form']['n']) {
                    $nav_3 = $val;
                    $nav_3 ['name'] = get_word($val['appname']);
                    break;
                }
            }
            if(!$nav_3) $nav_3 = $adminnav[$_M['form']['anyid']];
        } else {
            $nav_3 = $adminnav[$_M['form']['anyid']];
        }
        if(!$_M['form']['anyid']) $weizhi = '<li class="breadcrumb-item">'.$_M['word']['background_page'].'</li>';
        if($adminnav[$adminnav[$_M['form']['anyid']]['bigclass']]['name']){
            if($_M['form']['anyid'] == 44 && M_NAME!='myapp') $adminnav[$adminnav[$_M['form']['anyid']]['bigclass']]['name'] = '<a href="'.$adminnav['44']['url'].'">'.$adminnav['44']['name'].'</a>';
            $fenlei='<li class="breadcrumb-item">'.$adminnav[$adminnav[$_M['form']['anyid']]['bigclass']]['name'].'</li>';
        }
        $weizhi = '<li class="breadcrumb-item"><a href="'.$nav_3['url'].'">'.$nav_3['name'].'</a></li>';
?>
<header class="metadmin-haed navbar h-50">
    <div class="container-fluid h-100p">
        <div class="h-100p vertical-align pull-xs-left hidden-md-down">
            <div class="breadcrumb m-b-0 p-0 vertical-align-middle">
                <li class='breadcrumb-item'>{$lang_name}</li>
                {$fenlei}
                {$weizhi}
            </div>
        </div>
        <div class="metadmin-haed-right pull-xs-right h-100p vertical-align">
            <div class="vertical-align-middle">
                <?php
                if($_M['url']['help_tutorials_helpid'] && $_M['langset']=='cn'){
                    $_M['url']['help_tutorials_url'].=$_M['url']['help_tutorials_helpid'];
                ?>
                <div class="btn-group" hidden>
                    <a href='{$_M['url']['help_tutorials_url']}' target="_blank" class="btn btn-warning">
                        <i class="fa fa-question"></i>
                        <span class="hidden-sm-down">{$_M['word']['help1']}</span>
                    </a>
                </div>
                <?php
                }
                $power = admin_information();
                if($power['admin_group'] == '10000' || $power['admin_group'] == '3'){
                ?>
                <div class="btn-group" {$met_agents_metmsg}>
                    <button class="btn btn-default" data-toggle="modal" data-target="#functionEncy">
                        <i class="fa fa-pie-chart"></i>
                        <span class="hidden-sm-down">{$_M['word']['funcCollection']}</span>
                    </button>
                </div>
                <?php } ?>
                <div class="btn-group" {$met_agents_metmsg}>
                    <a href="https://www.metinfo.cn/bangzhu/index.php?ver=metcms" class="btn btn-default" target="_blank">
                        <i class="fa fa-life-ring"></i>
                        <span class="hidden-sm-down">{$_M['word']['indexbbs']}</span>
                    </a>
                </div>
                <div class="btn-group" {$met_agents_metmsg}>
                    <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
                        <i class="fa fa-bookmark"></i>
                        <span class="hidden-sm-down">{$_M['word']['indexcode']}</span>
                    </button>
                    <ul class="dropdown-menu animate animate-reverse dropdown-menu-right text-xs-center">
                        <?php
                        if($_M['config']['met_agents_type'] < 2) {
                        $auth = load::mod_class('system/class/auth', 'new');
                        $otherinfoauth = $auth->have_auth();
                            if(!$otherinfoauth) {
                        ?>
                        <li class="dropdown-item">
                            <a href="https://www.metinfo.cn/web/product.htm" target="_blank" class='block'>{$_M['word']['sys_authorization2']}</a>
                        </li>
                        <li class="dropdown-item">
                            <a class="btn btn-primary" href='{$_M['url']['adminurl']}&n=system&c=authcode&a=doindex'>{$_M['word']['sys_authorization1']}</a>
                        </li>
                        <?php }else{ ?>
                        <li class="dropdown-item">
                            <button class="btn btn-info" type="submit">{$otherinfoauth['info1']}</button>
                        </li>
                        <li class="dropdown-item">
                            <a class="nobo block" href="{$_M['url']['adminurl']}&n=system&c=authcode&a=doindex">{$_M['word']['entry_authorization']}</a>
                        </li>
                        <?php
                            }
                        }
                        ?>
                    </ul>
                </div>
                <div class="btn-group">
                    <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
                        <i class="fa fa-globe"></i>
                        <span class="hidden-sm-down">{$lang_name}</span>
                    </button>
                    <ul class="dropdown-menu animate animate-reverse dropdown-menu-right">
                        <?php
                        foreach($_M['user']['langok'] as $key=>$val){
                        	$url_now ='http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
                        	if(!strstr($url_now, "lang=")) {
                        	    $val['url'] = $_M['url']['site_admin']."index.php?lang=".$val['mark'];
                        	} else {
                        	    $val['url'] = str_replace(array("lang=".$_M['lang'], "lang%3D".$_M['lang']), array("lang=".$val['mark'], "lang%3D".$val['mark']), $url_now);
                        	}
                        	if(strstr($_M['config']['met_weburl'],'https')){
                        	    $val['url']=str_replace('http','https',$val['url']);
                        	}
                        ?>
                        <li class="dropdown-item"><a href="{$val['url']}&switch=1" class='block'>{$val['name']}</a></li>
                        <?php } ?>
                        <li class="dropdown-item">
                            <a href='{$url.adminurl}anyid=10&n=language&c=language_admin&a=dolangadd' class="btn btn-success"><i class="fa fa-plus"></i>{$_M['word']['added']}{$_M['word']['langweb']}</a>
                        </li>
                    </ul>
                </div>
                <?php if(!$_M['config']['met_agents_switch']){ ?>
                <div class="btn-group">
                    <a class="btn btn-default" href='{$_M['url']['adminurl']}n=system&c=news&a=doindex'>
                        <i class="fa fa-bell-o"></i>
                        <span class="tag tag-pill up tag-danger bg-red-600">{$msecount}</span>
                    </a>
                </div>
                <?php } ?>
                <div class="btn-group">
                    <button class="btn btn-default dropdown-toggle" type="button" id="adminuser" data-toggle="dropdown">
                        {$_M['user']['admin_name']}
                    </button>
                    <ul class="dropdown-menu animate animate-reverse dropdown-menu-right">
                        <li class="dropdown-item"><a href="{$_M['url']['adminurl']}n=admin&c=admin_admin&a=doeditor_info">{$_M['word']['modify_information']}</a></li>
                        <li class="dropdown-item"><a target="_top" href="{$_M['url']['adminurl']}n=login&c=login&a=dologinout">{$_M['word']['indexloginout']}</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</header>
<div class="modal fade" id="functionEncy">
    <div class="modal-dialog modal-lg modal-primary">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">{$_M['word']['funcCollection']}</h4>
            </div>
            <div class="modal-body">
				<include file='sys_admin/function_ency'/>
			</div>
        	<div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">{$_M['word']['close']}</button>
            </div>
    	</div>
	</div>
</div>
<?php }else if(M_ACTION=='dofunction_ency'){ ?>
<include file='sys_admin/function_ency'/>
<?php
    }
    if($_M['form']['pageset'] && $_M['url']['help_tutorials_helpid'] && $_M['langset']=='cn'){
        $_M['url']['help_tutorials_url'].=$_M['url']['help_tutorials_helpid'];
?>
<a href='{$_M['url']['help_tutorials_url']}' target="_blank" class="btn btn-icon btn-warning btn-squared btn-xs met-help-tutorials" hidden>
    <i class="fa fa-question"></i>
    <span class="hidden-sm-down">{$_M['word']['help1']}</span>
</a>
<?php
    }
    if(M_ACTION!='dofunction_ency'){
?>
<div class="metadmin-main container-fluid m-y-10">
    <?php
        $navlist = nav::get_nav();
        if($navlist){
    ?>
    <ul class="stat-list nav nav-tabs m-b-10 border-none">
        <?php
            foreach($navlist as $key => $val){
                $val['classnow']=$val['classnow']?'active':'';
        ?>
        <li class="nav-item"><a class='nav-link {$val['classnow']}' title="{$val['title']}" href="{$val['url']}" target="{$val['target']}">{$val['title']}</a></li>
        <?php } ?>
    </ul>
<?php
        }
    }
}
?>