<commit_before><?php
	class Util
	{
		var $weekday;
		var $id_cnv_tbl;
		
		function Util()
		{
			$this->weekday = array("<font color=red></font>", "", "", "", "", "", "<font color=blue>y</font>");

			$id_cnv_tbl_val = 0x30;
			$this->id_cnv_tbl = array();
		
			for($i=0; $i < 64 ; $i++){
				if($i == 10){
					$id_cnv_tbl_val = 0x41;
				}else if($i == 36){
					$id_cnv_tbl_val = 0x61;
				}else if($i == 62){
					$id_cnv_tbl_val = 0x2E;
				}
				$this->id_cnv_tbl[$i] = $id_cnv_tbl_val;
				$id_cnv_tbl_val++;
			}
		}

		function &getInstance()
		{
			return Singleton::getInstance("Util");
		}
		
		function file_lock($fp)
		{
			$ret = flock($fp,LOCK_EX);
			return $ret;
		}
		
		function file_unlock($fp)
		{
			$ret = flock($fp,LOCK_UN);
			return $ret;
		}
		
		function getline_count($txt)
		{
			if($txt == "")
			{
				return 0;
			}
			
			$cnt = preg_match('/\n/',$txt);
			$cnt++;
			
			return $cnt;
		}
		
		function isoneline($txt)
		{
			if(preg_match('/\n|\r/',$txt) > 0){
				return false;
			}
			return true;
		}
		
		function Isintstring($val)
		{
			if(preg_match('/^\d+$/', $val) > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		
		function readenv($key, $envlist, $charset, $ifnotfound_to_exit = false)
		{
			if(preg_match('/^'. $key . ' *= *([^\n]*)$/um', $envlist, $match))
			{
				if(preg_match('/^\d*$/', $match[1]) == 0)
				{
					$match[1] = mb_convert_encoding($match[1], $charset, 'UTF-8');
				}
				return $match[1];
			}
			else
			{
				if($ifnotfound_to_exit == false)
				{
					return null;
				}
				else
				{
					echo "L[{$key}܂łB";
					exit;
				}
			}
		}
	
		function readenvs($envlist, $charset, &$result)
		{
			$envlines = explode("\n", $envlist);
			
			foreach($envlines as $line)
			{
				if(preg_match('/^([^ =]+) *= *([^\n]*)$/u', $line, $match) == 0)
				{
					continue;
				}
				else
				{
					$result[$match[1]] = $match[2];
				}
				
				if(count($match) > 0)
				{
					if(preg_match('/^\d*$/', $result[$match[1]]) == 0)
					{
						$result[$match[1]] = mb_convert_encoding($result[$match[1]], $charset, 'UTF-8');
					}
				}
				
				$match = null;
			}
		}
	
		function updateenv($key, $val, &$envlist)
		{
			if(preg_match('/^'. $key . ' *= *([^\n]*)$/um', $envlist))
			{
				$envlist = preg_replace('/^'. $key . ' *= *([^\n]*)$/um', $key . '=' . $val, $envlist);
			}
			else
			{
				return false;
			}
			return true;
		}
		
		function addenv($key, $val, &$envlist)
		{
			$envlist .= "{$key}={$val}\n";
			return true;
		}

		function cnv_bbs_date($datetime, $usec = null)
		{
			$Util = Util::getInstance();
	
			if(isset($usec))
			{
				$usec = substr($usec, 1, 3);
			}
			else
			{
				$usec = "";
			}
			
			$date = date("Y/m/d", $datetime)."(".$Util->weekday[date("w", $datetime)].")".date(" H:i:s", $datetime).$usec;
		
			return $date;
		}
		
		function getcappass(&$mail)
		{
			$pass = strstr($mail, '#');
			
			if(!isset($pass))
			{
				return null;
			}
			
			if($pass == null)
			{
				return null;
			}
			
			if($pass == "")
			{
				return null;
			}
			
			$pass = substr($pass, 1);
			$mail = substr($mail, 0, strpos($mail, '#'));
			
			return $pass;
		}
		
		function bbshtmlspecialchars($str)
		{
			$str = str_replace('<', '&lt;',$str);	
			$str = str_replace('>', '&gt;',$str);	
			$str = str_replace('\'','&#39;',$str);
			$str = str_replace('"','&quot;',$str);
		
			return $str;			
		}
	
		function adminhtmlspecialchars($str)
		{
			$str = str_replace('&', '&amp;', $str);
			$str = Util::bbshtmlspecialchars($str);
			
			return $str;
		}
		
		function datspecialchars($msgbody)
		{<commit_msg>行末の不要な空白を除去<commit_after><?php
	class Util
	{
		var $weekday;
		var $id_cnv_tbl;
		
		function Util()
		{
			$this->weekday = array("<font color=red></font>", "", "", "", "", "", "<font color=blue>y</font>");

			$id_cnv_tbl_val = 0x30;
			$this->id_cnv_tbl = array();
		
			for($i=0; $i < 64 ; $i++){
				if($i == 10){
					$id_cnv_tbl_val = 0x41;
				}else if($i == 36){
					$id_cnv_tbl_val = 0x61;
				}else if($i == 62){
					$id_cnv_tbl_val = 0x2E;
				}
				$this->id_cnv_tbl[$i] = $id_cnv_tbl_val;
				$id_cnv_tbl_val++;
			}
		}

		function &getInstance()
		{
			return Singleton::getInstance("Util");
		}
		
		function file_lock($fp)
		{
			$ret = flock($fp,LOCK_EX);
			return $ret;
		}
		
		function file_unlock($fp)
		{
			$ret = flock($fp,LOCK_UN);
			return $ret;
		}
		
		function getline_count($txt)
		{
			if($txt == "")
			{
				return 0;
			}
			
			$cnt = preg_match('/\n/',$txt);
			$cnt++;
			
			return $cnt;
		}
		
		function isoneline($txt)
		{
			if(preg_match('/\n|\r/',$txt) > 0){
				return false;
			}
			return true;
		}
		
		function Isintstring($val)
		{
			if(preg_match('/^\d+$/', $val) > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		
		function readenv($key, $envlist, $charset, $ifnotfound_to_exit = false)
		{
			if(preg_match('/^'. $key . ' *= *([^\n]*)$/um', $envlist, $match))
			{
				if(preg_match('/^\d*$/', $match[1]) == 0)
				{
					$match[1] = mb_convert_encoding($match[1], $charset, 'UTF-8');
				}
				return $match[1];
			}
			else
			{
				if($ifnotfound_to_exit == false)
				{
					return null;
				}
				else
				{
					echo "L[{$key}܂łB";
					exit;
				}
			}
		}
	
		function readenvs($envlist, $charset, &$result)
		{
			$envlines = explode("\n", $envlist);
			
			foreach($envlines as $line)
			{
				if(preg_match('/^([^ =]+) *= *([^\n]*)$/u', $line, $match) == 0)
				{
					continue;
				}
				else
				{
					$result[$match[1]] = $match[2];
				}
				
				if(count($match) > 0)
				{
					if(preg_match('/^\d*$/', $result[$match[1]]) == 0)
					{
						$result[$match[1]] = mb_convert_encoding($result[$match[1]], $charset, 'UTF-8');
					}
				}
				
				$match = null;
			}
		}
	
		function updateenv($key, $val, &$envlist)
		{
			if(preg_match('/^'. $key . ' *= *([^\n]*)$/um', $envlist))
			{
				$envlist = preg_replace('/^'. $key . ' *= *([^\n]*)$/um', $key . '=' . $val, $envlist);
			}
			else
			{
				return false;
			}
			return true;
		}
		
		function addenv($key, $val, &$envlist)
		{
			$envlist .= "{$key}={$val}\n";
			return true;
		}

		function cnv_bbs_date($datetime, $usec = null)
		{
			$Util = Util::getInstance();
	
			if(isset($usec))
			{
				$usec = substr($usec, 1, 3);
			}
			else
			{
				$usec = "";
			}
			
			$date = date("Y/m/d", $datetime)."(".$Util->weekday[date("w", $datetime)].")".date(" H:i:s", $datetime).$usec;
		
			return $date;
		}
		
		function getcappass(&$mail)
		{
			$pass = strstr($mail, '#');
			
			if(!isset($pass))
			{
				return null;
			}
			
			if($pass == null)
			{
				return null;
			}
			
			if($pass == "")
			{
				return null;
			}
			
			$pass = substr($pass, 1);
			$mail = substr($mail, 0, strpos($mail, '#'));
			
			return $pass;
		}
		
		function bbshtmlspecialchars($str)
		{
			$str = str_replace('<', '&lt;',$str);	
			$str = str_replace('>', '&gt;',$str);	
			$str = str_replace('\'','&#39;',$str);
			$str = str_replace('"','&quot;',$str);
		
			return $str;
		}
	
		function adminhtmlspecialchars($str)
		{
			$str = str_replace('&', '&amp;', $str);
			$str = Util::bbshtmlspecialchars($str);
			
			return $str;
		}
		
		function datspecialchars($msgbody)
		{
{'fraction_non_alphanumeric': 0.22872852233676977, 'fraction_numerical': 0.012096219931271478, 'mean_word_length': 2.3591874422899353, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3280623', 'n_tokens_mistral': 3980, 'n_tokens_neox': 3009, 'n_words': 480}