Esempio n. 1
0
            $mailTemplate =& $_POST['text'];
            $mailText = true;
        } else {
            echo 'errEmptyMessage';
        }
        if (!empty($_POST['attachment']) && is_array($_POST['attachment'])) {
            foreach ($_POST['attachment'] as &$attachment) {
                $nameAttachment = implode('.', array_slice(explode('.', $attachment), 1));
                $attachment = 'uploads/temporary/' . $attachment;
                $mailer->AddAttachment($attachment, $nameAttachment);
            }
        }
        if (!$mailer->sendEmail($_POST['email'], false, false, $sendto, false, $_POST['subject'], $mailTemplate, $mailText)) {
            echo 'errSend';
        } else {
            !empty($_POST['attachment']) ? filesys::removeFiles($_POST['attachment']) : null;
            echo 'success';
        }
    }
} elseif (isset($_GET['uploadFile'])) {
    // обработка запроса о процессе загрузки файла (Если php поддерживает функцию uploadFileProgress)
    if (isset($_GET['action']) && 'uploadFileProgress' === $_GET['action'] && !empty($_POST['file']) && !empty($_POST['key'])) {
        echo !function_exists('uploadprogress_get_info') || !($result = uploadprogress_get_info($_POST['key'])) ? ajax::sdgJSONencode(array('result' => 0, 'size' => file_exists($_POST['file']) ? filesize($_POST['file']) : 0)) : ajax::sdgJSONencode($result + array('result' => 1));
    } elseif (isset($_GET['action']) && 'delUploaded' === $_GET['action'] && !empty($_POST['delUploadedFile'])) {
        foreach (array_unique(explode(',', $_POST['delUploadedFile'])) as $file) {
            @unlink('uploads/temporary/' . $file);
        }
        echo 'success';
    } elseif (isset($_POST['inputName']) && is_string($_POST['inputName']) && ($inputName =& $_POST['inputName']) && !empty($_FILES[$inputName])) {
        // проверяем ошибки
        switch ($_FILES[$inputName]['error']) {