|
Revision 918, 0.8 kB
(checked in by qldrob, 7 years ago)
|
Here we go, my first module. It works-for-me. We need to get proper ops
in the #freepbx channel though. For those that don't want to read the
actual file, this contains a java IRC client that connects to
irc.freenode.org, joins #freepbx, and announces which distro and version
of FreePBX they're using. We may want to make that optional, but I think
it's a good idea, myself. Please, try this out and tell me what you think.
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
<? |
|---|
| 2 |
|
|---|
| 3 |
function getversioninfo() { |
|---|
| 4 |
|
|---|
| 5 |
$version = ""; |
|---|
| 6 |
$locations = array('/etc/redhat-release', '/etc/fedora-release', |
|---|
| 7 |
'/etc/debian_version', '/etc/SuSE-release', '/etc/gentoo-release'); |
|---|
| 8 |
foreach ($locations as $loc) { |
|---|
| 9 |
if (is_readable($loc)) { |
|---|
| 10 |
$fh = fopen($loc, "r"); |
|---|
| 11 |
if ($version != "") { |
|---|
| 12 |
$version .= " OR ".fgets($fh, 80); |
|---|
| 13 |
} else { |
|---|
| 14 |
$version = fgets($fh, 80); |
|---|
| 15 |
} |
|---|
| 16 |
} |
|---|
| 17 |
} |
|---|
| 18 |
if ($version == "") { |
|---|
| 19 |
return "Unknown Version"; |
|---|
| 20 |
} else { |
|---|
| 21 |
$lastchar = substr("$version", strlen("$version") - 1, 1); |
|---|
| 22 |
if ($lastchar == "\n") |
|---|
| 23 |
{ |
|---|
| 24 |
$version = substr("$version", 0, -1); |
|---|
| 25 |
} |
|---|
| 26 |
return $version; |
|---|
| 27 |
} |
|---|
| 28 |
} |
|---|
| 29 |
?> |
|---|
| 30 |
|
|---|