mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Fixes
This commit is contained in:
parent
0997ee1ca9
commit
1ef08ae1b7
3 changed files with 9 additions and 4 deletions
|
@ -131,5 +131,10 @@ abstract class DBEntity
|
||||||
$this->changes = [];
|
$this->changes = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTableName(): string
|
||||||
|
{
|
||||||
|
return $this->getTable()->getName();
|
||||||
|
}
|
||||||
|
|
||||||
use \Nette\SmartObject;
|
use \Nette\SmartObject;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Logs
|
||||||
return $this->toLog($this->logs->get($id));
|
return $this->toLog($this->logs->get($id));
|
||||||
}
|
}
|
||||||
|
|
||||||
function create(int $user, string $table, string $model, int $type, $object, $changes): void
|
function create(int $user, string $table, string $model, int $type, $object, $changes, ?string $ip = NULL, ?string $useragent = NULL): void
|
||||||
{
|
{
|
||||||
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["logs"] === true) {
|
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["logs"] === true) {
|
||||||
$fobject = (is_array($object) ? $object : $object->unwrap());
|
$fobject = (is_array($object) ? $object : $object->unwrap());
|
||||||
|
@ -65,8 +65,8 @@ class Logs
|
||||||
$log->setXdiff_Old(json_encode($nobject));
|
$log->setXdiff_Old(json_encode($nobject));
|
||||||
$log->setXdiff_New(json_encode($_changes));
|
$log->setXdiff_New(json_encode($_changes));
|
||||||
$log->setTs(time());
|
$log->setTs(time());
|
||||||
$log->setIp(CurrentUser::i()->getIP());
|
$log->setIp($ip ?? CurrentUser::i()->getIP());
|
||||||
$log->setUserAgent(CurrentUser::i()->getUserAgent());
|
$log->setUserAgent($useragent ?? CurrentUser::i()->getUserAgent());
|
||||||
$log->save();
|
$log->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->authenticator->authenticate($chUser->getId());
|
$this->authenticator->authenticate($chUser->getId());
|
||||||
(new Logs)->create($user->getId(), "profiles", "openvk\\Web\\Models\\Entities\\User", 0, $user, $user);
|
(new Logs)->create($user->getId(), "profiles", "openvk\\Web\\Models\\Entities\\User", 0, $user, $user, $_SERVER["REMOTE_ADDR"], $_SERVER["HTTP_USER_AGENT"]);
|
||||||
$this->redirect("/id" . $user->getId());
|
$this->redirect("/id" . $user->getId());
|
||||||
$user->save();
|
$user->save();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue