国内流行的内容管理系统(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.

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