<commit_before><?php

/**
* Class to manage theme of pfc
* @author <NAME> <<EMAIL>>
*/

class version{
    var $local_version; // file of the user version
    var $pfc_official_current_version; // file of the pfc official current version

    
    function version(){
       $this->local_version = dirname(__FILE__)."/../version";
       $this->pfc_official_current_version = "http://www.phpfreechat.net/version";
    }

    /**
    * Get the local version
    * @return integer version
    */
    function getLocalVersion(){
       $fp =  fopen($this->local_version,"r");
       $version =  trim(fgets($fp));
       fclose($fp);
       return $version;
    }

    /**
    * Get the pfc official current version
    * @return integer version
    */
    function getPFCOfficialCurrentVersion(){
       $parse = parse_url($this->pfc_official_current_version);
       $host = $parse['host'];
       error_reporting(0); // It's maybe not the best thing to do...
       if (!fsockopen ($host, 80, $errno, $errstr, 1)) {
         return 0;
       }
       else{
         $fp =  fopen($this->pfc_official_current_version,"r");
         $version =  trim(fgets($fp));
         fclose($fp);
         return $version;
       }
    }
 
}

?><commit_msg>+ use file_get_contents instead of fileopen to read pfc version<commit_after><?php

/**
* Class to manage theme of pfc
* @author <NAME> <<EMAIL>>
*/

class version{
    var $local_version; // file of the user version
    var $pfc_official_current_version; // file of the pfc official current version

    
    function version(){
       $this->local_version = dirname(__FILE__)."/../version";
       $this->pfc_official_current_version = "http://www.phpfreechat.net/version";
    }

    /**
    * Get the local version
    * @return integer version
    */
    function getLocalVersion(){
       return file_get_contents($this->local_version);
    }

    /**
    * Get the pfc official current version
    * @return integer version
    */
    function getPFCOfficialCurrentVersion(){
       $parse = parse_url($this->pfc_official_current_version);
       $host = $parse['host'];
       error_reporting(0); // It's maybe not the best thing to do...
       if (!fsockopen ($host, 80, $errno, $errstr, 2)) {
         return 0;
       }
       else{
         return file_get_contents($this->pfc_official_current_version);
       }
    }
 
}

?>
{'fraction_non_alphanumeric': 0.13403361344537815, 'fraction_numerical': 0.004201680672268907, 'mean_word_length': 2.501470588235294, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, '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': '3791688', 'n_tokens_mistral': 752, 'n_tokens_neox': 723, 'n_words': 181}