openvk/Web/Presenters/templates/User/View.xml

549 lines
28 KiB
XML
Raw Normal View History

2020-06-07 19:04:43 +03:00
{extends "../@layout.xml"}
{block title}{$user->getCanonicalName()}{/block}
{block headIncludes}
<!-- openGraph -->
<meta property="og:title" content="{$user->getCanonicalName()}" />
<meta property="og:url" content="http://{$_SERVER['HTTP_HOST']}{$user->getURL()}" />
<meta property="og:image" content="{$user->getAvatarUrl()}" />
<meta property="og:type" content="profile" />
<meta property="og:first_name" content="{$user->getFirstName()}" />
<meta property="og:last_name" content="{$user->getLastName()}" />
<meta n:if="!is_null($user->getShortcode())" property="og:username" content="{$user->getShortcode()}" />
<meta property="og:gender" content="{($user->isFemale() ? 'fe' : '')}male" />
<!-- json-ld -->
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"type": "Person",
"name": {$user->getCanonicalName()},
"url": {('http://') . $_SERVER['HTTP_HOST'] . $user->getURL()}
}
</script>
{/block}
{block header}
{$user->getCanonicalName()}
<img n:if="$user->isVerified()"
class="name-checkmark"
src="/assets/packages/static/openvk/img/checkmark.png"
/>
2020-08-17 17:02:42 +03:00
<span n:if="isset($thisUser) && $user->getId() == $thisUser->getId()"><b>({_"this_is_you"})</b></span>
2020-06-07 19:04:43 +03:00
<!-- DEBUG: ONLINE REPORT: static {$user->getOnline()->timestamp()}s adjusted {$user->getOnline()->timestamp() + 2505600}s real {time()}s -->
<div n:if="$user->getOnline()->timestamp() + 2505600 > time()" style="float:right;">
{if $diff->i <= 5}
<span><b>{_online}</b></span>
{else}
<span>{_was_online} {$user->getOnline()}</span>
{/if}
</div>
<div n:if="$user->onlineStatus() == 2" style="float:right;">
<span><b>{_deceased_person}</b></span>
</div>
2020-06-07 19:04:43 +03:00
{/block}
{block content}
{if !$user->isBanned()}
{if !$user->getPrivacyPermission('page.read', $thisUser ?? NULL)}
<div class="msg msg_err">
2020-08-20 17:05:00 +03:00
<b>{_forbidden}</b><br/>
{_forbidden_comment}
2020-06-07 19:04:43 +03:00
</div>
{else}
<div class="left_small_block">
<div>
<a href="{$user->getAvatarLink()|nocheck}">
<img src="{$user->getAvatarUrl()}"
2020-08-20 17:05:00 +03:00
alt="{$user->getCanonicalName()}"
2020-06-07 19:04:43 +03:00
style="width: 100%; image-rendering: -webkit-optimize-contrast;" />
</a>
</div>
<div n:ifset="$thisUser" id="profile_links">
{if $user->getId() == $thisUser->getId()}
<div id="profile_link" style="width: 194px;">
<a href="/edit" class="link">{_"edit_page"}</a>
</div>
{else}
{if $thisUser->getChandlerUser()->can("substitute")->model('openvk\Web\Models\Entities\User')->whichBelongsTo(0)}
<a href="/setSID/{$user->getChandlerUser()->getId()}?hash={rawurlencode($csrfToken)}" class="profile_link">
2020-08-20 17:05:00 +03:00
{tr("login_as", $user->getFirstName())}
2020-06-07 19:04:43 +03:00
</a>
{/if}
2020-07-17 19:26:59 +03:00
{if $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)}
<a href="javascript:banUser()" class="profile_link">
2020-08-20 17:05:00 +03:00
{_ban_user_action}
2020-07-17 19:26:59 +03:00
</a>
2020-07-17 19:39:34 +03:00
<a href="javascript:warnUser()" class="profile_link">
2020-08-20 17:05:00 +03:00
{_warn_user_action}
2020-07-17 19:39:34 +03:00
</a>
2020-07-17 19:26:59 +03:00
{/if}
2021-10-07 23:09:14 +03:00
<a href="/gifts?act=pick&user={$user->getId()}" class="profile_link">{_send_gift}</a>
2020-06-07 19:04:43 +03:00
{var subStatus = $user->getSubscriptionStatus($thisUser)}
{if $subStatus === 0}
<form action="/setSub/user" method="post">
<input type="hidden" name="act" value="add" />
<input type="hidden" name="id" value="{$user->getId()}" />
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" class="profile_link" value="{_"friends_add"}" />
</form>
{elseif $subStatus === 1}
<form action="/setSub/user" method="post">
<input type="hidden" name="act" value="add" />
<input type="hidden" name="id" value="{$user->getId()}" />
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" class="profile_link" value="{_"friends_accept"}" />
</form>
{elseif $subStatus === 2}
<form action="/setSub/user" method="post">
<input type="hidden" name="act" value="rem" />
<input type="hidden" name="id" value="{$user->getId()}" />
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" class="profile_link" value="{_"friends_reject"}" />
</form>
{elseif $subStatus === 3}
<a href="/im?sel={$user->getId()}" class="profile_link">{_"send_message"}</a>
<form action="/setSub/user" method="post">
<input type="hidden" name="act" value="rem" />
<input type="hidden" name="id" value="{$user->getId()}" />
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" class="profile_link" value="{_"friends_delete"}" />
</form>
{/if}
{/if}
</div>
2020-08-17 17:02:42 +03:00
<div n:if="isset($thisUser) && !$thisUser->prefersNotToSeeRating()" class="profile-hints">
2020-06-07 19:04:43 +03:00
{var completeness = $user->getProfileCompletenessReport()}
<div class="completeness-gauge {if $completeness->total >= 100}completeness-gauge-gold{/if}">
<div style="width: {if ($completeness->total >= 100)}{round(($completeness->total / 10**strlen(strval($completeness->total))) * 100, 0)}{else}{$completeness->percent}{/if}%"></div>
2020-06-07 19:04:43 +03:00
<span>{$completeness->total}%</span>
</div>
2020-08-17 17:02:42 +03:00
{if isset($thisUser) && $user->getId() === $thisUser->getId() && sizeof($completeness->unfilled) > 0}
2020-06-07 19:04:43 +03:00
<br/>
<a n:if="in_array('interests', $completeness->unfilled)" href="/edit">
2020-08-20 15:22:32 +03:00
<img src="/assets/packages/static/openvk/img/icon1.gif" />
{_interests} (+20%)
2020-06-07 19:04:43 +03:00
</a>
<a n:if="in_array('email', $completeness->unfilled)" href="/edit?act=contacts">
2020-08-20 15:22:32 +03:00
<img src="/assets/packages/static/openvk/img/icon2.gif" />
Email (+20%)
2020-06-07 19:04:43 +03:00
</a>
<a n:if="in_array('phone', $completeness->unfilled)" href="/edit?act=contacts">
2020-08-20 15:22:32 +03:00
<img src="/assets/packages/static/openvk/img/icon2.gif" />
{_phone} (+20%)
2020-06-07 19:04:43 +03:00
</a>
<a n:if="in_array('telegram', $completeness->unfilled)" href="/edit?act=contacts">
2020-08-20 15:22:32 +03:00
<img src="/assets/packages/static/openvk/img/icon2.gif" />
Telegram (+10%)
2020-06-07 19:04:43 +03:00
</a>
<a n:if="in_array('status', $completeness->unfilled)" href="/edit">
2020-08-20 15:22:32 +03:00
<img src="/assets/packages/static/openvk/img/icon3.gif" />
{_status} (+10%)
2020-06-07 19:04:43 +03:00
</a>
{/if}
</div>
<br />
<div n:if="($giftCount = $user->getGiftCount()) > 0">
<div class="content_title_expanded" onclick="hidePanel(this, {$giftCount});">
{_gifts}
</div>
<div>
<div class="content_subtitle">
{tr("gifts", $giftCount)}
<div style="float:right;">
<a href="/gifts{$user->getId()}">{_all_title}</a>
</div>
</div>
<div class="ovk-avView">
<div class="ovk-avView--el" n:foreach="$user->getGifts(1, 3) as $giftDescriptor">
{var hideInfo = $giftDescriptor->anon ? $thisUser->getId() !== $user->getId() : false}
<a href="{$hideInfo ? 'javascript:false' : $giftDescriptor->sender->getURL()}">
<img class="ava"
src="{$giftDescriptor->gift->getImage(2)}"
2021-10-07 23:09:14 +03:00
alt="{$hideInfo ? tr('gift') : ($giftDescriptor->caption ?? tr('gift'))}" />
</a>
</div>
</div>
</div>
</div>
2020-06-07 19:04:43 +03:00
<div n:if="$user->getFriendsCount() > 0 && $user->getPrivacyPermission('friends.read', $thisUser ?? NULL)">
{var friendCount = $user->getFriendsCount()}
<div class="content_title_expanded" onclick="hidePanel(this, {$friendCount});">
{_"friends"}
</div>
<div>
<div class="content_subtitle">
{tr("friends", $friendCount)}
<div style="float:right;">
<a href="/friends{$user->getId()}">{_"all_title"}</a>
</div>
</div>
<div class="ovk-avView">
<div class="ovk-avView--el" n:foreach="$user->getFriends(1) as $friend">
<a href="{$friend->getURL()}">
<img class="ava" src="{$friend->getAvatarUrl()}" />
</a>
<br/>
<a href="{$friend->getURL()}">{$friend->getFirstName()}</a>
</div>
</div>
</div>
</div>
<div n:if="$user->getFollowersCount() > 0">
{var followersCount = $user->getFollowersCount()}
<div class="content_title_expanded" onclick="hidePanel(this, {$followersCount});">
{_followers}
</div>
<div>
<div class="content_subtitle">
{tr("followers", $followersCount)}
<div style="float:right;">
<a href="/friends{$user->getId()}?act=incoming">{_"all_title"}</a>
</div>
</div>
<div class="ovk-avView">
<div class="ovk-avView--el" n:foreach="$user->getFollowers(1) as $follower">
<a href="{$follower->getURL()}">
<img class="ava" src="{$follower->getAvatarUrl()}" />
</a>
<br/>
<a href="{$follower->getURL()}">{$follower->getFirstName()}</a>
</div>
</div>
</div>
</div>
<div n:if="$albumsCount > 0 && $user->getPrivacyPermission('photos.read', $thisUser ?? NULL)">
<div class="content_title_expanded" onclick="hidePanel(this, {$albumsCount});">
{_"albums"}
</div>
<div>
<div class="content_subtitle">
{tr("albums", $albumsCount)}
<div style="float:right;">
<a href="/albums{$user->getId()}">{_"all_title"}</a>
</div>
</div>
<div style="padding: 5px;">
<div class="ovk-album" style="display: inline-block;" n:foreach="$albums as $album">
<div style="text-align: center;float: left;height: 54pt;width: 100px;">
{var cover = $album->getCoverPhoto()}
<img
src="{is_null($cover)?'/assets/packages/static/openvk/img/camera_200.png':$cover->getURL()}"
style="max-width: 80px; max-height: 54pt;" />
</div>
2021-09-14 02:35:46 +03:00
<div style="overflow: hidden; overflow-wrap: break-word;">
2020-06-07 19:04:43 +03:00
<b><a href="/album{$album->getPrettyId()}">{$album->getName()}</a></b><br>
2020-08-20 17:05:00 +03:00
<span class="nobold">{tr("updated_at", $album->getEditTime() ?? $album->getPublicationTime())}</span>
2020-06-07 19:04:43 +03:00
</div>
</div>
</div>
</div>
</div>
<div n:if="$videosCount > 0 && $user->getPrivacyPermission('videos.read', $thisUser ?? NULL)">
<div class="content_title_expanded" onclick="hidePanel(this, {$albumsCount});">
{_videos}
</div>
<div>
<div class="content_subtitle">
{tr("videos", $videosCount)}
<div style="float:right;">
<a href="/videos{$user->getId()}">{_"all_title"}</a>
</div>
</div>
<div style="padding: 5px;">
2021-10-08 01:10:07 +03:00
<div class="ovk-video" n:foreach="$videos as $video">
<a href="/video{$video->getPrettyId()}" class="preview" align="center">
2020-06-07 19:04:43 +03:00
<img
src="{$video->getThumbnailURL()}"
2021-10-08 01:10:07 +03:00
style="max-width: 170px; max-height: 127px; margin: auto;" />
</a>
2020-06-07 19:04:43 +03:00
<div>
<b><a href="/video{$video->getPrettyId()}">{ovk_proc_strtr($video->getName(), 30)}</a></b><br>
2021-10-08 01:10:07 +03:00
<span style="font-size: 10px;">{$video->getPublicationTime()} | {_comments} ({$video->getCommentsCount()})</span>
2020-06-07 19:04:43 +03:00
</div>
</div>
</div>
</div>
</div>
<div n:if="$notesCount > 0 && $user->getPrivacyPermission('notes.read', $thisUser ?? NULL)">
<div class="content_title_expanded" onclick="hidePanel(this, {$albumsCount});">
{_notes}
</div>
<div>
<div class="content_subtitle">
{tr("notes", $notesCount)}
<div style="float:right;">
<a href="/notes{$user->getId()}">{_"all_title"}</a>
</div>
</div>
<div style="padding: 5px 8px 15px 8px;">
<ul class="notes_titles" n:foreach="$notes as $note">
<li class="written">
<a href="/note{$user->getId()}_{$note->getId()}">
{$note->getName()}
</a>
<small>
{$note->getPublicationTime()}
<span class="divide">|</span>
<a href="/note{$user->getId()}_{$note->getId()}">{_comments}</a>
</small>
</li>
</ul>
2020-06-07 19:04:43 +03:00
</div>
</div>
</div>
<div n:if="$user->getClubCount() > 0 && $user->getPrivacyPermission('groups.read', $thisUser ?? NULL)">
{var clubsCount = $user->getClubCount()}
<div class="content_title_expanded" onclick="hidePanel(this, {$clubsCount})">
{_"groups"}
</div>
<div>
<div class="content_subtitle">
{tr("groups", $clubsCount)}
<div style="float:right;">
<a href="/groups{$user->getId()}">{_"all_title"}</a>
</div>
</div>
<div style="padding-left: 5px;">
<div style="display: inline;" n:foreach="$user->getClubs(1) as $club">
<a href="club{$club->getId()}">{$club->getName()}</a> {if !$iterator->last}•{/if}
</div>
</div>
</div>
</div>
<div n:if="$user->getMeetingCount() > 0 && $user->getPrivacyPermission('groups.read', $thisUser ?? NULL)">
{var meetingCount = $user->getMeetingCount()}
<div class="content_title_expanded" onclick="hidePanel(this, {$meetingCount})">
{_meetings}
</div>
<div>
<div class="content_subtitle">
{tr("meetings", $meetingCount)}
<div style="float:right;">
<a href="/groups{$user->getId()}?act=meetings">{_"all_title"}</a>
</div>
</div>
<div style="padding-left: 5px;">
<div style="display: inline;" n:foreach="$user->getMeetings(1) as $meeting">
<a href="/event{$meeting->getId()}">{$meeting->getName()}</a> {if !$iterator->last}•{/if}
</div>
</div>
</div>
</div>
</div>
<div class="right_big_block">
<div class="page_info">
<div class="accountInfo clearFix">
<div class="profileName">
<h2>{$user->getFullName()}</h2>
{if !is_null($user->getStatus())}
2020-06-07 19:04:43 +03:00
<div class="page_status">{$user->getStatus()}</div>
2020-08-17 17:02:42 +03:00
{elseif isset($thisUser) && $user->getId() == $thisUser->getId()}
2020-06-07 19:04:43 +03:00
<div class="page_status">
<a href="/edit" class="edit_link">[ {_"change_status"} ]</a>
</div>
{/if}
</div>
</div><div>
<table id="basicInfo" class="ugc-table" border="0" cellspacing="0" cellpadding="0" border="0" cellspacing="0" cellpadding="0" n:if=" $user->getPrivacyPermission('page.info.read', $thisUser ?? NULL)">
2020-06-07 19:04:43 +03:00
<tbody>
<tr>
<td class="label"><span class="nobold">{_"gender"}: </span></td>
<td class="data">{$user->isFemale() ? tr("female") : tr("male")}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr>
<td class="label"><span class="nobold">{_"relationship"}:</span></td>
<td class="data">{var $marialStatus = $user->getMaritalStatus()}{_"relationship_$marialStatus"}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr>
<td class="label"><span class="nobold">{_"registration_date"}: </span></td>
<td class="data">{$user->getRegistrationTime()}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr n:if="!is_null($user->getHometown())">
<td class="label"><span class="nobold">{_"hometown"}:</span></td>
<td class="data">{$user->getHometown()}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr>
<td class="label"><span class="nobold">{_"politViews"}:</span></td>
<td class="data">{var $pviews = $user->getPoliticalViews()}{_"politViews_$pviews"}</td>
2020-06-07 19:04:43 +03:00
</tr>
2021-10-09 17:40:20 +03:00
{if $user->getBirthday() > 0}
2021-09-13 19:34:02 +03:00
<tr>
<td class="label"><span class="nobold">{_"birth_date"}:</span></td>
2021-10-09 17:40:20 +03:00
<td class="data">{date('d F Y',$user->getBirthday())},
{date('m d') >= date('m d', $user->getBirthday()) ? date('Y') - date('Y', $user->getBirthday()) :
(date('m d') < date('m d', $user->getBirthday()) ? date('Y') - date('Y', $user->getBirthday()) - 1)} {_"years"}</td>
2021-09-13 19:34:02 +03:00
</tr>
2021-09-13 21:13:52 +03:00
{/if}
2020-06-07 19:04:43 +03:00
</tbody>
</table>
</div>
2020-06-07 19:04:43 +03:00
</div>
<div n:if=" $user->getPrivacyPermission('page.info.read', $thisUser ?? NULL)">
<div class="content_title_expanded" onclick="hidePanel(this);">
{_"information"}
</div>
{capture $contactInfo_Tmp}
<table class="ugc-table" border="0" cellspacing="0" cellpadding="0" border="0" cellspacing="0" cellpadding="0" n:ifcontent>
2020-06-07 19:04:43 +03:00
<tbody n:ifcontent>
<!--sse-->
<tr n:if="!is_null($user->getContactEmail())">
<td class="label"><span class="nobold">{_"email"}: </span></td>
2020-06-07 19:04:43 +03:00
<td>
<a href="mailto:{$user->getContactEmail()}" rel="ugc">
{$user->getContactEmail()}
</a>
</td>
</tr>
<tr n:if="!is_null($user->getTelegram())">
<td class="label"><span class="nobold">{_"telegram"}: </span></td>
2020-06-07 19:04:43 +03:00
<td>
<a href="https://t.me/{$user->getTelegram()}" rel="ugc" target="_blank">
@{$user->getTelegram()}
</a>
</td>
</tr>
<!--/sse-->
<tr n:if="!is_null($user->getCity())">
<td class="label"><span class="nobold">{_"city"}:</span></td>
<td class="data">{$user->getCity()}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr n:if="!is_null($user->getPhysicalAddress())">
<td class="label"><span class="nobold">{_"address"}:</span></td>
<td class="data">{$user->getPhysicalAddress()}</td>
2020-06-07 19:04:43 +03:00
</tr>
</tbody>
</table>
{/capture}
{capture $uInfo_Tmp}
<table class="ugc-table" border="0" cellspacing="0" cellpadding="0" border="0" cellspacing="0" cellpadding="0" n:ifcontent>
2020-06-07 19:04:43 +03:00
<tbody n:ifcontent>
<tr n:if="!is_null($user->getInterests())">
<td class="label"><span class="nobold">{_"interests"}: </span></td>
<td class="data">{$user->getInterests()}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr n:if="!is_null($user->getFavoriteMusic())">
<td class="label"><span class="nobold">{_"favorite_music"}: </span></td>
<td class="data">{$user->getFavoriteMusic()}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr n:if="!is_null($user->getFavoriteFilms())">
<td class="label"><span class="nobold">{_"favorite_films"}: </span></td>
<td class="data">{$user->getFavoriteFilms()}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr n:if="!is_null($user->getFavoriteShows())">
<td class="label"><span class="nobold">{_"favorite_shows"}: </span></td>
<td class="data">{$user->getFavoriteShows()}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr n:if="!is_null($user->getFavoriteBooks())">
<td class="label"><span class="nobold">{_"favorite_books"}: </span></td>
<td class="data">{$user->getFavoriteBooks()}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr n:if="!is_null($user->getFavoriteQuote())">
<td class="label"><span class="nobold">{_"favorite_quotes"}: </span></td>
<td class="data">{$user->getFavoriteQuote()}</td>
2020-06-07 19:04:43 +03:00
</tr>
<tr n:if="!is_null($user->getDescription())">
<td class="label"><span class="nobold">О себе: </span></td>
<td class="data">{$user->getDescription()}</td>
2020-06-07 19:04:43 +03:00
</tr>
</tbody>
</table>
{/capture}
<div>
<div style="padding: 10px 8px 15px 8px;" n:ifcontent>
2020-06-07 19:04:43 +03:00
{if !empty($contactInfo_Tmp)}
<h4 style="border-bottom: none; font-size: 11px; padding: 0; display: inline-block;">{_"contact_information"} {ifset $thisUser}{if $thisUser->getId() == $user->getId()}<a href="/edit?act=contacts" class="edit_link">[ {_"edit"} ]</a>{/if}{/ifset}</h4>
{if !empty($contactInfo_Tmp)}
{$contactInfo_Tmp|noescape}
{else}
2020-08-20 17:05:00 +03:00
<div style="padding: 15px;color:gray;text-align: center;">{_no_information_provided}</div>
2020-06-07 19:04:43 +03:00
{/if}
<br>
{/if}
<h4 style="border-bottom: none; font-size: 11px; padding: 0; display: inline-block;">{_"personal_information"} {ifset $thisUser}{if $thisUser->getId() == $user->getId()}<a href="/edit?act=interests" class="edit_link">[ {_"edit"} ]</a>{/if}{/ifset}</h4>
{if !empty($uInfo_Tmp)}
{$uInfo_Tmp|noescape}
{else}
2020-08-20 17:05:00 +03:00
<div style="padding-top: 15px;color:gray;text-align: center;">{_no_information_provided}</div>
2020-06-07 19:04:43 +03:00
{/if}
</div>
</div>
2020-06-07 19:04:43 +03:00
<p n:if="empty($contactInfo_Tmp) && empty($uInfo_Tmp)">
Пользователь предпочёл оставить о себе только воздух тайны.
</p>
</div>
{presenter "openvk!Wall->wallEmbedded", $user->getId()}
2020-07-17 19:26:59 +03:00
<script n:if="isset($thisUser) && $thisUser->getChandlerUser()->can('access')->model('admin')->whichBelongsTo(NULL)">
function banUser() {
uBanMsgTxt = "Вы собираетесь забанить пользователя " + {$user->getCanonicalName()} + ".";
uBanMsgTxt += "<br/><b>Предупреждение</b>: Это действие удалит все подписки пользователя и отпишет всех от него.";
2020-07-17 19:39:34 +03:00
uBanMsgTxt += "<br/><br/><b>Причина бана</b>: <input type='text' id='uBanMsgInput' placeholder='придумайте что-нибудь крутое' />"
2020-07-17 19:26:59 +03:00
MessageBox("Забанить " + {$user->getFirstName()}, uBanMsgTxt, ["Подтвердить", "Отмена"], [
(function() {
res = document.querySelector("#uBanMsgInput").value;
xhr = new XMLHttpRequest();
xhr.open("GET", "/admin/ban.pl/" + {$user->getId()} + "?reason=" + res + "&hash=" + {rawurlencode($csrfToken)}, true);
2020-07-17 19:26:59 +03:00
xhr.onload = (function() {
if(xhr.responseText.indexOf("reason") === -1)
MessageBox("Ошибка", "Не удалось забанить пользователя...", ["OK"], [Function.noop]);
else
MessageBox("Операция успешна", "Пользователь заблокирован", ["OK"], [Function.noop]);
});
xhr.send(null);
}),
Function.noop
2020-07-17 19:39:34 +03:00
]);
}
function warnUser() {
uBanMsgTxt = "Вы собираетесь предупредить пользователя " + {$user->getCanonicalName()} + ".";
uBanMsgTxt += "<br/>Мы отправим уведомление пользователю в личные сообщения от имени аккаунта администратора.";
uBanMsgTxt += "<br/><br/><b>Текст предупреждения</b>: <input type='text' id='uWarnMsgInput' placeholder='придумайте что-нибудь крутое' />"
MessageBox("Выдать предупреждение " + {$user->getFirstName()}, uBanMsgTxt, ["Подтвердить", "Отмена"], [
(function() {
res = document.querySelector("#uWarnMsgInput").value;
xhr = new XMLHttpRequest();
xhr.open("GET", "/admin/warn.pl/" + {$user->getId()} + "?message=" + res + "&hash=" + {rawurlencode($csrfToken)}, true);
2020-07-17 19:39:34 +03:00
xhr.onload = (function() {
if(xhr.responseText.indexOf("message") === -1)
MessageBox("Ошибка", "Не удалось отправить предупреждение...", ["OK"], [Function.noop]);
else
MessageBox("Операция успешна", "Предупреждение отправлено", ["OK"], [Function.noop]);
});
xhr.send(null);
}),
Function.noop
]);
2020-07-17 19:26:59 +03:00
}
</script>
2020-06-07 19:04:43 +03:00
</div>
{/if}
{else} {* isBanned() *}
{include "banned.xml"}
{/if}
{/block}