Making WordPress.org


Ignore:
Timestamp:
01/19/2016 04:14:28 PM (8 years ago)
Author:
stephdau
Message:

WordPress.org SSO: updating theme with a patyh router/validator.

See #1524, and r2322

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/index.php

    r2313 r2323  
    88get_header();
    99
    10 if ( ! empty( $_GET['screen'] ) ) {
    11     $screen = preg_replace( '/[^a-z0-9-]/', '', $_GET['screen'] );
    12 } else if ( preg_match( '/^\/oauth([\/\?]{1}.*)?$/', $_SERVER['REQUEST_URI'] ) ) {
    13     $screen = 'oauth';
     10/**
     11 * Test if the path we're on is one that we use, depending on if it
     12 * has a partial or not, or load the 404 partial as fallback.
     13 *
     14 * Note that the path is first validated in WP_WPOrg_SSO::redirect_all_login_or_signup_to_sso().
     15 * @see https://meta.trac.wordpress.org/browser/sites/trunk/common/includes/wporg-sso/wp-plugin.php
     16 */
     17
     18if ( apply_filters( 'is_valid_wporg_sso_path', false ) && preg_match( '!^(/[^/\?]*)([/\?]{1,2}.*)?$!', $_SERVER['REQUEST_URI'], $matches ) ) {
     19    $screen = '/' === $matches[1] ? 'login' : preg_replace( '/[^a-z0-9-]/', '', $matches[1] );
    1420} else {
    15     $screen = 'login';
     21    $screen = '404';
    1622}
    1723
    18 $partial = __DIR__ . '/partials/' . $screen . '.php';
     24$partials_dir = __DIR__ . '/partials/';
     25$partial      = $partials_dir . $screen . '.php';
    1926
    2027if ( file_exists( $partial ) ) {
    2128    require_once( $partial );
     29} else {
     30    require_once( $partials_dir . '404.php');
    2231}
    2332
Note: See TracChangeset for help on using the changeset viewer.