49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
|
<?php
|
|||
|
|
|||
|
namespace Moderation;
|
|||
|
|
|||
|
use Chat;
|
|||
|
use User;
|
|||
|
|
|||
|
class Announcement
|
|||
|
{
|
|||
|
public static function init(): void
|
|||
|
{
|
|||
|
self::printForm();
|
|||
|
self::send();
|
|||
|
}
|
|||
|
|
|||
|
public static function printForm(): void
|
|||
|
{
|
|||
|
echo <<<HTML
|
|||
|
<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;">
|
|||
|
<h4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></h4>
|
|||
|
<form method="post"></form>
|
|||
|
<label for="announcementText"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></label>
|
|||
|
<input name="announcementText" type="text" id="announcementText" size="70" maxlength="1000">
|
|||
|
<input type="submit" name="announcementModeration" id="announcementModeration" class="btn" value="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"><br>
|
|||
|
<input name="announcementIsSigned" type="checkbox" id="announcementIsSigned" value="1">
|
|||
|
<label for="announcementIsSigned"><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></label>
|
|||
|
</form>
|
|||
|
</div>
|
|||
|
HTML;
|
|||
|
}
|
|||
|
|
|||
|
public static function send(): void
|
|||
|
{
|
|||
|
if (empty($_POST['announcementModeration'] || empty($_POST['announcementText']))) {
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
$strippedMessage = strip_tags($_POST['announcementText']);
|
|||
|
|
|||
|
if (empty($strippedMessage)) {
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
$sender = empty($_POST['announcementIsSigned']) ? '<b><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></b>' : User::getLogin(User::start()->info['id']);
|
|||
|
|
|||
|
(new Chat())->sendsys("$sender: $strippedMessage");
|
|||
|
echo '<span style="color: red; "><b><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></b></span>';
|
|||
|
}
|
|||
|
}
|