PluginProbe
wp-forecast / 1.6
wp-forecast v1.6
10.0 trunk 1.4 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3..5 3..8 3.0 3.1 3.2 3.3 3.4 3.6 All 86 releases
wp-forecast / wp-forecast-admin.php

wp-forecast-admin.php in wp-forecast 1.6, at wp-forecast-admin.php

723 lines 28.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /* This file is part of the wp-forecast plugin for wordpress */
3
4 /* Copyright 2006,2007 Hans Matzen (email : webmaster at tuxlog.de)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21
22 // location array and counter init
23 $loc=array();
24 $i=0;
25
26 // generic functions
27 require_once("funclib.php");
28
29 //
30 // delete cache if parameters are changed, to make sure
31 // current data will be available with next call
32 //
33 function wp_forecast_admin_init()
34 {
35 global $wpf_debug;
36
37 if ($wpf_debug > 0)
38 pdebug("Start of wp_forecast_admin_init ()");
39
40 $count = get_option('wp-forecast-count');
41
42 if ( ($_SERVER['QUERY_STRING']=="page=wp-forecast-admin.php") &&
43 (isset($_POST['info_update']) ))
44 {
45 for ($i=0;$i<$count;$i++) {
46 $wpfcid = get_widget_id( $i );
47
48 // delete cache for old location
49 update_option("wp-forecast-expire".$wpfcid,"0");
50 }
51 }
52
53 if ($wpf_debug > 0)
54 pdebug("End of wp_forecast_admin_init ()");
55 }
56
57 //
58 // add menuitem for options menu
59 //
60 function wp_forecast_admin()
61 {
62 global $wpf_debug;
63
64 if ($wpf_debug > 0)
65 pdebug("Start of wp_forecast_admin ()");
66
67
68 if (function_exists('add_options_page')) {
69 add_options_page('WP-Forecast', 'WP-Forecast', 6,
70 basename(__FILE__), 'wpf_admin_form');
71 }
72
73 if ($wpf_debug > 0)
74 pdebug("End of wp_forecast_admin ()");
75 }
76
77 //
78 // print out hint for the widget control
79 //
80 function wpf_admin_hint($args = null)
81 {
82 global $wpf_debug;
83
84 if ($wpf_debug > 0)
85 pdebug("Start of wp_admin_hint ()");
86
87 $wpfcid = $args;
88
89 // get translation
90 $locale = get_locale();
91 if ( empty($locale) )
92 $locale = 'en_US';
93 if(function_exists('load_textdomain'))
94 load_textdomain("wp-forecast_".$locale,ABSPATH . "wp-content/plugins/wp-forecast/lang/".$locale.".mo");
95
96 // code for widget title form
97 $title = $newtitle = get_option("wp-forecast-title".$wpfcid);
98
99 if ( $_POST["wpf-submit-title".$wpfcid] )
100 $newtitle = strip_tags(stripslashes($_POST["wpf-title-".$wpfcid]));
101
102 if ( $title != $newtitle ) {
103 $title = $newtitle;
104 update_option('wp-forecast-title'.$wpfcid, $title);
105 }
106
107 echo __("Title:","wp-forecast_".$locale);
108 echo " <input style='width: 250px;' id='wpf-title-". $wpfcid ."' name='wpf-title-" . $wpfcid . "' type='text' value='". $title . "' />";
109 echo "<input type='hidden' id='wpf-submit-title" . $wpfcid . "' name='wpf-submit-title".$wpfcid."' value='1' />";
110 echo "<p>".__('widget_hint',"wp-forecast_".$locale)."</p>";
111
112 if ($wpf_debug > 0)
113 pdebug("End of wp_admin_hint ()");
114 }
115
116 //
117 // get the locationlist and return it in one long string
118 //
119 function get_loclist($uri,$loc)
120 {
121 global $wpf_debug;
122
123 if ($wpf_debug > 0)
124 pdebug("Start of get_loclist ()");
125
126 $url=$uri . urlencode($loc);
127 $xml = fetchURL($url);
128
129 if ($wpf_debug > 0)
130 pdebug("End of get_loclist ()");
131
132 return $xml;
133 }
134
135
136 //
137 // parse xml and extract locations as an array
138 // for later us in the admin form
139 //
140 function get_locations($xml)
141 {
142 global $wpf_debug;
143
144 if ($wpf_debug > 0)
145 pdebug("Start of get_locations ()");
146
147 // start_element() - wird vom XML-Parser bei öffnenden Tags aufgerufen
148 function s_element( $parser, $name, $attribute )
149 {
150 global $loc,$i;
151 if ($name == "LOCATION") {
152 $loc[$i]=array();
153 $loc[$i]['city'] = $attribute['CITY'];
154 $loc[$i]['state'] = $attribute['STATE'];
155 $loc[$i]['location'] = $attribute['LOCATION'];
156 $i++;
157 }
158 }
159
160 // end_element() - dummy function
161 function e_element( $parser, $name ){}
162
163 // Instanz des XML-Parsers erzeugen
164 $parser = xml_parser_create();
165
166 // Parameter des XML-Parsers setzen
167 xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, true );
168
169 // Handler für Elemente ( öffnende / schließende Tags ) setzen
170 xml_set_element_handler( $parser, "s_element", "e_element" );
171
172 // try to parse the xml
173 if( !xml_parse( $parser, $xml,true ) )
174 {
175 // Fehler -> Ausführung abbrechen
176 die( "XML Fehler: " .
177 xml_error_string( xml_get_error_code( $parser ) ) .
178 " in Zeile " .
179 xml_get_current_line_number( $parser )
180 );
181 }
182
183 // Vom XML-Parser belegten Speicher freigeben
184 xml_parser_free( $parser );
185
186 if ($wpf_debug > 0)
187 pdebug("End of get_locations ()");
188
189 // return locations
190 return $loc;
191 }
192
193
194 //
195 // form handler for the widgets
196 //
197 function wpf_admin_form($wpfcid='A',$widgetcall=0)
198 {
199 global $wpf_debug,$wpf_maxwidgets;
200
201 if ($wpf_debug > 0)
202 pdebug("Start of wpf_admin_form ()");
203
204 $count = get_option('wp-forecast-count');
205 $wpf_timeout = get_option("wp-forecast-timeout");
206
207 // get locale
208 $locale = get_locale();
209 if ( empty($locale) )
210 $locale = 'en_US';
211
212 // called via the options menu not from widgets
213 if ($widgetcall==0) {
214 // load translation
215 if(function_exists('load_textdomain')) {
216 load_textdomain("wp-forecast_".$locale,ABSPATH . "wp-content/plugins/wp-forecast/lang/".$locale.".mo");
217 }
218
219 // if this is a post call, number of widgets
220 if ( isset($_POST['wpf-count-submit']) ) {
221 $number = (int) $_POST['wpf-number'];
222 if ( $number > $wpf_maxwidgets ) $number = $wpf_maxwidgets;
223 if ( $number < 1 ) $number = 1;
224 $newcount = $number;
225
226 if ( $count != $newcount ) {
227 $count = $newcount;
228 update_option('wp-forecast-count', $count);
229 // add missing option to database
230 wp_forecast_activate();
231 // init the new number of widgets
232 widget_wp_forecast_init($count);
233 }
234 }
235
236 // if this is a post call, timeout
237 if ( isset($_POST['wpf-timeout-submit']) ) {
238 $timeout = (int) $_POST['wpf-timeout'];
239 if ( $timeout < 0 ) $timeout = 1;
240
241 if ( $wpf_timeout != $timeout ) {
242 $wpf_timeout = $timeout;
243 update_option('wp-forecast-timeout', $wpf_timeout);
244 }
245 }
246
247 // print out number of widgets selection
248 $out = "<div class='wrap'>";
249 $out .= "<h2>WP-Forecast Widgets</h2>";
250 $out .= "<form name='options' id='options' method='post' action=''>";
251 $out .= "<table class='form-table'><tr><td>".__('How many wp-forecast widgets would you like?',"wp-forecast_".$locale)."</td>";
252 $out .= "<td><select id='wpf-number' name='wpf-number'>";
253
254 for ( $i = 1; $i <= $wpf_maxwidgets; ++$i ) {
255 $out .= "<option value='$i' ";
256 if ($count==$i)
257 $out .= "selected='selected' ";
258 $out .= ">$i</option>";
259 }
260 $out .= "</select></td><td><span class='submit'><input type='submit' name='wpf-count-submit' id='wpf-count-submit' value='".attribute_escape(__('Save'),"wp-forecast_".$locale)."' /></span></td></tr>";
261
262 // print out widget selection form
263 $out .="<tr><td>".__('Available widgets',"wp-forecast_".$locale).": </td>";
264 $out .="<td><select name='widgetid' size='1' >";
265 for ($i=0;$i<$count;$i++) {
266 $id = get_widget_id( $i );
267 $out .="<option value='".$id."' ";
268 if ( ($id==$_POST['widgetid'] and isset($_POST['set_widget'])) or
269 (isset($_POST['info_update']) and $id==$_POST['wid']) or
270 (isset($_POST['search_loc']) and $id==$_POST['wid']) or
271 (isset($_POST['set_loc']) and $id==$_POST['wid']))
272 $out .="selected";
273 $out .=">".$id."</option>";
274 }
275 $out .= "</select></td>";
276
277 $out .="<td><span class=\"submit\"><input type=\"submit\" name=\"set_widget\" value=\"" ;
278 $out .=__('Select widget',"wp-forecast_".$locale)." »\" /></span></td></tr>\n";
279
280
281 // print out timeout input field for fsockopen
282 // (timeout for accuweather connection)
283 $out .= "<tr><td>".__('Timeout for accuweather connections (secs.)?',"wp-forecast_".$locale)."</td>";
284 $out .= "<td><input id='wpf-timeout' name='wpf-timeout' type='text' size='3' maxlength='3' value='".$wpf_timeout. "' />";
285 $out .= "</td><td><span class='submit'><input type='submit' name='wpf-timeout-submit' id='wpf-timeout-submit' value='".attribute_escape(__('Save'),"wp-forecast_".$locale)."' /></span></td></tr></table></form></div>\n";
286
287 echo $out;
288 }
289
290
291 // if this is a post call, select widget
292 if (isset($_POST['set_widget']) and $widgetcall==0)
293 $wpfcid = $_POST['widgetid'];
294
295 // if this is any other post call
296 if ( (isset($_POST['info_update']) and $widgetcall==0) or
297 (isset($_POST['set_loc']) and $widgetcall==0) or
298 (isset($_POST['search_loc']) and $widgetcall==0) )
299 $wpfcid = $_POST['wid'];
300
301 // default is the first widget
302 if ($wpfcid=="")
303 $wpfcid="A";
304
305 // call sub form
306 wpf_sub_admin_form($wpfcid,$widgetcall);
307
308 if ($wpf_debug > 0)
309 pdebug("End of wpf_admin_form ()");
310 }
311
312 //
313 // form to modify wp-forecast setup
314 // options in wp_option: wp-forecast-location, wp-forecast-refresh
315 // wp-forecast-metric, wp-forecast-language
316 // wp-forecast-daytime wp-forecast-nighttime
317 // wp-forecast-dispconfig wp-forecast-locname
318 //
319 // the form also has a search function to search the wright location
320 //
321 function wpf_sub_admin_form($wpfcid,$widgetcall) {
322 global $loc,$wpf_debug;
323
324 if ($wpf_debug > 0)
325 pdebug("Start of wpf_sub_admin_form ()");
326
327 // uri for location search
328 $LOC_URI="http://forecastfox.accuweather.com/adcbin/forecastfox/locate_city.asp?location=";
329
330 // wp-forecast optionen aus datenbank lesen
331 $location=get_option("wp-forecast-location".$wpfcid);
332 $locname=get_option("wp-forecast-locname".$wpfcid);
333 $refresh=get_option("wp-forecast-refresh".$wpfcid);
334 $metric=get_option("wp-forecast-metric".$wpfcid);
335 $wpf_language=get_option("wp-forecast-language".$wpfcid);
336 $daytime=get_option("wp-forecast-daytime".$wpfcid);
337 $nighttime=get_option("wp-forecast-nighttime".$wpfcid);
338 $dispconfig=get_option("wp-forecast-dispconfig".$wpfcid);
339 $windunit = get_option("wp-forecast-windunit".$wpfcid);
340 $currtime = get_option("wp-forecast-currtime".$wpfcid);
341
342 // get translation
343 $locale = get_locale();
344 if ( empty($locale) )
345 $locale = 'en_US';
346 if(function_exists('load_textdomain'))
347 load_textdomain("wp-forecast_".$locale,ABSPATH . "wp-content/plugins/wp-forecast/lang/".$locale.".mo");
348
349
350 // if this is a POST call, save new values
351 if (isset($_POST['info_update'])) {
352 $upflag=false;
353
354 if ($location != $_POST["location"]) {
355 $location = $_POST["location"];
356 update_option("wp-forecast-location".$wpfcid, $location);
357 $upflag=true;
358 }
359
360 if ($locname != $_POST["locname"]) {
361 $locname = $_POST["locname"];
362 update_option("wp-forecast-locname".$wpfcid, $locname);
363 $upflag=true;
364 }
365
366 if ($refresh != $_POST["refresh"]) {
367 $refresh = $_POST["refresh"];
368 update_option("wp-forecast-refresh".$wpfcid, $refresh);
369 $upflag=true;
370 }
371
372 if ($metric != $_POST["metric"]) {
373 $metric = $_POST["metric"];
374 if ($metric=="") $metric="0";
375 update_option("wp-forecast-metric".$wpfcid, $metric);
376 $upflag=true;
377 }
378
379 if ($windunit != $_POST["windunit"]) {
380 $windunit = $_POST["windunit"];
381 update_option("wp-forecast-windunit".$wpfcid, $windunit);
382 $upflag=true;
383 }
384
385 if ($wpf_language != $_POST["language"]) {
386 $wpf_language = $_POST["language"];
387 update_option("wp-forecast-language".$wpfcid, $wpf_language);
388 $upflag=true;
389 }
390
391 if ($currtime != $_POST["currtime"]) {
392 $currtime = $_POST["currtime"];
393 if ($currtime=="") $currtime="0";
394 update_option("wp-forecast-currtime".$wpfcid, $currtime);
395 $upflag=true;
396 }
397
398 // set checkbox value to zero if not set
399 // for forecast options
400 $nd = array('day1','day2','day3','day4','day5','day6','day7','day8','day9','night1','night2','night3','night4','night5','night6','night7','night8','night9');
401 foreach ($nd as $i) {
402 if ($_POST[$i]=="")
403 $_POST["$i"]="0";
404 }
405
406 // set empty checkboxes to 0
407 $do = array('d_c_icon','d_c_time','d_c_short','d_c_temp','d_c_real','d_c_press','d_c_humid','d_c_wind','d_c_sunrise','d_c_sunset','d_d_icon','d_d_short','d_d_temp','d_d_wind','d_n_icon','d_n_short','d_n_temp','d_n_wind','d_c_date','d_d_date','d_n_date','d_c_copyright','d_c_wgusts','d_d_wgusts','d_n_wgusts');
408 foreach ($do as $i) {
409 if ($_POST[$i]=="")
410 $_POST["$i"]="0";
411 }
412
413 // build config string for dispconfig and update if necessary
414 $newdispconfig="";
415 foreach ($do as $i)
416 $newdispconfig.=$_POST[$i];
417
418 if (strcmp($dispconfig,$newdispconfig) != 0) {
419 $dispconfig = $newdispconfig;
420 update_option("wp-forecast-dispconfig".$wpfcid, $newdispconfig);
421 $upflag=true;
422 }
423
424
425 // build config string for forecast and update if necessary
426 $newdaytime=$_POST["day1"].$_POST["day2"].$_POST["day3"].$_POST["day4"].$_POST["day5"].$_POST["day6"].$_POST["day7"].$_POST["day8"].$_POST["day9"];
427
428 if ($daytime != $newdaytime) {
429 $daytime = $newdaytime;
430 update_option("wp-forecast-daytime".$wpfcid, $newdaytime);
431 $upflag=true;
432 }
433 // build config string for forecast and update if necessary
434 $newnighttime=$_POST["night1"].$_POST["night2"].$_POST["night3"].$_POST["night4"].$_POST["night5"].$_POST["night6"].$_POST["night7"].$_POST["night8"].$_POST["night9"];
435
436 if ($nighttime != $newnighttime) {
437 $nighttime = $newnighttime;
438 update_option("wp-forecast-nighttime".$wpfcid, $newnighttime);
439 $upflag=true;
440 }
441 // put message after update
442 echo"<div class='updated'><p><strong>";
443 if ($upflag)
444 echo __('Settings successfully updated',"wp-forecast_".$locale);
445 else
446 echo __('You have to change a field to update settings.',"wp-forecast_".$locale);
447
448 echo "</strong></p></div>";
449 }
450
451 // if this is a POST call, search locations
452 if (isset($_POST['search_loc'])) {
453 $xml=get_loclist($LOC_URI,$_POST["searchloc"]);
454 $xml=utf8_encode($xml);
455 get_locations($xml);
456 }
457
458 // if this is a POST call, set location
459 if (isset($_POST['set_loc'])) {
460 $location=$_POST["newloc"];
461 }
462 ?>
463
464 <?php if ($widgetcall == 0): ?><div class="wrap">
465 <form method="post" action=''><?php endif; ?>
466 <input name='wid' type='hidden' value='<?php echo $wpfcid; ?>'/>
467 <h2><?php echo __('WP-Forecast Setup',"wp-forecast_".$locale)." (Widget ".$wpfcid.") ";?></h2>
468 <?php if ($widgetcall == 0): ?><fieldset id="set1"><?php endif; ?>
469 <div style="float: left; width: 49%">
470 <b><?php echo __('Location',"wp-forecast_".$locale)?>:</b>
471 <input name="location" type="text" size="30" maxlength="80" value="<?php echo $location ?>"<?php if ($widgetcall==1) echo "readonly" ?> />
472 <?php if (isset($_POST['set_loc'])) { ?>
473 <p><b><?php echo __('Press Update options to save new location.',"wp-forecast_".$locale)?></b></p>
474 <?php } ?>
475
476 <p><b><?php echo __('Locationname',"wp-forecast_".$locale)?>:</b>
477 <input name="locname" type="text" size="30" maxlength="80" value="<?php echo $locname ?>" /></p>
478 <p><b><?php echo __('Refresh cache after',"wp-forecast_".$locale)?></b>
479 <input name="refresh" type="text" size="10" maxlength="6" value="<?php echo $refresh ?>"/>
480 <b><?php echo __('secs.',"wp-forecast_".$locale)?></b><br /></p>
481 <p><input type="checkbox" name="metric" value="1" <?php if ($metric=="1") echo "checked=\"checked\""?> /> <b><?php echo __('Use metric units',"wp-forecast_".$locale)?></b>
482 </p>
483
484 <p><input type="checkbox" name="currtime" value="1" <?php if ($currtime=="1") echo "checked=\"checked\""?> /> <b><?php echo __('Use current time',"wp-forecast_".$locale)?></b>
485 </p>
486
487 <p><b><?php echo __('Windspeed-Unit',"wp-forecast_".$locale)?>: </b><select name="windunit" size="1">
488 <option value="ms" <?php if ($windunit=="ms") echo "selected=\"selected\""?>><?php echo __('Meter/Second (m/s)',"wp-forecast_".$locale)?></option>
489 <option value="kmh" <?php if ($windunit=="kmh") echo "selected=\"selected\""?>><?php echo __('Kilometer/Hour (km/h)',"wp-forecast_".$locale)?></option>
490 <option value="mph" <?php if ($windunit=="mph") echo "selected=\"selected\""?>><?php echo __('Miles/Hour (mph)',"wp-forecast_".$locale)?></option>
491 <option value="kts" <?php if ($windunit=="kts") echo "selected=\"selected\""?>><?php echo __('Knots (kts)',"wp-forecast_".$locale)?></option>
492 </select></p>
493
494
495 <p>
496 <b><?php echo __('Language',"wp-forecast_".$locale)?>: </b><select name="language" size="1">
497 <option value="en_US" <?php if ($wpf_language=="en_US") echo "selected=\"selected\""?>>english</option>
498 <option value="de_DE" <?php if ($wpf_language=="de_DE") echo "selected=\"selected\""?>>deutsch</option>
499 <option value="nl_NL" <?php if ($wpf_language=="nl_NL") echo "selected=\"selected\""?>>dutch</option>
500 <option value="fr_FR" <?php if ($wpf_language=="fr_FR") echo "selected=\"selected\""?>>french</option>
501 <option value="it_IT" <?php if ($wpf_language=="it_IT") echo "selected=\"selected\""?>>italian</option>
502 <option value="pt_PT" <?php if ($wpf_language=="pt_PT") echo "selected=\"selected\""?>>portugu&#234;s</option>
503 <option value="sv_SE" <?php if ($wpf_language=="sv_SE") echo "selected=\"selected\""?>>swedish</option>
504 <option value="nb_NO" <?php if ($wpf_language=="nb_NO") echo "selected=\"selected\""?>>norwegian</option>
505 </select></p>
506
507 <b><?php echo __('Forecast',"wp-forecast_".$locale)?></b>
508 <table border="1">
509 <tr>
510 <td>&nbsp;</td>
511 <td><?php echo __('Day',"wp-forecast_".$locale)?> 1</td>
512 <td><?php echo __('Day',"wp-forecast_".$locale)?> 2</td>
513 <td><?php echo __('Day',"wp-forecast_".$locale)?> 3</td>
514 <td><?php echo __('Day',"wp-forecast_".$locale)?> 4</td>
515 <td><?php echo __('Day',"wp-forecast_".$locale)?> 5</td>
516 <td><?php echo __('Day',"wp-forecast_".$locale)?> 6</td>
517 <td><?php echo __('Day',"wp-forecast_".$locale)?> 7</td>
518 <td><?php echo __('Day',"wp-forecast_".$locale)?> 8</td>
519 <td><?php echo __('Day',"wp-forecast_".$locale)?> 9</td>
520 </tr>
521 <tr><td><?php echo __('Daytime',"wp-forecast_".$locale)?></td>
522 <td><input type="checkbox" name="day1" value="1"
523 <?php if (substr($daytime,0,1)=="1") echo "checked=\"checked\""?> /></td>
524 <td><input type="checkbox" name="day2" value="1"
525 <?php if (substr($daytime,1,1)=="1") echo "checked=\"checked\""?> /></td>
526 <td><input type="checkbox" name="day3" value="1"
527 <?php if (substr($daytime,2,1)=="1") echo "checked=\"checked\""?> /></td>
528 <td><input type="checkbox" name="day4" value="1"
529 <?php if (substr($daytime,3,1)=="1") echo "checked=\"checked\""?> /></td>
530 <td><input type="checkbox" name="day5" value="1"
531 <?php if (substr($daytime,4,1)=="1") echo "checked=\"checked\""?> /></td>
532 <td><input type="checkbox" name="day6" value="1"
533 <?php if (substr($daytime,5,1)=="1") echo "checked=\"checked\""?> /></td>
534 <td><input type="checkbox" name="day7" value="1"
535 <?php if (substr($daytime,6,1)=="1") echo "checked=\"checked\""?> /></td>
536 <td><input type="checkbox" name="day8" value="1"
537 <?php if (substr($daytime,7,1)=="1") echo "checked=\"checked\""?> /></td>
538 <td><input type="checkbox" name="day9" value="1"
539 <?php if (substr($daytime,8,1)=="1") echo "checked=\"checked\""?> /></td>
540 </tr>
541 <tr><td><?php echo __('Nighttime',"wp-forecast_".$locale)?></td>
542 <td><input type="checkbox" name="night1" value="1"
543 <?php if (substr($nighttime,0,1)=="1") echo "checked=\"checked\""?> /></td>
544 <td><input type="checkbox" name="night2" value="1"
545 <?php if (substr($nighttime,1,1)=="1") echo "checked=\"checked\""?> /></td>
546 <td><input type="checkbox" name="night3" value="1"
547 <?php if (substr($nighttime,2,1)=="1") echo "checked=\"checked\""?> /></td>
548 <td><input type="checkbox" name="night4" value="1"
549 <?php if (substr($nighttime,3,1)=="1") echo "checked=\"checked\""?> /></td>
550 <td><input type="checkbox" name="night5" value="1"
551 <?php if (substr($nighttime,4,1)=="1") echo "checked=\"checked\""?> /></td>
552 <td><input type="checkbox" name="night6" value="1"
553 <?php if (substr($nighttime,5,1)=="1") echo "checked=\"checked\""?> /></td>
554 <td><input type="checkbox" name="night7" value="1"
555 <?php if (substr($nighttime,6,1)=="1") echo "checked=\"checked\""?> /></td>
556 <td><input type="checkbox" name="night8" value="1"
557 <?php if (substr($nighttime,7,1)=="1") echo "checked=\"checked\""?> /></td>
558 <td><input type="checkbox" name="night9" value="1"
559 <?php if (substr($nighttime,8,1)=="1") echo "checked=\"checked\""?> /></td>
560 </tr>
561 </table>
562 <br />
563 </div>
564 <div style="padding-left: 2%; float: left; width: 49%;">
565 <b><?php echo __('Display Configuration',"wp-forecast_".$locale)?></b>
566 <table border="1">
567 <tr>
568 <td>&nbsp;</td>
569 <td><?php echo __('Current Conditions',"wp-forecast_".$locale)?></td>
570 <td><?php echo __('Forecast Day',"wp-forecast_".$locale)?></td>
571 <td><?php echo __('Forecast Night',"wp-forecast_".$locale)?></td>
572 </tr>
573 <tr>
574 <td><?php echo __('Icon',"wp-forecast_".$locale)?></td>
575 <td align='center'><input type="checkbox" name="d_c_icon" value="1"
576 <?php if (substr($dispconfig,0,1)=="1") echo "checked=\"checked\""?> /></td>
577 <td align='center'><input type="checkbox" name="d_d_icon" value="1"
578 <?php if (substr($dispconfig,10,1)=="1") echo "checked=\"checked\""?> /></td>
579 <td align='center'><input type="checkbox" name="d_n_icon" value="1"
580 <?php if (substr($dispconfig,14,1)=="1") echo "checked=\"checked\""?> /></td>
581 </tr>
582 <tr>
583 <td><?php echo __('Date',"wp-forecast_".$locale)?></td>
584 <td align='center'><input type="checkbox" name="d_c_date" value="1"
585 <?php if (substr($dispconfig,18,1)=="1") echo "checked=\"checked\""?> /></td>
586 <td align='center'>n/a</td>
587 <td align='center'>n/a</td>
588 </tr>
589 <tr>
590 <td><?php echo __('Time',"wp-forecast_".$locale)?></td>
591 <td align='center'><input type="checkbox" name="d_c_time" value="1"
592 <?php if (substr($dispconfig,1,1)=="1") echo "checked=\"checked\""?> /></td>
593 <td align='center'>n/a</td>
594 <td align='center'>n/a</td>
595 </tr>
596 <tr>
597 <td><?php echo __('Short Description',"wp-forecast_".$locale)?></td>
598 <td align='center'><input type="checkbox" name="d_c_short" value="1"
599 <?php if (substr($dispconfig,2,1)=="1") echo "checked=\"checked\""?> /></td>
600 <td align='center'><input type="checkbox" name="d_d_short" value="1"
601 <?php if (substr($dispconfig,11,1)=="1") echo "checked=\"checked\""?> /></td>
602 <td align='center'><input type="checkbox" name="d_n_short" value="1"
603 <?php if (substr($dispconfig,15,1)=="1") echo "checked=\"checked\""?> /></td>
604 </tr>
605 <tr>
606 <td><?php echo __('Temperature',"wp-forecast_".$locale)?></td>
607 <td align='center'><input type="checkbox" name="d_c_temp" value="1"
608 <?php if (substr($dispconfig,3,1)=="1") echo "checked=\"checked\""?> /></td>
609 <td align='center'><input type="checkbox" name="d_d_temp" value="1"
610 <?php if (substr($dispconfig,12,1)=="1") echo "checked=\"checked\""?> /></td>
611 <td align='center'><input type="checkbox" name="d_n_temp" value="1"
612 <?php if (substr($dispconfig,16,1)=="1") echo "checked=\"checked\""?> /></td>
613 </tr>
614 <tr>
615 <td><?php echo __('Realfeel',"wp-forecast_".$locale)?></td>
616 <td align='center'><input type="checkbox" name="d_c_real" value="1"
617 <?php if (substr($dispconfig,4,1)=="1") echo "checked=\"checked\""?> /></td>
618 <td align='center'>n/a</td>
619 <td align='center'>n/a</td>
620 </tr>
621 <tr>
622 <td><?php echo __('Pressure',"wp-forecast_".$locale)?></td>
623 <td align='center'><input type="checkbox" name="d_c_press" value="1"
624 <?php if (substr($dispconfig,5,1)=="1") echo "checked=\"checked\""?> /></td>
625 <td align='center'>n/a</td>
626 <td align='center'>n/a</td>
627 </tr>
628 <tr>
629 <td><?php echo __('Humidity',"wp-forecast_".$locale)?></td>
630 <td align='center'><input type="checkbox" name="d_c_humid" value="1"
631 <?php if (substr($dispconfig,6,1)=="1") echo "checked=\"checked\""?> /></td>
632 <td align='center'>n/a</td>
633 <td align='center'>n/a</td>
634 </tr>
635 <tr>
636 <td><?php echo __('Wind',"wp-forecast_".$locale)?></td>
637 <td align='center'><input type="checkbox" name="d_c_wind" value="1"
638 <?php if (substr($dispconfig,7,1)=="1") echo "checked=\"checked\""?> /></td>
639 <td align='center'><input type="checkbox" name="d_d_wind" value="1"
640 <?php if (substr($dispconfig,13,1)=="1") echo "checked=\"checked\""?> /></td>
641 <td align='center'><input type="checkbox" name="d_n_wind" value="1"
642 <?php if (substr($dispconfig,17,1)=="1") echo "checked=\"checked\""?> /></td>
643 </tr>
644 <tr>
645 <td><?php echo __('Windgusts',"wp-forecast_".$locale)?></td>
646 <td align='center'><input type="checkbox" name="d_c_wgusts" value="1"
647 <?php if (substr($dispconfig,22,1)=="1") echo "checked=\"checked\""?> /></td>
648 <td align='center'><input type="checkbox" name="d_d_wgusts" value="1"
649 <?php if (substr($dispconfig,23,1)=="1") echo "checked=\"checked\""?> /></td>
650 <td align='center'><input type="checkbox" name="d_n_wgusts" value="1"
651 <?php if (substr($dispconfig,24,1)=="1") echo "checked=\"checked\""?> /></td>
652 </tr>
653 <tr>
654 <td><?php echo __('Sunrise',"wp-forecast_".$locale)?></td>
655 <td align='center'><input type="checkbox" name="d_c_sunrise" value="1"
656 <?php if (substr($dispconfig,8,1)=="1") echo "checked=\"checked\""?> /></td>
657 <td align='center'>n/a</td>
658 <td align='center'>n/a</td>
659 </tr>
660 <tr>
661 <td><?php echo __('Sunset',"wp-forecast_".$locale)?></td>
662 <td align='center'><input type="checkbox" name="d_c_sunset" value="1"
663 <?php if (substr($dispconfig,9,1)=="1") echo "checked=\"checked\""?> /></td>
664 <td align='center'>n/a</td>
665 <td align='center'>n/a</td>
666 </tr>
667 <tr>
668 <td><?php echo __('Copyright',"wp-forecast_".$locale)?></td>
669 <td align='center'><input type="checkbox" name="d_c_copyright" value="1"
670 <?php if (substr($dispconfig,21,1)=="1") echo "checked=\"checked\""?> /></td>
671 <td align='center'>n/a</td>
672 <td align='center'>n/a</td>
673 </tr>
674 </table>
675 <br />
676 </div>
677 <?php if ($widgetcall==0): ?></fieldset><?php endif; ?>
678 <?php
679 if ($widgetcall ==0)
680 echo "<div class='submit'><input type='submit' name='info_update' value='".__('Update options',"wp-forecast_".$locale)." »' /></div>";
681 else
682 echo "<input type='hidden' name='info_update' value='1' />";
683
684
685 if ($widgetcall==0) {
686 echo "<hr /><fieldset id=\"set2\"><legend>".__('Search location',"wp-forecast_".$locale)."</legend><br />";
687
688 if (count($loc)<=0) {
689 echo "<p><b>".__('Searchterm',"wp-forecast_".$locale).":</b>\n";
690 echo "<input name=\"searchloc\" type=\"text\" size=\"30\" maxlength=\"30\" /><br /></p>\n";
691 if (isset($_POST['search_loc'])) {
692 echo "<p>".__('No locations found.',"wp-forecast_".$locale)."</p>";
693 } else {
694 echo "<p>".__('Please replace german Umlaute ä,ö,ü with a, o, u in your searchterm.',"wp-forecast_".$locale)."</p>";
695 }
696
697 echo "</fieldset>\n";
698 echo "<div class=\"submit\">\n";
699 echo "<input type=\"submit\" name=\"search_loc\" value=\"" ;
700 echo __('Search location',"wp-forecast_".$locale);
701 echo " »\" />\n";
702 } else {
703 echo "<b>".__('Search result',"wp-forecast_".$locale).": </b><select name=\"newloc\" size=\"1\">\n";
704 foreach ($loc as $l) {
705 echo "<option value=\"".$l['location']."\">";
706 echo $l['city']."/".$l['state'];
707 echo "</option>\n";
708 }
709 echo "</select><br /><p>".__('Please select your city and press set location.',"wp-forecast_".$locale)."</p>\n";
710 echo "</fieldset>\n";
711 echo "<div class=\"submit\">\n";
712 echo "<input type=\"submit\" name=\"set_loc\" value=\"" ;
713 echo __('Set location',"wp-forecast_".$locale);
714 echo " »\" />\n";
715 }
716 echo "</div></form></div>";
717 }
718
719 if ($wpf_debug > 0)
720 pdebug("End of wpf_sub_admin_form ()");
721 }
722 ?>
723