<commit_before>package Constants;
require Exporter;
use FindBin;

@ISA = qw(Exporter);
@EXPORT_OK = qw($READ_URL $WRITE_URL $HOST_URL $HTML_DIR $DATA_DIR $SQL_DB $DB_TYPE $DB_USER $DB_SOCKET $DB_PASSWD $IS_FOSSIL_RECORD $TAXA_TREE_CACHE $TAXA_LIST_CACHE $IP_MAIN $IP_BACKUP $DB $PAGE_TOP $PAGE_BOTTOM $COLLECTIONS $COLLECTION_NO $OCCURRENCES $OCCURRENCE_NO);  # symbols to export on request
use strict;

# general constants
$Constants::conf = read_conf();
my $conf = $Constants::conf;

$Constants::HOST_URL        = $conf->{'HOST_URL'};
$Constants::HTML_DIR        = $conf->{'HTML_DIR'};
$Constants::DATA_DIR        = $conf->{'DATA_DIR'};
$Constants::DB_SOCKET       = $conf->{'DB_SOCKET'};
$Constants::DB_PASSWD       = $conf->{'DB_PASSWD'};
$Constants::IP_MAIN         = '172.16.17.32';
$Constants::IP_BACKUP       = '172.16.17.32';

$Constants::IS_FOSSIL_RECORD = $conf->{'IS_FOSSIL_RECORD'};

if ($Constants::IS_FOSSIL_RECORD) {
    $Constants::TAXA_TREE_CACHE = 'taxa_tree_cache_fr';
    $Constants::TAXA_LIST_CACHE = 'taxa_list_cache_fr';
    $Constants::READ_URL = 'bridge.pl';
    $Constants::WRITE_URL = 'bridge.pl';
} else {
    $Constants::TAXA_TREE_CACHE = 'taxa_tree_cache';
    $Constants::TAXA_LIST_CACHE = 'taxa_list_cache';
    $Constants::READ_URL = 'bridge.pl';
    $Constants::WRITE_URL = 'bridge.pl';
}

$Constants::DB = 'pbdb';
$Constants::SQL_DB = 'pbdb';
$Constants::DB_TYPE = '';
$Constants::DB_USER = 'pbdbuser';
$Constants::PAGE_TOP = 'std_page_top';
$Constants::PAGE_BOTTOM = 'std_page_bottom';
$Constants::COLLECTIONS = 'collections';
$Constants::COLLECTION_NO = 'collection_no';
$Constants::OCCURRENCES = 'occurrences';
$Constants::OCCURRENCE_NO = 'occurrence_no';
if ( $ENV{'SERVER_NAME'} =~ /^eco/i )	{
    $Constants::DB = 'eco';
    $Constants::DB_TYPE = 'Recent occurrence';
    $Constants::PAGE_TOP = 'eco_top';
    $Constants::PAGE_BOTTOM = 'eco_bottom';
    $Constants::COLLECTIONS = 'inventories';
    $Constants::COLLECTION_NO = 'inventory_no';
    $Constants::OCCURRENCES = 'inventory_entries';
    $Constants::OCCURRENCE_NO = 'entry_no';
}
if ( $ENV{'HTTP_USER_AGENT'} =~ /Mobile/i )	{
    $Constants::PAGE_TOP = 'mobile_top';
    $Constants::PAGE_BOTTOM = 'mobile_bottom';
}


sub read_conf {
    my $base_dir = $FindBin::RealBin;
    $base_dir =~ s/\/(upload|cgi-bin|scripts|html)(\/.*)*$/\/config/;
    my $filename = "$base_dir/pbdb.conf";<commit_msg>iPad fix<commit_after>package Constants;
require Exporter;
use FindBin;

@ISA = qw(Exporter);
@EXPORT_OK = qw($READ_URL $WRITE_URL $HOST_URL $HTML_DIR $DATA_DIR $SQL_DB $DB_TYPE $DB_USER $DB_SOCKET $DB_PASSWD $IS_FOSSIL_RECORD $TAXA_TREE_CACHE $TAXA_LIST_CACHE $IP_MAIN $IP_BACKUP $DB $PAGE_TOP $PAGE_BOTTOM $COLLECTIONS $COLLECTION_NO $OCCURRENCES $OCCURRENCE_NO);  # symbols to export on request
use strict;

# general constants
$Constants::conf = read_conf();
my $conf = $Constants::conf;

$Constants::HOST_URL        = $conf->{'HOST_URL'};
$Constants::HTML_DIR        = $conf->{'HTML_DIR'};
$Constants::DATA_DIR        = $conf->{'DATA_DIR'};
$Constants::DB_SOCKET       = $conf->{'DB_SOCKET'};
$Constants::DB_PASSWD       = $conf->{'DB_PASSWD'};
$Constants::IP_MAIN         = '172.16.17.32';
$Constants::IP_BACKUP       = '172.16.17.32';

$Constants::IS_FOSSIL_RECORD = $conf->{'IS_FOSSIL_RECORD'};

if ($Constants::IS_FOSSIL_RECORD) {
    $Constants::TAXA_TREE_CACHE = 'taxa_tree_cache_fr';
    $Constants::TAXA_LIST_CACHE = 'taxa_list_cache_fr';
    $Constants::READ_URL = 'bridge.pl';
    $Constants::WRITE_URL = 'bridge.pl';
} else {
    $Constants::TAXA_TREE_CACHE = 'taxa_tree_cache';
    $Constants::TAXA_LIST_CACHE = 'taxa_list_cache';
    $Constants::READ_URL = 'bridge.pl';
    $Constants::WRITE_URL = 'bridge.pl';
}

$Constants::DB = 'pbdb';
$Constants::SQL_DB = 'pbdb';
$Constants::DB_TYPE = '';
$Constants::DB_USER = 'pbdbuser';
$Constants::PAGE_TOP = 'std_page_top';
$Constants::PAGE_BOTTOM = 'std_page_bottom';
$Constants::COLLECTIONS = 'collections';
$Constants::COLLECTION_NO = 'collection_no';
$Constants::OCCURRENCES = 'occurrences';
$Constants::OCCURRENCE_NO = 'occurrence_no';
if ( $ENV{'SERVER_NAME'} =~ /^eco/i )	{
    $Constants::DB = 'eco';
    $Constants::DB_TYPE = 'Recent occurrence';
    $Constants::PAGE_TOP = 'eco_top';
    $Constants::PAGE_BOTTOM = 'eco_bottom';
    $Constants::COLLECTIONS = 'inventories';
    $Constants::COLLECTION_NO = 'inventory_no';
    $Constants::OCCURRENCES = 'inventory_entries';
    $Constants::OCCURRENCE_NO = 'entry_no';
}
if ( $ENV{'HTTP_USER_AGENT'} =~ /Mobile/i && $ENV{'HTTP_USER_AGENT'} !~ /iPad/i )	{
    $Constants::PAGE_TOP = 'mobile_top';
    $Constants::PAGE_BOTTOM = 'mobile_bottom';
}


sub read_conf {
    my $base_dir = $FindBin::RealBin;
    $base_dir =~ s/\/(upload|cgi-bin|scripts|html)(\/.*)*$/\/config/;
    my $filename = "$base_dir/pbdb.conf";
{'fraction_non_alphanumeric': 0.17712865133623368, 'fraction_numerical': 0.0074580484773151025, 'mean_word_length': 5.471849865951743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '726859', 'n_tokens_mistral': 1917, 'n_tokens_neox': 1858, 'n_words': 274}