예제 #1
0
 function delArticle($id, $uid = '0', $postype = '1')
 {
     $id = (int) $id;
     $id or iPHP::alert("请选择要删除的文章");
     $uid && ($sql = "and `userid`='{$uid}' and `postype`='{$postype}'");
     $art = articleTable::row($id, 'cid,pic,tags', $sql);
     iACP::CP($art['cid'], 'cd', 'alert');
     $frs = articleTable::select_filedata_indexid($id);
     for ($i = 0; $i < count($frs); $i++) {
         if ($frs[$i]) {
             $path = $frs[$i]['path'] . '/' . $frs[$i]['filename'] . '.' . $frs[$i]['ext'];
             iFS::del(iFS::fp($frs[$i]['path'], '+iPATH'));
             $msg .= $this->del_msg($path . ' 文件删除');
         }
     }
     if ($art['tags']) {
         iPHP::app('tag.class', 'static');
         $msg .= tag::del($art['tags']);
     }
     iDB::query("DELETE FROM `#iCMS@__category_map` WHERE `iid` = '{$id}' AND `appid` = '" . $this->appid . "';");
     iDB::query("DELETE FROM `#iCMS@__prop_map` WHERE `iid` = '{$id}' AND `appid` = '" . $this->appid . "' ;");
     articleTable::del_filedata($id, 'indexid');
     $msg .= $this->del_msg('相关文件数据删除');
     articleTable::del_comment($id);
     $msg .= $this->del_msg('评论数据删除');
     articleTable::del($id);
     articleTable::del_data($id);
     $msg .= $this->del_msg('文章数据删除');
     $this->categoryApp->update_count_one($art['cid'], '-');
     $msg .= $this->del_msg('栏目数据更新');
     $msg .= $this->del_msg('删除完成');
     return $msg;
 }