/** * Recovery password */ public function actionRecovery () { $form = new UserRecoveryForm; if (Y::userId()) { $this->redirect(Y::module()->returnUrl); Y::end(); } $email = isset($_GET['email']) ? $_GET['email'] : ''; $activkey = isset($_GET['activkey']) ? $_GET['activkey'] : ''; if ($email&&$activkey) { //get new pass $find = User::model()->notsafe()->findByAttributes(array('email'=>$email)); if(isset($find)&&$find->activkey==$activkey) { $form2 = new UserChangePassword; if(isset($_POST['UserChangePassword'])) { $form2->attributes=$_POST['UserChangePassword']; if($form2->validate()) { $find->password = UserModule::encrypting($form2->password); if ($find->status==0) { $find->status = 1; } $find->save(); Y::flash('recoveryMessage',Users::t("New password is saved.")); $this->redirect(Y::module()->recoveryUrl); } } $this->render('changepassword',array('form'=>$form2)); } else { Y::flash('recoveryMessage',Users::t("Incorrect recovery link.")); $this->redirect(Y::module()->recoveryUrl); } } else { //send email if(isset($_POST['UserRecoveryForm'])) { $form->attributes=$_POST['UserRecoveryForm']; if($form->validate()) { $user = User::model()->notsafe()->findbyPk($form->user_id); $user->activkey = Y::module()->encrypting(microtime().$user->password); $user->save(); $activation_url = 'http://' . $_SERVER['HTTP_HOST'].$this->siteUrl('user/recovery',array("activkey" => $user->activkey, "email" => urldecode($user->email))); $subject = Users::t("You have requested the password recovery site {site_name}", array( '{site_name}'=>Yii::app()->name, )); $message = Users::t("You have requested the password recovery site {site_name}. To receive a new password, go to {activation_url}.", array( '{site_name}'=>Yii::app()->name, '{activation_url}'=>$activation_url, )); UserModule::sendMail($user->email,$subject,$message); Y::flash('recoveryMessage',Users::t("Please check your email. An instructions was sent to your email address.")); $this->refresh(); } } $this->render('recovery',array('form'=>$form)); } }
/** * Authenticates the password. * This is the 'authenticate' validator as declared in rules(). */ public function authenticate($attribute,$params) { if(!$this->hasErrors()) // we only want to authenticate when no input errors { $identity=new UserIdentity($this->username,$this->password); $identity->authenticate(); switch($identity->errorCode) { case UserIdentity::ERROR_NONE: $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days Yii::app()->user->login($identity,$duration); break; case UserIdentity::ERROR_EMAIL_INVALID: $this->addError("username",Users::t("Email is incorrect.")); break; case UserIdentity::ERROR_USERNAME_INVALID: $this->addError("username",Users::t("Username is incorrect.")); break; case UserIdentity::ERROR_STATUS_NOTACTIV: $this->addError("status",Users::t("You account is not activated.")); break; case UserIdentity::ERROR_STATUS_BAN: $this->addError("status",Users::t("You account is blocked.")); break; case UserIdentity::ERROR_PASSWORD_INVALID: $this->addError("password",Users::t("Password is incorrect.")); break; } } }
/** * Declares attribute labels. */ public function attributeLabels() { return array( 'password'=>Users::t("password"), 'verifyPassword'=>Users::t("Retype Password"), ); }
/** * Initialization * @return array */ public function init() { return array( 'name'=>__CLASS__, 'label'=>Users::t('jQueryUI datepicker'), 'fieldType'=>array('DATE','VARCHAR'), 'params'=>$this->params, 'paramsLabels' => array( 'dateFormat'=>Users::t('Date format'), ), ); }
/** * Plugins initialization * @return array */ public function init() { return array( 'name'=>__CLASS__, 'label'=>Users::t('Relation Belongs To',array(),__CLASS__), 'fieldType'=>array('INTEGER'), 'params'=>$this->params, 'paramsLabels' => array( 'modelName'=>Users::t('Model Name',array(),__CLASS__), 'optionName'=>Users::t('Lable field name',array(),__CLASS__), 'emptyField'=>Users::t('Empty item name',array(),__CLASS__), 'relationName'=>Users::t('Profile model relation name',array(),__CLASS__), ), ); }
/** * Plugins initialization * @return array */ public function init() { return array( 'name'=>__CLASS__, 'label'=>Users::t('jQueryUI autocomplete',array(),__CLASS__), 'fieldType'=>array('INTEGER'), 'params'=>$this->params, 'paramsLabels' => array( 'modelName'=>Users::t('Model Name',array(),__CLASS__), 'optionName'=>Users::t('Lable field name',array(),__CLASS__), 'emptyFieldLabel'=>Users::t('Empty item name',array(),__CLASS__), 'emptyFieldValue'=>Users::t('Empty item value',array(),__CLASS__), 'relationName'=>Users::t('Profile model relation name',array(),__CLASS__), 'minLength'=>Users::t('minimal start research length',array(),__CLASS__), ), ); }
public function rules() { $rules = array( array('username, password, verifyPassword, email', 'required'), array('username', 'length', 'max'=>20, 'min' => 3,'message' => Users::t("Incorrect username (length between 2 and 20 characters).")), array('password', 'length', 'max'=>128, 'min' => 4,'message' => Users::t("Incorrect password (minimal length 4 symbols).")), array('email', 'email'), array('username', 'unique', 'message' => Users::t("This user's name already exists.")), array('email', 'unique', 'message' => Users::t("This user's email address already exists.")), array('verifyPassword', 'compare', 'compareAttribute'=>'password', 'message' => Users::t("Retype Password is incorrect.")), array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u','message' => Users::t("Incorrect symbols (A-z0-9).")), ); if (isset($_POST['ajax']) && $_POST['ajax']==='registration-form') return $rules; else array_push($rules,array('verifyCode', 'captcha', 'allowEmpty'=>!UsersModule::doCaptcha('registration'))); return $rules; }
/** * Activation user account */ public function actionActivation () { $email = $_GET['email']; $activkey = $_GET['activkey']; if ($email&&$activkey) { $find = User::model()->notsafe()->findByAttributes(array('email'=>$email)); if (isset($find)&&$find->status) { $this->render('/user/message',array('title'=>Users::t("User activation"),'content'=>Users::t("You account is active."))); } elseif(isset($find->activkey) && ($find->activkey==$activkey)) { $find->activkey = UserModule::encrypting(microtime()); $find->status = 1; $find->save(); $this->render('/user/message',array('title'=>Users::t("User activation"),'content'=>Users::t("You account is activated."))); } else { $this->render('/user/message',array('title'=>Users::t("User activation"),'content'=>Users::t("Incorrect activation URL."))); } } else { $this->render('/user/message',array('title'=>Users::t("User activation"),'content'=>Users::t("Incorrect activation URL."))); } }
public function checkexists($attribute,$params) { if(!$this->hasErrors()) // we only want to authenticate when no input errors { if (strpos($this->login_or_email,"@")) { $user=User::model()->findByAttributes(array('email'=>$this->login_or_email)); if ($user) $this->user_id=$user->id; } else { $user=User::model()->findByAttributes(array('username'=>$this->login_or_email)); if ($user) $this->user_id=$user->id; } if($user===null) if (strpos($this->login_or_email,"@")) { $this->addError("login_or_email",Users::t("Email is incorrect.")); } else { $this->addError("login_or_email",Users::t("Username is incorrect.")); } } }
/** * Registration user */ public function actionRegistration() { if(Y::module()->isRegistrationClose) $this->redirect('close'); $model = new RegistrationForm; $profile=new Profile; $profile->regMode = true; // ajax validator if(isset($_POST['ajax']) && $_POST['ajax']==='registration-form') Y::end(UActiveForm::validate(array($model,$profile))); if (Y::userId()) { $this->redirect(Y::module()->cabinetUrl); } else { if(isset($_POST['RegistrationForm'])) { $model->attributes=$_POST['RegistrationForm']; $profile->attributes= isset($_POST['Profile'])?$_POST['Profile']:array(); if($model->validate()&&$profile->validate()) { $soucePassword = $model->password; $model->activkey=UserModule::encrypting(microtime().$soucePassword); $model->password=UserModule::encrypting($soucePassword); $model->verifyPassword=UserModule::encrypting($model->verifyPassword); $model->createtime=time(); $model->lastvisit=((Y::module()->loginNotActiv||(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false))&&Y::module()->autoLogin)?time():0; $model->superuser=0; $model->status=((Y::module()->activeAfterRegister)?User::STATUS_ACTIVE:User::STATUS_NOACTIVE); if ($model->save()) { $profile->user_id=$model->id; $profile->save(); if (Y::module()->sendActivationMail) { $activation_url = $this->createAbsoluteUrl('/user/activation',array("activkey" => $model->activkey, "email" => $model->email)); UserModule::sendMail($model->email,Users::t("You registered from {site_name}",array('{site_name}'=>Yii::app()->name)),Users::t("Please activate you account go to {activation_url}",array('{activation_url}'=>$activation_url))); } if ((Y::module()->loginNotActiv||(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false))&&Y::module()->autoLogin) { $identity=new UserIdentity($model->username,$soucePassword); $identity->authenticate(); Y::user()->login($identity,0); $this->redirect(Y::module()->returnUrl); } else { if (!Y::module()->activeAfterRegister&&!Y::module()->sendActivationMail) { Y::flash('/user/registration',Users::t("Thank you for your registration. Contact Admin to activate your account.")); } elseif(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false) { Y::flash('/user/registration',Users::t("Thank you for your registration. Please {{login}}.",array('{{login}}'=>CHtml::link(Users::t('Login'),Y::module()->loginUrl)))); } elseif(Y::module()->loginNotActiv) { Y::flash('/user/registration',Users::t("Thank you for your registration. Please check your email or login.")); } else { Y::flash('/user/registration',Users::t("Thank you for your registration. Please check your email.")); } $this->refresh(); } } } else $profile->validate(); } $this->render('/user/registration',array('model'=>$model,'profile'=>$profile,'lang'=>Yii::app()->language)); } }
<?php $this->breadcrumbs=array( Users::t('Profile Fields')=>Users::url('profileField/admin'), Users::t('Manage Profile Field'), ); ?> <h1><?php echo Users::t('Manage Profile Fields'); ?></h1> <?php echo $this->renderPartial('_menu', array( 'list'=> array( CHtml::link(Users::t('Create Profile Field'),Users::url('profileField/create')), ), )); ?> <?php $this->widget('zii.widgets.grid.CGridView', array( 'dataProvider'=>$dataProvider, 'cssFile'=>'/css/grid/styles.css', 'columns'=>array( 'id', 'varname', array( 'name'=>'title', 'value'=>'Users::t($data->title)', ), 'field_type', 'field_size', //'field_size_min', array( 'name'=>'required', 'value'=>'ProfileField::itemAlias("required",$data->required)',
<?php $this->breadcrumbs=array( Users::t('Profile Fields')=>Users::url('profileField/admin'), Users::t($model->title), ); ?> <h1><?php echo Users::t('View Profile Field #').$model->varname; ?></h1> <?php echo $this->renderPartial('_menu', array( 'list'=> array( CHtml::link(Users::t('Create Profile Field'),Users::url('profileField/create')), CHtml::link(Users::t('Update Profile Field'),Users::url('profileField/update',array('id'=>$model->id))), CHtml::linkButton(Users::t('Delete Profile Field'),array('submit'=>Users::url('profileField/delete',array('id'=>$model->id)),'confirm'=>'Are you sure to delete this item?')), ), )); ?> <?php $this->widget('zii.components.CDetailView', array( 'data'=>$model, 'attributes'=>array( 'id', 'varname', 'title', 'field_type', 'field_size', 'field_size_min', 'required', 'match', 'range', 'error_message', 'other_validator',
/** * @return array customized attribute labels (name=>label) */ public function attributeLabels() { $labels = array( 'user_id' => Users::t('User ID'), ); $model=$this->getFields(); foreach ($model as $field) $labels[$field->varname] = ((Y::module('users')->fieldsMessage)?Users::t($field->title,array(),Y::module('users')->fieldsMessage):Users::t($field->title)); return $labels; }
Users::t("Login") => Users::url('login'), Users::t("Restore"), ); ?> <h1><?php echo Users::t("Restore"); ?></h1> <?php if(Y::hasFlash('recoveryMessage')): ?> <div class="success"> <?php echo Y::flash('recoveryMessage'); ?> </div> <?php else: ?> <div class="form"> <?php echo CHtml::beginForm(); ?> <?php echo CHtml::errorSummary($form); ?> <div class="row"> <?php echo CHtml::activeLabel($form,'login_or_email'); ?> <?php echo CHtml::activeTextField($form,'login_or_email') ?> <p class="hint"><?php echo Users::t("Please enter your login or email addres."); ?></p> </div> <div class="row submit"> <?php echo CHtml::submitButton(Users::t("Restore")); ?> </div> <?php echo CHtml::endForm(); ?> </div><!-- form --> <?php endif; ?>
echo$form->textArea($profile,$field->varname,array('rows'=>6, 'cols'=>50)); } else { echo $form->textField($profile,$field->varname,array('size'=>60,'maxlength'=>(($field->field_size)?$field->field_size:255))); } ?> <?php echo $form->error($profile,$field->varname); ?> </div> <?php } } ?> <?php if (UsersModule::doCaptcha('registration')): ?> <div class="row"> <?php echo $form->labelEx($model,'verifyCode'); ?> <?php $this->widget('CCaptcha'); ?> <?php echo $form->textField($model,'verifyCode'); ?> <?php echo $form->error($model,'verifyCode'); ?> <p class="hint"><?php echo Users::t("Please enter the letters as they are shown in the image above."); ?> <br/><?php echo Users::t("Letters are not case-sensitive."); ?></p> </div> <?php endif; ?> <div class="row submit"> <?php echo CHtml::submitButton(Users::t("Register")); ?> </div> <?php $this->endWidget(); ?> </div><!-- form --> <?php endif; ?>
'name' => 'status', 'value' => User::itemAlias("UserStatus",$model->status), ) ); $this->widget('zii.widgets.CDetailView', array( 'data'=>$model, 'attributes'=>$attributes )); $prof_attrs = array(); $profileFields=ProfileField::model()->forOwner()->sort()->findAll(); if ($profileFields) { foreach($profileFields as $field) { array_push($prof_attrs, array( 'label' => Users::t($field->title), 'name' => $field->varname, 'stype'=>'raw', 'value' => ($field->widgetView($model->profile)?$field->widgetView($model->profile): (($field->range)?Profile::range($field->range,$model->profile->getAttribute($field->varname)): $model->profile->getAttribute($field->varname))), )); } } echo 'Профиль'; $this->widget('zii.widgets.CDetailView', array( 'data'=>$model->profile, 'attributes'=>$prof_attrs, ));
<?php $this->breadcrumbs=array( (Users::t('Users'))=>array('admin'), $model->username=>array('view','id'=>$model->id), (Users::t('Update User')), ); ?> <h1><?php echo Users::t('Update User')." ".$model->id; ?></h1> <?php echo $this->renderPartial('_menu', array( 'list'=> array( CHtml::link(Users::t('Create User'),Users::url('admin/create')), CHtml::link(Users::t('View User'),Users::url('admin/view',array('id'=>$model->id))), ), )); echo $this->renderPartial('_form', array('model'=>$model,'profile'=>$profile)); ?>
public static function getWidgets($fieldType='') { $basePath=Yii::getPathOfAlias('application.modules.users.components'); $widgets = array(); $list = array(''=>Users::t('No')); if (self::$_widgets) { $widgets = self::$_widgets; } else { $d = dir($basePath); while (false !== ($file = $d->read())) { if (strpos($file,'UW')===0) { list($className) = explode('.',$file); if (!class_exists($className)) continue; $widgetClass = new $className; if (!$widgetClass->init()) continue; $widgets[$className] = $widgetClass->init(); if ($fieldType) { if (in_array($fieldType,$widgets[$className]['fieldType'])) $list[$className] = $widgets[$className]['label']; } else { $list[$className] = $widgets[$className]['label']; } } } $d->close(); } return array($list,$widgets); }
/** * Change password */ public function actionChangepassword() { $model = new UserChangePassword; if (Y::userId()) { // ajax validator if(isset($_POST['ajax']) && $_POST['ajax']==='changepassword-form') Y::end(UActiveForm::validate($model)); if(isset($_POST['UserChangePassword'])) { $model->attributes=$_POST['UserChangePassword']; if($model->validate()) { $new_password = User::model()->notsafe()->findbyPk(Y::userId()); $new_password->password = UserModule::encrypting($model->password); $new_password->activkey=UserModule::encrypting(microtime().$model->password); $new_password->save(); Y::flashRedir('profileMessage',Users::t("New password is saved."),$this->module->profileUrl); } } $this->render('changepassword',array('model'=>$model)); } }
<?php $this->breadcrumbs=array( Users::t('Profile Fields')=>Users::url('profileField/admin'), $model->title=>array('view','id'=>$model->id), Users::t('Update Profile Field'), ); ?> <h1><?php echo Users::t('Update ProfileField ').$model->id; ?></h1> <?php echo $this->renderPartial('_menu', array( 'list'=> array( CHtml::link(Users::t('Create Profile Field'),Users::url('profileField/create')), CHtml::link(Users::t('View Profile Field'),Users::url('profileField/view',array('id'=>$model->id))), ), )); ?> <?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
<?php $this->breadcrumbs=array( Users::t('Users')=>Users::url('admin'), Users::t('Create User'), ); ?> <h1><?php echo Users::t("Create User"); ?></h1> <?php echo $this->renderPartial('_menu',array( 'list'=> array(), )); echo $this->renderPartial('_form', array('model'=>$model,'profile'=>$profile)); ?>
<ul class="actions"> <?php if(UserModule::isAdmin()) { ?> <li><?php echo CHtml::link(Users::t('Manage User'),array('/user/admin')); ?></li> <?php } ?> <li><?php echo CHtml::link(Users::t('Profile'),Y::module()->profileUrl); ?></li> <li><?php echo CHtml::link(Users::t('Edit'),Y::module()->editProfileUrl); ?></li> <li><?php echo CHtml::link(Users::t('Change password'),Y::module()->changePassUrl); ?></li> <li><?php echo CHtml::link(Users::t('Logout'),Y::module()->logoutUrl); ?></li> <li><?php echo CHtml::link(Yii::t('interface', 'CreatePost'), Users::url("posts/create",array('lang' => Yii::app()->language, 'add_type'=>'post'))); ?></li> <li><?php echo CHtml::link(Yii::t('interface', 'CreateQuestion'),Users::url("posts/create",array('lang' => Yii::app()->language, 'add_type'=>'question'))); ?></li> </ul>
public static function activeDateField($model,$attribute,$htmlOptions=array()) { // SET UP ARRAYS OF OPTIONS FOR DAY, MONTH, YEAR $x = 1; $dayOptions = array('00'=>' - '); while ($x < 31) { $dayOptions[(($x<10)?'0':'').$x] = $x; $x++; } $monthOptions = array( '00' => ' - ', '01'=> Users::t('January'), '02'=> Users::t('February'), '03'=> Users::t('March'), '04'=> Users::t('April'), '05'=> Users::t('May'), '06'=> Users::t('June'), '07'=> Users::t('July'), '08'=> Users::t('August'), '09'=> Users::t('September'), '10'=> Users::t('October'), '11'=> Users::t('November'), '12'=> Users::t('December'), ); $yearOptions = array('0000'=>' - '); $x = 1901; while ($x < 2030) { $yearOptions[$x] = $x; $x++; } parent::resolveNameID($model,$attribute,$htmlOptions); if ($model->$attribute != '0000-00-00' && isset($model->$attribute)) { if (is_array($model->$attribute)) { $new = $model->$attribute; $day = $new['day']; $month = $new['month']; $year = $new['year']; } else { $new = explode('-',$model->$attribute); // intval removes leading zero $day = $new[2]; $month = $new[1]; $year = $new[0]; } } else { // DEFAULT TO 0 IF THERE IS NO DATE SET $day = '00'; $month = '00'; $year = '0000'; } //echo "<pre>"; print_r(array($day,$month,$year)); die(); $return = parent::dropDownList($htmlOptions['name'].'[day]', $day,$dayOptions); $return .= parent::dropDownList($htmlOptions['name'].'[month]', $month,$monthOptions); $return .= parent::dropDownList($htmlOptions['name'].'[year]', $year,$yearOptions); return $return; }
<ul class="actions"> <li><?php echo CHtml::link(Users::t('Manage User'),Users::url('admin')); ?></li> <li><?php echo CHtml::link(Users::t('Manage Profile Field'),Users::url('profileField/admin')); ?></li> <?php if (isset($list)) { foreach ($list as $item) echo "<li>".$item."</li>"; } ?> </ul><!-- actions -->
<?php $this->breadcrumbs=array( Users::t('Profile Fields')=>Users::url('profileField/admin'), Users::t('Create Profile Field'), ); ?> <h1><?php echo Users::t('Create Profile Field'); ?></h1> <?php echo $this->renderPartial('_menu',array( 'list'=> array(), )); ?> <?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
<div class="form"> <?php $form=$this->beginWidget('UActiveForm', array( 'id'=>'profile-form', 'enableAjaxValidation'=>true, 'htmlOptions' => array('enctype'=>'multipart/form-data'), )); ?> <?php echo $form->errorSummary(array($model,$profile)); ?> <?php echo $this->renderPartial('_form', array('profile'=>$profile, 'form'=>$form))?> <div class="row"> <?php echo $form->labelEx($model,'username'); ?> <?php echo $form->textField($model,'username',array('size'=>20,'maxlength'=>20)); ?> <?php echo $form->error($model,'username'); ?> </div> <div class="row"> <?php echo $form->labelEx($model,'email'); ?> <?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>128)); ?> <?php echo $form->error($model,'email'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? Users::t('Create') : Users::t('Save')); ?> </div> <?php $this->endWidget(); ?> </div><!-- form -->
<?php $this->pageTitle = Yii::app()->name . ' - ' . Users::t("Login"); ?> <div class="register"> <h3><?php echo $title; ?> </h3> <div class="form"> <?php echo $content; ?> </div><!-- yiiForm --> </div>
); ?> <?php echo CHtml::errorSummary($model); ?> <div class="row"> <?php echo $form->label($model,'username'); ?> <?php echo $form->textField($model,'username') ?> </div> <div class="row"> <?php echo $form->label($model,'password'); ?> <?php echo $form->passwordField($model,'password') ?> </div> <!-- <div class="row"> <p class="hint"> <?php echo CHtml::link(Users::t("Register"),$this->module->registrationUrl); ?> | <?php echo CHtml::link(Users::t("Lost Password?"),Y::module('users')->recoveryUrl); ?> </p> </div> <div class="row rememberMe"> <?php echo $form->checkBox($model,'rememberMe'); ?> <?php echo $form->label($model,'rememberMe'); ?> </div> --> <div class="row submit"> <?php echo CHtml::submitButton('Войти'); ?> </div> <?php $this->endWidget(); ?> </div><!-- form -->
<div class="form"> <?php $form=$this->beginWidget('UActiveForm', array( 'id'=>'changepassword-form', 'enableAjaxValidation'=>true, )); ?> <p class="note"><?php echo Users::t('Fields with <span class="required">*</span> are required.'); ?></p> <?php echo CHtml::errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model,'password'); ?> <?php echo $form->passwordField($model,'password'); ?> <?php echo $form->error($model,'password'); ?> <p class="hint"> <?php echo Users::t("Minimal password length 4 symbols."); ?> </p> </div> <div class="row"> <?php echo $form->labelEx($model,'verifyPassword'); ?> <?php echo $form->passwordField($model,'verifyPassword'); ?> <?php echo $form->error($model,'verifyPassword'); ?> </div> <div class="row submit"> <?php echo CHtml::submitButton(Users::t("Save")); ?> </div> <?php $this->endWidget(); ?> </div><!-- form -->
public static function itemAlias($type,$code=NULL) { $_items = array( 'field_type' => array( 'INTEGER' => Users::t('INTEGER'), 'VARCHAR' => Users::t('VARCHAR'), 'TEXT'=> Users::t('TEXT'), 'DATE'=> Users::t('DATE'), 'FLOAT'=> Users::t('FLOAT'), 'BOOL'=> Users::t('BOOL'), 'BLOB'=> Users::t('BLOB'), 'BINARY'=> Users::t('BINARY'), ), 'required' => array( self::REQUIRED_NO => Users::t('No'), self::REQUIRED_NO_SHOW_REG => Users::t('No, but show on registration form'), self::REQUIRED_YES_SHOW_REG => Users::t('Yes and show on registration form'), self::REQUIRED_YES_NOT_SHOW_REG => Users::t('Yes'), ), 'visible' => array( self::VISIBLE_ALL => Users::t('For all'), self::VISIBLE_REGISTER_USER => Users::t('Registered users'), self::VISIBLE_ONLY_OWNER => Users::t('Only owner'), self::VISIBLE_NO => Users::t('Hidden'), ), ); if (isset($code)) return isset($_items[$type][$code]) ? $_items[$type][$code] : false; else return isset($_items[$type]) ? $_items[$type] : false; }