<commit_before><?php
/**
 *	action_form.php
 *
 *	@author		<NAME> <<EMAIL>>
 *	@license	http://www.opensource.org/licenses/bsd-license.php The BSD License
 *	@package	Ethna
 *	@version	$Id$
 */

/**
 *	եѴե饰: Ⱦѥʢѥ
 */
define('CONVERT_1BYTE_KANA', 1 << 0);

/**
 *	եѴե饰: ѿȾѿ
 */
define('CONVERT_2BYTE_NUMERIC', 1 << 1);

/**
 *	եѴե饰: ѥե٥åȢȾѥե٥å
 */
define('CONVERT_2BYTE_ALPHABET', 1 << 2);

/**
 *	եѴե饰: 
 */
define('CONVERT_LTRIM',	1 << 3);

/**
 *	եѴե饰: 
 */
define('CONVERT_RTRIM',	1 << 4);

/**
 *	եѴե饰: 
 */
define('CONVERT_LRTRIM', (1 << 3) | (1 << 4));

/**
 *	եѴե饰: ѱѿȾѱѿ/
 */
define('CONVERT_2BYTE', (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4));


/**
 *	ե९饹
 *
 *	@author		<NAME> <<EMAIL>>
 *	@access		public
 *	@package	Ethna
 */
class Ethna_ActionForm
{
	/**#@+
	 *	@access	private
	 */

	/**
	 *	@var	array	ե
	 */
	var $form = array();

	/**
	 *	@var	array	ե
	 */
	var $form_vars = array();

	/**
	 *	@var	array	ץꥱ
	 */
	var $app_vars = array();

	/**
	 *	@var	array	ץꥱ(ưפʤ)
	 */
	var $app_ne_vars = array();

	/**
	 *	@var	object	Ethna_ActionError	action error֥
	 */
	var $action_error;

	/**
	 *	@var	object	Ethna_ActionError	action error֥(ά)
	 */
	var $ae;

	/**
	 *	@var	object	Ethna_I18N	i18n֥
	 */
	var $i18n;

	/**
	 *	@var	array	ե
	 */
	var $def = array('name', 'required', 'max', 'min', 'regexp', 'custom', 'convert', 'form_type', 'type');

	/**#@-*/

	/**
	 *	Ethna_ActionForm饹Υ󥹥ȥ饯
	 *
	 *	@access	public
	 *	@param	object	Ethna_Controller	&$controller	controller֥
	 */
	function Ethna_ActionForm(&$controller)
	{
		$this->i18n =& $controller->getI18N();
		$this->action_error =& $controller->getActionError();
		$this->ae =& $this->action_error;

		if (isset($_SERVER['REQUEST_METHOD']) == false) {
			return;
		}

		if (strcasecmp($_SERVER['REQUEST_METHOD'], 'post') == 0) {
			$http_vars =& $_POST;
		} else {
			$http_vars =& $_GET;
		}

		// ե
		foreach ($this->form as $name => $value) {
			// ά
			foreach ($this->def as $k) {
				if (isset($value[$k]) == false) {
					$this->form[$name][$k] = null;
				}
			}

			$type = to_array($value['type']);
			if ($type[0] == VAR_TYPE_FILE) {
				@$this->form_vars[$name] =& $_FILES[$name];
			} else {
				if (isset($http_vars[$name]) == false) {
					if (isset($http_vars["{$name}_x"])) {
						@$this->form_vars[$name] = $http_vars["{$name}_x"];
					} else {
						@$this->form_vars[$name] = null;
					}
				} else {
					@$this->form_vars[$name] = $http_vars[$name];
				}
			}
		}
	}

	/**
	 *	եͤΥ(R)
	 *
	 *	@access	public
	 *	@param	string	$name	եͤ̾
	 *	@return	mixed	ե
	 */
	function get($name)
	{
		if (isset($this->form_vars[$name])) {
			return $this->form_vars[$name];
		}
		return null;
	}

