Код: Выделить всё
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('email', 'required'),
array('name_eng,name_rus', 'unique','message'=>'Such a real name is already in the database'),
array('username', 'unique', 'message'=>'Login must be unique. Such an entered login is already in the database', 'on'=>'create'),
array('username', 'length', 'max'=>140),
array('photo_name', 'file','maxSize'=>2097152,'types'=>'jpg,png,gif','allowEmpty'=>true),
array('email', 'email'),
array('role', 'length', 'max'=>20),
array('visits', 'length', 'max'=>11),
array('vs_code', 'length', 'max'=>100),
array('name_eng, name_rus, breeds_eng, breeds_rus, area_rus, area_eng, contact_rus, contact_eng, email, date_birth, description_rus, description_eng, site_URL', 'safe'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, username, role, name_eng, name_rus, breeds_eng, breeds_rus, area_rus, area_eng, contact_rus, contact_eng, email, photo_name, date_birth, description_rus, description_eng, visits, site_URL, date_reg, vs_code', 'safe', 'on'=>'search'),
array('old_photo', 'safe', 'on'=>'edit'),//вспомогательный элемент для загрузки фото
);
}