3 include("plotconf.inc");
6 if (isset($HTTP_GET_VARS["lastquery"])){
7 $HTTP_GET_VARS["lastquery"] = clean_param($HTTP_GET_VARS["lastquery"], PARAM_HOST
);
13 if(shouldrun($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
19 if(isset($HTTP_POST_VARS["button"])) {
22 $HTTP_POST_VARS["shape"] = clean_param($HTTP_POST_VARS["shape"], PARAM_ALPHA
);
23 $HTTP_POST_VARS["color"] = clean_param($HTTP_POST_VARS["color"], PARAM_ALPHA
);
24 $HTTP_POST_VARS["color"] = clean_param($HTTP_POST_VARS["size"], PARAM_INT
);
25 $HTTP_POST_VARS["earthimage"] = clean_param($HTTP_POST_VARS["earthimage"], PARAM_FILE
);
26 $HTTP_POST_VARS["cssdot"] = clean_param($HTTP_POST_VARS["cssdot"], PARAM_FILE
);
27 $HTTP_POST_VARS["seldrawmode"] = clean_param($HTTP_POST_VARS["seldrawmode"],PARAM_ALPHA
);
28 // unset the earth image if we don't have it in our list
29 if (!in_array($HTTP_POST_VARS["earthimage"],$earthimages)) {
30 unset($HTTP_POST_VARS["earthimage"]);
34 // save data from the POST
35 setcookie ("atlasprefs", "", time() - 36000000);
36 setcookie ("atlasprefs", "$HTTP_POST_VARS[shape]:$HTTP_POST_VARS[color]:$HTTP_POST_VARS[size]:$HTTP_POST_VARS[earthimage]:$HTTP_POST_VARS[cssdot]:$HTTP_POST_VARS[seldrawmode]", time() +
36000000, $cookiepath);
38 $setshape = $HTTP_POST_VARS["shape"];
39 $setcolor = $HTTP_POST_VARS["color"];
40 $setsize = $HTTP_POST_VARS["size"];
41 $setearthimage = $HTTP_POST_VARS["earthimage"];
42 $setcssdot = $HTTP_POST_VARS["cssdot"];
43 $setseldrawmode = $HTTP_POST_VARS["seldrawmode"];
47 if($setseldrawmode == "1") {
53 } elseif(isset($HTTP_COOKIE_VARS["atlasprefs"]) && validcookie($HTTP_COOKIE_VARS["atlasprefs"])) {
54 // get data from the cookie
55 @list
($setshape, $setcolor, $setsize, $setearthimage, $setcssdot, $setseldrawmode) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
57 $setshape = "Diamond";
60 $setearthimage = $earthimages[$defaultimage];
61 $setcssdot = "reddot.gif";
63 if(shouldrun($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
69 // override old cookie if there is post data
71 if(isset($HTTP_POST_VARS["seldrawmode"])) {
72 $setsetdrawmode = $HTTP_POST_VARS["seldrawmode"];
82 <html
><head
><title
><?php
echo t("IP-Atlas Preferences") ?
></title
>
84 <!-- your head tags here
-->
85 <link rel
="Stylesheet" href
="ip-atlas.css">
86 </head
><body bgcolor
="#ffffff">
90 <b
><?php
echo t("IP-Atlas preferences"); ?
></b
> <?php
echo t("(cookie based)"); ?
><br
/><br
/>
93 if(isset($HTTP_POST_VARS["button"])) {
94 print t("Your settings have been saved. You can now try"); ?
> <a href
="plot.php<?php if(isset($HTTP_GET_VARS["lastquery
"])) { echo "?address
=$HTTP_GET_VARS[lastquery
]"; } ?>"><?php
print t("plotting something.")."</a>"."<br /><br />";
100 <form action
="ip-atlas_prefs.php<?php if(isset($HTTP_GET_VARS["lastquery
"])) { echo "?lastquery
=$HTTP_GET_VARS[lastquery
]"; } ?>" method
="POST">
102 <?php
if(istheregd()) {
103 echo t("Draw mode (defaults guessed for your browser):");
105 print "<br /><select name=\"seldrawmode\">";
107 if(!isset($setseldrawmode)) {
108 if(shouldrun($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
115 if($setseldrawmode == "1") {
116 echo "<option value=\"1\" selected>GD";
117 echo "<option value=\"0\">CSS";
118 } elseif($setseldrawmode == "0") {
119 echo "<option value=\"1\">GD";
120 echo "<option value=\"0\" selected>CSS";
123 print "</select><br /><br />";
127 print "<input type=\"hidden\" name=\"seldrawmode\" value=\"0\" />";
133 <?php
echo t("Pointer Preferences (the dot that marks lat/lon):"); ?
><br
/>
135 if($drawmode == "GD") {
137 <input type="hidden" name="cssdot" value="reddot.gif" />
141 <td>'.t("Shape:").'</td><td><select name="shape">
144 $shapes = array("Diamond", "Diamond Outline", "Square", "Square Outline", "Cross");
145 foreach($shapes as $curshape) {
147 if($setshape == $curshape) {
148 print "<option value=\"$curshape\" selected>".t($curshape);
150 print "<option value=\"$curshape\">".t($curshape);
155 print "</select></td></tr><tr><td>".t("Size:")."</td><td><select name=\"size\">";
157 $sizes = array("2", "3", "4", "5", "6", "7", "8");
158 foreach($sizes as $cursize) {
160 if($setsize == $cursize) {
161 print "<option value=\"$cursize\" selected>$cursize";
163 print "<option value=\"$cursize\">$cursize";
168 print "</select></td></tr><tr><td>".t("Color:")."</td><td><select name=\"color\">";
170 $colors = array("red", "white", "yellow", "magenta", "cyan", "green", "violet");
171 foreach($colors as $curcolor) {
173 if($setcolor == $curcolor) {
174 print "<option value=\"$curcolor\" selected>".t($curcolor);
176 print "<option value=\"$curcolor\">".t($curcolor);
182 </select></td></tr></table>
185 } elseif($drawmode == "CSS") {
187 print t("Pointer:")." <select name=\"cssdot\">";
189 foreach($cssdots as $curdot) {
191 list($filename, $curdot, , ) = split(":", $curdot);
193 if($setcssdot == $filename) {
194 print "<option value=\"$filename\" selected>$curdot";
196 print "<option value=\"$filename\">$curdot";
201 print "</select><br />";
204 <input type="hidden" name="shape" value="Diamond" />
205 <input type="hidden" name="color" value="Red" />
206 <input type="hidden" name="size" value="3" />
217 <?php
echo t("Other Preferences:") ?
><br
/>
218 <?php
echo t("Earth Image:") ?
> 
;
219 <select name
="earthimage">
223 foreach($earthimages as $curentry) {
225 list($curfile, $curname, , ) = split(":", $curentry);
227 if($setearthimage == $curfile) {
228 print "<option value=\"$curfile\" selected>$curname";
230 print "<option value=\"$curfile\">$curname";
240 <input type
="Submit" name
="button" value
="<?php echo t("Save
") ?>">
243 [ <a href
="plot.php<?php if(isset($HTTP_GET_VARS["lastquery
"])) { echo "?address
=$HTTP_GET_VARS[lastquery
]"; } ?>"><?php
echo t("main") ?
></a
> ]<br
/><br
/>
245 <?php
include("footer.inc"); ?
>