<?php defined('ACCESS') OR die('No direct script access...');
/**
* Author - koder_alex
* ISQ - 669906617
* VK - https://vk.com/koder_alex
* It is forbidden to give, sell, modify.
*/
$prv = DB::$pdo->queryFetch("SELECT * FROM `privatMail` WHERE `id_user` = '$user[id]' LIMIT 1");
if (isset($_POST['save'])) {
$privat_mail = (isset($_POST['privat_mail']) ? (int)$_POST['privat_mail'] : 1);
$admin_mail = (isset($_POST['admin_mail']) ? (int)$_POST['admin_mail'] : 0);
DB::$pdo->query("UPDATE `privatMail` SET `privat_mail` = :privat_mail, `admin_mail` = :admin_mail WHERE `id_user` = :id_user", array(':privat_mail' => $privat_mail, ':admin_mail' => $admin_mail, ':id_user' => $user['id']));
redirect('/mail/?act=settings', 'Изменения успешно приняты.', 'ok');
}
thead('Настройка приватности');
?>
<div class="app-block">
<div class="list">Кто может мне писать:</div>
<form method="POST" action="">
<div class='list'>
<input name='privat_mail' type='radio' <?=($prv['privat_mail'] == 1 ? 'checked="checked" ' : null) ?>value='1' /> Все <br/>
<input name='privat_mail' type='radio' <?=($prv['privat_mail'] == 2 ? 'checked="checked" ' : null) ?>value='2' /> Друзья
<?php if(admin :: getAccess($user, array('a' => 3))) { ?>
<br/><label>
<input name='admin_mail' type='checkbox' <?=($prv['admin_mail'] == 1 ? 'checked="checked" ' : null) ?>value='1' /> Админ режим
</label>
<?php } ?>
<br>
<input type='submit' class='main-btn' name='save' value='Сохранить' />
</div>
</form>
<?