Fixed bugs in trade routes

+Trade routes are now editable without errors or redirects
+Trade routes are now filtered by village and not by account
This commit is contained in:
iopietro
2018-04-18 14:38:15 +02:00
parent 5270b1ca30
commit 06fc62752a
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -4309,10 +4309,10 @@ References: User ID/Message ID, Mode
} }
// no need to cache this method // no need to cache this method
function getTradeRoute($uid) { function getTradeRoute($from) {
list($uid) = $this->escape_input((int) $uid); list($from) = $this->escape_input((int) $from);
$q = "SELECT * FROM " . TB_PREFIX . "route where uid = $uid ORDER BY timestamp ASC"; $q = "SELECT * FROM " . TB_PREFIX . "route where `from` = $from ORDER BY timestamp ASC";
$result = mysqli_query($this->dblink,$q); $result = mysqli_query($this->dblink,$q);
return $this->mysqli_fetch_all($result); return $this->mysqli_fetch_all($result);
} }
+3 -3
View File
@@ -19,7 +19,7 @@ include("17_edit.tpl");
?> ?>
<p><?php echo TRADE_ROUTES_DESC;?> <img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"><b>2</b>.</p> <p><?php echo TRADE_ROUTES_DESC;?> <img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"><b>2</b>.</p>
<form method="post" action ="build.php?id=34&t=4"> <form method="post" action ="build.php?gid=17&t=4">
<table id="npc" cellpadding="1" cellspacing="1"> <table id="npc" cellpadding="1" cellspacing="1">
<thead> <thead>
<tr> <tr>
@@ -30,8 +30,8 @@ include("17_edit.tpl");
<th><?php echo TIME_LEFT;?></th> <th><?php echo TIME_LEFT;?></th>
</tr></thead><tbody> </tr></thead><tbody>
<?php <?php
$routes = $database->getTradeRoute($session->uid); $routes = $database->getTradeRoute($village->wid);
if(count($routes) == 0) { if(empty($routes)) {
echo "<td colspan=\"5\" class=\"none\">".NO_TRADE_ROUTES.".</td></tr>"; echo "<td colspan=\"5\" class=\"none\">".NO_TRADE_ROUTES.".</td></tr>";
}else{ }else{
foreach($routes as $route){ foreach($routes as $route){