From 32113cdc51b7e2106345ace8bbe5a553ee3cf21c Mon Sep 17 00:00:00 2001
From: xushubieli <xushubieli@qq.com>
Date: Tue, 26 Apr 2022 15:43:47 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=96=87=E6=A1=A3=E5=BC=B9?=
 =?UTF-8?q?=E5=87=BA=E5=B1=82=E5=92=8C=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86?=
 =?UTF-8?q?=E4=B8=8E=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86=E6=96=87=E4=BB=B6?=
 =?UTF-8?q?=E6=8C=89=E5=90=8D=E7=A7=B0=E6=8E=92=E5=BA=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/admin/dialog/select_images.php      |  7 +++----
 src/admin/dialog/select_media.php       |  5 ++---
 src/admin/dialog/select_soft.php        |  7 +++----
 src/admin/dialog/select_templets.php    |  7 +++----
 src/admin/templets/file_manage_main.htm | 20 ++++++++------------
 src/admin/templets/templets_default.htm |  6 ++----
 6 files changed, 21 insertions(+), 31 deletions(-)

diff --git a/src/admin/dialog/select_images.php b/src/admin/dialog/select_images.php
index 6befd635..46154108 100644
--- a/src/admin/dialog/select_images.php
+++ b/src/admin/dialog/select_images.php
@@ -155,10 +155,10 @@ a{text-decoration:none!important}
             <td class="linerow" colspan="4">点击图片预览,点击图片名选择图片,显示图片后点击该图片关闭预览</td>
         </tr>
         <?php
-        $dh = dir($inpath);
+        $dh = scandir($inpath);
         $ty1 = "";
         $ty2 = "";
-        while ($file = $dh->read()) {
+        foreach ($dh as $file) {
             //计算文件大小和创建时间
             if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
                 $filesize = filesize("$inpath/$file");
@@ -181,7 +181,7 @@ a{text-decoration:none!important}
                 $line = "<tr>
                 <td class='linerow' colspan='2'>
                 <a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=".urlencode($tmp).$addparm."'><img src='../../static/web/img/dir2.gif'>上级目录</a></td>
-                <td colspan='2' class='linerow'>当前目录:$activepath</td>
+                <td colspan='2' class='linerow'>当前目录:$activepath</td>
                 </tr>";
                 echo $line;
             } else if (is_dir("$inpath/$file")) {
@@ -222,7 +222,6 @@ a{text-decoration:none!important}
                 echo "$line";
             }
         }//End Loop
-        $dh->close();
         ?>
         </tr>
     </table>
diff --git a/src/admin/dialog/select_media.php b/src/admin/dialog/select_media.php
index a482b4ce..a108f68f 100644
--- a/src/admin/dialog/select_media.php
+++ b/src/admin/dialog/select_media.php
@@ -90,10 +90,10 @@ a{text-decoration:none!important}
             <td width="30%" align="center" class="linerow">最后修改时间</td>
         </tr>
         <?php
-        $dh = dir($inpath);
+        $dh = scandir($inpath);
         $ty1 = "";
         $ty2 = "";
-        while ($file = $dh->read()) {
+        foreach ($dh as $file) {
             //计算文件大小和创建时间
             if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
                 $filesize = filesize("$inpath/$file");
@@ -178,7 +178,6 @@ a{text-decoration:none!important}
                 echo "$line";
             }
         }//End Loop
-        $dh->close();
         ?>
     </table>
 </body>
diff --git a/src/admin/dialog/select_soft.php b/src/admin/dialog/select_soft.php
index 56193f5f..986d68e5 100644
--- a/src/admin/dialog/select_soft.php
+++ b/src/admin/dialog/select_soft.php
@@ -98,9 +98,9 @@ a{text-decoration:none!important}
                         <td width="30%" class="linerow">修改时间</td>
                     </tr>
                     <?php
-                    $dh = dir($inpath);
-                    $ty1 = $ty2 = '';
-                    while ($file = $dh->read()) {
+					$dh = scandir($inpath);
+					$ty1 = $ty2 = "";
+					foreach ($dh as $file) {
                         //计算文件大小和创建时间
                         if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
                             $filesize = filesize("$inpath/$file");
@@ -161,7 +161,6 @@ a{text-decoration:none!important}
                             echo "$line";
                         }
                     }//End Loop
-                    $dh->close();
                     ?>
                 </table>
             </td>
diff --git a/src/admin/dialog/select_templets.php b/src/admin/dialog/select_templets.php
index 42c939b0..515015d6 100644
--- a/src/admin/dialog/select_templets.php
+++ b/src/admin/dialog/select_templets.php
@@ -76,10 +76,10 @@ a{text-decoration:none!important}
             <td width="30%" class="linerow">修改时间</td>
         </tr>
         <?php
-        $dh = dir($inpath);
+        $dh = scandir($inpath);
         $ty1 = "";
         $ty2 = "";
