<?php
/**
 * @param Protty
 * @url www.pder.org
 **/
if ($_GET['c']=='opt'){
    require_once 'PerClass/State.admin.php';
    $ver = LoginStaFun($_SESSION['id'], $config);
    require 'PerClass/Article.admin.php';
    if ($_GET['ip']=='edit'){
        $EditArticle = QueryOne($_GET['id'], $config);
        require_once 'PerClass/Ify.admin.php';
        $ify = selectIfyIni($config);
        require_once 'Editor/edit_js.html';
        require_once 'Delivery/edit_article.html';
        if ($_POST['edit_submit']){
            $array = array(FileTer($_POST['title']),$_POST['content'],FileTer($_POST['rlink']),FileTer($_POST['image_link']),FileTer($_POST['ify']),time(),$ver['nickname'],$_POST['mend'],$_GET['id']);
            if (!empty($_GET['id'])){
                $information = Edit_Article($array, $config);
            }else {
                $information = false;
            }
            if ($information){
                echo "<script>alert('修改成功!');location.href='?c=art';</script>";
                 
            }else {
                echo "<script>alert('修改失败!');location.href='';</script>";
            }
        }
    }
    if ($_GET['ip']=='del'){
        $Del = Del_Article($_GET['id'], $config);
        if ($Del){
            echo "<script>alert('删除成功!');location.href='?c=art';</script>";
             
        }else {
            echo "<script>alert('删除失败!');location.href='?c=art';</script>";
        }
    }
    if ($_GET['ip']=='mend'){
        if (!empty($_GET['id'])){
            $Mend = MendUpdate($_GET['v'], $_GET['id'], $config);
            if ($Mend){
                echo "<script>alert('推荐操作成功!');location.href='?c=art';</script>";
            }else {
                echo "<script>alert('推荐操作失败!');location.href='?c=art';</script>";
            }
        }else {
            echo "<script>alert('操作失败!');location.href='?c=art';</script>";
        }
    }

}
?>