<commit_before><?php

/**
 * Twitter social login handler.
 */

if (! in_array ('twitter', $appconf['User']['login_methods'])) {
	echo $this->error (404, __ ('Not found'), __ ('The page you requested could not be found.'));
	return;
}

$twauth = new tmhOAuth (array (
	'consumer_key' => $appconf['Twitter']['consumer_key'],
	'consumer_secret' => $appconf['Twitter']['consumer_secret']
));

$here = tmhUtilities::php_self ();
if (strpos ($here, '?redirect=') === false) {
	$here .= '?redirect=' . urlencode ($_GET['redirect']);
}
@session_start ();

if (isset ($_SESSION['access_token'])) {
	// already have some credentials stored
	$twauth->config['user_token'] = $_SESSION['access_token']['oauth_token'];
	$twauth->config['user_secret'] = $_SESSION['access_token']['oauth_token_secret'];

	$code = $twauth->request ('GET', $twauth->url ('1/account/verify_credentials'));

	if ($code == 200) {
		// we have a user
		$resp = json_decode ($twauth->response['response']);<commit_msg>Fixed static method call on non-static method<commit_after><?php

/**
 * Twitter social login handler.
 */

if (! in_array ('twitter', $appconf['User']['login_methods'])) {
	echo $this->error (404, __ ('Not found'), __ ('The page you requested could not be found.'));
	return;
}

$twauth = new tmhOAuth (array (
	'consumer_key' => $appconf['Twitter']['consumer_key'],
	'consumer_secret' => $appconf['Twitter']['consumer_secret']
));

$tmhu = new tmhUtilities;
$here = $tmhu->php_self ();
if (strpos ($here, '?redirect=') === false) {
	$here .= '?redirect=' . urlencode ($_GET['redirect']);
}
@session_start ();

if (isset ($_SESSION['access_token'])) {
	// already have some credentials stored
	$twauth->config['user_token'] = $_SESSION['access_token']['oauth_token'];
	$twauth->config['user_secret'] = $_SESSION['access_token']['oauth_token_secret'];

	$code = $twauth->request ('GET', $twauth->url ('1/account/verify_credentials'));

	if ($code == 200) {
		// we have a user
		$resp = json_decode ($twauth->response['response']);
{'fraction_non_alphanumeric': 0.2143212332173048, 'fraction_numerical': 0.0069617105917454, 'mean_word_length': 5.8668941979522184, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '111652', 'n_tokens_mistral': 683, 'n_tokens_neox': 656, 'n_words': 148}