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


PHP UserAccess::addUserEvent方法代码示例

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


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

示例1: setUser

 protected function setUser($reddit_id, $name)
 {
     $query = new UserQuery();
     $users = $query->findByRedditID($reddit_id);
     $user = null;
     if ($users->count() == 0) {
         $user = new User();
         $user->setUsername($name);
         $user->setRedditID($reddit_id);
         $user->save();
     } else {
         $user = $users->getFirst();
     }
     if ($user->getBanned()) {
         // We block banned users by just not letting them log in
         session_destroy();
         return null;
     } else {
         $_SESSION[Auth::$SESSION_USER_ID] = $user->getId();
         //Record login
         UserAccess::addUserEvent($user, $_SERVER['REMOTE_ADDR'], UserAccessType::login);
         return $user;
     }
 }
开发者ID:pcmasteratings,项目名称:site,代码行数:24,代码来源:AAuthProvider.php

示例2: UserReview

$header = $game->getRatingHeaderForPlatform($platform);
$rating = $game->getRatingForPlatform($platform);
$user = Auth::getCurrentUser();
if (Auth::checkIfAuthenticated() && array_key_exists("submit_game_review", $_POST) && array_key_exists("submit_game_rating", $_POST)) {
    $new_review = $_POST["submit_game_review"];
    $new_rating = $_POST["submit_game_rating"];
    $review = UserReview::getUserReview($game, $platform, $user);
    if ($review == null) {
        $review = new UserReview();
        $review->setGame($game);
        $review->setPlatform($platform);
        $review->setUser($user);
        UserAccess::addUserEvent($user, $_SERVER['REMOTE_ADDR'], UserAccessType::addreview);
    } else {
        //we're editing an old review
        UserAccess::addUserEvent($user, $_SERVER['REMOTE_ADDR'], UserAccessType::editreview);
    }
    $review->setRatingId($new_rating);
    $review->setReview(strip_tags($new_review, '<br><br/>'));
    $review->save();
}
?>
<!DOCTYPE html>
<html>
<head>
    <?php 
include "res/head.php";
?>
    <link href="/css/bootstrap.min.css" rel="stylesheet"/>
    <meta charset="UTF-8"/>
    <title>PC Master Ratings - <?php 
开发者ID:pcmasteratings,项目名称:site,代码行数:31,代码来源:game.php


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