예제 #1
0
 public function authenticate()
 {
     //		$users=array(
     //			// username => password
     //			'demo'=>'demo',
     //			'admin'=>'admin',
     //		);
     //		if(!isset($users[$this->username]))
     //			$this->errorCode=self::ERROR_USERNAME_INVALID;
     //		elseif($users[$this->username]!==$this->password)
     //			$this->errorCode=self::ERROR_PASSWORD_INVALID;
     //		else
     //			$this->errorCode=self::ERROR_NONE;
     //		return !$this->errorCode;
     $username = strtolower($this->username);
     $password = $this->password;
     $member = Members::model()->find('LOWER(pr_username)=?', array($username));
     //$user = Account::model()->find('LOWER(account_email)=?',array($username));
     if ($member === null) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } elseif (Members::model()->generaSalt($password) != $member->pr_member_password || $member->pr_member_status == 0) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         $this->_id = $member->pr_primary_key;
         $this->errorCode = self::ERROR_NONE;
     }
     return !$this->errorCode;
 }
 /**
  * Authenticate a member
  *
  * @return int value greater then 0 means an error occurred 
  */
 public function authenticate()
 {
     $record = Members::model()->find('fbuid=:fbuid', array(':fbuid' => $this->fbuid));
     if ($record === null) {
         $this->errorCode = self::ERROR_UNKNOWN_IDENTITY;
         $this->errorMessage = Yii::t('members', 'Sorry, We could not find a member with that facebook account.');
     } else {
         if ($record->email != $this->fbemail) {
             $this->errorCode = self::ERROR_USERNAME_INVALID;
             $this->errorMessage = Yii::t('members', 'Sorry, But the emails of the accounts did no match.');
         } else {
             $this->_id = $record->id;
             $auth = Yii::app()->authManager;
             if (!$auth->isAssigned($record->role, $this->_id)) {
                 if ($auth->assign($record->role, $this->_id)) {
                     Yii::app()->authManager->save();
                 }
             }
             // We add username to the state
             $this->setState('name', $record->username);
             $this->setState('username', $record->username);
             $this->setState('seoname', $record->seoname);
             $this->setState('email', $record->email);
             $this->setState('role', $record->role);
             $this->errorCode = self::ERROR_NONE;
         }
     }
     return !$this->errorCode;
 }
 /**
  * Edit auth item action
  */
 public function actioneditauthitem()
 {
     // Perms
     if (!Yii::app()->user->checkAccess('op_roles_edit_auth')) {
         throw new CHttpException(403, Yii::t('error', 'Sorry, You don\'t have the required permissions to enter this section'));
     }
     if (isset($_GET['id']) && ($model = AuthItem::model()->find('name=:name', array(':name' => $_GET['id'])))) {
         if (isset($_POST['AuthItem'])) {
             $old_name = $model->name;
             $model->attributes = $_POST['AuthItem'];
             if ($model->save()) {
                 // Update parent name and child name in the auth child table
                 AuthItemChild::model()->updateAll(array('parent' => $model->name), 'parent=:name', array(':name' => $old_name));
                 AuthItemChild::model()->updateAll(array('child' => $model->name), 'child=:name', array(':name' => $old_name));
                 AuthAssignments::model()->updateAll(array('bizrule' => $model->bizrule, 'data' => $model->data, 'itemname' => $model->name), 'itemname=:name', array(':name' => $old_name));
                 Members::model()->updateAll(array('role' => $model->name), 'role=:name', array(':name' => $old_name));
                 Yii::app()->user->setFlash('success', Yii::t('adminroles', 'Auth Item Updated.'));
                 $this->redirect(array('roles/index'));
             }
         }
         $this->breadcrumbs[Yii::t('adminroles', 'Editing auth item')] = '';
         $this->pageTitle[] = Yii::t('adminroles', 'Editing auth item');
         // Display form
         $this->render('authitem_form', array('model' => $model, 'label' => Yii::t('adminroles', 'Editing auth item')));
     } else {
         Yii::app()->user->setFlash('error', Yii::t('adminerror', 'Could not find that ID.'));
         $this->redirect(array('roles/index'));
     }
 }
 /**
  * @return object - Members AR Object
  */
 private function getModel()
 {
     if (!$this->isGuest && $this->_model === null) {
         $this->_model = Members::model()->findByPk($this->id, array('select' => 'role'));
     }
     return $this->_model;
 }
 /**
  * Show Form
  */
 public function actionIndex()
 {
     $model = new ContactUs();
     if (isset($_POST['ContactUs'])) {
         $model->attributes = $_POST['ContactUs'];
         if ($model->save()) {
             // Do we need to email?
             if (Yii::app()->params['contactusemail']) {
                 // Build Message
                 $message = Yii::t('contactus', "New Contact Us Form Submitted<br /><br />\n\t\t\t\t\t\t\t\t\t\t\t\t    Id: {id}<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\tBy: {name}<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\tEmail: {email}<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\tSubject: {subject}<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t========================<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t{msg}<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t========================<br /><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\tRegards, the {team} Team.", array('{id}' => $model->id, '{name}' => $model->name, '{email}' => $model->email, '{subject}' => $model->subject, '{msg}' => $model->content, '{team}' => Yii::app()->name));
                 $email = Yii::app()->email;
                 $email->subject = Yii::t('contactus', 'New Contact Us Form: {subject}', array('{subject}' => $model->subject));
                 $email->to = Yii::app()->params['emailout'];
                 $email->from = $model->email;
                 $email->replyTo = Yii::app()->params['emailout'];
                 $email->message = $message;
                 $email->send();
             }
             Yii::app()->user->setFlash('success', Yii::t('contactus', 'Thank You. The form submitted successfully.'));
             $model = new ContactUs();
         }
     }
     // If we are a member then fill in
     if (Yii::app()->user->id) {
         $user = Members::model()->findByPk(Yii::app()->user->id);
         if ($user) {
             $model->name = $user->username;
             $model->email = $user->email;
         }
     }
     $this->render('index', array('model' => $model));
 }
 /**
  * Authenticate a member
  *
  * @return int value greater then 0 means an error occurred 
  */
 public function authenticate()
 {
     $record = Members::model()->findByAttributes(array('email' => $this->name));
     if ($record === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
         $this->errorMessage = Yii::t('members', 'Sorry, But we can\'t find a member with those login information.');
     } else {
         if ($record->password !== $record->hashPassword($this->password, $record->email)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
             $this->errorMessage = Yii::t('members', 'Sorry, But the password did not match the one in our records.');
         } else {
             $this->_id = $record->id;
             $auth = Yii::app()->authManager;
             if (!$auth->isAssigned($record->role, $this->_id)) {
                 if ($auth->assign($record->role, $this->_id)) {
                     Yii::app()->authManager->save();
                 }
             }
             // We add username to the state
             $this->setState('name', $record->username);
             $this->setState('username', $record->username);
             $this->setState('seoname', $record->seoname);
             $this->setState('email', $record->email);
             $this->setState('role', $record->role);
             $this->errorCode = self::ERROR_NONE;
         }
     }
     return !$this->errorCode;
 }
