403Webshell
Server IP : 104.21.74.147  /  Your IP : 216.73.217.154
Web Server : nginx/1.24.0
System : Linux wordpress-sites 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/rebeccaone.com/wp-content/plugins/cornerstone/includes/classes/Services/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/rebeccaone.com/wp-content/plugins/cornerstone/includes/classes/Services/AppBoot.php
<?php

namespace Themeco\Cornerstone\Services;

use Themeco\Cornerstone\Plugin;
use Themeco\Cornerstone\Util\ManagedParameters;

class AppBoot implements Service {
  protected $settings;
  protected $app;
  protected $permalinks;

  private $permissions;


  public function __construct(
    Settings $settings,
    App $app,
    Permalinks $permalinks,
    Permissions $permissions
  ) {
    $this->settings = $settings;
    $this->app = $app;
    $this->permalinks = $permalinks;
    $this->permissions = $permissions;
  }

  public function setup() {
    add_action( 'parse_request', [ $this, 'detect_load' ] );
  }

  public function detect_load( $wp ) {

    if ( defined( 'IFRAME_REQUEST' ) || ( isset( $_REQUEST['wp_customize'] ) && 'on' == $_REQUEST['wp_customize'] ) ) {
      return;
    }

    $route = null;

    // Check if we're loading the ugly way
    $ugly = ( isset( $_GET['cs-launch'] ) && '1' === $_GET['cs-launch'] );

    // Or if we're loading the nice way
    $nice = false;
    if ( $wp->request ) {

      // If we have a request, see if it matches our app slug
      $parts = explode( '/', $wp->request );

      if ( is_array( $parts ) && $parts[0] === $this->settings->appSlug() ) {

        if ( 1 === count( $parts ) && '/' !== substr( $_SERVER['REQUEST_URI'], -1, 1 ) ) {
          wp_safe_redirect( $wp->request . '/' );
        }

        $nice = true;
      }

    }


    // Bail if we're not loading
    if ( !$ugly && !$nice ) {
      return;
    }


    $can_redirect = ( $ugly && !$nice && $this->permalinks->hasValidStructure() );


    // Allow an initial route to be passed if not using permalinks
    if ( isset( $_GET['cs_route'] ) ) {

      $route = esc_attr( $_GET['cs_route'] );

      if ( $route ) {

        // If we loaded ugly but we can use nice URLs, let's redirect.
        if ( $can_redirect ) {

          $redirect = add_query_arg( array(
            'cs_route' => $route
          ), trailingslashit( $this->settings->appUrl()  ) );

          wp_safe_redirect( $redirect );
          exit;
        }

      }

    } elseif ( $can_redirect ) {
      wp_safe_redirect( trailingslashit( $this->settings->appUrl()  ) );
      exit;
    }

    // Can't redirect, but needs auth
    if ( ! is_user_logged_in() ) {
      auth_redirect();
      exit;
    }

    // User has no permission to edit anything in Cornerstone
    if (!$this->permissions->userCanEditAnything()) {
      wp_safe_redirect(apply_filters('cs_app_no_permission_redirect', '/'));
      exit;
    }

    $this->app->setArgs([ 'permalinks' => [ $nice, $route ] ])->boot();

  }

}

Youez - 2016 - github.com/yon3zu
LinuXploit