Merge "Make TitleInputWidget configurable, if term should be highlighted or not"
[lhc/web/wiklou.git] / includes / WebStart.php
index b095577..adce346 100644 (file)
@@ -141,3 +141,25 @@ if ( !defined( 'MW_NO_SETUP' ) ) {
 if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) {
        ignore_user_abort( true );
 }
+
+if ( !defined( 'MW_API' ) &&
+       RequestContext::getMain()->getRequest()->getHeader( 'Promise-Non-Write-API-Action' )
+) {
+       header( 'Cache-Control: no-cache' );
+       header( 'Content-Type: text/html; charset=utf-8' );
+       HttpStatus::header( 400 );
+       $error = wfMessage( 'nonwrite-api-promise-error' )->escaped();
+       $content = <<<EOT
+<!DOCTYPE html>
+<html>
+<head><meta charset="UTF-8" /></head>
+<body>
+$error
+</body>
+</html>
+
+EOT;
+       header( 'Content-Length: ' . strlen( $content ) );
+       echo $content;
+       die();
+}