This commit is contained in:
2023-11-02 15:57:39 +02:00
parent a14232a899
commit def933dca4
51 changed files with 8866 additions and 12429 deletions

View File

@@ -14,6 +14,31 @@ class ActionModel
$this->uid = $uid;
}
public static function new(array $user, string $vals, string $vars, int $time = 0)
{
if (!$time) {
$time = time();
}
Db::sql(
'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,?,?,?,?,?,?,?)',
[
$user['id'],
$time,
$user['city'],
$user['room'],
$vars,
UserIp::get(),
$vals,
'',
]
);
}
public static function getAll(string $filter = ''): array
{
return Db::getRows('select * from actions');
}
public function getByVals(string $vals)
{
return Db::getRow('select * from actions where uid = ? and vals = ?', [$this->uid, $vals]);
@@ -40,30 +65,18 @@ class ActionModel
Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]);
}
public static function new(array $user, string $vals, string $vars, int $time = 0)
/*protected function testAction($filter, $tp): array
{
if (!$time) {
$time = time();
if ($tp == 1) {
$query = 'select * from actions where ' . $filter;
} elseif ($tp == 2) {
$query = 'select count(*) from actions where ' . $filter;
} else {
return [];
}
Db::sql(
'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,?,?,?,?,?,?,?)',
[
$user['id'],
$time,
$user['city'],
$user['room'],
$vars,
UserIp::get(),
$vals,
'',
]
);
}
public static function getAll(string $filter = ''): array
{
return Db::getRows('select * from actions');
}
$arr = mysql_fetch_array(mysql_query($query));
return !empty($arr) ? $arr : [];
}*/
}