Clear some dead code!

Clear some dead code!
This commit is contained in:
novgorodschi catalin
2026-08-03 07:51:50 +03:00
parent aeccc54cb9
commit 613d800e29
16 changed files with 123 additions and 67 deletions
+1 -2
View File
@@ -143,8 +143,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
tz_config_set($text, '%ANAME%', ADMIN_NAME);
tz_config_set($text, '%ASUPPMSGS%', $SUPPORT_MSGS_IN_ADMIN);
tz_config_set($text, '%ARAIDS%', $ADMINS_RAIDABLE);
tz_config_set($text, '%UTRACK%', "TRACK_USR"); // not in use, text only in a comment
tz_config_set($text, '%UTOUT%', "USER_TIMEOUT"); // not in use, text only in a comment
tz_config_set($text, '%DOMAIN%', DOMAIN);
tz_config_set($text, '%HOMEPAGE%', HOMEPAGE);
tz_config_set($text, '%SERVER%', SERVER);
+1 -2
View File
@@ -127,8 +127,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
tz_config_set($text, '%ANAME%', ADMIN_NAME);
tz_config_set($text, '%ASUPPMSGS%', $SUPPORT_MSGS_IN_ADMIN);
tz_config_set($text, '%ARAIDS%', $ADMINS_RAIDABLE);
tz_config_set($text, '%UTRACK%', "TRACK_USR"); // not in use, text only in a comment
tz_config_set($text, '%UTOUT%', "USER_TIMEOUT"); // not in use, text only in a comment
tz_config_set($text, '%DOMAIN%', DOMAIN);
tz_config_set($text, '%HOMEPAGE%', HOMEPAGE);
tz_config_set($text, '%SERVER%', SERVER);
+1 -2
View File
@@ -128,8 +128,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
tz_config_set($text, '%ANAME%', ADMIN_NAME);
tz_config_set($text, '%ASUPPMSGS%', $SUPPORT_MSGS_IN_ADMIN);
tz_config_set($text, '%ARAIDS%', $ADMINS_RAIDABLE);
tz_config_set($text, '%UTRACK%', "TRACK_USR"); // not in use, text only in a comment
tz_config_set($text, '%UTOUT%', "USER_TIMEOUT"); // not in use, text only in a comment
tz_config_set($text, '%DOMAIN%', DOMAIN);
tz_config_set($text, '%HOMEPAGE%', HOMEPAGE);
tz_config_set($text, '%SERVER%', SERVER);
+17 -2
View File
@@ -124,6 +124,22 @@ $text = admin_config_template_contents(array(
));
tz_config_set($text, '%ERRORREPORT%', $_POST['error'] ?? '');
tz_config_set($text, '%ERROR%', $_POST['error'] ?? '', 'code');
// Regulile de inregistrare
tz_config_set($text, '%USRNMSPECIAL%',
(isset($_POST['usrnm_special']) && $_POST['usrnm_special'] === 'false') ? 'false' : 'true');
$uMin = isset($_POST['usrnm_min']) ? (int) $_POST['usrnm_min'] : 3;
if ($uMin < 1 || $uMin > 50) { $uMin = 3; }
tz_config_set($text, '%USRNMMIN%', $uMin);
$uMax = isset($_POST['usrnm_max']) ? (int) $_POST['usrnm_max'] : 15;
if ($uMax < $uMin || $uMax > 100) { $uMax = max(15, $uMin); }
tz_config_set($text, '%USRNMMAX%', $uMax);
$pMin = isset($_POST['pw_min']) ? (int) $_POST['pw_min'] : 4;
if ($pMin < 1 || $pMin > 100) { $pMin = 4; }
tz_config_set($text, '%PWMIN%', $pMin);
tz_config_set($text, '%SERVERNAME%', $_POST['servername'] ?? '');
// Fusul orar se scrie intr-un fisier PHP (define("TIMEZONE","...")), deci
// valoarea NU are voie sa ajunga acolo nefiltrata: pana acum $_POST['tzone']
@@ -224,8 +240,7 @@ $text = admin_config_template_contents(array(
tz_config_set($text, '%ASUPPMSGS%', $SUPPORT_MSGS_IN_ADMIN);
tz_config_set($text, '%ARAIDS%', $ADMINS_RAIDABLE);
tz_config_set($text, '%ANAME%', ADMIN_NAME);
tz_config_set($text, '%UTRACK%', "");
tz_config_set($text, '%UTOUT%', "");
tz_config_set($text, '%DOMAIN%', DOMAIN);
tz_config_set($text, '%HOMEPAGE%', HOMEPAGE);
tz_config_set($text, '%SERVER%', SERVER);
@@ -92,15 +92,7 @@ trait AutomationAccountMaintenance {
}
}
private function ClearInactive() {
global $database;
if(TRACK_USR) {
$timeout = time()-USER_TIMEOUT * 60;
$q = "DELETE FROM ".TB_PREFIX."active WHERE timestamp < $timeout";
$database->query($q);
}
}
private function checkInvitedPlayes() {
global $database;
+10 -16
View File
@@ -462,17 +462,6 @@ trait DatabaseUserQueries {
return mysqli_query($this->dblink,$q);
}
function addActiveUser($username, $time) {
list($username, $time) = $this->escape_input($username, $time);
$q = "REPLACE into " . TB_PREFIX . "active values ('$username',$time)";
if(mysqli_query($this->dblink,$q)) {
return true;
} else {
return false;
}
}
function updateActiveUser($username, $time) {
static $updated = false;
@@ -482,15 +471,20 @@ trait DatabaseUserQueries {
list($username, $time) = $this->escape_input($username, $time);
$res1 = $this->addActiveUser($username, $time);
// Marcam ultima activitate DOAR in users.timestamp.
//
// Exista si o tabela separata "active" care tinea aceeasi informatie,
// dar era citita de o singura pagina din panou, iar users.timestamp e
// oricum sursa pentru lista de jucatori online, harta de caldura si
// stergerea conturilor inactive. Tabela a fost eliminata.
$q = "UPDATE " . TB_PREFIX . "users set timestamp = $time where username = '$username'";
$res2 = mysqli_query($this->dblink,$q);
if($res1 && $res2) {
if (mysqli_query($this->dblink, $q)) {
$updated = true;
return true;
} else {
return false;
}
return false;
}
function submitProfile($uid, $gender, $location, $birthday, $desc1, $desc2) {
+10
View File
@@ -4318,3 +4318,13 @@ tz_def('TZ_WS_VS_NATARS', 'Against Natars');
// MESAJ DE SISTEM - previzualizare
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('ADM_PREVIEW', 'Preview');
//////////////////////////////////////////////////////////////////////////////////////////////////////
// REGULI DE INREGISTRARE (Server Configuration)
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('CONF_SERV_USRNM_MIN', 'Minimum username length');
tz_def('CONF_SERV_USRNM_MAX', 'Maximum username length');
tz_def('CONF_SERV_PW_MIN', 'Minimum password length');
tz_def('CONF_SERV_USRNM_SPECIAL', 'Allow . - _ in usernames');
tz_def('CONF_SERV_USRNM_SPECIAL_TOOLTIP', 'With True, usernames may contain a dot, hyphen or underscore, and single spaces between words. With False, only letters and digits are accepted.');
tz_def('CONF_SERV_REGRULES_TOOLTIP', 'Rules checked when a player registers. Changing them does not affect existing accounts.');
+10
View File
@@ -4261,3 +4261,13 @@ tz_def('TZ_WS_VS_NATARS', 'Contre les Natars');
// MESAJ DE SISTEM - previzualizare
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('ADM_PREVIEW', 'Aperçu');
//////////////////////////////////////////////////////////////////////////////////////////////////////
// REGULI DE INREGISTRARE (Server Configuration)
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('CONF_SERV_USRNM_MIN', 'Longueur minimale du nom');
tz_def('CONF_SERV_USRNM_MAX', 'Longueur maximale du nom');
tz_def('CONF_SERV_PW_MIN', 'Longueur minimale du mot de passe');
tz_def('CONF_SERV_USRNM_SPECIAL', 'Autoriser . - _ dans les noms');
tz_def('CONF_SERV_USRNM_SPECIAL_TOOLTIP', 'Avec True, les noms peuvent contenir un point, un tiret ou un underscore, et des espaces simples entre les mots. Avec False, seules les lettres et les chiffres sont acceptes.');
tz_def('CONF_SERV_REGRULES_TOOLTIP', 'Regles verifiees lors de l\'inscription. Les modifier n\'affecte pas les comptes existants.');
+10
View File
@@ -4058,3 +4058,13 @@ tz_def('TZ_WS_VS_NATARS', 'Contra Natarilor');
// MESAJ DE SISTEM - previzualizare
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('ADM_PREVIEW', 'Previzualizare');
//////////////////////////////////////////////////////////////////////////////////////////////////////
// REGULI DE INREGISTRARE (Server Configuration)
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('CONF_SERV_USRNM_MIN', 'Lungimea minima a numelui');
tz_def('CONF_SERV_USRNM_MAX', 'Lungimea maxima a numelui');
tz_def('CONF_SERV_PW_MIN', 'Lungimea minima a parolei');
tz_def('CONF_SERV_USRNM_SPECIAL', 'Permite . - _ in nume');
tz_def('CONF_SERV_USRNM_SPECIAL_TOOLTIP', 'Cu True, numele pot contine punct, liniuta sau underscore, si spatii simple intre cuvinte. Cu False, se accepta doar litere si cifre.');
tz_def('CONF_SERV_REGRULES_TOOLTIP', 'Reguli verificate la inregistrare. Schimbarea lor nu afecteaza conturile existente.');
+5 -1
View File
@@ -106,7 +106,11 @@ function __construct() {
$this->logged_in = $this->checkLogin();
if ($this->logged_in && TRACK_USR) {
// users.timestamp nu mai e optional: din el se scot lista de jucatori
// online, harta de caldura si stergerea conturilor inactive. Inainte era
// in spatele lui TRACK_USR - cu flagul stins, stergerea automata ar fi
// considerat TOTI jucatorii inactivi.
if ($this->logged_in) {
$database->updateActiveUser($this->username, $this->time);
}