예제 #7
0
 /**
  * Check that the username is unique
  */
 public function checkUniqueUserUpdate()
 {
     if ($this->scenario == 'update') {
         $user = Members::model()->exists('username=:username AND id!=:id', array(':username' => $this->username, ':id' => $this->id));
         if ($user) {
             $this->addError('username', Yii::t('adminmembers', 'Sorry, That username is already in use by another member.'));
         }
     }
 }
예제 #8
0
 public function actionDeductMoney()
 {
     if (Yii::app()->request->isAjaxRequest) {
         $food_order_id = Yii::app()->request->getParam('id');
         if (!$food_order_id) {
             $this->errorOutput(array('errorCode' => 1, 'errorText' => '没有id'));
         }
         $orderInfo = $this->loadModel($food_order_id);
         if (!$orderInfo) {
             $this->errorOutput(array('errorCode' => 1, 'errorText' => '该订单不存在'));
         } else {
             if ($orderInfo->status != 1) {
                 $this->errorOutput(array('errorCode' => 1, 'errorText' => '该订单不能付款'));
             }
         }
         //查询出该订单里用户的账户余额
         $member = Members::model()->find('id=:id', array(':id' => $orderInfo->food_user_id));
         if (!$member) {
             $this->errorOutput(array('errorCode' => 1, 'errorText' => '该订单的用户不存在'));
         }
         //判断用户的账户钱够不够扣钱
         if ($member->balance < $orderInfo->total_price) {
             $this->errorOutput(array('errorCode' => 1, 'errorText' => '该用户账户余额不足只有' . $member->balance . 'Ks'));
         }
         $member->balance -= $orderInfo->total_price;
         if ($member->save()) {
             $orderInfo->status = 2;
             if ($orderInfo->save()) {
                 //创建一条订单日志
                 $foodOrderLog = new FoodOrderLog();
                 $foodOrderLog->food_order_id = $food_order_id;
                 $foodOrderLog->status = $orderInfo->status;
                 $foodOrderLog->create_time = time();
                 if ($foodOrderLog->save()) {
                     //记录扣款记录
                     Yii::app()->record->record($orderInfo->food_user_id, $orderInfo->total_price);
                     $this->output(array('success' => 1, 'successText' => '扣款成功'));
                 } else {
                     $this->errorOutput(array('errorCode' => 1, 'errorText' => '订单状态更新失败'));
                 }
             } else {
                 $this->errorOutput(array('errorCode' => 1, 'errorText' => '订单状态更新失败'));
             }
         } else {
             $this->errorOutput(array('errorCode' => 1, 'errorText' => '扣款失败'));
         }
     } else {
         throw new CHttpException(404, Yii::t('yii', '非法操作'));
     }
 }
 /**
  * Profile action
  */
 public function actionviewprofile()
 {
     if (isset($_GET['uid']) && ($model = Members::model()->findByPk($_GET['uid']))) {
         $commentsModel = new UserComments();
         // Can add comments?
         $addcomments = false;
         $autoaddcomments = false;
         if (Yii::app()->user->id) {
             $addcomments = true;
         }
         if ($addcomments) {
             if (isset($_POST['UserComments'])) {
                 $commentsModel->attributes = $_POST['UserComments'];
                 $commentsModel->userid = $model->id;
                 $commentsModel->visible = 1;
                 if ($commentsModel->save()) {
                     Yii::app()->user->setFlash('success', Yii::t('users', 'Comment Added.'));
                     $commentsModel = new UserComments();
                 }
             }
         }
         // Grab the language data
         $criteria = new CDbCriteria();
         $criteria->condition = 'userid=:postid AND visible=:visible';
         $criteria->params = array(':postid' => $model->id, ':visible' => 1);
         $criteria->order = 'postdate DESC';
         // Load only approved
         if (Yii::app()->user->checkAccess('op_users_manage_comments')) {
             $criteria->condition .= ' OR visible=0';
         }
         $totalcomments = UserComments::model()->count($criteria);
         $pages = new CPagination($totalcomments);
         $pages->pageSize = self::PAGE_SIZE;
         $pages->applyLimit($criteria);
         // Grab comments
         $comments = UserComments::model()->orderDate()->findAll($criteria);
         // Markdown
         $markdown = new MarkdownParser();
         // Add page breadcrumb and title
         $this->pageTitle[] = Yii::t('users', 'Viewing {name} Profile', array('{name}' => $model->username));
         $this->breadcrumbs[Yii::t('users', 'Viewing {name} Profile', array('{name}' => $model->username))] = '';
         $this->render('profile', array('model' => $model, 'markdown' => $markdown, 'addcomments' => $addcomments, 'pages' => $pages, 'commentsModel' => $commentsModel, 'totalcomments' => $totalcomments, 'comments' => $comments));
     } else {
         throw new CHttpException(404, Yii::t('users', 'Sorry, But we could not find that user.'));
     }
 }
