• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP YumUser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: actionprojectdetails

 public function actionprojectdetails()
 {
     if (!empty(Yii::app()->user->_data)) {
         $projectModel = new YumUserProject();
         // get project id
         $id = Yii::app()->request->getParam('project_id');
         // here define the userdocumentsprojects as relation
         $projectObj = $projectModel->with('projectresources')->findByPk($id);
         $projectArr = [];
         $projectArr['project'] = $projectObj;
         //get project tasks
         $projModel = new YumUserProject();
         $projectTasks = $projModel->findAll('parent_id=:parent_id', array('parent_id' => $id));
         if (!empty($projectTasks)) {
             $projectArr['task'] = $projectTasks;
         } else {
             $projectArr['task'] = [];
         }
         $allUsersModel = new YumUser();
         $allUsersObjs = $allUsersModel->findAll();
         $this->render('projectdetails', array('projectdetails' => $projectArr, 'allUsers' => $allUsersObjs));
     } else {
         $this->redirect(array('//user/auth/login'));
     }
 }
开发者ID:usmansaleem10,项目名称:youthpowered,代码行数:25,代码来源:YumUserProjectController.php


示例2: actionCreate

 public function actionCreate()
 {
     // if some data has been entered before or the user is already logged in,
     // take the already existing data and prefill the input form
     if ($model = Shop::getCustomer()) {
         $address = $model->address;
     } else {
         $model = new Customer();
     }
     if (isset($_POST['Customer'])) {
         $model->attributes = $_POST['Customer'];
         if (isset($_POST['Address'])) {
             $address = new Address();
             $address->attributes = $_POST['Address'];
             if ($address->save()) {
                 $model->address_id = $address->id;
             }
         }
         if (!Yii::app()->user->isGuest) {
             $model->user_id = Yii::app()->user->id;
         }
         $model->validate();
         if (Shop::module()->useWithYum && isset($_POST['register']) && ($_POST['register'] = true)) {
             if (isset($_POST['Customer']['password']) && isset($_POST['Customer']['passwordRepeat'])) {
                 if ($_POST['Customer']['password'] != $_POST['Customer']['passwordRepeat']) {
                     $model->addError('password', Shop::t('Passwords do not match'));
                 } else {
                     if ($_POST['Customer']['password'] == '') {
                         $model->addError('password', Shop::t('Password is empty'));
                     } else {
                         $user = new YumUser();
                         $profile = new YumProfile();
                         $profile->attributes = $_POST['Customer'];
                         $profile->attributes = $_POST['Address'];
                         if ($user->register(strtr($model->email, array('@' => '_', '.' => '_')), $_POST['Customer']['password'], $profile)) {
                             $user->status = YumUser::STATUS_ACTIVE;
                             $user->save(false, array('status'));
                             $model->user_id = $user->id;
                             Shop::setFlash(Shop::t('Successfully registered user'));
                         } else {
                             $model->addErrors($user->getErrors());
                             $model->addErrors($profile->getErrors());
                             Shop::setFlash(Shop::t('Error while registering user'));
                         }
                     }
                 }
             }
         }
         if (!$model->hasErrors()) {
             if ($model->save()) {
                 Yii::app()->user->setState('customer_id', $model->customer_id);
                 $this->redirect(array('//shop/order/create', 'customer' => $model->customer_id));
             }
         }
     }
     $this->render('create', array('customer' => $model, 'address' => isset($address) ? $address : new Address()));
 }
开发者ID:axetion007,项目名称:yii-shop,代码行数:57,代码来源:CustomerController.php


示例3: listDocuments

 public function listDocuments()
 {
     $model = new YumUserdocuments();
     $allDocuments = $model->findAll();
     Yii::import('user.models.*');
     $userModel = new YumUser();
     $allUsers = $userModel->findAll();
     if (!empty($allDocuments)) {
         $this->render('index', array('model' => $model, 'documents' => $allDocuments, 'allUsers' => $allUsers));
         return;
     } else {
         $this->render('index', array('model' => $model, 'documents' => $allDocuments, 'allUsers' => $allUsers));
     }
 }
开发者ID:usmansaleem10,项目名称:youthpowered,代码行数:14,代码来源:YumUserdocumentsController.php


