log class
This commit is contained in:
parent
19e39dbefc
commit
9804bcb9e8
32
system/autoload/Log.php
Normal file
32
system/autoload/Log.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||||
|
* by https://t.me/ibnux
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
class Log{
|
||||||
|
public static function put($type, $description, $userid = '', $username = '')
|
||||||
|
{
|
||||||
|
$d = ORM::for_table('tbl_logs')->create();
|
||||||
|
$d->date = date('Y-m-d H:i:s');
|
||||||
|
$d->type = $type;
|
||||||
|
$d->description = $description;
|
||||||
|
$d->userid = $userid;
|
||||||
|
$d->ip = (empty($username)) ? $_SERVER["REMOTE_ADDR"] : $username;
|
||||||
|
$d->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function arrayToText($array, $start = '', $result = '')
|
||||||
|
{
|
||||||
|
foreach ($array as $k => $v) {
|
||||||
|
if (is_array($v)) {
|
||||||
|
$result = Log::arrayToText($v, "$start$k.", $result);
|
||||||
|
} else {
|
||||||
|
$result .= $start.$k ." : ". strval($v) ."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
@ -223,13 +223,7 @@ function _admin($login = true)
|
|||||||
|
|
||||||
function _log($description, $type = '', $userid = '0')
|
function _log($description, $type = '', $userid = '0')
|
||||||
{
|
{
|
||||||
$d = ORM::for_table('tbl_logs')->create();
|
Log::put($type, $description, $userid);
|
||||||
$d->date = date('Y-m-d H:i:s');
|
|
||||||
$d->type = $type;
|
|
||||||
$d->description = $description;
|
|
||||||
$d->userid = $userid;
|
|
||||||
$d->ip = $_SERVER["REMOTE_ADDR"];
|
|
||||||
$d->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Lang($key)
|
function Lang($key)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user