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

399 lines
23KB

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