forked from 20xd6/simple_blog
68 lines
2.1 KiB
PHP
68 lines
2.1 KiB
PHP
<?php
|
|
include ($_SERVER['DOCUMENT_ROOT'].'/common/php/header.php');
|
|
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/menu.php');
|
|
?>
|
|
|
|
<h1>Authors</h1>
|
|
<nav id="body_nav" class="jmenu">
|
|
<div class="pmenu">
|
|
|
|
<ul><li><a href=/>Home</a></li></ul>
|
|
<?php
|
|
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/get_month_name.php');
|
|
|
|
//Removes the number used to keep articles in post order from the displayed title.
|
|
function remove_sorting_number($link_title){
|
|
$first_three = mb_substr($link_title, 0, 3,"UTF-8");
|
|
|
|
if ( preg_match( '/[0-9][0-9] /', $first_three) ){
|
|
$link_title = mb_substr($link_title,3);
|
|
}
|
|
return $link_title;
|
|
}
|
|
|
|
|
|
$dir = '.';
|
|
// Check if the directory exists
|
|
if (file_exists($dir) && is_dir($dir) ) {
|
|
// Get the files of the directory as an array
|
|
$scan_arr = scandir($dir);
|
|
$files_arr = array_diff($scan_arr, array('.','..','index.php','common','.htaccess') );
|
|
// echo "<pre>"; print_r( $files_arr ); echo "</pre>";
|
|
// Get each files of our directory with line break
|
|
foreach ($files_arr as $file) {
|
|
//Get the file path
|
|
$file_path = "./".$file;
|
|
// Get the file extension
|
|
$file_ext = pathinfo($file_path, PATHINFO_EXTENSION);
|
|
if ($file_ext == "") {
|
|
$file_array[] = $file;
|
|
}
|
|
}
|
|
if (sizeof($file_array) != 0){
|
|
foreach($file_array as $file) {//Renders the folder names as more readable titles.
|
|
$link_title = str_replace('_',' ',$file);//Remove undersores and replace them with spaces
|
|
$link_title = str_replace($_replace,'',$link_title);
|
|
if (file_exists($file."/pfp.png")){
|
|
$pfp_path = $file."/pfp.png";
|
|
} else {
|
|
$pfp_path = "";
|
|
}
|
|
echo("<ul><li><img src=\".$pfp_path\" name=\"$file pfp\" width=\"20\" height=\"20\"><a href='$file'> $link_title </a></li></ul>\n");//Output the result.
|
|
}
|
|
} else {
|
|
echo "<ul><li><a>No Authors<a></li></ul>";
|
|
}
|
|
}
|
|
else {
|
|
echo "Directory does not exists";
|
|
}
|
|
echo("<ul><li><a href='..'>Back</a></li></ul>\n");
|
|
?>
|
|
</div><!--end of pmenu-->
|
|
</nav>
|
|
<br>
|
|
<?php
|
|
include ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');
|
|
?>
|