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


PHP User::getClientIdByUid方法代码示例

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


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

示例1: amIClient

 public function amIClient($uid = null)
 {
     $isLogged = false;
     if (is_null($uid)) {
         if (!Yii::$app->user->isGuest) {
             $uid = Yii::$app->getUser()->id;
         }
     }
     if (!is_null($uid)) {
         if (($client_id = (int) User::getClientIdByUid($uid)) > 0) {
             $this->client_id = $client_id;
             $isLogged = true;
         }
     }
     return $isLogged;
 }
开发者ID:babagay,项目名称:razzd,代码行数:16,代码来源:Twitter.php

示例2: actionRespond

 public function actionRespond($id = null, $hash = null)
 {
     $model = null;
     $userModel = new \frontend\models\User();
     if ($id) {
         $model = Razz::findOne($id);
     } elseif ($hash) {
         $model = Razz::findOne(['hash' => $hash]);
     }
     if (Yii::$app->getUser()->id === $model->uid) {
         //throw new HttpException(404, 'You are not allowed to respond to your own challenge!');
         return $this->render('error', ['model' => $model, 'message' => 'You are not allowed to respond to your own challenge!', 'userModel' => $userModel]);
     }
     if (!$model) {
         throw new HttpException(404, 'Razzd not found');
     }
     $model->scenario = 'respond';
     if ($model->responder_stream) {
         throw new HttpException(403, 'Razzd already responded.');
     }
     if (!Yii::$app->user->isGuest && $id && $model->hash && Yii::$app->user->id != $model->responder_uid) {
         // throw new HttpException(403, 'This razzd for other user.');
     } elseif (Yii::$app->user->isGuest && $model->responder_uid) {
         $this->redirect(['/login']);
     }
     if (!Yii::$app->user->isGuest && $id && $model->hash) {
         if (!is_null($model->facebook_id)) {
             $client_id = User::getClientIdByUid(Yii::$app->user->id);
             if ((int) $client_id != (int) $model->facebook_id) {
                 throw new HttpException(403, 'This razzd for other user!');
             }
         } elseif (!is_null($model->responder_uid)) {
             if (Yii::$app->user->id != $model->responder_uid) {
                 throw new HttpException(403, 'This razzd for other user...');
             }
         }
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $this->redirect('/razz/' . $model->id);
     } else {
         // print_r($model->getErrors());
         //exit();
     }
     return $this->render('respond', ['model' => $model, 'userModel' => $userModel]);
 }
开发者ID:babagay,项目名称:razzd,代码行数:45,代码来源:RazzController.php


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