/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if (WCF::getUser()->userID && $eventObj->board->countUserPosts && $eventObj->disablePost) { WBBUser::updateUserPosts(WCF::getUser()->userID, 1); if (ACTIVITY_POINTS_PER_POST) { UserRank::updateActivityPoints(ACTIVITY_POINTS_PER_POST); } } }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if ($eventObj->action == 'enable') { if ($eventObj->post->userID && $eventObj->board->countUserPosts && $eventObj->board->getModeratorPermission('canEnableThread') && !$eventObj->post->everEnabled) { WBBUser::updateUserPosts($eventObj->post->userID, -1); if (ACTIVITY_POINTS_PER_POST) { UserRank::updateActivityPoints(ACTIVITY_POINTS_PER_POST * -1, $eventObj->post->userID); } } } }
public function save() { parent::save(); if ($this->server == null) { $this->server = new Server($this->serverID); } $comment = ServerCommentEditor::create($this->server->serverID, BASHCore::getUser()->userID, $this->username, $this->text, TIME_NOW, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes, BASHCore::getUser()->userID > 0 ? false : true); if (MODULE_USER_RANK and BASHCore::getUser()->userID > 0) { require_once WCF_DIR . 'lib/data/user/rank/UserRank.class.php'; UserRank::updateActivityPoints(SERVER_COMMENT_USER_ACTIVITY_POINTS); } HeaderUtil::redirect('index.php?page=ServerDetail&serverID=' . $comment->serverID . SID_ARG_2ND_NOT_ENCODED . '#comment' . $comment->commentID); }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if ($eventObj->action == 'enable') { if ($eventObj->thread->userID && $eventObj->board->countUserPosts && $eventObj->board->getModeratorPermission('canEnableThread') && !$eventObj->thread->everEnabled) { WBBUser::updateUserPosts($eventObj->thread->userID, -1); if (ACTIVITY_POINTS_PER_THREAD) { UserRank::updateActivityPoints(ACTIVITY_POINTS_PER_THREAD * -1, $eventObj->thread->userID); } $postIDs = explode(',', ThreadEditor::getAllPostIDs((string) $eventObj->thread->threadID)); foreach ($postIDs as $postID) { $post = new Post($postID); if ($post->postID != $eventObj->thread->firstPostID && !$post->everEnabled) { WBBUser::updateUserPosts($post->userID, -1); if (ACTIVITY_POINTS_PER_POST) { UserRank::updateActivityPoints(ACTIVITY_POINTS_PER_POST * -1, $post->userID); } } } } } }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { // get userIDs $userIDs = ''; $sql = "SELECT\t\tuserID\n\t\t\tFROM\t\twbb" . WBB_N . "_user\n\t\t\tORDER BY\tuserID"; $result = WCF::getDB()->sendQuery($sql, $eventObj->limit, $eventObj->limit * $eventObj->loop); while ($row = WCF::getDB()->fetchArray($result)) { $userIDs .= ',' . $row['userID']; } if (empty($userIDs)) { return; } // get boardIDs $boardIDs = ''; $sql = "SELECT\tboardID\n\t\t\tFROM\twbb" . WBB_N . "_board\n\t\t\tWHERE\tboardType = 0\n\t\t\t\tAND countUserPosts = 1"; $result2 = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result2)) { $boardIDs .= ',' . $row['boardID']; } // update users posts $sql = "UPDATE\twbb" . WBB_N . "_user user\n\t\t\tSET\tposts = (\n\t\t\t\t\tSELECT\t\tCOUNT(*)\n\t\t\t\t\tFROM\t\twbb" . WBB_N . "_post post\n\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\t\tWHERE\t\tpost.userID = user.userID\n\t\t\t\t\t\t\tAND thread.boardID IN (0" . $boardIDs . ")\n\t\t\t\t)\n\t\t\tWHERE\tuser.userID IN (0" . $userIDs . ")"; WCF::getDB()->sendQuery($sql); // update activity points $sql = "SELECT\t\twbb_user.userID,\n\t\t\t\t\twbb_user.posts,\n\t\t\t\t\tuser.activityPoints,\n\t\t\t\t\tCOUNT(thread.threadID) AS threads\n\t\t\tFROM\t\twbb" . WBB_N . "_user wbb_user\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_user user\n\t\t\tON\t\t(user.userID = wbb_user.userID)\n\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\tON\t\t(thread.userID = wbb_user.userID AND thread.boardID IN (0" . $boardIDs . "))\n\t\t\tWHERE\t\twbb_user.userID IN (0" . $userIDs . ")\n\t\t\tGROUP BY\twbb_user.userID"; $result2 = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result2)) { $activityPoints = $row['threads'] * ACTIVITY_POINTS_PER_THREAD + ($row['posts'] - $row['threads']) * ACTIVITY_POINTS_PER_POST; // update activity points for this package $sql = "REPLACE INTO\twcf" . WCF_N . "_user_activity_point\n\t\t\t\t\t\t(userID, packageID, activityPoints)\n\t\t\t\tVALUES \t\t(" . $row['userID'] . ", " . PACKAGE_ID . ", " . $activityPoints . ")"; WCF::getDB()->sendQuery($sql); } // update global activity points $sql = "UPDATE\twcf" . WCF_N . "_user user\n\t\t\tSET\tuser.activityPoints = (\n\t\t\t\t\tSELECT\tSUM(activityPoints)\n\t\t\t\t\tFROM\twcf" . WCF_N . "_user_activity_point\n\t\t\t\t\tWHERE\tuserID = user.userID\n\t\t\t\t)\n\t\t\tWHERE\tuser.userID IN (0" . $userIDs . ")"; WCF::getDB()->sendQuery($sql); // update user rank WCF::getDB()->seekResult($result, 0); while ($row = WCF::getDB()->fetchArray($result)) { UserRank::updateActivityPoints(0, $row['userID']); } }
//Do the ranks $UploadedRank = UserRank::get_rank('uploaded', $Uploaded); $DownloadedRank = UserRank::get_rank('downloaded', $Downloaded); $UploadsRank = UserRank::get_rank('uploads', $Uploads); $RequestRank = UserRank::get_rank('requests', $RequestsFilled); $PostRank = UserRank::get_rank('posts', $ForumPosts); $BountyRank = UserRank::get_rank('bounty', $TotalSpent); $ArtistsRank = UserRank::get_rank('artists', $ArtistsAdded); if ($Downloaded == 0) { $Ratio = 1; } elseif ($Uploaded == 0) { $Ratio = 0.5; } else { $Ratio = round($Uploaded / $Downloaded, 2); } $OverallRank = UserRank::overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio); ?> <div class="box box_info box_userinfo_percentile"> <div class="head colhead_dark">Percentile Rankings (hover for values)</div> <ul class="stats nobullet"> <?php if ($Override = check_paranoia_here('uploaded')) { ?> <li class="tooltip<?php echo $Override === 2 ? ' paranoia_override' : ''; ?> " title="<?php echo Format::get_size($Uploaded); ?> ">Data uploaded: <?php echo $UploadedRank === false ? 'Server busy' : number_format($UploadedRank);
/** * Updates the user stats (user posts, activity points & user rank). * * @param string $threadIDs changed threads * @param string $mode (enable|copy|move|delete) * @param integer $destinationBoardID */ public static function updateUserStats($threadIDs, $mode, $destinationBoardID = 0) { if (empty($threadIDs)) { return; } // get destination board $destinationBoard = null; if ($destinationBoardID) { $destinationBoard = Board::getBoard($destinationBoardID); } if ($mode == 'copy' && !$destinationBoard->countUserPosts) { return; } // update user posts, activity points $userPosts = array(); $userActivityPoints = array(); $sql = "SELECT\tboardID, userID\n\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\tWHERE\tthreadID IN (" . $threadIDs . ")\n\t\t\t\t" . ($mode != 'enable' ? "AND everEnabled = 1" : '') . "\n\t\t\t\tAND userID <> 0"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { $board = Board::getBoard($row['boardID']); switch ($mode) { case 'enable': if ($board->countUserPosts) { // posts if (!isset($userPosts[$row['userID']])) { $userPosts[$row['userID']] = 0; } $userPosts[$row['userID']]++; // activity points if (!isset($userActivityPoints[$row['userID']])) { $userActivityPoints[$row['userID']] = 0; } $userActivityPoints[$row['userID']] += ACTIVITY_POINTS_PER_THREAD; } break; case 'copy': if ($destinationBoard->countUserPosts) { // posts if (!isset($userPosts[$row['userID']])) { $userPosts[$row['userID']] = 0; } $userPosts[$row['userID']]++; // activity points if (!isset($userActivityPoints[$row['userID']])) { $userActivityPoints[$row['userID']] = 0; } $userActivityPoints[$row['userID']] += ACTIVITY_POINTS_PER_THREAD; } break; case 'move': if ($board->countUserPosts != $destinationBoard->countUserPosts) { // posts if (!isset($userPosts[$row['userID']])) { $userPosts[$row['userID']] = 0; } $userPosts[$row['userID']] += $board->countUserPosts ? -1 : 1; // activity points if (!isset($userActivityPoints[$row['userID']])) { $userActivityPoints[$row['userID']] = 0; } $userActivityPoints[$row['userID']] += $board->countUserPosts ? ACTIVITY_POINTS_PER_THREAD * -1 : ACTIVITY_POINTS_PER_THREAD; } break; case 'delete': if ($board->countUserPosts) { // posts if (!isset($userPosts[$row['userID']])) { $userPosts[$row['userID']] = 0; } $userPosts[$row['userID']]--; // activity points if (!isset($userActivityPoints[$row['userID']])) { $userActivityPoints[$row['userID']] = 0; } $userActivityPoints[$row['userID']] -= ACTIVITY_POINTS_PER_THREAD; } break; } } // save posts if (count($userPosts)) { require_once WBB_DIR . 'lib/data/user/WBBUser.class.php'; foreach ($userPosts as $userID => $posts) { WBBUser::updateUserPosts($userID, $posts); } } // save activity points if (count($userActivityPoints)) { require_once WCF_DIR . 'lib/data/user/rank/UserRank.class.php'; foreach ($userActivityPoints as $userID => $points) { UserRank::updateActivityPoints($points, $userID); } } }
<div class="store-activity"> <div class="page-desc-holder"> Warcry WoW offers a unique selection of avatars based on your rank.<br/> Avatars are progressively unlocked as you go up, at the highest rank you may upload<br/> your own avatar. </div> <div class="container_3 account-wide" align="center"> <div class="avatars_groups"> <?php //Let's display our galleries $storage = new AvatarGallery(); foreach ($storage->getGalleries() as $RequiredRank => $avatars) { $GalleryRank = new UserRank($RequiredRank); //make sure we have any avatars in this gallery if (count($avatars) == 0) { continue; } //Staff avatars, skip for users if ($RequiredRank >= RANK_STAFF_MEMBER) { if ($CURUSER->getRank()->int() < RANK_STAFF_MEMBER) { continue; } } echo ' <div class="avatars_group_holder ', $CURUSER->getRank()->int() < $RequiredRank ? 'not_avaliable' : '', '"> <h1>', $GalleryRank->string(), ' Avatars</h1> <ul class="avatars_group">'; //Loop the avatars in this gallery
//Verify that we have permissions to edit //Start by checking if we own that post if ($CURUSER->get('id') != $Post['author']) { //Since we dont own the post //Check if we have the minimum required rank if ($CURUSER->getRank()->int() < $config['FORUM']['Min_Rank_Post_Edit']) { WCF::SetupNotification('You do not meet the requirements to edit this post.'); header("Location: " . $config['BaseURL'] . "/forums.php"); die; } else { //We have the minimum required rank //now check if the authoer is lower rank //If the author is not resolved we assume he is lower rank if ($userInfo = WCF::getAuthorInfo($Post['author'])) { //Get the poster rank $userRank = new UserRank($userInfo['rank']); //The author has equal or geater rank, we cant delete his post if ($CURUSER->getRank()->int() <= $userRank->int()) { WCF::SetupNotification('You do not meet the requirements to edit this post.'); header("Location: " . $config['BaseURL'] . "/forums.php"); die; } } } } //Set the title $TPL->SetTitle('Edit Reply'); $TPL->SetParameter('topbar', true); //Print the header $TPL->LoadHeader(); if ($topic = WCF::getTopicInfo($Post['topic'])) {
/** * @see Action::execute() */ public function execute() { parent::execute(); // count users $sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twbb" . WBB_N . "_user"; $row = WCF::getDB()->getFirstRow($sql); $count = $row['count']; // get user ids $userIDs = ''; $sql = "SELECT\t\tuserID\n\t\t\tFROM\t\twbb" . WBB_N . "_user\n\t\t\tORDER BY\tuserID"; $result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop); while ($row = WCF::getDB()->fetchArray($result)) { $userIDs .= ',' . $row['userID']; // update last posts if (PROFILE_SHOW_LAST_POSTS) { // delete old entries $sql = "DELETE FROM\twbb" . WBB_N . "_user_last_post\n\t\t\t\t\tWHERE\t\tuserID = " . $row['userID']; WCF::getDB()->sendQuery($sql); // get new entries $sql = "SELECT\t\tpostID, time\n\t\t\t\t\tFROM\t\twbb" . WBB_N . "_post\n\t\t\t\t\tWHERE\t\tuserID = " . $row['userID'] . "\n\t\t\t\t\tORDER BY\ttime DESC"; $result2 = WCF::getDB()->sendQuery($sql, 20); while ($row2 = WCF::getDB()->fetchArray($result2)) { $sql = "INSERT INTO\twbb" . WBB_N . "_user_last_post\n\t\t\t\t\t\t\t\t(userID, postID, time)\n\t\t\t\t\t\tVALUES\t\t(" . $row['userID'] . ", " . $row2['postID'] . ", " . $row2['time'] . ")"; WCF::getDB()->sendQuery($sql); } } } if (empty($userIDs)) { $this->calcProgress(); $this->finish(); } // get boards $boardIDs = ''; $sql = "SELECT\tboardID\n\t\t\tFROM\twbb" . WBB_N . "_board\n\t\t\tWHERE\tboardType = 0\n\t\t\t\tAND countUserPosts = 1"; $result2 = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result2)) { $boardIDs .= ',' . $row['boardID']; } // update users posts $sql = "UPDATE\twbb" . WBB_N . "_user user\n\t\t\tSET\tposts = (\n\t\t\t\t\tSELECT\t\tCOUNT(*)\n\t\t\t\t\tFROM\t\twbb" . WBB_N . "_post post\n\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\t\tWHERE\t\tpost.userID = user.userID\n\t\t\t\t\t\t\tAND post.isDeleted = 0\n\t\t\t\t\t\t\tAND post.isDisabled = 0\n\t\t\t\t\t\t\tAND thread.boardID IN (0" . $boardIDs . ")\n\t\t\t\t)\n\t\t\tWHERE\tuser.userID IN (0" . $userIDs . ")"; WCF::getDB()->sendQuery($sql); // update activity points $sql = "SELECT\t\twbb_user.userID, wbb_user.posts, user.activityPoints, COUNT(thread.threadID) AS threads\n\t\t\tFROM\t\twbb" . WBB_N . "_user wbb_user\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_user user\n\t\t\tON\t\t(user.userID = wbb_user.userID)\n\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\tON\t\t(thread.userID = wbb_user.userID AND thread.boardID IN (0" . $boardIDs . ") AND thread.isDeleted = 0 AND thread.isDisabled = 0)\n\t\t\tWHERE\t\twbb_user.userID IN (0" . $userIDs . ")\n\t\t\tGROUP BY\twbb_user.userID"; $result2 = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result2)) { $activityPoints = $row['threads'] * ACTIVITY_POINTS_PER_THREAD + ($row['posts'] - $row['threads']) * ACTIVITY_POINTS_PER_POST; // update activity points for this package $sql = "REPLACE INTO\twcf" . WCF_N . "_user_activity_point\n\t\t\t\t\t\t(userID, packageID, activityPoints)\n\t\t\t\tVALUES \t\t(" . $row['userID'] . ", " . PACKAGE_ID . ", " . $activityPoints . ")"; WCF::getDB()->sendQuery($sql); } // remove obsolet activity points $sql = "DELETE FROM\twcf" . WCF_N . "_user_activity_point\n\t\t\tWHERE\t\tpackageID NOT IN (\n\t\t\t\t\t\tSELECT\tpackageID\n\t\t\t\t\t\tFROM\twcf" . WCF_N . "_package\n\t\t\t\t\t)"; WCF::getDB()->sendQuery($sql); // update global activity points $sql = "UPDATE\twcf" . WCF_N . "_user user\n\t\t\tSET\tuser.activityPoints = (\n\t\t\t\t\tSELECT\tSUM(activityPoints)\n\t\t\t\t\tFROM\twcf" . WCF_N . "_user_activity_point\n\t\t\t\t\tWHERE\tuserID = user.userID\n\t\t\t\t)\n\t\t\tWHERE\tuser.userID IN (0" . $userIDs . ")"; WCF::getDB()->sendQuery($sql); // update pm counts $sql = "UPDATE\twcf" . WCF_N . "_user user\n\t\t\tSET\tpmUnreadCount = (\n\t\t\t\t\tSELECT\tCOUNT(*)\n\t\t\t\t\tFROM \twcf" . WCF_N . "_pm_to_user\n\t\t\t\t\tWHERE \trecipientID = user.userID\n\t\t\t\t\t\tAND isDeleted < 2\n\t\t\t\t\t\tAND isViewed = 0\n\t\t\t\t),\n\t\t\t\tpmTotalCount = (\n\t\t\t\t\tSELECT\tCOUNT(*)\n\t\t\t\t\tFROM \twcf" . WCF_N . "_pm_to_user\n\t\t\t\t\tWHERE \trecipientID = user.userID\n\t\t\t\t\t\tAND isDeleted < 2)\n\t\t\t\t\t\t+ (\n\t\t\t\t\tSELECT\t\tCOUNT(*)\n\t\t\t\t\tFROM \t\twcf" . WCF_N . "_pm pm\n\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_pm_to_user pm_to_user\n\t\t\t\t\tON\t\t(pm_to_user.pmID = pm.pmID\n\t\t\t\t\t\t\tAND pm_to_user.recipientID = pm.userID\n\t\t\t\t\t\t\tAND pm_to_user.isDeleted < 2)\n\t\t\t\t\tWHERE \t\tuserID = user.userID\n\t\t\t\t\t\t\tAND (saveInOutBox = 1\n\t\t\t\t\t\t\tOR isDraft = 1)\n\t\t\t\t\t\t\tAND pm_to_user.pmID IS NULL)\n\t\t\tWHERE\tuser.userID IN (0" . $userIDs . ")"; WCF::getDB()->sendQuery($sql); // update user rank require_once WCF_DIR . 'lib/data/user/rank/UserRank.class.php'; WCF::getDB()->seekResult($result, 0); while ($row = WCF::getDB()->fetchArray($result)) { UserRank::updateActivityPoints(0, $row['userID']); } $this->executed(); $this->calcProgress($this->limit * $this->loop, $count); $this->nextLoop(); }
//Pull some data from the Auth DB $authRes = $AUTH_DB->prepare("SELECT * FROM `account` WHERE `id` = :acc LIMIT 1;"); $authRes->bindParam(':acc', $aRow['id'], PDO::PARAM_INT); $authRes->execute(); //Fetch it $authRow = $authRes->fetch(); $GMLevel = ''; //Check for GM Level $gmRes = $AUTH_DB->prepare("SELECT * FROM `account_access` WHERE `id` = :acc;"); $gmRes->bindParam(':acc', $aRow['id'], PDO::PARAM_INT); $gmRes->execute(); //Loop the records while ($gmRec = $gmRes->fetch()) { $GMLevel .= 'Level: ' . $gmRec['gmlevel'] . ' - Realm: ' . $gmRec['RealmID'] . '<br>'; } //remove the last <br> $GMLevel = substr($GMLevel, 0, strlen($GMLevel) - 4); //Setup the rank $Rank = new UserRank($aRow['rank']); //Set the first two columns $row[0] = $aRow['id']; $row[1] = '<a href="index.php?page=user-preview&uid=' . $aRow['id'] . '">' . $aRow['displayName'] . '</a> [' . $authRow['username'] . ']'; $row[2] = $Rank->string() . ' [' . $Rank->int() . ']'; $row[3] = $GMLevel; $row[4] = $authRow['email']; $row[5] = $aRow['reg_ip']; $row[6] = $authRow['joindate']; //Now we have to pull $output['aaData'][] = $row; } echo json_encode($output);
/** * @see Form::save() */ public function save() { // set the language temporarily to the thread language if ($this->languageID && $this->languageID != WCF::getLanguage()->getLanguageID()) { $this->setLanguage($this->languageID); } parent::save(); // search for double posts if ($postID = PostEditor::test($this->subject, $this->text, WCF::getUser()->userID, $this->username)) { HeaderUtil::redirect('index.php?page=Thread&postID=' . $postID . SID_ARG_2ND_NOT_ENCODED . '#post' . $postID); exit; } // save poll if ($this->showPoll) { $this->pollEditor->save(); } // save thread in database $this->newThread = ThreadEditor::create($this->board->boardID, $this->languageID, $this->prefix, $this->subject, $this->text, WCF::getUser()->userID, $this->username, intval($this->isImportant == 1), intval($this->isImportant == 2), $this->closeThread, $this->getOptions(), $this->subscription, $this->attachmentListEditor, $this->pollEditor, intval($this->disableThread || !$this->board->getPermission('canStartThreadWithoutModeration'))); if ($this->isImportant == 2) { $this->newThread->assignBoards($this->boardIDs); } // save tags if (MODULE_TAGGING && THREAD_ENABLE_TAGS && $this->board->getPermission('canSetTags')) { $tagArray = TaggingUtil::splitString($this->tags); if (count($tagArray)) { $this->newThread->updateTags($tagArray); } } // reset language if ($this->userInterfaceLanguageID !== null) { $this->setLanguage($this->userInterfaceLanguageID, true); } if (!$this->disableThread && $this->board->getPermission('canStartThreadWithoutModeration')) { // update user posts if (WCF::getUser()->userID && $this->board->countUserPosts) { require_once WBB_DIR . 'lib/data/user/WBBUser.class.php'; WBBUser::updateUserPosts(WCF::getUser()->userID, 1); if (ACTIVITY_POINTS_PER_THREAD) { require_once WCF_DIR . 'lib/data/user/rank/UserRank.class.php'; UserRank::updateActivityPoints(ACTIVITY_POINTS_PER_THREAD); } } // refresh counter and last post $this->board->addThreads(); $this->board->setLastPost($this->newThread); // reset stat cache WCF::getCache()->clearResource('stat'); WCF::getCache()->clearResource('boardData'); // send notifications $this->newThread->sendNotification(new Post(null, array('postID' => $this->newThread->firstPostID, 'message' => $this->text, 'enableSmilies' => $this->enableSmilies, 'enableHtml' => $this->enableHtml, 'enableBBCodes' => $this->enableBBCodes)), $this->attachmentListEditor); $this->saved(); // forward to post HeaderUtil::redirect('index.php?page=Thread&threadID=' . $this->newThread->threadID . SID_ARG_2ND_NOT_ENCODED); } else { $this->saved(); if ($this->disableThread) { // forward to post HeaderUtil::redirect('index.php?page=Thread&threadID=' . $this->newThread->threadID . SID_ARG_2ND_NOT_ENCODED); } else { WCF::getTPL()->assign(array('url' => 'index.php?page=Board&boardID=' . $this->boardID . SID_ARG_2ND_NOT_ENCODED, 'message' => WCF::getLanguage()->get('wbb.threadAdd.moderation.redirect'), 'wait' => 5)); WCF::getTPL()->display('redirect'); } } exit; }
/** * @see Form::save() */ public function save() { // set the language temporarily to the thread language if ($this->thread->languageID && $this->thread->languageID != WCF::getLanguage()->getLanguageID()) { $this->setLanguage($this->thread->languageID); } MessageForm::save(); if ($this->thread->isDisabled) { $this->disablePost = 1; } // search for double posts if ($postID = PostEditor::test($this->subject, $this->text, WCF::getUser()->userID, $this->username, $this->threadID)) { HeaderUtil::redirect('index.php?page=Thread&postID=' . $postID . SID_ARG_2ND_NOT_ENCODED . '#post' . $postID); exit; } // save poll if ($this->showPoll) { $this->pollEditor->save(); } // save post in database $this->newPost = PostEditor::create($this->thread->threadID, $this->subject, $this->text, WCF::getUser()->userID, $this->username, $this->getOptions(), $this->attachmentListEditor, $this->pollEditor, null, intval($this->disablePost || !$this->board->getPermission('canReplyThreadWithoutModeration'))); // reset language if ($this->userInterfaceLanguageID !== null) { $this->setLanguage($this->userInterfaceLanguageID, true); } // remove quotes $sessionVars = WCF::getSession()->getVars(); if (isset($sessionVars['quotes'][$this->threadID])) { unset($sessionVars['quotes'][$this->threadID]); WCF::getSession()->register('quotes', $sessionVars['quotes']); } if (!$this->disablePost && $this->board->getPermission('canReplyThreadWithoutModeration')) { // refresh thread $this->thread->addPost($this->newPost, $this->closeThread); // update subscription $this->thread->setSubscription($this->subscription); // update user posts if (WCF::getUser()->userID && $this->board->countUserPosts) { WBBUser::updateUserPosts(WCF::getUser()->userID, 1); if (ACTIVITY_POINTS_PER_POST) { require_once WCF_DIR . 'lib/data/user/rank/UserRank.class.php'; UserRank::updateActivityPoints(ACTIVITY_POINTS_PER_POST); } } // refresh counter and last post $this->board->addPosts(); $this->board->setLastPost($this->thread); // close / open thread if (!$this->thread->isClosed && $this->closeThread) { $this->thread->close(); } else { if ($this->thread->isClosed && !$this->closeThread) { $this->thread->open(); } } // mark as done if ($this->markAsDone == 1) { $this->thread->markAsDone(); } else { if (MODULE_THREAD_MARKING_AS_DONE && $this->board->enableMarkingAsDone && $this->thread->isDone && WCF::getUser()->userID && WCF::getUser()->userID == $this->thread->userID) { $this->thread->markAsUndone(); } } // reset stat cache WCF::getCache()->clearResource('stat'); WCF::getCache()->clearResource('boardData'); // send notifications $this->newPost->sendNotification($this->thread, $this->board, $this->attachmentListEditor); $this->saved(); // forward to post $url = 'index.php?page=Thread&postID=' . $this->newPost->postID . SID_ARG_2ND_NOT_ENCODED . '#post' . $this->newPost->postID; HeaderUtil::redirect($url); } else { $this->saved(); if ($this->disablePost) { HeaderUtil::redirect('index.php?page=Thread&postID=' . $this->newPost->postID . SID_ARG_2ND_NOT_ENCODED . '#post' . $this->newPost->postID); } else { WCF::getTPL()->assign(array('url' => 'index.php?page=Thread&threadID=' . $this->threadID . SID_ARG_2ND_NOT_ENCODED, 'message' => WCF::getLanguage()->get('wbb.postAdd.moderation.redirect'), 'wait' => 5)); WCF::getTPL()->display('redirect'); } } exit; }
/** * @see Form:.save() */ public function save() { parent::save(); $entry = BashEntryEditor::create(BASHCore::getUser()->userID, $this->username, $this->serverID, $this->serverName, $this->text, TIME_NOW, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes); if (MODULE_USER_RANK and BASHCore::getUser()->userID > 0) { require_once WCF_DIR . 'lib/data/user/rank/UserRank.class.php'; UserRank::updateActivityPoints(BASH_USER_ACTIVITY_POINTS); } if (WCF::getUser()->userID > 0) { HeaderUtil::redirect('index.php?page=BashEntry&entryID=' . $entry->entryID . SID_ARG_2ND_NOT_ENCODED); } else { // redirect to index WCF::getTPL()->assign(array('url' => 'index.php' . SID_ARG_1ST, 'message' => WCF::getLanguage()->get('bash.page.bashEntryAdd.guestRedirect'), 'wait' => 10)); WCF::getTPL()->display('redirect'); exit; } // call event $this->saved(); }
echo 'Error: The user id is invalid!'; } else { //fetch the webrecord $webRecord = $webRes->fetch(); //Find the auth record $authRes = $AUTH_DB->prepare("SELECT * FROM `account` WHERE `id` = :acc LIMIT 1;"); $authRes->bindParam(':acc', $account, PDO::PARAM_INT); $authRes->execute(); //Fetch it $authRecord = $authRes->fetch(); echo ' <div class="column left"> <h3>Web Record</h3> <table>'; //Setup the rank $Rank = new UserRank($webRecord['rank']); //Setup the avatr //prepare the avatar if ((int) $webRecord['avatarType'] == AVATAR_TYPE_GALLERY) { $gallery = new AvatarGallery(); $Avatar = $gallery->get((int) $webRecord['avatar']); unset($gallery); } else { if ((int) $webRecord['avatarType'] == AVATAR_TYPE_UPLOAD) { $Avatar = new Avatar(0, $webRecord['avatar'], 0, AVATAR_TYPE_UPLOAD); } } echo ' <tr><td>ID</td><td>', $webRecord['id'], '</td></tr> <tr><td>Display Name</td><td>', $webRecord['displayName'], '</td></tr> <tr><td>Silver</td><td>', $webRecord['silver'], '</td></tr>
} if ($userInfo = WCF::getAuthorInfo($arr['author'])) { $userRank = new UserRank($userInfo['rank']); $arr['author_str'] = $userInfo['displayName']; //prepare the avatar if ((int) $userInfo['avatarType'] == AVATAR_TYPE_GALLERY) { $gallery = new AvatarGallery(); $Avatar = $gallery->get((int) $userInfo['avatar']); unset($gallery); } else { if ((int) $userInfo['avatarType'] == AVATAR_TYPE_UPLOAD) { $Avatar = new Avatar(0, $userInfo['avatar'], 0, AVATAR_TYPE_UPLOAD); } } } else { $userRank = new UserRank(0); $arr['author_str'] = 'Unknown'; $arr['author_rank'] = 'Unknown'; $gallery = new AvatarGallery(); $Avatar = $gallery->get(0); unset($gallery); } //format the time $arr['added'] = date('D M j, Y, h:i A', strtotime($arr['added'])); //Is staff post $staffPost = $CORE->hasFlag((int) $arr['flags'], WCF_FLAGS_STAFF_POST); //Is deleted $deletedPost = (int) $arr['deleted_by'] > 0 ? true : false; //Resolve the deletion author if ($deletedPost) { $userInfo = WCF::getAuthorInfo($arr['deleted_by']);