lwb5-in-2025/scripts/game/main/account/library/terminate.inc

33 lines
702 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class main_account_terminate {
public function __construct($lib) {
2016-01-10 11:01:49 +01:00
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
function run($uid, $status, $reason = null) {
foreach (config::getGames() as $game) {
if ($game->name == 'main' || $game->status() == 'FINISHED') {
continue;
}
$lib = $game->getLib();
$pid = $lib->call('doesUserPlay', $uid);
if (is_null($pid)) {
continue;
}
$lib->call('leaveGame', $pid, $status);
}
$qs = is_null($reason) ? "" : (",reason='" . addslashes($reason) . "'");
$this->db->query("UPDATE account SET status='$status',quit_ts=NULL,vac_start=NULL$qs WHERE id=$uid");
$this->lib->call('log', $uid, 'q');
}
}
?>