/**
 * Reads the headers of the data file to be used throughout the detection.
 *
 * @return array
 *   The headers of the data file.
 */
function fiftyone_degrees_get_headers()
{
    global $_fiftyone_degrees_data_file_path;
    $headers['data_file_path'] = $_fiftyone_degrees_data_file_path;
    $_fiftyone_degrees_data_file = fiftyone_degrees_get_data_file(0);
    $headers['info'] = fiftyone_degrees_get_data_info($_fiftyone_degrees_data_file);
    $version = "{$headers['info']['major_version']}.{$headers['info']['minor_version']}";
    $supported_version = fiftyone_degrees_get_supported_version();
    if ($version !== $supported_version) {
        die('An incompatible data file has been supplied. Ensure the lastest 51Degrees data and api are being used.');
    }
    $headers['ascii_strings_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['ascii_strings_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['ascii_strings_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['component_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['component_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['component_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['map_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['map_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['map_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['property_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['property_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['property_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['values_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['values_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['values_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['profile_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['profile_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['profile_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['signatures_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['signatures_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['signatures_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['ranked_signatures_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['ranked_signatures_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['ranked_signatures_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['node_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['node_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['node_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['root_node_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['root_node_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['root_node_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['profile_offsets_offset'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['profile_offsets_length'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    $headers['profile_offsets_count'] = fiftyone_degrees_read_int($_fiftyone_degrees_data_file);
    return $headers;
}
function fiftyone_degrees_get_data_date()
{
    fiftyone_degrees_set_file_handle();
    global $_fiftyone_degrees_data_file;
    $info = fiftyone_degrees_get_data_info($_fiftyone_degrees_data_file);
    $date_string = "{$info['published_day']}-{$info['published_month']}-{$info['published_year']}";
    date_default_timezone_set("Europe/London");
    $date = strtotime($date_string);
    fclose($_fiftyone_degrees_data_file);
    return $date;
}