HEX
Server: LiteSpeed
System: Linux php-prod-3.spaceapp.ru 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: sarli3128 (1010)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/thread-self/root/home/retile.ru/public_html/catalog/controller/feedback/feedback.php
<?php
class ControllerFeedbackFeedback extends Controller {

    /* ============================================================
       ФУНКЦИЯ ОТПРАВКИ ПИСЬМА ДЛЯ POSTONE и POSTTWO
    ============================================================ */
    private function sendMailUnified($subject_name, $subject_title) {

        // === Формируем HTML-тело письма ===
        $message = "";
        foreach ($this->request->post as $key => $val) {
            if ($key == 'name' || $key == 'phone' || $key == 'captcha' || $key == 'Политика принята') continue;
            $message .= "<strong>" . $key . ":</strong> " . nl2br($val) . "<br>";
        }

        // === Инициализация OpenCart Mail ===
        $mail = new Mail($this->config->get('config_mail_engine'));
        $mail->parameter = $this->config->get('config_mail_parameter');
        $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
        $mail->smtp_username = $this->config->get('config_mail_smtp_username');
        $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
        $mail->smtp_port = $this->config->get('config_mail_smtp_port');
        $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');

        // === Отправитель ===
        $from_email = $this->config->get('config_mail_smtp_username');

        // === Получатели ===
        $alert_list = [];

        // config_mail_alert_email (через запятую)
        $alert_emails = $this->config->get('config_mail_alert_email');
        if (!empty($alert_emails)) {
            foreach (explode(',', $alert_emails) as $e) {
                $e = trim($e);
                if (filter_var($e, FILTER_VALIDATE_EMAIL)) {
                    $alert_list[] = $e;
                }
            }
        }

        // главный email магазина
        $main_email = $this->config->get('config_email');
        if (filter_var($main_email, FILTER_VALIDATE_EMAIL)) {
            $alert_list[] = $main_email;
        }

        // удалить дубликаты
        $alert_list = array_unique($alert_list);

        // === Рассылка каждому адресату ===
        foreach ($alert_list as $email_to) {
            $mail->setTo($email_to);
            $mail->setFrom($from_email);
            $mail->setSender(html_entity_decode($subject_name, ENT_QUOTES, 'UTF-8'));
            $mail->setSubject(html_entity_decode($subject_title, ENT_QUOTES, 'UTF-8'));
            $mail->setHtml($message);
            $mail->send();
        }

        return true;
    }

    /* ============================================================
       P O S T O N E
    ============================================================ */
    public function postone() {
        $json = [];

        /* ---------- Upload ---------- */
        $allowed = ['png','jpg','gif','svg','zip','txt','doc','docx','cdr','ai','eps'];
        if (isset($_FILES['upl']) && $_FILES['upl']['error'] === 0) {
            $extension = strtolower(pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION));
            if (!in_array($extension, $allowed)) {
                exit('{"status":"error"}');
            }
            if (move_uploaded_file($_FILES['upl']['tmp_name'], 'uploads/' . $_FILES['upl']['name'])) {
                exit('{"status":"success"}');
            }
        }

        /* ---------- POST из php://input ---------- */
        $raw = file_get_contents('php://input');
        foreach (explode('&', $raw) as $pair) {
            if (strpos($pair, '=') !== false) {
                list($k, $v) = explode('=', $pair);
                $k = urldecode($k);
                $v = urldecode($v);
                if (!isset($_POST[$k])) {
                    $this->request->post[$k] = $v;
                }
            }
        }

        /* ---------- Валидация ---------- */
        if (mb_strlen($this->request->post['Имя']) < 2) {
            $json['error']['Имя'] = 'Неправильно: Имя';
        }
        if (mb_strlen($this->request->post['Телефон']) < 8) {
            $json['error']['Телефон'] = 'Неправильно: Телефон';
        }
        if (mb_strlen($this->request->post['Сообщение']) < 5) {
            $json['error']['Сообщение'] = 'Неправильно: Сообщение';
        }

        /* ---------- Антибот ---------- */
        if (!empty($this->request->post['name']) || !empty($json['error'])) {
            die('BOTS!');
        }

        /* ---------- Отправка письма ---------- */
        $this->sendMailUnified(
            'Бесплатная консультация',
            'Запрос консультации с сайта retile.ru'
        );

        $json['status'] = 'Success';

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode($json));
    }


    /* ============================================================
       P O S T T W O
    ============================================================ */
    public function posttwo() {
        $json = [];

        /* ---------- Upload ---------- */
        $allowed = ['png','jpg','gif','svg','zip','txt','doc','docx','cdr','ai','eps'];
        if (isset($_FILES['upl']) && $_FILES['upl']['error'] === 0) {
            $extension = strtolower(pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION));
            if (!in_array($extension, $allowed)) {
                exit('{"status":"error"}');
            }
            if (move_uploaded_file($_FILES['upl']['tmp_name'], 'uploads/' . $_FILES['upl']['name'])) {
                exit('{"status":"success"}');
            }
        }

        /* ---------- POST из php://input ---------- */
        $raw = file_get_contents('php://input');
        foreach (explode('&', $raw) as $pair) {
            if (strpos($pair, '=') !== false) {
                list($k, $v) = explode('=', $pair);
                $k = urldecode($k);
                $v = urldecode($v);
                if (!isset($_POST[$k])) {
                    $this->request->post[$k] = $v;
                }
            }
        }

        /* ---------- Валидация ---------- */
        if (mb_strlen($this->request->post['Ваше имя']) < 2) {
            $json['error']['Ваше имя'] = 'Неправильно: Ваше имя';
        }
        if (mb_strlen($this->request->post['Телефон']) < 8) {
            $json['error']['Телефон'] = 'Неправильно: Телефон';
        }

        /* ---------- Антибот ---------- */
        if (!empty($this->request->post['phone']) || !empty($json['error'])) {
            die('BOTS!');
        }

        /* ---------- Отправка письма ---------- */
        $this->sendMailUnified(
            'Коммерческое предложение',
            'Коммерческое предложение с сайта retile.ru'
        );

        $json['status'] = 'Success';

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode($json));
    }
}