Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
ecad88e7
Commit
ecad88e7
authored
Aug 08, 2011
by
Byron Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 307688: Moves OS and platform detection out of enter_bug.cgi
r=mkanat, a=LpSolit
parent
c3a95dde
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
250 additions
and
191 deletions
+250
-191
UserAgent.pm
Bugzilla/UserAgent.pm
+247
-0
enter_bug.cgi
enter_bug.cgi
+3
-191
No files found.
Bugzilla/UserAgent.pm
0 → 100644
View file @
ecad88e7
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is the Mozilla Foundation
# Portions created by the Initial Developer are Copyright (C) 2011 the
# Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Terry Weissman <terry@mozilla.org>
# Dave Miller <justdave@syndicomm.com>
# Joe Robins <jmrobins@tgix.com>
# Gervase Markham <gerv@gerv.net>
# Shane H. W. Travis <travis@sedsystems.ca>
# Nitish Bezzala <nbezzala@yahoo.com>
# Byron Jones <glob@mozilla.com>
package
Bugzilla::
UserAgent
;
use
strict
;
use
base
qw(Exporter)
;
our
@EXPORT
=
qw(detect_platform detect_op_sys)
;
use
Bugzilla::
Field
;
use
List::
MoreUtils
qw(natatime)
;
use
constant
DEFAULT_VALUE
=>
'Other'
;
use
constant
PLATFORMS_MAP
=>
(
# PowerPC
qr/\(.*PowerPC.*\)/
i
=>
[
"PowerPC"
,
"Macintosh"
],
# AMD64, Intel x86_64
qr/\(.*[ix0-9]86 (?:on |\()x86_64.*\)/
=>
[
"IA32"
,
"x86"
,
"PC"
],
qr/\(.*amd64.*\)/
=>
[
"AMD64"
,
"x86_64"
,
"PC"
],
qr/\(.*x86_64.*\)/
=>
[
"AMD64"
,
"x86_64"
,
"PC"
],
# Intel IA64
qr/\(.*IA64.*\)/
=>
[
"IA64"
,
"PC"
],
# Intel x86
qr/\(.*Intel.*\)/
=>
[
"IA32"
,
"x86"
,
"PC"
],
qr/\(.*[ix0-9]86.*\)/
=>
[
"IA32"
,
"x86"
,
"PC"
],
# Versions of Windows that only run on Intel x86
qr/\(.*Win(?:dows |)[39M].*\)/
=>
[
"IA32"
,
"x86"
,
"PC"
],
qr/\(.*Win(?:dows |)16.*\)/
=>
[
"IA32"
,
"x86"
,
"PC"
],
# Sparc
qr/\(.*sparc.*\)/
=>
[
"Sparc"
,
"Sun"
],
qr/\(.*sun4.*\)/
=>
[
"Sparc"
,
"Sun"
],
# Alpha
qr/\(.*AXP.*\)/
i
=>
[
"Alpha"
,
"DEC"
],
qr/\(.*[ _]Alpha.\D/
i
=>
[
"Alpha"
,
"DEC"
],
qr/\(.*[ _]Alpha\)/
i
=>
[
"Alpha"
,
"DEC"
],
# MIPS
qr/\(.*IRIX.*\)/
i
=>
[
"MIPS"
,
"SGI"
],
qr/\(.*MIPS.*\)/
i
=>
[
"MIPS"
,
"SGI"
],
# 68k
qr/\(.*68K.*\)/
=>
[
"68k"
,
"Macintosh"
],
qr/\(.*680[x0]0.*\)/
=>
[
"68k"
,
"Macintosh"
],
# HP
qr/\(.*9000.*\)/
=>
[
"PA-RISC"
,
"HP"
],
# ARM
qr/\(.*ARM.*\)/
=>
[
"ARM"
,
"PocketPC"
],
# PocketPC intentionally before PowerPC
qr/\(.*Windows CE.*PPC.*\)/
=>
[
"ARM"
,
"PocketPC"
],
# PowerPC
qr/\(.*PPC.*\)/
=>
[
"PowerPC"
,
"Macintosh"
],
qr/\(.*AIX.*\)/
=>
[
"PowerPC"
,
"Macintosh"
],
# Stereotypical and broken
qr/\(.*Windows CE.*\)/
=>
[
"ARM"
,
"PocketPC"
],
qr/\(.*Macintosh.*\)/
=>
[
"68k"
,
"Macintosh"
],
qr/\(.*Mac OS [89].*\)/
=>
[
"68k"
,
"Macintosh"
],
qr/\(.*WOW64.*\)/
=>
[
"x86_64"
],
qr/\(.*Win64.*\)/
=>
[
"IA64"
],
qr/\(Win.*\)/
=>
[
"IA32"
,
"x86"
,
"PC"
],
qr/\(.*Win(?:dows[ -])NT.*\)/
=>
[
"IA32"
,
"x86"
,
"PC"
],
qr/\(.*OSF.*\)/
=>
[
"Alpha"
,
"DEC"
],
qr/\(.*HP-?UX.*\)/
i
=>
[
"PA-RISC"
,
"HP"
],
qr/\(.*IRIX.*\)/
i
=>
[
"MIPS"
,
"SGI"
],
qr/\(.*(SunOS|Solaris).*\)/
=>
[
"Sparc"
,
"Sun"
],
# Braindead old browsers who didn't follow convention:
qr/Amiga/
=>
[
"68k"
,
"Macintosh"
],
qr/WinMosaic/
=>
[
"IA32"
,
"x86"
,
"PC"
],
);
use
constant
OS_MAP
=>
(
# Sun
qr/\(.*Solaris.*\)/
=>
[
"Solaris"
],
qr/\(.*SunOS 5.11.*\)/
=>
[(
"OpenSolaris"
,
"Opensolaris"
,
"Solaris 11"
)],
qr/\(.*SunOS 5.10.*\)/
=>
[
"Solaris 10"
],
qr/\(.*SunOS 5.9.*\)/
=>
[
"Solaris 9"
],
qr/\(.*SunOS 5.8.*\)/
=>
[
"Solaris 8"
],
qr/\(.*SunOS 5.7.*\)/
=>
[
"Solaris 7"
],
qr/\(.*SunOS 5.6.*\)/
=>
[
"Solaris 6"
],
qr/\(.*SunOS 5.5.*\)/
=>
[
"Solaris 5"
],
qr/\(.*SunOS 5.*\)/
=>
[
"Solaris"
],
qr/\(.*SunOS.*sun4u.*\)/
=>
[
"Solaris"
],
qr/\(.*SunOS.*i86pc.*\)/
=>
[
"Solaris"
],
qr/\(.*SunOS.*\)/
=>
[
"SunOS"
],
# BSD
qr/\(.*BSD\/
(?:
OS
|
386
)
.*\
)
/
=>
[
"BSDI"
],
qr/\(.*FreeBSD.*\)/
=>
[
"FreeBSD"
],
qr/\(.*OpenBSD.*\)/
=>
[
"OpenBSD"
],
qr/\(.*NetBSD.*\)/
=>
[
"NetBSD"
],
# Misc POSIX
qr/\(.*IRIX.*\)/
=>
[
"IRIX"
],
qr/\(.*OSF.*\)/
=>
[
"OSF/1"
],
qr/\(.*Linux.*\)/
=>
[
"Linux"
],
qr/\(.*BeOS.*\)/
=>
[
"BeOS"
],
qr/\(.*AIX.*\)/
=>
[
"AIX"
],
qr/\(.*OS\/
2
.*\
)
/ => ["OS/
2
"],
qr/\(.*QNX.*\)/ => ["
Neutrino
"],
qr/\(.*VMS.*\)/ => ["
OpenVMS
"],
qr/\(.*HP-?UX.*\)/ => ["
HP
-
UX
"],
# Windows
qr/\(.*Windows XP.*\)/ => ["
Windows
XP
"],
qr/\(.*Windows NT 6\.1.*\)/ => ["
Windows
7
"],
qr/\(.*Windows NT 6\.0.*\)/ => ["
Windows
Vista
"],
qr/\(.*Windows NT 5\.2.*\)/ => ["
Windows
Server
2003
"],
qr/\(.*Windows NT 5\.1.*\)/ => ["
Windows
XP
"],
qr/\(.*Windows 2000.*\)/ => ["
Windows
2000
"],
qr/\(.*Windows NT 5.*\)/ => ["
Windows
2000
"],
qr/\(.*Win.*9[8x].*4\.9.*\)/ => ["
Windows
ME
"],
qr/\(.*Win(?:dows |)M[Ee].*\)/ => ["
Windows
ME
"],
qr/\(.*Win(?:dows |)98.*\)/ => ["
Windows
98
"],
qr/\(.*Win(?:dows |)95.*\)/ => ["
Windows
95
"],
qr/\(.*Win(?:dows |)16.*\)/ => ["
Windows
3.1
"],
qr/\(.*Win(?:dows[ -]|)NT.*\)/ => ["
Windows
NT
"],
qr/\(.*Windows.*NT.*\)/ => ["
Windows
NT
"],
# OS X
qr/\(.*Mac OS X (?:|Mach-O |\()10.6.*\)/ => ["
Mac
OS
X
10.6
"],
qr/\(.*Mac OS X (?:|Mach-O |\()10.5.*\)/ => ["
Mac
OS
X
10.5
"],
qr/\(.*Mac OS X (?:|Mach-O |\()10.4.*\)/ => ["
Mac
OS
X
10.4
"],
qr/\(.*Mac OS X (?:|Mach-O |\()10.3.*\)/ => ["
Mac
OS
X
10.3
"],
qr/\(.*Mac OS X (?:|Mach-O |\()10.2.*\)/ => ["
Mac
OS
X
10.2
"],
qr/\(.*Mac OS X (?:|Mach-O |\()10.1.*\)/ => ["
Mac
OS
X
10.1
"],
# Unfortunately, OS X 10.4 was the first to support Intel. This is fallback
# support because some browsers refused to include the OS Version.
qr/\(.*Intel.*Mac OS X.*\)/ => ["
Mac
OS
X
10.4
"],
# OS X 10.3 is the most likely default version of PowerPC Macs
# OS X 10.0 is more for configurations which didn't setup 10.x versions
qr/\(.*Mac OS X.*\)/ => [("
Mac
OS
X
10.3
", "
Mac
OS
X
10.0
", "
Mac
OS
X
")],
qr/\(.*Mac OS 9.*\)/ => [("
Mac
System
9
.
x
", "
Mac
System
9.0
")],
qr/\(.*Mac OS 8\.6.*\)/ => [("
Mac
System
8.6
", "
Mac
System
8.5
")],
qr/\(.*Mac OS 8\.5.*\)/ => ["
Mac
System
8.5
"],
qr/\(.*Mac OS 8\.1.*\)/ => [("
Mac
System
8.1
", "
Mac
System
8.0
")],
qr/\(.*Mac OS 8\.0.*\)/ => ["
Mac
System
8.0
"],
qr/\(.*Mac OS 8[^.].*\)/ => ["
Mac
System
8.0
"],
qr/\(.*Mac OS 8.*\)/ => ["
Mac
System
8.6
"],
qr/\(.*Darwin.*\)/ => [("
Mac
OS
X
10.0
", "
Mac
OS
X
")],
# Silly
qr/\(.*Mac.*PowerPC.*\)/ => ["
Mac
System
9
.
x
"],
qr/\(.*Mac.*PPC.*\)/ => ["
Mac
System
9
.
x
"],
qr/\(.*Mac.*68k.*\)/ => ["
Mac
System
8.0
"],
# Evil
qr/Amiga/i => ["
Other
"],
qr/WinMosaic/ => ["
Windows
95
"],
qr/\(.*32bit.*\)/ => ["
Windows
95
"],
qr/\(.*16bit.*\)/ => ["
Windows
3.1
"],
qr/\(.*PowerPC.*\)/ => ["
Mac
System
9
.
x
"],
qr/\(.*PPC.*\)/ => ["
Mac
System
9
.
x
"],
qr/\(.*68K.*\)/ => ["
Mac
System
8.0
"],
);
sub detect_platform {
my $userAgent = $ENV{'HTTP_USER_AGENT'};
my @detected;
my $iterator = natatime(2, PLATFORMS_MAP);
while (my($re, $ra) = $iterator->()) {
if ($userAgent =~ $re) {
push @detected, @$ra;
}
}
return _pick_valid_field_value('rep_platform', @detected);
}
sub detect_op_sys {
my $userAgent = $ENV{'HTTP_USER_AGENT'};
my @detected;
my $iterator = natatime(2, OS_MAP);
while (my($re, $ra) = $iterator->()) {
if ($userAgent =~ $re) {
push @detected, @$ra;
}
}
push(@detected, "
Windows
") if grep(/^Windows /, @detected);
push(@detected, "
Mac
OS
") if grep(/^Mac /, @detected);
return _pick_valid_field_value('op_sys', @detected);
}
# Takes the name of a field and a list of possible values for that field.
# Returns the first value in the list that is actually a valid value for that
# field.
# Returns 'Other' if none of the values match.
sub _pick_valid_field_value {
my ($field, @values) = @_;
foreach my $value (@values) {
return $value if check_field($field, $value, undef, 1);
}
return DEFAULT_VALUE;
}
1;
__END__
=head1 NAME
Bugzilla::UserAgent - UserAgent utilities for Bugzilla
=head1 SYNOPSIS
use Bugzilla::UserAgent;
printf "
platform:
%
s
op
-
sys:
%
s
\
n
"
,
detect_platform
(),
detect_op_sys
();
=
head1
DESCRIPTION
The
functions
exported
by
this
module
all
return
information
derived
from
the
remote
client
's user agent.
=head1 FUNCTIONS
=over 4
=item C<detect_platform>
This function attempts to detect the remote client'
s
platform
from
the
presented
user
-
agent
.
If
a
suitable
value
on
the
I
<
platform
>
field
is
found
,
that
field
value
will
be
returned
.
If
no
suitable
value
is
detected
,
C
<
detect_platform
>
returns
I
<
Other
>.
=
item
C
<
detect_op_sys
>
This
function
attempts
to
detect
the
remote
client
'
s
operating
system
from
the
presented
user
-
agent
.
If
a
suitable
value
on
the
I
<
op_sys
>
field
is
found
,
that
field
value
will
be
returned
.
If
no
suitable
value
is
detected
,
C
<
detect_op_sys
>
returns
I
<
Other
>.
=
back
enter_bug.cgi
View file @
ecad88e7
...
@@ -51,6 +51,7 @@ use Bugzilla::Keyword;
...
@@ -51,6 +51,7 @@ use Bugzilla::Keyword;
use
Bugzilla::
Token
;
use
Bugzilla::
Token
;
use
Bugzilla::
Field
;
use
Bugzilla::
Field
;
use
Bugzilla::
Status
;
use
Bugzilla::
Status
;
use
Bugzilla::
UserAgent
;
my
$user
=
Bugzilla
->
login
(
LOGIN_REQUIRED
);
my
$user
=
Bugzilla
->
login
(
LOGIN_REQUIRED
);
...
@@ -166,195 +167,6 @@ sub formvalue {
...
@@ -166,195 +167,6 @@ sub formvalue {
return
Bugzilla
->
cgi
->
param
(
$name
)
||
$default
||
""
;
return
Bugzilla
->
cgi
->
param
(
$name
)
||
$default
||
""
;
}
}
# Takes the name of a field and a list of possible values for that
# field. Returns the first value in the list that is actually a
# valid value for that field.
# The field should be named after its DB table.
# Returns undef if none of the platforms match.
sub
pick_valid_field_value
(@)
{
my
(
$field
,
@values
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
foreach
my
$value
(
@values
)
{
return
$value
if
$dbh
->
selectrow_array
(
"SELECT 1 FROM $field WHERE value = ?"
,
undef
,
$value
);
}
return
undef
;
}
sub
pickplatform
{
return
formvalue
(
"rep_platform"
)
if
formvalue
(
"rep_platform"
);
my
@platform
;
if
(
Bugzilla
->
params
->
{
'defaultplatform'
})
{
@platform
=
Bugzilla
->
params
->
{
'defaultplatform'
};
}
else
{
# If @platform is a list, this function will return the first
# item in the list that is a valid platform choice. If
# no choice is valid, we return "Other".
for
(
$ENV
{
'HTTP_USER_AGENT'
})
{
#PowerPC
/\(.*PowerPC.*\)/i
&&
do
{
push
@platform
,
(
"PowerPC"
,
"Macintosh"
);};
#AMD64, Intel x86_64
/\(.*amd64.*\)/
&&
do
{
push
@platform
,
(
"AMD64"
,
"x86_64"
,
"PC"
);};
/\(.*x86_64.*\)/
&&
do
{
push
@platform
,
(
"AMD64"
,
"x86_64"
,
"PC"
);};
#Intel Itanium
/\(.*IA64.*\)/
&&
do
{
push
@platform
,
"IA64"
;};
#Intel x86
/\(.*Intel.*\)/
&&
do
{
push
@platform
,
(
"IA32"
,
"x86"
,
"PC"
);};
/\(.*[ix0-9]86.*\)/
&&
do
{
push
@platform
,
(
"IA32"
,
"x86"
,
"PC"
);};
#Versions of Windows that only run on Intel x86
/\(.*Win(?:dows |)[39M].*\)/
&&
do
{
push
@platform
,
(
"IA32"
,
"x86"
,
"PC"
);};
/\(.*Win(?:dows |)16.*\)/
&&
do
{
push
@platform
,
(
"IA32"
,
"x86"
,
"PC"
);};
#Sparc
/\(.*sparc.*\)/
&&
do
{
push
@platform
,
(
"Sparc"
,
"Sun"
);};
/\(.*sun4.*\)/
&&
do
{
push
@platform
,
(
"Sparc"
,
"Sun"
);};
#Alpha
/\(.*AXP.*\)/i
&&
do
{
push
@platform
,
(
"Alpha"
,
"DEC"
);};
/\(.*[ _]Alpha.\D/i
&&
do
{
push
@platform
,
(
"Alpha"
,
"DEC"
);};
/\(.*[ _]Alpha\)/i
&&
do
{
push
@platform
,
(
"Alpha"
,
"DEC"
);};
#MIPS
/\(.*IRIX.*\)/i
&&
do
{
push
@platform
,
(
"MIPS"
,
"SGI"
);};
/\(.*MIPS.*\)/i
&&
do
{
push
@platform
,
(
"MIPS"
,
"SGI"
);};
#68k
/\(.*68K.*\)/
&&
do
{
push
@platform
,
(
"68k"
,
"Macintosh"
);};
/\(.*680[x0]0.*\)/
&&
do
{
push
@platform
,
(
"68k"
,
"Macintosh"
);};
#HP
/\(.*9000.*\)/
&&
do
{
push
@platform
,
(
"PA-RISC"
,
"HP"
);};
#ARM
/\(.*ARM.*\)/
&&
do
{
push
@platform
,
(
"ARM"
,
"PocketPC"
);};
#PocketPC intentionally before PowerPC
/\(.*Windows CE.*PPC.*\)/
&&
do
{
push
@platform
,
(
"ARM"
,
"PocketPC"
);};
#PowerPC
/\(.*PPC.*\)/
&&
do
{
push
@platform
,
(
"PowerPC"
,
"Macintosh"
);};
/\(.*AIX.*\)/
&&
do
{
push
@platform
,
(
"PowerPC"
,
"Macintosh"
);};
#Stereotypical and broken
/\(.*Windows CE.*\)/
&&
do
{
push
@platform
,
(
"ARM"
,
"PocketPC"
);};
/\(.*Macintosh.*\)/
&&
do
{
push
@platform
,
(
"68k"
,
"Macintosh"
);};
/\(.*Mac OS [89].*\)/
&&
do
{
push
@platform
,
(
"68k"
,
"Macintosh"
);};
/\(.*Win64.*\)/
&&
do
{
push
@platform
,
"IA64"
;};
/\(Win.*\)/
&&
do
{
push
@platform
,
(
"IA32"
,
"x86"
,
"PC"
);};
/\(.*Win(?:dows[ -])NT.*\)/
&&
do
{
push
@platform
,
(
"IA32"
,
"x86"
,
"PC"
);};
/\(.*OSF.*\)/
&&
do
{
push
@platform
,
(
"Alpha"
,
"DEC"
);};
/\(.*HP-?UX.*\)/i
&&
do
{
push
@platform
,
(
"PA-RISC"
,
"HP"
);};
/\(.*IRIX.*\)/i
&&
do
{
push
@platform
,
(
"MIPS"
,
"SGI"
);};
/\(.*(SunOS|Solaris).*\)/
&&
do
{
push
@platform
,
(
"Sparc"
,
"Sun"
);};
#Braindead old browsers who didn't follow convention:
/Amiga/
&&
do
{
push
@platform
,
(
"68k"
,
"Macintosh"
);};
/WinMosaic/
&&
do
{
push
@platform
,
(
"IA32"
,
"x86"
,
"PC"
);};
}
}
return
pick_valid_field_value
(
'rep_platform'
,
@platform
)
||
"Other"
;
}
sub
pickos
{
if
(
formvalue
(
'op_sys'
)
ne
""
)
{
return
formvalue
(
'op_sys'
);
}
my
@os
=
();
if
(
Bugzilla
->
params
->
{
'defaultopsys'
})
{
@os
=
Bugzilla
->
params
->
{
'defaultopsys'
};
}
else
{
# This function will return the first
# item in @os that is a valid platform choice. If
# no choice is valid, we return "Other".
for
(
$ENV
{
'HTTP_USER_AGENT'
})
{
/\(.*IRIX.*\)/
&&
do
{
push
@os
,
"IRIX"
;};
/\(.*OSF.*\)/
&&
do
{
push
@os
,
"OSF/1"
;};
/\(.*Linux.*\)/
&&
do
{
push
@os
,
"Linux"
;};
/\(.*Solaris.*\)/
&&
do
{
push
@os
,
"Solaris"
;};
/\(.*SunOS.*\)/
&&
do
{
/\(.*SunOS 5.11.*\)/
&&
do
{
push
@os
,
(
"OpenSolaris"
,
"Opensolaris"
,
"Solaris 11"
);};
/\(.*SunOS 5.10.*\)/
&&
do
{
push
@os
,
"Solaris 10"
;};
/\(.*SunOS 5.9.*\)/
&&
do
{
push
@os
,
"Solaris 9"
;};
/\(.*SunOS 5.8.*\)/
&&
do
{
push
@os
,
"Solaris 8"
;};
/\(.*SunOS 5.7.*\)/
&&
do
{
push
@os
,
"Solaris 7"
;};
/\(.*SunOS 5.6.*\)/
&&
do
{
push
@os
,
"Solaris 6"
;};
/\(.*SunOS 5.5.*\)/
&&
do
{
push
@os
,
"Solaris 5"
;};
/\(.*SunOS 5.*\)/
&&
do
{
push
@os
,
"Solaris"
;};
/\(.*SunOS.*sun4u.*\)/
&&
do
{
push
@os
,
"Solaris"
;};
/\(.*SunOS.*i86pc.*\)/
&&
do
{
push
@os
,
"Solaris"
;};
/\(.*SunOS.*\)/
&&
do
{
push
@os
,
"SunOS"
;};
};
/\(.*HP-?UX.*\)/
&&
do
{
push
@os
,
"HP-UX"
;};
/\(.*BSD.*\)/
&&
do
{
/\(.*BSD\/(?:OS|386).*\)/
&&
do
{
push
@os
,
"BSDI"
;};
/\(.*FreeBSD.*\)/
&&
do
{
push
@os
,
"FreeBSD"
;};
/\(.*OpenBSD.*\)/
&&
do
{
push
@os
,
"OpenBSD"
;};
/\(.*NetBSD.*\)/
&&
do
{
push
@os
,
"NetBSD"
;};
};
/\(.*BeOS.*\)/
&&
do
{
push
@os
,
"BeOS"
;};
/\(.*AIX.*\)/
&&
do
{
push
@os
,
"AIX"
;};
/\(.*OS\/2.*\)/
&&
do
{
push
@os
,
"OS/2"
;};
/\(.*QNX.*\)/
&&
do
{
push
@os
,
"Neutrino"
;};
/\(.*VMS.*\)/
&&
do
{
push
@os
,
"OpenVMS"
;};
/\(.*Win.*\)/
&&
do
{
/\(.*Windows XP.*\)/
&&
do
{
push
@os
,
"Windows XP"
;};
/\(.*Windows NT 6\.1.*\)/
&&
do
{
push
@os
,
"Windows 7"
;};
/\(.*Windows NT 6\.0.*\)/
&&
do
{
push
@os
,
"Windows Vista"
;};
/\(.*Windows NT 5\.2.*\)/
&&
do
{
push
@os
,
"Windows Server 2003"
;};
/\(.*Windows NT 5\.1.*\)/
&&
do
{
push
@os
,
"Windows XP"
;};
/\(.*Windows 2000.*\)/
&&
do
{
push
@os
,
"Windows 2000"
;};
/\(.*Windows NT 5.*\)/
&&
do
{
push
@os
,
"Windows 2000"
;};
/\(.*Win.*9[8x].*4\.9.*\)/
&&
do
{
push
@os
,
"Windows ME"
;};
/\(.*Win(?:dows |)M[Ee].*\)/
&&
do
{
push
@os
,
"Windows ME"
;};
/\(.*Win(?:dows |)98.*\)/
&&
do
{
push
@os
,
"Windows 98"
;};
/\(.*Win(?:dows |)95.*\)/
&&
do
{
push
@os
,
"Windows 95"
;};
/\(.*Win(?:dows |)16.*\)/
&&
do
{
push
@os
,
"Windows 3.1"
;};
/\(.*Win(?:dows[ -]|)NT.*\)/
&&
do
{
push
@os
,
"Windows NT"
;};
/\(.*Windows.*NT.*\)/
&&
do
{
push
@os
,
"Windows NT"
;};
};
/\(.*Mac OS X.*\)/
&&
do
{
/\(.*Mac OS X (?:|Mach-O |\()10.6.*\)/
&&
do
{
push
@os
,
"Mac OS X 10.6"
;};
/\(.*Mac OS X (?:|Mach-O |\()10.5.*\)/
&&
do
{
push
@os
,
"Mac OS X 10.5"
;};
/\(.*Mac OS X (?:|Mach-O |\()10.4.*\)/
&&
do
{
push
@os
,
"Mac OS X 10.4"
;};
/\(.*Mac OS X (?:|Mach-O |\()10.3.*\)/
&&
do
{
push
@os
,
"Mac OS X 10.3"
;};
/\(.*Mac OS X (?:|Mach-O |\()10.2.*\)/
&&
do
{
push
@os
,
"Mac OS X 10.2"
;};
/\(.*Mac OS X (?:|Mach-O |\()10.1.*\)/
&&
do
{
push
@os
,
"Mac OS X 10.1"
;};
# Unfortunately, OS X 10.4 was the first to support Intel. This is
# fallback support because some browsers refused to include the OS
# Version.
/\(.*Intel.*Mac OS X.*\)/
&&
do
{
push
@os
,
"Mac OS X 10.4"
;};
# OS X 10.3 is the most likely default version of PowerPC Macs
# OS X 10.0 is more for configurations which didn't setup 10.x versions
/\(.*Mac OS X.*\)/
&&
do
{
push
@os
,
(
"Mac OS X 10.3"
,
"Mac OS X 10.0"
,
"Mac OS X"
);};
};
/\(.*32bit.*\)/
&&
do
{
push
@os
,
"Windows 95"
;};
/\(.*16bit.*\)/
&&
do
{
push
@os
,
"Windows 3.1"
;};
/\(.*Mac OS \d.*\)/
&&
do
{
/\(.*Mac OS 9.*\)/
&&
do
{
push
@os
,
(
"Mac System 9.x"
,
"Mac System 9.0"
);};
/\(.*Mac OS 8\.6.*\)/
&&
do
{
push
@os
,
(
"Mac System 8.6"
,
"Mac System 8.5"
);};
/\(.*Mac OS 8\.5.*\)/
&&
do
{
push
@os
,
"Mac System 8.5"
;};
/\(.*Mac OS 8\.1.*\)/
&&
do
{
push
@os
,
(
"Mac System 8.1"
,
"Mac System 8.0"
);};
/\(.*Mac OS 8\.0.*\)/
&&
do
{
push
@os
,
"Mac System 8.0"
;};
/\(.*Mac OS 8[^.].*\)/
&&
do
{
push
@os
,
"Mac System 8.0"
;};
/\(.*Mac OS 8.*\)/
&&
do
{
push
@os
,
"Mac System 8.6"
;};
};
/\(.*Darwin.*\)/
&&
do
{
push
@os
,
(
"Mac OS X 10.0"
,
"Mac OS X"
);};
# Silly
/\(.*Mac.*\)/
&&
do
{
/\(.*Mac.*PowerPC.*\)/
&&
do
{
push
@os
,
"Mac System 9.x"
;};
/\(.*Mac.*PPC.*\)/
&&
do
{
push
@os
,
"Mac System 9.x"
;};
/\(.*Mac.*68k.*\)/
&&
do
{
push
@os
,
"Mac System 8.0"
;};
};
# Evil
/Amiga/i
&&
do
{
push
@os
,
"Other"
;};
/WinMosaic/
&&
do
{
push
@os
,
"Windows 95"
;};
/\(.*PowerPC.*\)/
&&
do
{
push
@os
,
"Mac System 9.x"
;};
/\(.*PPC.*\)/
&&
do
{
push
@os
,
"Mac System 9.x"
;};
/\(.*68K.*\)/
&&
do
{
push
@os
,
"Mac System 8.0"
;};
}
}
push
(
@os
,
"Windows"
)
if
grep
(
/^Windows /
,
@os
);
push
(
@os
,
"Mac OS"
)
if
grep
(
/^Mac /
,
@os
);
return
pick_valid_field_value
(
'op_sys'
,
@os
)
||
"Other"
;
}
##############################################################################
##############################################################################
# End of subroutines
# End of subroutines
##############################################################################
##############################################################################
...
@@ -469,8 +281,8 @@ else {
...
@@ -469,8 +281,8 @@ else {
$default
{
'component_'
}
=
formvalue
(
'component'
);
$default
{
'component_'
}
=
formvalue
(
'component'
);
$default
{
'priority'
}
=
formvalue
(
'priority'
,
Bugzilla
->
params
->
{
'defaultpriority'
});
$default
{
'priority'
}
=
formvalue
(
'priority'
,
Bugzilla
->
params
->
{
'defaultpriority'
});
$default
{
'bug_severity'
}
=
formvalue
(
'bug_severity'
,
Bugzilla
->
params
->
{
'defaultseverity'
});
$default
{
'bug_severity'
}
=
formvalue
(
'bug_severity'
,
Bugzilla
->
params
->
{
'defaultseverity'
});
$default
{
'rep_platform'
}
=
pick
platform
();
$default
{
'rep_platform'
}
=
detect_
platform
();
$default
{
'op_sys'
}
=
picko
s
();
$default
{
'op_sys'
}
=
detect_op_sy
s
();
$vars
->
{
'alias'
}
=
formvalue
(
'alias'
);
$vars
->
{
'alias'
}
=
formvalue
(
'alias'
);
$vars
->
{
'short_desc'
}
=
formvalue
(
'short_desc'
);
$vars
->
{
'short_desc'
}
=
formvalue
(
'short_desc'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment