Fixed a bug in the alliance

+Usernames and alliances of attacked players are now shown in the
"attacker" and "defender" filter while peace is active
+Some clean-up
This commit is contained in:
iopietro
2018-04-16 00:02:13 +02:00
parent 8dd8fc2364
commit 2d573a915c
3 changed files with 9 additions and 13 deletions
+3 -5
View File
@@ -1,7 +1,5 @@
<?php
$prefix = "".TB_PREFIX."ndata";
$limit = "ntype!=0 AND ntype!=4 AND ntype!=5 AND ntype!=6 AND ntype!=7 AND ntype!=8 AND ntype!=9 AND ntype!=10 AND ntype!=11 AND ntype!=12 AND ntype!=13 AND ntype!=14 AND ntype!=15 AND ntype!=16 AND ntype!=17 AND ntype!=20 AND ntype!=21";
$sql = mysqli_query($database->dblink,"SELECT * FROM $prefix WHERE ally = ".(int) $session->alliance." AND $limit ORDER BY time DESC LIMIT 20");
$sql = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."ndata WHERE ally = ".(int) $session->alliance." AND (ntype != 0 AND ntype < 4 OR ntype > 17 AND ntype != 20 AND ntype != 21) ORDER BY time DESC LIMIT 20");
$query = mysqli_num_rows($sql);
$outputList = '';
$name = 1;
@@ -41,8 +39,8 @@ if($ntype==4 || $ntype==5 || $ntype==6 || $ntype==7){
$outputList .= $database->getUserField($dataarray[0], "username", 0);
$outputList .= $nn;
$outputList .= $database->getUserField($dataarray[28], "username", 0);
$getUserAlly = $database->getUserField($dataarray[28], "alliance", 0);
$outputList .= $database->getUserField($type != 22 ? $dataarray[28] : $dataarray[2], "username", 0);
$getUserAlly = $database->getUserField($type != 22 ? $dataarray[28] : $dataarray[2], "alliance", 0);
$getAllyName = $database->getAllianceName($getUserAlly);
if($getUserAlly==$session->alliance || !$getUserAlly){
+3 -5
View File
@@ -1,7 +1,5 @@
<?php
$prefix = "".TB_PREFIX."ndata";
$limit = "ntype!=1 AND ntype!=2 AND ntype!=3 AND ntype!=8 AND ntype!=9 AND ntype!=10 AND ntype!=11 AND ntype!=12 AND ntype!=13 AND ntype!=14 AND ntype!=15 AND ntype!=16 AND ntype!=17 AND ntype!=18 AND ntype!=19";
$sql = mysqli_query($database->dblink,"SELECT * FROM $prefix WHERE ally = ".(int) $session->alliance." AND $limit ORDER BY time DESC LIMIT 20");
$sql = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."ndata WHERE ally = ".(int) $session->alliance." AND (ntype < 1 OR ntype > 3 AND ntype < 8 OR ntype > 19) ORDER BY time DESC LIMIT 20");
$query = mysqli_num_rows($sql);
$outputList = '';
$name = 1;
@@ -42,8 +40,8 @@ if($ntype==4 || $ntype==5 || $ntype==6 || $ntype==7){
$outputList .= $database->getUserField($dataarray[0], "username", 0);
$outputList .= $nn;
$outputList .= $database->getUserField($dataarray[28], "username", 0);
$getUserAlly = $database->getUserField($dataarray[0], "alliance", 0);
$outputList .= $database->getUserField($type != 22 ? $dataarray[28] : $dataarray[2], "username", 0);
$getUserAlly = $database->getUserField($type != 22 ? $dataarray[28] : $dataarray[2], "alliance", 0);
$getAllyName = $database->getAllianceName($getUserAlly);
if($getUserAlly==$session->alliance || !$getUserAlly){
+3 -3
View File
@@ -9,11 +9,11 @@ include("alli_menu.tpl");
<h4 class="chartHeadline">Military events</h4>
<div id="submenu">
<a href="allianz.php?s=3&f=32">
<img src="img/x.gif" class="btn_def" alt="Defender" title="Defender" />
<img src="img/x.gif" class="<?php echo $_GET['f'] == 32 ? "active btn_def" : "btn_def";?>" alt="Defender" title="Defender" />
</a>
<a href="allianz.php?s=3&f=31">
<img src="img/x.gif" class="btn_off" alt="Attacker" title="Attacker" />
<img src="img/x.gif" class="<?php echo $_GET['f'] == 31 ? "active btn_off" : "btn_off";?>" alt="Attacker" title="Attacker" />
</a>
</div>
<?php
@@ -83,7 +83,7 @@ if($ntype==4 || $ntype==5 || $ntype==6 || $ntype==7){
}else if($ntype==1 or $ntype==2 or $ntype==3 or $ntype==18 or $ntype==19){
$getUserAlly = $database->getUserField($type != 22 ? $dataarray[28] : $dataarray[2], "alliance", 0);
}else{
$getUserAlly = $database->getUserField($dataarray[0], "alliance", 0);
$getUserAlly = $database->getUserField($type != 22 ? $dataarray[28] : $dataarray[2], "alliance", 0);
}
$getAllyName = $database->getAllianceName($getUserAlly);