Пример #1
0
function do_work($id, $job, $check = 0)
{
    global $db, $pre, $timestamp, $lfjid, $lfjdb, $webdb, $web_admin, $reason, $Fid_db;
    if (!$Fid_db) {
        include ROOT_PATH . "data/all_fid.php";
    }
    if (!$lfjid) {
        showerr("请先登录");
    }
    $erp = get_id_table($id);
    $rsdb = $db->get_one("SELECT A.*,B.admin FROM {$pre}article{$erp} A LEFT JOIN {$pre}sort B ON A.fid=B.fid WHERE A.aid='{$id}' ");
    if ($check == 1) {
        if (!$web_admin && !in_array($lfjid, explode(",", $rsdb[admin]))) {
            showerr("你没权限操作此文:{$rsdb['title']}");
        }
    }
    if ($job == "delete") {
        global $forcedel;
        delete_article($rsdb[aid], '', $forcedel);
        make_article_html('', 'del', $rsdb);
        //静态处理
        $array[title] = "你发表的《{$rsdb[title]}》被删除了";
    } elseif ($job == "move" && $rsdb[yz] != 2) {
        global $fid;
        if ($fid) {
            make_article_html('', 'del', $rsdb);
            //静态处理,要放在前面,不然FID都变了,就没法删除
            $rs = $db->get_one("SELECT name FROM {$pre}sort WHERE fid='{$fid}'");
            $db->query("UPDATE {$pre}article{$erp} SET fid='{$fid}',fname='{$rs['name']}',lastfid='{$rsdb['fid']}' WHERE aid='{$id}' ");
            $db->query("UPDATE {$pre}reply{$erp} SET fid='{$fid}' WHERE aid='{$id}' ");
            $rsdb[mid] && $db->query("UPDATE {$pre}article_content_{$rsdb['mid']} SET fid='{$fid}' WHERE aid='{$id}' ");
            $array[title] = "你发表的《{$rsdb[title]}》被转移栏目了";
        }
    } elseif ($job == "color") {
        global $Color;
        $db->query("UPDATE {$pre}article{$erp} SET titlecolor='{$Color}' WHERE aid='{$id}' ");
        $array[title] = "你发表的《{$rsdb[title]}》被设置标题颜色了";
    } elseif ($job == "yz" && $rsdb[yz] != 2 && $rsdb[yz] != 1) {
        $db->query("UPDATE {$pre}article{$erp} SET yz='1',yzer='{$lfjdb['username']}',yztime='{$timestamp}' WHERE aid='{$id}' ");
        //财富处理
        Give_article_money($rsdb[uid], 'yz', $rsdb);
        $array[title] = "你发表的《{$rsdb[title]}》通过审核了";
    } elseif ($job == "unyz" && $rsdb[yz] != 2 && $rsdb[yz] != 0) {
        $db->query("UPDATE {$pre}article{$erp} SET yz='0',yzer='{$lfjdb['username']}',yztime='{$timestamp}' WHERE aid='{$id}' ");
        //财富处理
        Give_article_money($rsdb[uid], 'unyz', $rsdb);
        make_article_html('', 'del', $rsdb);
        //静态处理
        $array[title] = "你发表的《{$rsdb[title]}》被取消审核了";
    } elseif ($job == "com" && !$rsdb[levels]) {
        global $levels;
        if ($levels < 1) {
            $levels = 1;
        }
        $db->query("UPDATE {$pre}article{$erp} SET levels='{$levels}',levelstime='{$timestamp}' WHERE aid='{$id}' ");
        //财富处理
        Give_article_money($rsdb[uid], 'com', $rsdb);
        $array[title] = "你发表的《{$rsdb[title]}》被推荐了";
    } elseif ($job == "uncom" && $rsdb[levels]) {
        $db->query("UPDATE {$pre}article{$erp} SET levels='0',levelstime='0' WHERE aid='{$id}' ");
        //财富处理
        Give_article_money($rsdb[uid], 'uncom', $rsdb);
        $array[title] = "你发表的《{$rsdb[title]}》被取消推荐了";
    } elseif ($job == "top") {
        global $toptime;
        $times = $timestamp + $toptime;
        $db->query("UPDATE {$pre}article{$erp} SET list='{$times}' WHERE aid='{$id}'");
        $array[title] = "你发表的《{$rsdb[title]}》被置顶了";
    } elseif ($job == "untop") {
        $db->query("UPDATE {$pre}article{$erp} SET list=posttime WHERE aid='{$id}' ");
        $array[title] = "你发表的《{$rsdb[title]}》被取消置顶了";
    } elseif ($job == "front") {
        global $topid;
        if ($topid) {
            $rs = $db->get_one("SELECT list FROM {$pre}article{$erp} WHERE aid='{$topid}' ");
            $list = $rs["list"] + 5;
            $db->query("UPDATE {$pre}article{$erp} SET list='{$list}' WHERE aid='{$id}' ");
        } else {
            $db->query("UPDATE {$pre}article{$erp} SET list='{$timestamp}' WHERE aid='{$id}' ");
        }
        $array[title] = "你发表的《{$rsdb[title]}》被提前显示了";
    } elseif ($job == "bottom") {
        global $bottomid;
        if ($bottomid) {
            $rs = $db->get_one("SELECT list FROM {$pre}article{$erp} WHERE aid='{$bottomid}' ");
            $list = $rs["list"] - 5;
            $db->query("UPDATE {$pre}article{$erp} SET list='{$list}' WHERE aid='{$id}' ");
        } else {
            $db->query("UPDATE {$pre}article{$erp} SET list='0' WHERE aid='{$id}' ");
        }
        $array[title] = "你发表的《{$rsdb[title]}》被沉底了";
    } elseif ($job == 'return') {
        if ($rsdb[yz] == 2) {
            $db->query("UPDATE {$pre}article{$erp} SET yz=1 WHERE aid='{$id}' ");
            $array[title] = "你发表的《{$rsdb[title]}》从回收站还原了";
        }
    } elseif ($job == 'special') {
        global $spid;
        if (!$spid) {
            showerr("请选择一个专题");
        }
        $rssp = $db->get_one(" SELECT * FROM {$pre}special WHERE id='{$spid}' ");
        $detail = explode(",", $rssp[aids]);
        if (!in_array($id, $detail)) {
            if ($rssp[aids]) {
                $rssp[aids] = "{$id},{$rssp['aids']}";
            } else {
                $rssp[aids] = "{$id}";
            }
            $db->query("UPDATE `{$pre}special` SET `aids`='{$rssp['aids']}' WHERE id='{$spid}'");
        }
        $array[title] = "你发表的《{$rsdb[title]}》被设置专题了";
    } elseif ($job == 'fusort') {
        global $fid;
        if (!$fid) {
            showerr("请选择一个辅栏目");
        }
        if (!$db->get_one("SELECT * FROM {$pre}fu_article WHERE fid='{$fid}' AND aid='{$id}'")) {
            $db->query("INSERT INTO {$pre}fu_article SET fid='{$fid}',aid='{$id}'");
        }
        $array[title] = "你发表的《{$rsdb[title]}》被设置辅栏目了";
    }
    //短消息通知
    if ($reason) {
        $array[fromer] = $lfjdb[username];
        $array[fromuid] = $lfjdb[uid];
        $array[touid] = $rsdb[uid];
        $array[content] = $reason;
        pm_msgbox($array);
    }
    //删除缓存文件
    delete_cache_file($rsdb[fid], $rsdb[aid]);
}
Пример #2
0
    $Content = addslashes($Content);
    $rows = $Num;
    $min = ($page - 1) * $rows;
    $detail = explode("\r\n", $Usrdb);
    for ($i = $min; $i < $min + $rows; $i++) {
        if (!($username = $detail[$i])) {
            continue;
        }
        $rs = $db->get_one("SELECT D.* FROM {$pre}memberdata D WHERE D.username='******' LIMIT {$min},{$rows}");
        if (!$rs[uid]) {
            continue;
        }
        $array[touid] = $rs[uid];
        $array[fromuid] = 0;
        $array[fromer] = "系统消息";
        $array[title] = addslashes($Title);
        $array[content] = addslashes($Content);
        pm_msgbox($array);
        $ck++;
    }
    $page++;
    if ($ck++) {
        echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=?lfj={$lfj}&action={$action}&page={$page}&succeeNUM={$succeeNUM}&failNUM={$failNUM}'>";
        exit;
    } else {
        unlink(ROOT_PATH . "cache/message_cache.php");
        $succeeNUM = intval($succeeNUM);
        $failNUM = intval($failNUM);
        jump("站内消息发送完毕", "index.php?lfj={$lfj}&job={$action}", 30);
    }
}
Пример #3
0
function send_msg($uid, $title, $content, $fromuid = 0)
{
    global $lfjid;
    $fromer = $fromuid ? $lfjid : 'SYSTEM';
    $array = array('touid' => $uid, 'fromuid' => $fromuid, 'title' => $title, 'content' => $content, 'fromer' => $fromer);
    pm_msgbox($array);
}