Skip to content
Permalink
Browse files

avoid garmin.php redirect; fixes #844

  • Loading branch information...
following5 committed Sep 13, 2015
1 parent 2b85dff commit a04d9f119957362035841e94013f31fb137a5c1f
@@ -108,7 +108,7 @@
$opt['lib']['garmin']['key'] = '00112233445566778899AABBCCDDEEFF00';
$opt['lib']['garmin']['domain'] = 'local.opencaching.de';
$opt['lib']['garmin']['url'] = 'http://local.opencaching.de/';
$opt['lib']['garmin']['redirect'] = $opt['lib']['garmin']['url'] . 'garmin.php?redirect=1&cacheid={cacheid}';
$opt['lib']['garmin']['page_url'] = $opt['lib']['garmin']['url'] . $dev_codepath . 'htdocs/';
// developer.what3words.com API Key
$opt['lib']['w3w']['apikey'] = 'YOURAPIKEY';
@@ -194,7 +194,7 @@
$opt['lib']['garmin']['domain'] = '<domain>';
$opt['lib']['garmin']['key'] = '00112233445566778899AABBCCDDEEFF00';
$opt['lib']['garmin']['url'] = 'http://' . $opt['lib']['garmin']['domain'] . '/';
$opt['lib']['garmin']['redirect'] = 'http://<domain>/garmin.php?redirect=1&cacheid={cacheid}';
$opt['lib']['garmin']['page_url'] = 'http://<domain>/';
// developer.what3words.com API Key
$opt['lib']['w3w']['apikey'] = 'YOURAPIKEY';
@@ -23,11 +23,16 @@
else if (isset($_REQUEST['wp']))
$cacheid = cache::cacheIdFromWP($_REQUEST['wp']);
// important: when the domain does not fit the api key, you must be redirected to the correct domain
// When the domain does not fit the api key, you must be redirected to the correct domain.
// As this not all browses reliably redirect popup window locations, the settings meanwhile
// allow to directly link to the registered domain, so the following code should no longer
// be needed.
if (($opt['lib']['garmin']['domain'] != $_SERVER['HTTP_HOST']) && !isset($_REQUEST['redirect']))
{
$redirect = $opt['lib']['garmin']['redirect'];
$redirect = str_replace('{cacheid}', $cacheid, $redirect);
$redirect = $opt['lib']['garmin']['page_url'] . 'garmin.php?redirect=1&cacheid=' . $cacheid;
if (isset($_REQUEST['templocale']))
$redirect .= '&templocale=' . $_REQUEST['templocale'];
$tpl->redirect($redirect);
exit;
}
@@ -220,8 +220,14 @@ function set_language()
{
global $opt, $cookie;
$savelocale = true;
if (isset($_REQUEST['locale']))
$opt['template']['locale'] = strtoupper($_REQUEST['locale']);
elseif (isset($_REQUEST['templocale']))
{
$opt['template']['locale'] = strtoupper($_REQUEST['templocale']);
$savelocale = false;
}
else
$opt['template']['locale'] = strtoupper($cookie->get('locale', $opt['template']['default']['locale']));
@@ -237,7 +243,8 @@ function set_language()
else
$opt['template']['locale'] = $opt['template']['default']['locale'];
$cookie->set('locale', $opt['template']['locale'], $opt['template']['default']['locale']);
if ($savelocale)
$cookie->set('locale', $opt['template']['locale'], $opt['template']['default']['locale']);
bindtextdomain('messages', $opt['rootpath'] . 'cache2/translate');
set_php_locale();
@@ -283,7 +283,7 @@
<option value="search.php?searchto=searchbycacheid&showresult=1&f_inactive=0&f_ignored=0&startat=0&cacheid={$cache.cacheid}&output=txt">TXT</option>
</select>&nbsp;
<img src="resource2/{$opt.template.style}/images/viewcache/14x19-gps-device.png" class="icon16" alt="" />
<input type="button" class="exportbutton" value="{t}Send to GPS device{/t}" onclick="window.open('garmin.php?lat={$cache.latitude}&lon={$cache.longitude}&wp={$cache.wpoc}','{t escape=js}Send{/t}','width=640,height=320,resizable=no,scrollbars=1')" />
<input type="button" class="exportbutton" value="{t}Send to GPS device{/t}" onclick="window.open('{$garmin_url}garmin.php?lat={$cache.latitude}&lon={$cache.longitude}&wp={$cache.wpoc}&templocale={$opt.template.locale}','{t escape=js}Send{/t}','width=640,height=320,resizable=no,scrollbars=1')" />
</p></td>
</tr>
</table>
@@ -508,7 +508,7 @@ function showalllists()
<a href="search.php?searchto=searchbydistance&showresult=1&expert=0&output=HTML&sort=bydistance&f_userowner=1&f_userfound=1&f_inactive=1&lat={$cache.latitude}&lon={$cache.longitude}&distance=150&unit=km&cachetype={$cache.type}" rel="nofollow">{t}same type{/t}</a>
<br />
<img src="resource2/{$opt.template.style}/images/viewcache/16x16-search.png" class="icon16" alt="" /> {t}Send this waypoint to GPS device:{/t} <a href="#" onclick="window.open('garmin.php?&lat={$cache.latitude}&lon={$cache.longitude}&wp={$cache.wpoc}','{t escape=js}Send{/t}','width=640,height=290,resizable=no,scrollbars=1')">Garmin</a><br />
<img src="resource2/{$opt.template.style}/images/viewcache/16x16-search.png" class="icon16" alt="" /> {t}Send this waypoint to GPS device:{/t} <a href="#" onclick="window.open('{$garmin_url}garmin.php?&lat={$cache.latitude}&lon={$cache.longitude}&wp={$cache.wpoc}&templocale={$opt.template.locale}','{t escape=js}Send{/t}','width=640,height=320,resizable=no,scrollbars=1')">Garmin</a><br />
<img src="resource2/{$opt.template.style}/images/viewcache/16x16-save.png" class="icon16" alt="" /> {t}Download as file:{/t}
<a href="search.php?searchto=searchbycacheid&showresult=1&f_inactive=0&f_ignored=0&startat=0&cacheid={$cache.cacheid}&output=gpx" rel="nofollow" title="{t}GPS Exchange Format .gpx{/t}">GPX</a> -
<a href="search.php?searchto=searchbycacheid&showresult=1&f_inactive=0&f_ignored=0&startat=0&cacheid={$cache.cacheid}&output=loc" rel="nofollow" title="{t}Waypointfile .loc{/t}">LOC</a> -
@@ -363,6 +363,7 @@ function getChildWaypoints($cacheid)
$tpl->assign('shortlink_domain', $opt['logic']['shortlink_domain']);
$tpl->assign('listing_admin', $login->listingAdmin());
$tpl->assign('npahelplink', helppagelink('npa'));
$tpl->assign('garmin_url', $opt['lib']['garmin']['page_url']);
// display the page
$tpl->display();

0 comments on commit a04d9f1

Please sign in to comment.
You can’t perform that action at this time.