function blueprints_info()
{
    global $smarty, $sql;
    $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : '';
    $blueprint_id = isset($_REQUEST['blueprint_id']) ? $_REQUEST['blueprint_id'] : '';
    if (!in_array($type, array('army', 'navy', 'weapon')) || empty($blueprint_id)) {
        error(__FILE__, __LINE__, 'INVALID_ID/TYPE', 'Invalid type and/or blueprint_id');
    }
    $sql->where(array($type . 'blueprints', $type . 'blueprint_id', $blueprint_id));
    $sql->limit(1);
    $db_result = $sql->execute();
    if (mysql_num_rows($db_result) == 0) {
        error(__FILE__, __LINE__, 'INVALID_ID', 'Invalid blueprint_id');
    }
    $blueprint = mysql_fetch_array($db_result, MYSQL_ASSOC);
    if ($blueprint['kingdom_id'] != $_SESSION['kingdom_id']) {
        error(__FILE__, __LINE__, 'INVALID_ACCESS', 'You do not have permission to access that blueprint.');
    }
    $blueprint['mineralspread'] = unserialize($blueprint['mineralspread']);
    $blueprint['resources']['time'] = format_time(timeparser($blueprint['time'] * $_SESSION['round_speed']));
    $blueprint['resources']['workers'] = format_number($blueprint['workers'], true);
    $blueprint['resources']['energy'] = format_number($blueprint['energy'], true);
    if (!empty($blueprint['mineralspread'])) {
        $mineralnames = array(0 => 'fe', 1 => 'o', 2 => 'si', 3 => 'mg', 4 => 'ni', 5 => 's', 6 => 'he', 7 => 'h');
        foreach ($blueprint['mineralspread'] as $key => $value) {
            $resources['minerals'][$mineralnames[$key]] = format_number($blueprint['minerals'] / $value, true);
        }
        $blueprint['resources']['minerals'] = $resources['minerals'];
    }
    if ($type == 'weapon') {
        $blueprint['targets'] = unserialize($blueprint['targets']);
    } else {
        $blueprint['weapons'] = unserialize($blueprint['weapons']);
    }
    blueprints_stats($type, $blueprint_id);
    $smarty->assign('type', $type);
    $smarty->assign('blueprint', $blueprint);
    $smarty->display('blueprints_info.tpl');
}
 function info()
 {
     $planet = $this->data->planet($this->planet_id);
     //$designs['army'] = array('attack', 'defense', 'armor', 'hull', 'weapons', 'size');
     //$designs['navy'] = array('attack', 'defense', 'armor', 'hull', 'weapons', 'cargo', 'speed', 'size');
     $unit = $this->data->blueprint($this->unit_type, $this->unit_id);
     $unit['name'] = htmlentities($unit['name']);
     if (!empty($planet['production'][$this->unit_type][$unit[$this->unit_type . 'concept_id']])) {
         $unit['resources']['time'] = format_time(timeparser($unit['time'] * $_SESSION['round_speed'] / $planet['production'][$this->unit_type][$unit[$this->unit_type . 'concept_id']]));
     }
     $unit['resources']['workers'] = format_number($unit['workers'], true);
     $unit['resources']['energy'] = format_number($unit['energy'], true);
     if (!empty($unit['mineralspread'])) {
         $mineralnames = unserialize(MINERALS_ARRAY);
         foreach ($unit['mineralspread'] as $key => $value) {
             $resources['minerals'][$mineralnames[$key]] = format_number($unit['minerals'] / $value, true);
         }
         $unit['resources']['minerals'] = $resources['minerals'];
     }
     if ($unit['kingdom_id'] == $_SESSION['kingdom_id']) {
         blueprints_stats($this->unit_type, $this->unit_id);
     }
     research_planets();
     $this->smarty->assign('unit', $unit);
     $this->smarty->assign('unit_type', $this->unit_type);
     $this->smarty->assign('unit_id', $this->unit_id);
     $this->smarty->display('units_info.tpl');
 }