Файл: adultscript-2.0.3-pro/files/modules/message/components/read.php
Строк: 34
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_message_read extends VModule_message
{
public function __construct()
{
parent::__construct();
}
public function render()
{
VAuth::check('Registered');
VLanguage::load('frontend.user');
$user_id = (int) $_SESSION['user_id'];
$msg_id = (isset($_GET['id'])) ? (int) trim($_GET['id']) : 0;
$this->tpl = VF::factory('template');
$errors = array();
$messages = array();
$this->db->query("SELECT m.msg_id, m.sender_id, m.subject, m.message, m.status,
m.spam, u.username, u.gender, u.avatar
FROM #__message AS m
LEFT JOIN #__user AS u ON (u.user_id = m.sender_id)
WHERE m.msg_id = ".$msg_id."
LIMIT 1");
if ($this->db->affected_rows()) {
$msg = $this->db->fetch_assoc();
$this->db->query("UPDATE #__message SET status = 2 WHERE msg_id = ".$msg_id." AND status IN (1,2) LIMIT 1");
if (isset($_GET['a'])) {
$action = trim($_GET['a']);
if ($action == 'block') {
$this->db->query("INSERT INTO #__user_blocks
SET user_id = ".$user_id.",
blocked_id = ".(int) $msg['sender_id']);
$messages[] = __('user-blocked');
} elseif ($action == 'spam') {
$this->db->query("UPDATE #__message SET spam = '1' WHERE msg_id = ".$msg_id." LIMIT 1");
$this->tpl->spam = 1;
$messages[] = __('msg-spam-success');
} else {
}
}
}
$this->tpl->menu = 'home';
$this->tpl->submenu = 'user-message-inbox';
$this->tpl->colmenu = 'manage';
$this->tpl->title = __('read-title');
$this->tpl->meta_title = __('read-meta-title');
$this->tpl->folders = array('1' => 'inbox', '2' => 'inbox', '3' => 'outbox', '4' => 'trash');
$this->tpl->errors = $errors;
$this->tpl->messages = $messages;
$this->tpl->ucfg = VF::cfg('module.user');
$this->tpl->msg = $msg;
$this->tpl->load(array('header', 'message_read', 'footer'));
$this->tpl->display();
}
}