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

795 lines 34.4 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";
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['pdfirstday'] != $_POST["pdfirstday"]) {
370 $av['pdfirstday'] = $_POST["pdfirstday"];
371 if ($av['pdfirstday']=="") $av['pdfirstday']="0";
372 $upflag=true;
373 }
374
375 if ($av['pdforecast'] != $_POST["pdforecast"]) {
376 $av['pdforecast'] = $_POST["pdforecast"];
377 if ($av['pdforecast']=="") $av['pdforecast']="0";
378 $upflag=true;
379 }
380
381 // set checkbox value to zero if not set
382 // for forecast options
383 $nd = array('day1','day2','day3','day4','day5','day6','day7','day8','day9','night1','night2','night3','night4','night5','night6','night7','night8','night9');
384 foreach ($nd as $i) {
385 if ($_POST[$i]=="")
386 $_POST["$i"]="0";
387 }
388
389 // set empty checkboxes to 0
390 $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');
391 foreach ($do as $i) {
392 if ($_POST[$i]=="")
393 $_POST["$i"]="0";
394 }
395
396 // build config string for dispconfig and update if necessary
397 $newdispconfig="";
398 foreach ($do as $i)
399 $newdispconfig.=$_POST[$i];
400
401 if (strcmp($av['dispconfig'],$newdispconfig) != 0) {
402 $av['dispconfig'] = $newdispconfig;
403 $upflag=true;
404 }
405
406
407 // build config string for forecast and update if necessary
408 $newdaytime=$_POST["day1"].$_POST["day2"].$_POST["day3"].$_POST["day4"].$_POST["day5"].$_POST["day6"].$_POST["day7"].$_POST["day8"].$_POST["day9"];
409
410 if ($av['daytime'] != $newdaytime) {
411 $av['daytime'] = $newdaytime;
412 $upflag=true;
413 }
414 // build config string for forecast and update if necessary
415 $newnighttime=$_POST["night1"].$_POST["night2"].$_POST["night3"].$_POST["night4"].$_POST["night5"].$_POST["night6"].$_POST["night7"].$_POST["night8"].$_POST["night9"];
416
417 if ($av['nighttime'] != $newnighttime) {
418 $av['nighttime'] = $newnighttime;
419 $upflag=true;
420 }
421 // put message after update
422 echo"<div class='updated'><p><strong>";
423 if ($upflag) {
424 update_option("wp-forecast-opts".$wpfcid,serialize($av));
425 update_option("wp-forecast-expire".$wpfcid,"0");
426 echo __('Settings successfully updated',"wp-forecast_".$locale);
427 } else
428 echo __('You have to change a field to update settings.',"wp-forecast_".$locale);
429 echo "</strong></p></div>";
430 }
431
432 // if this is a POST call, search locations
433 if (isset($_POST['search_loc'])) {
434 // search location for accuweather
435 if ($av['service'] == "accu") {
436 $xml=get_loclist($av['ACCU_LOC_URI'],$_POST["searchloc"]);
437 $xml=utf8_encode($xml);
438 accu_get_locations($xml); // modifies global array $loc
439 }
440
441 // search location for weather bug
442 if ($av['service'] == "bug") {
443 $blu=str_replace('#apicode#',$av['apikey1'],$av['BUG_LOC_URI']);
444 $xml=get_loclist($blu,$_POST["searchloc"]);
445 $xml=utf8_encode($xml);
446
447
448 bug_get_locations($xml); // modifies global array $loc
449 }
450 // search location for weather.com
451 if ($av['service'] == "com") {
452 //$xml=get_loclist($COM_LOC_URI,$_POST["searchloc"]);
453 //$xml=utf8_encode($xml);
454 //if ( !function_exists('com_get_locations') )
455 //require_once("func_com.php");
456 //com_get_locations($xml); // modifies global array $loc
457 }
458 }
459
460 // if this is a POST call, set location
461 if (isset($_POST['set_loc'])) {
462 $av['location']=$_POST["newloc"];
463 }
464 ?>
465
466 <?php if ($widgetcall == 0): ?><div class="wrap">
467 <!-- add javascript for field control -->
468 <?php
469 include("wp-forecast-js.php");
470 ?>
471 <form method="post" name='woptions' action=''>
472 <?php endif; ?>
473 <input name='wid' type='hidden' value='<?php echo $wpfcid; ?>'/>
474 <h2><?php echo __('WP-Forecast Setup',"wp-forecast_".$locale)." (Widget ".$wpfcid.") ";?></h2>
475 <?php if ($widgetcall == 0): ?><fieldset id="set1"><?php endif; ?>
476 <div style="float: left; width: 49%">
477 <p><b><?php echo __('Weatherservice',"wp-forecast_".$locale)?>:</b>
478 <select name="service" size="1" onchange="apifields(document.woptions.service.value);">
479 <option value="accu" <?php if ($av['service']=="accu") echo "selected=\"selected\""?>><?php echo __('AccuWeather',"wp-forecast_".$locale)?></option>
480 <option value="bug" <?php if ($av['service']=="bug") echo "selected=\"selected\""?>><?php echo __('WeatherBug',"wp-forecast_".$locale)?></option>
481 <!--
482 <option value="com" <?php if ($av['service']=="com") echo "selected=\"selected\""?>><?php echo __('Weather.com',"wp-forecast_".$locale)?></option> -->
483 </select></p>
484
485 <p><?php echo __('Partner ID',"wp-forecast_".$locale)?>:
486 <input name="apikey1" type="text" size="30" maxlength="80" value="<?php echo $av['apikey1'] ?>" /></p>
487 <!--
488 <p><?php echo __('Licensekey',"wp-forecast_".$locale)?>:
489 <input name="apikey2" type="text" size="30" maxlength="80" value="<?php echo $av['apikey2'] ?>" /></p>
490 -->
491 <script type="text/javascript">apifields(document.woptions.service.value);</script>
492
493 <p><b><?php echo __('Location',"wp-forecast_".$locale)?>:</b>
494 <input name="location" type="text" size="30" maxlength="80" value="<?php echo $av['location'] ?>"<?php if ($widgetcall==1) echo "readonly" ?> />
495 <?php if (isset($_POST['set_loc'])) { ?>
496 <p><b><?php echo __('Press Update options to save new location.',"wp-forecast_".$locale)?></b></p>
497 <?php } ?>
498
499 <p><b><?php echo __('Locationname',"wp-forecast_".$locale)?>:</b>
500 <input name="locname" type="text" size="30" maxlength="80" value="<?php echo $av['locname'] ?>" /></p>
501 <p><b><?php echo __('Refresh cache after',"wp-forecast_".$locale)?></b>
502 <input name="refresh" type="text" size="10" maxlength="6" value="<?php echo $av['refresh'] ?>"/>
503 <b><?php echo __('secs.',"wp-forecast_".$locale)?></b><br /></p>
504 <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>
505 </p>
506
507 <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>
508 </p>
509
510 <p><b><?php echo __('Windspeed-Unit',"wp-forecast_".$locale)?>: </b><select name="windunit" size="1">
511 <option value="ms" <?php if ($av['windunit']=="ms") echo "selected=\"selected\""?>><?php echo __('Meter/Second (m/s)',"wp-forecast_".$locale)?></option>
512 <option value="kmh" <?php if ($av['windunit']=="kmh") echo "selected=\"selected\""?>><?php echo __('Kilometer/Hour (km/h)',"wp-forecast_".$locale)?></option>
513 <option value="mph" <?php if ($av['windunit']=="mph") echo "selected=\"selected\""?>><?php echo __('Miles/Hour (mph)',"wp-forecast_".$locale)?></option>
514 <option value="kts" <?php if ($av['windunit']=="kts") echo "selected=\"selected\""?>><?php echo __('Knots (kts)',"wp-forecast_".$locale)?></option>
515 </select></p>
516
517
518
519
520 <p>
521 <b><?php echo __('Language',"wp-forecast_".$locale)?>: </b><select name="language" size="1">
522 <option value="en_US" <?php if ($av['wpf_language']=="en_US") echo "selected=\"selected\""?>>english</option>
523 <option value="de_DE" <?php if ($av['wpf_language']=="de_DE") echo "selected=\"selected\""?>>deutsch</option>
524 <option value="da_DK" <?php if ($av['wpf_language']=="da_DK") echo "selected=\"selected\""?>>dansk</option>
525 <option value="nl_NL" <?php if ($av['wpf_language']=="nl_NL") echo "selected=\"selected\""?>>dutch</option>
526 <option value="fi_FI" <?php if ($av['wpf_language']=="fi_FI") echo "selected=\"selected\""?>>finnish</option>
527 <option value="fr_FR" <?php if ($av['wpf_language']=="fr_FR") echo "selected=\"selected\""?>>french</option>
528 <option value="hu_HU" <?php if ($av['wpf_language']=="hu_HU") echo "selected=\"selected\""?>>hungarian</option>
529 <option value="it_IT" <?php if ($av['wpf_language']=="it_IT") echo "selected=\"selected\""?>>italian</option>
530 <option value="pl_PL" <?php if ($av['wpf_language']=="pl_PL") echo "selected=\"selected\""?>>polish</option>
531 <option value="pt_PT" <?php if ($av['wpf_language']=="pt_PT") echo "selected=\"selected\""?>>portugu&#234;s</option>
532 <option value="ro_RO" <?php if ($av['wpf_language']=="ro_RO") echo "selected=\"selected\""?>>romanian</option>
533 <option value="ru_RU" <?php if ($av['wpf_language']=="ru_RU") echo "selected=\"selected\""?>>russian</option>
534 <option value="nb_NO" <?php if ($av['wpf_language']=="nb_NO") echo "selected=\"selected\""?>>norwegian</option>
535 <option value="es_ES" <?php if ($av['wpf_language']=="es_ES") echo "selected=\"selected\""?>>spanish</option>
536 <option value="sv_SE" <?php if ($av['wpf_language']=="sv_SE") echo "selected=\"selected\""?>>swedish</option>
537
538 </select></p>
539
540 <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>
541 </p>
542
543 <p>
544 <b><?php echo __('First day in pull-down',"wp-forecast_".$locale)?>: </b><select id="pdfirstday" name="pdfirstday" size="1">
545 <option value="1" <?php if ($av['pdfirstday']=="1") echo "selected=\"selected\""?>>1</option>
546 <option value="2" <?php if ($av['pdfirstday']=="2") echo "selected=\"selected\""?>>2</option>
547 <option value="3" <?php if ($av['pdfirstday']=="3") echo "selected=\"selected\""?>>3</option>
548 <option value="4" <?php if ($av['pdfirstday']=="4") echo "selected=\"selected\""?>>4</option>
549 <option value="5" <?php if ($av['pdfirstday']=="5") echo "selected=\"selected\""?>>5</option>
550 <option value="6" <?php if ($av['pdfirstday']=="6") echo "selected=\"selected\""?>>6</option>
551 <option value="7" <?php if ($av['pdfirstday']=="7") echo "selected=\"selected\""?>>7</option>
552 <option value="8" <?php if ($av['pdfirstday']=="8") echo "selected=\"selected\""?>>8</option>
553 <option value="9" <?php if ($av['pdfirstday']=="9") echo "selected=\"selected\""?>>9</option>
554 </select></p>
555 <script type="text/javascript">pdfields_update();</script>
556
557 </div>
558 <!-- start of right column -->
559 <div style="padding-left: 2%; float: left; width: 49%;">
560 <b><?php echo __('Display Configuration',"wp-forecast_".$locale)?></b>
561 <table>
562 <tr>
563 <td>&nbsp;</td>
564 <td><?php echo __('Current Conditions',"wp-forecast_".$locale)?></td>
565 <td><?php echo __('Forecast Day',"wp-forecast_".$locale)?></td>
566 <td><?php echo __('Forecast Night',"wp-forecast_".$locale)?></td>
567 </tr>
568 <tr>
569 <td><?php echo __('Icon',"wp-forecast_".$locale)?></td>
570 <td align='center'><input type="checkbox" name="d_c_icon" value="1"
571 <?php if (substr($av['dispconfig'],0,1)=="1") echo "checked=\"checked\""?> /></td>
572 <td align='center'><input type="checkbox" name="d_d_icon" value="1"
573 <?php if (substr($av['dispconfig'],10,1)=="1") echo "checked=\"checked\""?> /></td>
574 <td align='center'><input type="checkbox" name="d_n_icon" value="1"
575 <?php if (substr($av['dispconfig'],14,1)=="1") echo "checked=\"checked\""?> /></td>
576 </tr>
577 <tr>
578 <td><?php echo __('Date',"wp-forecast_".$locale)?></td>
579 <td align='center'><input type="checkbox" name="d_c_date" value="1"
580 <?php if (substr($av['dispconfig'],18,1)=="1") echo "checked=\"checked\""?> /></td>
581 <td align='center'>&nbsp;</td>
582 <td align='center'>&nbsp;</td>
583 </tr>
584 <tr>
585 <td><?php echo __('Time',"wp-forecast_".$locale)?></td>
586 <td align='center'><input type="checkbox" name="d_c_time" value="1"
587 <?php if (substr($av['dispconfig'],1,1)=="1") echo "checked=\"checked\""?> /></td>
588 <td align='center'>&nbsp;</td>
589 <td align='center'>&nbsp;</td>
590 </tr>
591 <tr>
592 <td><?php echo __('Short Description',"wp-forecast_".$locale)?></td>
593 <td align='center'><input type="checkbox" name="d_c_short" value="1"
594 <?php if (substr($av['dispconfig'],2,1)=="1") echo "checked=\"checked\""?> /></td>
595 <td align='center'><input type="checkbox" name="d_d_short" value="1"
596 <?php if (substr($av['dispconfig'],11,1)=="1") echo "checked=\"checked\""?> /></td>
597 <td align='center'><input type="checkbox" name="d_n_short" value="1"
598 <?php if (substr($av['dispconfig'],15,1)=="1") echo "checked=\"checked\""?> /></td>
599 </tr>
600 <tr>
601 <td><?php echo __('Temperature',"wp-forecast_".$locale)?></td>
602 <td align='center'><input type="checkbox" name="d_c_temp" value="1"
603 <?php if (substr($av['dispconfig'],3,1)=="1") echo "checked=\"checked\""?> /></td>
604 <td align='center'><input type="checkbox" name="d_d_temp" value="1"
605 <?php if (substr($av['dispconfig'],12,1)=="1") echo "checked=\"checked\""?> /></td>
606 <td align='center'><input type="checkbox" name="d_n_temp" value="1"
607 <?php if (substr($av['dispconfig'],16,1)=="1") echo "checked=\"checked\""?> /></td>
608 </tr>
609 <tr>
610 <td><?php echo __('Realfeel',"wp-forecast_".$locale)?></td>
611 <td align='center'><input type="checkbox" name="d_c_real" value="1"
612 <?php if (substr($av['dispconfig'],4,1)=="1") echo "checked=\"checked\""?> /></td>
613 <td align='center'>&nbsp;</td>
614 <td align='center'>&nbsp;</td>
615 </tr>
616 <tr>
617 <td><?php echo __('Pressure',"wp-forecast_".$locale)?></td>
618 <td align='center'><input type="checkbox" name="d_c_press" value="1"
619 <?php if (substr($av['dispconfig'],5,1)=="1") echo "checked=\"checked\""?> /></td>
620 <td align='center'>&nbsp;</td>
621 <td align='center'>&nbsp;</td>
622 </tr>
623 <tr>
624 <td><?php echo __('Humidity',"wp-forecast_".$locale)?></td>
625 <td align='center'><input type="checkbox" name="d_c_humid" value="1"
626 <?php if (substr($av['dispconfig'],6,1)=="1") echo "checked=\"checked\""?> /></td>
627 <td align='center'>&nbsp;</td>
628 <td align='center'>&nbsp;</td>
629 </tr>
630 <tr>
631 <td><?php echo __('Wind',"wp-forecast_".$locale)?></td>
632 <td align='center'><input type="checkbox" name="d_c_wind" value="1"
633 <?php if (substr($av['dispconfig'],7,1)=="1") echo "checked=\"checked\""?> /></td>
634 <td align='center'><input type="checkbox" name="d_d_wind" value="1"
635 <?php if (substr($av['dispconfig'],13,1)=="1") echo "checked=\"checked\""?> /></td>
636 <td align='center'><input type="checkbox" name="d_n_wind" value="1"
637 <?php if (substr($av['dispconfig'],17,1)=="1") echo "checked=\"checked\""?> /></td>
638 </tr>
639 <tr>
640 <td><?php echo __('Windgusts',"wp-forecast_".$locale)?></td>
641 <td align='center'><input type="checkbox" name="d_c_wgusts" value="1"
642 <?php if (substr($av['dispconfig'],22,1)=="1") echo "checked=\"checked\""?> /></td>
643 <td align='center'><input type="checkbox" name="d_d_wgusts" value="1"
644 <?php if (substr($av['dispconfig'],23,1)=="1") echo "checked=\"checked\""?> /></td>
645 <td align='center'><input type="checkbox" name="d_n_wgusts" value="1"
646 <?php if (substr($av['dispconfig'],24,1)=="1") echo "checked=\"checked\""?> /></td>
647 </tr>
648 <tr>
649 <td><?php echo __('Sunrise',"wp-forecast_".$locale)?></td>
650 <td align='center'><input type="checkbox" name="d_c_sunrise" value="1"
651 <?php if (substr($av['dispconfig'],8,1)=="1") echo "checked=\"checked\""?> /></td>
652 <td align='center'>&nbsp;</td>
653 <td align='center'>&nbsp;</td>
654 </tr>
655 <tr>
656 <td><?php echo __('Sunset',"wp-forecast_".$locale)?></td>
657 <td align='center'><input type="checkbox" name="d_c_sunset" value="1"
658 <?php if (substr($av['dispconfig'],9,1)=="1") echo "checked=\"checked\""?> /></td>
659 <td align='center'>&nbsp;</td>
660 <td align='center'>&nbsp;</td>
661 </tr>
662 <tr>
663 <td><?php echo __('Copyright',"wp-forecast_".$locale)?></td>
664 <td align='center'><input type="checkbox" name="d_c_copyright" value="1"
665 <?php if (substr($av['dispconfig'],21,1)=="1") echo "checked=\"checked\""?> /></td>
666 <td align='center'>&nbsp;</td>
667 <td align='center'>&nbsp;</td>
668 </tr>
669 <tr>
670 <td><?php echo __('Link to Weatherprovider',"wp-forecast_".$locale)?></td>
671 <td align='center'><input type="checkbox" name="d_c_accuweather" value="1"
672 <?php if (substr($av['dispconfig'],25,1)=="1") echo "checked=\"checked\""?> /></td>
673 <td align='center'>&nbsp;</td>
674 <td align='center'>&nbsp;</td>
675 </tr>
676 </table>
677 <br />
678
679 <b><?php echo __('Forecast',"wp-forecast_".$locale)?></b>
680
681 <table>
682 <tr>
683 <td>&nbsp;</td>
684 <td><?php echo __('All',"wp-forecast_".$locale)?></td>
685 <td><?php echo __('Day',"wp-forecast_".$locale)?> 1</td>
686 <td><?php echo __('Day',"wp-forecast_".$locale)?> 2</td>
687 <td><?php echo __('Day',"wp-forecast_".$locale)?> 3</td>
688 <td><?php echo __('Day',"wp-forecast_".$locale)?> 4</td>
689 <td><?php echo __('Day',"wp-forecast_".$locale)?> 5</td>
690 <td><?php echo __('Day',"wp-forecast_".$locale)?> 6</td>
691 <td><?php echo __('Day',"wp-forecast_".$locale)?> 7</td>
692 <td><?php echo __('Day',"wp-forecast_".$locale)?> 8</td>
693 <td><?php echo __('Day',"wp-forecast_".$locale)?> 9</td>
694 </tr>
695 <tr><td><?php echo __('Daytime',"wp-forecast_".$locale)?></td>
696 <td><input type="checkbox" name="alldays" onClick="this.value=check('day')" /></td>
697 <td><input type="checkbox" name="day1" value="1"
698 <?php if (substr($av['daytime'],0,1)=="1") echo "checked=\"checked\""?> /></td>
699 <td><input type="checkbox" name="day2" value="1"
700 <?php if (substr($av['daytime'],1,1)=="1") echo "checked=\"checked\""?> /></td>
701 <td><input type="checkbox" name="day3" value="1"
702 <?php if (substr($av['daytime'],2,1)=="1") echo "checked=\"checked\""?> /></td>
703 <td><input type="checkbox" name="day4" value="1"
704 <?php if (substr($av['daytime'],3,1)=="1") echo "checked=\"checked\""?> /></td>
705 <td><input type="checkbox" name="day5" value="1"
706 <?php if (substr($av['daytime'],4,1)=="1") echo "checked=\"checked\""?> /></td>
707 <td><input type="checkbox" name="day6" value="1"
708 <?php if (substr($av['daytime'],5,1)=="1") echo "checked=\"checked\""?> /></td>
709 <td><input type="checkbox" name="day7" value="1"
710 <?php if (substr($av['daytime'],6,1)=="1") echo "checked=\"checked\""?> /></td>
711 <td><input type="checkbox" name="day8" value="1"
712 <?php if (substr($av['daytime'],7,1)=="1") echo "checked=\"checked\""?> /></td>
713 <td><input type="checkbox" name="day9" value="1"
714 <?php if (substr($av['daytime'],8,1)=="1") echo "checked=\"checked\""?> /></td>
715 </tr>
716 <tr><td><?php echo __('Nighttime',"wp-forecast_".$locale)?></td>
717 <td><input type="checkbox" name="allnight" onClick="this.value=check('night')" /></td>
718 <td><input type="checkbox" name="night1" value="1"
719 <?php if (substr($av['nighttime'],0,1)=="1") echo "checked=\"checked\""?> /></td>
720 <td><input type="checkbox" name="night2" value="1"
721 <?php if (substr($av['nighttime'],1,1)=="1") echo "checked=\"checked\""?> /></td>
722 <td><input type="checkbox" name="night3" value="1"
723 <?php if (substr($av['nighttime'],2,1)=="1") echo "checked=\"checked\""?> /></td>
724 <td><input type="checkbox" name="night4" value="1"
725 <?php if (substr($av['nighttime'],3,1)=="1") echo "checked=\"checked\""?> /></td>
726 <td><input type="checkbox" name="night5" value="1"
727 <?php if (substr($av['nighttime'],4,1)=="1") echo "checked=\"checked\""?> /></td>
728 <td><input type="checkbox" name="night6" value="1"
729 <?php if (substr($av['nighttime'],5,1)=="1") echo "checked=\"checked\""?> /></td>
730 <td><input type="checkbox" name="night7" value="1"
731 <?php if (substr($av['nighttime'],6,1)=="1") echo "checked=\"checked\""?> /></td>
732 <td><input type="checkbox" name="night8" value="1"
733 <?php if (substr($av['nighttime'],7,1)=="1") echo "checked=\"checked\""?> /></td>
734 <td><input type="checkbox" name="night9" value="1"
735 <?php if (substr($av['nighttime'],8,1)=="1") echo "checked=\"checked\""?> /></td>
736 </tr>
737 </table>
738 </div>
739 <!-- finally update field attributes -->
740 <script type="text/javascript">
741 apifields(document.woptions.service.value);
742 </script>
743 <?php if ($widgetcall==0): ?></fieldset><?php endif; ?>
744 <?php
745 if ($widgetcall ==0)
746 echo "<div class='submit'><input class='button-primary' type='submit' name='info_update' value='".__('Update options',"wp-forecast_".$locale)." »' /></div>";
747 else
748 echo "<input type='hidden' name='info_update' value='1' />";
749
750 // suchformular fuer locations
751 if ($widgetcall==0)
752 {
753 echo "<hr /><fieldset id=\"set2\"><legend>".__('Search location',"wp-forecast_".$locale)."</legend><br />";
754
755 if (count($loc)<=0 )
756 {
757 echo "<p><b>".__('Searchterm',"wp-forecast_".$locale).":</b>\n";
758 echo "<input name=\"searchloc\" type=\"text\" size=\"30\" maxlength=\"30\" /><br /></p>\n";
759 if (isset($_POST['search_loc']))
760 {
761 echo "<p>".__('No locations found.',"wp-forecast_".$locale)."</p>";
762 }
763 else
764 {
765 echo "<p>".__('Please replace german Umlaute ä,ö,ü with a, o, u in your searchterm.',"wp-forecast_".$locale)."</p>";
766 }
767 echo "</fieldset>\n";
768 echo "<div class='submit'>\n";
769 echo "<input class='button-primary' type='submit' name='search_loc' value='" ;
770 echo __('Search location',"wp-forecast_".$locale);
771 echo " »' />\n";
772 }
773 else
774 {
775 echo "<b>".__('Search result',"wp-forecast_".$locale).": </b><select name=\"newloc\" size=\"1\">\n";
776 foreach ($loc as $l)
777 {
778 echo "<option value=\"".$l['location']."\">";
779 echo $l['city']."/".$l['state'];
780 echo "</option>\n";
781 }
782 echo "</select><br /><p>".__('Please select your city and press set location.',"wp-forecast_".$locale)."</p>\n";
783 echo "</fieldset>\n";
784 echo "<div class='submit'>\n";
785 echo "<input class='button-primary' type='submit' name='set_loc' value='" ;
786 echo __('Set location',"wp-forecast_".$locale);
787 echo " »' />\n";
788 }
789 echo "</div></form></div>";
790 }
791
792 pdebug(1,"End of wpf_sub_admin_form ()");
793 }
794 ?>
795