Add the ability to specify the website of users and groups (#279)

This commit is contained in:
Maxim Leshchenko 2021-11-12 18:56:41 +02:00 committed by GitHub
parent 818d7cbc02
commit 1c650d595c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 47 additions and 1 deletions

View file

@ -207,6 +207,12 @@ final class GroupPresenter extends OpenVKPresenter
$club->setWall(empty($this->postParam("wall")) ? 0 : 1); $club->setWall(empty($this->postParam("wall")) ? 0 : 1);
$club->setAdministrators_List_Display(empty($this->postParam("administrators_list_display")) ? 0 : $this->postParam("administrators_list_display")); $club->setAdministrators_List_Display(empty($this->postParam("administrators_list_display")) ? 0 : $this->postParam("administrators_list_display"));
$website = $this->postParam("website") ?? "";
if(empty($website))
$user->setWebsite(NULL);
else
$user->setWebsite((!parse_url($website, PHP_URL_SCHEME) ? "https://" : "") . $website);
if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) { if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) {
$photo = new Photo; $photo = new Photo;
try { try {

View file

@ -158,6 +158,12 @@ final class UserPresenter extends OpenVKPresenter
$user->setTelegram(empty($this->postParam("telegram")) ? NULL : $this->postParam("telegram")); $user->setTelegram(empty($this->postParam("telegram")) ? NULL : $this->postParam("telegram"));
$user->setCity(empty($this->postParam("city")) ? NULL : $this->postParam("city")); $user->setCity(empty($this->postParam("city")) ? NULL : $this->postParam("city"));
$user->setAddress(empty($this->postParam("address")) ? NULL : $this->postParam("address")); $user->setAddress(empty($this->postParam("address")) ? NULL : $this->postParam("address"));
$website = $this->postParam("website") ?? "";
if(empty($website))
$user->setWebsite(NULL);
else
$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"), 300));
$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"), 300));

View file

@ -53,6 +53,14 @@
<input type="text" name="shortcode" value="{$club->getShortcode()}" /> <input type="text" name="shortcode" value="{$club->getShortcode()}" />
</td> </td>
</tr> </tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_website}: </span>
</td>
<td>
<input type="text" name="website" value="{$club->getWebsite()}" />
</td>
</tr>
<tr> <tr>
<td width="120" valign="top"> <td width="120" valign="top">
<span class="nobold">{_avatar}: </span> <span class="nobold">{_avatar}: </span>

View file

@ -29,6 +29,14 @@
<td><span class="nobold">{_"description"}:</span></td> <td><span class="nobold">{_"description"}:</span></td>
<td>{$club->getDescription()}</td> <td>{$club->getDescription()}</td>
</tr> </tr>
<tr n:if="!is_null($club->getWebsite())">
<td><span class="nobold">{_"website"}: </span></td>
<td>
<a href="{$club->getWebsite()}" rel="ugc" target="_blank">
{$club->getWebsite()}
</a>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

View file

@ -173,6 +173,14 @@
<input type="text" name="telegram" value="{$user->getTelegram()}" /> <input type="text" name="telegram" value="{$user->getTelegram()}" />
</td> </td>
</tr> </tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_"personal_website"}: </span>
</td>
<td>
<input type="text" name="website" value="{$user->getWebsite()}" />
</td>
</tr>
<tr> <tr>
<td width="120" valign="top"> <td width="120" valign="top">
<span class="nobold">{_"city"}: </span> <span class="nobold">{_"city"}: </span>

View file

@ -424,6 +424,14 @@
</a> </a>
</td> </td>
</tr> </tr>
<tr n:if="!is_null($user->getWebsite())">
<td class="label"><span class="nobold">{_"personal_website"}: </span></td>
<td>
<a href="{$user->getWebsite()}" rel="ugc" target="_blank">
{$user->getWebsite()}
</a>
</td>
</tr>
<!--/sse--> <!--/sse-->
<tr n:if="!is_null($user->getCity())"> <tr n:if="!is_null($user->getCity())">
<td class="label"><span class="nobold">{_"city"}:</span></td> <td class="label"><span class="nobold">{_"city"}:</span></td>

View file

@ -0,0 +1,2 @@
ALTER TABLE `profiles` ADD COLUMN `website` VARCHAR(128) AFTER `telegram`;
ALTER TABLE `groups` ADD COLUMN `website` VARCHAR(128);

@ -1 +1 @@
Subproject commit 0dbc29908e74bcd048ebf39aaf4f11281c907a2d Subproject commit 8e38c28a0b5ccfaee1bc6c1961b2845b80608354