From f4c56612d9a9b29c02ac111a5f7e89545f32826e Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 18 Mar 2018 17:32:42 +0000 Subject: [PATCH] Added audit info to user creation operation. --- WEB-INF/lib/ttUserHelper.class.php | 7 +++++-- WEB-INF/templates/footer.tpl | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/WEB-INF/lib/ttUserHelper.class.php b/WEB-INF/lib/ttUserHelper.class.php index 8dceed83..f8680d9f 100644 --- a/WEB-INF/lib/ttUserHelper.class.php +++ b/WEB-INF/lib/ttUserHelper.class.php @@ -109,6 +109,7 @@ class ttUserHelper { // insert - inserts a user into database. static function insert($fields, $hash = true) { + global $user; $mdb2 = getConnection(); $password = $mdb2->quote($fields['password']); @@ -123,10 +124,12 @@ class ttUserHelper { $status_f = ', status'; $status_v = ', '.$mdb2->quote($fields['status']); } + $created_ip_v = ', '.$mdb2->quote($_SERVER['REMOTE_ADDR']); + $created_by_v = ', '.$mdb2->quote($user->id); - $sql = "insert into tt_users (name, login, password, team_id, role_id, client_id, rate, email $status_f) values (". + $sql = "insert into tt_users (name, login, password, team_id, role_id, client_id, rate, email, created, created_ip, created_by $status_f) values (". $mdb2->quote($fields['name']).", ".$mdb2->quote($fields['login']). - ", $password, $team_id, ".$mdb2->quote($fields['role_id']).", ".$mdb2->quote($fields['client_id']).", $rate, ".$mdb2->quote($email)." $status_v)"; + ", $password, $team_id, ".$mdb2->quote($fields['role_id']).", ".$mdb2->quote($fields['client_id']).", $rate, ".$mdb2->quote($email).", now() $created_ip_v $created_by_v $status_v)"; $affected = $mdb2->exec($sql); // Now deal with project assignment. diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 776d899c..4758cc71 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.53.4100 | Copyright © Anuko | +  Anuko Time Tracker 1.17.54.4101 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1