<commit_before><?php
class SpotPage_edituserprefs extends SpotPage_Abs {
	private $_editUserPrefsForm;
	
	function __construct(SpotDb $db, SpotSettings $settings, $currentSession, $params) {
		parent::__construct($db, $settings, $currentSession);
		$this->_editUserPrefsForm = $params['edituserprefsform'];
	} # ctor

	function render() {
		$formMessages = array('errors' => array(),
							  'info' => array());
							  
		# Validate proper permissions
		$this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_edit_own_userprefs, '');
		
		# Make sure the editresult is set to 'not comited' per default
		$editResult = array();

		# Instantiat the user system as necessary for the management of user preferences
		$spotUserSystem = new SpotUserSystem($this->_db, $this->_settings);
		
		# zet de page title
		$this->_pageTitle = "spot: edit user preferences";
		
		# Retrieve the user we want to edit, this is for now always the current user
		$spotUser = $this->_db->getUser($this->_currentSession['user']['userid']);
		if ($spotUser === false) {
			$formMessages['errors'][] = sprintf(_('User %s cannot be found'), $spotUser['username']);
			$editResult = array('result' => 'failure');
		} # if
		
		/* <commit_msg>Username is not available when a userid lookup fails<commit_after><?php
class SpotPage_edituserprefs extends SpotPage_Abs {
	private $_editUserPrefsForm;
	
	function __construct(SpotDb $db, SpotSettings $settings, $currentSession, $params) {
		parent::__construct($db, $settings, $currentSession);
		$this->_editUserPrefsForm = $params['edituserprefsform'];
	} # ctor

	function render() {
		$formMessages = array('errors' => array(),
							  'info' => array());
							  
		# Validate proper permissions
		$this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_edit_own_userprefs, '');
		
		# Make sure the editresult is set to 'not comited' per default
		$editResult = array();

		# Instantiat the user system as necessary for the management of user preferences
		$spotUserSystem = new SpotUserSystem($this->_db, $this->_settings);
		
		# zet de page title
		$this->_pageTitle = "spot: edit user preferences";
		
		# Retrieve the user we want to edit, this is for now always the current user
		$spotUser = $this->_db->getUser($this->_currentSession['user']['userid']);
		if ($spotUser === false) {
			$formMessages['errors'][] = sprintf(_('User %d cannot be found'), $this->_currentSession['user']['userid']);
			$editResult = array('result' => 'failure');
		} # if
		
		/* 
{'fraction_non_alphanumeric': 0.14033680834001605, 'fraction_numerical': 0.0, 'mean_word_length': 4.69634703196347, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '6326557', 'n_tokens_mistral': 826, 'n_tokens_neox': 723, 'n_words': 210}