예제 #10
0
 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     //获取库里面用户信息
     $userinfo = Members::model()->find('name=:username', array(':username' => $this->username));
     if (!$userinfo) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         $_password = md5($userinfo->salt . $this->password);
         if ($_password != $userinfo->password) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             $this->errorCode = self::ERROR_NONE;
             //登录成功之后保持user信息
             $this->setState('member_userinfo', array('id' => $userinfo->id, 'username' => $userinfo->name));
         }
     }
     return !$this->errorCode;
 }
예제 #11
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Payments();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Payments'])) {
         $model->attributes = $_POST['Payments'];
         $member = Members::model()->findByPk($model->member_id);
         $transaction = $member->dbConnection->beginTransaction();
         if ($model->save()) {
             $member->next_payment_date = date('Y-m-d', strtotime('1 month'));
             if ($member->save()) {
                 $transaction->commit();
                 $this->redirect(array('view', 'id' => $model->id));
             }
         } else {
             $transaction->rollback();
         }
     }
     $this->render('create', array('model' => $model));
 }
예제 #12
0
 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         //如果需要登陆就检测用户是否登陆
         if (defined('NEED_LOGIN') && NEED_LOGIN) {
             //检测
             $accessToken = Yii::app()->request->getParam('access_token');
             if (!$accessToken) {
                 Error::output(Error::ERR_NO_LOGIN);
             } else {
                 //检测token有没有过期
                 $userLogin = UserLogin::model()->find("token = :token AND login_time + " . Yii::app()->params['login_expire_time'] . " > " . time(), array(':token' => $accessToken));
                 if ($userLogin) {
                     //根据用户id查询用户信息
                     $memberInfo = Members::model()->find('id = :id', array(':id' => $userLogin->user_id));
                     if (!$memberInfo) {
                         Error::output(Error::ERR_NO_LOGIN);
                     }
                     //转换成数组
                     $memberInfo = CJSON::decode(CJSON::encode($memberInfo));
                     //把用户信息存放到user里面供访问
                     unset($memberInfo['password'], $memberInfo['salt']);
                     //如果存在头像,就返回
                     if ($memberInfo['avatar']) {
                         //取图片数据
                         $material = Material::model()->findByPk($memberInfo['avatar']);
                         $memberInfo['avatar'] = array('host' => Yii::app()->params['img_url'], 'filepath' => $material->filepath, 'filename' => $material->filename);
                     }
                     $this->_user = $memberInfo;
                 } else {
                     Error::output(Error::ERR_NO_LOGIN);
                 }
             }
         }
         return true;
     } else {
         return false;
     }
 }
