extended profile edit

This commit is contained in:
themohooks 2024-07-08 22:33:27 +03:00
parent bc57f6b97c
commit ac7deee234
3 changed files with 162 additions and 20 deletions

BIN
static/img/star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

View file

@ -21,16 +21,22 @@ $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Navbar.php'); ?>
<tr>
<td class="main">
<h1><?= $userprofile->i('username') ?></h1>
<h1><?= $userprofile->i('username') ?><?php if ($userprofile->i('admin') === 1) { echo '<img width="32" src="/static/img/star.png">'; } ?></h1>
<?php
if ($userprofile->i('id') === Auth::userid()) { ?>
<p><b><a href="/lk/profile">Редактировать мой профиль</a></b></p>
<?php } ?>
<table width="100%">
<tr>
<?php if ($userprofile->content('badge') !== null) { ?>
<div style="float:left; border:solid 1px #3b7dc1; padding:6px 10px 7px; margin-bottom:13px; background-color:#0199ff44"><b><?=nl2br($userprofile->content('badge'))?></div><br>
<?php } ?>
<td valign="top" width="100%">
<div class="p20" style="padding-right:12px">
<table>
<table style="margin-bottom: 15px;">
<colgroup><col width="170px">
</colgroup>
<col width="170px">
<?php
if ($userprofile->content('location') !== null) { ?>
@ -46,6 +52,109 @@ $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
<td><?= json_decode($userprofile->i('content'), true)['aboutlive']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['aboutbirthday']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">День рождения:</td>
<td><?= json_decode($userprofile->i('content'), true)['aboutbirthday']['value'] ?></td>
</tr>
<?php } ?>
</col></table>
<table style="margin-bottom: 15px;">
<colgroup><col width="170px">
</colgroup>
<?php
if (json_decode($userprofile->i('content'), true)['aboutlangs']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Владение языками:</td>
<td><?= json_decode($userprofile->i('content'), true)['aboutlangs']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['abouttelegram']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Telegram:</td>
<td><?= json_decode($userprofile->i('content'), true)['abouttelegram']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['aboutvk']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">ВКонтакте:</td>
<td><?= json_decode($userprofile->i('content'), true)['aboutvk']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['abouttwitter']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Twitter/X:</td>
<td><?= json_decode($userprofile->i('content'), true)['abouttwitter']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['aboutyoutube']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Twitter/X:</td>
<td><?= json_decode($userprofile->i('content'), true)['aboutyoutube']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['aboutemail']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Почта:</td>
<td><?= json_decode($userprofile->i('content'), true)['aboutemail']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['aboutinstagram']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Instagram:</td>
<td><?= json_decode($userprofile->i('content'), true)['aboutinstagram']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['abouttransphoto']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">TransPhoto:</td>
<td><?= json_decode($userprofile->i('content'), true)['abouttransphoto']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['aboutwebsite']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Личный сайт:</td>
<td><?= json_decode($userprofile->i('content'), true)['aboutwebsite']['value'] ?></td>
</tr>
<?php } ?>
</table>
<table style="margin-bottom: 15px;">
<colgroup><col width="170px">
</colgroup>
<?php
if (json_decode($userprofile->i('content'), true)['aboutfavs_trains']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Любимые модели поездов:</td>
<td><?= json_decode($userprofile->i('content'), true)['aboutfavs_trains']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['aboutfavs_countries']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Любимые страны:</td>
<td><?= json_decode($userprofile->i('content'), true)['aboutfavs_countries']['value'] ?></td>
</tr>
<?php } ?>
<?php
if (json_decode($userprofile->i('content'), true)['aboutfavs_cities']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Любимые города:</td>
<td><?= json_decode($userprofile->i('content'), true)['aboutfavs_cities']['value'] ?></td>
</tr>
<?php } ?>
</table>
<table>
<colgroup><col width="170px">
</colgroup>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Дата регистрации:</td>
<td><span class="sm"><?= Date::zmdate($userprofile->content('regdate')) ?></span></td>

View file

@ -114,7 +114,8 @@ $user = new User(Auth::userid());
<?php
function getSelectedCountryId() {
function getSelectedCountryId()
{
$user = new User(Auth::userid());
$result = json_decode($user->i('content'), true)['aboutrid']['value'];
return $result;
@ -224,7 +225,8 @@ $user = new User(Auth::userid());
<option value="48">Япония</option>
<option value="26">Прочее</option>
';
function addSelectedAttribute($optionsHtml, $selectedValue) {
function addSelectedAttribute($optionsHtml, $selectedValue)
{
return preg_replace_callback(
'/<option value="(\d+)"(.*?)>(.*?)<\/option>/',
function ($matches) use ($selectedValue) {
@ -247,7 +249,16 @@ $user = new User(Auth::userid());
</select>
<div style="margin-bottom:3px; margin-top:5px">Откуда:</div>
<input type="text" name="aboutlive" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutlive']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">Дата рождения</div>
<input type="text" name="aboutbirthday" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutbirthday']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">Владение языками</div>
<input type="text" name="aboutlangs" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutlangs']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">Пол</div>
<select name="sex" style="width:100%">
<option value="0">(не указан)</option>
<option value="1" selected="">мужской</option>
<option value="2">женский</option>
</select>
</div>
@ -261,6 +272,28 @@ $user = new User(Auth::userid());
<textarea name="aboutmemo" style="width:100%; height:200px"><?= json_decode($user->i('content'), true)['aboutmemo']['value'] ?></textarea>
</div>
<div style="margin-bottom:3px; margin-top:5px">Telegram</div>
<input type="text" name="abouttelegram" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['abouttelegram']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">ВКонтакте</div>
<input type="text" name="aboutvk" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutvk']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">Twitter/X</div>
<input type="text" name="abouttwitter" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['abouttwitter']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">YouTube</div>
<input type="text" name="aboutyoutube" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutyoutube']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">Почта</div>
<input type="text" name="aboutemail" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutemail']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">Instagram</div>
<input type="text" name="aboutinstagram" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutinstagram']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">TransPhoto</div>
<input type="text" name="abouttransphoto" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['abouttransphoto']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">Личный сайт</div>
<input type="text" name="aboutwebsite" id="live" style="width:100%; margin-bottom: 35px;" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutwebsite']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">Любимые модели поездов</div>
<input type="text" name="aboutfavs_trains" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutfavs_trains']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">Любимые страны</div>
<input type="text" name="aboutfavs_countries" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutfavs_countries']['value'] ?>">
<div style="margin-bottom:3px; margin-top:5px">Любимые города</div>
<input type="text" name="aboutfavs_cities" id="live" style="width:100%" maxlength="50" value="<?= json_decode($user->i('content'), true)['aboutfavs_cities']['value'] ?>">
<div style="margin-bottom:7px"><b>Фотография</b></div>
<div style="margin-bottom:15px">