<commit_before><?php

	$template_file = 'home.php';

	$users_schema = array(
						'password' 	=> array('Password', 	'table' => false, 'display' => 'password', 'form-width' => '50'),
						'password_conf' => array('Confirm Password', 'table' => false, 'display' => 'password', 'form-width' => '50'),
						'email' 		=> array('Email'),
						'timezone' 	=> array('Time Zone', 	'form-width' => '50'),
						'lang' 		=> array('Language', 	'form-width' => '50'),
					);

	$logins_schema = array(
						'id' 			=> array('ID', 		'table' => false, 'key' => true),
						'cookie' 		=> array('Browser', 	'function' => '_is_current_browser'),
						'remember' 	=> array('Remember', 	'enum' => array('', 'Selected')),
						'ip' 			=> array('Location', 	'function' => '_location_by_ip'),
						'last_login' 	=> array('Last Login', 	'display' => 'calendar+clock'),
						'useragent' 	=> array('Browser &amp; OS', 'function' => '_browser_os'),
						'log_out' 		=> array('Log Out', 	'cmd' => 'user/remote-logout/{key}')
					);

	function index($params){
		global $method, $user;
		if ($user['id'] == -1 && $method != 'log_in')
			redirect('user', 'log_in');
		//
		global $users_schema, $logins_schema;
		$db = connect_database();
		//
		if (isset($params['email'])){
			if ($params['password'] == '[encrypted]')
				unset($params['password']);
			else if ($params['password'] != $params['password_conf'])
				flash_message('Password confirmation does not match.', 'error');
			else
				$params['password'] = md5($params['password'].':'.COMMON_SALT);
			$params['id'] = $user['id'];
			$params['reset_code'] = '';
			$db->update('user', $params);
			flash_message('Settings are updated.', 'success');<commit_msg>Allow changing timezone to user by dropdown, redirect after saving user settings<commit_after><?php

	$template_file = 'home.php';

	$users_schema = array(
						'password' 	=> array('Password', 	'table' => false, 'display' => 'password', 'form-width' => '50'),
						'password_conf' => array('Confirm Password', 'table' => false, 'display' => 'password', 'form-width' => '50'),
						'email' 		=> array('Email'),
						'timezone' 	=> array('Time Zone', 	'form-width' => '50'),
						'lang' 		=> array('Language', 	'form-width' => '50'),
					);

	$logins_schema = array(
						'id' 			=> array('ID', 		'table' => false, 'key' => true),
						'cookie' 		=> array('Browser', 	'function' => '_is_current_browser'),
						'remember' 	=> array('Remember', 	'enum' => array('', 'Selected')),
						'ip' 			=> array('Location', 	'function' => '_location_by_ip'),
						'last_login' 	=> array('Last Login', 	'display' => 'calendar+clock'),
						'useragent' 	=> array('Browser &amp; OS', 'function' => '_browser_os'),
						'log_out' 		=> array('Log Out', 	'cmd' => 'user/remote-logout/{key}')
					);

	function index($params){
		global $method, $user;
		if ($user['id'] == -1 && $method != 'log_in')
			redirect('user', 'log_in');
		//
		global $users_schema, $logins_schema;
		$users_schema['timezone']['enum'] = json_decode(file_get_contents('data/timezones.json'));
		$db = connect_database();
		//
		if (isset($params['email'])){
			if ($params['password'] == '[encrypted]')
				unset($params['password']);
			else if ($params['password'] != $params['password_conf'])
				flash_message('Password confirmation does not match.', 'error');
			else
				$params['password'] = md5($params['password'].':'.COMMON_SALT);
			$params['id'] = $user['id'];
			$params['reset_code'] = '';
			$db->update('user', $params);
			flash_message('Settings are updated.', 'success');
			redirect('user');
{'fraction_non_alphanumeric': 0.23471950879151549, 'fraction_numerical': 0.0055819145967066705, 'mean_word_length': 4.012587412587413, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 61, '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': '4013742', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1214, 'n_words': 243}