예제 #13
0
파일: index.php 프로젝트: thongnv90/bluesms
<?php

/* @var $this MembersController */
/* @var $dataProvider CActiveDataProvider */
$this->breadcrumbs = array('Thành viên');
//$this->menu=array(
//	array('label'=>'Create Members', 'url'=>array('create')),
//	array('label'=>'Manage Members', 'url'=>array('admin')),
//);
//
?>
<h1>Thành viên
        <?php 
$disable = "style=\"display:none;\" readonly";
if (Members::model()->getManagerSystem()) {
    $this->widget('bootstrap.widgets.TbButton', array('label' => '<i class="icon-plus"></i>&nbsp;Thêm thành viên', 'type' => 'none', 'size' => 'normal', 'encodeLabel' => false, 'buttonType' => 'link', 'url' => $this->createUrl('create')));
    $disable = "";
}
?>
</h1>

<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'gridview-members', 'dataProvider' => $dataProvider, 'type' => 'striped bordered condensed', 'template' => "{items}{pager}", 'columns' => array(array('header' => '<input type="checkbox" name="case" id="selectall" value="" />', 'type' => 'raw', 'value' => '\'<input type="checkbox" name="case" class="case" value="$data->pr_primary_key" />\''), array('header' => '#', 'type' => 'raw', 'name' => 'pr_primary_key', 'value' => '$data->pr_primary_key'), array('header' => 'Tài khoản', 'type' => 'raw', 'name' => 'pr_username', 'value' => '$data->pr_username'), array('header' => 'Tên thành viên', 'type' => 'raw', 'value' => '\'<a href="\'.YII::app()->createUrl("Members/default/view",array("id"=>$data->pr_primary_key)).\'">\'.$data->memberProfile->pr_member_profile_display_name.\'</a>\''), array('header' => 'Email', 'type' => 'raw', 'name' => 'pr_member_email', 'value' => '$data->pr_member_email'), array('header' => 'Actions', 'headerHtmlOptions' => array('style' => 'text-align:center;width:120px'), 'htmlOptions' => array('style' => 'text-align:center'), 'type' => 'raw', 'value' => '($data->pr_member_status) ? ' . '\'<a href="#" id="member_delete" ' . $disable . ' onclick="ajaxDeleteMember(\'.$data->pr_primary_key.\');return false;" data-original-title="Xóa" rel="tooltip" title><i class="icon-trash"></i></a>
                    <a href="#" id="member_delete" ' . $disable . ' onclick="ajaxClockMember(\'.$data->pr_primary_key.\',0)" data-original-title="Khóa" rel="tooltip" title><i class="icon-unlock"></i></a>\'' . ': \'<a href="#" id="member_delete" ' . $disable . ' onclick="ajaxDeleteMember(\'.$data->pr_primary_key.\');return false;" data-original-title="Xóa" rel="tooltip" title><i class="icon-trash"></i></a>
                    <a href="#" id="member_delete" ' . $disable . ' onclick="ajaxClockMember(\'.$data->pr_primary_key.\',1)" data-original-title="Khóa" rel="tooltip" title><i class="icon-lock"></i></a>\''))));
