当前位置: 首页>>代码示例>>PHP>>正文


PHP Members::model方法代码示例

本文整理汇总了PHP中Members::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Members::model方法的具体用法?PHP Members::model怎么用?PHP Members::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Members的用法示例。


在下文中一共展示了Members::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

 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;
 }
开发者ID:thongnv90,项目名称:bluesms,代码行数:28,代码来源:UserIdentity.php

示例2: authenticate

 /**
  * 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;
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:34,代码来源:facebookIdentity.php

示例3: actioneditauthitem

 /**
  * 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'));
     }
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:32,代码来源:RolesController.php

示例4: getModel

 /**
  * @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;
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:10,代码来源:CustomWebUser.php

示例5: actionIndex

 /**
  * 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));
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:35,代码来源:ContactusController.php

示例6: authenticate

 /**
  * 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;
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:34,代码来源:InternalIdentity.php

示例7: checkUniqueUserUpdate

 /**
  * 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.'));
         }
     }
 }
开发者ID:evan70,项目名称:yii-tracker,代码行数:12,代码来源:Users.php

示例8: actionDeductMoney

 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', '非法操作'));
     }
 }
开发者ID:elite-lcf,项目名称:mictfood,代码行数:50,代码来源:FoodorderController.php

示例9: actionviewprofile

 /**
  * 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.'));
     }
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:49,代码来源:UsersController.php

示例10: authenticate

 /**
  * 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;
 }
开发者ID:RoyZeng,项目名称:dinner,代码行数:26,代码来源:MemberIdentity.php

示例11: actionCreate

 /**
  * 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));
 }
开发者ID:roycocup,项目名称:stargym,代码行数:25,代码来源:PaymentsController.php

示例12: beforeControllerAction

 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;
     }
 }
开发者ID:RoyZeng,项目名称:dinner,代码行数:39,代码来源:ApiModule.php

示例13: array

<?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({
开发者ID:thongnv90,项目名称:bluesms,代码行数:31,代码来源:index.php

示例14: actionModifyAvatar

 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);
     }
 }
开发者ID:RoyZeng,项目名称:dinner,代码行数:22,代码来源:CenterController.php

示例15: array

<?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 
开发者ID:roycocup,项目名称:stargym,代码行数:31,代码来源:_form.php


注:本文中的Members::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。