mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-10 13:21:01 +00:00
Redesign Admin Panel
Full frontend & backend redesign and refactor
This commit is contained in:
+239
-365
@@ -1,386 +1,260 @@
|
||||
<?php
|
||||
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename alliance.tpl ##
|
||||
## Developed by: Dzoki ##
|
||||
## Reworked: aggenkeech ##
|
||||
## License: TravianZ Project ##
|
||||
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
|
||||
## ##
|
||||
## Filename : alliance.tpl ##
|
||||
## Type : Admin Panel Frontend ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Developed by : Dzoki (Original) ##
|
||||
## Refactored by : Shadow ##
|
||||
## Redesign by : Shadow ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Contact : cata7007@gmail.com ##
|
||||
## Project : TravianZ ##
|
||||
## GitHub : https://github.com/Shadowss/TravianZ ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## License : TravianZ Project ##
|
||||
## Copyright : TravianZ (c) 2010-2025. All rights reserved. ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
#################################################################################
|
||||
|
||||
if($_GET['aid'])
|
||||
{
|
||||
$alidata = $database->getAlliance($_GET['aid']);
|
||||
$aliusers = $database->getAllMember($_GET['aid']);
|
||||
if($alidata and $aliusers)
|
||||
{
|
||||
$memberIDs = [];
|
||||
foreach($aliusers as $member) {
|
||||
$memberIDs[] = $member['id'];
|
||||
}
|
||||
if($_GET['aid']) {
|
||||
$aid = (int)$_GET['aid'];
|
||||
$alidata = $database->getAlliance($aid);
|
||||
$aliusers = $database->getAllMember($aid);
|
||||
|
||||
if($alidata && $aliusers) {
|
||||
$memberIDs = array_column($aliusers, 'id');
|
||||
$data = $database->getVSumField($memberIDs,"pop");
|
||||
$totalpop = 0;
|
||||
if(count($data)) {
|
||||
foreach($data as $row) { $totalpop += $row['Total']; }
|
||||
}
|
||||
$founder = $database->getUserField($alidata['leader'],"username",0);
|
||||
|
||||
if (count($data)) {
|
||||
foreach ($data as $row) {
|
||||
$totalpop += $row['Total'];
|
||||
}
|
||||
} ?>
|
||||
// --- FIX 1: calculeaza max membri dupa Ambasada (lvl 20 = 60) ---
|
||||
$embassyLevel = 0;
|
||||
$embQ = mysqli_query($GLOBALS["link"], "SELECT MAX(b.level) as lvl FROM ".TB_PREFIX."bdata b JOIN ".TB_PREFIX."vdata v ON v.wref=b.wid WHERE v.owner=".(int)$alidata['leader']." AND b.type=18");
|
||||
if($embR = mysqli_fetch_assoc($embQ)) $embassyLevel = (int)$embR['lvl'];
|
||||
$maxMembers = $embassyLevel * 3;
|
||||
if($maxMembers < 3) $maxMembers = 3;
|
||||
if((int)$alidata['max'] > 0) $maxMembers = (int)$alidata['max']; // daca e setat manual, il respectam
|
||||
|
||||
<br>
|
||||
<table id="profile" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Alliance <a href="?p=alliance&aid=<?php echo $alidata['id'];?>"><?php echo $alidata['name'];?></a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Details</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="empty"></td>
|
||||
<td class="empty"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="details">
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Tag</th>
|
||||
<td><?php echo $alidata['tag']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><?php echo $alidata['name']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="empty"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<td>???</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Points</th>
|
||||
<td><?php echo $totalpop; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Members</th>
|
||||
<td><?php echo count($aliusers); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="empty"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Alliance Founder</th>
|
||||
<td><a href="?p=player&uid=<?php echo $alidata['leader']; ?>"><?php echo $database->getUserField($alidata['leader'],"username",0); ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><b>Alliance Positions</b></td>
|
||||
</tr>
|
||||
// --- FIX 3: calculeaza rank real dupa puncte ---
|
||||
$allianceRank = 1;
|
||||
$rankSql = "SELECT a.id, COALESCE(SUM(v.pop),0) as pts FROM ".TB_PREFIX."alidata a LEFT JOIN ".TB_PREFIX."users u ON u.alliance=a.id LEFT JOIN ".TB_PREFIX."vdata v ON v.owner=u.id GROUP BY a.id ORDER BY pts DESC";
|
||||
$rankRes = mysqli_query($GLOBALS["link"], $rankSql);
|
||||
while($rr = mysqli_fetch_assoc($rankRes)){ if((int)$rr['id'] == $aid) break; $allianceRank++; }
|
||||
?>
|
||||
<style>
|
||||
.ali-wrap{max-width:1200px;margin:0 auto;font-family:Verdana,Arial;}
|
||||
.ali-head{background:linear-gradient(#fff,#f2f2f2);border:1px solid #c9c9c9;border-radius:5px;padding:14px 16px;margin-bottom:12px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;}
|
||||
.ali-head h1{margin:0;font-size:22px;color:#222;}
|
||||
.ali-head h1 span.tag{background:#71D000;color:#fff;padding:2px 8px;border-radius:3px;font-size:14px;margin-right:8px;}
|
||||
.ali-head .stats{display:flex;gap:16px;font-size:12px;color:#555;}
|
||||
.ali-head .stats b{color:#000;font-size:13px;}
|
||||
|
||||
<?php
|
||||
error_reporting(0);
|
||||
$sql = "SELECT * FROM ".TB_PREFIX."ali_permission WHERE alliance = ".(int) $_GET['aid']."";
|
||||
$result = mysqli_query($GLOBALS["link"], $sql);
|
||||
while($row = mysqli_fetch_assoc($result))
|
||||
{
|
||||
$player = mysqli_fetch_assoc(mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".(int) $row['uid'].""));
|
||||
if($row['opt1'] == 1) { $position1 = "Assign To Position"; } else { $position1 = "No Assigning Positions"; }
|
||||
if($row['opt2'] == 1) { $position2 = "Kick Players"; } else { $position2 = "No Kicking Players"; }
|
||||
if($row['opt3'] == 1) { $position3 = "Change Description"; } else { $position3 = "No Changing Description"; }
|
||||
if($row['opt4'] == 1) { $position4 = "Invite Players"; } else { $position4 = "No Invitations"; }
|
||||
if($row['opt5'] == 1) { $position5 = "Manage Forums"; } else { $position5 = "No Forum Management"; }
|
||||
if($row['opt6'] == 1) { $position6 = "Alliance Diplomacy"; } else { $position6 = "No Diplomacy"; }
|
||||
if($row['opt7'] == 1) { $position7 = "Mass IGMs (MMs)"; } else { $position7 = "No MMs"; }
|
||||
if($row['opt8'] == 1) { $position8 = "???"; } else { $position8 = "No ???"; }
|
||||
.grid-2{display:grid;grid-template-columns:380px 1fr;gap:12px;}
|
||||
@media(max-width:950px){.grid-2{grid-template-columns:1fr;}}
|
||||
|
||||
echo '
|
||||
<tr>
|
||||
<td>Position:</td>
|
||||
<td><a href="admin.php?p=player&uid='.$row['uid'].'">'.$player['username'].'</a><br /><b>'.$row['rank'].'</b><br />
|
||||
<select>
|
||||
<option>Permissions</option>
|
||||
<option>'.$position1.'</option>
|
||||
<option>'.$position2.'</option>
|
||||
<option>'.$position3.'</option>
|
||||
<option>'.$position4.'</option>
|
||||
<option>'.$position5.'</option>
|
||||
<option>'.$position6.'</option>
|
||||
<option>'.$position7.'</option>
|
||||
<option>'.$position8.'</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
?>
|
||||
.card{background:#fff;border:1px solid #d5d5d5;border-radius:4px;overflow:hidden;box-shadow:0 1px 2px rgba(0,0,0,.04);margin-bottom:12px;}
|
||||
.card h3{margin:0;padding:8px 12px;background:#f7f7f7;border-bottom:1px solid #e0e0e0;font-size:13px;text-transform:uppercase;color:#444;letter-spacing:.4px;}
|
||||
.card .body{padding:12px;}
|
||||
|
||||
<tr>
|
||||
<th>Capacity</th>
|
||||
<td>
|
||||
<?php
|
||||
$now = count($aliusers);
|
||||
$max = $alidata['max'];
|
||||
if($now > $max)
|
||||
{
|
||||
$color = "red";
|
||||
}
|
||||
else
|
||||
{
|
||||
$color = "blue";
|
||||
}
|
||||
echo "<b><font color=\"$color\">($now/$max)</font></b>";
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="empty"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><a href="?p=editAli&aid=<?php echo $alidata['id'];?>">» Edit Alliance</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><a href="?p=DelAli&aid=<?php echo $alidata['id'];?>">» Delete Alliance</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="empty"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="desc2" colspan="2">
|
||||
<center><div class="desc2div">
|
||||
<?php echo nl2br($alidata['notice']); ?>
|
||||
</div></center>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="empty"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td class="desc1">
|
||||
<center><div class="desc1div">
|
||||
<?php echo nl2br($alidata['desc']); ?>
|
||||
</div></center>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" class="empty"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
/* --- FIX 2: fundal alb, text negru lizibil --- */
|
||||
.info-list{width:100%;font-size:12px;border-collapse:collapse;}
|
||||
.info-list th{width:130px;text-align:left;color:#333;font-weight:600;padding:8px;background:#f8fafc;border-bottom:1px solid #eee;vertical-align:top;}
|
||||
.info-list td{padding:8px;color:#000;background:#ffffff;border-bottom:1px solid #f5f5f5;}
|
||||
.info-list td a{color:#0066cc;text-decoration:none;}
|
||||
.info-list td a:hover{text-decoration:underline;}
|
||||
|
||||
.positions{display:flex;flex-direction:column;gap:8px;max-height:220px;overflow:auto;padding-right:4px;}
|
||||
.pos-item{border:1px solid #eee;border-radius:3px;padding:6px 8px;background:#fafafa;}
|
||||
.pos-item .name{font-weight:bold;color:#222;}
|
||||
.pos-item .rank{font-size:11px;color:#71D000;margin-left:4px;}
|
||||
.pos-item .perms{font-size:11px;color:#666;margin-top:3px;}
|
||||
|
||||
<table id="member" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Player</th>
|
||||
<th>Population</th>
|
||||
<th>Villages</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
// preload villages data
|
||||
$userIDs = [];
|
||||
foreach($aliusers as $user) {
|
||||
$userIDs[] = $user['id'];
|
||||
.desc-box{background:#fcfcfc;border:1px solid #eee;border-radius:3px;padding:10px;min-height:120px;font-size:12px;line-height:1.5;white-space:pre-wrap;}
|
||||
|
||||
.members-table,.mini-table{width:100%;border-collapse:collapse;font-size:12px;}
|
||||
.members-table th,.mini-table th{background:#f0f0f0;padding:7px;border:1px solid #ddd;text-align:left;font-weight:bold;color:#333;}
|
||||
.members-table td,.mini-table td{padding:6px;border:1px solid #eee;}
|
||||
.members-table tr:hover{background:#f9fff0;}
|
||||
.members-table td.ra{width:30px;text-align:center;color:#888;}
|
||||
.members-table td.on{width:24px;text-align:center;}
|
||||
|
||||
.badge-cap{padding:2px 6px;border-radius:3px;font-weight:bold;color:#fff;}
|
||||
.badge-cap.ok{background:#2a7;}.badge-cap.full{background:#c00;}
|
||||
|
||||
.btn-row{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap;}
|
||||
.btn{padding:6px 12px;border-radius:3px;font-size:12px;text-decoration:none;border:1px solid #bbb;background:#f5f5f5;color:#333;}
|
||||
.btn:hover{background:#fff;}
|
||||
.btn.edit{border-color:#71D000;background:#eaffd5;color:#2a5a00;}
|
||||
.btn.del{border-color:#c00;background:#ffe5e5;color:#900;}
|
||||
|
||||
.diplo-type{font-size:11px;padding:2px 5px;border-radius:2px;color:#fff;}
|
||||
.diplo-1{background:#2a7;}.diplo-2{background:#06a;}.diplo-3{background:#c00;}
|
||||
</style>
|
||||
|
||||
<div class="ali-wrap">
|
||||
<!-- HEADER -->
|
||||
<div class="ali-head">
|
||||
<h1><span class="tag"><?php echo htmlspecialchars($alidata['tag']); ?></span> <?php echo htmlspecialchars($alidata['name']); ?></h1>
|
||||
<div class="stats">
|
||||
<div>👑 Founder: <b><a href="?p=player&uid=<?php echo $alidata['leader']; ?>"><?php echo htmlspecialchars($founder); ?></a></b></div>
|
||||
<div>👥 Members: <b><?php echo count($aliusers); ?>/<?php echo $maxMembers; ?></b></div>
|
||||
<div>🏆 Points: <b><?php echo number_format($totalpop); ?></b></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid-2">
|
||||
<!-- LEFT -->
|
||||
<div>
|
||||
<div class="card">
|
||||
<h3>📋 Alliance Details</h3>
|
||||
<div class="body">
|
||||
<table class="info-list">
|
||||
<tr><th>Tag</th><td><?php echo htmlspecialchars($alidata['tag']); ?></td></tr>
|
||||
<tr><th>Name</th><td><?php echo htmlspecialchars($alidata['name']); ?></td></tr>
|
||||
<tr><th>Rank</th><td><b>#<?php echo $allianceRank; ?></b></td></tr>
|
||||
<tr><th>Points</th><td><?php echo number_format($totalpop); ?></td></tr>
|
||||
<tr><th>Capacity</th><td>
|
||||
<?php $now=count($aliusers); $cls=$now>=$maxMembers?'full':'ok'; ?>
|
||||
<span class="badge-cap <?php echo $cls; ?>"><?php echo "$now/$maxMembers"; ?></span>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<div style="margin-top:12px;">
|
||||
<b style="font-size:12px;">🛡️ Alliance Positions</b>
|
||||
<div class="positions">
|
||||
<?php
|
||||
error_reporting(0);
|
||||
$sql = "SELECT * FROM ".TB_PREFIX."ali_permission WHERE alliance = $aid";
|
||||
$result = mysqli_query($GLOBALS["link"], $sql);
|
||||
while($row = mysqli_fetch_assoc($result)){
|
||||
$player = mysqli_fetch_assoc(mysqli_query($GLOBALS["link"], "SELECT username FROM ".TB_PREFIX."users WHERE id = ".(int)$row['uid']));
|
||||
$perms = [];
|
||||
if($row['opt1']) $perms[]="Assign"; if($row['opt2']) $perms[]="Kick";
|
||||
if($row['opt3']) $perms[]="Edit Desc"; if($row['opt4']) $perms[]="Invite";
|
||||
if($row['opt5']) $perms[]="Forum"; if($row['opt6']) $perms[]="Diplomacy";
|
||||
if($row['opt7']) $perms[]="MM";
|
||||
echo '<div class="pos-item"><span class="name"><a href="admin.php?p=player&uid='.$row['uid'].'">'.htmlspecialchars($player['username']).'</a></span> <span class="rank">'.htmlspecialchars($row['rank']).'</span><div class="perms">'.implode(' • ', $perms).'</div></div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-row">
|
||||
<a class="btn edit" href="?p=editAli&aid=<?php echo $alidata['id'];?>">✏️ Edit Alliance</a>
|
||||
<a class="btn del" href="?p=DelAli&aid=<?php echo $alidata['id'];?>" onclick="return confirm('Delete alliance?')">🗑️ Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>📢 Alliance Notice</h3>
|
||||
<div class="body"><div class="desc-box"><?php echo nl2br(htmlspecialchars($alidata['notice'])); ?></div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RIGHT -->
|
||||
<div>
|
||||
<div class="card">
|
||||
<h3>📖 Alliance Description</h3>
|
||||
<div class="body"><div class="desc-box" style="min-height:260px;"><?php echo nl2br(htmlspecialchars($alidata['desc'])); ?></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MEMBERS -->
|
||||
<div class="card">
|
||||
<h3>👥 Members (<?php echo count($aliusers); ?>)</h3>
|
||||
<div class="body" style="padding:0;">
|
||||
<table class="members-table">
|
||||
<thead><tr><th>#</th><th>Player</th><th>Population</th><th>Villages</th><th></th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$rank=0;
|
||||
$database->getProfileVillages($memberIDs);
|
||||
foreach($aliusers as $user){
|
||||
$rank++;
|
||||
$TotalUserPop = $database->getVSumField($user['id'],"pop");
|
||||
$TotalVillages = $database->getProfileVillages($user['id']);
|
||||
echo "<tr>";
|
||||
echo "<td class='ra'>$rank.</td>";
|
||||
echo "<td><a href='admin.php?p=player&uid=".$user['id']."'>".htmlspecialchars($user['username'])."</a></td>";
|
||||
echo "<td>".(int)$TotalUserPop."</td>";
|
||||
echo "<td>".count($TotalVillages)."</td>";
|
||||
echo "<td class='on'>";
|
||||
if((time()-600) < $user['timestamp']) echo "<img class='online1' src='img/x.gif' title='Online now'>";
|
||||
elseif((time()-86400) < $user['timestamp']) echo "<img class='online2' src='img/x.gif' title='<1 day'>";
|
||||
elseif((time()-259200) < $user['timestamp']) echo "<img class='online3' src='img/x.gif' title='<3 days'>";
|
||||
elseif((time()-604800) < $user['timestamp']) echo "<img class='online4' src='img/x.gif' title='<7 days'>";
|
||||
else echo "<img class='online5' src='img/x.gif' title='Offline'>";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
$database->getProfileVillages($userIDs);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
// display the page
|
||||
foreach($aliusers as $user)
|
||||
{
|
||||
$rank = $rank + 1;
|
||||
$TotalUserPop = $database->getVSumField($user['id'],"pop");
|
||||
$TotalVillages = $database->getProfileVillages($user['id']);
|
||||
echo "<tr>";
|
||||
echo "<td class=ra>".$rank.".</td>";
|
||||
echo "<td class=pla><a href=spieler.php?uid=".$user['id'].">".$user['username']."</a></td>";
|
||||
echo "<td class=hab>".$TotalUserPop."</td>";
|
||||
echo "<td class=vil>".count($TotalVillages)."</td>";
|
||||
if($aid == $session->alliance)
|
||||
{
|
||||
if ((time()-600) < $user['timestamp'])
|
||||
{
|
||||
// 0 Min - 10 Min
|
||||
echo "<td class=on><img class=online1 src=img/x.gif title=now online alt=now online /></td>";
|
||||
}
|
||||
elseif ((time()-86400) < $user['timestamp'] && (time()-600) > $user['timestamp'])
|
||||
{
|
||||
// 10 Min - 1 Days
|
||||
echo "<td class=on><img class=online2 src=img/x.gif title=now online alt=now online /></td>";
|
||||
}
|
||||
elseif ((time()-259200) < $user['timestamp'] && (time()-86400) > $user['timestamp'])
|
||||
{
|
||||
// 1-3 Days
|
||||
echo "<td class=on><img class=online3 src=img/x.gif title=now online alt=now online /></td>";
|
||||
}
|
||||
elseif ((time()-604800) < $user['timestamp'] && (time()-259200) > $user['timestamp'])
|
||||
{
|
||||
echo "<td class=on><img class=online4 src=img/x.gif title=now online alt=now online /></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<td class=on><img class=online5 src=img/x.gif title=now online alt=now online /></td>";
|
||||
}
|
||||
}
|
||||
echo " </tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<br /><br />
|
||||
<div class="grid-2">
|
||||
<!-- NEWS -->
|
||||
<div class="card">
|
||||
<h3>📰 Alliance News</h3>
|
||||
<div class="body" style="padding:0;max-height:300px;overflow:auto;">
|
||||
<table class="mini-table">
|
||||
<thead><tr><th>Event</th><th style="width:130px;">Time</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql = "SELECT * FROM ".TB_PREFIX."ali_log WHERE aid = $aid ORDER BY date DESC LIMIT 50";
|
||||
$result = mysqli_query($GLOBALS["link"], $sql);
|
||||
while($row = mysqli_fetch_assoc($result)){
|
||||
// --- FIX 4: curata HTML-ul din news ---
|
||||
$comment = html_entity_decode($row['comment']);
|
||||
$comment = preg_replace('/<a href="spieler\.php\?uid=(\d+)">([^<]+)<\/a>/i', '<a href="admin.php?p=player&uid=$1">$2</a>', $comment);
|
||||
$comment = strip_tags($comment, '<a>'); // lasa doar linkurile curate
|
||||
echo '<tr><td>'.$comment.'</td><td>'.date('d.m.Y H:i', $row['date']).'</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="profile">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3">Alliance News</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Event</td>
|
||||
<td>Time</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
$sql = "SELECT * FROM ".TB_PREFIX."ali_log WHERE aid = ".(int) $_GET['aid']."";
|
||||
$result = mysqli_query($GLOBALS["link"], $sql);
|
||||
while($row = mysqli_fetch_assoc($result))
|
||||
{
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.$row['comment'].'</td>
|
||||
<td>'.date('d:m:Y H:i', $row['date']).'</td>
|
||||
</tr>';
|
||||
}
|
||||
?>
|
||||
</thead>
|
||||
</table>
|
||||
<br /><br />
|
||||
<!-- DIPLOMACY -->
|
||||
<div class="card">
|
||||
<h3>🤝 Diplomacy</h3>
|
||||
<div class="body" style="padding:0;">
|
||||
<table class="mini-table">
|
||||
<thead><tr><th>Alliance</th><th>Type</th><th style="width:60px;">Status</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$sql = "SELECT * FROM ".TB_PREFIX."diplomacy WHERE alli1 = $aid OR alli2 = $aid ORDER BY accepted DESC";
|
||||
$result = mysqli_query($GLOBALS["link"], $sql);
|
||||
while($row = mysqli_fetch_assoc($result)){
|
||||
$other = ($row['alli1']==$aid) ? $row['alli2'] : $row['alli1'];
|
||||
$ally = mysqli_fetch_assoc(mysqli_query($GLOBALS["link"], "SELECT tag FROM ".TB_PREFIX."alidata WHERE id = ".(int)$other));
|
||||
$type = $row['type']==1?'Confederation':($row['type']==2?'NAP':'War');
|
||||
$cls = 'diplo-'.$row['type'];
|
||||
$acc = $row['accepted'] ? '<img src="../../gpack/travian_default/img/a/acc.gif">' : '<img src="../../gpack/travian_default/img/a/del.gif">';
|
||||
echo '<tr><td><a href="admin.php?p=alliance&aid='.$other.'">'.htmlspecialchars($ally['tag']).'</a></td><td><span class="diplo-type '.$cls.'">'.$type.'</span></td><td>'.$acc.'</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Not Sure this Diplomacy is correct, but I think it is</h3>
|
||||
<br />
|
||||
<table id="profile">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3">Alliance Diplomacy Sent</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Recipient Alliance</td>
|
||||
<td>Type</td>
|
||||
<td>Accepted</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
$sql = "SELECT * FROM ".TB_PREFIX."diplomacy WHERE alli1 = ".(int) $_GET['aid']."";
|
||||
$result = mysqli_query($GLOBALS["link"], $sql);
|
||||
while($row = mysqli_fetch_assoc($result))
|
||||
{
|
||||
if($row['type'] == 1) { $type = 'Confederation Pact'; }
|
||||
if($row['type'] == 2) { $type = 'Non Agression Pact'; }
|
||||
if($row['type'] == 3) { $type = 'Declaration of War'; }
|
||||
if($row['accepted'] == 0) { $accepted = "<img src=\"../../gpack/travian_default/img/a/del.gif\">"; }
|
||||
if($row['accepted'] ==1) { $accepted = "<img src=\"../../gpack/travian_default/img/a/acc.gif\">"; }
|
||||
<?php include("allymedals.tpl"); ?>
|
||||
</div>
|
||||
|
||||
$ally = mysqli_fetch_assoc(mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."alidata WHERE id = ".(int) $row['alli2'].""));
|
||||
echo '
|
||||
<tr>
|
||||
<td><a href="admin.php?p=alliance&aid='.$row['alli1'].'">'.$ally['tag'].'</a></td>
|
||||
<td>'.$type.'</td>
|
||||
<td>'.$accepted.'</td>
|
||||
</tr>';
|
||||
}
|
||||
?>
|
||||
</thead>
|
||||
</table>
|
||||
<br /><br />
|
||||
|
||||
<table id="profile">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3">Alliance Diplomacy Recieved</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>From Alliance</td>
|
||||
<td>Type</td>
|
||||
<td>Accepted</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
$sql = "SELECT * FROM ".TB_PREFIX."diplomacy WHERE alli2 = ".(int) $_GET['aid']."";
|
||||
$result = mysqli_query($GLOBALS["link"], $sql);
|
||||
while($row = mysqli_fetch_assoc($result))
|
||||
{
|
||||
if($row['type'] == 1) { $type = 'Confederation Pact'; }
|
||||
if($row['type'] == 2) { $type = 'Non Agression Pact'; }
|
||||
if($row['type'] == 3) { $type = 'Declaration of War'; }
|
||||
if($row['accepted'] == 0) { $accepted = "<img src=\"../../gpack/travian_default/img/a/del.gif\">"; }
|
||||
if($row['accepted'] ==1) { $accepted = "<img src=\"../../gpack/travian_default/img/a/acc.gif\">"; }
|
||||
|
||||
$ally = mysqli_fetch_assoc(mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."alidata WHERE id = ".(int) $row['alli1'].""));
|
||||
echo '
|
||||
<tr>
|
||||
<td><a href="admin.php?p=alliance&aid='.$row['alli2'].'">'.$ally['tag'].'</a></td>
|
||||
<td>'.$type.'</td>
|
||||
<td>'.$accepted.'</td>
|
||||
</tr>';
|
||||
}
|
||||
?>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<table id="profile">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3">Alliance Relationships</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Alliance</td>
|
||||
<td>Type</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
$sql = "SELECT * FROM ".TB_PREFIX."diplomacy WHERE alli1 = ".(int) $_GET['aid']." OR alli2 = ".(int) $_GET['aid']." AND accepted = 1";
|
||||
$result = mysqli_query($GLOBALS["link"], $sql);
|
||||
while($row = mysqli_fetch_assoc($result))
|
||||
{
|
||||
if($row['type'] == 1) { $type = 'Confederation Pact'; }
|
||||
if($row['type'] == 2) { $type = 'Non Agression Pact'; }
|
||||
if($row['type'] == 3) { $type = 'Declaration of War'; }
|
||||
if($row['accepted'] == 0) { $accepted = "<img src=\"../../gpack/travian_default/img/a/del.gif\">"; }
|
||||
if($row['accepted'] == 1) { $accepted = "<img src=\"../../gpack/travian_default/img/a/acc.gif\">"; }
|
||||
|
||||
$ally1 = mysqli_fetch_assoc(mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."alidata WHERE id = ".(int) $row['alli1'].""));
|
||||
$ally2 = mysqli_fetch_assoc(mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."alidata WHERE id = ".(int) $row['alli2'].""));
|
||||
echo '
|
||||
<tr>
|
||||
<td><a href="admin.php?p=alliance&aid='.$row['alli1'].'">'.$ally1['tag'].'</a> & <a href="admin.php?p=alliance&aid='.$row['alli2'].'">'.$ally2['tag'].'</a></td>
|
||||
<td>'.$type.'</td>
|
||||
<td><img src="../../gpack/travian_default/img/a/acc.gif"></td>
|
||||
</tr>';
|
||||
}
|
||||
?>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<?php
|
||||
include("allymedals.tpl");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Not found...<a href=\"javascript: history.go(-1)\">Back</a>";
|
||||
}
|
||||
<?php
|
||||
} else {
|
||||
echo "<div style='padding:30px;text-align:center;'>Alliance not found... <a href='javascript:history.go(-1)'>Back</a></div>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user