Advanced logs

This commit is contained in:
Matteo Gheza 2020-05-30 13:22:52 +02:00
parent 022a864eb4
commit 22f0904196
3 changed files with 6 additions and 4 deletions

View File

@ -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:||

View File

@ -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) {

View File

@ -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 {
<tbody>
<?php
foreach($risultato as $row){
if(!in_array($row['subisce'], $hidden) OR in_array($user->name(), $hidden)){
echo "<tr><td>" . $row["azione"] . "</td><td>" . $user->nameById($row["subisce"]) . "</td><td>" . $user->nameById($row["agisce"]) ."</td><td>" . $row['data'] . " - ore " . $row['ora'] . "</tr>";
if(!in_array($row['changed'], $hidden) OR in_array($user->name(), $hidden)){
echo "<tr><td>" . $row["action"] . "</td><td>" . $user->nameById($row["changed"]) . "</td><td>" . $user->nameById($row["editor"]) ."</td><td>" . $row['date'] . " - ore " . $row['time'] . "</tr>";
}
}