本文整理汇总了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;
}
}
示例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