<?php
/**
 * 糾錯管理
 *
 * @version        $Id: erraddsave.php 1 19:09 2010年7月12日Z tianya $
 * @package        DedeCMS.Administrator
 * @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license        http://help.dedecms.com/usersguide/license.html
 * @link           http://www.dedecms.com
 */
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/datalistcp.class.php');
require_once(DEDEINC.'/common.func.php');

if(empty($dopost)) $dopost ='';
if(empty($fmdo)) $fmdo = '';

function username($mid)
{
    global $dsql;
    if(!isset($mid) || empty($mid))
    {
        return "遊客";
        exit();
    }
    else
    {
        $sql = "SELECT uname FROM `#@__member` WHERE `mid` = '$mid'";
        $row = $dsql->GetOne($sql);
        return $row['uname'];
        exit();
    }
    exit();
}

function typename($me)
{
    switch ($me)
    {
        case $me == 1:
            return $me = "錯別字";
            break;
        case $me == 2:
            return $me = "成語運用不當";
            break;
        case $me == 3:
            return $me = "專業術語寫法不規則";
            break;
        case $me == 4:
            return $me = "產品與圖片不符";
            break;
        case $me == 5:
            return $me = "事實年代以及內容錯誤";
            break;
        case $me == 6:
            return $me = "事實年代以及內容錯誤";
            break;
        case $me == 7:
            return $me = "其他錯誤";
            break;
        default:
            return $me = "未知錯誤";
            break;
    }
}

if($dopost == "delete")
{
    if($id=='')
    {
        ShowMsg("參數無效！","-1");
        exit();
    }
    
    
    if($fmdo=='yes')
    {
        $id = explode("`", $id);
        foreach ($id as $var)
        {
            $query = "DELETE FROM `#@__erradd` WHERE `id` = '$var'";
            $dsql->ExecuteNoneQuery($query);
        }
        ShowMsg("成功刪除指定的文檔！","erraddsave.php");
        exit();
    }  
    else
    {
        require_once(DEDEINC."/oxwindow.class.php");
        $wintitle = "刪除";
        $wecome_info = "<a href='erraddsave.php'>錯誤管理</a>::刪除錯誤";
        $win = new OxWindow();
        $win->Init("erraddsave.php","js/blank.js","POST");
        $win->AddHidden("fmdo","yes");
        $win->AddHidden("dopost",$dopost);
        $win->AddHidden("id",$id);
        $win->AddTitle("你確實要刪除「 $id 」這些錯誤提示？");
        $winform = $win->GetWindow("ok");
        $win->Display();
        exit();
    }
    exit();
}

$sql = "SELECT * FROM `#@__erradd`";
$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN."/templets/erradd.htm");
$dlist->SetSource($sql);
$dlist->display();