diff --git a/GameEngine/Database/DatabaseForumQueries.php b/GameEngine/Database/DatabaseForumQueries.php
index 81f6da1f..396c9465 100644
--- a/GameEngine/Database/DatabaseForumQueries.php
+++ b/GameEngine/Database/DatabaseForumQueries.php
@@ -29,7 +29,13 @@ trait DatabaseForumQueries {
* @return array Returns all user's shared forums
*/
- function getSharedForums($uid, $alliance){
+ function getSharedForums($uid, $alliance) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $uid = (int) $uid;
+ $alliance = (int) $alliance;
+
list($uid, $alliance) = $this->escape_input((int) $uid, (int) $alliance);
$allianceForums = $confForums = $closedForums = [];
@@ -108,7 +114,13 @@ trait DatabaseForumQueries {
* @return int Returns the total amount of the wanted forum
*/
- function countForums($forumArea, $ally){
+ function countForums($forumArea, $ally) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $forumArea = (int) $forumArea;
+ $ally = (int) $ally;
+
list($forumArea, $ally) = $this->escape_input((int) $forumArea, (int) $ally);
$q = "SELECT Count(*) as Total FROM ".TB_PREFIX."forum_cat WHERE ".($ally != -1 ? "alliance = $ally AND" : "")." forum_area = $forumArea";
@@ -118,6 +130,11 @@ trait DatabaseForumQueries {
// no need to refactor this method
function CheckForum($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input((int) $id);
$q = "SELECT Count(*) as Total FROM " . TB_PREFIX . "forum_cat where alliance = $id";
@@ -127,6 +144,11 @@ trait DatabaseForumQueries {
// no need to refactor this method
function CountCat($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "SELECT count(id) FROM " . TB_PREFIX . "forum_topic where cat = '$id'";
@@ -137,6 +159,11 @@ trait DatabaseForumQueries {
// no need to refactor this method
function LastTopic($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "SELECT * from " . TB_PREFIX . "forum_topic where cat = '$id' order by post_date";
@@ -145,6 +172,11 @@ trait DatabaseForumQueries {
}
function CheckLastTopic($id, $use_cache = true) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
// first of all, check if we should be using cache and whether the field
@@ -165,6 +197,11 @@ trait DatabaseForumQueries {
}
function CheckLastPost($id, $use_cache = true) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
// first of all, check if we should be using cache and whether the field
@@ -185,6 +222,11 @@ trait DatabaseForumQueries {
}
function LastPost($id, $use_cache = true) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
// first of all, check if we should be using cache and whether the field
@@ -201,6 +243,11 @@ trait DatabaseForumQueries {
}
function CountTopic($id, $use_cache = true) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
// first of all, check if we should be using cache and whether the field
@@ -223,6 +270,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function CountPost($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "SELECT count(id) FROM " . TB_PREFIX . "forum_post where topic = '$id'";
@@ -233,6 +285,12 @@ trait DatabaseForumQueries {
// no need to cache this method
function ForumCat($id, $mode = 0) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+ $mode = (int) $mode;
+
list($id, $mode) = $this->escape_input($id, $mode);
$q = "SELECT * from " . TB_PREFIX . "forum_cat where alliance = '$id' ".(!$mode ? "OR forum_area = 1" : "")." ORDER BY sorting DESC, id";
@@ -242,6 +300,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function ForumCatEdit($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "SELECT * from " . TB_PREFIX . "forum_cat where id = '$id'";
@@ -251,6 +314,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function ForumCatAlliance($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "SELECT alliance from " . TB_PREFIX . "forum_cat where id = $id LIMIT 1";
@@ -261,6 +329,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function ForumCatName($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "SELECT forum_name from " . TB_PREFIX . "forum_cat where id = $id LIMIT 1";
@@ -271,6 +344,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function CheckCatTopic($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "SELECT Count(*) as Total from " . TB_PREFIX . "forum_topic where cat = $id";
@@ -280,6 +358,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function CheckResultEdit($alli) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $alli = (int) $alli;
+
list($alli) = $this->escape_input($alli);
$q = "SELECT Count(*) as Total from " . TB_PREFIX . "forum_edit where alliance = $alli";
@@ -289,6 +372,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function CheckCloseTopic($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input((int) $id);
$q = "SELECT close from " . TB_PREFIX . "forum_topic where id = '$id' LIMIT 1";
@@ -298,6 +386,11 @@ trait DatabaseForumQueries {
}
function CheckEditRes($alli, $use_cache = true) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $alli = (int) $alli;
+
list($alli) = $this->escape_input($alli);
// first of all, check if we should be using cache and whether the field
@@ -315,6 +408,12 @@ trait DatabaseForumQueries {
}
function CreatResultEdit($alli, $result) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $alli = (int) $alli;
+ $result = (int) $result;
+
list($alli, $result) = $this->escape_input($alli, $result);
$q = "INSERT into " . TB_PREFIX . "forum_edit values (0,'$alli','$result')";
@@ -323,6 +422,12 @@ trait DatabaseForumQueries {
}
function UpdateResultEdit($alli, $result) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $alli = (int) $alli;
+ $result = (int) $result;
+
list($alli, $result) = $this->escape_input($alli, $result);
$date = time();
@@ -330,7 +435,15 @@ trait DatabaseForumQueries {
return mysqli_query($this->dblink,$q);
}
- function MoveForum($id, $area, $ally, $mode){
+ function MoveForum($id, $area, $ally, $mode) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+ $area = (int) $area;
+ $ally = (int) $ally;
+ $mode = (int) $mode;
+
list($id, $area, $ally, $mode) = $this->escape_input((int) $id, (int) $area, (int) $ally, $mode);
$q = "UPDATE
@@ -343,6 +456,12 @@ trait DatabaseForumQueries {
}
function UpdateEditTopic($id, $title, $cat) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+ $cat = (int) $cat;
+
list($id, $title, $cat) = $this->escape_input((int) $id, $title, $cat);
$q = "UPDATE " . TB_PREFIX . "forum_topic set title = '$title', cat = '$cat' where id = $id";
@@ -350,6 +469,11 @@ trait DatabaseForumQueries {
}
function UpdateEditForum($id, $name, $des, $alliances, $users) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id, $name, $des, $alliances, $users) = $this->escape_input((int) $id, $name, $des, $alliances, $users);
$q = "UPDATE " . TB_PREFIX . "forum_cat SET forum_name = '$name', forum_des = '$des', display_to_alliances = '$alliances', display_to_users = '$users' WHERE id = $id";
@@ -357,6 +481,12 @@ trait DatabaseForumQueries {
}
function StickTopic($id, $mode) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+ $mode = (int) $mode;
+
list($id, $mode) = $this->escape_input((int) $id, (int) $mode);
$q = "UPDATE " . TB_PREFIX . "forum_topic SET stick = $mode WHERE id = $id";
@@ -365,6 +495,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function ForumCatTopic($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "SELECT * from " . TB_PREFIX . "forum_topic where cat = '$id' AND stick = '' ORDER BY post_date desc";
@@ -374,6 +509,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function ForumCatTopicStick($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "SELECT * from " . TB_PREFIX . "forum_topic where cat = '$id' AND stick = '1' ORDER BY post_date desc";
@@ -383,6 +523,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function ShowTopic($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input((int) $id);
$q = "SELECT * from " . TB_PREFIX . "forum_topic where id = $id";
@@ -392,6 +537,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function ShowPost($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "SELECT * from " . TB_PREFIX . "forum_post where topic = '$id' ORDER BY id ASC";
@@ -401,6 +551,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function ShowPostEdit($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input((int) $id);
$q = "SELECT * from " . TB_PREFIX . "forum_post where id = $id";
@@ -409,6 +564,13 @@ trait DatabaseForumQueries {
}
function CreatForum($owner, $alli, $name, $des, $area, $alliances, $users) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $owner = (int) $owner;
+ $alli = (int) $alli;
+ $area = (int) $area;
+
list($owner, $alli, $name, $des, $area, $alliances, $users) = $this->escape_input($owner, $alli, $name, $des, $area, $alliances, $users);
$q = "INSERT into " . TB_PREFIX . "forum_cat values (0, 0,'$owner','$alli','$name','$des','$area','$alliances','$users')";
@@ -417,6 +579,14 @@ trait DatabaseForumQueries {
}
function CreatTopic($title, $post, $cat, $owner, $alli, $ends) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $cat = (int) $cat;
+ $owner = (int) $owner;
+ $alli = (int) $alli;
+ $ends = (int) $ends;
+
list($title, $post, $cat, $owner, $alli, $ends) = $this->escape_input($title, $post, (int) $cat, (int) $owner, (int) $alli, (int) $ends);
$date = time();
@@ -430,6 +600,12 @@ trait DatabaseForumQueries {
*************************/
function createSurvey($topic, $title, $option1, $option2, $option3, $option4, $option5, $option6, $option7, $option8, $ends) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $topic = (int) $topic;
+ $ends = (int) $ends;
+
list($topic, $title, $option1, $option2, $option3, $option4, $option5, $option6, $option7, $option8, $ends) = $this->escape_input($topic, $title, $option1, $option2, $option3, $option4, $option5, $option6, $option7, $option8, $ends);
$q = "INSERT into " . TB_PREFIX . "forum_survey (topic,title,option1,option2,option3,option4,option5,option6,option7,option8,ends) values ('$topic','$title','$option1','$option2','$option3','$option4','$option5','$option6','$option7','$option8','$ends')";
@@ -438,6 +614,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function getSurvey($topic) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $topic = (int) $topic;
+
list($topic) = $this->escape_input((int) $topic);
$q = "SELECT * FROM " . TB_PREFIX . "forum_survey where topic = $topic LIMIT 1";
@@ -447,6 +628,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function checkSurvey($topic) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $topic = (int) $topic;
+
list($topic) = $this->escape_input((int) $topic);
$q = "SELECT Count(*) as Total FROM " . TB_PREFIX . "forum_survey where topic = $topic";
@@ -460,6 +646,12 @@ trait DatabaseForumQueries {
}
function Vote($topic, $num, $text) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $topic = (int) $topic;
+ $num = (int) $num;
+
list($topic, $num, $text) = $this->escape_input((int) $topic, (int) $num, $text);
$q = "UPDATE " . TB_PREFIX . "forum_survey set vote".$num." = vote".$num." + 1, voted = '$text' where topic = ".$topic."";
@@ -468,6 +660,12 @@ trait DatabaseForumQueries {
// no need to cache this method
function checkVote($topic, $uid) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $topic = (int) $topic;
+ $uid = (int) $uid;
+
list( $topic, $uid ) = $this->escape_input( (int) $topic, $uid );
$q = "SELECT voted FROM " . TB_PREFIX . "forum_survey where topic = $topic LIMIT 1";
@@ -484,6 +682,11 @@ trait DatabaseForumQueries {
// no need to cache this method
function getVoteSum($topic) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $topic = (int) $topic;
+
list( $topic ) = $this->escape_input( (int) $topic );
$q = "SELECT * FROM " . TB_PREFIX . "forum_survey where topic = $topic LIMIT 1";
@@ -504,6 +707,13 @@ trait DatabaseForumQueries {
*************************/
function CreatPost($post, $tids, $owner, $fid2 = 0) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $tids = (int) $tids;
+ $owner = (int) $owner;
+ $fid2 = (int) $fid2;
+
global $message, $session;
list($post, $tids, $owner, $fid2) = $this->escape_input($post, (int) $tids, $owner, (int) $fid2);
@@ -546,6 +756,11 @@ trait DatabaseForumQueries {
}
function UpdatePostDate($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input((int) $id);
$date = time();
@@ -554,6 +769,11 @@ trait DatabaseForumQueries {
}
function EditUpdateTopic($id, $post) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id, $post) = $this->escape_input((int) $id, $post);
$q = "UPDATE " . TB_PREFIX . "forum_topic set post = '$post' where id = $id";
@@ -562,6 +782,11 @@ trait DatabaseForumQueries {
}
function EditUpdatePost($id, $post) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id, $post) = $this->escape_input((int) $id, $post);
$q = "UPDATE " . TB_PREFIX . "forum_post set post = '$post' where id = $id";
@@ -569,6 +794,12 @@ trait DatabaseForumQueries {
}
function LockTopic($id, $mode) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+ $mode = (int) $mode;
+
list($id, $mode) = $this->escape_input((int) $id, $mode);
$q = "UPDATE " . TB_PREFIX . "forum_topic set close = '$mode' where id = $id";
@@ -576,6 +807,11 @@ trait DatabaseForumQueries {
}
function DeleteCat($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$qs = "DELETE from " . TB_PREFIX . "forum_cat where id = '$id'";
@@ -595,6 +831,11 @@ trait DatabaseForumQueries {
}
function DeleteSurvey($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
if (!is_array($id)) {
$id = [$id];
}
@@ -608,6 +849,11 @@ trait DatabaseForumQueries {
}
function DeleteTopic($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$qs = "DELETE from " . TB_PREFIX . "forum_topic where id = '$id'";
@@ -615,6 +861,11 @@ trait DatabaseForumQueries {
}
function DeletePost($id) {
+ // Identificatorii intra in SQL fara ghilimele ("where id = $id"),
+ // iar mysqli_real_escape_string nu protejeaza contextul numeric.
+ // Conversia la intreg e singura care opreste "5 OR 1=1".
+ $id = (int) $id;
+
list($id) = $this->escape_input($id);
$q = "DELETE from " . TB_PREFIX . "forum_post where id = '$id'";
diff --git a/Templates/Alliance/alli_menu.tpl b/Templates/Alliance/alli_menu.tpl
index 2a6c11f7..22b3f768 100644
--- a/Templates/Alliance/alli_menu.tpl
+++ b/Templates/Alliance/alli_menu.tpl
@@ -1,15 +1,21 @@
ForumCatAlliance($_GET['fid']);
+ $aid = $database->ForumCatAlliance((int) $_GET['fid']);
} else if (isset($_GET['fid2']) && !empty($_GET['fid2'])) {
- $aid = $database->ForumCatAlliance($_GET['fid2']);
+ $aid = $database->ForumCatAlliance((int) $_GET['fid2']);
} else {
$aid = $session->alliance;
}
@@ -98,11 +117,11 @@ if (
isset($_POST['thema']) && !empty($_POST['thema']) &&
Alliance::canAct([
'aid' => $aid,
- 'alliance' => ($topic = reset($database->ShowTopic($_POST['tid'])))['alliance'],
+ 'alliance' => ($topic = reset($database->ShowTopic((int) $_POST['tid'])))['alliance'],
'forum_perm' => $opt['opt5'],
'admin' => $_GET['admin'],
'owner' => $topic['owner'],
- 'forum_owner' => ($forumData = reset($database->ForumCatEdit($_POST['fid'])))['owner']
+ 'forum_owner' => ($forumData = reset($database->ForumCatEdit((int) $_POST['fid'])))['owner']
], 1) &&
(
($forumData['forum_area'] != 1 &&
@@ -130,14 +149,14 @@ if (
isset($_POST['u1']) && !empty($_POST['u1']) &&
isset($_POST['u2']) && !empty($_POST['u2']) &&
(
- ($database->ForumCatAlliance($_POST['fid']) == $session->alliance && $opt['opt5'] == 1)
+ ($database->ForumCatAlliance((int) $_POST['fid']) == $session->alliance && $opt['opt5'] == 1)
|| $session->access == ADMIN
)
) {
$forumViewable['alliances'] = $forumViewable['users'] = "";
- $forumData = reset($database->ForumCatEdit($_POST['fid']));
+ $forumData = reset($database->ForumCatEdit((int) $_POST['fid']));
// visibility logic unchanged
if ($forumData['forum_area'] != 1) {
@@ -172,7 +191,7 @@ if (
!empty($_POST['thema']) && !empty($_POST['text']) && !empty($_POST['fid']) &&
(
(
- ($forumData = reset($database->ForumCatEdit($_POST['fid'])))['alliance'] == $session->alliance ||
+ ($forumData = reset($database->ForumCatEdit((int) $_POST['fid'])))['alliance'] == $session->alliance ||
$forumData['forum_area'] == 1 ||
$alliance->isForumAccessible($_POST['fid'])
) &&
@@ -240,12 +259,12 @@ if (
!empty($_POST['text']) && !empty($_POST['tid']) && !empty($_POST['fid2']) &&
(
(
- ($forumData = reset($database->ForumCatEdit($_POST['fid2'])))['alliance'] == $session->alliance ||
+ ($forumData = reset($database->ForumCatEdit((int) $_POST['fid2'])))['alliance'] == $session->alliance ||
$forumData['forum_area'] == 1 ||
$alliance->isForumAccessible($_POST['fid2'])
) &&
(
- ($forumData['forum_area'] != 3 && !reset($database->ShowTopic($_POST['tid']))['close'])
+ ($forumData['forum_area'] != 3 && !reset($database->ShowTopic((int) $_POST['tid']))['close'])
|| ($forumData['forum_area'] == 3 && $opt['opt5'] == 1)
)
)
@@ -274,7 +293,7 @@ if (
isset($_POST['tid']) && !empty($_POST['tid']) &&
Alliance::canAct([
'aid' => $aid,
- 'alliance' => ($topic = reset($database->ShowTopic($_POST['tid'])))['alliance'],
+ 'alliance' => ($topic = reset($database->ShowTopic((int) $_POST['tid'])))['alliance'],
'forum_perm' => $opt['opt5'],
'admin' => (!empty($_GET['admin']) ? $_GET['admin'] : ''),
'owner' => $topic['owner'],
@@ -303,7 +322,7 @@ if (
Alliance::canAct([
'aid' => $aid,
'alliance' => ($topic = reset($database->ShowTopic(
- ($post = reset($database->ShowPostEdit($_POST['pod'])))['topic']
+ ($post = reset($database->ShowPostEdit((int) $_POST['pod'])))['topic']
)))['alliance'],
'forum_perm' => $opt['opt5'],
'owner' => $post['owner'],
@@ -343,13 +362,13 @@ if (
$_GET['admin'] == "pos" &&
isset($_GET['res'], $_GET['fid']) && !empty($_GET['fid']) &&
(
- ($database->ForumCatAlliance($_GET['fid']) == $session->alliance && $opt['opt5'] == 1) ||
- ($forumData = reset($database->ForumCatEdit($_GET['fid'])))['owner'] == $session->uid
+ ($database->ForumCatAlliance((int) $_GET['fid']) == $session->alliance && $opt['opt5'] == 1) ||
+ ($forumData = reset($database->ForumCatEdit((int) $_GET['fid'])))['owner'] == $session->uid
&& $session->access == ADMIN
)
) {
- $database->moveForum($_GET['fid'], $forumData['forum_area'], $session->alliance, $_GET['res']);
+ $database->moveForum((int) $_GET['fid'], $forumData['forum_area'], $session->alliance, $_GET['res']);
$alliance->redirect($_GET);
}
@@ -421,14 +440,14 @@ elseif (
isset($_GET['idf']) && !empty($_GET['idf']) &&
(
(
- ($database->ForumCatAlliance($_GET['idf']) == $session->alliance && $opt['opt5'] == 1) ||
- ($forumData = reset($database->ForumCatEdit($_GET['idf'])))['owner'] == $session->uid
+ ($database->ForumCatAlliance((int) $_GET['idf']) == $session->alliance && $opt['opt5'] == 1) ||
+ ($forumData = reset($database->ForumCatEdit((int) $_GET['idf'])))['owner'] == $session->uid
) ||
($forumData['alliance'] == 0 && $session->access == ADMIN)
)
) {
- $database->DeleteCat($_GET['idf']);
+ $database->DeleteCat((int) $_GET['idf']);
$alliance->redirect($_GET);
}
@@ -442,15 +461,15 @@ elseif (
!empty($_GET['pod']) && !empty($_GET['tid']) && !empty($_GET['fid2']) &&
Alliance::canAct([
'aid' => $aid,
- 'alliance' => reset($database->ShowTopic($_GET['tid']))['alliance'],
+ 'alliance' => reset($database->ShowTopic((int) $_GET['tid']))['alliance'],
'forum_perm' => $opt['opt5'],
- 'owner' => reset($database->ShowPostEdit($_GET['pod']))['owner'],
+ 'owner' => reset($database->ShowPostEdit((int) $_GET['pod']))['owner'],
'admin' => $_GET['admin'],
- 'forum_owner' => reset($database->ForumCatEdit($_GET['fid2']))['owner']
+ 'forum_owner' => reset($database->ForumCatEdit((int) $_GET['fid2']))['owner']
], 1)
) {
- $database->DeletePost($_GET['pod']);
+ $database->DeletePost((int) $_GET['pod']);
header("Location: allianz.php?s=2&fid2=".$_GET['fid2']."&tid=".$_GET['tid']);
exit;
@@ -467,11 +486,11 @@ elseif ($_GET['admin'] == "editpost" &&
!empty($_GET['pod']) && !empty($_GET['tid']) && !empty($_GET['fid']) &&
Alliance::canAct([
'aid' => $aid,
- 'alliance' => reset($database->ShowTopic($_GET['tid']))['alliance'],
+ 'alliance' => reset($database->ShowTopic((int) $_GET['tid']))['alliance'],
'forum_perm' => $opt['opt5'],
- 'owner' => reset($database->ShowPostEdit($_GET['pod']))['owner'],
+ 'owner' => reset($database->ShowPostEdit((int) $_GET['pod']))['owner'],
'admin' => $_GET['admin'],
- 'forum_owner' => reset($database->ForumCatEdit($_GET['fid']))['owner']
+ 'forum_owner' => reset($database->ForumCatEdit((int) $_GET['fid']))['owner']
], 1)
) include("Forum/forum_10.tpl");
diff --git a/Templates/Alliance/index.php b/Templates/Alliance/index.php
index 9fcb4aed..dab55142 100644
--- a/Templates/Alliance/index.php
+++ b/Templates/Alliance/index.php
@@ -1,11 +1,21 @@
generateRandStr(6);
// --- 1. Normalizare trupe t1..t11 (păstrăm exact logica originală) ---
diff --git a/Templates/a2b/index.php b/Templates/a2b/index.php
index 9fcb4aed..16009bf1 100644
--- a/Templates/a2b/index.php
+++ b/Templates/a2b/index.php
@@ -2,10 +2,20 @@
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
-## Filename index.php ##
-## Developed by: aggenkeech ##
-## License: TravianZ Project ##
-## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
+## Filename : index.php ##
+## Type : Directory Access Guard ##
+## --------------------------------------------------------------------------- ##
+## Developed by : aggenkeech ##
+## Refactored by : Shadow ##
+## --------------------------------------------------------------------------- ##
+## Contact : cata7007@gmail.com ##
+## Project : TravianZ ##
+## URLs: : https://travianz.org ##
+## GitHub : https://github.com/Shadowss/TravianZ ##
+## --------------------------------------------------------------------------- ##
+## License : TravianZ Project ##
+## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
+## --------------------------------------------------------------------------- ##
#################################################################################
// prevent direct misuse in weird contexts (optional but safe)
diff --git a/Templates/a2b/newdorf.tpl b/Templates/a2b/newdorf.tpl
index 02506546..9eb17ec9 100644
--- a/Templates/a2b/newdorf.tpl
+++ b/Templates/a2b/newdorf.tpl
@@ -1,4 +1,23 @@
unitarray['u' . $session->tribe . '0'] ?? 0);
diff --git a/Templates/a2b/search.tpl b/Templates/a2b/search.tpl
index 3b9a0aef..aa58337f 100644
--- a/Templates/a2b/search.tpl
+++ b/Templates/a2b/search.tpl
@@ -1,4 +1,23 @@
getVillage($enforce['from']);
$fromcoor = $database->getCoor($enforce['from']);
$tocoor = $database->getCoor($enforce['vref']);
diff --git a/Templates/a2b/units_1.tpl b/Templates/a2b/units_1.tpl
index 01526602..265de301 100644
--- a/Templates/a2b/units_1.tpl
+++ b/Templates/a2b/units_1.tpl
@@ -1,104 +1,29 @@
-
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename : units_1.tpl ##
+## Type : Rally Point Troop Selection (Romans) ##
+## --------------------------------------------------------------------------- ##
+## Developed by : Shadow ##
+## --------------------------------------------------------------------------- ##
+## Contact : cata7007@gmail.com ##
+## Project : TravianZ ##
+## URLs: : https://travianz.org ##
+## GitHub : https://github.com/Shadowss/TravianZ ##
+## --------------------------------------------------------------------------- ##
+## License : TravianZ Project ##
+## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
+## --------------------------------------------------------------------------- ##
+#################################################################################
+/**
+ * Trupele tribului 1 (Romans): u1..u10.
+ *
+ * Formularul e identic pentru toate triburile, difera doar blocul de unitati,
+ * asa ca traieste intr-un singur loc. Fisierul acesta ramane doar ca a2b.php
+ * sa poata include in continuare "units_" . $session->tribe . ".tpl".
+ */
-
-
+include("Templates/a2b/units_common.tpl");
diff --git a/Templates/a2b/units_2.tpl b/Templates/a2b/units_2.tpl
index f3e5a363..ed15f692 100644
--- a/Templates/a2b/units_2.tpl
+++ b/Templates/a2b/units_2.tpl
@@ -1,104 +1,29 @@
-
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename : units_2.tpl ##
+## Type : Rally Point Troop Selection (Teutons) ##
+## --------------------------------------------------------------------------- ##
+## Developed by : Shadow ##
+## --------------------------------------------------------------------------- ##
+## Contact : cata7007@gmail.com ##
+## Project : TravianZ ##
+## URLs: : https://travianz.org ##
+## GitHub : https://github.com/Shadowss/TravianZ ##
+## --------------------------------------------------------------------------- ##
+## License : TravianZ Project ##
+## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
+## --------------------------------------------------------------------------- ##
+#################################################################################
+/**
+ * Trupele tribului 2 (Teutons): u11..u20.
+ *
+ * Formularul e identic pentru toate triburile, difera doar blocul de unitati,
+ * asa ca traieste intr-un singur loc. Fisierul acesta ramane doar ca a2b.php
+ * sa poata include in continuare "units_" . $session->tribe . ".tpl".
+ */
-
-
+include("Templates/a2b/units_common.tpl");
diff --git a/Templates/a2b/units_3.tpl b/Templates/a2b/units_3.tpl
index 0ab2c34c..436db44d 100644
--- a/Templates/a2b/units_3.tpl
+++ b/Templates/a2b/units_3.tpl
@@ -1,104 +1,29 @@
-
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename : units_3.tpl ##
+## Type : Rally Point Troop Selection (Gauls) ##
+## --------------------------------------------------------------------------- ##
+## Developed by : Shadow ##
+## --------------------------------------------------------------------------- ##
+## Contact : cata7007@gmail.com ##
+## Project : TravianZ ##
+## URLs: : https://travianz.org ##
+## GitHub : https://github.com/Shadowss/TravianZ ##
+## --------------------------------------------------------------------------- ##
+## License : TravianZ Project ##
+## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
+## --------------------------------------------------------------------------- ##
+#################################################################################
+/**
+ * Trupele tribului 3 (Gauls): u21..u30.
+ *
+ * Formularul e identic pentru toate triburile, difera doar blocul de unitati,
+ * asa ca traieste intr-un singur loc. Fisierul acesta ramane doar ca a2b.php
+ * sa poata include in continuare "units_" . $session->tribe . ".tpl".
+ */
-
-
+include("Templates/a2b/units_common.tpl");
diff --git a/Templates/a2b/units_4.tpl b/Templates/a2b/units_4.tpl
index 0b0b64ae..249f97a2 100644
--- a/Templates/a2b/units_4.tpl
+++ b/Templates/a2b/units_4.tpl
@@ -1,104 +1,29 @@
-
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename : units_4.tpl ##
+## Type : Rally Point Troop Selection (Nature) ##
+## --------------------------------------------------------------------------- ##
+## Developed by : Shadow ##
+## --------------------------------------------------------------------------- ##
+## Contact : cata7007@gmail.com ##
+## Project : TravianZ ##
+## URLs: : https://travianz.org ##
+## GitHub : https://github.com/Shadowss/TravianZ ##
+## --------------------------------------------------------------------------- ##
+## License : TravianZ Project ##
+## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
+## --------------------------------------------------------------------------- ##
+#################################################################################
+/**
+ * Trupele tribului 4 (Nature): u31..u40.
+ *
+ * Formularul e identic pentru toate triburile, difera doar blocul de unitati,
+ * asa ca traieste intr-un singur loc. Fisierul acesta ramane doar ca a2b.php
+ * sa poata include in continuare "units_" . $session->tribe . ".tpl".
+ */
-
-
+include("Templates/a2b/units_common.tpl");
diff --git a/Templates/a2b/units_5.tpl b/Templates/a2b/units_5.tpl
index 1368329f..04da978a 100644
--- a/Templates/a2b/units_5.tpl
+++ b/Templates/a2b/units_5.tpl
@@ -1,99 +1,29 @@
-
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename : units_5.tpl ##
+## Type : Rally Point Troop Selection (Natars) ##
+## --------------------------------------------------------------------------- ##
+## Developed by : Shadow ##
+## --------------------------------------------------------------------------- ##
+## Contact : cata7007@gmail.com ##
+## Project : TravianZ ##
+## URLs: : https://travianz.org ##
+## GitHub : https://github.com/Shadowss/TravianZ ##
+## --------------------------------------------------------------------------- ##
+## License : TravianZ Project ##
+## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
+## --------------------------------------------------------------------------- ##
+#################################################################################
+/**
+ * Trupele tribului 5 (Natars): u41..u50.
+ *
+ * Formularul e identic pentru toate triburile, difera doar blocul de unitati,
+ * asa ca traieste intr-un singur loc. Fisierul acesta ramane doar ca a2b.php
+ * sa poata include in continuare "units_" . $session->tribe . ".tpl".
+ */
-
-
+include("Templates/a2b/units_common.tpl");
diff --git a/Templates/a2b/units_6.tpl b/Templates/a2b/units_6.tpl
index 439b9d51..f69eb885 100644
--- a/Templates/a2b/units_6.tpl
+++ b/Templates/a2b/units_6.tpl
@@ -1,104 +1,29 @@
-
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename : units_6.tpl ##
+## Type : Rally Point Troop Selection (Huns) ##
+## --------------------------------------------------------------------------- ##
+## Developed by : Shadow ##
+## --------------------------------------------------------------------------- ##
+## Contact : cata7007@gmail.com ##
+## Project : TravianZ ##
+## URLs: : https://travianz.org ##
+## GitHub : https://github.com/Shadowss/TravianZ ##
+## --------------------------------------------------------------------------- ##
+## License : TravianZ Project ##
+## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
+## --------------------------------------------------------------------------- ##
+#################################################################################
+/**
+ * Trupele tribului 6 (Huns): u51..u60.
+ *
+ * Formularul e identic pentru toate triburile, difera doar blocul de unitati,
+ * asa ca traieste intr-un singur loc. Fisierul acesta ramane doar ca a2b.php
+ * sa poata include in continuare "units_" . $session->tribe . ".tpl".
+ */
-
-
+include("Templates/a2b/units_common.tpl");
diff --git a/Templates/a2b/units_7.tpl b/Templates/a2b/units_7.tpl
index fd0a6464..50643f26 100644
--- a/Templates/a2b/units_7.tpl
+++ b/Templates/a2b/units_7.tpl
@@ -1,104 +1,29 @@
-
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename : units_7.tpl ##
+## Type : Rally Point Troop Selection (Egyptians) ##
+## --------------------------------------------------------------------------- ##
+## Developed by : Shadow ##
+## --------------------------------------------------------------------------- ##
+## Contact : cata7007@gmail.com ##
+## Project : TravianZ ##
+## URLs: : https://travianz.org ##
+## GitHub : https://github.com/Shadowss/TravianZ ##
+## --------------------------------------------------------------------------- ##
+## License : TravianZ Project ##
+## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
+## --------------------------------------------------------------------------- ##
+#################################################################################
+/**
+ * Trupele tribului 7 (Egyptians): u61..u70.
+ *
+ * Formularul e identic pentru toate triburile, difera doar blocul de unitati,
+ * asa ca traieste intr-un singur loc. Fisierul acesta ramane doar ca a2b.php
+ * sa poata include in continuare "units_" . $session->tribe . ".tpl".
+ */
-
-
+include("Templates/a2b/units_common.tpl");
diff --git a/Templates/a2b/units_8.tpl b/Templates/a2b/units_8.tpl
index 7777c2b4..12a619e9 100644
--- a/Templates/a2b/units_8.tpl
+++ b/Templates/a2b/units_8.tpl
@@ -1,104 +1,29 @@
-
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename : units_8.tpl ##
+## Type : Rally Point Troop Selection (Spartans) ##
+## --------------------------------------------------------------------------- ##
+## Developed by : Shadow ##
+## --------------------------------------------------------------------------- ##
+## Contact : cata7007@gmail.com ##
+## Project : TravianZ ##
+## URLs: : https://travianz.org ##
+## GitHub : https://github.com/Shadowss/TravianZ ##
+## --------------------------------------------------------------------------- ##
+## License : TravianZ Project ##
+## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
+## --------------------------------------------------------------------------- ##
+#################################################################################
+/**
+ * Trupele tribului 8 (Spartans): u71..u80.
+ *
+ * Formularul e identic pentru toate triburile, difera doar blocul de unitati,
+ * asa ca traieste intr-un singur loc. Fisierul acesta ramane doar ca a2b.php
+ * sa poata include in continuare "units_" . $session->tribe . ".tpl".
+ */
-
-
+include("Templates/a2b/units_common.tpl");
diff --git a/Templates/a2b/units_9.tpl b/Templates/a2b/units_9.tpl
index 6d0bd213..0cd53473 100644
--- a/Templates/a2b/units_9.tpl
+++ b/Templates/a2b/units_9.tpl
@@ -1,104 +1,29 @@
-
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename : units_9.tpl ##
+## Type : Rally Point Troop Selection (Vikings) ##
+## --------------------------------------------------------------------------- ##
+## Developed by : Shadow ##
+## --------------------------------------------------------------------------- ##
+## Contact : cata7007@gmail.com ##
+## Project : TravianZ ##
+## URLs: : https://travianz.org ##
+## GitHub : https://github.com/Shadowss/TravianZ ##
+## --------------------------------------------------------------------------- ##
+## License : TravianZ Project ##
+## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
+## --------------------------------------------------------------------------- ##
+#################################################################################
+/**
+ * Trupele tribului 9 (Vikings): u81..u90.
+ *
+ * Formularul e identic pentru toate triburile, difera doar blocul de unitati,
+ * asa ca traieste intr-un singur loc. Fisierul acesta ramane doar ca a2b.php
+ * sa poata include in continuare "units_" . $session->tribe . ".tpl".
+ */
-
-
+include("Templates/a2b/units_common.tpl");
diff --git a/Templates/a2b/units_common.tpl b/Templates/a2b/units_common.tpl
new file mode 100644
index 00000000..1d8e2699
--- /dev/null
+++ b/Templates/a2b/units_common.tpl
@@ -0,0 +1,155 @@
+ u1..u10, tribul 2 -> u11..u20, tribul 9 -> u81..u90
+ * deci primul indice e (trib - 1) * 10 + 1.
+ *
+ * Fisierele units_N.tpl au ramas, ca sa nu se schimbe modul de includere din
+ * a2b.php, dar acum doar apeleaza acest sablon.
+ */
+
+$a2bTribe = isset($session->tribe) ? (int) $session->tribe : 1;
+
+if ($a2bTribe < 1 || $a2bTribe > 9) {
+ $a2bTribe = 1;
+}
+
+$a2bFirstUnit = ($a2bTribe - 1) * 10 + 1;
+
+// Natarii nu au erou, deci nu li se arata casuta lui.
+$a2bShowHero = ($a2bTribe !== 5) && !empty($village->unitarray['hero']);
+
+/**
+ * Deseneaza o casuta de unitate.
+ *
+ * @param int $slot pozitia in formular (1..10) - devine numele campului tN
+ * @param int $unitId identificatorul real al unitatii (u1..u90)
+ * @param string $class clasele celulei din tabel
+ */
+if (!function_exists('a2b_unit_cell')) {
+ function a2b_unit_cell($slot, $unitId, $class)
+ {
+ global $village;
+
+ $have = isset($village->unitarray['u' . $unitId])
+ ? (int) $village->unitarray['u' . $unitId] : 0;
+ $label = defined('U' . $unitId) ? constant('U' . $unitId) : ('u' . $unitId);
+ $field = 't' . (int) $slot;
+
+ echo '';
+ echo ' ';
+ echo ' ';
+
+ if ($have > 0) {
+ echo ' (' . $have . ')';
+ } else {
+ echo ' (0)';
+ }
+
+ echo ' | ';
+ }
+}
+?>
+
+
+