-        while ($file = $dh->read()) {
+        foreach ($dh as $file) {
             //计算文件大小和创建时间
             if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
                 $filesize = filesize("$inpath/$file");
@@ -102,7 +102,7 @@ a{text-decoration:none!important}
                     $tmp = preg_replace("#[\/][^\/]*$#", "", $activepath);
                     $line = "<tr>
                     <td class='linerow'><a href='select_templets.php?f=$f&activepath=".urlencode($tmp)."'><img src='../../static/web/img/dir2.gif'>上级目录</a></td>
-                    <td colspan='2' class='linerow'>当前目录:$activepath</td>
+                    <td colspan='2' class='linerow'>当前目录:$activepath</td>
                     </tr>\r\n";
                       echo $line;
                 } else if (is_dir("$inpath/$file")) {
@@ -187,7 +187,6 @@ a{text-decoration:none!important}
                     echo "$line";
                 }
             }//End Loop
-            $dh->close();
             ?>
         </table>
     </body>
diff --git a/src/admin/templets/file_manage_main.htm b/src/admin/templets/file_manage_main.htm
index 5ecd3c6d..641d90f1 100644
--- a/src/admin/templets/file_manage_main.htm
+++ b/src/admin/templets/file_manage_main.htm
@@ -22,11 +22,11 @@
       <td width="30%" background="../static/web/img/wbg.gif">操作</td>
     </tr>
     <?php
-$dh = dir($inpath);
-$ty1="";
-$ty2="";
+$dh = scandir($inpath);
+$ty1 = "";
+$ty2 = "";
 $files = $dirs = array();
-while(($file = $dh->read()) !== false)
+foreach ($dh as $file)
 {
 	if($file!="." && $file!=".." && !is_dir("$inpath/$file"))
 	{
@@ -58,10 +58,7 @@ while(($file = $dh->read()) !== false)
   <td height='26'>
   <a href=file_manage_main.php?activepath=".urlencode($tmp)."><img src='../static/web/img/dir2.gif'>上级目录</a>
   </td>
-  <td colspan='3'>
-   当前目录:$activepath &nbsp;
-
-   </td>
+  <td colspan='3'>当前目录:$activepath</td>
   </tr>";
 		$dirs[] = $line;
 	}
@@ -72,8 +69,8 @@ while(($file = $dh->read()) !== false)
 		$line = "\n<tr height='26' onMouseMove=\"javascript:this.bgColor='#F8FCF1';\" onMouseOut=\"javascript:this.bgColor='#ffffff';\">
    <td>
     <a href=file_manage_main.php?activepath=".urlencode("$activepath/$file")."><img src='../static/web/img/dir.gif'>$file</a></td>
-   <td> </td>
-   <td> </td>
+   <td></td>
+   <td></td>
    <td>
    <a href=file_manage_view.php?filename=".urlencode($file)."&activepath=".urlencode($activepath)."&fmdo=rename class='btn btn-success btn-sm'><i class='fa fa-address-card-o'></i> 改名</a>
    <a href=file_manage_view.php?filename=".urlencode($file)."&activepath=".urlencode($activepath)."&type=dir&fmdo=del class='btn btn-success btn-sm'><i class='fa fa-trash'></i> 删除</a>
@@ -300,7 +297,6 @@ while(($file = $dh->read()) !== false)
 		$files[] = $line;
 	}
 }
-$dh->close();
 foreach ($dirs as $dir)
 {
 	echo $dir;
@@ -317,7 +313,7 @@ foreach ($files as $file)
         <a href='file_manage_view.php?fmdo=newdir&activepath=<?php echo urlencode($activepath)?>' class="btn btn-success btn-sm">新建目录</a>
         <a href='file_manage_view.php?fmdo=upload&activepath=<?php echo urlencode($activepath)?>' class="btn btn-success btn-sm">文件上传</a>
         <a href='file_manage_control.php?fmdo=space&activepath=<?php echo urlencode($activepath)?>' class="btn btn-success btn-sm">空间检查</a>
-        &nbsp;&nbsp;</td>
+      </td>
     </tr>
   </table>
 </body>
diff --git a/src/admin/templets/templets_default.htm b/src/admin/templets/templets_default.htm
index a644ab1b..7d55a155 100644
--- a/src/admin/templets/templets_default.htm
+++ b/src/admin/templets/templets_default.htm
@@ -27,8 +27,7 @@ function DelTpl(filename) {
 		<tr>
 			<td colspan="4" height="26" bgcolor="#f8f8f8">
 				<span style="float:left;line-height:26px">
-				当前位置:
-				<?php
+				当前位置:<?php
       			if($acdir=='plus') echo '插件模板';
       			else if($acdir=='system') echo '底层模板';
       			else echo '核心模板 &gt; '.$acdir;
@@ -43,8 +42,7 @@ function DelTpl(filename) {
 		<?php
 		$files = scandir($templetdird);
 		foreach ($files as $filename){
-			if(!preg_match("#\.htm#", $filename))
-			continue;
+			if(!preg_match("#\.htm#", $filename)) continue;
 			$filetime = filemtime($templetdird.'/'.$filename);
 			$filetime = MyDate("Y-m-d H:i",$filetime);
 			$fileinfo = (isset($fileinfos[$filename]) ? $fileinfos[$filename]:'未知模板');