?>

<script type="text/javascript">
    function ajaxDeleteMember(member_id)
    {
        $.ajax({
예제 #14
0
 public function actionModifyAvatar()
 {
     //处理图片
     if ($_FILES['avatar'] && !$_FILES['avatar']['error']) {
         $imgInfo = Yii::app()->material->upload('avatar');
         if ($imgInfo) {
             //更新到用户表里面
             $member = Members::model()->findByPk($this->module->user['id']);
             $member->avatar = $imgInfo['id'];
             if ($member->save()) {
                 Out::jsonOutput(array('return' => 1));
                 //留言成功
             } else {
                 Error::output(Error::ERR_UPLOAD_FAIL);
             }
         } else {
             Error::output(Error::ERR_UPLOAD_FAIL);
         }
     } else {
         Error::output(Error::ERR_NO_SELECT_FILE);
     }
 }
예제 #15
0
파일: _form.php 프로젝트: roycocup/stargym
<?php

$members = Members::model()->findAll();
?>

<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'payments-form', 'enableAjaxValidation' => false));
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'member_id');
?>
		<?php 
echo CHtml::dropDownList('Payments[member_id]', '*', CHtml::listData($members, 'id', 'slug'));
?>
		<?php 
echo $form->error($model, 'member_id');
?>
	</div>

	<div class="row">
		<?php 
예제 #16
0
 public function getManagerSystem()
 {
     $member_id = YII::app()->user->id;
     // Kiem tra co phai mamager cua he thong khong
     $model = Members::model()->findByPk($member_id);
     if ($model->pr_roles_id == 1) {
         return true;
     }
     return false;
 }
