mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:17:02 +02:00
improved logging for the gui
Change-Id: I31d0dbb70b8d8184ce1f48d0161ddaf9e6c8d9ca Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
@ -85,7 +85,7 @@ class ModelAccountingAccounting extends Model
|
||||
|
||||
}
|
||||
|
||||
if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, sprintf("processed %s to %s: %d records deleted, %d records added",date(DATE_TEMPLATE, $return['starttimestamp']),date(DATE_TEMPLATE, $return['stoptimestamp']),$return['deletedstats'],$return['addedstats'])); }
|
||||
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, sprintf("processed %s to %s: %d records deleted, %d records added",date(DATE_TEMPLATE, $return['starttimestamp']),date(DATE_TEMPLATE, $return['stoptimestamp']),$return['deletedstats'],$return['addedstats'])); }
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class ModelAuditAudit extends Model {
|
||||
$query = $this->db->query("SELECT COUNT(*) AS count FROM " . TABLE_AUDIT . " $where", $arr);
|
||||
$n = $query->row['count'];
|
||||
|
||||
if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, sprintf("audit query: '%s' in %.2f s, %d hits", $query->query, $query->exec_time, $query->row['count'])); }
|
||||
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, sprintf("audit query: '%s' in %.2f s, %d hits", $query->query, $query->exec_time, $query->row['count'])); }
|
||||
}
|
||||
else { $n = MAX_AUDIT_HITS; }
|
||||
|
||||
@ -87,7 +87,7 @@ class ModelAuditAudit extends Model {
|
||||
|
||||
$this->session->set("audit_query", array('where' => $where, 'sortorder' => $sortorder, 'arr' => $arr));
|
||||
|
||||
if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, sprintf("audit query: '%s', param: '%s' in %.2f s, %d hits", $query->query, implode(' ', $arr), $query->exec_time, $query->num_rows)); }
|
||||
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, sprintf("audit query: '%s', param: '%s' in %.2f s, %d hits", $query->query, implode(' ', $arr), $query->exec_time, $query->num_rows)); }
|
||||
|
||||
if(isset($query->rows)) {
|
||||
|
||||
|
@ -55,7 +55,7 @@ class ModelPolicyRetention extends Model {
|
||||
|
||||
$query = $this->db->query("UPDATE " . VIEW_MESSAGES . " SET retained = ? WHERE arrived > ? AND (todomain=? OR fromdomain=?)", array($retained, $start_ts, $data['domain'], $data['domain']));
|
||||
|
||||
if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, sprintf("update retention date: domain='%s', days=%d, hits=%d, exec time=%.2f sec", $data['domain'], $data['days'], $this->db->countAffected(), $query->exec_time)); }
|
||||
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, sprintf("update retention date: domain='%s', days=%d, hits=%d, exec time=%.2f sec", $data['domain'], $data['days'], $this->db->countAffected(), $query->exec_time)); }
|
||||
|
||||
return $this->db->countAffected();
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ class ModelSearchMessage extends Model {
|
||||
|
||||
if($id == '' || !preg_match("/^([0-9a-f]+)$/", $id)) { return $s; }
|
||||
|
||||
if(LOG_LEVEL >= DEBUG) { syslog(LOG_INFO, DECRYPT_BINARY . " $id"); }
|
||||
|
||||
$handle = popen(DECRYPT_BINARY . " $id", "r");
|
||||
while(($buf = fread($handle, DECRYPT_BUFFER_LENGTH))) {
|
||||
$s .= $buf;
|
||||
@ -89,6 +91,8 @@ class ModelSearchMessage extends Model {
|
||||
|
||||
if($piler_id == '' || $attachment_id == '' || !preg_match("/^([0-9a-f]+)$/", $piler_id) || !preg_match("/^([0-9m]+)$/", $attachment_id)) { return $data; }
|
||||
|
||||
if(LOG_LEVEL >= DEBUG) { syslog(LOG_INFO, DECRYPT_ATTACHMENT_BINARY . " $piler_id $attachment_id"); }
|
||||
|
||||
$handle = popen(DECRYPT_ATTACHMENT_BINARY . " $piler_id $attachment_id", "r");
|
||||
while(($buf = fread($handle, DECRYPT_BUFFER_LENGTH))){
|
||||
$data .= $buf;
|
||||
|
@ -148,7 +148,7 @@ class ModelUserAuth extends Model {
|
||||
foreach($params as $param) {
|
||||
$ret = $this->checkLoginAgainstLDAP_real($username, $password, $data, $param);
|
||||
|
||||
syslog(LOG_INFO, "ldap auth result against " . $param['ldap_host'] . " / " . $param['ldap_type'] . ": $ret");
|
||||
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, "ldap auth result against " . $param['ldap_host'] . " / " . $param['ldap_type'] . ": $ret"); }
|
||||
|
||||
if($ret == 1) { return $ret; }
|
||||
}
|
||||
@ -208,7 +208,7 @@ class ModelUserAuth extends Model {
|
||||
|
||||
$ldap_auth = new LDAP($ldap_host, $a['dn'], $password);
|
||||
|
||||
if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, "ldap auth against '" . $ldap_host . "', dn: '" . $a['dn'] . "', result: " . $ldap_auth->is_bind_ok()); }
|
||||
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, "ldap auth against '" . $ldap_host . "', dn: '" . $a['dn'] . "', result: " . $ldap_auth->is_bind_ok()); }
|
||||
|
||||
if($ldap_auth->is_bind_ok()) {
|
||||
|
||||
@ -241,7 +241,7 @@ class ModelUserAuth extends Model {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(ENABLE_SYSLOG == 1) {
|
||||
else if(LOG_LEVEL >= NORMAL) {
|
||||
syslog(LOG_INFO, "cannot bind to '" . $ldap_host . "' as '" . $ldap_helper_dn . "'");
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ class ModelUserAuth extends Model {
|
||||
$data = array();
|
||||
|
||||
foreach($e as $a) {
|
||||
//syslog(LOG_INFO, "checking ldap entry dn: " . $a['dn'] . ", cn: " . $a['cn']);
|
||||
if(LOG_LEVEL >= DEBUG) { syslog(LOG_INFO, "checking ldap entry dn: " . $a['dn'] . ", cn: " . $a['cn']); }
|
||||
|
||||
foreach (array("mail", "mailalternateaddress", "proxyaddresses", "zimbraMailForwardingAddress", "member", "memberOfGroup") as $mailattr) {
|
||||
if(isset($a[$mailattr])) {
|
||||
@ -289,7 +289,7 @@ class ModelUserAuth extends Model {
|
||||
if(is_array($a[$mailattr])) {
|
||||
for($i = 0; $i < $a[$mailattr]['count']; $i++) {
|
||||
|
||||
//syslog(LOG_INFO, "checking entry: " . $a[$mailattr][$i]);
|
||||
if(LOG_LEVEL >= DEBUG) { syslog(LOG_INFO, "checking entry: " . $a[$mailattr][$i]); }
|
||||
|
||||
$a[$mailattr][$i] = strtolower($a[$mailattr][$i]);
|
||||
|
||||
@ -305,7 +305,7 @@ class ModelUserAuth extends Model {
|
||||
}
|
||||
}
|
||||
else {
|
||||
//syslog(LOG_INFO, "checking entry #2: " . $a[$mailattr]);
|
||||
if(LOG_LEVEL >= DEBUG) { syslog(LOG_INFO, "checking entry #2: " . $a[$mailattr]); }
|
||||
|
||||
$email = strtolower(preg_replace("/^([\w]+)\:/i", "", $a[$mailattr]));
|
||||
if(validemail($email) && !in_array($email, $data)) { array_push($data, $email); }
|
||||
@ -440,7 +440,7 @@ class ModelUserAuth extends Model {
|
||||
if(isset($u[1])) { $username = $u[1]; }
|
||||
else { $username = $_SERVER['REMOTE_USER']; }
|
||||
|
||||
if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, "sso login: $username"); }
|
||||
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, "sso login: $username"); }
|
||||
|
||||
$ldap = new LDAP(LDAP_HOST, LDAP_HELPER_DN, LDAP_HELPER_PASSWORD);
|
||||
|
||||
@ -455,7 +455,7 @@ class ModelUserAuth extends Model {
|
||||
$username = strtolower(preg_replace("/^smtp\:/i", "", $username));
|
||||
|
||||
if($username == '') {
|
||||
syslog(LOG_INFO, "no email address found for " . $a['dn']);
|
||||
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, "no email address found for " . $a['dn']); }
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user