	/**
	 *	ե
	 *
	 *	@access	public
	 *	@return	array	ե
	 */
	function getDef()
	{
		return $this->form;
	}

	/**
	 *	եɽ̾
	 *
	 *	@access	public
	 *	@param	string	$name	եͤ̾
	 *	@return	mixed	եͤɽ̾
	 */
	function getName($name)
	{
		if (isset($this->form[$name]) == false) {
			return null;
		}
		if (isset($this->form[$name]['name']) && $this->form[$name]['name'] != null) {
			return $this->form[$name]['name'];
		}

		// try message catalog
		return $this->i18n->get($name);
	}

	/**
	 *	եͤؤΥ(W)
	 *
	 *	@access	public
	 *	@param	string	$name	եͤ̾
	 *	@param	string	$value	ꤹ
	 */
	function set($name, $value)
	{
		$this->form_vars[$name] = $value;
	}

	/**
	 *	եͤˤ֤
	 *
	 *	@access	public
	 *	@param	bool	$escape	HTMLץե饰(true:פ)
	 *	@return	array	եͤǼ
	 */
	function &getArray($escape = true)
	{
		$retval = array();

		$this->_getArray($this->form_vars, $retval, $escape);

		return $retval;
	}

	/**
	 *	ץꥱͤΥ(R)
	 *
	 *	@access	public
	 *	@param	string	$name	
	 *	@return	mixed	ץꥱ
	 */
	function getApp($name)
	{
		if (isset($this->app_vars[$name]) == false) {
			return null;
		}
		return $this->app_vars[$name];
	}

	/**
	 *	ץꥱͤΥ(W)
	 *
	 *	@access	public
	 *	@param	string	$name	
	 *	@param	mixed	$value	
	 */
	function setApp($name, $value)
	{
		$this->app_vars[$name] = $value;
	}

	/**
	 *	ץꥱͤˤ֤
	 *
	 *	@access	public
	 *	@param	boolean	$escape	HTMLץե饰(true:פ)
	 *	@return	array	եͤǼ
	 */
	function getAppArray($escape = true)
	{
		$retval = array();

		$this->_getArray($this->app_vars, $retval, $escape);

		return $retval;
	}

	/**
	 *	ץꥱ(ưפʤ)Υ(R)
	 *
	 *	@access	public
	 *	@param	string	$name	
	 *	@return	mixed	ץꥱ
	 */
	function getAppNE($name)
	{
		if (isset($this->app_ne_vars[$name]) == false) {
			return null;
		}
		return $this->app_ne_vars[$name];
	}

	/**
	 *	ץꥱ(ưפʤ)Υ(W)
	 *
	 *	@access	public
	 *	@param	string	$name	
	 *	@param	mixed	$value	
	 */
	function setAppNE($name, $value)
	{
		$this->app_ne_vars[$name] = $value;
	}

	/**
	 *	ץꥱ(ưפʤ)ˤ֤
	 *
	 *	@access	public
	 *	@param	boolean	$escape	HTMLץե饰(true:פ)
	 *	@return	array	եͤǼ
	 */
	function getAppNEArray($escape = false)
	{
		$retval = array();

		$this->_getArray($this->app_ne_vars, $retval, $escape);

		return $retval;
	}

	/**
	 *	եˤ֤()
	 *
	 *	@access	private
	 *	@param	array	&$vars		ե()
	 *	@param	array	&$retval	ؤѴ
	 *	@param	bool	$escape		HTMLץե饰(true:פ)
	 */
	function _getArray(&$vars, &$retval, $escape)
	{
		foreach (array_keys($vars) as $name) {
			if (is_array($vars[$name])) {
				$retval[$name] = array();
				$this->_getArray($vars[$name], $retval[$name], $escape);
			} else {
				$retval[$name] = $escape ? htmlspecialchars($vars[$name]) : $vars[$name];
			}
		}
	}

