<commit_before><?php

# initialisation stuff
/* init sets all the defaults
 * it is called after config, so that constants not defined in config can be set here
 * it cannot use the DB contents, as the DB connection hasn't been established yet
 */
define('PHPLISTINIT',true);

if (empty($GLOBALS["commandline"]) && isset($GLOBALS["developer_email"]) && $_SERVER['HTTP_HOST'] != 'dev.phplist.com' && !empty($GLOBALS['show_dev_errors'])) {
  error_reporting(E_ALL);
  ini_set('display_errors',1);
  foreach ($_REQUEST as $key => $val) {
    unset($$key);
  }
} else {
  error_reporting(0);
}

# record the start time(usec) of script
$now =  gettimeofday();
$GLOBALS["pagestats"] = array();
$GLOBALS["pagestats"]["time_start"] = $now["sec"] * 1000000 + $now["usec"];
$GLOBALS["pagestats"]["number_of_queries"] = 0;

if (function_exists('iconv_set_encoding')) {
  iconv_set_encoding("input_encoding", "UTF-8");
  iconv_set_encoding("internal_encoding", "UTF-8");
  iconv_set_encoding("output_encoding", "UTF-8");
}

if (function_exists('mb_internal_encoding')) {
  mb_internal_encoding("UTF-8");
}
#magic quotes are deprecated, so try to switch off if possible
ini_set("magic_quotes_gpc","off");

$IsCommandlinePlugin = '';
$zlib_compression = ini_get('zlib.output_compression');
# hmm older versions of PHP don't have this, but then again, upgrade php instead?
if (function_exists('ob_list_handlers')) {
  $handlers = ob_list_handlers();
} else {
  $handlers = array();
}
$gzhandler = 0;
foreach ($handlers as $handler) {
  $gzhandler = $gzhandler || $handler == 'ob_gzhandler';
}
# @@@ needs more work
$GLOBALS['compression_used'] = $zlib_compression || $gzhandler;

# make sure these are set correctly, so they cannot be injected due to the PHP Globals Problem,
# http://www.hardened-php.net/globals-problem
$GLOBALS['language_module'] = $language_module;
$GLOBALS['database_module'] = $database_module;

## this is mostly useful when using commandline, and the language is not detected
## with the browser
if (!isset($GLOBALS['default_system_language'])) {
  $GLOBALS['default_system_language'] = 'en';
}

if (!isset($table_prefix)) {
  $table_prefix = 'phplist_';
}
if (!isset($usertable_prefix)) {
  $usertable_prefix = 'phplist_user_';
}

/* this can probably go */
if (isset($GLOBALS['design'])) {
  $GLOBALS['ui'] = $GLOBALS['design'];
#@todo 
#  $GLOBALS['design'] = basename($GLOBALS['design']);
}

if (!isset($GLOBALS['ui']) || !is_dir(dirname(__FILE__).'/ui/'.$GLOBALS['ui'])) {
  ## prefer dressprow over orange
  if (is_dir(dirname(__FILE__).'/ui/dressprow')) {
    $GLOBALS['ui'] = 'dressprow';
  } else {
    $GLOBALS['ui'] = 'default';
  }
}

include_once dirname(__FILE__)."/structure.php";

if (!isset($tables)) {
  $tables = array();
}
foreach ($GLOBALS["DBstructuser"] as $tablename => $tablecolumns) {
  $tables[$tablename] =  $usertable_prefix . $tablename;
};
foreach ($GLOBALS["DBstructphplist"] as $tablename => $tablecolumns) {
  $tables[$tablename] =  $table_prefix . $tablename;
};
# unset the struct arrays, DBStruct and tables globals remain for the rest of the program
unset($GLOBALS["DBstructuser"]);
unset($GLOBALS["DBstructphplist"]);

$GLOBALS['show_dev_errors'] = $show_dev_errors;
$magic_quotes = ini_get('magic_quotes_gpc');
if ($magic_quotes == 'off' || empty($magic_quotes)) {
  define('NO_MAGIC_QUOTES',true);
} else {
  define('NO_MAGIC_QUOTES',false);
}

