Файл: modules/padmin/mail.php
Строк: 57
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
if($user['level'] < 6 || !isset($user)) { header('Location: /'); exit;}
$locate = 'in_padmin';
$err = false;
// if(isset($_POST['send']) && $_GET['act'] == 'send')
// {
// $text = substr(input($_POST['text']), 0, 5000);
// if(empty($text))
// {
// $err = 'Message is empty';
// }
// if($err == false)
// {
// $mail_users = $db->query("SELECT * FROM `users` WHERE `id` != '". $user['id'] ."'");
// while($mail_user = $mail_users->fetch())
// {
// if ($db->query("SELECT * FROM `mail_chat` WHERE (`user_id` = '". User::Id() ."' OR `who_id` = '". User::Id() ."') AND (`who_id` = '". $mail_user['id'] ."' OR `user_id` = '". $mail_user['id'] ."')")->rowCount() == 0 && User::Id() != $mail_user['id'])
// {
// $db->query("INSERT INTO `mail_chat` SET `user_id` = '". User::Id() ."', `who_id` = '". $mail_user['id'] ."', `time_last_message` = '". time() ."'");
// }
// if($db->query("SELECT * FROM `mail_chat` WHERE `user_id` = '". User::Id()."' AND `who_id` = '". $mail_user['id'] ."'")->rowCount() != 0)
// {
// $chat_id = $db->query("SELECT id FROM `mail_chat` WHERE `user_id` = '". User::Id() ."' AND `who_id` = '". $mail_user['id'] ."'")->fetchColumn();
// }
// else
// {
// $chat_id = $db->query("SELECT `id` FROM `mail_chat` WHERE `who_id` = '". User::Id() ."' AND `user_id` = '". $mail_user['id'] ."'")->fetchColumn();
// }
// $db->query("INSERT INTO `mail` SET `mail_chat_id` = '$chat_id', `user_id` = '$user[id]', `who_id` = '". $mail_user['id'] ."', `text` = '". $text ."', `time` = '". time() ."', `read`='0'");
// $db->query("UPDATE `mail_chat` SET `time_last_message` = '". time() ."' WHERE `id` = '$chat_id'");
// redirect('/padmin/mail?sended');
// }
// }
// }
$title = _t('padmin_mail');
include_header($title);
$tpl->div('title', _t('padmin_mail'));
// (isset($_GET['sended']) ? Template::div('block', _t('mess_added')) : null);
$tpl->div('error', 'Tempotary unvailable!');
$tpl->div('menu', '<b>'._t('message') .'</b><br/>
<form action="/padmin/mail/?act=send" method="post">
<textarea name="text" rows="5" cols="26"></textarea><br/>
<input name="send" type="submit" value="'. _t('send').'"/>
</form>');
$tpl->div('block', img('admin.png') .'<a href="/padmin/">'. _t('padmin') .'</a><br/>'. HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
?>