Last active
September 15, 2019 18:47
-
-
Save g1ll/5a0879f5d48440633012381d3157c687 to your computer and use it in GitHub Desktop.
Revisions
-
g1ll revised this gist
Sep 15, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,7 @@ function getFolders($dir = false) { return $folders; } //TEST echo "<pre>"; print_r(getFolders()); echo "</pre>"; -
g1ll revised this gist
Apr 4, 2017 . No changes.There are no files selected for viewing
-
g1ll revised this gist
Apr 4, 2017 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,6 @@ function getFolders($dir = false) { $server_sign = filter_input(INPUT_SERVER, 'SERVER_SIGNATURE', FILTER_SANITIZE_STRING); $unix_server = (stristr($server_sign, "win")) ? false : true; $slash = ($unix_server) ? "/" : "\\"; $dir = (!$dir) ? getcwd() : $dir; $open_dir = opendir($dir); -
g1ll revised this gist
Apr 4, 2017 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ <?php function getFolders($dir = false) { $server_sign = filter_input(INPUT_SERVER, 'SERVER_SIGNATURE', FILTER_SANITIZE_STRING); $unix_server = (stristr($server_sign, "win")) ? false : true; @@ -18,4 +19,9 @@ function getFolders($dir = false) { } } return $folders; } echo "<pre>"; print_r(getFolders()); echo "</pre>"; ?> -
g1ll created this gist
Apr 4, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ function getFolders($dir = false) { $server_sign = filter_input(INPUT_SERVER, 'SERVER_SIGNATURE', FILTER_SANITIZE_STRING); $unix_server = (stristr($server_sign, "win")) ? false : true; // (teste)? verdadeira: falsa; $slash = ($unix_server) ? "/" : "\\"; $dir = (!$dir) ? getcwd() : $dir; $open_dir = opendir($dir); $folders = []; while ($item = readdir($open_dir)) { if ($item != "." && $item != "..") { $path = filetype(realpath($dir . $slash . $item)); if ($path == "dir") { $folders[] = $item; foreach (getFolders(realpath($dir . $slash . $item)) as $folder) { $folders[] = $item . $slash . $folder; } } } } return $folders; }