Пример #1
0
function post_edit()
{
    global $db, $pre, $postdb, $fid, $fidDB, $Fid_db, $mid, $lfjuid, $rsdb, $lfjdb, $webdb, $timestamp, $aid, $FROMURL, $groupdb, $web_admin, $fu_fiddb;
    if ($rsdb[levels] && $postdb[levels]) {
        $postdb[levels] = $rsdb[levels];
        //处理其他级别2,3,4...以防出错
    }
    if ($postdb[top]) {
        $postdb['list'] = $rsdb['list'] > $timestamp ? $rsdb['list'] : $timestamp * 1.3;
    } else {
        $postdb['list'] = $rsdb['list'] > $timestamp ? $timestamp : $rsdb['list'];
    }
    if (!$web_admin && $groupdb[EditPassPower] == 1) {
        $postdb[yz] = '';
    }
    $erp = $Fid_db[iftable][$fid];
    $db->query("UPDATE `{$pre}article{$erp}` SET title='{$postdb['title']}',smalltitle='{$postdb['smalltitle']}',fid='{$fid}',fname='{$fidDB['name']}',hits='{$postdb['hits']}',posttime='{$postdb['posttime']}',list='{$postdb['list']}',author='{$postdb['author']}',copyfrom='{$postdb['copyfrom']}',copyfromurl='{$postdb['copyfromurl']}',titlecolor='{$postdb['titlecolor']}',fonttype='{$postdb['fonttype']}',picurl='{$postdb['picurl']}',ispic='{$postdb['ispic']}',yz='{$postdb['yz']}',levels='{$postdb['levels']}',keywords='{$postdb['keywords']}',jumpurl='{$postdb['jumpurl']}',iframeurl='{$postdb['iframeurl']}',style='{$postdb['style']}',template='{$postdb['template']}',target='{$postdb['target']}',money='{$postdb['money']}',passwd='{$postdb['passwd']}',editer='{$userdb['username']}',edittime='{$timestamp}',begintime='{$postdb['begintime']}',endtime='{$postdb['endtime']}',description='{$postdb['description']}',allowview='{$postdb['allowview']}',allowdown='{$postdb['allowdown']}',htmlname='{$postdb['htmlname']}',forbidcomment='{$postdb['forbidcomment']}',goods_sn='{$postdb['goods_sn']}' WHERE aid='{$aid}' ");
    if ($postdb[htmlname] != $rsdb[htmlname]) {
        //自定义内容页文件名
        get_showhtmltype();
    }
    //辅栏目处理
    query_fu_sort($fu_fiddb, $aid);
    //修改内容
    query_reply($aid, $rsdb[rid], 'edit');
    //财富处理
    if (!$postdb[yz] && $rsdb[yz]) {
        Give_article_money($lfjuid, 'unyz', $rsdb);
    }
    if (!$postdb[levels] && $rsdb[levels]) {
        Give_article_money($lfjuid, 'uncom', $rsdb);
    }
    //添加关键字
    if ($rsdb[keywords] != $postdb[keywords]) {
        keyword_del($aid, $rsdb[keywords]);
        keyword_add($aid, $postdb[keywords], $lfjdb[uid]);
    }
    if ($rsdb[ifvote]) {
        edit_vote($aid);
    }
    //删除缓存文件
    delete_cache_file($fid, $aid);
    corntab_post('DE');
    corntab_post('EN', $aid);
    //定时发布
}
Пример #2
0
function delete_article($aid, $rid, $forcedel = 0)
{
    global $db, $pre, $webdb;
    if (!$aid) {
        showerr("id²»´æÔÚ");
    }
    $erp = get_id_table($aid);
    if ($rid) {
        $rsdb = $db->get_one("SELECT R.*,A.* FROM {$pre}article{$erp} A LEFT JOIN {$pre}reply{$erp} R ON A.aid=R.aid WHERE R.rid='{$rid}'");
    } elseif ($aid) {
        $rsdb = $db->get_one("SELECT R.*,A.* FROM {$pre}article{$erp} A LEFT JOIN {$pre}reply{$erp} R ON A.aid=R.aid WHERE A.aid='{$aid}' ORDER BY R.rid ASC LIMIT 1");
        if (!$rsdb[rid]) {
            $db->query("DELETE FROM {$pre}article{$erp} WHERE aid='{$aid}'");
            $db->query("DELETE FROM {$pre}article_db WHERE aid='{$aid}'");
            $db->query("DELETE FROM {$pre}fu_article WHERE aid='{$aid}'");
        }
    }
    if (!$rsdb) {
        return;
    }
    if ($rsdb[topic]) {
        if ($forcedel || $webdb[ForceDel]) {
            if ($rsdb[picurl]) {
                delete_attachment($rsdb[uid], tempdir($rsdb[picurl]));
                delete_attachment($rsdb[uid], tempdir("{$rsdb['picurl']}.jpg"));
                delete_attachment($rsdb[uid], tempdir("{$rsdb['picurl']}.jpg.jpg"));
            }
            $query = $db->query("SELECT * FROM {$pre}reply{$erp} WHERE aid='{$rsdb['aid']}'");
            while ($rs = $db->fetch_array($query)) {
                delete_attachment($rs[uid], $rs[content]);
            }
            if ($rsdb[mid]) {
                $r2 = $db->get_one("SELECT * FROM {$pre}article_content_{$rsdb['mid']} WHERE aid='{$rsdb['aid']}'");
                //ɾ³ý¸½¼þ
                if ($rsdb[mid] == 100 || $rsdb[mid] == 101 || $rsdb[mid] == 102) {
                    //ɾ³ýͼƬ,Èí¼þ,ÊÓƵ
                    if ($rsdb[mid] == 100) {
                        $string = $r2[photourl];
                    } elseif ($rsdb[mid] == 101) {
                        $string = $r2[softurl];
                    } elseif ($rsdb[mid] == 102) {
                        $string = $r2[mvurl];
                    }
                    $string = str_replace("\r", "", $string);
                    $detail = explode("\n", $string);
                    foreach ($detail as $value) {
                        $d = explode("@@@", $value);
                        delete_attachment($rsdb[uid], tempdir($d[0]));
                    }
                } elseif ($rsdb[mid] == 104) {
                    //ɾ³ýFLASH
                    $d = explode("@@@", $r2[flashurl]);
                    delete_attachment($rsdb[uid], tempdir($d[0]));
                }
                $db->query("DELETE FROM {$pre}article_content_{$rsdb['mid']} WHERE aid='{$rsdb['aid']}'");
            }
            $db->query("DELETE FROM `{$pre}collection` WHERE aid='{$rsdb['aid']}' ");
            $db->query("DELETE FROM `{$pre}article{$erp}` WHERE aid='{$rsdb['aid']}' ");
            $db->query("DELETE FROM `{$pre}article_db` WHERE aid='{$rsdb['aid']}' ");
            $db->query("DELETE FROM `{$pre}reply{$erp}` WHERE aid='{$rsdb['aid']}' ");
            $db->query("DELETE FROM `{$pre}comment` WHERE aid='{$rsdb['aid']}' ");
            $db->query("DELETE FROM `{$pre}report` WHERE aid='{$rsdb['aid']}' ");
            $db->query("DELETE FROM `{$pre}fu_article` WHERE aid='{$rsdb['aid']}'");
            //²Æ¸»´¦Àí
            Give_article_money($rsdb[uid], 'del');
            if ($rsdb[levels]) {
                Give_article_money($rsdb[uid], 'uncom');
            }
            //ɾ³ý¹Ø¼ü×Ö
            keyword_del($rsdb[aid], $rsdb[keywords]);
        } else {
            $db->query("UPDATE {$pre}article{$erp} SET yz=2 WHERE aid='{$rsdb['aid']}'");
        }
    } else {
        $db->query("DELETE FROM {$pre}reply{$erp} WHERE rid='{$rsdb['rid']}'");
        delete_attachment($rsdb[uid], $rsdb[content]);
        if ($rsdb[mid]) {
            $db->query("DELETE FROM {$pre}article_content_{$rsdb['mid']} WHERE rid='{$rsdb['rid']}'");
        }
        $db->query("UPDATE {$pre}article{$erp} SET pages=pages-1 WHERE aid='{$rsdb['aid']}'");
    }
    //ɾ³ý»º´æÎļþ
    delete_cache_file($rsdb[fid], $rsdb[aid]);
}