$bCanUnVote = False; if ($arUser["Points"]) { $bCanUnVote = True; $strNotesText .= str_replace("#POINTS#", $arUser["Points"]["POINTS"], str_replace("#END#", ForumNumberRusEnding($arUser["Points"]["POINTS"]), GetMessage("FR_YOU_ALREADY_VOTE1"))) . ". "; if (IntVal($arUser["Points"]["POINTS"]) < IntVal($arCurrUser["Rank"]["VOTES"])) { $bCanVote = True; $strNotesText .= str_replace("#POINTS#", IntVal($arUser["Points"]["VOTES"]) - IntVal($arUser["Points"]["POINTS"]), str_replace("#END#", ForumNumberRusEnding(IntVal($arCurrUser["Rank"]["VOTES"]) - IntVal($arUser["Points"]["POINTS"])), GetMessage("FR_YOU_ALREADY_VOTE3"))); } if ($USER->IsAdmin()) { $strNotesText .= GetMessage("FR_VOTE_ADMIN"); } } else { if (IntVal($arCurrUser["Rank"]["VOTES"]) > 0) { $bCanVote = True; $strNotesText .= GetMessage("FR_NO_VOTE"); $strNotesText .= str_replace("#POINTS#", IntVal($arCurrUser["Rank"]["VOTES"]) - IntVal($arUser["Points"]["POINTS"]), str_replace("#END#", ForumNumberRusEnding(IntVal($arCurrUser["Rank"]["VOTES"]) - IntVal($arUser["Points"]["POINTS"])), GetMessage("FR_NO_VOTE1"))) . ". "; if ($USER->IsAdmin()) { $strNotesText .= GetMessage("FR_VOTE_ADMIN"); } } } if ($bCanVote || $bCanUnVote) { ?> <td nowrap class="forummessbutton"><a href="read.php?UID=<?php echo $arMessage["AUTHOR_ID"]; ?> &FID=<?php echo $FID; ?> &TID=<?php echo $TID;
$arUserRank = CForumUser::GetUserRank(intVal($USER->GetParam("USER_ID"))); $arUserPoints = CForumUserPoints::GetByID(intVal($USER->GetParam("USER_ID")), $arParams["UID"]); if ($arUserPoints) { $bCanUnVote = True; $strNotesText .= str_replace("#POINTS#", $arUserPoints["POINTS"], str_replace("#END#", ForumNumberRusEnding($arUserPoints["POINTS"]), GetMessage("F_ALREADY_VOTED1"))) . ". \n"; if (CForumUser::IsAdmin()) { $strNotesText .= GetMessage("F_ALREADY_VOTED_ADMIN"); } elseif (intVal($arUserPoints["POINTS"]) < intVal($arUserRank["VOTES"])) { $bCanVote = True; $strNotesText .= str_replace("#POINTS#", intVal($arUserRank["VOTES"]) - intVal($arUserPoints["POINTS"]), str_replace("#END#", ForumNumberRusEnding(intVal($arUserRank["VOTES"]) - intVal($arUserPoints["POINTS"])), GetMessage("F_ALREADY_VOTED3"))); } } elseif (intVal($arUserRank["VOTES"]) > 0 || CForumUser::IsAdmin()) { $bCanVote = True; $strNotesText .= GetMessage("F_NOT_VOTED"); if (!CForumUser::IsAdmin()) { $strNotesText .= str_replace("#POINTS#", $arUserRank["VOTES"], str_replace("#END#", ForumNumberRusEnding($arUserRank["VOTES"]), GetMessage("F_NOT_VOTED1"))) . ". \n"; } else { $strNotesText .= GetMessage("F_ALREADY_VOTED_ADMIN"); } } $arResult["bCanVote"] = $bCanVote; $arResult["bCanUnVote"] = $bCanUnVote; $arResult["titleVote"] = $strNotesText; $arResult["SHOW_VOTES"] = strlen($strNotesText) > 0 || $bCanVote || $bCanUnVote ? "Y" : "N"; if (CForumUser::IsAdmin() && $bCanVote) { $arResult["VOTES"] = intVal($arUserRank["VOTES"]); } if ($bCanUnVote) { $arResult["VOTE_ACTION"] = "UNVOTE"; $arResult["URL"]["~VOTE"] = $APPLICATION->GetCurPageParam("CANCEL_VOTE=Y&VOTE_USER=Y", array("sessid", "VOTE_USER", "VOTES", "CANCEL_VOTE")); } else {
elseif (intVal($arUserPoints["POINTS"]) < intVal($arUserRank["VOTES"])) { $bCanVote = True; $strNotesText .= str_replace("#POINTS#", (intVal($arUserRank["VOTES"])-intVal($arUserPoints["POINTS"])), str_replace("#END#", ForumNumberRusEnding((intVal($arUserRank["VOTES"])-intVal($arUserPoints["POINTS"]))), GetMessage("F_ALREADY_VOTED3"))); } } elseif (intVal($arUserRank["VOTES"]) > 0 || $GLOBALS["APPLICATION"]->GetGroupRight("forum") >= "W") { $bCanVote = True; $strNotesText .= GetMessage("F_NOT_VOTED"); if ($GLOBALS["APPLICATION"]->GetGroupRight("forum") < "W") { $strNotesText .= str_replace("#POINTS#", $arUserRank["VOTES"], str_replace("#END#", ForumNumberRusEnding($arUserRank["VOTES"]), GetMessage("F_NOT_VOTED1"))).". \n"; } else { $strNotesText .= GetMessage("F_ALREADY_VOTED_ADMIN"); } } $arResult["bCanVote"] = $bCanVote; $arResult["bCanUnVote"] = $bCanUnVote; $arResult["titleVote"] = $strNotesText; $arResult["SHOW_VOTES"] = (strlen($strNotesText) > 0 || $bCanVote || $bCanUnVote ? "Y" : "N"); if ($GLOBALS["APPLICATION"]->GetGroupRight("forum") >= "W" && $bCanVote) $arResult["VOTES"] = intVal($arUserRank["VOTES"]); if ($bCanUnVote): $arResult["VOTE_ACTION"] = "UNVOTE";