added new log level LOG_DEBUG

This commit is contained in:
Roland Gruber 2010-01-25 16:38:36 +00:00
parent 24995cb969
commit 0a885bd081
5 changed files with 23 additions and 15 deletions

View File

@ -1,17 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head> <html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
<title>Upgrade notes</title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"><title>Upgrade notes</title>
<link rel="stylesheet" type="text/css" href="style/layout.css"> <link rel="stylesheet" type="text/css" href="style/layout.css">
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"> <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"></head><body>
</head><body>
<h1>Upgrade notes</h1> <h1>Upgrade notes</h1>
This is a list of API changes for all LAM releases. This is a list of API changes for all LAM releases.
@ -24,6 +23,7 @@ This is a list of API changes for all LAM releases.
You can now integrate JavaScript libraries by simply putting the files You can now integrate JavaScript libraries by simply putting the files
into templates/lib. All files with the name *.js are automatically into templates/lib. All files with the name *.js are automatically
included on all pages.<br> included on all pages.<br>
There is a new log level LOG_DEBUG available for logNewMessage().<br>
<br> <br>
<br> <br>

View File

@ -1608,6 +1608,7 @@ class accountContainer {
* @return array error messages * @return array error messages
*/ */
function load_account($dn) { function load_account($dn) {
logNewMessage(LOG_DEBUG, "Edit account " . $dn);
$this->module = array(); $this->module = array();
$modules = $_SESSION['config']->get_AccountModules($this->type); $modules = $_SESSION['config']->get_AccountModules($this->type);
$search = substr($dn, 0, strpos($dn, ',')); $search = substr($dn, 0, strpos($dn, ','));
@ -1735,6 +1736,7 @@ class accountContainer {
* This function will prepare the object for a new account. * This function will prepare the object for a new account.
*/ */
function new_account() { function new_account() {
logNewMessage(LOG_DEBUG, "New account with type " . $this->type);
$this->isNewAccount = true; $this->isNewAccount = true;
$this->lastLoadedProfile = 'default'; $this->lastLoadedProfile = 'default';
$modules = $_SESSION['config']->get_AccountModules($this->type); $modules = $_SESSION['config']->get_AccountModules($this->type);

View File

@ -3,7 +3,7 @@
$Id$ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2006 Roland Gruber Copyright (C) 2006 - 2010 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -151,11 +151,11 @@ function logoffAndBackToLoginPage() {
/** /**
* Puts a new message in the log file. * Puts a new message in the log file.
* *
* @param string $level log level (LOG_NOTICE, LOG_WARNING, LOG_ERR) * @param string $level log level (LOG_DEBUG, LOG_NOTICE, LOG_WARNING, LOG_ERR)
* @param string $message log message * @param string $message log message
*/ */
function logNewMessage($level, $message) { function logNewMessage($level, $message) {
$possibleLevels = array(LOG_NOTICE => 'NOTICE', LOG_WARNING => 'WARNING', LOG_ERR => 'ERROR'); $possibleLevels = array(LOG_DEBUG => 'DEBUG', LOG_NOTICE => 'NOTICE', LOG_WARNING => 'WARNING', LOG_ERR => 'ERROR');
if (!in_array($level, array_keys($possibleLevels))) StatusMessage('ERROR', 'Invalid log level!', $level); if (!in_array($level, array_keys($possibleLevels))) StatusMessage('ERROR', 'Invalid log level!', $level);
if (isset($_SESSION['cfgMain'])) $cfg = $_SESSION['cfgMain']; if (isset($_SESSION['cfgMain'])) $cfg = $_SESSION['cfgMain'];
else $cfg = new LAMCfgMain(); else $cfg = new LAMCfgMain();

View File

@ -3,7 +3,7 @@
$Id$ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2009 Roland Gruber Copyright (C) 2003 - 2010 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -259,14 +259,13 @@ if (!$cfg->isWritable()) {
<?php echo _("Log level"); ?> <?php echo _("Log level"); ?>
<SELECT name="logLevel"> <SELECT name="logLevel">
<?php <?php
$options = array(_("Notice"), _("Warning"), _("Error")); $options = array(_("Debug") => LOG_DEBUG, _("Notice") => LOG_NOTICE, _("Warning") => LOG_WARNING, _("Error") => LOG_ERR);
$levels = array(LOG_NOTICE, LOG_WARNING, LOG_ERR); foreach ($options as $key => $value) {
for ($i = 0; $i < sizeof($options); $i++) { if ($cfg->logLevel == $value) {
if ($cfg->logLevel == $levels[$i]) { echo "<option selected value=\"" . $value . "\">" . $key . "</option>";
echo "<option selected value=\"" . $levels[$i] . "\">" . $options[$i] . "</option>";
} }
else { else {
echo "<option value=\"" . $levels[$i] . "\">" . $options[$i] . "</option>"; echo "<option value=\"" . $value . "\">" . $key . "</option>";
} }
} }
?> ?>

View File

@ -4,6 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2006 Michael Duergner Copyright (C) 2003 - 2006 Michael Duergner
2005 - 2010 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -25,6 +26,7 @@ $Id$
* Login form of LDAP Account Manager. * Login form of LDAP Account Manager.
* *
* @author Michael Duergner * @author Michael Duergner
* @author Roland Gruber
* @package main * @package main
*/ */
@ -138,6 +140,7 @@ if(isset($_POST['profile'])) {
* @param object $config_object current active configuration * @param object $config_object current active configuration
*/ */
function display_LoginPage($config_object) { function display_LoginPage($config_object) {
logNewMessage(LOG_DEBUG, "Display login page");
global $error_message; global $error_message;
// generate 256 bit key and initialization vector for user/passwd-encryption // generate 256 bit key and initialization vector for user/passwd-encryption
// check if we can use /dev/random otherwise use /dev/urandom or rand() // check if we can use /dev/random otherwise use /dev/urandom or rand()
@ -407,9 +410,11 @@ function display_LoginPage($config_object) {
<?php <?php
if (isLAMProVersion()) { if (isLAMProVersion()) {
echo "LDAP Account Manager <b>Pro</b>: <b>" . LAMVersion() . "</b>&nbsp;&nbsp;&nbsp;"; echo "LDAP Account Manager <b>Pro</b>: <b>" . LAMVersion() . "</b>&nbsp;&nbsp;&nbsp;";
logNewMessage(LOG_DEBUG, "LAM Pro " . LAMVersion());
} }
else { else {
echo "LDAP Account Manager: <b>" . LAMVersion() . "</b>&nbsp;&nbsp;&nbsp;"; echo "LDAP Account Manager: <b>" . LAMVersion() . "</b>&nbsp;&nbsp;&nbsp;";
logNewMessage(LOG_DEBUG, "LAM " . LAMVersion());
} }
?> ?>
</SMALL> </SMALL>
@ -429,6 +434,7 @@ if(!empty($_POST['checklogin'])) {
$_SESSION['ldap'] = new Ldap($_SESSION['config']); // Create new Ldap object $_SESSION['ldap'] = new Ldap($_SESSION['config']); // Create new Ldap object
if($_POST['passwd'] == "") { if($_POST['passwd'] == "") {
logNewMessage(LOG_DEBUG, "Empty password for login");
$error_message = _("Empty password submitted. Please try again."); $error_message = _("Empty password submitted. Please try again.");
display_LoginPage($_SESSION['config']); // Empty password submitted. Return to login page. display_LoginPage($_SESSION['config']); // Empty password submitted. Return to login page.
} }
@ -543,6 +549,7 @@ if(!empty($_POST['checklogin'])) {
} }
// Reload loginpage after a profile change // Reload loginpage after a profile change
elseif(!empty($_POST['profileChange'])) { elseif(!empty($_POST['profileChange'])) {
logNewMessage(LOG_DEBUG, "Change server profile to " . $_POST['profile']);
$_SESSION['config'] = new LAMConfig($_POST['profile']); // Recreate the config object with the submited $_SESSION['config'] = new LAMConfig($_POST['profile']); // Recreate the config object with the submited
display_LoginPage($_SESSION['config']); // Load login page display_LoginPage($_SESSION['config']); // Load login page
} }