function project_sidebar() { global $db, $con, $html, $config, $currency, $symbol, $area, $logger, $_GET, $phrase; if ($con->estrato == -1) { $min = 4; $max = 6; } else { $min = $con->estrato-1; $max = $con->estrato+1; if ($max > 6) { $min--; } if ($min < 0) { $max++; } } $project = $db->query_first("SELECT * FROM `project` WHERE `id`!=".$db->sql($_GET['id'])." AND `estrato`>=".$db->sql($min)." AND `estrato`<=".$db->sql($max)." AND `vende` > 0 ORDER BY RAND()"); if (!$project['id']) { $logger->log("Had to search for any old project to fill in the sidebar"); $project = $db->query_first("SELECT * FROM `project` WHERE `id`!=".$db->sql($_GET['id'])." ORDER BY RAND()"); } $project['price_min'] = convert_currency($project['price_min']); $project['price_max'] = convert_currency($project['price_max']); $project['area_min'] = convert_area($project['area_min']); $project['area_max'] = convert_area($project['area_max']); eval('$html["sidebars"] .= "'.fetch_template('sidebar_project').'";'); }
<?php require_once 'includes/functions.php'; $from_value = ''; $from_unit = ''; $to_unit = ''; $to_value = ''; if ($_POST['submit']) { $from_value = $_POST['from_value']; $from_unit = $_POST['from_unit']; $to_unit = $_POST['to_unit']; $to_value = convert_area($from_value, $from_unit, $to_unit); } ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Convert Area</title> <link href="styles.css" rel="stylesheet" type="text/css"> </head> <body> <div id="main-content"> <h1>Convert Area</h1> <form action="" method="post"> <div class="entry"> <label>From:</label>
prep_project_for_output($project); $html['banner'] = $project['banner']; $html['title'] = $project['name']; $result = $db->query("SELECT * FROM `apartment` WHERE `project`=".$db->sql($_GET['id'])." ORDER BY `bedrooms` DESC,`bathrooms` DESC,`area_max` DESC,`area_min` DESC"); $i = 0; while ($apartment = $db->fetch_array($result)) { if ($apartment['plan'] == '') { $apartment['plan'] = $config['default_floorplan']; } $apartment['bedrooms'] = convert_rooms($apartment['bedrooms']); $apartment['bathrooms'] = convert_rooms($apartment['bathrooms']); $apartment['area_min'] = convert_area($apartment['area_min']); $apartment['area_max'] = convert_area($apartment['area_max']); $apartment['price_min'] = convert_currency($apartment['price_min']); $apartment['price_max'] = convert_currency($apartment['price_max']); $compiled_phrase['area'] = phrase($phrase['areas_de_x_hasta_y'], $apartment['area_min'].$area, $apartment['area_max'].$area); $compiled_phrase['price'] = phrase( ($project['vende'] ? $phrase['ofertas_desde_x_hasta_y'] : $apartment['ofertas_desde_x_hasta_y']), $symbol.$apartment['price_min'].' '.$currency, $symbol.$apartment['price_max'].' '.$currency); if ($apartment['y'] > $config['size_mediabox']) { $multiplier = $config['size_mediabox']/$apartment['y']; $apartment['x'] *= $multiplier; $apartment['y'] = $config['size_mediabox']; }