国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

451 lines
24KB

  1. <?php if(!defined('DEDEINC')) exit('Request Error!');
  2. /**
  3. * 栏目单元,主要用户管理后台管理处
  4. *
  5. * @version $Id: typeunit.class.admin.php 1 15:21 2010年7月5日Z tianya $
  6. * @package DedeCMS.Libraries
  7. * @copyright Copyright (c) 2007 - 2018, DesDev, Inc.
  8. * @copyright Copyright (c) 2020, DedeBIZ.COM
  9. * @license https://www.dedebiz.com/license/v6
  10. * @link https://www.dedebiz.com
  11. */
  12. require_once(DEDEINC."/channelunit.func.php");
  13. /**
  14. * 栏目单元,主要用户管理后台管理处
  15. *
  16. * @package TypeUnit
  17. * @subpackage DedeCMS.Libraries
  18. * @link http://www.dedecms.com
  19. */
  20. class TypeUnit
  21. {
  22. var $dsql;
  23. var $artDir;
  24. var $baseDir;
  25. var $idCounter;
  26. var $idArrary;
  27. var $shortName;
  28. var $CatalogNums;
  29. //php5构造函数
  30. function __construct()
  31. {
  32. $this->idCounter = 0;
  33. $this->artDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
  34. $this->baseDir = $GLOBALS['cfg_basedir'];
  35. $this->shortName = $GLOBALS['art_shortname'];
  36. $this->idArrary = '';
  37. $this->dsql = 0;
  38. }
  39. function TypeUnit()
  40. {
  41. $this->__construct();
  42. }
  43. //清理类
  44. function Close()
  45. {
  46. }
  47. //获取所有栏目的文档ID数
  48. function UpdateCatalogNum()
  49. {
  50. $this->dsql->SetQuery("SELECT typeid,count(typeid) as dd FROM `#@__arctiny` WHERE arcrank <>-2 group by typeid");
  51. $this->dsql->Execute();
  52. while($row = $this->dsql->GetArray())
  53. {
  54. $this->CatalogNums[$row['typeid']] = $row['dd'];
  55. }
  56. }
  57. function GetTotalArc($tid)
  58. {
  59. if(!is_array($this->CatalogNums))
  60. {
  61. $this->UpdateCatalogNum();
  62. }
  63. if(!isset($this->CatalogNums[$tid]))
  64. {
  65. return 0;
  66. }
  67. else
  68. {
  69. $totalnum = 0;
  70. $ids = explode(',',GetSonIds($tid));
  71. foreach($ids as $tid)
  72. {
  73. if(isset($this->CatalogNums[$tid]))
  74. {
  75. $totalnum += $this->CatalogNums[$tid];
  76. }
  77. }
  78. return $totalnum;
  79. }
  80. }
  81. /**
  82. * 读出所有分类,在类目管理页(list_type)中使用
  83. *
  84. * @access public
  85. * @param int $channel 频道ID
  86. * @param int $nowdir 当前操作ID
  87. * @return string
  88. */
  89. function ListAllType($channel=0,$nowdir=0)
  90. {
  91. global $cfg_admin_channel, $admin_catalogs;
  92. $this->dsql = $GLOBALS['dsql'];
  93. //检测用户有权限的顶级栏目
  94. if($cfg_admin_channel=='array')
  95. {
  96. $admin_catalog = join(',', $admin_catalogs);
  97. $this->dsql->SetQuery("SELECT reid FROM `#@__arctype` WHERE id in($admin_catalog) group by reid ");
  98. $this->dsql->Execute();
  99. $topidstr = '';
  100. while($row = $this->dsql->GetObject())
  101. {
  102. if($row->reid==0) continue;
  103. $topidstr .= ($topidstr=='' ? $row->reid : ','.$row->reid);
  104. }
  105. $admin_catalog .= ','.$topidstr;
  106. $admin_catalogs = explode(',', $admin_catalog);
  107. $admin_catalogs = array_unique($admin_catalogs);
  108. }
  109. $this->dsql->SetQuery("SELECT id,typedir,typename,ispart,sortrank,ishidden FROM `#@__arctype` WHERE reid=0 order by sortrank");
  110. $this->dsql->Execute(0);
  111. while($row = $this->dsql->GetObject(0))
  112. {
  113. if( $cfg_admin_channel=='array' && !in_array($row->id, $admin_catalogs) )
  114. {
  115. continue;
  116. }
  117. $typeDir = $row->typedir;
  118. $typeName = $row->typename;
  119. $ispart = $row->ispart;
  120. $id = $row->id;
  121. $rank = $row->sortrank;
  122. if($row->ishidden=='1')
  123. {
  124. $nss = "<font color='red'>[隐]</font>";
  125. }
  126. else
  127. {
  128. $nss = '';
  129. }
  130. echo "<table width='100%' border='0' cellspacing='0' cellpadding='2'>\r\n";
  131. //普通列表
  132. if($ispart==0)
  133. {
  134. echo " <tr>\r\n";
  135. echo " <td style='background-color:#FBFCE2;' width='2%' class='bline'><img style='cursor:pointer' id='img".$id."' onClick=\"LoadSuns('suns".$id."',$id);\" src='images/dedeexplode.gif' width='11' height='11'></td>\r\n";
  136. echo " <td style='background-color:#FBFCE2;' class='bline'><table width='98%' border='0' cellspacing='0' cellpadding='0'><tr><td width='50%'><input class='np' type='checkbox' name='tids[]' value='{$id}'><a href='catalog_do.php?cid=".$id."&dopost=listArchives' oncontextmenu=\"CommonMenu(event,this,$id,'".urlencode($typeName)."')\"> {$nss}".$typeName."[ID:".$id."]</a>(文档:".$this->GetTotalArc($id).") <a onclick=\"AlertMsg('快捷编辑窗口','$id');\" href=\"javascript:;\"><img src='images/write2.gif'/></a>";
  137. echo " </td><td align='right'>";
  138. echo " <a href='{$GLOBALS['cfg_phpurl']}/list.php?tid={$id}' target='_blank' class='btn btn-secondary btn-sm' title='预览'><i class='fa fa-globe' aria-hidden='true'></i></a>";
  139. echo " <a href='catalog_do.php?cid={$id}&dopost=listArchives' class='btn btn-secondary btn-sm' title='内容'><i class='fa fa-list' aria-hidden='true'></i></a>";
  140. echo " <a href='catalog_add.php?id={$id}' class='btn btn-secondary btn-sm' title='增加子类'><i class='fa fa-plus-circle' aria-hidden='true'></i></a>";
  141. echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
  142. echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' class='btn btn-secondary btn-sm' title='移动'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
  143. echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' class='btn btn-secondary btn-sm' title='删除'><i class='fa fa-trash' aria-hidden='true'></i></a>";
  144. echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
  145. }
  146. //带封面的频道
  147. else if($ispart==1)
  148. {
  149. echo " <tr >\r\n";
  150. echo " <td style='background-color:#FBFCE2;' width='2%' class='bline'><img style='cursor:pointer' id='img".$id."' onClick=\"LoadSuns('suns".$id."',$id);\" src='images/dedeexplode.gif' width='11' height='11'></td>\r\n";
  151. echo " <td style='background-color:#FBFCE2;' class='bline'><table width='98%' border='0' cellspacing='0' cellpadding='0'><tr><td width='50%'><input class='np' type='checkbox' name='tids[]' value='{$id}'><a href='catalog_do.php?cid=".$id."&dopost=listArchives' oncontextmenu=\"CommonMenuPart(event,this,$id,'".urlencode($typeName)."')\"> {$nss}".$typeName."[ID:".$id."]</a> <a onclick=\"AlertMsg('快捷编辑窗口','$id');\" href=\"javascript:;\"> <img src='images/write2.gif'/> </a>";
  152. echo " </td><td align='right'>";
  153. echo " <a href='{$GLOBALS['cfg_phpurl']}/list.php?tid={$id}' target='_blank' class='btn btn-secondary btn-sm' title='预览'><i class='fa fa-globe' aria-hidden='true'></i></a>";
  154. echo " <a href='catalog_do.php?cid={$id}&dopost=listArchives' class='btn btn-secondary btn-sm' title='内容'><i class='fa fa-list' aria-hidden='true'></i></a>";
  155. echo " <a href='catalog_add.php?id={$id}' class='btn btn-secondary btn-sm' title='增加子类'><i class='fa fa-plus-circle' aria-hidden='true'></i></a>";
  156. echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
  157. echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' class='btn btn-secondary btn-sm' title='移动'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
  158. echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' class='btn btn-secondary btn-sm' title='删除'><i class='fa fa-trash' aria-hidden='true'></i></a>";
  159. echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
  160. }
  161. //独立页面
  162. else if($ispart==2)
  163. {
  164. echo " <tr height='24' bgcolor='#FBFCE2'>\r\n";
  165. echo " <td width='2%' class='bline2'><img style='cursor:pointer' id='img".$id."' onClick=\"LoadSuns('suns".$id."',$id);\" src='images/dedeexplode.gif' width='11' height='11'></td>\r\n";
  166. echo " <td class='bline2'><table width='98%' border='0' cellspacing='0' cellpadding='0'><tr><td width='50%'><input class='np' type='checkbox' name='tids[]' value='{$id}'><a href='catalog_edit.php?id=".$id."' oncontextmenu=\"SingleMenu(event,this,$id,'".urlencode($typeName)."')\"> {$nss}".$typeName."[ID:".$id."]</a> <a onclick=\"AlertMsg('快捷编辑窗口','$id');\" href=\"javascript:;\"><img src='images/write2.gif'/></a>";
  167. echo " </td><td align='right'>";
  168. echo " <a href='{$typeDir}' target='_blank' class='btn btn-secondary btn-sm' title='预览'><i class='fa fa-globe' aria-hidden='true'></i></a>";
  169. echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
  170. echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' class='btn btn-secondary btn-sm' title='移动'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
  171. echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' class='btn btn-secondary btn-sm' title='删除'><i class='fa fa-trash' aria-hidden='true'></i></a>";
  172. echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
  173. }
  174. echo " <tr><td colspan='2' id='suns".$id."'>";
  175. $lastid = GetCookie('lastCid');
  176. if($channel==$id || $lastid==$id || isset($GLOBALS['exallct']) || $cfg_admin_channel=='array')
  177. {
  178. echo " <table width='100%' border='0' cellspacing='0' cellpadding='0'>\r\n";
  179. $this->LogicListAllSunType($id," ");
  180. echo " </table>\r\n";
  181. }
  182. echo "</td></tr>\r\n</table>\r\n";
  183. }
  184. }
  185. /**
  186. * 获得子类目的递归调用
  187. *
  188. * @access public
  189. * @param int $id 栏目ID
  190. * @param string $step 层级标志
  191. * @return void
  192. */
  193. function LogicListAllSunType($id, $step)
  194. {
  195. global $cfg_admin_channel, $admin_catalogs;
  196. $fid = $id;
  197. $this->dsql->SetQuery("SELECT id,reid,typedir,typename,ispart,sortrank,ishidden FROM `#@__arctype` WHERE reid='".$id."' order by sortrank");
  198. $this->dsql->Execute($fid);
  199. if($this->dsql->GetTotalRow($fid)>0)
  200. {
  201. while($row = $this->dsql->GetObject($fid))
  202. {
  203. if($cfg_admin_channel=='array' && !in_array($row->id, $admin_catalogs) )
  204. {
  205. continue;
  206. }
  207. $typeDir = $row->typedir;
  208. $typeName = $row->typename;
  209. $reid = $row->reid;
  210. $id = $row->id;
  211. $ispart = $row->ispart;
  212. if($step==" ")
  213. {
  214. $stepdd = 2;
  215. }
  216. else
  217. {
  218. $stepdd = 3;
  219. }
  220. $rank = $row->sortrank;
  221. if($row->ishidden=='1')
  222. {
  223. $nss = "<font color='red'>[隐]</font>";
  224. }
  225. else
  226. {
  227. $nss = '';
  228. }
  229. //普通列表
  230. if($ispart==0)
  231. {
  232. echo "<tr height='24' oncontextmenu=\"CommonMenu(event,this,$id,'".urlencode($typeName)."')\">\r\n";
  233. echo "<td class='nbline'>";
  234. echo "<table width='98%' border='0' cellspacing='0' cellpadding='0'>";
  235. echo "<tr onMouseMove=\"javascript:this.bgColor='#FAFCE0';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\"><td width='50%'>";
  236. echo "<input class='np' type='checkbox' name='tids[]' value='{$id}'>$step <img style='cursor:pointer' id='img".$id."' onClick=\"LoadSuns('suns".$id."',$id);\" src='images/dedeexplode.gif' width='11' height='11'> <a href='catalog_do.php?cid=".$id."&dopost=listArchives'>{$nss}".$typeName."[ID:".$id."]</a>(文档:".$this->GetTotalArc($id).") <a onclick=\"AlertMsg('快捷编辑窗口','$id');\" href=\"javascript:;\"><img src='images/write2.gif'/></a>";
  237. echo "</td><td align='right'>";
  238. echo " <a href='{$GLOBALS['cfg_phpurl']}/list.php?tid={$id}' target='_blank' title='预览' class='btn btn-secondary btn-sm'><i class='fa fa-globe' aria-hidden='true'></i></a>";
  239. echo " <a href='catalog_do.php?cid={$id}&dopost=listArchives' class='btn btn-secondary btn-sm' title='内容'><i class='fa fa-list' aria-hidden='true'></i></a>";
  240. echo " <a href='catalog_add.php?id={$id}' class='btn btn-secondary btn-sm' title='增加子类'><i class='fa fa-plus-circle' aria-hidden='true'></i></a>";
  241. echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
  242. echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' title='移动' class='btn btn-secondary btn-sm'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
  243. echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' title='删除' class='btn btn-secondary btn-sm'><i class='fa fa-trash' aria-hidden='true'></i></a>";
  244. echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
  245. }
  246. //封面频道
  247. else if($ispart==1)
  248. {
  249. echo " <tr height='24' oncontextmenu=\"CommonMenu(event,this,$id,'".urlencode($typeName)."')\">\r\n";
  250. echo "<td class='nbline'><table width='98%' border='0' cellspacing='0' cellpadding='0'><tr onMouseMove=\"javascript:this.bgColor='#FAFCE0';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\"><td width='50%'>";
  251. echo "<input class='np' type='checkbox' name='tids[]' value='{$id}'>$step <img style='cursor:pointer' id='img".$id."' onClick=\"LoadSuns('suns".$id."',$id);\" src='images/dedeexplode.gif' width='11' height='11'> <a href='catalog_do.php?cid=".$id."&dopost=listArchives'>{$nss}".$typeName."[ID:".$id."]</a> <a onclick=\"AlertMsg('快捷编辑窗口','$id');\" href=\"javascript:;\"><img src='images/write2.gif'/></a>";
  252. echo "</td><td align='right'>";
  253. echo "<a href='{$GLOBALS['cfg_phpurl']}/list.php?tid={$id}' target='_blank' title='预览' class='btn btn-secondary btn-sm'><i class='fa fa-globe' aria-hidden='true'></i></a>";
  254. echo " <a href='catalog_do.php?cid={$id}&dopost=listArchives' class='btn btn-secondary btn-sm' title='内容'><i class='fa fa-list' aria-hidden='true'></i></a>";
  255. echo " <a href='catalog_add.php?id={$id}' class='btn btn-secondary btn-sm' title='增加子类'><i class='fa fa-plus-circle' aria-hidden='true'></i></a>";
  256. echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
  257. echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' title='移动' class='btn btn-secondary btn-sm'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
  258. echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' title='删除' class='btn btn-secondary btn-sm'><i class='fa fa-trash' aria-hidden='true'></i></a>";
  259. echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
  260. }
  261. //独立页面
  262. else if($ispart==2)
  263. {
  264. echo "<tr height='24' oncontextmenu=\"SingleMenu(event,this,$id,'".urlencode($typeName)."')\">\r\n";
  265. echo "<td class='bline2'><table width='98%' border='0' cellspacing='0' cellpadding='0'>";
  266. echo "<tr onMouseMove=\"javascript:this.bgColor='#FAFCE0';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\"><td width='50%'>";
  267. echo "<input class='np' type='checkbox' name='tids[]' value='{$id}'>$step <img style='cursor:pointer' id='img".$id."' onClick=\"LoadSuns('suns".$id."',$id);\" src='images/dedeexplode.gif' width='11' height='11'> <a href='catalog_do.php?cid=".$id."&dopost=listArchives'>{$nss}".$typeName."[ID:".$id."]</a> <a onclick=\"AlertMsg('快捷编辑窗口','$id');\" href=\"javascript:;\"><img src='images/write2.gif'/></a>";
  268. echo "</td><td align='right'>";
  269. echo " <a href='{$typeDir}' target='_blank' title='预览' class='btn btn-secondary btn-sm'><i class='fa fa-globe' aria-hidden='true'></i></a>";
  270. echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
  271. echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' title='移动' class='btn btn-secondary btn-sm'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
  272. echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' title='删除' class='btn btn-secondary btn-sm'><i class='fa fa-trash' aria-hidden='true'></i></a>";
  273. echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
  274. }
  275. echo " <tr><td id='suns".$id."' style='display:none'><table width='100%' border='0' cellspacing='0' cellpadding='0'>";
  276. $this->LogicListAllSunType($id,$step." ");
  277. echo "</table></td></tr>\r\n";
  278. }
  279. }
  280. }
  281. /**
  282. * 返回与某个目相关的下级目录的类目ID列表(删除类目或文章时调用)
  283. *
  284. * @access public
  285. * @param int $id 栏目ID
  286. * @param int $channel 频道ID
  287. * @return array
  288. */
  289. function GetSunTypes($id, $channel=0)
  290. {
  291. $this->dsql = $GLOBALS['dsql'];
  292. $this->idArray[$this->idCounter]=$id;
  293. $this->idCounter++;
  294. $fid = $id;
  295. if($channel!=0)
  296. {
  297. $csql = " And channeltype=$channel ";
  298. }
  299. else
  300. {
  301. $csql = "";
  302. }
  303. $this->dsql->SetQuery("SELECT id FROM `#@__arctype` WHERE reid=$id $csql");
  304. $this->dsql->Execute("gs".$fid);
  305. //if($this->dsql->GetTotalRow("gs".$fid)!=0)
  306. //{
  307. while($row=$this->dsql->GetObject("gs".$fid))
  308. {
  309. $nid = $row->id;
  310. $this->GetSunTypes($nid,$channel);
  311. }
  312. //}
  313. return $this->idArray;
  314. }
  315. /**
  316. * 删除类目
  317. *
  318. * @access public
  319. * @param int $id 栏目ID
  320. * @param bool $isDelFile 是否删除文件
  321. * @return string
  322. */
  323. function DelType($id, $isDelFile)
  324. {
  325. $this->idCounter = 0;
  326. $this->idArray = array();
  327. $this->GetSunTypes($id);
  328. $query = "
  329. SELECT #@__arctype.*,#@__channeltype.typename AS ctypename,
  330. #@__channeltype.addtable
  331. FROM `#@__arctype` LEFT JOIN #@__channeltype
  332. ON #@__channeltype.id=#@__arctype.channeltype
  333. WHERE #@__arctype.id='$id'
  334. ";
  335. $typeinfos = $this->dsql->GetOne($query);
  336. $topinfos = $this->dsql->GetOne("SELECT moresite,siteurl FROM `#@__arctype` WHERE id='".$typeinfos['topid']."'");
  337. if(!is_array($typeinfos))
  338. {
  339. return FALSE;
  340. }
  341. $indir = $typeinfos['typedir'];
  342. $addtable = $typeinfos['addtable'];
  343. $ispart = $typeinfos['ispart'];
  344. $defaultname = $typeinfos['defaultname'];
  345. //删除数据库里的相关记录
  346. foreach($this->idArray as $id)
  347. {
  348. $myrow = $this->dsql->GetOne("SELECT * FROM `#@__arctype` WHERE id='$id'");
  349. if($myrow['topid']>0)
  350. {
  351. $mytoprow = $this->dsql->GetOne("SELECT moresite,siteurl FROM `#@__arctype` WHERE id='".$myrow['topid']."'");
  352. if(is_array($mytoprow) && !empty($mytoprow))
  353. {
  354. foreach($mytoprow as $k=>$v)
  355. {
  356. if(!preg_match("/[0-9]/",$k))
  357. {
  358. $myrow[$k] = $v;
  359. }
  360. }
  361. }
  362. }
  363. //删除目录和目录里的所有文件 ### 禁止了此功能
  364. //删除单独页面
  365. if($myrow['ispart']==2 && $myrow['typedir']=='')
  366. {
  367. if( is_file($this->baseDir.'/'.$myrow['defaultname']) )
  368. {
  369. @unlink($this->baseDir.'/'.$myrow['defaultname']);
  370. }
  371. }
  372. //删除数据库信息
  373. $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__arctype` WHERE id='$id'");
  374. $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE typeid='$id'");
  375. $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE typeid='$id'");
  376. $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__spec` WHERE typeid='$id'");
  377. $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__feedback` WHERE typeid='$id'");
  378. if($addtable!="")
  379. {
  380. $this->dsql->ExecuteNoneQuery("DELETE FROM $addtable WHERE typeid='$id'");
  381. }
  382. }
  383. //删除目录和目录里的所有文件 ### 禁止了此功能
  384. //删除单独页面
  385. if($ispart==2 && $indir=="")
  386. {
  387. if( is_file($this->baseDir."/".$defaultname) )
  388. {
  389. @unlink($this->baseDir."/".$defaultname);
  390. }
  391. }
  392. @reset($this->idArray);
  393. $this->idCounter = 0;
  394. return TRUE;
  395. }
  396. /**
  397. * 删除指定目录的所有文件
  398. *
  399. * @access public
  400. * @param string $indir 指定目录
  401. * @return int
  402. */
  403. function RmDirFile($indir)
  404. {
  405. if(!file_exists($indir)) return;
  406. $dh = dir($indir);
  407. while($file = $dh->read())
  408. {
  409. if($file == "." || $file == "..")
  410. {
  411. continue;
  412. }
  413. else if(is_file("$indir/$file"))
  414. {
  415. @unlink("$indir/$file");
  416. }
  417. else
  418. {
  419. $this->RmDirFile("$indir/$file");
  420. }
  421. if(is_dir("$indir/$file"))
  422. {
  423. @rmdir("$indir/$file");
  424. }
  425. }
  426. $dh->close();
  427. return(1);
  428. }
  429. }//End Class