if (empty($GLOBALS['language_module'])) {
  $GLOBALS['language_module'] = 'english.inc';
}
if (empty($GLOBALS['database_module']) || !is_file(dirname(__FILE__).'/'.$GLOBALS['database_module'])) {
  $GLOBALS['database_module'] = 'mysqli.inc';
}
if (!isset($database_connection_compression))
  $database_connection_compression = false;
if (!isset($database_connection_ssl))
  $database_connection_ssl = false;

## @@ would be nice to move this to the config file at some point
# http://mantis.phplist.com/view.php?id=15521
## set it on the fly, although that will probably only work with Apache
## we need to save this in the DB, so that it'll work on commandline
$GLOBALS['scheme'] = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'https' : 'http';
$GLOBALS['admin_scheme'] = $GLOBALS['scheme'];
if (defined('PUBLIC_PROTOCOL')) {
  $GLOBALS['public_scheme'] = PUBLIC_PROTOCOL;
} else {
  $GLOBALS['public_scheme'] = $GLOBALS['scheme'];
}

if (!isset($bounce_protocol)) {
  $bounce_protocol = 'pop';
}
if (!isset($bounce_unsubscribe_threshold)) {
  $bounce_unsubscribe_threshold = 3;
}
## spelling mistake in earlier version, make sure to set it correctly
if (!isset($bounce_unsubscribe_threshold) && isset($bounce_unsubscribe_treshold)) {
  $bounce_unsubscribe_threshold = $bounce_unsubscribe_treshold;
}
if (!isset($bounce_mailbox_purge)) {
  $bounce_mailbox_purge = true;
}
if (!isset($bounce_mailbox_purge_unprocessed)) {
  $bounce_mailbox_purge_unprocessed = true;
}

# set some defaults if they are not specified
if (!defined("REGISTER")) define("REGISTER",1);
if (!defined("USE_PDF")) define("USE_PDF",0);
if (!defined("VERBOSE")) define("VERBOSE",0);
if (!defined("TEST")) define("TEST",1);
if (!defined("DEVSITE")) define("DEVSITE",0);
define('TRANSLATIONS_XML','https://translate.phplist.org/translations.xml');

//define('TLD_AUTH_LIST','http://data.iana.org/TLD/tlds-alpha-by-domain.txt');
//define('TLD_AUTH_MD5','http://data.iana.org/TLD/tlds-alpha-by-domain.txt.md5');
define('TLD_AUTH_LIST','https://www.phplist.com/files/tlds-alpha-by-domain.txt');
define('TLD_AUTH_MD5','https://www.phplist.com/files/tlds-alpha-by-domain.txt.md5');
define('TLD_REFETCH_TIMEOUT',15552000); ## 180 days, about 6 months
define('PQAPI_URL','https://pqapi.phplist.com/1/t/pqapi');
if (!defined('SHOW_PQCHOICE')) define('SHOW_PQCHOICE',false);

// obsolete by rssmanager plugin
// if (!defined("ENABLE_RSS")) define("ENABLE_RSS",0);
if (!defined("ALLOW_ATTACHMENTS")) define("ALLOW_ATTACHMENTS",0);
if (!defined("EMAILTEXTCREDITS")) define("EMAILTEXTCREDITS",0);
if (!defined("PAGETEXTCREDITS")) define("PAGETEXTCREDITS",0);
if (!defined("USEFCK")) define("USEFCK",1);
if (!defined("USECK")) define("USECK",0); ## ckeditor integration, not finished yet
if (!defined("ASKFORPASSWORD")) define("ASKFORPASSWORD",0);
if (!defined('SILENT_RESUBSCRIBE')) define('SILENT_RESUBSCRIBE',true);
if (!defined("UNSUBSCRIBE_REQUIRES_PASSWORD")) define("UNSUBSCRIBE_REQUIRES_PASSWORD",0);<commit_msg>default show remote processing option to true<commit_after><?php

# initialisation stuff
/* init sets all the defaults
 * it is called after config, so that constants not defined in config can be set here
 * it cannot use the DB contents, as the DB connection hasn't been established yet
 */
