<?php
/**
 * 會員日誌編輯
 *
 * @version        $Id: member_feed_edit.php 1 14:08 2010年7月19日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");
CheckPurview('sys_Log');
if(empty($dopost))
{
    ShowMsg("你沒指定任何參數！","javascript:;");
    exit();
}
if(empty($dellog)) $dellog = 0;

//清空所選日誌
if($dopost == "clearcheck")
{
    $nowtime = time();
    $starttime = $nowtime - (24*3600);
    $endtime =$nowtime -($dellog*24*3600);
    $dsql->ExecuteNoneQuery("DELETE FROM #@__member_feed WHERE dtime BETWEEN $endtime AND $starttime ");
    ShowMsg("成功清空過去".$dellog."天記錄！","member_feed_main.php");
    exit();
}
//清空所有日誌
else if($dopost == "clear")
{
    $dsql->ExecuteNoneQuery("TRUNCATE TABLE #@__member_feed");
    ShowMsg("成功清空所有記錄！","memberlog_list.php");
    exit();
}
//刪除選定日誌
else if($dopost == "del")
{
    $bkurl = isset($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : "member_feed_main.php";
    $ids = explode('`', $ids);
    $dquery = "";
    foreach($ids as $id)
    {
        if($dquery=="") $dquery .= " fid='$id' ";
        else $dquery .= " OR fid='$id' ";
    }
    if($dquery!="") $dquery = " WHERE ".$dquery;
    $dsql->ExecuteNoneQuery("DELETE FROM #@__member_feed $dquery");
    ShowMsg("成功刪除指定的記錄！",$bkurl);
    exit();
}
//審核選定日誌
else if($dopost=="check")
{
    $bkurl = isset($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : "member_feed_main.php";
    $ids = explode('`', $ids);
    $dquery = "";
    foreach($ids as $id)
    {
        if($dquery=="") $dquery .= " fid='$id' ";
        else $dquery .= " OR fid='$id' ";
    }
    if($dquery!="") $dquery = " WHERE ".$dquery;
    $dsql->ExecuteNoneQuery("UPDATE #@__member_feed SET ischeck=1 $dquery");
    ShowMsg("成功審核指定的記錄！",$bkurl);
    exit();
} else {
    ShowMsg("無法識別你的請求！","javascript:;");
    exit();
}