PluginProbe
wp-forecast / 1.4
wp-forecast v1.4
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.4, at wp-forecast-admin.php

702 lines 27.6 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
206 // get locale
207 $locale = get_locale();
208 if ( empty($locale) )
209 $locale = 'en_US';
210
211 // called via the options menu not from widgets
212 if ($widgetcall==0) {
213 // load translation
214 if(function_exists('load_textdomain')) {
215 load_textdomain("wp-forecast_".$locale,ABSPATH . "wp-content/plugins/wp-forecast/lang/".$locale.".mo");
216 }
217
218 // if this is a post call, number of widgets
219 if ( isset($_POST['wpf-count-submit']) ) {
220 $number = (int) $_POST['wpf-number'];
221 if ( $number > $wpf_maxwidgets ) $number = $wpf_maxwidgets;
222 if ( $number < 1 ) $number = 1;
223 $newcount = $number;
224
225 if ( $count != $newcount ) {
226 $count = $newcount;
227 update_option('wp-forecast-count', $count);
228 // add missing option to database
229 wp_forecast_activate();
230 // init the new number of widgets
231 widget_wp_forecast_init($count);
232 }
233 }
234
235 // print out number of widgets selection
236 $out = "<div class='wrap'><form method='post' action=''>";
237 $out .= "<h2>WP-Forecast Widgets</h2>";
238 $out .= "<table><tr><td>".__('How many wp-forecast widgets would you like?',"wp-forecast_".$locale)."</td>";
239 $out .= "<td><select id='wpf-number' name='wpf-number'>";
240
241 for ( $i = 1; $i <= $wpf_maxwidgets; ++$i ) {
242 $out .= "<option value='$i' ";
243 if ($count==$i)
244 $out .= "selected='selected' ";
245 $out .= ">$i</option>";
246 }
247 $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>";
248
249 // print out widget selection form
250 $out .="<tr><td>".__('Available widgets',"wp-forecast_".$locale).": </td>";
251 $out .="<td><select name='widgetid' size='1' >";
252 for ($i=0;$i<$count;$i++) {
253 $id = get_widget_id( $i );
254 $out .="<option value='".$id."' ";
255 if ( ($id==$_POST['widgetid'] and isset($_POST['set_widget'])) or
256 (isset($_POST['info_update']) and $id==$_POST['wid']) or
257 (isset($_POST['search_loc']) and $id==$_POST['wid']) or
258 (isset($_POST['set_loc']) and $id==$_POST['wid']))
259 $out .="selected";
260 $out .=">".$id."</option>";
261 }
262 $out .= "</select></td>";
263
264 $out .="<td><span class=\"submit\"><input type=\"submit\" name=\"set_widget\" value=\"" ;
265 $out .=__('Select widget',"wp-forecast_".$locale)." »\" /></span></td></tr></table></form></div>\n";
266
267 echo $out;
268 }
269
270
271 // if this is a post call, select widget
272 if (isset($_POST['set_widget']) and $widgetcall==0)
273 $wpfcid = $_POST['widgetid'];
274
275 // if this is any other post call
276 if ( (isset($_POST['info_update']) and $widgetcall==0) or
277 (isset($_POST['set_loc']) and $widgetcall==0) or
278 (isset($_POST['search_loc']) and $widgetcall==0) )
279 $wpfcid = $_POST['wid'];
280
281 // default is the first widget
282 if ($wpfcid=="")
283 $wpfcid="A";
284
285 // call sub form
286 wpf_sub_admin_form($wpfcid,$widgetcall);
287
288 if ($wpf_debug > 0)
289 pdebug("End of wpf_admin_form ()");
290 }
291
292 //
293 // form to modify wp-forecast setup
294 // options in wp_option: wp-forecast-location, wp-forecast-refresh
295 // wp-forecast-metric, wp-forecast-language
296 // wp-forecast-daytime wp-forecast-nighttime
297 // wp-forecast-dispconfig wp-forecast-locname
298 //
299 // the form also has a search function to search the wright location
300 //
301 function wpf_sub_admin_form($wpfcid,$widgetcall) {
302 global $loc,$wpf_debug;
303
304 if ($wpf_debug > 0)
305 pdebug("Start of wpf_sub_admin_form ()");
306
307 // uri for location search
308 $LOC_URI="http://forecastfox.accuweather.com/adcbin/forecastfox/locate_city.asp?location=";
309
310 // wp-forecast optionen aus datenbank lesen
311 $location=get_option("wp-forecast-location".$wpfcid);
312 $locname=get_option("wp-forecast-locname".$wpfcid);
313 $refresh=get_option("wp-forecast-refresh".$wpfcid);
314 $metric=get_option("wp-forecast-metric".$wpfcid);
315 $wpf_language=get_option("wp-forecast-language".$wpfcid);
316 $daytime=get_option("wp-forecast-daytime".$wpfcid);
317 $nighttime=get_option("wp-forecast-nighttime".$wpfcid);
318 $dispconfig=get_option("wp-forecast-dispconfig".$wpfcid);
319 $windunit = get_option("wp-forecast-windunit".$wpfcid);
320 $currtime = get_option("wp-forecast-currtime".$wpfcid);
321
322 // get translation
323 $locale = get_locale();
324 if ( empty($locale) )
325 $locale = 'en_US';
326 if(function_exists('load_textdomain'))
327 load_textdomain("wp-forecast_".$locale,ABSPATH . "wp-content/plugins/wp-forecast/lang/".$locale.".mo");
328
329
330 // if this is a POST call, save new values
331 if (isset($_POST['info_update'])) {
332 $upflag=false;
333
334 if ($location != $_POST["location"]) {
335 $location = $_POST["location"];
336 update_option("wp-forecast-location".$wpfcid, $location);
337 $upflag=true;
338 }
339
340 if ($locname != $_POST["locname"]) {
341 $locname = $_POST["locname"];
342 update_option("wp-forecast-locname".$wpfcid, $locname);
343 $upflag=true;
344 }
345
346 if ($refresh != $_POST["refresh"]) {
347 $refresh = $_POST["refresh"];
348 update_option("wp-forecast-refresh".$wpfcid, $refresh);
349 $upflag=true;
350 }
351
352 if ($metric != $_POST["metric"]) {
353 $metric = $_POST["metric"];
354 if ($metric=="") $metric="0";
355 update_option("wp-forecast-metric".$wpfcid, $metric);
356 $upflag=true;
357 }
358
359 if ($windunit != $_POST["windunit"]) {
360 $windunit = $_POST["windunit"];
361 update_option("wp-forecast-windunit".$wpfcid, $windunit);
362 $upflag=true;
363 }
364
365 if ($wpf_language != $_POST["language"]) {
366 $wpf_language = $_POST["language"];
367 update_option("wp-forecast-language".$wpfcid, $wpf_language);
368 $upflag=true;
369 }
370
371 if ($currtime != $_POST["currtime"]) {
372 $currtime = $_POST["currtime"];
373 if ($currtime=="") $currtime="0";
374 update_option("wp-forecast-currtime".$wpfcid, $currtime);
375 $upflag=true;
376 }
377
378 // set checkbox value to zero if not set
379 // for forecast options
380 $nd = array('day1','day2','day3','day4','day5','day6','day7','day8','day9','night1','night2','night3','night4','night5','night6','night7','night8','night9');
381 foreach ($nd as $i) {
382 if ($_POST[$i]=="")
383 $_POST["$i"]="0";
384 }
385
386 // set empty checkboxes to 0
387 $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');
388 foreach ($do as $i) {
389 if ($_POST[$i]=="")
390 $_POST["$i"]="0";
391 }
392
393 // build config string for dispconfig and update if necessary
394 $newdispconfig="";
395 foreach ($do as $i)
396 $newdispconfig.=$_POST[$i];
397
398 if (strcmp($dispconfig,$newdispconfig) != 0) {
399 $dispconfig = $newdispconfig;
400 update_option("wp-forecast-dispconfig".$wpfcid, $newdispconfig);
401 $upflag=true;
402 }
403
404
405 // build config string for forecast and update if necessary
406 $newdaytime=$_POST["day1"].$_POST["day2"].$_POST["day3"].$_POST["day4"].$_POST["day5"].$_POST["day6"].$_POST["day7"].$_POST["day8"].$_POST["day9"];
407
408 if ($daytime != $newdaytime) {
409 $daytime = $newdaytime;
410 update_option("wp-forecast-daytime".$wpfcid, $newdaytime);
411 $upflag=true;
412 }
413 // build config string for forecast and update if necessary
414 $newnighttime=$_POST["night1"].$_POST["night2"].$_POST["night3"].$_POST["night4"].$_POST["night5"].$_POST["night6"].$_POST["night7"].$_POST["night8"].$_POST["night9"];
415
416 if ($nighttime != $newnighttime) {
417 $nighttime = $newnighttime;
418 update_option("wp-forecast-nighttime".$wpfcid, $newnighttime);
419 $upflag=true;
420 }
421 // put message after update
422 echo"<div class='updated'><p><strong>";
423 if ($upflag)
424 echo __('Settings successfully updated',"wp-forecast_".$locale);
425 else
426 echo __('You have to change a field to update settings.',"wp-forecast_".$locale);
427
428 echo "</strong></p></div>";
429 }
430
431 // if this is a POST call, search locations
432 if (isset($_POST['search_loc'])) {
433 $xml=get_loclist($LOC_URI,$_POST["searchloc"]);
434 $xml=utf8_encode($xml);
435 get_locations($xml);
436 }
437
438 // if this is a POST call, set location
439 if (isset($_POST['set_loc'])) {
440 $location=$_POST["newloc"];
441 }
442 ?>
443
444 <?php if ($widgetcall == 0): ?><div class="wrap">
445 <form method="post" action=''><?php endif; ?>
446 <input name='wid' type='hidden' value='<?php echo $wpfcid; ?>'/>
447 <h2><?php echo __('WP-Forecast Setup',"wp-forecast_".$locale)." (Widget ".$wpfcid.") ";?></h2>
448 <?php if ($widgetcall == 0): ?><fieldset id="set1"><?php endif; ?>
449 <div style="float: left; width: 49%">
450 <b><?php echo __('Location',"wp-forecast_".$locale)?>:</b>
451 <input name="location" type="text" size="30" maxlength="80" value="<?php echo $location ?>"<?php if ($widgetcall==1) echo "readonly" ?> />
452 <?php if (isset($_POST['set_loc'])) { ?>
453 <p><b><?php echo __('Press Update options to save new location.',"wp-forecast_".$locale)?></b></p>
454 <?php } ?>
455
456 <p><b><?php echo __('Locationname',"wp-forecast_".$locale)?>:</b>
457 <input name="locname" type="text" size="30" maxlength="80" value="<?php echo $locname ?>" /></p>
458 <p><b><?php echo __('Refresh cache after',"wp-forecast_".$locale)?></b>
459 <input name="refresh" type="text" size="10" maxlength="6" value="<?php echo $refresh ?>"/>
460 <b><?php echo __('secs.',"wp-forecast_".$locale)?></b><br /></p>
461 <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>
462 </p>
463
464 <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>
465 </p>
466
467 <p><b><?php echo __('Windspeed-Unit',"wp-forecast_".$locale)?>: </b><select name="windunit" size="1">
468 <option value="ms" <?php if ($windunit=="ms") echo "selected=\"selected\""?>><?php echo __('Meter/Second (m/s)',"wp-forecast_".$locale)?></option>
469 <option value="kmh" <?php if ($windunit=="kmh") echo "selected=\"selected\""?>><?php echo __('Kilometer/Hour (km/h)',"wp-forecast_".$locale)?></option>
470 <option value="mph" <?php if ($windunit=="mph") echo "selected=\"selected\""?>><?php echo __('Miles/Hour (mph)',"wp-forecast_".$locale)?></option>
471 <option value="kts" <?php if ($windunit=="kts") echo "selected=\"selected\""?>><?php echo __('Knots (kts)',"wp-forecast_".$locale)?></option>
472 </select></p>
473
474
475 <p>
476 <b><?php echo __('Language',"wp-forecast_".$locale)?>: </b><select name="language" size="1">
477 <option value="en_US" <?php if ($wpf_language=="en_US") echo "selected=\"selected\""?>>english</option>
478 <option value="de_DE" <?php if ($wpf_language=="de_DE") echo "selected=\"selected\""?>>deutsch</option>
479 <option value="nl_NL" <?php if ($wpf_language=="nl_NL") echo "selected=\"selected\""?>>dutch</option>
480 <option value="fr_FR" <?php if ($wpf_language=="fr_FR") echo "selected=\"selected\""?>>french</option>
481 <option value="it_IT" <?php if ($wpf_language=="it_IT") echo "selected=\"selected\""?>>italian</option>
482 <option value="pt_PT" <?php if ($wpf_language=="pt_PT") echo "selected=\"selected\""?>>portugu&#234;s</option>
483 <option value="sv_SE" <?php if ($wpf_language=="sv_SE") echo "selected=\"selected\""?>>swedish</option>
484 </select></p>
485
486 <b><?php echo __('Forecast',"wp-forecast_".$locale)?></b>
487 <table border="1">
488 <tr>
489 <td>&nbsp;</td>
490 <td><?php echo __('Day',"wp-forecast_".$locale)?> 1</td>
491 <td><?php echo __('Day',"wp-forecast_".$locale)?> 2</td>
492 <td><?php echo __('Day',"wp-forecast_".$locale)?> 3</td>
493 <td><?php echo __('Day',"wp-forecast_".$locale)?> 4</td>
494 <td><?php echo __('Day',"wp-forecast_".$locale)?> 5</td>
495 <td><?php echo __('Day',"wp-forecast_".$locale)?> 6</td>
496 <td><?php echo __('Day',"wp-forecast_".$locale)?> 7</td>
497 <td><?php echo __('Day',"wp-forecast_".$locale)?> 8</td>
498 <td><?php echo __('Day',"wp-forecast_".$locale)?> 9</td>
499 </tr>
500 <tr><td><?php echo __('Daytime',"wp-forecast_".$locale)?></td>
501 <td><input type="checkbox" name="day1" value="1"
502 <?php if (substr($daytime,0,1)=="1") echo "checked=\"checked\""?> /></td>
503 <td><input type="checkbox" name="day2" value="1"
504 <?php if (substr($daytime,1,1)=="1") echo "checked=\"checked\""?> /></td>
505 <td><input type="checkbox" name="day3" value="1"
506 <?php if (substr($daytime,2,1)=="1") echo "checked=\"checked\""?> /></td>
507 <td><input type="checkbox" name="day4" value="1"
508 <?php if (substr($daytime,3,1)=="1") echo "checked=\"checked\""?> /></td>
509 <td><input type="checkbox" name="day5" value="1"
510 <?php if (substr($daytime,4,1)=="1") echo "checked=\"checked\""?> /></td>
511 <td><input type="checkbox" name="day6" value="1"
512 <?php if (substr($daytime,5,1)=="1") echo "checked=\"checked\""?> /></td>
513 <td><input type="checkbox" name="day7" value="1"
514 <?php if (substr($daytime,6,1)=="1") echo "checked=\"checked\""?> /></td>
515 <td><input type="checkbox" name="day8" value="1"
516 <?php if (substr($daytime,7,1)=="1") echo "checked=\"checked\""?> /></td>
517 <td><input type="checkbox" name="day9" value="1"
518 <?php if (substr($daytime,8,1)=="1") echo "checked=\"checked\""?> /></td>
519 </tr>
520 <tr><td><?php echo __('Nighttime',"wp-forecast_".$locale)?></td>
521 <td><input type="checkbox" name="night1" value="1"
522 <?php if (substr($nighttime,0,1)=="1") echo "checked=\"checked\""?> /></td>
523 <td><input type="checkbox" name="night2" value="1"
524 <?php if (substr($nighttime,1,1)=="1") echo "checked=\"checked\""?> /></td>
525 <td><input type="checkbox" name="night3" value="1"
526 <?php if (substr($nighttime,2,1)=="1") echo "checked=\"checked\""?> /></td>
527 <td><input type="checkbox" name="night4" value="1"
528 <?php if (substr($nighttime,3,1)=="1") echo "checked=\"checked\""?> /></td>
529 <td><input type="checkbox" name="night5" value="1"
530 <?php if (substr($nighttime,4,1)=="1") echo "checked=\"checked\""?> /></td>
531 <td><input type="checkbox" name="night6" value="1"
532 <?php if (substr($nighttime,5,1)=="1") echo "checked=\"checked\""?> /></td>
533 <td><input type="checkbox" name="night7" value="1"
534 <?php if (substr($nighttime,6,1)=="1") echo "checked=\"checked\""?> /></td>
535 <td><input type="checkbox" name="night8" value="1"
536 <?php if (substr($nighttime,7,1)=="1") echo "checked=\"checked\""?> /></td>
537 <td><input type="checkbox" name="night9" value="1"
538 <?php if (substr($nighttime,8,1)=="1") echo "checked=\"checked\""?> /></td>
539 </tr>
540 </table>
541 <br />
542 </div>
543 <div style="padding-left: 2%; float: left; width: 49%;">
544 <b><?php echo __('Display Configuration',"wp-forecast_".$locale)?></b>
545 <table border="1">
546 <tr>
547 <td>&nbsp;</td>
548 <td><?php echo __('Current Conditions',"wp-forecast_".$locale)?></td>
549 <td><?php echo __('Forecast Day',"wp-forecast_".$locale)?></td>
550 <td><?php echo __('Forecast Night',"wp-forecast_".$locale)?></td>
551 </tr>
552 <tr>
553 <td><?php echo __('Icon',"wp-forecast_".$locale)?></td>
554 <td align='center'><input type="checkbox" name="d_c_icon" value="1"
555 <?php if (substr($dispconfig,0,1)=="1") echo "checked=\"checked\""?> /></td>
556 <td align='center'><input type="checkbox" name="d_d_icon" value="1"
557 <?php if (substr($dispconfig,10,1)=="1") echo "checked=\"checked\""?> /></td>
558 <td align='center'><input type="checkbox" name="d_n_icon" value="1"
559 <?php if (substr($dispconfig,14,1)=="1") echo "checked=\"checked\""?> /></td>
560 </tr>
561 <tr>
562 <td><?php echo __('Date',"wp-forecast_".$locale)?></td>
563 <td align='center'><input type="checkbox" name="d_c_date" value="1"
564 <?php if (substr($dispconfig,18,1)=="1") echo "checked=\"checked\""?> /></td>
565 <td align='center'>n/a</td>
566 <td align='center'>n/a</td>
567 </tr>
568 <tr>
569 <td><?php echo __('Time',"wp-forecast_".$locale)?></td>
570 <td align='center'><input type="checkbox" name="d_c_time" value="1"
571 <?php if (substr($dispconfig,1,1)=="1") echo "checked=\"checked\""?> /></td>
572 <td align='center'>n/a</td>
573 <td align='center'>n/a</td>
574 </tr>
575 <tr>
576 <td><?php echo __('Short Description',"wp-forecast_".$locale)?></td>
577 <td align='center'><input type="checkbox" name="d_c_short" value="1"
578 <?php if (substr($dispconfig,2,1)=="1") echo "checked=\"checked\""?> /></td>
579 <td align='center'><input type="checkbox" name="d_d_short" value="1"
580 <?php if (substr($dispconfig,11,1)=="1") echo "checked=\"checked\""?> /></td>
581 <td align='center'><input type="checkbox" name="d_n_short" value="1"
582 <?php if (substr($dispconfig,15,1)=="1") echo "checked=\"checked\""?> /></td>
583 </tr>
584 <tr>
585 <td><?php echo __('Temperature',"wp-forecast_".$locale)?></td>
586 <td align='center'><input type="checkbox" name="d_c_temp" value="1"
587 <?php if (substr($dispconfig,3,1)=="1") echo "checked=\"checked\""?> /></td>
588 <td align='center'><input type="checkbox" name="d_d_temp" value="1"
589 <?php if (substr($dispconfig,12,1)=="1") echo "checked=\"checked\""?> /></td>
590 <td align='center'><input type="checkbox" name="d_n_temp" value="1"
591 <?php if (substr($dispconfig,16,1)=="1") echo "checked=\"checked\""?> /></td>
592 </tr>
593 <tr>
594 <td><?php echo __('Realfeel',"wp-forecast_".$locale)?></td>
595 <td align='center'><input type="checkbox" name="d_c_real" value="1"
596 <?php if (substr($dispconfig,4,1)=="1") echo "checked=\"checked\""?> /></td>
597 <td align='center'>n/a</td>
598 <td align='center'>n/a</td>
599 </tr>
600 <tr>
601 <td><?php echo __('Pressure',"wp-forecast_".$locale)?></td>
602 <td align='center'><input type="checkbox" name="d_c_press" value="1"
603 <?php if (substr($dispconfig,5,1)=="1") echo "checked=\"checked\""?> /></td>
604 <td align='center'>n/a</td>
605 <td align='center'>n/a</td>
606 </tr>
607 <tr>
608 <td><?php echo __('Humidity',"wp-forecast_".$locale)?></td>
609 <td align='center'><input type="checkbox" name="d_c_humid" value="1"
610 <?php if (substr($dispconfig,6,1)=="1") echo "checked=\"checked\""?> /></td>
611 <td align='center'>n/a</td>
612 <td align='center'>n/a</td>
613 </tr>
614 <tr>
615 <td><?php echo __('Wind',"wp-forecast_".$locale)?></td>
616 <td align='center'><input type="checkbox" name="d_c_wind" value="1"
617 <?php if (substr($dispconfig,7,1)=="1") echo "checked=\"checked\""?> /></td>
618 <td align='center'><input type="checkbox" name="d_d_wind" value="1"
619 <?php if (substr($dispconfig,13,1)=="1") echo "checked=\"checked\""?> /></td>
620 <td align='center'><input type="checkbox" name="d_n_wind" value="1"
621 <?php if (substr($dispconfig,17,1)=="1") echo "checked=\"checked\""?> /></td>
622 </tr>
623 <tr>
624 <td><?php echo __('Windgusts',"wp-forecast_".$locale)?></td>
625 <td align='center'><input type="checkbox" name="d_c_wgusts" value="1"
626 <?php if (substr($dispconfig,22,1)=="1") echo "checked=\"checked\""?> /></td>
627 <td align='center'><input type="checkbox" name="d_d_wgusts" value="1"
628 <?php if (substr($dispconfig,23,1)=="1") echo "checked=\"checked\""?> /></td>
629 <td align='center'><input type="checkbox" name="d_n_wgusts" value="1"
630 <?php if (substr($dispconfig,24,1)=="1") echo "checked=\"checked\""?> /></td>
631 </tr>
632 <tr>
633 <td><?php echo __('Sunrise',"wp-forecast_".$locale)?></td>
634 <td align='center'><input type="checkbox" name="d_c_sunrise" value="1"
635 <?php if (substr($dispconfig,8,1)=="1") echo "checked=\"checked\""?> /></td>
636 <td align='center'>n/a</td>
637 <td align='center'>n/a</td>
638 </tr>
639 <tr>
640 <td><?php echo __('Sunset',"wp-forecast_".$locale)?></td>
641 <td align='center'><input type="checkbox" name="d_c_sunset" value="1"
642 <?php if (substr($dispconfig,9,1)=="1") echo "checked=\"checked\""?> /></td>
643 <td align='center'>n/a</td>
644 <td align='center'>n/a</td>
645 </tr>
646 <tr>
647 <td><?php echo __('Copyright',"wp-forecast_".$locale)?></td>
648 <td align='center'><input type="checkbox" name="d_c_copyright" value="1"
649 <?php if (substr($dispconfig,21,1)=="1") echo "checked=\"checked\""?> /></td>
650 <td align='center'>n/a</td>
651 <td align='center'>n/a</td>
652 </tr>
653 </table>
654 <br />
655 </div>
656 <?php if ($widgetcall==0): ?></fieldset><?php endif; ?>
657 <?php
658 if ($widgetcall ==0)
659 echo "<div class='submit'><input type='submit' name='info_update' value='".__('Update options',"wp-forecast_".$locale)." »' /></div>";
660 else
661 echo "<input type='hidden' name='info_update' value='1' />";
662
663
664 if ($widgetcall==0) {
665 echo "<hr /><fieldset id=\"set2\"><legend>".__('Search location',"wp-forecast_".$locale)."</legend><br />";
666
667 if (count($loc)<=0) {
668 echo "<p><b>".__('Searchterm',"wp-forecast_".$locale).":</b>\n";
669 echo "<input name=\"searchloc\" type=\"text\" size=\"30\" maxlength=\"30\" /><br /></p>\n";
670 if (isset($_POST['search_loc'])) {
671 echo "<p>".__('No locations found.',"wp-forecast_".$locale)."</p>";
672 } else {
673 echo "<p>".__('Please replace german Umlaute ä,ö,ü with a, o, u in your searchterm.',"wp-forecast_".$locale)."</p>";
674 }
675
676 echo "</fieldset>\n";
677 echo "<div class=\"submit\">\n";
678 echo "<input type=\"submit\" name=\"search_loc\" value=\"" ;
679 echo __('Search location',"wp-forecast_".$locale);
680 echo " »\" />\n";
681 } else {
682 echo "<b>".__('Search result',"wp-forecast_".$locale).": </b><select name=\"newloc\" size=\"1\">\n";
683 foreach ($loc as $l) {
684 echo "<option value=\"".$l['location']."\">";
685 echo $l['city']."/".$l['state'];
686 echo "</option>\n";
687 }
688 echo "</select><br /><p>".__('Please select your city and press set location.',"wp-forecast_".$locale)."</p>\n";
689 echo "</fieldset>\n";
690 echo "<div class=\"submit\">\n";
691 echo "<input type=\"submit\" name=\"set_loc\" value=\"" ;
692 echo __('Set location',"wp-forecast_".$locale);
693 echo " »\" />\n";
694 }
695 echo "</div></form></div>";
696 }
697
698 if ($wpf_debug > 0)
699 pdebug("End of wpf_sub_admin_form ()");
700 }
701 ?>
702