Corrected some spelling errors and added copyright notice

This commit is contained in:
Jack-Benny Persson 2014-07-27 17:07:07 +02:00
parent 9cbe7deedc
commit 75e20d8481

View File

@ -1,5 +1,24 @@
#!/usr/bin/php
<?php
/*
Copyright (C) 2014 Jack-Benny Persson <jack-benny@cyberinfo.se>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Define exit status
$ok = 0;
$warning = 1;
@ -108,7 +127,7 @@ if (!preg_grep("/^$district$/", $availDistricts))
//$data = file_get_contents("smhi_alla_varningar.xml"); //For testing purposes
$data = shell_exec("curl -s http://www.smhi.se/weatherSMHI2/varningar/smhi_alla_varningar.xml");
//Regex the area (1st parathentis is area, 2nd is warning class, 3rd is warning msg)
// Regex the area (1st paranthesis is area, 2nd is warning class, 3rd is warning msg)
preg_match("/($district)(?:: )(?:Varning klass )([1-3]+)(?:,\s)([-a-z0-9åäö.,&\s]*)/i",
$data, $matches);
@ -132,7 +151,7 @@ else
$warnLevel = 0;
}
//Check for warnings...
// Check for warnings and exit with correct exit status
switch ($warnLevel)
{
case 0: