add fav games

This commit is contained in:
mrilyew 2024-12-18 19:13:05 +03:00
parent e67963ed37
commit 996108289c
10 changed files with 48 additions and 10 deletions

View file

@ -269,7 +269,7 @@ final class Account extends VKAPIRequestHandler
return 1; return 1;
$entity = get_entity_by_id($owner_id); $entity = get_entity_by_id($owner_id);
if(!$entity || $entity->isDeleted()) if(!$entity)
return 0; return 0;
if(!$entity->isBlacklistedBy($this->getUser())) if(!$entity->isBlacklistedBy($this->getUser()))

View file

@ -12,8 +12,14 @@ final class Users extends VKAPIRequestHandler
if($authuser == NULL) $authuser = $this->getUser(); if($authuser == NULL) $authuser = $this->getUser();
$users = new UsersRepo; $users = new UsersRepo;
if($user_ids == "0") if($user_ids == "0") {
if(!$authuser) {
return [];
}
$user_ids = (string) $authuser->getId(); $user_ids = (string) $authuser->getId();
}
$usrs = explode(',', $user_ids); $usrs = explode(',', $user_ids);
$response = array(); $response = array();
@ -198,6 +204,13 @@ final class Users extends VKAPIRequestHandler
$response[$i]->quotes = $usr->getFavoriteQuote(); $response[$i]->quotes = $usr->getFavoriteQuote();
break; break;
case "games":
if(!$canView) {
break;
}
$response[$i]->games = $usr->getFavoriteGames();
break;
case "email": case "email":
if(!$canView) { if(!$canView) {
break; break;

View file

@ -415,6 +415,11 @@ class User extends RowModel
return $this->getRecord()->fav_quote; return $this->getRecord()->fav_quote;
} }
function getFavoriteGames(): ?string
{
return $this->getRecord()->fav_games;
}
function getCity(): ?string function getCity(): ?string
{ {
return $this->getRecord()->city; return $this->getRecord()->city;
@ -1432,6 +1437,9 @@ class User extends RowModel
$res->blacklisted = (int)$user->isBlacklistedBy($this); $res->blacklisted = (int)$user->isBlacklistedBy($this);
break; break;
case "games":
$res->games = $this->getFavoriteGames();
break;
} }
} }

View file

