Example #1
0
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['items']);
//快速改变作品状态
if (isset($_POST['action']) && $_POST['action'] == 'ajax_edit' && isset($_POST['status']) && isset($_POST['item'])) {
    require_once ROOT_PATH . '/apps/items/models/items.class.php';
    $itemsClass = new items();
    //改变作品免费状态
    $res_status = '';
    $_POST['status'] == 'false' ? $res_status = 'true' : ($res_status = 'false');
    $res = $itemsClass->ajax_edit_free_file_status($_POST['item'], $res_status);
    if ($res) {
        $pic = '';
        $_POST['status'] == 'false' ? $pic = "http://" . $_SERVER['SERVER_NAME'] . "/static//admin/images/icons/24x24/accept.png" : ($pic = "http://" . $_SERVER['SERVER_NAME'] . "/static///img/question.png");
        //构造返回数据
        $res_arr = array('status' => $res_status, 'pic' => $pic);
        die(json_encode($res_arr));
    } else {
        die;
    }
}
if (isset($_POST['q'])) {
    $_GET['q'] = $_POST['q'];
}
if (!isset($_GET['q'])) {
    $_GET['q'] = '';