mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Try to do a better job of matching user agent strings
Bug: T124264 Change-Id: Ieb51d97f46c478ee5527e4bc20a54c6929b54727
This commit is contained in:
parent
f0b2ce2ded
commit
f6c2d234be
|
@ -72,15 +72,19 @@ class VisualEditorHooks {
|
|||
$blacklist = $config->get( 'VisualEditorBrowserBlacklist' );
|
||||
$ua = strtolower( $req->getHeader( 'User-Agent' ) );
|
||||
foreach ( $blacklist as $uaSubstr => $rules ) {
|
||||
if ( !strpos( $ua, $uaSubstr ) ) {
|
||||
if ( !strpos( $ua, $uaSubstr . '/' ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( !is_array( $rules ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$uaParts = preg_split( '/' . $uaSubstr . '\//', $ua ); // PHP 5.3 compat
|
||||
$version = $uaParts[ 1 ];
|
||||
$matches = array();
|
||||
$ret = preg_match( '/' . $uaSubstr . '\/([0-9\.]*) ?/i', $ua, $matches );
|
||||
if ( $ret !== 1 ) {
|
||||
continue;
|
||||
}
|
||||
$version = $matches[1];
|
||||
foreach ( $rules as $rule ) {
|
||||
list( $op, $matchVersion ) = $rule;
|
||||
if (
|
||||
|
|
Loading…
Reference in a new issue