define('PHPLISTINIT',true);

if (empty($GLOBALS["commandline"]) && isset($GLOBALS["developer_email"]) && $_SERVER['HTTP_HOST'] != 'dev.phplist.com' && !empty($GLOBALS['show_dev_errors'])) {
  error_reporting(E_ALL);
  ini_set('display_errors',1);
  foreach ($_REQUEST as $key => $val) {
    unset($$key);
  }
} else {
  error_reporting(0);
}

# record the start time(usec) of script
$now =  gettimeofday();
$GLOBALS["pagestats"] = array();
$GLOBALS["pagestats"]["time_start"] = $now["sec"] * 1000000 + $now["usec"];
$GLOBALS["pagestats"]["number_of_queries"] = 0;

if (function_exists('iconv_set_encoding')) {
  iconv_set_encoding("input_encoding", "UTF-8");
  iconv_set_encoding("internal_encoding", "UTF-8");
  iconv_set_encoding("output_encoding", "UTF-8");
}

if (function_exists('mb_internal_encoding')) {
  mb_internal_encoding("UTF-8");
}
#magic quotes are deprecated, so try to switch off if possible
ini_set("magic_quotes_gpc","off");

$IsCommandlinePlugin = '';
$zlib_compression = ini_get('zlib.output_compression');
# hmm older versions of PHP don't have this, but then again, upgrade php instead?
if (function_exists('ob_list_handlers')) {
  $handlers = ob_list_handlers();
} else {
  $handlers = array();
}
$gzhandler = 0;
foreach ($handlers as $handler) {
  $gzhandler = $gzhandler || $handler == 'ob_gzhandler';
}
# @@@ needs more work
$GLOBALS['compression_used'] = $zlib_compression || $gzhandler;

# make sure these are set correctly, so they cannot be injected due to the PHP Globals Problem,
# http://www.hardened-php.net/globals-problem
$GLOBALS['language_module'] = $language_module;
$GLOBALS['database_module'] = $database_module;

## this is mostly useful when using commandline, and the language is not detected
## with the browser
if (!isset($GLOBALS['default_system_language'])) {
  $GLOBALS['default_system_language'] = 'en';
}

if (!isset($table_prefix)) {
  $table_prefix = 'phplist_';
}
if (!isset($usertable_prefix)) {
  $usertable_prefix = 'phplist_user_';
}

/* this can probably go */
if (isset($GLOBALS['design'])) {
  $GLOBALS['ui'] = $GLOBALS['design'];
#@todo 
#  $GLOBALS['design'] = basename($GLOBALS['design']);
}

if (!isset($GLOBALS['ui']) || !is_dir(dirname(__FILE__).'/ui/'.$GLOBALS['ui'])) {
  ## prefer dressprow over orange
  if (is_dir(dirname(__FILE__).'/ui/dressprow')) {
    $GLOBALS['ui'] = 'dressprow';
  } else {
    $GLOBALS['ui'] = 'default';
  }
}

include_once dirname(__FILE__)."/structure.php";

if (!isset($tables)) {
  $tables = array();
}
foreach ($GLOBALS["DBstructuser"] as $tablename => $tablecolumns) {
  $tables[$tablename] =  $usertable_prefix . $tablename;
};
foreach ($GLOBALS["DBstructphplist"] as $tablename => $tablecolumns) {
  $tables[$tablename] =  $table_prefix . $tablename;
};
# unset the struct arrays, DBStruct and tables globals remain for the rest of the program
unset($GLOBALS["DBstructuser"]);
unset($GLOBALS["DBstructphplist"]);

$GLOBALS['show_dev_errors'] = $show_dev_errors;
$magic_quotes = ini_get('magic_quotes_gpc');
if ($magic_quotes == 'off' || empty($magic_quotes)) {
  define('NO_MAGIC_QUOTES',true);
} else {
  define('NO_MAGIC_QUOTES',false);
}