示例4: actionEditAvatar

 public function actionEditAvatar()
 {
     $model = YumUser::model()->findByPk(Yii::app()->user->id);
     if (isset($_POST['YumUser'])) {
         $model->attributes = $_POST['YumUser'];
         $model->setScenario('avatarUpload');
         if (Yum::module('avatar')->avatarMaxWidth != 0) {
             $model->setScenario('avatarSizeCheck');
         }
         $model->avatar = CUploadedFile::getInstanceByName('YumUser[avatar]');
         if ($model->validate()) {
             if ($model->avatar instanceof CUploadedFile) {
                 // Prepend the id of the user to avoid filename conflicts
                 $filename = Yum::module('avatar')->avatarPath . '/' . $model->id . '_' . $_FILES['YumUser']['name']['avatar'];
                 $model->avatar->saveAs($filename);
                 $model->avatar = $filename;
                 if ($model->save()) {
                     Yum::setFlash(Yum::t('The image was uploaded successfully'));
                     Yum::log(Yum::t('User {username} uploaded avatar image {filename}', array('{username}' => $model->username, '{filename}' => $model->avatar)));
                     $this->redirect(array('//profile/profile/view'));
                 }
             }
         }
     }
     $this->render('edit_avatar', array('model' => $model));
 }
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:26,代码来源:YumAvatarController.php


示例5: actionRegistration

 public function actionRegistration()
 {
     Yii::import('application.modules.profile.models.*');
     $profile = new YumProfile();
     if (isset($_POST['Profile'])) {
         $profile->attributes = $_POST['YumProfile'];
         if ($profile->save()) {
             $user = new YumUser();
         }
         $password = YumUser::generatePassword();
         // we generate a dummy username here, since yum requires one
         $user->register(md5($profile->email), $password, $profile);
         $this->sendRegistrationEmail($user, $password);
         Yum::setFlash('Thank you for your registration. Please check your email.');
         $this->redirect(Yum::module()->loginUrl);
     }
     $this->render('/registration/registration', array('profile' => $profile));
 }
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:18,代码来源:RegistrationController.php


