mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-13 14:51:01 +00:00
For incremental refactor + some credits
This commit is contained in:
+9
-10
@@ -4,16 +4,15 @@ use App\Entity\User;
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Project: TravianZ ##
|
## Project: TravianZ ##
|
||||||
## Version: 22.06.2015 ##
|
## Version: 18.05.2026 ##
|
||||||
## Filename Account.php ##
|
## Filename: Account.php ##
|
||||||
## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ##
|
## Developed by: Dzoki ##
|
||||||
## Fixed by: Shadow - STARVATION , HERO FIXED COMPL. ##
|
## Refactored by: Shadow ##
|
||||||
## Fixed by: InCube - double troops ##
|
## License: TravianZ Project ##
|
||||||
## License: TravianZ Project ##
|
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
||||||
## Copyright: TravianZ (c) 2010-2015. All rights reserved. ##
|
## URLs: https://travianz.org ##
|
||||||
## URLs: http://travian.shadowss.ro ##
|
## https://github.com/Shadowss/TravianZ ##
|
||||||
## Source code: https://github.com/Shadowss/TravianZ ##
|
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
## Refactor by: Shadow ##
|
## Refactor by: Shadow ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
||||||
## URLs: http://travian.shadowss.ro ##
|
## URLs: https://travianz.org ##
|
||||||
## Source code: https://github.com/Shadowss/TravianZ ##
|
## https://github.com/Shadowss/TravianZ ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
## URLs: http://travian.shadowss.ro ##
|
## URLs: https://travianz.org ##
|
||||||
## https://github.com/Shadowss/TravianZ ##
|
## https://github.com/Shadowss/TravianZ ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
||||||
## ##
|
## ##
|
||||||
## URLs: http://travian.shadowss.ro ##
|
## URLs: https://travianz.org ##
|
||||||
## https://github.com/Shadowss/TravianZ ##
|
## https://github.com/Shadowss/TravianZ ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
|
|||||||
+41
-20
@@ -5,7 +5,14 @@
|
|||||||
## --------------------------------------------------------------------------- ##
|
## --------------------------------------------------------------------------- ##
|
||||||
## Filename Form.php ##
|
## Filename Form.php ##
|
||||||
## License: TravianZ Project ##
|
## License: TravianZ Project ##
|
||||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
||||||
|
## Refactored by: Shadow ##
|
||||||
|
## ##
|
||||||
|
## Refactor: Incremental cleanup (compatibility preserved) ##
|
||||||
|
## Notes: PHP 7+ / legacy safe ##
|
||||||
|
## ##
|
||||||
|
## URLs: http://travian.shadowss.ro ##
|
||||||
|
## https://github.com/Shadowss/TravianZ ##
|
||||||
## ##
|
## ##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
@@ -13,63 +20,77 @@ class Form {
|
|||||||
|
|
||||||
private $errorarray = array();
|
private $errorarray = array();
|
||||||
public $valuearray = array();
|
public $valuearray = array();
|
||||||
private $errorcount;
|
private $errorcount = 0;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
if(isset($_SESSION['errorarray']) && isset($_SESSION['valuearray'])) {
|
|
||||||
|
if (isset($_SESSION['errorarray']) && isset($_SESSION['valuearray'])) {
|
||||||
|
|
||||||
$this->errorarray = $_SESSION['errorarray'];
|
$this->errorarray = $_SESSION['errorarray'];
|
||||||
$this->valuearray = $_SESSION['valuearray'];
|
$this->valuearray = $_SESSION['valuearray'];
|
||||||
$this->errorcount = count($this->errorarray);
|
$this->errorcount = count($this->errorarray);
|
||||||
|
|
||||||
unset($_SESSION['errorarray']);
|
unset($_SESSION['errorarray'], $_SESSION['valuearray']);
|
||||||
unset($_SESSION['valuearray']);
|
} else {
|
||||||
|
$this->errorcount = 0;
|
||||||
}
|
}
|
||||||
else $this->errorcount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addError($field,$error) {
|
public function addError($field, $error) {
|
||||||
|
|
||||||
$this->errorarray[$field] = $error;
|
$this->errorarray[$field] = $error;
|
||||||
$this->errorcount = count($this->errorarray);
|
$this->errorcount = count($this->errorarray);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getError($field) {
|
public function getError($field) {
|
||||||
if(array_key_exists($field,$this->errorarray)) {
|
|
||||||
|
if (array_key_exists($field, $this->errorarray)) {
|
||||||
return $this->errorarray[$field];
|
return $this->errorarray[$field];
|
||||||
}
|
}
|
||||||
else return "";
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getValue($field) {
|
public function getValue($field) {
|
||||||
if(array_key_exists($field,$this->valuearray)) {
|
|
||||||
|
if (array_key_exists($field, $this->valuearray)) {
|
||||||
return $this->valuearray[$field];
|
return $this->valuearray[$field];
|
||||||
}
|
}
|
||||||
else return "";
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setValue($field, $value) {
|
public function setValue($field, $value) {
|
||||||
$this->valuearray[$field] = $value;
|
|
||||||
|
$this->valuearray[$field] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDiff($field,$cookie) {
|
public function getDiff($field, $cookie) {
|
||||||
if(array_key_exists($field,$this->valuearray) && $this->valuearray[$field] != $cookie) {
|
|
||||||
|
if (array_key_exists($field, $this->valuearray) && $this->valuearray[$field] != $cookie) {
|
||||||
return $this->valuearray[$field];
|
return $this->valuearray[$field];
|
||||||
}
|
}
|
||||||
else return $cookie;
|
|
||||||
|
return $cookie;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRadio($field,$value) {
|
public function getRadio($field, $value) {
|
||||||
if(array_key_exists($field,$this->valuearray) && $this->valuearray[$field] == $value) {
|
|
||||||
|
if (array_key_exists($field, $this->valuearray) && $this->valuearray[$field] == $value) {
|
||||||
return "checked";
|
return "checked";
|
||||||
}
|
}
|
||||||
else return "";
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function returnErrors() {
|
public function returnErrors() {
|
||||||
|
|
||||||
return $this->errorcount;
|
return $this->errorcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getErrors() {
|
public function getErrors() {
|
||||||
|
|
||||||
return $this->errorarray;
|
return $this->errorarray;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user