hasExpired()) {
$tmp = fetchAllHouses_03();
$cache->setContent($tmp);
$cache->save();
foreach ($tmp as $t) {
if ($t['town'] == $townid) $array[] = $t;
}
$array = isset($array) ? $array : false;
} else {
$tmp = $cache->load();
foreach ($tmp as $t) {
if ($t['town'] == $townid) $array[] = $t;
}
$array = isset($array) ? $array : false;
}
// Design and present the list
if ($array) {
$guild_support = (isset($array[0]['guild'])) ? true : false;
?>
house list.
Name: |
Size: |
Doors: |
Beds: |
Price: |
Owner: |
';
echo "". $value['name'] ." | ";
echo "". $value['size'] ." | ";
echo "". $value['doors'] ." | ";
echo "". $value['beds'] ." | ";
echo "". $value['price'] ." | ";
if ($value['owner'] == 0)
echo "None | ";
else {
if ($guild_support && $value['guild'] == 1) {
$guild_name = get_guild_name($value['owner']);
echo ''. $guild_name .' | ';
} else {
$data = user_character_data($value['owner'], 'name');
echo ''. $data['name'] .' | ';
}
}
echo '';
}
?>
';
//Token::debug($_POST['token']);
echo 'Please clear your web cache/cookies OR use another web browser
';
}
} else {
if (empty($_POST) === true && $config['ServerEngine'] === 'TFS_03') {
?>
House file not foundFAILED TO LOCATE/READ FILE AT:
". $house['house_file'] ."
LINUX users: Make sure www-data have read access to file.
WINDOWS users: Learn to write correct file path.
");
exit();
}
// Load and cache SQL house data:
$cache = new Cache('engine/cache/houses/sqldata');
if ($cache->hasExpired()) {
$house_query = mysql_select_multi('SELECT `players`.`name`, `houses`.`id` FROM `players`, `houses` WHERE `houses`.`owner` = `players`.`id`;');
$cache->setContent($house_query);
$cache->save();
} else
$house_query = $cache->load();
$sqmPrice = $house['price_sqm'];
$house_load = simplexml_load_file($house['house_file']);
if ($house_query !== false && $house_load !== false) {
?>
House list
House |
Location |
Owner |
Size |
Rent |
'. $row['name'] .'';
foreach ($house_load as $house_fetch){
$house_price = (int)$house_fetch['size'] * $sqmPrice;
?>
|
|
|
|
|
Something is wrong with the cache.';
} else if ($config['ServerEngine'] === 'TFS_10') {
// Fetch values
$querystring_id = &$_GET['id'];
$townid = ($querystring_id) ? (int)$_GET['id'] : $config['houseConfig']['HouseListDefaultTown'];
$towns = $config['towns'];
$order = &$_GET['order'];
$type = &$_GET['type'];
// Create Search house box
?>
hasExpired()) {
$houses = mysql_select_multi("SELECT `id`, `owner`, `paid`, `warnings`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` ORDER BY {$order} {$type};");
if ($houses !== false) {
// Fetch player names
$playerlist = array();
foreach ($houses as $h)
if ($h['owner'] > 0)
$playerlist[] = $h['owner'];
if (!empty($playerlist)) {
$ids = join(',', $playerlist);
$tmpPlayers = mysql_select_multi("SELECT `id`, `name` FROM players WHERE `id` IN ($ids);");
// Sort $tmpPlayers by player id
$tmpById = array();
foreach ($tmpPlayers as $p)
$tmpById[$p['id']] = $p['name'];
for ($i = 0; $i < count($houses); $i++)
if ($houses[$i]['owner'] > 0)
$houses[$i]['ownername'] = $tmpById[$houses[$i]['owner']];
}
$cache->setContent($houses);
$cache->save();
}
} else
$houses = $cache->load();
if ($houses !== false || !empty($houses)) {
// Intialize stuff
//data_dump($houses, false, "House data");
?>
Name |
Size |
Beds |
Rent |
Owner |
Town |
". $house['name'] .""; ?> |
|
|
|
". $house['ownername'] ."";
else
echo ($house['highest_bidder'] == 0 ? 'None | ' : 'Selling | ');
?>
|
Failed to fetch data from sql->houses table.Is the table empty?
";
} // End TFS 1.0 logic
}
include 'layout/overall/footer.php'; ?>