	/**
	 *	ե͸ڥ᥽å
	 *
	 *	@access	public
	 *	@return	int		ȯ顼ο
	 */
	function validate()
	{
		foreach ($this->form as $name => $value) {
			$type = to_array($value['type']);
			if ($type[0] == VAR_TYPE_FILE) {
				// ե븡
				$tmp_name = to_array($this->form_vars[$name]['tmp_name']);
				$valid_keys = array();
				foreach ($tmp_name as $k => $v) {
					if (is_uploaded_file($tmp_name[$k]) == false) {
						// եʳ̵ͤ
						continue;
					}
					$valid_keys[] = $k;
				}
				if (count($valid_keys) == 0 && $value['required']) {
					$this->ae->add(E_FORM_REQUIRED, $name, "{form}˥ե򤷤Ʋ");
					continue;
				} else if (count($valid_keys) == 0 && $value['required'] == false) {
					continue;
				}

				if (is_array($this->form_vars[$name]['tmp_name'])) {
					if (is_array($value['type']) == false) {
						// ñΥեϤƤ
						$this->ae->add(E_FORM_WRONGTYPE_FILE, $name, "{form}ˤϥ顼ͤϤƤ");
						continue;
					}

					// եǡƹ
					$files = array();
					foreach ($valid_keys as $k) {
						$files[$k]['name'] = $this->form_vars[$name]['name'][$k];
						$files[$k]['type'] = $this->form_vars[$name]['type'][$k];
						$files[$k]['tmp_name'] = $this->form_vars[$name]['tmp_name'][$k];
						$files[$k]['size'] = $this->form_vars[$name]['size'][$k];
					}
					$this->form_vars[$name] = $files;

					// γǤФ븡
					foreach (array_keys($this->form_vars[$name]) as $key) {
						$this->_validate($name, $this->form_vars[$name][$key], $value);
					}
				} else {
					if (is_array($value['type'])) {
						// Υե˥顼ͤϤƤ
						$this->ae->add(E_FORM_WRONGTYPE_FILE, $name, "{form}ˤϤƤ");
						continue;
					}
					if (count($valid_keys) == 0) {
						$this->form_vars[$name] = null;
					}
					$this->_validate($name, $this->form_vars[$name], $value);
				}
			} else {
				if (is_array($this->form_vars[$name])) {
					if (is_array($value['type']) == false) {
						// 顼ΥեϤƤ
						$this->ae->add(E_FORM_WRONGTYPE_SCALAR, $name, "{form}ˤϥ顼ͤϤƤ");
						continue;
					}

					// γǤФѴ/
					foreach (array_keys($this->form_vars[$name]) as $key) {
						$this->form_vars[$name][$key] = $this->_convert($this->form_vars[$name][$key], $value['convert']);
						$this->_validate($name, $this->form_vars[$name][$key], $value);
					}
				} else {
					if ($this->form_vars[$name] == null && is_array($value['type']) && $value['required'] == false) {
						// 󷿤ǾάĤΤΤͼΤƤʤƤ⥨顼Ȥʤ
						continue;
					} else if (is_array($value['type'])) {
						$this->ae->add(E_FORM_WRONGTYPE_ARRAY, $name, "{form}ˤϤƤ");
						continue;
					}
					$this->form_vars[$name] = $this->_convert($this->form_vars[$name], $value['convert']);
					$this->_validate($name, $this->form_vars[$name], $value);
				}
			}
		}

		if ($this->ae->count() == 0) {
			// ɲøڥ᥽å
			$this->_validatePlus();
		}

		return $this->ae->count();
	}

	/**
	 *	å᥽å(쥯饹)
	 *
	 *	@access	public
	 *	@param	string	$name	ե̾
	 *	@return	array	åоݤΥե(顼̵null)
	 */
	function check($name)
	{
		if (is_null($this->form_vars[$name]) || $this->form_vars[$name] === "") {
			return null;
		}

		// Ethna_Backend
		$c =& $GLOBALS['controller'];
		$this->backend =& $c->getBackend();

		return to_array($this->form_vars[$name]);
	}

