PluginProbe
wp-forecast / 3..5
wp-forecast v3..5
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 3..5, at wp-forecast-admin.php

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