mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-29 14:47:14 +00:00
Fix admin log addVillage
Fix admin log addVillage
This commit is contained in:
@@ -178,24 +178,50 @@ class adm_DB {
|
|||||||
return $r['id'];
|
return $r['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddVillage($post) {
|
function AddVillage($post) {
|
||||||
global $database;
|
global $database;
|
||||||
$wid = $this->getWref($post['x'], $post['y']);
|
|
||||||
$uid = (int)$post['uid'];
|
$wid = $this->getWref($post['x'], $post['y']);
|
||||||
$status = $database->getVillageState($wid);
|
$uid = (int)$post['uid'];
|
||||||
$status = 0;
|
$status = $database->getVillageState($wid);
|
||||||
if ($status == 0) {
|
$status = 0;
|
||||||
mysqli_query($this->connection, "INSERT INTO ". TB_PREFIX. "admin_log VALUES (0,". (int)$_SESSION['id']. ",'Added new village <b><a href=\'admin.php?p=village&did=$wid\'>$wid</a></b> to user <b><a href=\'admin.php?p=player&uid=$uid\'>$uid</a></b>',". time(). ")");
|
|
||||||
$database->setFieldTaken($wid);
|
if ($status == 0) {
|
||||||
$username = $database->getUserArray($uid, 1);
|
$database->setFieldTaken($wid);
|
||||||
$username = $username['username'];
|
|
||||||
$database->addVillage($wid, $uid, $username, '0');
|
$user = $database->getUserArray($uid, 1);
|
||||||
$database->addResourceFields($wid, $database->getVillageType($wid, false));
|
$username = $user['username'];
|
||||||
$database->addUnits($wid);
|
|
||||||
$database->addTech($wid);
|
$database->addVillage($wid, $uid, $username, '0');
|
||||||
$database->addABTech($wid);
|
$database->addResourceFields($wid, $database->getVillageType($wid, false));
|
||||||
|
$database->addUnits($wid);
|
||||||
|
$database->addTech($wid);
|
||||||
|
$database->addABTech($wid);
|
||||||
|
|
||||||
|
/* ---------------- Admin log ---------------- */
|
||||||
|
$villageName = $database->getVillageField($wid, 'name');
|
||||||
|
if (empty($villageName) || $villageName == '?') {
|
||||||
|
$villageName = $username . "'s village";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$villageNameSafe = htmlspecialchars($villageName, ENT_QUOTES, 'UTF-8');
|
||||||
|
$userNameSafe = htmlspecialchars($username, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
|
$logText = "Added new village <b><a href='admin.php?p=village&did=$wid'>$villageNameSafe</a></b> to user <b><a href='admin.php?p=player&uid=$uid'>$userNameSafe</a></b>";
|
||||||
|
$logEsc = $database->escape($logText);
|
||||||
|
|
||||||
|
mysqli_query(
|
||||||
|
$this->connection,
|
||||||
|
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`)
|
||||||
|
VALUES (
|
||||||
|
0,
|
||||||
|
" . (int)$_SESSION['id'] . ",
|
||||||
|
'$logEsc',
|
||||||
|
" . time() . "
|
||||||
|
)"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------- Pedepsire jucător ---------------- */
|
/* ---------------- Pedepsire jucător ---------------- */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user