Latest SANDPIT - MERGE from CVS (MERGE-GIT)

This commit is contained in:
Deon George
2009-07-01 16:09:17 +10:00
parent 388783fc84
commit ea17aadef4
210 changed files with 37284 additions and 52716 deletions

View File

@@ -1,12 +1,9 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/syslog.php,v 1.13.2.1 2007/12/26 09:26:33 wurley Exp $
// $Header$
/**
* Functions related to syslog logging.
*
* @author Benjamin Drieu <benjamin.drieu@fr.alcove.com> and Alcôve
* @package phpLDAPadmin
*
* 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 the Free Software Foundation; either version 2 of the
@@ -21,16 +18,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* @author Benjamin Drieu <benjamin.drieu@fr.alcove.com> and Alcôve
* @package phpLDAPadmin
*/
# If config_default.php hasnt been called yet, then return.
if (! defined('APPCONFIG') || ! isset($_SESSION[APPCONFIG]))
return;
/* Initialize syslog */
if ($_SESSION[APPCONFIG]->GetValue('debug','syslog')) {
define_syslog_variables();
openlog('phpldapadmin', LOG_ODELAY, LOG_DAEMON );
# Initialize syslog
if ($_SESSION[APPCONFIG]->getValue('debug','syslog') && function_exists('syslog')) {
openlog('phpldapadmin',LOG_ODELAY,LOG_DAEMON);
}
/**
@@ -39,66 +38,53 @@ if ($_SESSION[APPCONFIG]->GetValue('debug','syslog')) {
* is true.
*
* @param emergency Syslog emergency.
* @param log_string String to log.
* @param log_string String to log.
*/
function syslog_msg ( $emergency, $log_string, $ldapserver=null ) {
if (isset($_SESSION[APPCONFIG]) && $_SESSION[APPCONFIG]->GetValue('debug','syslog')) {
function syslog_msg($emergency,$log_string) {
if (! function_exists('syslog') || ! isset($_SESSION[APPCONFIG]) || ! $_SESSION[APPCONFIG]->getValue('debug','syslog'))
return;
if (isset($ldapserver->server_id))
$log_string = sprintf('(%s) %s',$ldapserver->getLoggedInDN(),$log_string);
syslog ( $emergency, $log_string );
}
return true;
return syslog($emergency,$log_string);
}
/**
* Issue an error message via syslog.
*
* @param log_string Log message to send to syslog.
* @param server_id If set, print the logged user as well.
*
* @param log_string Log message to send to syslog.
* @return true on success.
*/
function syslog_err ( $log_string, $ldapserver=null ) {
return syslog_msg ( LOG_ERR, $log_string, $ldapserver );
function syslog_err($log_string) {
return syslog_msg(LOG_ERR,$log_string);
}
/**
* Issue a warning message via syslog.
*
* @param log_string Log message to send to syslog.
* @param server_id If set, print the logged user as well.
*
* @param log_string Log message to send to syslog.
* @return true on success.
*/
function syslog_warning ( $log_string, $ldapserver=null ) {
return syslog_msg ( LOG_WARNING, $log_string, $ldapserver );
function syslog_warning($log_string) {
return syslog_msg(LOG_WARNING,$log_string);
}
/**
* Issue a notice message via syslog.
*
* @param log_string Log message to send to syslog.
* @param server_id If set, print the logged user as well.
*
* @param log_string Log message to send to syslog.
* @return true on success.
*/
function syslog_notice ( $log_string, $ldapserver=null ) {
return syslog_msg ( LOG_NOTICE, $log_string, $ldapserver );
function syslog_notice($log_string) {
return syslog_msg(LOG_NOTICE,$log_string);
}
/**
* Issue a debug message via syslog, only if $log_level is set to
* 'debug' from the config file.
*
* @param log_string Log message to send to syslog.
* @param server_id If set, print the logged user as well.
*
* @param log_string Log message to send to syslog.
* @return true on success or if debug log is not activated.
*/
function syslog_debug ( $log_string, $ldapserver=null ) {
return syslog_msg ( LOG_DEBUG, $log_string, $ldapserver );
function syslog_debug($log_string) {
return syslog_msg(LOG_DEBUG,$log_string);
}
?>