Skip to content

Commit 708f182

Browse files
committed
Merge pull request #25 from wjgeoghegan/master
Added weather_units setting to sysedit
2 parents 9ade85a + 04c17a3 commit 708f182

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

admin/sysedit.php

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@
153153
}
154154

155155
// begin double-checking of some of the settings in config.inc.php //
156-
156+
157+
if (!in_array(@$weather_units, array('c','f'))){
158+
$weather_units = 'c';
159+
}
160+
157161
if ($refresh != "none") {
158162
$tmp_refresh = intval($refresh);
159163
if (!empty($tmp_refresh)) {
@@ -1042,6 +1046,17 @@ class=table_rows width=80% align=left valign=top><input type=\"radio\" name=\"tm
10421046
</td></tr>\n";
10431047
$row_count++;
10441048
$row_color = ($row_count % 2) ? $color2 : $color1;
1049+
echo " <tr><td bgcolor='$row_color' class=table_rows width=10% align=left style='padding-left:4px;' valign=top>weather_units:</td>\n";
1050+
echo " <td bgcolor='$row_color' class=table_rows width=10% align=left valign=top>";
1051+
echo " <select name=\"weather_units\">\n";
1052+
echo " <option value=\"c\" " . ($weather_units == "c" ? "selected" : "") . ">Celsius</option>\n";
1053+
echo " <option value=\"f\" " . ($weather_units == "f" ? "selected" : "") . ">Fahrenheit</option>\n";
1054+
echo " </select>";
1055+
echo " <td bgcolor='$row_color' class=table_rows width=80% align=left style='padding-left:10px;' valign=top>Display weather in US or metric measurements.
1056+
Options are Fahrenheit or Celsius. Default is Celsius\".
1057+
</td></tr>\n";
1058+
$row_count++;
1059+
$row_color = ($row_count % 2) ? $color2 : $color1;
10451060
echo " <tr><td bgcolor='$row_color' class=table_rows width=10% align=left style='padding-left:4px;' valign=top>metar:</td>
10461061
<td bgcolor='$row_color' class=table_rows width=10% align=left valign=top><input type=\"text\" size=\"10\" maxlength=\"4\"
10471062
name=\"metar\" value=\"$metar\" /></td>
@@ -1260,6 +1275,8 @@ class=table_rows width=80% align=left valign=top><input type=\"radio\" name=\"tm
12601275
$post_group_name = $_POST['group_name'];
12611276
$post_display_current_users = $_POST['display_current_users'];
12621277
$post_display_weather = $_POST['display_weather'];
1278+
$post_weather_units = $_POST['weather_units'];
1279+
12631280
$post_show_display_name = $_POST['show_display_name'];
12641281
$post_display_office_name = $_POST['display_office_name'];
12651282
$post_display_group_name = $_POST['display_group_name'];
@@ -1364,6 +1381,7 @@ class=table_rows width=80% align=left valign=top><input type=\"radio\" name=\"tm
13641381
echo " </table>\n";
13651382
$evil_post = "1";
13661383
} elseif (($post_restrict_ips != '0') && ($post_restrict_ips != '1')) {
1384+
$evil_post = "1";
13671385
echo " <table align=center class=table_border width=100% border=0 cellpadding=0 cellspacing=3>\n";
13681386
echo " <tr><td width=20 align=center height=25 class=table_rows><img src='../images/icons/cancel.png' /></td>
13691387
<td class=table_rows_red height=25><b>restrict_ips</b> does not equal \"yes\" or \"no\".</td></tr>\n";
@@ -1502,6 +1520,12 @@ class=table_rows width=80% align=left valign=top><input type=\"radio\" name=\"tm
15021520
<td class=table_rows_red height=25><b>display_weather</b> does not equal \"yes\" or \"no\".</td></tr>\n";
15031521
echo " </table>\n";
15041522
$evil_post = "1";
1523+
} elseif (!in_array($post_weather_units, array('c','f'))){
1524+
echo " <table align=center class=table_border width=100% border=0 cellpadding=0 cellspacing=3>\n";
1525+
echo " <tr><td width=20 align=center height=25 class=table_rows><img src='../images/icons/cancel.png' /></td>
1526+
<td class=table_rows_red height=25><b>weather_units</b> does not equal \"Celsius\" or \"Fahrenheit\".</td></tr>\n";
1527+
echo " </table>\n";
1528+
$evil_post = "1";
15051529
} elseif ((isset($post_metar)) && (!preg_match('/' . "^([a-zA-Z]{4})+$" . '/i', $post_metar))) {
15061530
echo " <table align=center class=table_border width=100% border=0 cellpadding=0 cellspacing=3>\n";
15071531
echo " <tr><td width=20 align=center height=25 class=table_rows><img src='../images/icons/cancel.png' /></td>
@@ -2372,6 +2396,17 @@ class=table_rows width=80% align=left valign=top><input type=\"radio\" name=\"tm
23722396
echo " <td bgcolor='$row_color' class=table_rows width=80% align=left style='padding-left:10px;' valign=top>To display local weather
23732397
info on the left side of the application just below the submit button, set this to \"yes\". Default is \"<b>no</b>\".
23742398
</td></tr>\n";
2399+
$row_count++;
2400+
$row_color = ($row_count % 2) ? $color2 : $color1;
2401+
echo " <tr><td bgcolor='$row_color' class=table_rows width=10% align=left style='padding-left:4px;' valign=top>weather_units:</td>\n";
2402+
echo " <td bgcolor='$row_color' class=table_rows width=10% align=left valign=top>";
2403+
echo " <select name=\"weather_units\">\n";
2404+
echo " <option value=\"c\" " . ($weather_units == "c" ? "selected" : "") . ">Celsius</option>\n";
2405+
echo " <option value=\"f\" " . ($weather_units == "f" ? "selected" : "") . ">Fahrenheit</option>\n";
2406+
echo " </select>";
2407+
echo " <td bgcolor='$row_color' class=table_rows width=80% align=left style='padding-left:10px;' valign=top>Display weather in US or metric measurements.
2408+
Options are Fahrenheit or Celsius. Default is Celsius\".
2409+
</td></tr>\n";
23752410
$row_count++;
23762411
$row_color = ($row_count % 2) ? $color2 : $color1;
23772412
echo " <tr><td bgcolor='$row_color' class=table_rows width=10% align=left style='padding-left:4px;' valign=top>metar:</td>
@@ -3105,6 +3140,10 @@ class=table_rows width=80% align=left valign=top><input type=\"radio\" name=\"tm
31053140
31063141
$display_weather = "' . $post_display_weather . '";
31073142
3143+
/* Display weather in US or metric measurements. Options are "f" or "c". Default is "c" */
3144+
3145+
$weather_units = "' . $post_weather_units . '";
3146+
31083147
31093148
/* ICAO (International Civil Aviation Organization) for your local airport. This is the
31103149
unique four letter international ID for the airport. METAR reports are created at

templates/admin_index_tpl.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,13 @@
280280
</td></tr>\n";
281281
$row_count++;
282282
$row_color = ($row_count % 2) ? $color2 : $color1;
283+
echo " <tr><td bgcolor='$row_color' class=table_rows width=10% align=left style='padding-left:4px;' valign=top>weather_units:</td>
284+
<td bgcolor='$row_color' class=table_rows width=10% align=left valign=top>".($weather_units == "c" ? "Celsius" : "Fahrenheit")."</td>
285+
<td bgcolor='$row_color' class=table_rows width=80% align=left style='padding-left:10px;' valign=top>Display weather in US or metric measurements. Options are Fahrenheit or
286+
Celsius. Default is Celsius\".
287+
</td></tr>\n";
288+
$row_count++;
289+
$row_color = ($row_count % 2) ? $color2 : $color1;
283290
echo " <tr><td bgcolor='$row_color' class=table_rows width=10% align=left style='padding-left:4px;' valign=top>metar:</td>
284291
<td bgcolor='$row_color' class=table_rows width=10% align=left valign=top>$metar</td>
285292
<td bgcolor='$row_color' class=table_rows width=80% align=left style='padding-left:10px;' valign=top>Sets the ICAO (International

0 commit comments

Comments
 (0)