403Webshell
Server IP : 104.26.2.156  /  Your IP : 216.73.216.185
Web Server : nginx/1.27.1
System : Linux us-1 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User : vinodai ( 3134)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /storage/v1396/wwwindicidolscom/public_html/wp-content/plugins/ai-engine/classes/rest/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /storage/v1396/wwwindicidolscom/public_html/wp-content/plugins/ai-engine/classes/rest/settings.php
<?php

class Meow_MWAI_Rest_Settings extends Meow_MWAI_Rest_Base {
  public function register_routes() {
    register_rest_route( $this->namespace, '/settings/update', [
      'methods' => 'POST',
      'callback' => [ $this, 'rest_settings_update' ],
      'permission_callback' => [ $this->core, 'check_rest_nonce' ]
    ] );
    register_rest_route( $this->namespace, '/settings/options', [
      'methods' => 'GET',
      'callback' => [ $this, 'rest_settings_options' ],
      'permission_callback' => [ $this->core, 'check_rest_nonce' ]
    ] );
    register_rest_route( $this->namespace, '/settings/reset', [
      'methods' => 'POST',
      'callback' => [ $this, 'rest_settings_reset' ],
      'permission_callback' => [ $this->core, 'check_rest_nonce' ]
    ] );
    register_rest_route( $this->namespace, '/settings/chatbots', [
      'methods' => 'GET',
      'callback' => [ $this, 'rest_settings_get_chatbots' ],
      'permission_callback' => [ $this->core, 'check_rest_nonce' ]
    ] );
    register_rest_route( $this->namespace, '/settings/chatbots', [
      'methods' => 'POST',
      'callback' => [ $this, 'rest_settings_update_chatbots' ],
      'permission_callback' => [ $this->core, 'check_rest_nonce' ]
    ] );
    register_rest_route( $this->namespace, '/settings/themes', [
      'methods' => 'GET',
      'callback' => [ $this, 'rest_settings_get_themes' ],
      'permission_callback' => [ $this->core, 'check_rest_nonce' ]
    ] );
    register_rest_route( $this->namespace, '/settings/themes', [
      'methods' => 'POST',
      'callback' => [ $this, 'rest_settings_update_themes' ],
      'permission_callback' => [ $this->core, 'check_rest_nonce' ]
    ] );
    register_rest_route( $this->namespace, '/settings/reset-usage', [
      'methods' => 'POST',
      'callback' => [ $this, 'rest_settings_reset_usage' ],
      'permission_callback' => [ $this->core, 'check_rest_nonce' ]
    ] );
  }

  public function rest_settings_update( $request ) {
    try {
      $params = $request->get_json_params();
      $filters_options = $params['options'];
      $this->core->update_options( $filters_options );
      $this->core->update_options( [
        'module_suggestions' => isset( $params['options']['module_suggestions'] ),
        'module_chatbots' => isset( $params['options']['module_chatbots'] ),
        'module_search' => isset( $params['options']['module_search'] ),
        'module_tasks' => isset( $params['options']['module_tasks'] ),
        'module_advisor' => isset( $params['options']['module_advisor'] ),
      ] );
      return $this->create_rest_response( [ 'success' => true ], 200 );
    }
    catch ( Exception $e ) {
      return $this->create_rest_response( [ 'success' => false, 'message' => $e->getMessage() ], 500 );
    }
  }

  public function rest_settings_options( $request ) {
    try {
      $options = $this->core->get_all_options();
      return $this->create_rest_response( [ 'success' => true, 'options' => $options ], 200 );
    }
    catch ( Exception $e ) {
      return $this->create_rest_response( [ 'success' => false, 'message' => $e->getMessage() ], 500 );
    }
  }

  public function rest_settings_reset( $request ) {
    try {
      $options = $this->core->get_all_options( true );
      $this->core->update_options( $options );
      return $this->create_rest_response( [ 'success' => true, 'options' => $options ], 200 );
    }
    catch ( Exception $e ) {
      return $this->create_rest_response( [ 'success' => false, 'message' => $e->getMessage() ], 500 );
    }
  }

  public function rest_settings_get_chatbots( $request ) {
    try {
      $chatbots = $this->core->get_chatbots();
      return $this->create_rest_response( [ 'success' => true, 'chatbots' => $chatbots ], 200 );
    }
    catch ( Exception $e ) {
      return $this->create_rest_response( [ 'success' => false, 'message' => $e->getMessage() ], 500 );
    }
  }

  public function rest_settings_update_chatbots( $request ) {
    try {
      $params = $request->get_json_params();
      $chatbots = $params['chatbots'];
      $this->core->update_chatbots( $chatbots );
      $saved_chatbots = $this->core->get_chatbots();
      return $this->create_rest_response( [ 'success' => true, 'chatbots' => $saved_chatbots ], 200 );
    }
    catch ( Exception $e ) {
      return $this->create_rest_response( [ 'success' => false, 'message' => $e->getMessage() ], 500 );
    }
  }

  public function rest_settings_get_themes( $request ) {
    try {
      $themes = $this->core->get_themes();
      return $this->create_rest_response( [ 'success' => true, 'themes' => $themes ], 200 );
    }
    catch ( Exception $e ) {
      return $this->create_rest_response( [ 'success' => false, 'message' => $e->getMessage() ], 500 );
    }
  }

  public function rest_settings_update_themes( $request ) {
    try {
      $params = $request->get_json_params();
      $themes = $params['themes'];
      $this->core->update_themes( $themes );
      return $this->create_rest_response( [ 'success' => true ], 200 );
    }
    catch ( Exception $e ) {
      return $this->create_rest_response( [ 'success' => false, 'message' => $e->getMessage() ], 500 );
    }
  }

  public function rest_settings_reset_usage( $request ) {
    try {
      // Reset the actual backend options that store usage data
      $this->core->update_option( 'ai_usage', [] );
      $this->core->update_option( 'ai_usage_daily', [] );
      
      // Force refresh to get updated options to return to frontend
      $options = $this->core->get_all_options( true );
      
      return $this->create_rest_response( [ 
        'success' => true, 
        'options' => $options 
      ], 200 );
    }
    catch ( Exception $e ) {
      return $this->create_rest_response( [ 'success' => false, 'message' => $e->getMessage() ], 500 );
    }
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit