Вход Регистрация
Файл: adultscript-2.0.3-pro/files/modules/message/components/spam.php
Строк: 45
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VComponent_message_spam extends VModule_message
{
    public function 
__construct()
    {
        
parent::__construct();
    }
    
    public function 
render()
    {
        
VAuth::check('Registered');
        
VLanguage::load('frontend.user');
        
        
$user_id     = (int) $_SESSION['user_id'];
        
$errors        = array();
        
$messages    = array();
        if (isset(
$_POST['submit-actions'])) {
            
$ids     $this->get_checked_ids();
            if (
$ids) {
                
$action    trim($_POST['actions']);
                if (
$action == 'delete') {
                    
$this->db->query("DELETE FROM #__message
                                      WHERE msg_id IN ("
.implode(','array_values($ids)).")
                                      AND (sender_id = "
.$user_id." OR receiver_id = ".$user_id.")
                                      AND spam = '1'"
);
                    
$messages[] = __('msgs-delete-success');
                } else {
                    
$errors[] = __('action-invalid');
                }
            } else {
                
$errors[] = __('msgs-empty');
            }
        }
        
        
$page            = (isset($_GET['page'])) ? (int) trim($_GET['page']) : 1;
        
$sql_count        "SELECT COUNT(*) AS total_msgs
                           FROM #__message
                           WHERE (sender_id = "
.$user_id." OR receiver_id = ".$user_id.")
                           AND spam = '1'"
;
        
$total_msgs        $this->db->get_field($sql_count'total_msgs');
        
$pagination        VPagination::get($page$total_msgs20);
        
$sql            "SELECT m.msg_id, m.sender_id, m.receiver_id, m.subject,
                                  m.message, m.send_date, m.status, u.username
                           FROM #__message AS m
                           LEFT JOIN #__user AS u ON (u.user_id = m.sender_id)
                           WHERE (m.sender_id = "
.$user_id." OR m.receiver_id = ".$user_id.")
                           AND m.spam = '1'
                           ORDER BY m.msg_id DESC
                           LIMIT "
.$pagination['limit'];
        
$msgs            $this->db->get_rows($sql);
    
        
$this->tpl->menu        'home';
        
$this->tpl->submenu        'user-message-spam';
        
        
$this->tpl->title        __('spam-title');
        
$this->tpl->meta_title    __('spam-meta-title');
        
        
        
$this->tpl->errors        $errors;
        
$this->tpl->messages    $messages;
        
$this->tpl->msgs        $msgs;
        
$this->tpl->pagination    $pagination;
        
        
$this->tpl->load(array('header''user_messages''footer'));
        
$this->tpl->display();
    }
}
Онлайн: 0
Реклама