當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。