function delete_list_file($url) { $list_file = list_file($url); foreach ($list_file as $file) { delete_filename($url, $file); } }
function list_file($dir, $as) { $list = scandir($dir); // 得到该文件下的所有文件和文件夹 foreach ($list as $file) { //遍历 $file_location = $dir . "/" . $file; //生成路径 if (is_dir($file_location) && $file != "." && $file != "..") { //判断是不是文件夹 $as = list_file($file_location, $as); //继续遍历 } else { if (substr(basename($file), -3) == '.js' && basename($file) != "jscoverage.js") { array_push($as, $file_location); } } } return $as; }
return cmp_name($a, $b); } if ($asc == 'a') { return $a['ext'] < $b['ext'] ? -1 : 1; } else { return $a['ext'] > $b['ext'] ? -1 : 1; } } echo '<table class="table table-striped"><tr>'; //<!-- liste des fichiers --> /* repertoire initial à lister */ $dir = ""; if (!$dir) { $dir = INI_Conf_Moteur($_SESSION['opensim_select'], "address"); } list_file(rawurldecode($dir)); echo '</td></tr></table><HR>'; echo '<table><tr>'; //************************************************************************** $i = 0; while (list($key, $val) = each($tableauIni)) { if ($i % 3 <= 3) { echo '<td>'; $ImgMap = "http://" . $hostnameSSH . ":" . trim($srvOS) . "/index.php?method=regionImage" . str_replace("-", "", $tableauIni[$key]['RegionUUID']); echo '<center><b><u>*** ' . $key . ' ***</u></b> <img src="' . $ImgMap . '" width=45 height=45 BORDER=1></center>'; echo '<FORM METHOD=POST ACTION="">'; // *** Test des Fichiers suivants *** $filename1 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "OpenSim.ini"; $filename2 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $FichierINIOpensim; $filename3 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "config-include/FlotsamCache.ini"; $filename4 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "config-include/GridCommon.ini";
function list_file($dir, $theme, $x) { $list = scandir($dir); // 得到该文件下的所有文件和文件夹 foreach ($list as $file) { //遍历 $file_location = $dir . "/" . $file; //生成路径 $a = explode("/", $file_location); $b = $a[3]; if (is_dir($file_location) && $file != "." && $file != ".." && count($a) == "4") { //判断是不是文件 if (is_int(($x - 1) / 4) && $x - 1 != "0") { $bb = "<br>"; } else { } if ($b == $theme) { $cc = "disabled"; $ccc = "正在使用"; } else { $cc = ""; $ccc = "更换"; } $content = file_get_contents("../content/themes/{$b}/info.config"); $info = explode("\r\n", $content); echo $bb . ' <div class="col-sm-6 col-md-3"> <div class="thumbnail" > <img src="../content/themes/' . $b . '/preview.png" width="100%"alt="..."> <div class="caption"> <h3>' . $info[0] . '</h3> <p style="">作者:<a href="' . $info[2] . '" target="new">' . $info[1] . '</a></p> <p><a onclick="settheme(\'' . $b . '\');" class="btn btn-primary" role="button" ' . $cc . '>' . $ccc . '</a> </p> </div> </div> </div>'; list_file($file_location, $theme, $x++); //继续遍历 } } }
$key = $_POST["key"]; $cmd = $_POST["cmd"]; $delete = $_POST["delete"]; $start_delete = $_POST["start_delete"]; $array = explode("/", $_SERVER['SCRIPT_FILENAME']); $array_id = count($array) - 1; $this_file = $array["{$array_id}"]; $not_delete['files'] = array($this_file); $not_delete['dirs'] = array('kda_tar'); $gzip = false; if (!function_exists('shell_exec')) { echo "<p style='border:1px solid red; padding:15px;'>'shell_exec' not supported</p>"; } echo "<form style='border:3px solid #ccc; padding:15px;' name='extract' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\r\n\t \t\t<input style='padding:10px;' type='text' name='file' value='" . $_SERVER['SCRIPT_FILENAME'] . "'>\r\n\t \t\t<input type='submit' name='key' value='archive'>\r\n\t \t\t</form>"; if (empty($key) and empty($delete)) { $result = list_file("."); for ($i = 0; $i < count($result); $i++) { $fileinfo = pathinfo($result[$i]); if ($fileinfo['extension'] == "tar") { echo "\r\n\t \t\t<form style='border:3px solid black; padding:15px;' name='extract' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\r\n\t \t\t<input style='padding:10px;' type='text' name='file' value='" . $fileinfo['basename'] . "'>\r\n\t \t\t<input style='padding:10px;' type='text' name='cmd' value='tar -xf " . $fileinfo['basename'] . " &'>\r\n\t \t\t<input type='submit' name='key' value='extract'>\r\n\t \t\t</form>"; } elseif ($fileinfo['extension'] == "extracted") { echo "\r\n\t \t\t<form style='border:3px solid #ccc; padding:15px;' name='extract' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\r\n\t \t\t<input style='padding:10px;' type='text' name='file' value='" . $fileinfo['basename'] . "'>\r\n\t \t\t<input type='submit' name='key' value='unextract'>\r\n\t \t\t</form>"; } } echo "<h4>DELETE ALL " . $count_files . " files and dirictories</h4>\r\n\t \t\t<form style='border:1px solid red; padding:15px;' name='extract' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\r\n\t \t\t<input type='submit' name='delete' value='ok'>\r\n\t \t\t</form>"; } elseif (!empty($delete)) { echo "<h3>DELTE " . $count_files . " files and dirictories?</h3>\r\n\t \t\t<form style='border:5px solid red; padding:15px;' name='extract' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\r\n\t \t\t<input style='padding:10px; border:3px solid black' type='text' name='delete' value=''>\r\n\t \t\t<input style='border:5px solid red;' type='submit' name='start_delete' value='run'>\r\n\t \t\t</form>"; if ($delete == $delete_password) { $count_delete = delete_other(); echo "<h1>[DELETE ALL] =" . $count_delete . "= OK</h1>"; }
<html lang="ja"> <head> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Cache-Control" content="no-cache" /> <meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8" /> <head><title>doc (Nov/07/2015)</title> </head> <body> <h2>Nov/07/2015 Version</h2> <hr /> ファイル一覧 (ダウンロードするファイルを選んで下さい。)<p /> <blockquote> <?php include 'list_file_doc.php'; list_file(); ?> </blockquote> <hr /> <a href="../kanseihin/">完成品</a><p /> <div id="result_aa">result_aa</div> <hr /> <div id="outarea_aa">outarea_aa</div> <div id="outarea_bb">outarea_bb</div> <div id="outarea_cc">outarea_cc</div> <div id="outarea_dd">outarea_dd</div> <div id="outarea_ee">outarea_ee</div> <div id="outarea_ff">outarea_ff</div> <div id="outarea_gg">outarea_gg</div> <div id="outarea_hh">outarea_hh</div>
</div> </div> </div> <div class="am-tab-panel am-fade am-in" id="tab4"> <div class="am-g"> <div class="am-u-lg-12 am-u-sm-12"> <div class="am-g am-margin-top"> <table class="am-table am-table-striped am-table-hover table-main"> <thead> <tr> <th width="40%">文件名</th> <th width="30%">更新时间</th> <th width="15%">文件大小</th> <th width="15%">下载</th> </tr> </thead> <tbody> <?php $dir = "files/sampleai"; list_file($dir); ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div>