X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2FEditPage.php;h=d8fef17792ae0a0286a742a937b007fb826a262d;hb=751bac3786c561225f121b607189ccd865416e1b;hp=300c5f314771a671bf33a2ec8f6f745b1f30062d;hpb=314291057be8864871100eaaaa291a9049ca9a65;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 300c5f3147..d8fef17792 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -869,7 +869,7 @@ class EditPage { } elseif ( $this->section == 'new' ) { // Nothing *to* preview for new sections return false; - } elseif ( ( $request->getVal( 'preload' ) !== null || $this->mTitle->exists() ) + } elseif ( ( $request->getCheck( 'preload' ) || $this->mTitle->exists() ) && $this->context->getUser()->getOption( 'previewonfirst' ) ) { // Standard preference behavior @@ -975,7 +975,7 @@ class EditPage { $this->scrolltop = $request->getIntOrNull( 'wpScrolltop' ); - if ( $this->textbox1 === '' && $request->getVal( 'wpTextbox1' ) === null ) { + if ( $this->textbox1 === '' && !$request->getCheck( 'wpTextbox1' ) ) { // wpTextbox1 field is missing, possibly due to being "too big" // according to some filter rules such as Suhosin's setting for // suhosin.request.max_value_length (d'oh) @@ -1667,11 +1667,10 @@ class EditPage { case self::AS_SUCCESS_NEW_ARTICLE: $query = $resultDetails['redirect'] ? 'redirect=no' : ''; if ( $extraQueryRedirect ) { - if ( $query === '' ) { - $query = $extraQueryRedirect; - } else { - $query = $query . '&' . $extraQueryRedirect; + if ( $query !== '' ) { + $query .= '&'; } + $query .= $extraQueryRedirect; } $anchor = $resultDetails['sectionanchor'] ?? ''; $out->redirect( $this->mTitle->getFullURL( $query ) . $anchor ); @@ -1688,18 +1687,16 @@ class EditPage { ); if ( $resultDetails['redirect'] ) { - if ( $extraQuery == '' ) { - $extraQuery = 'redirect=no'; - } else { - $extraQuery = 'redirect=no&' . $extraQuery; + if ( $extraQuery !== '' ) { + $extraQuery = '&' . $extraQuery; } + $extraQuery = 'redirect=no' . $extraQuery; } if ( $extraQueryRedirect ) { - if ( $extraQuery === '' ) { - $extraQuery = $extraQueryRedirect; - } else { - $extraQuery = $extraQuery . '&' . $extraQueryRedirect; + if ( $extraQuery !== '' ) { + $extraQuery .= '&'; } + $extraQuery .= $extraQueryRedirect; } $out->redirect( $this->mTitle->getFullURL( $extraQuery ) . $sectionanchor ); @@ -4560,7 +4557,10 @@ ERROR; return $wgParser->guessLegacySectionNameFromWikiText( $text ); } // Meanwhile, real browsers get real anchors - return $wgParser->guessSectionNameFromWikiText( $text ); + $name = $wgParser->guessSectionNameFromWikiText( $text ); + // With one little caveat: per T216029, fragments in HTTP redirects need to be urlencoded, + // otherwise Chrome double-escapes the rest of the URL. + return '#' . urlencode( mb_substr( $name, 1 ) ); } /**