示例6: renderContent

 protected function renderContent()
 {
     parent::renderContent();
     if (Yii::app()->user->isGuest) {
         return false;
     }
     $user = YumUser::model()->findByPk(Yii::app()->user->id);
     $this->render('profile_comments', array('comments' => Yii::app()->user->data()->profile->recentComments()));
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:9,代码来源:ProfileCommentsWidget.php


示例7: checkexists

 public function checkexists($attribute, $params)
 {
     $user = null;
     // we only want to authenticate when there are no input errors so far
     if (!$this->hasErrors()) {
         if (strpos($this->login_or_email, "@")) {
             $profile = YumProfile::model()->findByAttributes(array('email' => $this->login_or_email));
             $this->user = $profile && $profile->user && $profile->user instanceof YumUser ? $profile->user : null;
         } else {
             $this->user = YumUser::model()->findByAttributes(array('username' => $this->login_or_email));
         }
     }
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:13,代码来源:YumPasswordRecoveryForm.php


示例8: loadModel

 public function loadModel($id = null)
 {
     if (!$id) {
         $id = Yii::app()->user->id;
     }
     if (is_numeric($id)) {
         return $this->_model = YumUser::model()->findByPk($id);
     } else {
         if (is_string($id)) {
             return $this->_model = YumUser::model()->find("username = '{$id}'");
         }
     }
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:13,代码来源:YumProfileController.php


示例9: isPublic

	public function isPublic($user = null) {
		if($user == null)
			$user = Yii::app()->user->id;

		if(!$this->visible)
			return false;

		if($privacy = YumUser::model()->findByPk($user)->privacy) {
			if($privacy->public_profile_fields & pow(2, $this->id))
				return true;
		}

		return false;
	}
开发者ID:neam,项目名称:yii-user-management,代码行数:14,代码来源:YumProfileField.php


示例10: rules

 public function rules()
 {
     $rules = parent::rules();
     if (!(Yum::hasModule('registration') && Yum::module('registration')->registration_by_email)) {
         $rules[] = array('username', 'required');
     }
     $rules[] = array('newsletter, terms,type_id', 'safe');
     // password requirement is already checked in YumUser model, its sufficient
     // to check for verifyPassword here
     $rules[] = array('verifyPassword', 'required');
     $rules[] = array('password', 'compare', 'compareAttribute' => 'verifyPassword', 'message' => Yum::t("Retype password is incorrect."));
     if (Yum::module('registration')->enableCaptcha && !Yum::module()->debug) {
         $rules[] = array('verifyCode', 'captcha', 'allowEmpty' => CCaptcha::checkRequirements());
     }
     return $rules;
 }
开发者ID:usmansaleem10,项目名称:youthpowered,代码行数:16,代码来源:YumRegistrationForm.php


示例11: actionCreate

 public function actionCreate()
 {
     $this->layout = Yum::module()->adminLayout;
     $model = new YumRole();
     $this->performAjaxValidation($model, 'yum-role-form');
     if (isset($_POST['YumRole'])) {
         $model->attributes = $_POST['YumRole'];
         if ($model->save()) {
             if (Yum::module()->enableLogging == true) {
                 $user = YumUser::model()->findbyPK(Yii::app()->user->id);
                 Yum::log(Yum::t('The role {role} has been created by {username}', array('{role}' => $model->title, '{username}' => Yii::app()->user->data()->username)));
             }
             $this->redirect(array('admin'));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:17,代码来源:YumRoleController.php


示例12: getPublicFields

 public function getPublicFields()
 {
     if (!Yum::module('profile')->enablePrivacySetting) {
         return false;
     }
     $fields = array();
     if ($privacy = @YumUser::model()->cache(500)->with('privacy')->findByPk($this->user_id)->privacy->public_profile_fields) {
         $i = 1;
         foreach (YumProfileField::model()->cache(500)->findAll() as $field) {
             if ($i & $privacy && $field->visible != 0) {
                 $fields[] = $field;
             }
             $i *= 2;
         }
     }
     return $fields;
 }
开发者ID:bhaveshsoni,项目名称:yii-user-management,代码行数:17,代码来源:YumProfile.php


示例13: actionCompose

 public function actionCompose($to_user_id = null, $answer_to = 0)
 {
     $model = new YumMessage();
     $this->performAjaxValidation('YumMessage', 'yum-message-form');
     if (isset($_POST['YumMessage'])) {
         $model->attributes = $_POST['YumMessage'];
         $model->from_user_id = Yii::app()->user->id;
         $model->validate();
         if (!$model->hasErrors()) {
             $model->save();
             Yum::setFlash(Yum::t('Message "{message}" has been sent to {to}', array('{message}' => $model->title, '{to}' => YumUser::model()->findByPk($model->to_user_id)->username)));
             $this->redirect(Yum::module('message')->inboxRoute);
         }
     }
     $fct = 'render';
     if (Yii::app()->request->isAjaxRequest) {
         $fct = 'renderPartial';
     }
     $this->{$fct}('compose', array('model' => $model, 'to_user_id' => $to_user_id, 'answer_to' => $answer_to));
 }
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:20,代码来源:YumMessageController.php


示例14: authenticate

 public function authenticate($without_password = false)
 {
     $user = YumUser::model()->find('username = :username', array(':username' => $this->username));
     // try to authenticate via email
     if (Yum::hasModule('profile') && Yum::module()->loginType & UserModule::LOGIN_BY_EMAIL && !$user) {
         if ($profile = YumProfile::model()->find('email = :email', array(':email' => $this->username))) {
             if ($profile->user) {
                 $user = $profile->user;
             }
         }
     }
     if (!$user) {
         return self::ERROR_STATUS_USER_DOES_NOT_EXIST;
     }
     if ($user->status == YumUser::STATUS_INACTIVE) {
         $this->errorCode = self::ERROR_STATUS_INACTIVE;
     } else {
         if ($user->status == YumUser::STATUS_BANNED) {
             $this->errorCode = self::ERROR_STATUS_BANNED;
         } else {
             if ($user->status == YumUser::STATUS_REMOVED) {
                 $this->errorCode = self::ERROR_STATUS_REMOVED;
             } else {
                 if ($without_password) {
                     $this->credentialsConfirmed($user);
                 } else {
                     if (!CPasswordHelper::verifyPassword($this->password, $user->password)) {
                         $this->errorCode = self::ERROR_PASSWORD_INVALID;
                     } else {
                         $this->credentialsConfirmed($user);
                     }
                 }
             }
         }
     }
     return !$this->errorCode;
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:37,代码来源:YumUserIdentity.php


示例15: write

 public static function write($to, $from, $subject, $body, $mail = true)
 {
     $message = new YumMessage();
     if (!$mail) {
         $message->omit_mail = true;
     }
     if (is_object($from)) {
         $message->from_user_id = (int) $from->id;
     } else {
         if (is_numeric($from)) {
             $message->from_user_id = $from;
         } else {
             if (is_string($from) && ($user = YumUser::model()->find("username = '{$from}'"))) {
                 $message->from_user_id = $user->id;
             } else {
                 return false;
             }
         }
     }
     if (is_object($to)) {
         $message->to_user_id = (int) $to->id;
     } else {
         if (is_numeric($to)) {
             $message->to_user_id = $to;
         } else {
             if (is_string($to) && ($user = YumUser::model()->find("username = '{$to}'"))) {
                 $message->to_user_id = $user->id;
             } else {
                 return false;
             }
         }
     }
     $message->title = $subject;
     $message->message = $body;
     return $message->save();
 }
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:36,代码来源:YumMessage.php


示例16: beforeSave

 public function beforeSave()
 {
     $this->updatetime = time();
     // If the user has activated email receiving, send a email
     if ($this->isNewRecord) {
         if ($user = YumUser::model()->findByPk($this->friend_id)) {
             if (Yum::hasModule('messages') && $user->privacy && $user->privacy->message_new_friendship) {
                 Yii::import('application.modules.messages.models.YumMessage');
                 YumMessage::write($user, $this->inviter, Yum::t('New friendship request from {username}', array('{username}' => $this->inviter->username)), YumTextSettings::getText('text_friendship_new', array('{username}' => $this->inviter->username, '{link_friends}' => Yii::app()->controller->createUrl('//friendship/friendship/index'), '{link_profile}' => Yii::app()->controller->createUrl('//profile/profile/view'), '{message}' => $this->message)));
             }
         }
     }
     return parent::beforeSave();
 }
开发者ID:bhaveshsoni,项目名称:yii-user-management,代码行数:14,代码来源:YumFriendship.php


示例17: array

?>
    </div>

    <div style="float: right; margin: 10px;">
        <div class="row">
            <?php 
echo $form->labelEx($model, 'superuser');
echo $form->dropDownList($model, 'superuser', YumUser::itemAlias('AdminStatus'));
echo $form->error($model, 'superuser');
?>
        </div>

        <div class="row">
            <?php 
echo $form->labelEx($model, 'status');
echo $form->dropDownList($model, 'status', YumUser::itemAlias('UserStatus'));
echo $form->error($model, 'status');
?>
        </div>
<?php 
if (Yum::hasModule('role')) {
    Yii::import('application.modules.role.models.*');
    ?>
            <div class="row roles">
                <p> <?php 
    echo Yum::t('User belongs to these roles');
    ?>
 </p>

                <?php 
    $this->widget('application.modules.user.components.Relation', array('model' => $model, 'relation' => 'roles', 'style' => 'dropdownlist', 'fields' => 'title', 'showAddButton' => false));
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:31,代码来源:_form.php


示例18: actionActivation

 /**
  * Activation of an user account. The Email and the Activation key send
  * by email needs to correct in order to continue. The Status will
  * be initially set to 1 (active - first Visit) so the administrator
  * can see, which accounts have been activated, but not yet logged in 
  * (more than once)
  */
 public function actionActivation($email, $key)
 {
     // If already logged in, we dont activate anymore
     if (!Yii::app()->user->isGuest) {
         Yum::setFlash('You are already logged in, please log out to activate your account');
         $this->redirect(Yii::app()->user->returnUrl);
     }
     // If everything is set properly, let the model handle the Validation
     // and do the Activation
     $status = YumUser::activate($email, $key);
     if ($status instanceof YumUser) {
         if (Yum::module('registration')->loginAfterSuccessfulActivation) {
             $login = new YumUserIdentity($status->username, false);
             $login->authenticate(true);
             Yii::app()->user->login($login);
         }
         $this->render(Yum::module('registration')->activationSuccessView);
     } else {
         $this->render(Yum::module('registration')->activationFailureView, array('error' => $status));
     }
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:28,代码来源:YumRegistrationController.php


示例19: actionLogout

 public function actionLogout()
 {
     // If the user is already logged out send them to returnLogoutUrl
     if (Yii::app()->user->isGuest) {
         $this->redirect(Yum::module()->returnLogoutUrl);
     }
     //let's delete the login_type cookie
     $cookie = Yii::app()->request->cookies['login_type'];
     if ($cookie) {
         $cookie->expire = time() - 3600 * 72;
         Yii::app()->request->cookies['login_type'] = $cookie;
     }
     if ($user = YumUser::model()->findByPk(Yii::app()->user->id)) {
         $username = $user->username;
         $user->logout();
         if (Yii::app()->user->name == 'facebook') {
             if (!Yum::module()->loginType & UserModule::LOGIN_BY_FACEBOOK) {
                 throw new Exception('actionLogout for Facebook was called, but is not activated in main.php');
             }
             Yii::import('application.modules.user.vendors.facebook.*');
             require_once 'Facebook.php';
             $facebook = new Facebook(Yum::module()->facebookConfig);
             $fb_cookie = 'fbs_' . Yum::module()->facebookConfig['appId'];
             $cookie = Yii::app()->request->cookies[$fb_cookie];
             if ($cookie) {
                 $cookie->expire = time() - 1 * (3600 * 72);
                 Yii::app()->request->cookies[$cookie->name] = $cookie;
                 $servername = '.' . Yii::app()->request->serverName;
                 setcookie("{$fb_cookie}", "", time() - 3600);
                 setcookie("{$fb_cookie}", "", time() - 3600, "/", "{$servername}", 1);
             }
             $session = $facebook->getSession();
             Yum::log('Facebook logout from user ' . $username);
             Yii::app()->user->logout();
             $this->redirect($facebook->getLogoutUrl(array('next' => $this->createAbsoluteUrl(Yum::module()->returnLogoutUrl), 'session_key' => $session['session_key'])));
         } else {
             Yum::log(Yum::t('User {username} logged off', array('{username}' => $username)));
             Yii::app()->user->logout();
         }
     }
     $this->redirect(Yum::module()->returnLogoutUrl);
 }
开发者ID:bhaveshsoni,项目名称:yii-user-management,代码行数:42,代码来源:YumAuthController.php


示例20: authenticate

	public function authenticate($without_password = false)
	{
		$user = YumUser::model()->find('username = :username', array(
					':username' => $this->username));

		// try to authenticate via email
		if(!$user && (Yum::module()->loginType & 2) && Yum::hasModule('profile')) {
			if($profile = YumProfile::model()->find('email = :email', array(
							':email' => $this->username)))
				if($profile->user)
					$user = $profile->user;
		}

		if(!$user)
			return self::ERROR_STATUS_USER_DOES_NOT_EXIST;

		if($without_password)
			$this->credentialsConfirmed($user);
		else if(YumUser::encrypt($this->password)!==$user->password)
			$this->errorCode=self::ERROR_PASSWORD_INVALID;
		else if($user->status == YumUser::STATUS_INACTIVE)
			$this->errorCode=self::ERROR_STATUS_INACTIVE;
		else if($user->status == YumUser::STATUS_BANNED)
			$this->errorCode=self::ERROR_STATUS_BANNED;
		else if($user->status == YumUser::STATUS_REMOVED)
			$this->errorCode=self::ERROR_STATUS_REMOVED;
		else
			$this->credentialsConfirmed($user);
		return !$this->errorCode;

	}
开发者ID:richardh68,项目名称:yii-user-management,代码行数:31,代码来源:YumUserIdentity.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ZEND_JSON类代码示例发布时间:2022-05-23
下一篇:
PHP Yum类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap