"&sortorder=false", "title" => "&sortorder=false", "status" => "&sortorder=true", "ext" => "&sortorder=true", "aTime" => "&sortorder=false", "mTime" => "&sortorder=false" ); if( $sortOrder ){ $sortOrders[ $sortKey ] = "&sortorder=false"; } else{ $sortOrders[ $sortKey ] = "&sortorder=true"; } $distinctOnly = DISTINCT_ONLY; $distinctValue = ""; if( $distinctOnly ){ $distinctValue = "checked"; } if( array_key_exists( "distinctOnly", $_GET )){ $distinctValue = $_GET["distinctOnly"]; if( is_null( $distinctValue ) || "true" != $distinctValue ){ $distinctOnly = false; $distinctValue = ""; } else{ $distinctOnly = true; $distinctValue = "checked"; } } $multiOnly = MULTI_ONLY; $multiValue = ""; if( $multiOnly ){ $multiValue = "checked"; } if( array_key_exists( "multiOnly", $_GET )){ $multiValue = $_GET["multiOnly"]; if( is_null( $multiValue ) || "true" != $multiValue ){ $multiOnly = false; $multiValue = ""; } else{ $multiOnly = true; $multiValue = "checked"; } } print <<< JAVA_SCRIPT JAVA_SCRIPT; print <<< OPTION_FORM
同じIDのキャッシュは1件だけ表示(「完全」を優先して表示)
同じIDが複数あるキャッシュのみ表示
OPTION_FORM; print <<< TABLE_HEADER TABLE_HEADER; $count = 0; $baseDir = BASE_DIR; if( !file_exists( $baseDir ) ){ print <<< BASE_DIR_ERR BASE_DIR_ERR; } else{ $arrayKey = ""; $id = ""; $title = ""; $status = ""; $ext = ""; $aTime = ""; $mTime = ""; $filename = ""; $caches = readCacheDir( $baseDir, $distinctOnly, $multiOnly ); // キャッシュを列挙 sortArrayByArray( $caches, $sortKey, $sortOrder ); // ソート foreach( $caches as $arrayKey => $cache ){ $id = $cache["id"]; $title = $cache["title"]; $status = $cache["status"]; $ext = $cache["ext"]; $aTime = $cache["aTime"]; $mTime = $cache["mTime"]; print <<< FILE_LINE FILE_LINE; $count = $count +1; } } print <<< FOOTER
ID タイトル 状態 拡張子 最終アクセス日時 最終更新日時
ベースディレクトリ[$baseDir]が無効
$id $title $status $ext $aTime $mTime
{$count}件出力 FOOTER; ?> read() ){ $filepath = $baseDir . "/" . $aFile; $arrayKey = ""; $id = ""; $title = ""; $status = "完全"; $ext = ""; $aTime = ""; $cTime = ""; $mTime = ""; $workstring = $aFile; if( is_dir( $filepath ) ){ continue; } if( 0 == strncmp( "nltmp_", $workstring, 6 ) ){ $workstring = substr( $workstring, 6 ); $status = "途中"; } if( 0 != strncmp( "sm", $workstring, 2 ) ) { continue; } if( $ext = strrchr( $workstring, "." )){ $workstring = substr( $workstring, 0, strlen( $workstring )- strlen( $ext )); } $sepIndex = strpos( $workstring, "_" ); if( $sepIndex ) { $title = substr( $workstring, $sepIndex + 1 ); $workstring = substr( $workstring, 0, $sepIndex ); } if( $low = strrchr( $workstring, "low" )){ $workstring = substr( $workstring, 0, strlen( $workstring )- strlen( $low )); $status = $status . "(low)"; } $aTime = date("Y/m/d H:i:s", fileatime( $filepath )); $cTime = date("Y/m/d H:i:s", filectime( $filepath )); // inode変更時刻 $mTime = date("Y/m/d H:i:s", filemtime( $filepath )); $id = $workstring; if( $distinctOnly ){ $arrayKey = $id; if( array_key_exists( $arrayKey, $caches )){ array_push( $multiIds, $id ); $existCache = $caches[ $arrayKey ]; $skip = false; switch( $existCache[ "status" ] ){ case "完全": $skip = true; break; case "途中": if( "完全" != $status ){ $skip = true; } break; case "完全(low)": if( "途中(low)" == $status ){ $skip = true; } break; case "途中(low)": break; } if( $skip ){ continue; } } } else{ $arrayKey = $aFile; foreach( $caches as $key => $cache ){ if( $id == $cache["id"] ){ array_push( $multiIds, $id ); break; } } } $caches[ $arrayKey ] = array( "id" => $id, "title" => $title, "status" => $status, "ext" => $ext, "aTime" => $aTime, "cTime" => $cTime, "mTime" => $mTime, "filename" => $aFile ); } $files->close(); if( $multiOnly ){ foreach( $caches as $arrayKey => $cache ){ if( !in_array( $cache["id"], $multiIds )){ unset( $caches[ $arrayKey ]); } } } return $caches; } // // 関数:sortArrayByArray // 指定された要素のキーでソートする // function sortArrayByArray( &$arrayByArray, $sortKey, $sortOrder ) { $targetKeys = array(); foreach( $arrayByArray as $key => $item ){ $targetKeys[ $key ] = $item[ $sortKey ]; } if( $sortOrder ){ asort( $targetKeys ); } else{ arsort( $targetKeys ); } $tempArray = $arrayByArray; while( array_pop( $arrayByArray )); foreach( $targetKeys as $key => $property ){ $arrayByArray[ $key ]= $tempArray[ $key ]; } } ?>