- // List access logfiles
- $dir = PATH.LOGS_BASE."/";
- if (is_dir($dir)) {
- // logs directory does exist
- OUTPUT_HTML("<OL>");
- $handle = @opendir($dir) or mxchange_die("Cannot open directory ".LOGS_BASE."!");
- while($file = @readdir($handle)) {
- // We currenly only like files with "access" as prefix, should be more flexible!
- if (substr($file, 0, 6) == "access") {
- // Okay, let us print it out
- OUTPUT_HTML("<LI><A href=\"".URL."/modules.php?module=admin&what=".$GLOBALS['what']."&access=".urlencode($file)."\">".$file."</A></LI>");
- }
- }
- @closedir($handle);
- OUTPUT_HTML("</OL>");
- }
- else
- {
+ // Is the directory there?
+ if (isDirectory(getConfig('PATH') . getConfig('logs_base'))) {
+ // Logs directory does exist so begin the list
+ outputHtml('<ol>');
+
+ // Read all files
+ $files = getArrayFromDirectory(getConfig('logs_base'), 'access');
+
+ // And walk through them
+ foreach ($files as $file) {
+ // Cut dirname away
+ $file = basename($file);
+
+ // Okay, add it
+ outputHtml('<li><a href="{%url=modules.php?module=admin&what=' . getWhat() . '&access=' . urlencode($file) . '%}">' . $file . '</a></li>');
+ } // END - foreach
+
+ // Finish list
+ outputHtml('</ol>');
+ } else {