<commit_before><?php

/**
 * Adds a device to the current user id and session.
 * See Users_Device::add method for more details.
 * @param {string} $deviceId
 * @param {string} $appId external app id registered with the platform
 * @param {string} [$platform=Q_Request::browser()||Q_Request::platform()] one of the platforms listed in Users/apps/platforms array
 * @param {string} [$version=Q_Request::OSVersion()] version of the platform
 * @param {string} [$formFactor=Q_Request::formFactor()] the form factor of the platform
 * @return {void}
 */
function Users_device_post ()
{
	if (Q_Request::requireFields(array('deviceId', 'appId'))) {
		return false;
	}
	$deviceId = $_REQUEST['deviceId'];
	$appId = $_REQUEST['appId'];
	$user = Users::loggedInUser(true);
	try {
		// NOTE: this requires http://browscap.org to be operating
		$info = Q_Request::browscap()->getBrowser();
		$browser = $info->Browser;
		$version = $info->Version;
	} catch (Exception $e) {
		$browser = Q_Request::browser();
		$version = null;
	}
	if (Q_Config::get('Users', 'apps', $browser, false)) {<commit_msg>Fixed Users/device post in case of Cordova<commit_after><?php

/**
 * Adds a device to the current user id and session.
 * See Users_Device::add method for more details.
 * @param {string} $deviceId
 * @param {string} $appId external app id registered with the platform
 * @param {string} [$platform=Q_Request::browser()||Q_Request::platform()] one of the platforms listed in Users/apps/platforms array
 * @param {string} [$version=Q_Request::OSVersion()] version of the platform
 * @param {string} [$formFactor=Q_Request::formFactor()] the form factor of the platform
 * @return {void}
 */
function Users_device_post ()
{
	if (Q_Request::requireFields(array('deviceId', 'appId'))) {
		return false;
	}
	$deviceId = $_REQUEST['deviceId'];
	$appId = $_REQUEST['appId'];
	$user = Users::loggedInUser(true);
	try {
		// NOTE: this requires http://browscap.org to be operating
		$info = Q_Request::browscap()->getBrowser();
		$browser = $info->Browser;
		$version = $info->Version;
	} catch (Exception $e) {
		$browser = Q_Request::browser();
		$version = null;
	}
	if (!Q_Request::isCordova()
	and Q_Config::get('Users', 'apps', $browser, false)) {
{'fraction_non_alphanumeric': 0.16218637992831542, 'fraction_numerical': 0.0, 'mean_word_length': 5.290140845070423, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '368230', 'n_tokens_mistral': 732, 'n_tokens_neox': 715, 'n_words': 204}