X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=index.php;h=9bdeceaaccb438c086de2c55882072f6dbe43125;hb=78040801011740393dc2059516a98a8381beeab6;hp=53c652913cae1b0804bbac55e7dd177fb257acfa;hpb=c814ac9fbd7245879173e1abf0c30c9a9d186b78;p=mdref%2Fmdref
diff --git a/index.php b/index.php
index 53c6529..9bdecea 100644
--- a/index.php
+++ b/index.php
@@ -91,9 +91,9 @@ function urlpath($dir, $file) {
function ls($dir) {
$dir = rtrim(is_dir($dir) ? $dir : dirname($dir) ."/". basename($dir, ".md"), "/");
printf("
\n");
- printf("- ⇐ Home
\n");
+ printf("- ⇐ Home
\n");
if ($dir !== "." && ($dn = dirname($dir)) !== ".") {
- printf("- ⇑ %s
\n",
+ printf("- ⇑ %s
\n",
urlpath($dir, ".."),
ns($dn));
}
@@ -127,7 +127,7 @@ function ls($dir) {
}
}
- printf("- ⇒ %s
\n",
+ printf("- ⇒ %s
\n",
urlpath($dir, $file),
ns("$dir/".basename($file, ".md")));
}
@@ -154,15 +154,12 @@ function ml($file) {
if (is_dir($dir)) {
printf("Functions:
\n");
printf("\n");
- foreach (scandir($dir) as $file) {
- if ($file{0} === "." || !is_file("$dir/$file") || ctype_upper($file{0})) {
- continue;
- }
- printf("%s
%s
\n",
+ foreach (glob("$dir/[_a-z]*.md") as $file) {
+ printf("%s
%s
\n",
urlpath($dir, $file),
basename($file, ".md"),
- @end(head("$dir/$file", 3)),
- join(" ", cut(head("$dir/$file"), ["f"=>"1-"]))
+ @end(head($file, 3)),
+ join(" ", cut(head($file), ["f"=>"1-"]))
);
}
printf("
\n");
@@ -173,15 +170,12 @@ function ml($file) {
if (is_dir($dir)) {
printf("Methods:
\n");
printf("\n");
- foreach (scandir($dir) as $file) {
- if ($file{0} === "." || !is_file("$dir/$file") || ctype_upper($file{0})) {
- continue;
- }
- printf("%s
%s
\n",
+ foreach (glob("$dir/[_a-z]*.md") as $file) {
+ printf("%s
%s
\n",
urlpath($dir, $file),
basename($file, ".md"),
- @end(head("$dir/$file", 3)),
- join(" ", cut(head("$dir/$file"), ["f"=>"1-"]))
+ @end(head($file, 3)),
+ join(" ", cut(head($file), ["f"=>"1-"]))
);
}
printf("
\n");
@@ -215,12 +209,13 @@ function md($file, $res) {
}
}
-chdir($_SERVER["DOCUMENT_ROOT"]);
+chdir(__DIR__);
$t = ["css"=>"text/css", "js"=>"application/javascript"];
$r = new http\Env\Request;
$u = new http\Url($r->getRequestUrl());
$s = new http\Env\Response;
-$p = ".". $u->path;
+$b = dirname($_SERVER["SCRIPT_NAME"]);
+$p = ".". substr($u->path, strlen($b));
switch($p) {
case "./index.php":
@@ -241,11 +236,9 @@ ob_start($s);
=ns($p)?>
-
+
+
-
-
-