예제 #17
0
 public function loadModel($id)
 {
     $model = Members::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #18
0
					<td><?php 
echo Yii::t('adminindex', 'Newsletter Signups');
?>
</td>
					<td><?php 
echo Yii::app()->format->number(Newsletter::model()->count());
?>
</td>
				</tr>
				<tr>
					<td><?php 
echo Yii::t('adminindex', 'Last Registered');
?>
</td>
					<td><?php 
echo Members::model()->find(array('order' => 'joined desc', 'limit' => 1))->getModelLink();
?>
</td>
				</tr>
				<tr>
					<td><?php 
echo Yii::t('adminindex', 'User Comments');
?>
</td>
					<td><?php 
echo Yii::app()->format->number(UserComments::model()->count());
?>
</td>
				</tr>
				<tr>
					<td><?php 
예제 #19
0
 public function actionRegister()
 {
     $name = Yii::app()->request->getParam('name');
     $password1 = Yii::app()->request->getParam('password1');
     $password2 = Yii::app()->request->getParam('password2');
     if (!$name) {
         Error::output(Error::ERR_NO_USER_NAME);
     } else {
         if (strlen($name) > 15) {
             Error::output(Error::ERR_USERNAME_TOO_LONG);
         }
     }
     if (!$password1 || !$password2) {
         Error::output(Error::ERR_NO_PASSWORD);
     } else {
         if (strlen($password1) > 15 || strlen($password2) > 15) {
             Error::output(Error::ERR_PASSWORD_TOO_LONG);
         } else {
             if ($password1 !== $password2) {
                 Error::output(Error::ERR_TWO_PASSWORD_NOT_SAME);
             }
         }
     }
     //判断该用户是不是已经存在了
     $_member = Members::model()->find('name=:name', array(':name' => $name));
     if ($_member) {
         Error::output(Error::ERR_USER_HAS_EXISTS);
     }
     //随机长生一个干扰码
     $salt = Common::getGenerateSalt();
     $model = new Members();
     $model->name = $name;
     $model->salt = $salt;
     $model->password = md5($salt . $password1);
     $model->create_time = time();
     $model->update_time = time();
     if ($model->save()) {
         $model->order_id = $model->id;
         $model->save();
         //注册成功返回数据
         $member = CJSON::decode(CJSON::encode($model));
         //返回数据
         Out::jsonOutput($member);
     } else {
         Error::output(Error::ERR_SAVE_FAIL);
     }
 }
예제 #20
0
	    </tr>
	</tfoot>
	<tbody>
		<?php 
if (is_array($rows) && count($rows)) {
    ?>
			<?php 
    foreach ($rows as $row) {
        ?>
			<tr>
	        	<td><?php 
        $this->widget('ext.VGGravatarWidget', array('size' => 40, 'email' => $row->email, 'htmlOptions' => array('class' => 'imgavatar tiptop', 'title' => $row->username, 'alt' => 'avatar')));
        ?>
</td>
				<td><?php 
        echo Members::model()->getLink($row->username, $row->id, $row->seoname);
        ?>
</td>
				<td><?php 
        echo Yii::app()->dateFormatter->formatDateTime($row->joined, 'short', 'short');
        ?>
</td>
				<td><?php 
        echo Yii::t('users', ucfirst($row->role));
        ?>
</td>
	    	</tr>
			<?php 
    }
    ?>
		<?php 
예제 #21
0
 function actionClockMember()
 {
     if (isset($_POST['member_id']) && isset($_POST['status_id'])) {
         $model = Members::model()->findByPk($_POST['member_id']);
     }
     $model->pr_member_status = $_POST['status_id'];
     if ($model->save()) {
         if ($_POST['status_id'] == 0) {
             echo '{"status":"clock"}';
         } else {
             echo '{"status":"unclock"}';
         }
     }
 }
예제 #22
0
				<?php 
    }
    ?>
			</ul>
		</div>
		<div id="footerscr">
			<h4 class="icon16"><?php 
    echo Yii::t('global', 'Latest Users Joined');
    ?>
</h4>
			<?php 
    if ($this->beginCache('indexlastestusers', array('duration' => 3600))) {
        ?>
			<ul id="listscrfooter">
					<?php 
        $last = Members::model()->findAll(array('order' => 'joined DESC', 'limit' => 4));
        ?>

					<?php 
        if (is_array($last) && count($last)) {
            ?>
						<?php 
            foreach ($last as $member) {
                ?>
							<li><a href='<?php 
                echo Yii::app()->createUrl('user/' . $member->id . '-' . $member->seoname, array('lang' => false));
                ?>
'><?php 
                $this->widget('ext.VGGravatarWidget', array('size' => 60, 'email' => $member->email, 'htmlOptions' => array('class' => 'imgavatar', 'title' => CHtml::encode($member->username), 'alt' => 'avatar')));
                ?>
</a></li>
예제 #23
0
파일: _form.php 프로젝트: reubsc/sds
<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'member-details-form', 'enableAjaxValidation' => false));
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'memberID');
?>
                <?php 
echo CHtml::activeDropDownList($model, 'memberID', Chtml::listData(Members::model()->findAll(), 'memberID', 'memberName'), array('empty' => 'Select a Member'));
?>
		<?php 
echo $form->error($model, 'memberID');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'govermentTypeID');
?>
		<?php 
//echo $form->textField($model,'govermentTypeID',array('size'=>11,'maxlength'=>11));
?>
                <?php 
echo CHtml::activeDropDownList($model, 'govermentTypeID', Chtml::listData(GovermentTypes::model()->findAll(), 'govermentTypeID', 'govermentTypeName'), array('empty' => 'Select a Goverment Type'));
예제 #24
0
        echo $v['smallTotal'];
        ?>
</td>
		</tr>
		<?php 
    }
    ?>
		<?php 
}
?>
	</tbody>
	<tfoot>
		<tr>
			<td colspan="4">
			<p class="resident_flag"><em/>扣费类型:<em><?php 