if (empty($GLOBALS['language_module'])) {
  $GLOBALS['language_module'] = 'english.inc';
}
if (empty($GLOBALS['database_module']) || !is_file(dirname(__FILE__).'/'.$GLOBALS['database_module'])) {
  $GLOBALS['database_module'] = 'mysqli.inc';
}
if (!isset($database_connection_compression))
  $database_connection_compression = false;
if (!isset($database_connection_ssl))
  $database_connection_ssl = false;

## @@ would be nice to move this to the config file at some point
# http://mantis.phplist.com/view.php?id=15521
## set it on the fly, although that will probably only work with Apache
## we need to save this in the DB, so that it'll work on commandline
$GLOBALS['scheme'] = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'https' : 'http';
$GLOBALS['admin_scheme'] = $GLOBALS['scheme'];
if (defined('PUBLIC_PROTOCOL')) {
  $GLOBALS['public_scheme'] = PUBLIC_PROTOCOL;
} else {
  $GLOBALS['public_scheme'] = $GLOBALS['scheme'];
}

if (!isset($bounce_protocol)) {
  $bounce_protocol = 'pop';
}
if (!isset($bounce_unsubscribe_threshold)) {
  $bounce_unsubscribe_threshold = 3;
}
## spelling mistake in earlier version, make sure to set it correctly
if (!isset($bounce_unsubscribe_threshold) && isset($bounce_unsubscribe_treshold)) {
  $bounce_unsubscribe_threshold = $bounce_unsubscribe_treshold;
}
if (!isset($bounce_mailbox_purge)) {
  $bounce_mailbox_purge = true;
}
if (!isset($bounce_mailbox_purge_unprocessed)) {
  $bounce_mailbox_purge_unprocessed = true;
}

# set some defaults if they are not specified
if (!defined("REGISTER")) define("REGISTER",1);
if (!defined("USE_PDF")) define("USE_PDF",0);
if (!defined("VERBOSE")) define("VERBOSE",0);
if (!defined("TEST")) define("TEST",1);
if (!defined("DEVSITE")) define("DEVSITE",0);
define('TRANSLATIONS_XML','https://translate.phplist.org/translations.xml');

//define('TLD_AUTH_LIST','http://data.iana.org/TLD/tlds-alpha-by-domain.txt');
//define('TLD_AUTH_MD5','http://data.iana.org/TLD/tlds-alpha-by-domain.txt.md5');
define('TLD_AUTH_LIST','https://www.phplist.com/files/tlds-alpha-by-domain.txt');
define('TLD_AUTH_MD5','https://www.phplist.com/files/tlds-alpha-by-domain.txt.md5');
define('TLD_REFETCH_TIMEOUT',15552000); ## 180 days, about 6 months
define('PQAPI_URL','https://pqapi.phplist.com/1/t/pqapi');
if (!defined('SHOW_PQCHOICE')) define('SHOW_PQCHOICE',true);

// obsolete by rssmanager plugin
// if (!defined("ENABLE_RSS")) define("ENABLE_RSS",0);
if (!defined("ALLOW_ATTACHMENTS")) define("ALLOW_ATTACHMENTS",0);
if (!defined("EMAILTEXTCREDITS")) define("EMAILTEXTCREDITS",0);
if (!defined("PAGETEXTCREDITS")) define("PAGETEXTCREDITS",0);
if (!defined("USEFCK")) define("USEFCK",1);
if (!defined("USECK")) define("USECK",0); ## ckeditor integration, not finished yet
if (!defined("ASKFORPASSWORD")) define("ASKFORPASSWORD",0);
if (!defined('SILENT_RESUBSCRIBE')) define('SILENT_RESUBSCRIBE',true);
if (!defined("UNSUBSCRIBE_REQUIRES_PASSWORD")) define("UNSUBSCRIBE_REQUIRES_PASSWORD",0);
{'fraction_non_alphanumeric': 0.1806562232094147, 'fraction_numerical': 0.00794949731119944, 'mean_word_length': 6.965238981998758, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 8, 'lorem ipsum': 0, 'www.': 6, 'xml': 2}, 'pii_count': 0, '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': '5979879', 'n_tokens_mistral': 4575, 'n_tokens_neox': 4460, 'n_words': 885}