Редакция 41 | Редакция 59 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 41 | Редакция 42 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | class Core { |
3 | class Core { |
4 | function getDistribution($message) { |
4 | function getDistribution($message) { |
- | 5 | $answer = "unknown"; |
|
5 | if (preg_match("/debian/i",$message)) { |
6 | if (preg_match("/debian/i",$message)) { |
6 | $answer = "Debian GNU/Linux"; |
7 | $answer = "debian"; |
7 | }
|
8 | }
|
8 | if (preg_match("/ubuntu/i",$message)) { |
9 | if (preg_match("/ubuntu/i",$message)) { |
9 | $answer = "Ubuntu Linux"; |
10 | $answer = "ubuntu"; |
10 | }
|
11 | }
|
11 | if (preg_match("/infralinux/i",$message)) { |
12 | if (preg_match("/infralinux/i",$message)) { |
12 | $answer = "InfraLinux"; |
13 | $answer = "infra"; |
13 | }
|
14 | }
|
14 | return $answer; |
15 | return $answer; |
15 | }
|
16 | }
|
16 | 17 | ||
17 | function getLinuxOS($message) { |
18 | function getLinuxOS($message) { |
18 | if (preg_match("/linux/i",$message)) { |
19 | if (preg_match("/linux/i",$message)) { |
19 | return true; |
20 | return true; |
20 | } else { |
21 | } else { |
21 | return false; |
22 | return false; |
22 | }
|
23 | }
|
23 | }
|
24 | }
|
- | 25 | function getDistVersion($message,$distro){ |
|
- | 26 | $answer = "unknown"; |
|
- | 27 | if ($distro == "debian") { |
|
- | 28 | if (preg_match("/sarge/i",$message)) $answer = "sarge"; |
|
- | 29 | if (preg_match("/etch/i",$message)) $answer = "etch"; |
|
- | 30 | if (preg_match("/lenny/i",$message)) $answer = "lenny"; |
|
- | 31 | }
|
|
- | 32 | if ($distro == "ubuntu" || $distro == "infra") { |
|
- | 33 | if (preg_match("/hardy/i",$message)) $answer = "hardy"; |
|
- | 34 | if (preg_match("/intrepid/i",$message)) $answer = "intrepid"; |
|
- | 35 | }
|
|
- | 36 | return $answer; |
|
- | 37 | }
|
|
24 | }
|
38 | }
|
25 | 39 | ||
26 | ?>
|
40 | ?>
|
27 | 41 |