<?php

/**
*
* @package Free Tube Script
* @version v1.0
* @copyright (c) 2011 Agriz
* @license GNU Public License Under Certain Conditions [Powered by should remain unchanged]
* @contact http://www.agrizlive.com
*
*/

	class AppModel extends Model {
	
		function invalidate($field, $value = null) {
			if (!is_array($this->validationErrors)) {
					$this->validationErrors = array();
			}
			if(empty($value)) {
					$value = true;
			}
			if (is_array($value)) {
					if (count($value) > 2) { # string %s %s string, trans1, trans2
							$translatedValue = sprintf(__($value[0], true), $value[1], $value[2]);
					} else {
							$translatedValue = sprintf(__($value[0], true), $value[1]);
					}
					$this->validationErrors[$field] = $translatedValue;
			} else {
					$this->validationErrors[$field] = __($value, true);
			}
		} 
	}	
?>