$memberInfo = Members::model()->find('id=:id', array(':id' => Yii::app()->user->member_userinfo['id']));
//常驻员工单次订购不允许超过1份
if ($memberInfo->resident == 1 && $order['Count'] > 1) {
    echo '<script>
			        alert("常驻员工每餐只允许订购一份!请返回购物车修改!");
			        </script>';
    $this->redirect(Yii::app()->createUrl('site/lookmenu', array('shop_id' => $order['shop_id'], 'resident_flag' => yes)));
}
//$memberInfo = Members::model()->find('id=:id',array(':id' => Yii::app()->user->member_userinfo['id']));
echo Yii::app()->params['resident_flag'][$memberInfo->resident];
/*if($memberInfo->balance < $this->order['Total'] && !in_array(Yii::app()->user->member_userinfo['id'], Yii::app()->params['allow_user_id']))
	 {
	 throw new CHttpException(404,Yii::t('yii','亲!您的账户余额不足,不能下单哦,到行政MM交钱吧!'));
	 }*/
?>
 </em></p>
예제 #25
0
 public function actionDomodify()
 {
     $cur_password = Yii::app()->request->getPost('cur_password');
     $new_password = Yii::app()->request->getPost('new_password');
     $comfirm_password = Yii::app()->request->getPost('comfirm_password');
     if (!$cur_password) {
         $this->errorOutput(array('errorCode' => 1, 'errorText' => '当前密码不能为空'));
     }
     if (!$new_password || !$comfirm_password) {
         $this->errorOutput(array('errorCode' => 1, 'errorText' => '新密码不能为空'));
     } else {
         if (strlen($new_password) > 15 || strlen($comfirm_password) > 15) {
             $this->errorOutput(array('errorCode' => 1, 'errorText' => '新密码不能超过15个字符'));
         } else {
             if ($new_password !== $comfirm_password) {
                 $this->errorOutput(array('errorCode' => 1, 'errorText' => '两次密码不相符'));
             }
         }
     }
     //判断该用户是不是已经存在了
     $_member = Members::model()->find('id=:id', array(':id' => Yii::app()->user->member_userinfo['id']));
     if (!$_member) {
         $this->errorOutput(array('errorCode' => 1, 'errorText' => '当前用户不存在'));
     } else {
         if (md5($_member->salt . $cur_password) != $_member->password) {
             $this->errorOutput(array('errorCode' => 1, 'errorText' => '当前密码输入错误'));
         }
     }
     //随机长生一个干扰码
     $salt = Common::getGenerateSalt();
     $_member->salt = $salt;
     $_member->password = md5($salt . $new_password);
     $_member->update_time = time();
     if ($_member->save()) {
         $this->output(array('success' => 1, 'successText' => '修改成功'));
     } else {
         $this->errorOutput(array('errorCode' => 1, 'errorText' => '修改失败'));
     }
 }
 /**
  * View user action
  */
 public function actionviewuser()
 {
     if (isset($_GET['id']) && ($model = Members::model()->findByPk($_GET['id']))) {
         $this->breadcrumbs[Yii::t('adminmembers', 'Viewing User')] = '';
         $this->pageTitle[] = Yii::t('adminmembers', 'Viewing User');
         // Display
         $this->render('user_view', array('model' => $model, 'label' => Yii::t('adminmembers', 'Viewing User')));
     } else {
         Yii::app()->user->setFlash('error', Yii::t('adminerror', 'Could not find that ID.'));
         $this->redirect(array('members/index'));
     }
 }
 /**
  * Check the var in the password form and if it is ok 
  * then reset the password and email the member the new one.
  */
 public function actionreset()
 {
     $q = Yii::app()->format->text($_GET['q']);
     // Search for this in the DB
     $member = Members::model()->findByAttributes(array('passwordreset' => $q));
     if (!$member) {
         Yii::app()->user->setFlash('error', Yii::t('login', 'Sorry, Nothing was found for that reset link.'));
         $this->redirect('index/index');
     }
     // We matched so now reset the reset link,
     // Create a new password and save it for that member
     // Email and redirect
     // Create secret reset link
     $password = $member->generatePassword(5, 10);
     $hashedPassword = $member->hashPassword($password, $member->email);
     $message = Yii::t('login', "Dear {username},<br /><br />\n\t\t\t\t\t\t\t\t\tWe have reseted your password successfully.<br /><br />\n\t\t\t\t\t\t\t\t\tYou new password is: <b>{password}</b><br />", array('{username}' => $member->username, '{password}' => $password));
     $message .= Yii::t('global', '<br /><br />----------------<br />Regards,<br />The {team} Team.<br />', array('{team}' => Yii::app()->name));
     $email = Yii::app()->email;
     $email->subject = Yii::t('login', 'Password Reset Completed');
     $email->to = $member->email;
     $email->from = Yii::app()->params['emailin'];
     $email->replyTo = Yii::app()->params['emailout'];
     $email->message = $message;
     $email->send();
     // Save the key for this member
     $member->passwordreset = '';
     $member->password = $hashedPassword;
     $member->scenario = 'lostpassword';
     $member->save();
     Yii::app()->user->setFlash('success', Yii::t('login', 'Thank You. Your password was reset. Please check your email for you new generated password.'));
     $this->redirect('index/index');
 }
 /**
  * Get the rows for the sitemap
  */
 protected function getRows()
 {
     $_rows = array();
     // Grab blog cats
     $blogCats = BlogCats::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language));
     if (count($blogCats)) {
         foreach ($blogCats as $blogCat) {
             $_rows[] = $this->makeData($this->getFullUrl('/blog/category/' . $blogCat->alias), time(), 'monthly', 0.1);
         }
     }
     // Grab blog rows
     $blogRows = Blog::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language));
     if (count($blogRows)) {
         foreach ($blogRows as $blogRow) {
             $_rows[] = $this->makeData($this->getFullUrl('/blog/view/' . $blogRow->alias), $blogRow->postdate, 'weekly', 1);
         }
     }
     // Grab tutorials cats
     $tutorialsCats = TutorialsCats::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language));
     if (count($tutorialsCats)) {
         foreach ($tutorialsCats as $tutorialsCat) {
             $_rows[] = $this->makeData($this->getFullUrl('/tutorials/category/' . $tutorialsCat->alias), time(), 'monthly', 0.1);
         }
     }
     // Grab tutorials rows
     $tutorialsRows = Tutorials::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language));
     if (count($tutorialsRows)) {
         foreach ($tutorialsRows as $tutorialsRow) {
             $_rows[] = $this->makeData($this->getFullUrl('/tutorials/view/' . $tutorialsRow->alias), $tutorialsRow->postdate, 'weekly', 1);
         }
     }
     // Grab extensions cats
     $extensionsCats = ExtensionsCats::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language));
     if (count($extensionsCats)) {
         foreach ($extensionsCats as $extensionsCat) {
             $_rows[] = $this->makeData($this->getFullUrl('/extensions/category/' . $extensionsCat->alias), time(), 'monthly', 0.1);
         }
     }
     // Grab extensions rows
     $extensionsRows = Extensions::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language));
     if (count($extensionsRows)) {
         foreach ($extensionsRows as $extensionsRow) {
             $_rows[] = $this->makeData($this->getFullUrl('/extensions/view/' . $extensionsRow->alias), $extensionsRow->postdate, 'weekly', 1);
         }
     }
     // Grab users rows
     $usersRows = Members::model()->findAll();
     if (count($usersRows)) {
         foreach ($usersRows as $usersRow) {
             $_rows[] = $this->makeData($this->getFullUrl('/user/' . $usersRow->id . '-' . $usersRow->seoname), $usersRow->joined, 'monthly', 1);
         }
     }
     // Grab forum topics rows
     $forumTopics = ForumTopics::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language));
     if (count($forumTopics)) {
         foreach ($forumTopics as $forumTopic) {
             $_rows[] = $this->makeData($this->getFullUrl('/forum/topic/' . $forumTopic->id . '-' . $forumTopic->alias), $forumTopic->dateposted, 'daily', 1);
         }
     }
     // Grab custom pages
     $customPages = CustomPages::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language));
     if (count($customPages)) {
         foreach ($customPages as $customPage) {
             $_rows[] = $this->makeData($this->getFullUrl('/' . $forumTopic->alias), $customPage->dateposted, 'weekly', 1);
         }
     }
     // Grab documentation pages
     $documentations = Documentation::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language));
     if (count($documentations)) {
         foreach ($documentations as $documentation) {
             $_rows[] = $this->makeData($this->getFullUrl('/documentation/guide/' . $documentation->type . '/topic/' . $documentation->mkey), $documentation->last_updated, 'weekly', 1);
         }
     }
     // Return array
     return $_rows;
 }