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

398 lines
23KB

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