diff --git a/README.md b/README.md index d650542..179ac0b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This is only a **development version**. |CLI Installation|:heavy_check_mark:||| |Translation|||:x:| |User managament|||:x:| -|Logs||:clock8:|| +|Logs|:heavy_check_mark:||| |Graphs|||:x:| |Images||:clock8:|| diff --git a/server/core.php b/server/core.php index 0539977..6d55c63 100644 --- a/server/core.php +++ b/server/core.php @@ -335,6 +335,7 @@ class user{ die('Too many requests'); } if($this->auth->isLoggedIn()){ + $this->log("Login", $this->auth->getUserId(), $this->auth->getUserId(), date("d/m/Y"), date("H:i.s")); $user = $this->database->exec("SELECT * FROM `%PREFIX%_profiles` WHERE id = :id;", true, [":id" => $this->auth->getUserId()]); if(!empty($user)){ if(is_null($user[0]["name"])){ @@ -363,6 +364,7 @@ class user{ public function logout(){ try { + $this->log("Logout", $this->auth->getUserId(), $this->auth->getUserId(), date("d/m/Y"), date("H:i.s")); $this->auth->destroySession(); } catch (\Delight\Auth\NotLoggedInException $e) { diff --git a/server/risorse/ajax/ajax_log.php b/server/risorse/ajax/ajax_log.php index 31814df..11876d5 100644 --- a/server/risorse/ajax/ajax_log.php +++ b/server/risorse/ajax/ajax_log.php @@ -3,7 +3,7 @@ include_once("../../core.php"); init_class(); $user->requirelogin(); -$risultato = $database->exec("SELECT * FROM `%PREFIX%_log`", true); +$risultato = $database->exec("SELECT * FROM `%PREFIX%_log` ORDER BY `date` DESC, `time` DESC", true); $hidden = $user->hidden(); ?> @@ -80,8 +80,8 @@ select::-ms-expand { name(), $hidden)){ - echo "" . $row["azione"] . "" . $user->nameById($row["subisce"]) . "" . $user->nameById($row["agisce"]) ."" . $row['data'] . " - ore " . $row['ora'] . ""; + if(!in_array($row['changed'], $hidden) OR in_array($user->name(), $hidden)){ + echo "" . $row["action"] . "" . $user->nameById($row["changed"]) . "" . $user->nameById($row["editor"]) ."" . $row['date'] . " - ore " . $row['time'] . ""; } }