001.
<?php
002.
session_cache_limiter(
'nocache'
);
003.
session_start();
004.
005.
$GLOBALS
[
'level'
] = 0;
006.
007.
header(
"Content-Type: text/html; charset=utf-8"
);
008.
?>
009.
<!DOCTYPE html>
010.
<html lang=
"ja"
>
011.
<head>
012.
<meta content=
"width=device-width initial-scale=1.0 minimum-scale=1.0 maximum-scale=1.0 user-scalable=no"
name=
"viewport"
>
013.
<meta charset=
"utf-8"
>
014.
<title>list4.php</title>
015.
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"
></script>
016.
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.bundle.min.js"
></script>
017.
<link rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css"
>
018.
<script>
019.
$(
function
(){
020.
021.
022.
var
scroll_top = $(
"<a id='scroll_top'>▲</a>"
)
023.
scroll_top.prop(
"href"
,
"javascript:void(0)"
);
024.
scroll_top.css({
025.
"position"
:
"fixed"
,
026.
"opacity"
:
"0.5"
,
027.
"text-decoration"
:
"none"
,
028.
"font-size"
:
"40px"
,
029.
"color"
:
"rgba(255,255,255,0.85)"
,
030.
"text-shadow"
:
"1px 1px 2px #656a6f"
,
031.
"right"
:
"3%"
,
032.
"bottom"
:
"5rem"
,
033.
"display"
:
"none"
034.
});
035.
036.
037.
scroll_top.on(
"click"
,
function
(){
038.
window.scroll(0,0);
039.
});
040.
041.
042.
$(
"body"
).append( scroll_top );
043.
044.
045.
$(window).on(
"scroll"
,
function
(){
046.
var
scroll = $(
"html"
).scrollTop();
047.
if
( scroll <= 200 && $(
"#scroll_top"
).css(
"display"
) !=
"none"
) {
048.
$(
"#scroll_top"
).css(
"display"
,
"none"
);
049.
}
050.
if
( scroll > 200 && $(
"#scroll_top"
).css(
"display"
) ==
"none"
) {
051.
$(
"#scroll_top"
).css(
"display"
,
""
);
052.
}
053.
});
054.
055.
});
056.
</script>
057.
</head>
058.
<body>
059.
060.
<div
class
=
"btn-group"
style=
'position:fixed;left:200px;top:0px;z-index:2147483647'
>
061.
<button type=
"button"
class
=
"btn btn-secondary"
>ジャンプ</button>
062.
<button type=
"button"
063.
class
=
"btn btn-secondary dropdown-toggle dropdown-toggle-split"
064.
data-toggle=
"dropdown"
065.
aria-haspopup=
"true"
066.
aria-expanded=
"false"
>
067.
<span
class
=
"sr-only"
>Toggle Dropdown</span>
068.
</button>
069.
<div
class
=
"dropdown-menu"
>
070.
<a
class
=
"dropdown-item"
href=
"#cs"
>C#</a>
071.
<a
class
=
"dropdown-item"
href=
"#database"
>データベース</a>
072.
<a
class
=
"dropdown-item"
href=
"#excel"
>Excel</a>
073.
<a
class
=
"dropdown-item"
href=
"#html"
>HTML</a>
074.
<a
class
=
"dropdown-item"
href=
"#java"
>Java</a>
075.
<a
class
=
"dropdown-item"
href=
"#javascript"
>JavaScript</a>
076.
<a
class
=
"dropdown-item"
href=
"#jquery"
>jQuery</a>
077.
<a
class
=
"dropdown-item"
href=
"#php"
>PHP</a>
078.
<a
class
=
"dropdown-item"
href=
"#system-design"
>システム設計</a>
079.
<a
class
=
"dropdown-item"
href=
"#tools"
>ツール</a>
080.
<a
class
=
"dropdown-item"
href=
"#windows"
>Windows</a>
081.
<a
class
=
"dropdown-item"
href=
"#work"
>作業場所</a>
082.
083.
084.
</div>
085.
</div>
086.
087.
088.
<div style=
'margin-left:-38px;margin-bottom:1000px;'
>
089.
<ul>
090.
<?php recursionFiles(
realpath
(
"./"
) ) ?>
091.
</ul>
092.
</div>
093.
</body>
094.
</html>
095.
<?php
096.
097.
098.
099.
100.
function
recursionFiles(
$target
) {
101.
102.
$GLOBALS
[
'level'
]++;
103.
104.
105.
$files
=
glob
(
"{$target}/*"
);
106.
107.
foreach
(
$files
as
$file
) {
108.
109.
if
(
is_file
(
$file
)) {
110.
$path_parts
=
pathinfo
(
$file
);
111.
if
(
$path_parts
[
'extension'
] ==
"doc"
||
$path_parts
[
'extension'
] ==
"line"
||
$path_parts
[
'extension'
] ==
"ttl"
||
$path_parts
[
'extension'
] ==
"menu"
) {
112.
continue
;
113.
}
114.
if
(
$path_parts
[
'extension'
] ==
"png"
||
$path_parts
[
'extension'
] ==
"jpg"
) {
115.
continue
;
116.
}
117.
118.
$target
=
$path_parts
[
'basename'
];
119.
$ttl
=
$path_parts
[
'dirname'
] .
"/"
.
$path_parts
[
'filename'
] .
".ttl"
;
120.
if
(
file_exists
(
$ttl
) ) {
121.
$target
=
file_get_contents
(
$ttl
);
122.
}
123.
$url
=
str_replace
(
"/home/lightbox/www/homepage"
,
""
,
$path_parts
[
'dirname'
]);
124.
125.
if
(
$target
==
"list1.php"
||
$target
==
"list2.php"
||
$target
==
"list3.php"
||
$target
==
"list4.php"
) {
126.
continue
;
127.
}
128.
129.
130.
print
"<li><a style='color:black' href=\"{$url}/?src={$path_parts['basename']}\">{$target}</a></li>"
;
131.
}
132.
133.
else
{
134.
$url
=
str_replace
(
"/home/lightbox/www/homepage"
,
""
,
$file
);
135.
$path_parts
=
pathinfo
(
$url
);
136.
if
(
$path_parts
[
'basename'
] ==
"image"
||
$path_parts
[
'basename'
] ==
"log"
) {
137.
continue
;
138.
}
139.
140.
if
(
$GLOBALS
[
'level'
] == 1 ) {
141.
print
"<li id=\"{$path_parts['basename']}\" class=\"alert alert-primary\" style='padding:10px;margin-top:25px;list-style:none;'><a href=\"{$url}\">{$path_parts['basename']}</a></li>"
;
142.
}
143.
else
{
144.
print
"<li id=\"{$path_parts['basename']}\" style='margin-top:10px;'><a class=\"btn btn-outline-primary\" style='width:200px;text-align:left;' href=\"{$url}\">{$path_parts['basename']}</a></li>"
;
145.
}
146.
print
"<UL style='margin-bottom:20px;'>"
;
147.
148.
recursionFiles(
$file
);
149.
print
"</UL>"
;
150.
}
151.
}
152.
153.
$GLOBALS
[
'level'
]--;
154.
155.
}
156.
157.
158.
159.
?>