<?php 
# ./plugin.php?main.html

defined('IN_SYSTEM') === false && exit('PHPnew Blog.');

$plu_link = array();
$plu_link['意见/bug'] = './plugin.php?main=gidea.html';
$plu_link['网站地图'] = './plugin.php?main=maps.html';
$plu_link['法律条款'] = './plugin.php?main=statute.html';
$plu_link['关于我们'] = './plugin.php?main=about.html';

switch($default_parem[2]){
    case 'about':
        $html['title'] = '关于我们';
        common_function_template('main_about');
        break;
    case 'statute':
        $html['title'] = '法律条款';
        common_function_template('main_statute');
        break;
    case 'maps':
        $title = $html['title'];
        $html['title'] = '网站地图';
        common_function_template('main_maps');
        break;
    case 'gidea':
        $main_gidea = fun_source('main_gidea');
        # 删除过程
        if(isset($default_get['delete']) && USER_ADMIN){
            unset($main_gidea[$default_get['delete']]); 
            fun_source('main_gidea',$main_gidea);
            fun_header();
        }
        
        if(IS_POST){
            if(!USER_UID){
                fun_message('使用此功能需要登录用户账号','./index.php?user=login.html');
            }
            $default_post['types'] += 0;
            $default_post['tmess'] = nl2br(fun_enhtml(fun_stripslashes($default_post['tmess'])));
            $default_post['username'] = USER_NAME;
            $default_post['time'] = GET_TIME;
            if(isset($default_post['update']) === true && USER_ADMIN){
                $main_gidea[$default_post['update']]['remess'] = $default_post['tmess'] . '<br />'.USER_NAME. "__".fun_date(GET_TIME);
            }else{
               array_unshift($main_gidea,$default_post); 
            }
            fun_source('main_gidea',$main_gidea);
            fun_message('意见/bug 报告完成, 请等待技术员处理....');
        }
        
        $types = array();
        $types[1] = '通用bug';
        $types[2] = '严重bug';
        $types[3] = '优化建议';
        $types[4] = '前端bug';
        $types[5] = '纯意见';
        $types[6] = '更新记录';
        $types[7] = '修复记录';
        
        foreach($main_gidea AS $key => $val){
            $main_gidea[$key]['time'] = fun_date($val['time']);
            $main_gidea[$key]['types'] = $types[$val['types']];
        }
        
        
        $html['title'] = '意见与BUG维护中心';
        common_function_template('main_gidea');
        break;
}