New function isDirectory() introduced, fixed GET_DIR_AS_ARRAY() (replaces scandir())
[mailer.git] / inc / modules / admin / what-logs.php
index 648fa3a67b52b484c136c63202df1deb40a9dd50..33c537b6a2d3eeb6b99e372d71bf670a6c9f5831 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Management fuer Zugriffslogbuecher               *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision:: 856                                                    $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
@@ -40,9 +45,9 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
-if (!empty($_GET['access'])) {
+if (REQUEST_ISSET_GET(('access'))) {
        // Secure input and construct FQFN
-       $access = SQL_ESCAPE(strip_tags($_GET['access']));
+       $access = SQL_ESCAPE(strip_tags(REQUEST_GET('access')));
        $target = sprintf("%slogs/%s", constant('PATH'), $access);
 
        // Is the file valid and readable?
@@ -71,21 +76,21 @@ if (!empty($_GET['access'])) {
                        OUTPUT_HTML($OUTPUT);
 
                        // Output message
-                       LOAD_TEMPLATE("admin_settings_saved", false, UNKNOWN_LOGFILE_FORMAT_1.$access.UNKNOWN_LOGFILE_FORMAT_2);
+                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('ADMIN_UNKNOWN_LOGFILE_FORMAT'), $access));
                        return;
                }
 
                // Output the logfile's content and exit
                print($content);
-               exit;
+               shutdown();
        } else {
                // Not readable!
-               LOAD_TEMPLATE("admin_settings_saved", false, LOGFILE_NOT_READABLE_1.$access.LOGFILE_NOT_READABLE_2);
+               LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('LOGFILE_NOT_READABLE'), $access));
        }
 } else {
        // List access logfiles
-       $dir = PATH.getConfig('logs_base')."/";
-       if (is_dir($dir)) {
+       $dir = constant('PATH') . getConfig('logs_base') . "/";
+       if (isDirectory($dir)) {
                // logs directory does exist
                OUTPUT_HTML("<ol>");
                $handle = opendir($dir) or mxchange_die("Cannot open directory ".getConfig('logs_base')."!");
@@ -93,14 +98,14 @@ if (!empty($_GET['access'])) {
                        // 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&amp;what=".$GLOBALS['what']."&access=".urlencode($file)."\">".$file."</a></li>");
+                               OUTPUT_HTML("<li><a href=\"{!URL!}/modules.php?module=admin&amp;what=".$GLOBALS['what']."&amp;access=".urlencode($file)."\">".$file."</a></li>");
                        }
                }
                closedir($handle);
                OUTPUT_HTML("</ol>");
        } else {
                // logs directory does not exist
-               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_LOGS_DIR_404_1.getConfig('logs_base').ADMIN_LOGS_DIR_404_2);
+               LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('ADMIN_LOGS_DIR_404'), getConfig('logs_base')));
        }
 }