Compare commits

...

7 commits

7 changed files with 34 additions and 19 deletions

View file

@ -138,13 +138,13 @@ final class Account extends VKAPIRequestHandler
$user->setSex($sex == 1 ? 1 : 0); $user->setSex($sex == 1 ? 1 : 0);
} }
if ($relation > -1) { if ($relation > -1 && $relation <= 8) {
$user->setMarital_Status($relation); $user->setMarital_Status($relation);
} }
if (!empty($bdate)) { if (!empty($bdate)) {
$birthday = strtotime($bdate); $birthday = strtotime($bdate);
if (!is_int($birthday)) { if (!is_int($birthday) || $birthday > time()) {
$this->fail(100, "invalid value of bdate."); $this->fail(100, "invalid value of bdate.");
} }
@ -173,7 +173,12 @@ final class Account extends VKAPIRequestHandler
if ($sex > 0 || $relation > -1 || $bdate_visibility > 1 || !empty("$first_name$last_name$screen_name$bdate$home_town$status")) { if ($sex > 0 || $relation > -1 || $bdate_visibility > 1 || !empty("$first_name$last_name$screen_name$bdate$home_town$status")) {
$output["changed"] = 1; $output["changed"] = 1;
try {
$user->save(); $user->save();
} catch(\TypeError $e) {
$output["changed"] = 0;
}
} }
return (object) $output; return (object) $output;

View file

@ -429,6 +429,11 @@ class Club extends RowModel
$this->save(); $this->save();
} }
public function delete(bool $softly = true): void
{
$this->ban("");
}
public function unban(): void public function unban(): void
{ {
$this->setBlock_Reason(null); $this->setBlock_Reason(null);

View file

@ -333,7 +333,7 @@ async function __docAttachment(form, ctx = "wall", source = "user", source_arg =
<text id="photo_com_title_photos"> <text id="photo_com_title_photos">
${tr("select_doc")} ${tr("select_doc")}
</text> </text>
<span style="display: inline-flex;gap: 7px;"> <span style="display: inline-flex;gap: 7px;margin-left: 5px;">
${source != "user" ? `<a id="_doc_picker_go_to_my">${tr("go_to_my_documents")}</a>`: ""} ${source != "user" ? `<a id="_doc_picker_go_to_my">${tr("go_to_my_documents")}</a>`: ""}
<a id="_doc_picker_upload">${tr("upload_button")}</a> <a id="_doc_picker_upload">${tr("upload_button")}</a>
</span> </span>

View file

@ -12,7 +12,7 @@ $(document).on("change", ".photo_ajax_upload_button", (e) => {
return; return;
} }
if(file.size > 5 * 1024 * 1024) { if(file.size > window.openvk.max_filesize_mb * 1024 * 1024) {
MessageBox(tr("error"), tr("max_filesize", 5), [tr("ok")], [() => {Function.noop}]) MessageBox(tr("error"), tr("max_filesize", 5), [tr("ok")], [() => {Function.noop}])
return; return;
} }
@ -88,7 +88,6 @@ $(document).on("click", ".photo_upload_container #endUploading", (e) => {
data.append("hash", u("meta[name=csrf]").attr("value")) data.append("hash", u("meta[name=csrf]").attr("value"))
let xhr = new XMLHttpRequest() let xhr = new XMLHttpRequest()
// в самом вк на каждое изменение описания отправляется свой запрос, но тут мы экономим запросы
xhr.open("POST", "/photos/upload?act=finish&album="+document.getElementById("album").value) xhr.open("POST", "/photos/upload?act=finish&album="+document.getElementById("album").value)
xhr.onloadstart = () => { xhr.onloadstart = () => {
@ -108,10 +107,10 @@ $(document).on("click", ".photo_upload_container #endUploading", (e) => {
document.querySelector(".page_content .insertPhotos").innerHTML = "" document.querySelector(".page_content .insertPhotos").innerHTML = ""
document.getElementById("endUploading").style.display = "none" document.getElementById("endUploading").style.display = "none"
NewNotification(tr("photos_successfully_uploaded"), tr("click_to_go_to_album"), null, () => {window.router.route({url:`/album${result.owner}_${result.album}`})}) window.router.route({url:`/album${result.owner}_${result.album}`})
document.querySelector(".whiteBox").style.display = "block" /*document.querySelector(".whiteBox").style.display = "block"
document.querySelector(".insertAgain").append(document.getElementById("fakeButton")) document.querySelector(".insertAgain").append(document.getElementById("fakeButton"))*/
} }
e.currentTarget.removeAttribute("disabled") e.currentTarget.removeAttribute("disabled")

View file

@ -1967,10 +1967,10 @@ async function repost(id, repost_type = 'post') {
title: tr('share'), title: tr('share'),
unique_name: 'repost_modal', unique_name: 'repost_modal',
body: ` body: `
<div class='display_flex_column' style='gap: 1px;'> <div class='display_flex_column' style='gap: 5px;'>
<b>${tr('auditory')}</b> <b>${tr('auditory')}</b>
<div class='display_flex_column'> <div class='display_flex_column' style="gap: 2px;padding-left: 1px;">
<label> <label>
<input type="radio" name="repost_type" value="wall" checked> <input type="radio" name="repost_type" value="wall" checked>
${tr("in_wall")} ${tr("in_wall")}
@ -1986,6 +1986,7 @@ async function repost(id, repost_type = 'post') {
<b>${tr('your_comment')}</b> <b>${tr('your_comment')}</b>
<div style="padding-left: 1px;">
<input type='hidden' id='repost_attachments'> <input type='hidden' id='repost_attachments'>
<textarea id='repostMsgInput' placeholder='...'></textarea> <textarea id='repostMsgInput' placeholder='...'></textarea>
@ -1994,6 +1995,7 @@ async function repost(id, repost_type = 'post') {
<label><input type='checkbox' name="signed">${tr('add_signature')}</label> <label><input type='checkbox' name="signed">${tr('add_signature')}</label>
</div> </div>
</div> </div>
</div>
`, `,
buttons: [tr('send'), tr('cancel')], buttons: [tr('send'), tr('cancel')],
callbacks: [ callbacks: [
@ -2060,7 +2062,7 @@ async function repost(id, repost_type = 'post') {
] ]
}); });
u('.ovk-diag-body').attr('style', 'padding: 14px;') u('.ovk-diag-body').attr('style', 'padding: 18px;')
u('.ovk-diag-body').on('change', `input[name='repost_type']`, (e) => { u('.ovk-diag-body').on('change', `input[name='repost_type']`, (e) => {
const value = e.target.value const value = e.target.value
@ -2086,6 +2088,7 @@ async function repost(id, repost_type = 'post') {
if(window.openvk.writeableClubs.items.length < 1) { if(window.openvk.writeableClubs.items.length < 1) {
u(`input[name='repost_type'][value='group']`).attr('disabled', 'disabled') u(`input[name='repost_type'][value='group']`).attr('disabled', 'disabled')
u(`input[name='repost_type'][value='group']`).closest("label").addClass("lagged")
} }
} }
@ -2424,6 +2427,9 @@ const showMoreObserver = new IntersectionObserver(entries => {
if(target.length < 1 || target.hasClass('paginator-at-top')) { if(target.length < 1 || target.hasClass('paginator-at-top')) {
return return
} }
if(target.hasClass('lagged')) {
return
}
const current_url = new URL(location.href) const current_url = new URL(location.href)
if(current_url.searchParams && !isNaN(parseInt(current_url.searchParams.get('p')))) { if(current_url.searchParams && !isNaN(parseInt(current_url.searchParams.get('p')))) {

View file

@ -505,7 +505,7 @@
"edit_photo" = "Edit photo"; "edit_photo" = "Edit photo";
"creating_album" = "Creating album"; "creating_album" = "Creating album";
"delete_photo" = "Delete photo"; "delete_photo" = "Delete photo";
"sure_deleting_photo" = "Do you really want to delete this picture?"; "sure_deleting_photo" = "Do you sure you want to delete this photo from album?";
"upload_photo" = "Upload photo"; "upload_photo" = "Upload photo";
"photo" = "Photo"; "photo" = "Photo";
"upload_button" = "Upload"; "upload_button" = "Upload";

View file

@ -489,7 +489,7 @@
"edit_photo" = "Изменить фотографию"; "edit_photo" = "Изменить фотографию";
"creating_album" = "Создание альбома"; "creating_album" = "Создание альбома";
"delete_photo" = "Удалить фотографию"; "delete_photo" = "Удалить фотографию";
"sure_deleting_photo" = "Вы уверены, что хотите удалить эту фотографию?"; "sure_deleting_photo" = "Вы уверены, что хотите удалить эту фотографию из альбома?";
"upload_photo" = "Загрузить фотографию"; "upload_photo" = "Загрузить фотографию";
"photo" = "Фотография"; "photo" = "Фотография";
"upload_button" = "Загрузить"; "upload_button" = "Загрузить";