Plugin Directory


Ignore:
Timestamp:
10/11/2026 11:37:56 AM (6 days ago)
Author:
hippooo
Message:

Update to version 1.12.1 from GitHub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • hippoo/trunk/app/rest.php

    r3731411 r3739429  
    407407        <script type="text/javascript">
    408408            window.onload = function() {
    409             window.location.href = "{{LINK}}";
     409            window.location.href = {{LINK}};
    410410            };
    411411        </script>
    … …  
    418418        </html>';
    419419
    420     $html = str_replace( array( '{{TITLE}}', '{{DESC}}' ), array( $title, $desc ), $html );
    421 
    422     if ( ! empty( $request['token_id'] ) ) {
     420    $html = str_replace(
     421        array( '{{TITLE}}', '{{DESC}}' ),
     422        array( esc_html( $title ), esc_html( $desc ) ),
     423        $html
     424    );
     425
     426    $url_params = $request->get_url_params();
     427    $token_id   = isset( $url_params['token_id'] ) ? $url_params['token_id'] : '';
     428
     429    if ( ! preg_match( '/^[a-zA-Z0-9_-]+$/', $token_id ) ) {
     430        return new WP_REST_Response( array( 'Message' => __( 'Invalid token.', 'hippoo' ) ), 400 );
     431    }
     432   
     433    if ( ! empty( $token_id ) ) {
    423434        $msg  = __( 'You can get the data from here', 'hippoo' );
    424         $link = 'hippoo://app/login/?token=' . $request['token_id'];
    425         $html = str_replace( array( '{{LINK}}', '{{MSG}}' ), array( $link, $msg ), $html );
     435        $link = 'hippoo://app/login/?token=' . $token_id;
     436        $html = str_replace(
     437            array( '{{LINK}}', '{{MSG}}' ),
     438            array( wp_json_encode( $link ), esc_html( $msg ) ),
     439            $html
     440        );
    426441    } else {
    427442        $html = str_replace( '{{MSG}}', __( 'Unauthenticated, No Token Data', 'hippoo' ), $html );
Note: See TracChangeset for help on using the changeset viewer.