/** * 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)); } }
public function actionClose() { $email = new Email; $this->performAjaxValidation($email); if(isset($_POST['Email'])) { $email->attributes = $_POST['Email']; $email->to = Y::config('email_to_registraiton'); $email->send(); Y::flash('success',Yii::t('interface', "email was sended")); } $this->render('/registration/close', array('model' => $email) ); }
<?php echo CHtml::tag('div', array('class'=>'admin-flash-msg'), Y::flash('deleteCategory')); echo CHtml::link('Создать категорию', Admin::url('categories/createNode')); $this->widget('ext.QTreeGridView.CQTreeGridView',array( 'dataProvider'=>$dp, 'cssFile'=>Yii::app()->baseUrl.'/css/grid/styles.css', 'template'=>'{items}', 'hideHeader'=>false, //'pager'=>array('cssFile'=>'/css/pager/pager-styles.css'), 'ajaxUpdate' => true, 'columns'=>array( array( 'name'=>'title', 'type'=>'raw', 'value'=>'$data->title' ), array( 'name'=>'alias', 'type'=>'raw', 'value'=>'$data->alias' ), array( 'name'=>'type', 'type'=>'raw', 'value'=>'$data->type' ), array( 'class'=>'CheckBoxColumnAjax', 'headerText'=>'published', 'checked'=>'$data->published', ),
<?php $this->pageTitle=Yii::app()->name . ' - '.Users::t("Login"); $this->breadcrumbs=array( Users::t("Login"), ); ?> <h1><?php echo Users::t("Login"); ?></h1> <?php if(Y::hasFlash('loginMessage')) { ?> <div class="success"> <?php echo Y::flash('loginMessage'); ?> </div> <?php } ?> <!-- <p><?php echo Users::t("Please fill out the following form with your login credentials:"); ?></p> --> <div class="form"> <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'login-form', 'enableAjaxValidation'=>true, 'enableClientValidation'=>false, 'focus'=>array($model,'username'), 'action'=>$this->module->loginUrl) ); ?> <?php echo CHtml::errorSummary($model); ?> <div class="row"> <?php echo $form->label($model,'username'); ?> <?php echo $form->textField($model,'username') ?> </div>
<?php $this->pageTitle=Yii::app()->name . ' - '.Users::t("Restore"); $this->breadcrumbs=array( 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(); ?>
<?php $this->pageTitle=Yii::app()->name . ' - '.Users::t("Profile"); $this->breadcrumbs=array( Users::t("Profile")=>Users::url('cabinet'), Users::t("Edit"), ); ?> <h2><?php echo Users::t('Edit profile'); ?></h2> <?php if(Y::isGuest()) {$this->widget('GuestMenu');} else {$this->widget('UserMenu');} ?> <?php if(Y::hasFlash('profileMessage')): ?> <div class="success"> <?php echo Y::flash('profileMessage'); ?> </div> <?php endif; ?> <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'); ?>
public function actionMoveData($action, $from, $to) { $fromCat = Category::model()->findByPk($from); $toCat = Category::model()->findByPk($to); if ($fromCat == null || $toCat == null) throw new CException("Не передан параметр fromCat или toCat в ".__CLASS__."::".__FUNCTION__); if ($fromCat->type != $toCat->type) throw new CException("Типы категорий не совпадают, копирование не может быть произведено."); if ($fromCat->moveAndDelete($action, $toCat)) $msg = "Категория удалена успешно"; else $msg = "Произошел сбой при удалении категории, попробуйте еще раз"; Y::flash('deleteCategory', $msg); $this->redirect(Admin::url('categories/admin')); }
<?php $this->pageTitle=Yii::app()->name . ' - '.Users::t("Registration"); $this->breadcrumbs=array( Users::t("Registration"), ); ?> <h1><?php echo Users::t("Registration"); ?></h1> <?php if(Y::hasFlash('registration')): ?> <div class="success"> <?php echo Y::flash('registration'); ?> </div> <?php else: ?> <div class="form"> <?php $form=$this->beginWidget('UActiveForm', array( 'id'=>'registration-form', 'enableAjaxValidation'=>true, 'disableAjaxValidationAttributes'=>array('RegistrationForm_verifyCode'), 'htmlOptions' => array('enctype'=>'multipart/form-data'), )); ?> <p class="note"><?php echo Users::t('Fields with <span class="required">*</span> are required.'); ?></p> <?php echo $form->errorSummary(array($model,$profile)); ?> <div class="row"> <?php echo $form->labelEx($model,'username'); ?> <?php echo $form->textField($model,'username'); ?> <?php echo $form->error($model,'username'); ?> </div>
<div> <?php echo Yii::t('errors', 'registration close', array('{email}'=>Y::config('email_to_registraiton') ));?> </div> <div class="form"> <?php if(Y::hasFlash('success')) { echo CHtml::tag('div', array('class'=>'success'), Y::flash('success')); }?> <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'send-mail', 'enableAjaxValidation'=>true )); ?> <?php echo CHtml::errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model,'subject'); ?> <?php echo $form->textField($model,'subject') ?> <?php echo $form->error($model,'subject'); ?> </div> <div class="row"> <?php echo $form->labelEx($model,'message'); ?> <?php echo $form->textArea($model,'message') ?> <?php echo $form->error($model,'message'); ?> </div> <div class="row submit"> <?php echo CHtml::submitButton(Yii::t('interface', "send mail")); ?> </div>