<commit_before><?php
/**
* @package rscds
* @author <NAME> <<EMAIL>>
* @copyright Catalyst IT Ltd
* @license   http://gnu.org/copyleft/gpl.html GNU GPL v2
*/

// Ensure the configuration starts out as an empty object.
unset($c);

// Default some of the configurable values
$c->sysabbr     = 'rscds';
$c->admin_email = '<EMAIL>';
$c->system_name = "Really Simple CalDAV Store";
$c->domain_name = $_SERVER['SERVER_NAME'];
$c->images      = "/images";
$c->save_time_zone_defs = true;
$c->stylesheets = array( "/rscds.css" );
$c->collections_always_exist = true;
$c->enable_row_linking = true;
// $c->default_locale = array('es_MX', 'es_MX.UTF-8', 'es');
$c->default_locale = "en_NZ";
$c->base_directory = preg_replace("#/[^/]*$#", "", $_SERVER['DOCUMENT_ROOT']);

// Kind of private configuration values
$c->total_query_time = 0;

$c->dbg = array( "i18n" => 1 );

// Utilities
require_once("AWLUtilities.php");

/**
* Calculate the simplest form of reference to this page, excluding the PATH_INFO following the script name.
*/
$c->protocol_server_port_script = sprintf( "%s://%s%s%s", (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'? 'https' : 'http'), $_SERVER['SERVER_NAME'],
                 (
                   ( (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') && $_SERVER['SERVER_PORT'] == 80 )
                           || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] == 443 )
                   ? ''
                   : ':'.$_SERVER['SERVER_PORT']
                 ),
                 $_SERVER['SCRIPT_NAME'] );

dbg_error_log( "LOG", "==========> method =%s= =%s= =%s=", $_SERVER['REQUEST_METHOD'], $c->protocol_server_port_script, $_SERVER['PATH_INFO']);

init_gettext( 'rscds', $c->base_directory.'/locale' );

if ( file_exists("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php") ) {
  include_once("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php");
}
else if ( file_exists("../config/config.php") ) {
  include_once("../config/config.php");
}
else {
  include_once("rscds_configuration_missing.php");
  exit;
}

/**
* Now that we have loaded the configuration file we can switch to a
* default site locale.  This may be overridden by each user.
*/
awl_set_locale($c->default_locale);

/**
* Figure our version from the changelog
*/
$c->code_version = 0;
$changelog = false;
if ( file_exists("../debian/changelog") ) {
  $changelog = fopen( "../debian/changelog", "r" );
}
else if ( file_exists("/usr/share/doc/rscds/changelog.Debian") ) {
  $changelog = fopen( "/usr/share/doc/rscds/changelog.Debian", "r" );
}
else if ( file_exists("/usr/share/doc/rscds/changelog") ) {
  $changelog = fopen( "/usr/share/doc/rscds/changelog", "r" );
}
if ( $changelog ) {
  list( $c->code_pkgver, $c->code_major, $c->code_minor, $c->code_patch, $c->code_debian ) = fscanf($changelog, "%s (%d.%d.%d-%d)");
  $c->code_version = (($c->code_major * 1000) + $c->code_minor).".".$c->code_patch;
  fclose($changelog);
}
dbg_error_log("caldav", "Version %s (%d.%d.%d-%d) == %s", $c->code_pkgver, $c->code_major, $c->code_minor, $c->code_patch, $c->code_debian, $c->code_version);
header( sprintf("Server: %s/%d.%d", $c->code_pkgver, $c->code_major, $c->code_minor) );


/**
* Force the domain name to what was in the configuration file
*/
$_SERVER['SERVER_NAME'] = $c->domain_name;

include_once("PgQuery.php");

?><commit_msg>Add commented out default timezone config setting.<commit_after><?php
/**
* @package rscds
* @author <NAME> <<EMAIL>>
* @copyright Catalyst IT Ltd
* @license   http://gnu.org/copyleft/gpl.html GNU GPL v2
*/

// Ensure the configuration starts out as an empty object.
unset($c);

// Default some of the configurable values
$c->sysabbr     = 'rscds';
$c->admin_email = '<EMAIL>';
$c->system_name = "Really Simple CalDAV Store";
$c->domain_name = $_SERVER['SERVER_NAME'];
$c->images      = "/images";
$c->save_time_zone_defs = true;
$c->stylesheets = array( "/rscds.css" );
$c->collections_always_exist = true;
$c->enable_row_linking = true;
// $c->default_locale = array('es_MX', 'es_MX.UTF-8', 'es');
// $c->local_tzid = 'Pacific/Auckland';  // Perhaps we should read from /etc/timezone - I wonder how standard that is?
$c->default_locale = "en_NZ";
$c->base_directory = preg_replace("#/[^/]*$#", "", $_SERVER['DOCUMENT_ROOT']);

// Kind of private configuration values
$c->total_query_time = 0;

$c->dbg = array( "i18n" => 1 );

// Utilities
require_once("AWLUtilities.php");

/**
* Calculate the simplest form of reference to this page, excluding the PATH_INFO following the script name.
*/
$c->protocol_server_port_script = sprintf( "%s://%s%s%s", (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'? 'https' : 'http'), $_SERVER['SERVER_NAME'],
                 (
                   ( (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') && $_SERVER['SERVER_PORT'] == 80 )
                           || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] == 443 )
                   ? ''
                   : ':'.$_SERVER['SERVER_PORT']
                 ),
                 $_SERVER['SCRIPT_NAME'] );

dbg_error_log( "LOG", "==========> method =%s= =%s= =%s=", $_SERVER['REQUEST_METHOD'], $c->protocol_server_port_script, $_SERVER['PATH_INFO']);

init_gettext( 'rscds', $c->base_directory.'/locale' );

if ( file_exists("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php") ) {
  include_once("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php");
}
else if ( file_exists("../config/config.php") ) {
  include_once("../config/config.php");
}
else {
  include_once("rscds_configuration_missing.php");
  exit;
}

/**
* Now that we have loaded the configuration file we can switch to a
* default site locale.  This may be overridden by each user.
*/
awl_set_locale($c->default_locale);

/**
* Figure our version from the changelog
*/
$c->code_version = 0;
$changelog = false;
if ( file_exists("../debian/changelog") ) {
  $changelog = fopen( "../debian/changelog", "r" );
}
else if ( file_exists("/usr/share/doc/rscds/changelog.Debian") ) {
  $changelog = fopen( "/usr/share/doc/rscds/changelog.Debian", "r" );
}
else if ( file_exists("/usr/share/doc/rscds/changelog") ) {
  $changelog = fopen( "/usr/share/doc/rscds/changelog", "r" );
}
if ( $changelog ) {
  list( $c->code_pkgver, $c->code_major, $c->code_minor, $c->code_patch, $c->code_debian ) = fscanf($changelog, "%s (%d.%d.%d-%d)");
  $c->code_version = (($c->code_major * 1000) + $c->code_minor).".".$c->code_patch;
  fclose($changelog);
}
dbg_error_log("caldav", "Version %s (%d.%d.%d-%d) == %s", $c->code_pkgver, $c->code_major, $c->code_minor, $c->code_patch, $c->code_debian, $c->code_version);
header( sprintf("Server: %s/%d.%d", $c->code_pkgver, $c->code_major, $c->code_minor) );


/**
* Force the domain name to what was in the configuration file
*/
$_SERVER['SERVER_NAME'] = $c->domain_name;

include_once("PgQuery.php");

?>
{'fraction_non_alphanumeric': 0.21669085631349783, 'fraction_numerical': 0.0046444121915820025, 'mean_word_length': 3.9862518089725034, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 94, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2042647', 'n_tokens_mistral': 2587, 'n_tokens_neox': 2495, 'n_words': 490}