diff --git a/e107_handlers/admin_log_class.php b/e107_handlers/admin_log_class.php index 0e45f10f7..6a957a977 100644 --- a/e107_handlers/admin_log_class.php +++ b/e107_handlers/admin_log_class.php @@ -415,12 +415,23 @@ class e_admin_log $time_usec = $time_usec * 1000000; + if(!is_numeric($event_type)) + { + $title = "User Audit Event-Type Failure: "; + $title .= (string) $event_type; + $debug = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,4); + $debug[0] = e_REQUEST_URI; + + $this->e_log_event(4, $debug[1]['file']."|".$debug[1]['function']."@".$debug[1]['line'], "USERAUDIT", $title, $debug, FALSE); + return false; + } + // See whether we should log this $user_logging_opts = e107::getConfig()->get('user_audit_opts'); if (!isset($user_logging_opts[$event_type])) // Finished if not set to log this event type { - return; + return false; } if($this->rldb == null) @@ -475,6 +486,7 @@ class e_admin_log $this->rldb->insert("audit_log", $insertQry); + return true; // $this->rldb->insert("audit_log", "0, ".intval($time_sec).', '.intval($time_usec).", '{$eventcode}', {$userid}, '{$userstring}', '{$userIP}', '{$title}', '{$detail}' "); } diff --git a/e107_handlers/login.php b/e107_handlers/login.php index 9d804288f..e68c5121e 100644 --- a/e107_handlers/login.php +++ b/e107_handlers/login.php @@ -336,6 +336,8 @@ class userlogin protected function lookupUser($username, $forceLogin) { $pref = e107::getPref(); + $log = e107::getLog(); + $maxLength = varset($pref['loginname_maxlength'],30); if(varset($pref['allowEmailLogin'])==1) // Email login only @@ -347,7 +349,7 @@ class userlogin if (!$forceLogin && (strlen($username) > $maxLength)) // Error - invalid username { $auditLog = array('reason'=>'username longer than maxlength', 'maxlength'=> $maxLength, 'username'=>$username); - e107::getAdminLog()->user_audit(USER_AUDIT_LOGIN, $auditLog, 0, $username); + $log->user_audit(USER_AUDIT_LOGIN, $auditLog, 0, $username); $this->invalidLogin($username,LOGIN_BAD_USERNAME); return FALSE; } @@ -357,7 +359,7 @@ class userlogin if (e107::getDb()->select('user', '*', $query) !== 1) // Handle duplicate emails as well // Invalid user { $auditLog = array('reason'=>'query failed to return a result', 'query'=>$query, 'username'=>$username); - e107::getAdminLog()->user_audit(USER_AUDIT_LOGIN, $auditLog, 0, $username); + $log->user_audit(USER_AUDIT_LOGIN, $auditLog, 0, $username); return $this->invalidLogin($username,LOGIN_BAD_USER); } @@ -411,6 +413,7 @@ class userlogin protected function checkUserPassword($username, $userpass, $response, $forceLogin) { $pref = e107::getPref(); + $log = e107::getAdminLog(); if($forceLogin === 'provider') return true; @@ -463,7 +466,7 @@ class userlogin ); - e107::getAdminLog()->user_audit(USER_AUDIT_LOGIN, $auditLog, $this->userData['user_id'], $this->userData['user_name']); + $log->user_audit(USER_AUDIT_LOGIN, $auditLog, $this->userData['user_id'], $this->userData['user_name']); if (($pass_result = $this->userMethods->CheckPassword($userpass,($this->lookEmail ? $this->userData['user_loginname'] : $username),$requiredPassword)) === PASSWORD_INVALID) {