<commit_before><?php

class Paquet {
	private $token   = '';
	private $actions = array();
	private $user=null;
	private $answer=null;
	private $rank=0;
	
	function __construct() {
		if(empty($_COOKIE['token'])) {
			$_COOKIE['token'] = '';
			$_COOKIE['temps'] = 0;
		}
		
		if(!empty($_COOKIE['token'])) {
			$this->token = $_COOKIE['token'];
		}
	}
	
	function add_action($action, $para='') {
		if($para == '') {
			$para=array('');
		}
		$this->actions[$action] = $para;
	}
	
	function send_actions() {
		$var = array('token'     => $this->token,
		             'actions'   => $this->actions);
		
		$postvar = http_build_query($var);
		$opts = array('http' =>
		    array(
		        'method'  => 'POST',
		        'header'  => 'Content-type: application/x-www-form-urlencoded',
		        'content' => $postvar
		    )
		);
		
		$context = stream_context_create($opts);
		$data    = json_decode(file_get_contents('http://'.$_SERVER['HTTP_HOST'].'/api.php', false, $context));
		
		if(!empty($data->user)) {
			$this->user = $data->user;
			
			$temps = time()+TEMPS_CO*86400;
			<commit_msg>Fix if http can't be used.<commit_after><?php

class Paquet {
	private $token   = '';
	private $actions = array();
	private $user=null;
	private $answer=null;
	private $rank=0;
	
	function __construct() {
		if(empty($_COOKIE['token'])) {
			$_COOKIE['token'] = '';
			$_COOKIE['temps'] = 0;
		}
		
		if(!empty($_COOKIE['token'])) {
			$this->token = $_COOKIE['token'];
		}
	}
	
	function add_action($action, $para='') {
		if($para == '') {
			$para=array('');
		}
		$this->actions[$action] = $para;
	}
	
	function send_actions() {
		if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
			$protocol = 'https';
		}
		else {
			$protocol = 'http';
		}
		
		$var = array('token'     => $this->token,
		             'actions'   => $this->actions);
		
		$postvar = http_build_query($var);
		$opts = array('http' =>
		    array(
		        'method'  => 'POST',
		        'header'  => 'Content-type: application/x-www-form-urlencoded',
		        'content' => $postvar
		    )
		);
		
		$context = stream_context_create($opts);
		$data    = json_decode(file_get_contents($protocol.'://'.$_SERVER['HTTP_HOST'].'/api.php', false, $context));
		
		if(!empty($data->user)) {
			$this->user = $data->user;
			
			$temps = time()+TEMPS_CO*86400;
			
{'fraction_non_alphanumeric': 0.2170376712328767, 'fraction_numerical': 0.0059931506849315065, 'mean_word_length': 3.0432525951557095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3188839', 'n_tokens_mistral': 977, 'n_tokens_neox': 833, 'n_words': 134}