PluginProbe
wp-forecast / 2.6
wp-forecast v2.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 2.6, at wp-forecast-admin.php

803 lines 35.1 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-2009 Hans Matzen (email : webmaster at tuxlog dot 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 require_once("func_accu.php");
29 require_once("func_bug.php");
30
31 //
32 // delete cache if parameters are changed, to make sure
33 // current data will be available with next call
34 //
35 function wp_forecast_admin_init()
36 {
37 pdebug(1,"Start of wp_forecast_admin_init ()");
38
39 $count = get_option('wp-forecast-count');
40
41 if ( ($_SERVER['QUERY_STRING']=="page=wp-forecast-admin.php") &&
42 (isset($_POST['info_update']) ))
43 {
44 for ($i=0;$i<$count;$i++) {
45 $wpfcid = get_widget_id( $i );
46
47 // delete cache for old location
48 update_option("wp-forecast-expire".$wpfcid,"0");
49 update_option("wp-forecast-cache".$wpfcid,"");
50 }
51 }
52
53 // add thickbox and jquery for checklist
54 wp_enqueue_script( 'thickbox' );
55 wp_enqueue_style ( 'thickbox' );
56
57 pdebug(1,"End of wp_forecast_admin_init ()");
58 }
59
60 //
61 // add menuitem for options menu
62 //
63 function wp_forecast_admin()
64 {
65 pdebug(1,"Start of wp_forecast_admin ()");
66
67 add_menu_page('wp-Forecast', 'wp-Forecast', 6,
68 basename(__FILE__), 'wpf_admin_form',
69 site_url("/wp-content/plugins/wp-forecast") . '/wpf.png');
70
71 pdebug(1,"End of wp_forecast_admin ()");
72 }
73
74 //
75 // print out hint for the widget control
76 //
77 function wpf_admin_hint($args = null)
78 {
79 pdebug(1,"Start of wp_admin_hint ()");
80
81 $wpfcid = $args;
82
83 // get translation
84 $locale = get_locale();
85 if ( empty($locale) )
86 $locale = 'en_US';
87 if(function_exists('load_textdomain'))
88 load_textdomain("wp-forecast_".$locale,ABSPATH . "wp-content/plugins/wp-forecast/lang/".$locale.".mo");
89
90 // code for widget title form
91 $av=get_wpf_opts($wpfcid);
92 $av['title'] = $newtitle = $av['title'];
93
94 if ( $_POST["wpf-submit-title".$wpfcid] )
95 $newtitle = strip_tags(stripslashes($_POST["wpf-title-".$wpfcid]));
96
97 if ( $av['title'] != $newtitle ) {
98 $av['title'] = $newtitle;
99 update_option('wp-forecast-opts'.$wpfcid, serialize($av));
100 }
101
102 echo __("Title:","wp-forecast_".$locale);
103 echo " <input style='width: 250px;' id='wpf-title-". $wpfcid ."' name='wpf-title-" . $wpfcid . "' type='text' value='". $av['title'] . "' />";
104 echo "<input type='hidden' id='wpf-submit-title" . $wpfcid . "' name='wpf-submit-title".$wpfcid."' value='1' />";
105 echo "<p>".__('widget_hint',"wp-forecast_".$locale)."</p>";
106
107 pdebug(1,"End of wp_admin_hint ()");
108 }
109
110 //
111 // get the locationlist and return it in one long string
112 //
113 function get_loclist($uri,$loc)
114 {
115 pdebug(1,"Start of get_loclist ()");
116
117 $url=$uri . urlencode($loc);
118 $xml = fetchURL($url);
119
120 pdebug(1,"End of get_loclist ()");
121
122 return $xml;
123 }
124
125
126 //
127 // form handler for the widgets
128 //
129 function wpf_admin_form($wpfcid='A',$widgetcall=0)
130 {
131 global $wpf_maxwidgets;
132
133 pdebug(1,"Start of wpf_admin_form ()");
134
135 $count = get_option('wp-forecast-count');
136 $wpf_timeout = get_option("wp-forecast-timeout");
137 $wpf_delopt = get_option("wp-forecast-delopt");
138
139 // get locale
140 $locale = get_locale();
141 if ( empty($locale) )
142 $locale = 'en_US';
143
144 // called via the options menu not from widgets
145 if ($widgetcall==0) {
146 // load translation
147 if(function_exists('load_textdomain')) {
148 load_textdomain("wp-forecast_".$locale,ABSPATH . "wp-content/plugins/wp-forecast/lang/".$locale.".mo");
149 }
150
151 // if this is a post call, number of widgets
152 if ( isset($_POST['wpf-count-submit']) ) {
153 $number = (int) $_POST['wpf-number'];
154 if ( $number > $wpf_maxwidgets ) $number = $wpf_maxwidgets;
155 if ( $number < 1 ) $number = 1;
156 $newcount = $number;
157
158 if ( $count != $newcount ) {
159 $count = $newcount;
160 update_option('wp-forecast-count', $count);
161 // add missing option to database
162 wp_forecast_activate();
163 // init the new number of widgets
164 widget_wp_forecast_init($count);
165 }
166 }
167
168 // if this is a post call, timeout
169 if ( isset($_POST['wpf-timeout-submit']) ) {
170 $timeout = (int) $_POST['wpf-timeout'];
171 if ( $timeout < 0 ) $timeout = 1;
172
173 if ( $wpf_timeout != $timeout ) {
174 $wpf_timeout = $timeout;
175 update_option('wp-forecast-timeout', $wpf_timeout);
176 }
177 }
178
179 // if this is a post call, delopt
180 if ( isset($_POST['wpf-delopt-submit']) )
181 {
182 if ( empty($_POST['wpf-delopt']) )
183 $_POST['wpf-delopt'] = 'off';
184 $delopt = (int) ($_POST['wpf-delopt'] == "on");
185 if ( $wpf_delopt != $delopt ) {
186 $wpf_delopt = $delopt;
187 update_option('wp-forecast-delopt', $wpf_delopt);
188 }
189 }
190
191
192 // if this is a post call, pre-transport
193 if ( isset($_POST['wpf-pre-transport-submit']) )
194 {
195 $pre_trans = get_option('wp-forecast-pre-transport');
196 if ($_POST['wpf-pre-transport'] != $pre_trans)
197 update_option('wp-forecast-pre-transport', $_POST['wpf-pre-transport']);
198 }
199
200
201 // print out number of widgets selection
202 $out = "<div class='wrap'>";
203 $out .= "<h2>WP-Forecast Widgets</h2>";
204 $out .= "<form name='options' id='options' method='post' action=''>";
205 $out .= "<table><tr><td width=\"60%\">".__('How many wp-forecast widgets would you like?',"wp-forecast_".$locale)."</td>";
206 $out .= "<td width=\"20%\"><select id='wpf-number' name='wpf-number'>";
207
208 for ( $i = 1; $i <= $wpf_maxwidgets; ++$i ) {
209 $out .= "<option value='$i' ";
210 if ($count==$i)
211 $out .= "selected='selected' ";
212 $out .= ">$i</option>";
213 }
214 $out .= "</select></td><td><span class='submit'><input class='button' type='submit' name='wpf-count-submit' id='wpf-count-submit' value='".attribute_escape(__('Save'),"wp-forecast_".$locale)."' /></span></td></tr>";
215
216 // print out widget selection form
217 $out .="<tr><td>".__('Available widgets',"wp-forecast_".$locale).": </td>";
218 $out .="<td><select name='widgetid' size='1' >";
219 for ($i=0;$i<$count;$i++) {
220 $id = get_widget_id( $i );
221 $out .="<option value='".$id."' ";
222 if ( (array_key_exists('widgetid', $_POST) and
223 $id==$_POST['widgetid'] and isset($_POST['set_widget'])) or
224 (isset($_POST['info_update']) and $id==$_POST['wid']) or
225 (isset($_POST['search_loc']) and $id==$_POST['wid']) or
226 (isset($_POST['set_loc']) and $id==$_POST['wid']))
227 $out .="selected='selected'";
228 $out .=">".$id."</option>";
229 }
230 $out .= "</select></td>";
231
232 $out .='<td><span class="submit"><input class="button" type="submit" name="set_widget" value="' ;
233 $out .=__('Select widget',"wp-forecast_".$locale)." »\" /></span></td></tr>\n";
234
235
236 // print out timeout input field for transport
237 // (timeout for data connection)
238 $out .= "<tr><td>".__('Timeout for weatherprovider connections (secs.)?',"wp-forecast_".$locale)."</td>";
239 $out .= "<td><input id='wpf-timeout' name='wpf-timeout' type='text' size='3' maxlength='3' value='".$wpf_timeout. "' />";
240 $out .= "</td><td><span class='submit'><input class='button' type='submit' name='wpf-timeout-submit' id='wpf-timeout-submit' value='".attribute_escape(__('Save'),"wp-forecast_".$locale)."' /></span></td></tr>";
241
242
243 // show transport method selection
244 $out .= "<tr><td>".__('Preselect wordpress transfer method',"wp-forecast_".$locale)." :</td>";
245 $out .= "<td><select name='wpf-pre-transport' id='wpf-pre-transport' size='1' >";
246 $out .= "<option value='default'>". __("default","wp-forecast".$locale)."</option>";
247
248 // get wordpress default transports
249 $pre_trans = get_option("wp-forecast-pre-transport");
250 $tlist = get_wp_transports();
251 foreach($tlist as $t)
252 {
253 $out .= "<option value='$t'" . ($t == $pre_trans ? 'selected="selected"':'') . ">$t</option>";
254 }
255 $out .= "</select></td>";
256 $out .= "<td><span class='submit'><input class='button' type='submit' name='wpf-pre-transport-submit' id='wpf-pre-transport-submit' value='".attribute_escape(__('Save'),"wp-forecast_".$locale)."' /></span></td></tr>";
257
258
259 // print out option deletion switch
260 $out .= "<tr><td>".__('Delete options during plugin deactivation?',"wp-forecast_".$locale)."</td>";
261 $out .= "<td><input id='wpf-delopt' name='wpf-delopt' type='checkbox' ";
262 if ($wpf_delopt)
263 $out .= 'checked="checked"';
264 $out .= " />";
265 $out .= "</td><td><span class='submit'><input class='button' type='submit' name='wpf-delopt-submit' id='wpf-delopt-submit' value='".attribute_escape(__('Save'),"wp-forecast_".$locale)."' /></span></td></tr></table></form></div>\n";
266
267 // add link to checklist dialog
268 $out .= '<div style="text-align:right"><a href="../wp-content/plugins/wp-forecast/wp-forecast-check.php?height=600&amp;width=800" class="thickbox" title="">'.__("Check connection to Weatherprovider","wp-forecast_".$locale).'</a></div>'."\n";
269
270 echo $out;
271 }
272
273 // if this is a post call, select widget
274 if (isset($_POST['set_widget']) and $widgetcall==0)
275 $wpfcid = $_POST['widgetid'];
276
277 // if this is any other post call
278 if ( (isset($_POST['info_update']) and $widgetcall==0) or
279 (isset($_POST['set_loc']) and $widgetcall==0) or
280 (isset($_POST['search_loc']) and $widgetcall==0) )
281 $wpfcid = $_POST['wid'];
282
283 // default is the first widget
284 if ($wpfcid=="")
285 $wpfcid="A";
286
287 // call sub form
288 wpf_sub_admin_form($wpfcid,$widgetcall);
289
290 pdebug(1,"End of wpf_admin_form ()");
291 }
292
293 //
294 // form to modify wp-forecast setup
295 // the form also has a search function to search the wright location
296 //
297 function wpf_sub_admin_form($wpfcid,$widgetcall) {
298 global $loc;
299
300 pdebug(1,"Start of wpf_sub_admin_form ()");
301
302 // get parameters
303 $av=get_wpf_opts($wpfcid);
304
305 // get translation
306 $locale = get_locale();
307 if ( empty($locale) )
308 $locale = 'en_US';
309 if(function_exists('load_textdomain'))
310 load_textdomain("wp-forecast_".$locale,ABSPATH . "wp-content/plugins/wp-forecast/lang/".$locale.".mo");
311
312
313 // if this is a POST call, save new values
314 if (isset($_POST['info_update'])) {
315 $upflag=false;
316
317 if ($av['service'] != $_POST["service"]) {
318 $av['service'] = $_POST["service"];
319 $upflag=true;
320 }
321
322 if ($av['apikey1'] != $_POST["apikey1"]) {
323 $av['apikey1'] = $_POST["apikey1"];
324 $upflag=true;
325 }
326
327 if ($av['apikey2'] != $_POST["apikey2"]) {
328 $av['apikey2'] = $_POST["apikey2"];
329 $upflag=true;
330 }
331
332 if ($av['location'] != $_POST["location"]) {
333 $av['location'] = $_POST["location"];
334 $upflag=true;
335 }
336
337 if ($av['locname'] != $_POST["locname"]) {
338 $av['locname'] = $_POST["locname"];
339 $upflag=true;
340 }
341
342 if ($av['refresh'] != $_POST["refresh"]) {
343 $av['refresh'] = $_POST["refresh"];
344 $upflag=true;
345 }
346
347 if ($av['metric'] != $_POST["metric"]) {
348 $av['metric'] = $_POST["metric"];
349 if ($av['metric']=="") $av['metric']="0";
350 $upflag=true;
351 }
352
353 if ($av['windunit'] != $_POST["windunit"]) {
354 $av['windunit'] = $_POST["windunit"];
355 $upflag=true;
356 }
357
358 if ($av['wpf_language'] != $_POST["language"]) {
359 $av['wpf_language'] = $_POST["language"];
360 $upflag=true;
361 }
362
363 if ($av['currtime'] != $_POST["currtime"]) {
364 $av['currtime'] = $_POST["currtime"];
365 if ($av['currtime']=="") $av['currtime']="0";
366 $upflag=true;
367 }
368
369 if ($av['timeoffset'] != $_POST["timeoffset"]) {
370 $av['timeoffset'] = $_POST["timeoffset"];
371 $upflag=true;
372 }
373
374 if ($av['pdfirstday'] != $_POST["pdfirstday"]) {
375 $av['pdfirstday'] = $_POST["pdfirstday"];
376 if ($av['pdfirstday']=="") $av['pdfirstday']="0";
377 $upflag=true;
378 }
379
380 if ($av['pdforecast'] != $_POST["pdforecast"]) {
381 $av['pdforecast'] = $_POST["pdforecast"];
382 if ($av['pdforecast']=="") $av['pdforecast']="0";
383 $upflag=true;
384 }
385
386 // set checkbox value to zero if not set
387 // for forecast options
388 $nd = array('day1','day2','day3','day4','day5','day6','day7','day8','day9','night1','night2','night3','night4','night5','night6','night7','night8','night9');
389 foreach ($nd as $i) {
390 if ($_POST[$i]=="")
391 $_POST["$i"]="0";
392 }
393
394 // set empty checkboxes to 0
395 $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','d_c_accuweather','d_c_aw_newwindow');
396 foreach ($do as $i) {
397 if ($_POST[$i]=="")
398 $_POST["$i"]="0";
399 }
400
401 // build config string for dispconfig and update if necessary
402 $newdispconfig="";
403 foreach ($do as $i)
404 $newdispconfig.=$_POST[$i];
405
406 if (strcmp($av['dispconfig'],$newdispconfig) != 0) {
407 $av['dispconfig'] = $newdispconfig;
408 $upflag=true;
409 }
410
411
412 // build config string for forecast and update if necessary
413 $newdaytime=$_POST["day1"].$_POST["day2"].$_POST["day3"].$_POST["day4"].$_POST["day5"].$_POST["day6"].$_POST["day7"].$_POST["day8"].$_POST["day9"];
414
415 if ($av['daytime'] != $newdaytime) {
416 $av['daytime'] = $newdaytime;
417 $upflag=true;
418 }
419 // build config string for forecast and update if necessary
420 $newnighttime=$_POST["night1"].$_POST["night2"].$_POST["night3"].$_POST["night4"].$_POST["night5"].$_POST["night6"].$_POST["night7"].$_POST["night8"].$_POST["night9"];
421
422 if ($av['nighttime'] != $newnighttime) {
423 $av['nighttime'] = $newnighttime;
424 $upflag=true;
425 }
426 // put message after update
427 echo"<div class='updated'><p><strong>";
428 if ($upflag) {
429 update_option("wp-forecast-opts".$wpfcid,serialize($av));
430 update_option("wp-forecast-expire".$wpfcid,"0");
431 echo __('Settings successfully updated',"wp-forecast_".$locale);
432 } else
433 echo __('You have to change a field to update settings.',"wp-forecast_".$locale);
434 echo "</strong></p></div>";
435 }
436
437 // if this is a POST call, search locations
438 if (isset($_POST['search_loc'])) {
439 // search location for accuweather
440 if ($av['service'] == "accu") {
441 $xml=get_loclist($av['ACCU_LOC_URI'],$_POST["searchloc"]);
442 $xml=utf8_encode($xml);
443 accu_get_locations($xml); // modifies global array $loc
444 }
445
446 // search location for weather bug
447 if ($av['service'] == "bug") {
448 $blu=str_replace('#apicode#',$av['apikey1'],$av['BUG_LOC_URI']);
449 $xml=get_loclist($blu,$_POST["searchloc"]);
450 $xml=utf8_encode($xml);
451
452
453 bug_get_locations($xml); // modifies global array $loc
454 }
455 // search location for weather.com
456 if ($av['service'] == "com") {
457 //$xml=get_loclist($COM_LOC_URI,$_POST["searchloc"]);
458 //$xml=utf8_encode($xml);
459 //if ( !function_exists('com_get_locations') )
460 //require_once("func_com.php");
461 //com_get_locations($xml); // modifies global array $loc
462 }
463 }
464
465 // if this is a POST call, set location
466 if (isset($_POST['set_loc'])) {
467 $av['location']=$_POST["newloc"];
468 }
469 ?>
470
471 <?php if ($widgetcall == 0): ?><div class="wrap">
472 <!-- add javascript for field control -->
473 <?php
474 include("wp-forecast-js.php");
475 ?>
476 <form method="post" name='woptions' action=''>
477 <?php endif; ?>
478 <input name='wid' type='hidden' value='<?php echo $wpfcid; ?>'/>
479 <h2><?php echo __('WP-Forecast Setup',"wp-forecast_".$locale)." (Widget ".$wpfcid.") ";?></h2>
480 <?php if ($widgetcall == 0): ?><fieldset id="set1"><?php endif; ?>
481 <div style="float: left; width: 49%">
482 <p><b><?php echo __('Weatherservice',"wp-forecast_".$locale)?>:</b>
483 <select name="service" size="1" onchange="apifields(document.woptions.service.value);">
484 <option value="accu" <?php if ($av['service']=="accu") echo "selected=\"selected\""?>><?php echo __('AccuWeather',"wp-forecast_".$locale)?></option>
485 <option value="bug" <?php if ($av['service']=="bug") echo "selected=\"selected\""?>><?php echo __('WeatherBug',"wp-forecast_".$locale)?></option>
486 <!--
487 <option value="com" <?php if ($av['service']=="com") echo "selected=\"selected\""?>><?php echo __('Weather.com',"wp-forecast_".$locale)?></option> -->
488 </select></p>
489
490 <p><?php echo __('Partner ID',"wp-forecast_".$locale)?>:
491 <input name="apikey1" type="text" size="30" maxlength="80" value="<?php echo $av['apikey1'] ?>" /></p>
492 <!--
493 <p><?php echo __('Licensekey',"wp-forecast_".$locale)?>:
494 <input name="apikey2" type="text" size="30" maxlength="80" value="<?php echo $av['apikey2'] ?>" /></p>
495 -->
496 <script type="text/javascript">apifields(document.woptions.service.value);</script>
497
498 <p><b><?php echo __('Location',"wp-forecast_".$locale)?>:</b>
499 <input name="location" type="text" size="30" maxlength="80" value="<?php echo $av['location'] ?>"<?php if ($widgetcall==1) echo "readonly" ?> /></p>
500 <?php if (isset($_POST['set_loc'])) { ?>
501 <p><b><?php echo __('Press Update options to save new location.',"wp-forecast_".$locale)?></b></p>
502 <?php } ?>
503
504 <p><b><?php echo __('Locationname',"wp-forecast_".$locale)?>:</b>
505 <input name="locname" type="text" size="30" maxlength="80" value="<?php echo $av['locname'] ?>" /></p>
506 <p><b><?php echo __('Refresh cache after',"wp-forecast_".$locale)?></b>
507 <input name="refresh" type="text" size="10" maxlength="6" value="<?php echo $av['refresh'] ?>"/>
508 <b><?php echo __('secs.',"wp-forecast_".$locale)?></b><br /></p>
509 <p><input type="checkbox" name="metric" value="1" <?php if ($av['metric']=="1") echo "checked=\"checked\""?> /> <b><?php echo __('Use metric units',"wp-forecast_".$locale)?></b>
510 </p>
511
512 <p><input type="checkbox" name="currtime" value="1" <?php if ($av['currtime']=="1") echo "checked=\"checked\""?> /> <b><?php echo __('Use current time',"wp-forecast_".$locale)?></b>
513 / <b><?php echo __('Time-Offset',"wp-forecast_".$locale)?> :</b> <input type="text" name="timeoffset" size="5" maxlength="5" value="<?php echo $av['timeoffset'] ?>" />
514 </p>
515
516 <p><b><?php echo __('Windspeed-Unit',"wp-forecast_".$locale)?>: </b><select name="windunit" size="1">
517 <option value="ms" <?php if ($av['windunit']=="ms") echo "selected=\"selected\""?>><?php echo __('Meter/Second (m/s)',"wp-forecast_".$locale)?></option>
518 <option value="kmh" <?php if ($av['windunit']=="kmh") echo "selected=\"selected\""?>><?php echo __('Kilometer/Hour (km/h)',"wp-forecast_".$locale)?></option>
519 <option value="mph" <?php if ($av['windunit']=="mph") echo "selected=\"selected\""?>><?php echo __('Miles/Hour (mph)',"wp-forecast_".$locale)?></option>
520 <option value="kts" <?php if ($av['windunit']=="kts") echo "selected=\"selected\""?>><?php echo __('Knots (kts)',"wp-forecast_".$locale)?></option>
521 </select></p>
522
523
524
525
526 <p>
527 <b><?php echo __('Language',"wp-forecast_".$locale)?>: </b><select name="language" size="1">
528 <option value="en_US" <?php if ($av['wpf_language']=="en_US") echo "selected=\"selected\""?>>english</option>
529 <option value="de_DE" <?php if ($av['wpf_language']=="de_DE") echo "selected=\"selected\""?>>deutsch</option>
530 <option value="da_DK" <?php if ($av['wpf_language']=="da_DK") echo "selected=\"selected\""?>>dansk</option>
531 <option value="nl_NL" <?php if ($av['wpf_language']=="nl_NL") echo "selected=\"selected\""?>>dutch</option>
532 <option value="fi_FI" <?php if ($av['wpf_language']=="fi_FI") echo "selected=\"selected\""?>>finnish</option>
533 <option value="fr_FR" <?php if ($av['wpf_language']=="fr_FR") echo "selected=\"selected\""?>>french</option>
534 <option value="hu_HU" <?php if ($av['wpf_language']=="hu_HU") echo "selected=\"selected\""?>>hungarian</option>
535 <option value="it_IT" <?php if ($av['wpf_language']=="it_IT") echo "selected=\"selected\""?>>italian</option>
536 <option value="pl_PL" <?php if ($av['wpf_language']=="pl_PL") echo "selected=\"selected\""?>>polish</option>
537 <option value="pt_PT" <?php if ($av['wpf_language']=="pt_PT") echo "selected=\"selected\""?>>portugu&#234;s</option>
538 <option value="ro_RO" <?php if ($av['wpf_language']=="ro_RO") echo "selected=\"selected\""?>>romanian</option>
539 <option value="ru_RU" <?php if ($av['wpf_language']=="ru_RU") echo "selected=\"selected\""?>>russian</option>
540 <option value="nb_NO" <?php if ($av['wpf_language']=="nb_NO") echo "selected=\"selected\""?>>norwegian</option>
541 <option value="es_ES" <?php if ($av['wpf_language']=="es_ES") echo "selected=\"selected\""?>>spanish</option>
542 <option value="sv_SE" <?php if ($av['wpf_language']=="sv_SE") echo "selected=\"selected\""?>>swedish</option>
543
544 </select></p>
545
546 <p><input type="checkbox" id="pdforecast" name="pdforecast" value="1" <?php if ($av['pdforecast']=="1") echo "checked=\"checked\""?> onchange="pdfields_update();" /> <b><?php echo __('Show forecast as ajax pull-down',"wp-forecast_".$locale)?></b>
547 </p>
548
549 <p>
550 <b><?php echo __('First day in pull-down',"wp-forecast_".$locale)?>: </b><select id="pdfirstday" name="pdfirstday" size="1">
551 <option value="1" <?php if ($av['pdfirstday']=="1") echo "selected=\"selected\""?>>1</option>
552 <option value="2" <?php if ($av['pdfirstday']=="2") echo "selected=\"selected\""?>>2</option>
553 <option value="3" <?php if ($av['pdfirstday']=="3") echo "selected=\"selected\""?>>3</option>
554 <option value="4" <?php if ($av['pdfirstday']=="4") echo "selected=\"selected\""?>>4</option>
555 <option value="5" <?php if ($av['pdfirstday']=="5") echo "selected=\"selected\""?>>5</option>
556 <option value="6" <?php if ($av['pdfirstday']=="6") echo "selected=\"selected\""?>>6</option>
557 <option value="7" <?php if ($av['pdfirstday']=="7") echo "selected=\"selected\""?>>7</option>
558 <option value="8" <?php if ($av['pdfirstday']=="8") echo "selected=\"selected\""?>>8</option>
559 <option value="9" <?php if ($av['pdfirstday']=="9") echo "selected=\"selected\""?>>9</option>
560 </select></p>
561 <script type="text/javascript">pdfields_update();</script>
562
563 </div>
564 <!-- start of right column -->
565 <div style="padding-left: 2%; float: left; width: 49%;">
566 <b><?php echo __('Display Configuration',"wp-forecast_".$locale)?></b>
567 <table>
568 <tr>
569 <td>&nbsp;</td>
570 <td><?php echo __('Current Conditions',"wp-forecast_".$locale)?></td>
571 <td><?php echo __('Forecast Day',"wp-forecast_".$locale)?></td>
572 <td><?php echo __('Forecast Night',"wp-forecast_".$locale)?></td>
573 </tr>
574 <tr>
575 <td><?php echo __('Icon',"wp-forecast_".$locale)?></td>
576 <td align='center'><input type="checkbox" name="d_c_icon" value="1"
577 <?php if (substr($av['dispconfig'],0,1)=="1") echo "checked=\"checked\""?> /></td>
578 <td align='center'><input type="checkbox" name="d_d_icon" value="1"
579 <?php if (substr($av['dispconfig'],10,1)=="1") echo "checked=\"checked\""?> /></td>
580 <td align='center'><input type="checkbox" name="d_n_icon" value="1"
581 <?php if (substr($av['dispconfig'],14,1)=="1") echo "checked=\"checked\""?> /></td>
582 </tr>
583 <tr>
584 <td><?php echo __('Date',"wp-forecast_".$locale)?></td>
585 <td align='center'><input type="checkbox" name="d_c_date" value="1"
586 <?php if (substr($av['dispconfig'],18,1)=="1") echo "checked=\"checked\""?> /></td>
587 <td align='center'>&nbsp;</td>
588 <td align='center'>&nbsp;</td>
589 </tr>
590 <tr>
591 <td><?php echo __('Time',"wp-forecast_".$locale)?></td>
592 <td align='center'><input type="checkbox" name="d_c_time" value="1"
593 <?php if (substr($av['dispconfig'],1,1)=="1") echo "checked=\"checked\""?> /></td>
594 <td align='center'>&nbsp;</td>
595 <td align='center'>&nbsp;</td>
596 </tr>
597 <tr>
598 <td><?php echo __('Short Description',"wp-forecast_".$locale)?></td>
599 <td align='center'><input type="checkbox" name="d_c_short" value="1"
600 <?php if (substr($av['dispconfig'],2,1)=="1") echo "checked=\"checked\""?> /></td>
601 <td align='center'><input type="checkbox" name="d_d_short" value="1"
602 <?php if (substr($av['dispconfig'],11,1)=="1") echo "checked=\"checked\""?> /></td>
603 <td align='center'><input type="checkbox" name="d_n_short" value="1"
604 <?php if (substr($av['dispconfig'],15,1)=="1") echo "checked=\"checked\""?> /></td>
605 </tr>
606 <tr>
607 <td><?php echo __('Temperature',"wp-forecast_".$locale)?></td>
608 <td align='center'><input type="checkbox" name="d_c_temp" value="1"
609 <?php if (substr($av['dispconfig'],3,1)=="1") echo "checked=\"checked\""?> /></td>
610 <td align='center'><input type="checkbox" name="d_d_temp" value="1"
611 <?php if (substr($av['dispconfig'],12,1)=="1") echo "checked=\"checked\""?> /></td>
612 <td align='center'><input type="checkbox" name="d_n_temp" value="1"
613 <?php if (substr($av['dispconfig'],16,1)=="1") echo "checked=\"checked\""?> /></td>
614 </tr>
615 <tr>
616 <td><?php echo __('Realfeel',"wp-forecast_".$locale)?></td>
617 <td align='center'><input type="checkbox" name="d_c_real" value="1"
618 <?php if (substr($av['dispconfig'],4,1)=="1") echo "checked=\"checked\""?> /></td>
619 <td align='center'>&nbsp;</td>
620 <td align='center'>&nbsp;</td>
621 </tr>
622 <tr>
623 <td><?php echo __('Pressure',"wp-forecast_".$locale)?></td>
624 <td align='center'><input type="checkbox" name="d_c_press" value="1"
625 <?php if (substr($av['dispconfig'],5,1)=="1") echo "checked=\"checked\""?> /></td>
626 <td align='center'>&nbsp;</td>
627 <td align='center'>&nbsp;</td>
628 </tr>
629 <tr>
630 <td><?php echo __('Humidity',"wp-forecast_".$locale)?></td>
631 <td align='center'><input type="checkbox" name="d_c_humid" value="1"
632 <?php if (substr($av['dispconfig'],6,1)=="1") echo "checked=\"checked\""?> /></td>
633 <td align='center'>&nbsp;</td>
634 <td align='center'>&nbsp;</td>
635 </tr>
636 <tr>
637 <td><?php echo __('Wind',"wp-forecast_".$locale)?></td>
638 <td align='center'><input type="checkbox" name="d_c_wind" value="1"
639 <?php if (substr($av['dispconfig'],7,1)=="1") echo "checked=\"checked\""?> /></td>
640 <td align='center'><input type="checkbox" name="d_d_wind" value="1"
641 <?php if (substr($av['dispconfig'],13,1)=="1") echo "checked=\"checked\""?> /></td>
642 <td align='center'><input type="checkbox" name="d_n_wind" value="1"
643 <?php if (substr($av['dispconfig'],17,1)=="1") echo "checked=\"checked\""?> /></td>
644 </tr>
645 <tr>
646 <td><?php echo __('Windgusts',"wp-forecast_".$locale)?></td>
647 <td align='center'><input type="checkbox" name="d_c_wgusts" value="1"
648 <?php if (substr($av['dispconfig'],22,1)=="1") echo "checked=\"checked\""?> /></td>
649 <td align='center'><input type="checkbox" name="d_d_wgusts" value="1"
650 <?php if (substr($av['dispconfig'],23,1)=="1") echo "checked=\"checked\""?> /></td>
651 <td align='center'><input type="checkbox" name="d_n_wgusts" value="1"
652 <?php if (substr($av['dispconfig'],24,1)=="1") echo "checked=\"checked\""?> /></td>
653 </tr>
654 <tr>
655 <td><?php echo __('Sunrise',"wp-forecast_".$locale)?></td>
656 <td align='center'><input type="checkbox" name="d_c_sunrise" value="1"
657 <?php if (substr($av['dispconfig'],8,1)=="1") echo "checked=\"checked\""?> /></td>
658 <td align='center'>&nbsp;</td>
659 <td align='center'>&nbsp;</td>
660 </tr>
661 <tr>
662 <td><?php echo __('Sunset',"wp-forecast_".$locale)?></td>
663 <td align='center'><input type="checkbox" name="d_c_sunset" value="1"
664 <?php if (substr($av['dispconfig'],9,1)=="1") echo "checked=\"checked\""?> /></td>
665 <td align='center'>&nbsp;</td>
666 <td align='center'>&nbsp;</td>
667 </tr>
668 <tr>
669 <td><?php echo __('Copyright',"wp-forecast_".$locale)?></td>
670 <td align='center'><input type="checkbox" name="d_c_copyright" value="1"
671 <?php if (substr($av['dispconfig'],21,1)=="1") echo "checked=\"checked\""?> /></td>
672 <td align='center'>&nbsp;</td>
673 <td align='center'>&nbsp;</td>
674 </tr>
675 <tr>
676 <td><?php echo __('Link to Weatherprovider',"wp-forecast_".$locale)?></td>
677 <td align='center'><input type="checkbox" name="d_c_accuweather" id="d_c_accuweather" value="1"
678 <?php if (substr($av['dispconfig'],25,1)=="1") echo "checked=\"checked\""?> onchange="nwfields_update();" /></td>
679 <td colspan="2" align='left'>(<?php echo __('Open in new Window',"wp-forecast_".$locale)?>:
680 <input type="checkbox" name="d_c_aw_newwindow" id="d_c_aw_newwindow" value="1"
681 <?php if (substr($av['dispconfig'],26,1)=="1") echo "checked=\"checked\""?> />)</td>
682 </tr>
683 </table>
684 <br />
685 <script type="text/javascript">nwfields_update();</script>
686
687 <b><?php echo __('Forecast',"wp-forecast_".$locale)?></b>
688
689 <table>
690 <tr>
691 <td>&nbsp;</td>
692 <td><?php echo __('All',"wp-forecast_".$locale)?></td>
693 <td><?php echo __('Day',"wp-forecast_".$locale)?> 1</td>
694 <td><?php echo __('Day',"wp-forecast_".$locale)?> 2</td>
695 <td><?php echo __('Day',"wp-forecast_".$locale)?> 3</td>
696 <td><?php echo __('Day',"wp-forecast_".$locale)?> 4</td>
697 <td><?php echo __('Day',"wp-forecast_".$locale)?> 5</td>
698 <td><?php echo __('Day',"wp-forecast_".$locale)?> 6</td>
699 <td><?php echo __('Day',"wp-forecast_".$locale)?> 7</td>
700 <td><?php echo __('Day',"wp-forecast_".$locale)?> 8</td>
701 <td><?php echo __('Day',"wp-forecast_".$locale)?> 9</td>
702 </tr>
703 <tr><td><?php echo __('Daytime',"wp-forecast_".$locale)?></td>
704 <td><input type="checkbox" name="alldays" onclick="this.value=check('day')" /></td>
705 <td><input type="checkbox" name="day1" value="1"
706 <?php if (substr($av['daytime'],0,1)=="1") echo "checked=\"checked\""?> /></td>
707 <td><input type="checkbox" name="day2" value="1"
708 <?php if (substr($av['daytime'],1,1)=="1") echo "checked=\"checked\""?> /></td>
709 <td><input type="checkbox" name="day3" value="1"
710 <?php if (substr($av['daytime'],2,1)=="1") echo "checked=\"checked\""?> /></td>
711 <td><input type="checkbox" name="day4" value="1"
712 <?php if (substr($av['daytime'],3,1)=="1") echo "checked=\"checked\""?> /></td>
713 <td><input type="checkbox" name="day5" value="1"
714 <?php if (substr($av['daytime'],4,1)=="1") echo "checked=\"checked\""?> /></td>
715 <td><input type="checkbox" name="day6" value="1"
716 <?php if (substr($av['daytime'],5,1)=="1") echo "checked=\"checked\""?> /></td>
717 <td><input type="checkbox" name="day7" value="1"
718 <?php if (substr($av['daytime'],6,1)=="1") echo "checked=\"checked\""?> /></td>
719 <td><input type="checkbox" name="day8" value="1"
720 <?php if (substr($av['daytime'],7,1)=="1") echo "checked=\"checked\""?> /></td>
721 <td><input type="checkbox" name="day9" value="1"
722 <?php if (substr($av['daytime'],8,1)=="1") echo "checked=\"checked\""?> /></td>
723 </tr>
724 <tr><td><?php echo __('Nighttime',"wp-forecast_".$locale)?></td>
725 <td><input type="checkbox" name="allnight" onclick="this.value=check('night')" /></td>
726 <td><input type="checkbox" name="night1" value="1"
727 <?php if (substr($av['nighttime'],0,1)=="1") echo "checked=\"checked\""?> /></td>
728 <td><input type="checkbox" name="night2" value="1"
729 <?php if (substr($av['nighttime'],1,1)=="1") echo "checked=\"checked\""?> /></td>
730 <td><input type="checkbox" name="night3" value="1"
731 <?php if (substr($av['nighttime'],2,1)=="1") echo "checked=\"checked\""?> /></td>
732 <td><input type="checkbox" name="night4" value="1"
733 <?php if (substr($av['nighttime'],3,1)=="1") echo "checked=\"checked\""?> /></td>
734 <td><input type="checkbox" name="night5" value="1"
735 <?php if (substr($av['nighttime'],4,1)=="1") echo "checked=\"checked\""?> /></td>
736 <td><input type="checkbox" name="night6" value="1"
737 <?php if (substr($av['nighttime'],5,1)=="1") echo "checked=\"checked\""?> /></td>
738 <td><input type="checkbox" name="night7" value="1"
739 <?php if (substr($av['nighttime'],6,1)=="1") echo "checked=\"checked\""?> /></td>
740 <td><input type="checkbox" name="night8" value="1"
741 <?php if (substr($av['nighttime'],7,1)=="1") echo "checked=\"checked\""?> /></td>
742 <td><input type="checkbox" name="night9" value="1"
743 <?php if (substr($av['nighttime'],8,1)=="1") echo "checked=\"checked\""?> /></td>
744 </tr>
745 </table>
746 </div>
747 <!-- finally update field attributes -->
748 <script type="text/javascript">
749 apifields(document.woptions.service.value);
750 </script>
751 <?php if ($widgetcall==0): ?></fieldset><?php endif; ?>
752 <?php
753 if ($widgetcall ==0)
754 echo "<div class='submit'><input class='button-primary' type='submit' name='info_update' value='".__('Update options',"wp-forecast_".$locale)." »' /></div>";
755 else
756 echo "<input type='hidden' name='info_update' value='1' />";
757
758 // suchformular fuer locations
759 if ($widgetcall==0)
760 {
761 echo "<hr /><fieldset id=\"set2\"><legend>".__('Search location',"wp-forecast_".$locale)."</legend><br />";
762
763 if (count($loc)<=0 )
764 {
765 echo "<p><b>".__('Searchterm',"wp-forecast_".$locale).":</b>\n";
766 echo "<input name=\"searchloc\" type=\"text\" size=\"30\" maxlength=\"30\" /><br /></p>\n";
767 if (isset($_POST['search_loc']))
768 {
769 echo "<p>".__('No locations found.',"wp-forecast_".$locale)."</p>";
770 }
771 else
772 {
773 echo "<p>".__('Please replace german Umlaute ä,ö,ü with a, o, u in your searchterm.',"wp-forecast_".$locale)."</p>";
774 }
775 echo "</fieldset>\n";
776 echo "<div class='submit'>\n";
777 echo "<input class='button-primary' type='submit' name='search_loc' value='" ;
778 echo __('Search location',"wp-forecast_".$locale);
779 echo " »' />\n";
780 }
781 else
782 {
783 echo "<b>".__('Search result',"wp-forecast_".$locale).": </b><select name=\"newloc\" size=\"1\">\n";
784 foreach ($loc as $l)
785 {
786 echo "<option value=\"".$l['location']."\">";
787 echo $l['city']."/".$l['state'];
788 echo "</option>\n";
789 }
790 echo "</select><br /><p>".__('Please select your city and press set location.',"wp-forecast_".$locale)."</p>\n";
791 echo "</fieldset>\n";
792 echo "<div class='submit'>\n";
793 echo "<input class='button-primary' type='submit' name='set_loc' value='" ;
794 echo __('Set location',"wp-forecast_".$locale);
795 echo " »' />\n";
796 }
797 echo "</div></form></div>";
798 }
799
800 pdebug(1,"End of wpf_sub_admin_form ()");
801 }
802 ?>
803