Uname: Linux premium72.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.2.29 [ PHP INFO ] PHP os: Linux
Server Ip: 198.54.125.95
Your Ip: 216.73.216.164
User: matican (532) | Group: matican (531)
Safe Mode: OFF
Disable Function:
NONE

name : Exporter.php
<?php

/**
 * @copyright Copyright (c) 2009-2022 ThemeCatcher (https://www.themecatcher.net)
 */
class Quform_Form_Exporter
{
    /**
     * @var Quform_Repository
     */
    protected $repository;

    /**
     * @param Quform_Repository $repository
     */
    public function __construct(Quform_Repository $repository)
    {
        $this->repository = $repository;
    }

    /**
     * Handle the Ajax request to get the form export data
     *
     * Sends a JSON response, ending execution
     */
    public function export()
    {
        $this->validateExportRequest();

        $config = $this->repository->getConfig((int) $_POST['id']);

        if ( ! is_array($config)) {
            wp_send_json(array(
                'type' => 'error',
                'errors' => array(
                    'qfb-export-form' => __('Form not found', 'quform')
                )
            ));
        }

        wp_send_json(array(
            'type' => 'success',
            'data' => base64_encode(serialize($config))
        ));
    }

    /**
     * Validate the Ajax request to get the form export data
     *
     * Sends a JSON response if the request is invalid, ending execution
     */
    protected function validateExportRequest()
    {
        if ( ! Quform::isPostRequest() || ! isset($_POST['id']) || ! is_numeric($_POST['id'])) {
            wp_send_json(array(
                'type' => 'error',
                'message' => __('Bad request', 'quform')
            ));
        }

        if ( ! current_user_can('quform_export_forms')) {
            wp_send_json(array(
                'type' => 'error',
                'message' => __('Insufficient permissions', 'quform')
            ));
        }

        if ( ! check_ajax_referer('quform_export_form', false, false)) {
            wp_send_json(array(
                'type'    => 'error',
                'message' => __('Nonce check failed', 'quform')
            ));
        }
    }
}
© 2025 XylotrechusZ