diff --git a/Templates/Build/avaliable.tpl b/Templates/Build/avaliable.tpl index a71d7852..e16df07d 100644 --- a/Templates/Build/avaliable.tpl +++ b/Templates/Build/avaliable.tpl @@ -289,7 +289,7 @@ if($workshop == 0 && $academy <= 9 && $academy >= 5 && $mainbuilding >= 2 && $ma if($tournamentsquare == 0 && $rallypoint <= 14 && $rallypoint >= 7) { include("soon/tsquare.tpl"); } -if($bakery == 0 && $grainmill >= 1 && $grainmill <= 5 || $cropland >= 5 && $cropland <= 10 || $mainbuilding >= 2 && $mainbuilding <= 5) { +if($bakery == 0 && ($grainmill >= 1 && $cropland >= 5 || $mainbuilding >= 2 && ($grainmill >= 1 || $cropland >= 5))) { include("soon/bakery.tpl"); } if($townhall == 0 && ($mainbuilding <= 9 && $mainbuilding >= 5) || ($academy >= 5 && $academy <= 9)) { diff --git a/Templates/Profile/preference.tpl b/Templates/Profile/preference.tpl index 408a7836..c0ca4c81 100644 --- a/Templates/Profile/preference.tpl +++ b/Templates/Profile/preference.tpl @@ -26,22 +26,22 @@ if($_POST) { foreach($_POST as $key => $value) { if(substr($key, 0, 2) == 'nr') { $i = substr($key, 2); - $links[$i]['nr'] = mysqli_real_escape_string($GLOBALS['link'],$value); + $links[$i]['nr'] = mysqli_real_escape_string($database->dblink, $value); } if(substr($key, 0, 2) == 'id') { $i = substr($key, 2); - $links[$i]['id'] = mysqli_real_escape_string($GLOBALS['link'],$value); + $links[$i]['id'] = mysqli_real_escape_string($database->dblink, $value); } if(substr($key, 0, 8) == 'linkname') { $i = substr($key, 8); - $links[$i]['linkname'] = mysqli_real_escape_string($GLOBALS['link'],$value); + $links[$i]['linkname'] = mysqli_real_escape_string($database->dblink, $value); } if(substr($key, 0, 8) == 'linkziel') { $i = substr($key, 8); - $links[$i]['linkziel'] = mysqli_real_escape_string($GLOBALS['link'],$value); + $links[$i]['linkziel'] = mysqli_real_escape_string($database->dblink, $value); } } @@ -53,28 +53,28 @@ if($_POST) { // Add new link $userid = (int) $session->uid; if($session->access!=BANNED){ - $query = mysqli_query($GLOBALS['link'],'INSERT INTO `' . TB_PREFIX . 'links` (`userid`, `name`, `url`, `pos`) VALUES (' . $userid . ', \'' . $link['linkname'] . '\', \'' . $link['linkziel'] . '\', ' . $link['nr'] . ')'); + $query = mysqli_query($database->dblink,'INSERT INTO `' . TB_PREFIX . 'links` (`userid`, `name`, `url`, `pos`) VALUES (' . $userid . ', \'' . $link['linkname'] . '\', \'' . $link['linkziel'] . '\', ' . $link['nr'] . ')'); }else{ header("Location: banned.php"); exit; } } elseif(trim($link['nr']) != '' AND trim($link['linkname']) != '' AND trim($link['linkziel']) != '' AND trim($link['id']) != '') { // Update link - $query = mysqli_query($GLOBALS['link'],'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']); + $query = mysqli_query($database->dblink,'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']); $data = mysqli_fetch_assoc($query); // May the user update this entry? if($data['userid'] == $session->uid) { - $query2 = mysqli_query($GLOBALS['link'],'UPDATE `' . TB_PREFIX . 'links` SET `name` = \'' . $link['linkname'] . '\', `url` = \'' . $link['linkziel'] . '\', `pos` = ' . $link['nr'] . ' WHERE `id` = ' . $link['id']); + $query2 = mysqli_query($database->dblink,'UPDATE `' . TB_PREFIX . 'links` SET `name` = \'' . $link['linkname'] . '\', `url` = \'' . $link['linkziel'] . '\', `pos` = ' . $link['nr'] . ' WHERE `id` = ' . $link['id']); } } elseif(trim($link['nr']) == '' AND trim($link['linkname']) == '' AND trim($link['linkziel']) == '' AND trim($link['id']) != '') { // Delete entry - $query = mysqli_query($GLOBALS['link'],'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']); + $query = mysqli_query($database->dblink,'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']); $data = mysqli_fetch_assoc($query); // May the user delete this entry? if($data['userid'] == $session->uid) { - $query2 = mysqli_query($GLOBALS['link'],'DELETE FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']); + $query2 = mysqli_query($database->dblink,'DELETE FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']); } } } @@ -84,7 +84,7 @@ if($_POST) { // Fetch all links -$query = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'links` WHERE `userid` = ' . (int) $session->uid . ' ORDER BY `pos` ASC') or die(mysqli_error($database->dblink)); +$query = mysqli_query($database->dblink,'SELECT * FROM `' . TB_PREFIX . 'links` WHERE `userid` = ' . (int) $session->uid . ' ORDER BY `pos` ASC') or die(mysqli_error($database->dblink)); $links = array(); while($data = mysqli_fetch_assoc($query)) { $links[] = $data;