@ -251,13 +251,14 @@ final class UserPresenter extends OpenVKPresenter
else else
$user->setWebsite((!parse_url($website, PHP_URL_SCHEME) ? "https://" : "") . $website); $user->setWebsite((!parse_url($website, PHP_URL_SCHEME) ? "https://" : "") . $website);
} elseif($_GET['act'] === "interests") { } elseif($_GET['act'] === "interests") {
$user->setInterests(empty($this->postParam("interests")) ? NULL : ovk_proc_strtr($this->postParam("interests"), 300)); $user->setInterests(empty($this->postParam("interests")) ? NULL : ovk_proc_strtr($this->postParam("interests"), 1000));
$user->setFav_Music(empty($this->postParam("fav_music")) ? NULL : ovk_proc_strtr($this->postParam("fav_music"), 300)); $user->setFav_Music(empty($this->postParam("fav_music")) ? NULL : ovk_proc_strtr($this->postParam("fav_music"), 1000));
$user->setFav_Films(empty($this->postParam("fav_films")) ? NULL : ovk_proc_strtr($this->postParam("fav_films"), 300)); $user->setFav_Films(empty($this->postParam("fav_films")) ? NULL : ovk_proc_strtr($this->postParam("fav_films"), 1000));
$user->setFav_Shows(empty($this->postParam("fav_shows")) ? NULL : ovk_proc_strtr($this->postParam("fav_shows"), 300)); $user->setFav_Shows(empty($this->postParam("fav_shows")) ? NULL : ovk_proc_strtr($this->postParam("fav_shows"), 1000));
$user->setFav_Books(empty($this->postParam("fav_books")) ? NULL : ovk_proc_strtr($this->postParam("fav_books"), 300)); $user->setFav_Books(empty($this->postParam("fav_books")) ? NULL : ovk_proc_strtr($this->postParam("fav_books"), 1000));
$user->setFav_Quote(empty($this->postParam("fav_quote")) ? NULL : ovk_proc_strtr($this->postParam("fav_quote"), 300)); $user->setFav_Quote(empty($this->postParam("fav_quote")) ? NULL : ovk_proc_strtr($this->postParam("fav_quote"), 1000));
$user->setAbout(empty($this->postParam("about")) ? NULL : ovk_proc_strtr($this->postParam("about"), 300)); $user->setFav_Games(empty($this->postParam("fav_games")) ? NULL : ovk_proc_strtr($this->postParam("fav_games"), 1000));
$user->setAbout(empty($this->postParam("about")) ? NULL : ovk_proc_strtr($this->postParam("about"), 1000));
} elseif($_GET["act"] === "backdrop") { } elseif($_GET["act"] === "backdrop") {
if($this->postParam("subact") === "remove") { if($this->postParam("subact") === "remove") {
$user->unsetBackDropPictures(); $user->unsetBackDropPictures();

View file

@ -294,6 +294,14 @@
<textarea type="text" name="fav_quote">{$user->getFavoriteQuote()}</textarea> <textarea type="text" name="fav_quote">{$user->getFavoriteQuote()}</textarea>
</td> </td>
</tr> </tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_favorite_games}: </span>
</td>
<td>
<textarea type="text" name="fav_games">{$user->getFavoriteGames()}</textarea>
</td>
</tr>
<tr> <tr>
<td width="120" valign="top"> <td width="120" valign="top">
<span class="nobold">{_information_about}: </span> <span class="nobold">{_information_about}: </span>

View file

@ -567,6 +567,10 @@
<td class="label"><span class="nobold">{_favorite_quotes}: </span></td> <td class="label"><span class="nobold">{_favorite_quotes}: </span></td>
<td class="data">{$user->getFavoriteQuote()}</td> <td class="data">{$user->getFavoriteQuote()}</td>
</tr> </tr>
<tr n:if="!is_null($user->getFavoriteGames())">
<td class="label"><span class="nobold">{_favorite_games}: </span></td>
<td class="data">{$user->getFavoriteGames()}</td>
</tr>
<tr n:if="!is_null($user->getDescription())"> <tr n:if="!is_null($user->getDescription())">
<td class="label"><span class="nobold">{_information_about}: </span></td> <td class="label"><span class="nobold">{_information_about}: </span></td>
<td class="data">{$user->getDescription()}</td> <td class="data">{$user->getDescription()}</td>

View file

@ -924,7 +924,8 @@ u(document).on("click", "#editPost", async (e) => {
const target = u(e.target) const target = u(e.target)
const post = target.closest("table") const post = target.closest("table")
const content = post.find(".post-content") const content = post.find(".post-content")
const edit_place = post.find('.post-edit') const edit_place_l = post.find('.post-edit')
const edit_place = u(edit_place_l.first())
const id = post.attr('data-id').split('_') const id = post.attr('data-id').split('_')
let type = 'post' let type = 'post'

View file

@ -0,0 +1 @@
ALTER TABLE `profiles` ADD `fav_games` MEDIUMTEXT NULL DEFAULT NULL AFTER `fav_quote`;

View file

@ -152,6 +152,7 @@
"favorite_shows" = "Favorite TV-shows"; "favorite_shows" = "Favorite TV-shows";
"favorite_books" = "Favorite books"; "favorite_books" = "Favorite books";
"favorite_quotes" = "Favorite quotes"; "favorite_quotes" = "Favorite quotes";
"favorite_games" = "Favorite games";
"information_about" = "About"; "information_about" = "About";
"updated_at" = "Updated at $1"; "updated_at" = "Updated at $1";

View file

@ -136,6 +136,7 @@
"favorite_shows" = "Любимые ТВ-шоу"; "favorite_shows" = "Любимые ТВ-шоу";
"favorite_books" = "Любимые книги"; "favorite_books" = "Любимые книги";
"favorite_quotes" = "Любимые цитаты"; "favorite_quotes" = "Любимые цитаты";
"favorite_games" = "Любимые игры";
"information_about" = "О себе"; "information_about" = "О себе";
"updated_at" = "Обновлено $1"; "updated_at" = "Обновлено $1";
"user_banned" = "К сожалению, нам пришлось заблокировать страницу пользователя <b>$1</b>."; "user_banned" = "К сожалению, нам пришлось заблокировать страницу пользователя <b>$1</b>.";