	/**
	 *	å᥽å: ¸ʸ
	 *
	 *	@access	public
	 *	@param	string	$name	ե̾
	 *	@return	object	Ethna_Error	顼֥(顼̵null)
	 */
	function &checkVendorChar($name)
	{
		$string = $this->form_vars[$name];
		for ($i = 0; $i < strlen($string); $i++) {
			/* JIS13Τߥå */
			$c = ord($string{$i});
			if ($c < 0x80) {
				/* ASCII */
			} else if ($c == 0x8e) {
				/* Ⱦѥ */
				$i++;
			} else if ($c == 0x8f) {
				/* JIS X 0212 */
				$i += 2;
			} else if ($c == 0xad || ($c >= 0xf9 && $c <= 0xfc)) {
				/* IBMĥʸ / NECIBMĥʸ */
				return $this->ad->add(E_FORM_INVALIDCHAR, $name, '{form}˵¸ʸϤƤޤ');
			} else {
				$i++;
			}
		}

		return null;
	}

	/**
	 *	å᥽å: ᡼륢ɥ쥹
	 *
	 *	@access	public
	 *	@param	string	$name	ե̾
	 *	@return	object	Ethna_Error	顼֥(顼̵null)
	 */
	function &checkMailaddress($name)
	{<commit_msg>- added missing methods<commit_after><?php
/**
 *	action_form.php
 *
 *	@author		<NAME> <<EMAIL>>
 *	@license	http://www.opensource.org/licenses/bsd-license.php The BSD License
 *	@package	Ethna
 *	@version	$Id$
 */

/**
 *	եѴե饰: Ⱦѥʢѥ
 */
define('CONVERT_1BYTE_KANA', 1 << 0);

/**
 *	եѴե饰: ѿȾѿ
 */
define('CONVERT_2BYTE_NUMERIC', 1 << 1);

/**
 *	եѴե饰: ѥե٥åȢȾѥե٥å
 */
define('CONVERT_2BYTE_ALPHABET', 1 << 2);

/**
 *	եѴե饰: 
 */
define('CONVERT_LTRIM',	1 << 3);

/**
 *	եѴե饰: 
 */
define('CONVERT_RTRIM',	1 << 4);

/**
 *	եѴե饰: 
 */
define('CONVERT_LRTRIM', (1 << 3) | (1 << 4));

/**
 *	եѴե饰: ѱѿȾѱѿ/
 */
define('CONVERT_2BYTE', (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4));


/**
 *	ե९饹
 *
 *	@author		<NAME> <<EMAIL>>
 *	@access		public
 *	@package	Ethna
 */
class Ethna_ActionForm
{
	/**#@+
	 *	@access	private
	 */

	/**
	 *	@var	array	ե
	 */
	var $form = array();

	/**
	 *	@var	array	ե
	 */
	var $form_vars = array();

	/**
	 *	@var	array	ץꥱ
	 */
	var $app_vars = array();

	/**
	 *	@var	array	ץꥱ(ưפʤ)
	 */
	var $app_ne_vars = array();

	/**
	 *	@var	object	Ethna_ActionError	action error֥
	 */
	var $action_error;

	/**
	 *	@var	object	Ethna_ActionError	action error֥(ά)
	 */
	var $ae;

	/**
	 *	@var	object	Ethna_I18N	i18n֥
	 */
	var $i18n;

	/**
	 *	@var	array	ե
	 */
	var $def = array('name', 'required', 'max', 'min', 'regexp', 'custom', 'convert', 'form_type', 'type');

	/**#@-*/

	/**
	 *	Ethna_ActionForm饹Υ󥹥ȥ饯
	 *
	 *	@access	public
	 *	@param	object	Ethna_Controller	&$controller	controller֥
	 */
	function Ethna_ActionForm(&$controller)
	{
		$this->i18n =& $controller->getI18N();
		$this->action_error =& $controller->getActionError();
		$this->ae =& $this->action_error;

		if (isset($_SERVER['REQUEST_METHOD']) == false) {
			return;
		}

		if (strcasecmp($_SERVER['REQUEST_METHOD'], 'post') == 0) {
			$http_vars =& $_POST;
		} else {
			$http_vars =& $_GET;
		}

		// ե
		foreach ($this->form as $name => $value) {
			// ά
			foreach ($this->def as $k) {
				if (isset($value[$k]) == false) {
					$this->form[$name][$k] = null;
				}
			}

			$type = to_array($value['type']);
			if ($type[0] == VAR_TYPE_FILE) {
				@$this->form_vars[$name] =& $_FILES[$name];
			} else {
				if (isset($http_vars[$name]) == false) {
					if (isset($http_vars["{$name}_x"])) {
						@$this->form_vars[$name] = $http_vars["{$name}_x"];
					} else {
						@$this->form_vars[$name] = null;
					}
				} else {
					@$this->form_vars[$name] = $http_vars[$name];
				}
			}
		}
	}

	/**
	 *	եͤΥ(R)
	 *
	 *	@access	public
	 *	@param	string	$name	եͤ̾
	 *	@return	mixed	ե
	 */
	function get($name)
	{
		if (isset($this->form_vars[$name])) {
			return $this->form_vars[$name];
		}
		return null;
	}

	/**
	 *	ե
	 *
	 *	@access	public
	 *	@return	array	ե
	 */
	function getDef()
	{
		return $this->form;
	}

	/**
	 *	եɽ̾
	 *
	 *	@access	public
	 *	@param	string	$name	եͤ̾
	 *	@return	mixed	եͤɽ̾
	 */
	function getName($name)
	{
		if (isset($this->form[$name]) == false) {
			return null;
		}
		if (isset($this->form[$name]['name']) && $this->form[$name]['name'] != null) {
			return $this->form[$name]['name'];
		}

		// try message catalog
		return $this->i18n->get($name);
	}

	/**
	 *	եͤؤΥ(W)
	 *
	 *	@access	public
	 *	@param	string	$name	եͤ̾
	 *	@param	string	$value	ꤹ
	 */
	function set($name, $value)
	{
		$this->form_vars[$name] = $value;
	}

	/**
	 *	եͤˤ֤
	 *
	 *	@access	public
	 *	@param	bool	$escape	HTMLץե饰(true:פ)
	 *	@return	array	եͤǼ
	 */
	function &getArray($escape = true)
	{
		$retval = array();

		$this->_getArray($this->form_vars, $retval, $escape);

		return $retval;
	}

	/**
	 *	ץꥱͤΥ(R)
	 *
	 *	@access	public
	 *	@param	string	$name	
	 *	@return	mixed	ץꥱ
	 */
	function getApp($name)
	{
		if (isset($this->app_vars[$name]) == false) {
			return null;
		}
		return $this->app_vars[$name];
	}

	/**
	 *	ץꥱͤΥ(W)
	 *
	 *	@access	public
	 *	@param	string	$name	
	 *	@param	mixed	$value	
	 */
	function setApp($name, $value)
	{
		$this->app_vars[$name] = $value;
	}

	/**
	 *	ץꥱͤˤ֤
	 *
	 *	@access	public
	 *	@param	boolean	$escape	HTMLץե饰(true:פ)
	 *	@return	array	եͤǼ
	 */
	function getAppArray($escape = true)
	{
		$retval = array();

		$this->_getArray($this->app_vars, $retval, $escape);

		return $retval;
	}

	/**
	 *	ץꥱ(ưפʤ)Υ(R)
	 *
	 *	@access	public
	 *	@param	string	$name	
	 *	@return	mixed	ץꥱ
	 */
	function getAppNE($name)
	{
		if (isset($this->app_ne_vars[$name]) == false) {
			return null;
		}
		return $this->app_ne_vars[$name];
	}

	/**
	 *	ץꥱ(ưפʤ)Υ(W)
	 *
	 *	@access	public
	 *	@param	string	$name	
	 *	@param	mixed	$value	
	 */
	function setAppNE($name, $value)
	{
		$this->app_ne_vars[$name] = $value;
	}

	/**
	 *	ץꥱ(ưפʤ)ˤ֤
	 *
	 *	@access	public
	 *	@param	boolean	$escape	HTMLץե饰(true:פ)
	 *	@return	array	եͤǼ
	 */
	function getAppNEArray($escape = false)
	{
		$retval = array();

		$this->_getArray($this->app_ne_vars, $retval, $escape);

		return $retval;
	}

	/**
	 *	եˤ֤()
	 *
	 *	@access	private
	 *	@param	array	&$vars		ե()
	 *	@param	array	&$retval	ؤѴ
	 *	@param	bool	$escape		HTMLץե饰(true:פ)
	 */
	function _getArray(&$vars, &$retval, $escape)
	{
		foreach (array_keys($vars) as $name) {
			if (is_array($vars[$name])) {
				$retval[$name] = array();
				$this->_getArray($vars[$name], $retval[$name], $escape);
			} else {
				$retval[$name] = $escape ? htmlspecialchars($vars[$name]) : $vars[$name];
			}
		}
	}

	/**
	 *	ե͸ڥ᥽å
	 *
	 *	@access	public
	 *	@return	int		ȯ顼ο
	 */
	function validate()
	{
		foreach ($this->form as $name => $value) {
			$type = to_array($value['type']);
			if ($type[0] == VAR_TYPE_FILE) {
				// ե븡
				$tmp_name = to_array($this->form_vars[$name]['tmp_name']);
				$valid_keys = array();
				foreach ($tmp_name as $k => $v) {
					if (is_uploaded_file($tmp_name[$k]) == false) {
						// եʳ̵ͤ
						continue;
					}
					$valid_keys[] = $k;
				}
				if (count($valid_keys) == 0 && $value['required']) {
					$this->ae->add(E_FORM_REQUIRED, $name, "{form}˥ե򤷤Ʋ");
					continue;
				} else if (count($valid_keys) == 0 && $value['required'] == false) {
					continue;
				}

				if (is_array($this->form_vars[$name]['tmp_name'])) {
					if (is_array($value['type']) == false) {
						// ñΥեϤƤ
						$this->ae->add(E_FORM_WRONGTYPE_FILE, $name, "{form}ˤϥ顼ͤϤƤ");
						continue;
					}

					// եǡƹ
					$files = array();
					foreach ($valid_keys as $k) {
						$files[$k]['name'] = $this->form_vars[$name]['name'][$k];
						$files[$k]['type'] = $this->form_vars[$name]['type'][$k];
						$files[$k]['tmp_name'] = $this->form_vars[$name]['tmp_name'][$k];
						$files[$k]['size'] = $this->form_vars[$name]['size'][$k];
					}
					$this->form_vars[$name] = $files;

					// γǤФ븡
					foreach (array_keys($this->form_vars[$name]) as $key) {
						$this->_validate($name, $this->form_vars[$name][$key], $value);
					}
				} else {
					if (is_array($value['type'])) {
						// Υե˥顼ͤϤƤ
						$this->ae->add(E_FORM_WRONGTYPE_FILE, $name, "{form}ˤϤƤ");
						continue;
					}
					if (count($valid_keys) == 0) {
						$this->form_vars[$name] = null;
					}
					$this->_validate($name, $this->form_vars[$name], $value);
				}
			} else {
				if (is_array($this->form_vars[$name])) {
					if (is_array($value['type']) == false) {
						// 顼ΥեϤƤ
						$this->ae->add(E_FORM_WRONGTYPE_SCALAR, $name, "{form}ˤϥ顼ͤϤƤ");
						continue;
					}

					// γǤФѴ/
					foreach (array_keys($this->form_vars[$name]) as $key) {
						$this->form_vars[$name][$key] = $this->_convert($this->form_vars[$name][$key], $value['convert']);
						$this->_validate($name, $this->form_vars[$name][$key], $value);
					}
				} else {
					if ($this->form_vars[$name] == null && is_array($value['type']) && $value['required'] == false) {
						// 󷿤ǾάĤΤΤͼΤƤʤƤ⥨顼Ȥʤ
						continue;
					} else if (is_array($value['type'])) {
						$this->ae->add(E_FORM_WRONGTYPE_ARRAY, $name, "{form}ˤϤƤ");
						continue;
					}
					$this->form_vars[$name] = $this->_convert($this->form_vars[$name], $value['convert']);
					$this->_validate($name, $this->form_vars[$name], $value);
				}
			}
		}

		if ($this->ae->count() == 0) {
			// ɲøڥ᥽å
			$this->_validatePlus();
		}

		return $this->ae->count();
	}

	/**
	 *	å᥽å(쥯饹)
	 *
	 *	@access	public
	 *	@param	string	$name	ե̾
	 *	@return	array	åоݤΥե(顼̵null)
	 */
	function check($name)
	{
		if (is_null($this->form_vars[$name]) || $this->form_vars[$name] === "") {
			return null;
		}

		// Ethna_Backend
		$c =& $GLOBALS['controller'];
		$this->backend =& $c->getBackend();

		return to_array($this->form_vars[$name]);
	}

	/**
	 *	å᥽å: ¸ʸ
	 *
	 *	@access	public
	 *	@param	string	$name	ե̾
	 *	@return	object	Ethna_Error	顼֥(顼̵null)
	 */
	function &checkVendorChar($name)
	{
		$string = $this->form_vars[$name];
		for ($i = 0; $i < strlen($string); $i++) {
			/* JIS13Τߥå */
			$c = ord($string{$i});
			if ($c < 0x80) {
				/* ASCII */
			} else if ($c == 0x8e) {
				/* Ⱦѥ */
				$i++;
			} else if ($c == 0x8f) {
				/* JIS X 0212 */
				$i += 2;
			} else if ($c == 0xad || ($c >= 0xf9 && $c <= 0xfc)) {
				/* IBMĥʸ / NECIBMĥʸ */
				return $this->ad->add(E_FORM_INVALIDCHAR, $name, '{form}˵¸ʸϤƤޤ');
			} else {
				$i++;
			}
		}

		return null;
	}

	/**
	 *	å᥽å: bool
	 *
	 *	@access	public
	 *	@param	string	$name	ե̾
	 *	@return	object	Ethna_Error	顼֥(顼̵null)
	 */
	function &checkBoolean($name)
	{
		$form_vars = $this->check($name);
		if ($form_vars == null) {
			return null;
		}
		foreach ($form_vars as $v) {
			if ($v != "0" && $v != "1") {
				return $this->ae->add(E_FORM_INVALIDCHAR, $name, '{form}ϤƤ');
			}
		}
		return null;
	}

	/**
	 *	å᥽å: ᡼륢ɥ쥹
	 *
	 *	@access	public
	 *	@param	string	$name	ե̾
	 *	@return	object	Ethna_Error	顼֥(顼̵null)
	 */
	function &checkMailaddress($name)
	{
{'fraction_non_alphanumeric': 0.22451238798102266, 'fraction_numerical': 0.00716921454928835, 'mean_word_length': 2.8606023606023605, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 198, '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': '5133982', 'n_tokens_mistral': 9887, 'n_tokens_neox': 8504, 'n_words': 1385}