HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
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: /var/www/zaklada/wp-content/plugins/coming-soon/app/settings.php
<?php

/**
 * Save Settings
 */
function seedprod_lite_save_settings()
{
    if (check_ajax_referer('seedprod_nonce')) {
        if (!empty($_POST['settings'])) {
            $settings = stripslashes_deep($_POST['settings']);

            $s = json_decode($settings);

            // Get old settings to check if there has been a change
            $settings_old = get_option('seedprod_settings');
            $s_old = json_decode($settings_old);

            // Key is for $settings, Value is for get_option()
            $settings_to_update = array(
                'enable_coming_soon_mode' => 'seedprod_coming_soon_page_id',
                'enable_maintenance_mode' => 'seedprod_maintenance_mode_page_id',
                'enable_login_mode'       => 'seedprod_login_page_id',
                'enable_404_mode'         => 'seedprod_404_page_id'
            );

            foreach ( $settings_to_update as $setting => $option ) {
                $has_changed = ($s->$setting !== $s_old->$setting ? true : false);
                if ( !$has_changed ) { continue; } // Do nothing if no change

                $id = get_option($option);

                $post_exists = !is_null( get_post($id) );
                if ( !$post_exists ) {
                    update_option($option, null);
                    continue;
                }

                $update = array();
                $update['ID'] = $id;

                // Publish page when active
                if ( $s->$setting === true ) {
                    $update['post_status'] = 'publish';
                    wp_update_post($update);
                }

                // Unpublish page when inactive
                if ( $s->$setting === false ) {
                    $update['post_status'] = 'draft';
                    wp_update_post($update);
                }
            }

            update_option('seedprod_settings', $settings);

            $response = array(
            'status'=> 'true',
            'msg'=> __('Settings Updated', 'coming-soon')
        );
        } else {
            $response = array(
                'status'=> 'false',
                'msg'=> __('Error Updating Settings', 'coming-soon')
            );
        }

        // Send Response
        wp_send_json($response);
        exit;
    }
}