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">
<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="shortcut icon" type="image/x-icon" href="images/favicon.ico">
</head><body>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"></head><body>
<h1>Upgrade notes</h1>
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
into templates/lib. All files with the name *.js are automatically
included on all pages.<br>
There is a new log level LOG_DEBUG available for logNewMessage().<br>
<br>
<br>

View File

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

View File

@ -3,7 +3,7 @@
$Id$
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
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.
*
* @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
*/
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 (isset($_SESSION['cfgMain'])) $cfg = $_SESSION['cfgMain'];
else $cfg = new LAMCfgMain();

View File

@ -3,7 +3,7 @@
$Id$
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
it under the terms of the GNU General Public License as published by
@ -259,14 +259,13 @@ if (!$cfg->isWritable()) {
<?php echo _("Log level"); ?>
<SELECT name="logLevel">
<?php
$options = array(_("Notice"), _("Warning"), _("Error"));
$levels = array(LOG_NOTICE, LOG_WARNING, LOG_ERR);
for ($i = 0; $i < sizeof($options); $i++) {
if ($cfg->logLevel == $levels[$i]) {
echo "<option selected value=\"" . $levels[$i] . "\">" . $options[$i] . "</option>";
$options = array(_("Debug") => LOG_DEBUG, _("Notice") => LOG_NOTICE, _("Warning") => LOG_WARNING, _("Error") => LOG_ERR);
foreach ($options as $key => $value) {
if ($cfg->logLevel == $value) {
echo "<option selected value=\"" . $value . "\">" . $key . "</option>";
}
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/)
Copyright (C) 2003 - 2006 Michael Duergner
2005 - 2010 Roland Gruber
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
@ -25,6 +26,7 @@ $Id$
* Login form of LDAP Account Manager.
*
* @author Michael Duergner
* @author Roland Gruber
* @package main
*/
@ -138,6 +140,7 @@ if(isset($_POST['profile'])) {
* @param object $config_object current active configuration
*/
function display_LoginPage($config_object) {
logNewMessage(LOG_DEBUG, "Display login page");
global $error_message;
// generate 256 bit key and initialization vector for user/passwd-encryption
// check if we can use /dev/random otherwise use /dev/urandom or rand()
@ -407,9 +410,11 @@ function display_LoginPage($config_object) {
<?php
if (isLAMProVersion()) {
echo "LDAP Account Manager <b>Pro</b>: <b>" . LAMVersion() . "</b>&nbsp;&nbsp;&nbsp;";
logNewMessage(LOG_DEBUG, "LAM Pro " . LAMVersion());
}
else {
echo "LDAP Account Manager: <b>" . LAMVersion() . "</b>&nbsp;&nbsp;&nbsp;";
logNewMessage(LOG_DEBUG, "LAM " . LAMVersion());
}
?>
</SMALL>
@ -429,6 +434,7 @@ if(!empty($_POST['checklogin'])) {
$_SESSION['ldap'] = new Ldap($_SESSION['config']); // Create new Ldap object
if($_POST['passwd'] == "") {
logNewMessage(LOG_DEBUG, "Empty password for login");
$error_message = _("Empty password submitted. Please try again.");
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
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
display_LoginPage($_SESSION['config']); // Load login page
}