Merge remote-tracking branch 'bohrsty/246_404-fixes' into stable

This commit is contained in:
following
2013-07-31 13:32:32 +02:00
6 changed files with 154 additions and 49 deletions
+80 -23
View File
@@ -18,34 +18,91 @@
$tpl->caching = false;
$tpl->cache_lifetime = 300;
$tpl->cache_id = $sUserCountry;
// rootpath
$tpl->assign('rootpath',$opt['rootpath']);
// website
// check length
$uril = 70;
$uri = 'http://'.strtolower($_SERVER['SERVER_NAME']).$_SERVER['REQUEST_URI'];
// limit to $uril
if(strlen($uri) > $uril) {
$uri = substr($uri,0,$uril-3).'...';
// simplify variables if exists
$redirectUrl = '';
$isRedirect404 = false;
if (isset($_SERVER['REDIRECT_URL']))
{
$redirectUrl = $_SERVER['REDIRECT_URL'];
$isRedirect404 = true;
}
// $tpl->assign('website',$uri);
$tpl->assign('website','');
// get newest blog entries
$tpl->assign('blog', $getNew->feedForSmarty('blog',3));
// get newest forum posts
$tpl->assign('forum',$getNew->feedForSmarty('forum',3));
// get newest wiki
$tpl->assign('wiki', $getNew->feedForSmarty('wiki',3));
// assign redirection status
$tpl->assign('isRedirect404', $isRedirect404);
// check if original path starts with "/" and remove it
if (substr($redirectUrl, 0, 1) == '/')
$redirectUrl = substr($redirectUrl, 1);
// get number of subdirectories (-1 because the last part of url is treated as file)
$numDirs = count(explode('/', $redirectUrl)) - 1 -2;
// put ../ together according to $numDirs
$prePath = '';
for ($i=0; $i<$numDirs; $i++)
{
$prePath .= '../';
}
// assign path
$tpl->assign('actualpath',$prePath);
// website, if is 404 redirection
if ($isRedirect404)
{
// check length
$uril = 70;
$uri = 'http://'.strtolower($_SERVER['SERVER_NAME']).$_SERVER['REQUEST_URI'];
// limit to $uril
if(strlen($uri) > $uril) {
$uri = substr($uri,0,$uril-3).'...';
}
// assign uri
$tpl->assign('website',$uri);
}
else
$tpl->assign('website','');
// set feeds and options
$feeds = array('blog', 'forum', 'wiki');
$options = $feeds;
array_push($options, 'newcaches');
// simplify $opt
foreach ($options as $option)
{
$opt404[$option] = (isset($opt['page']['404'][$_SERVER['SERVER_NAME']][$option]) ? $opt['page']['404'][$_SERVER['SERVER_NAME']][$option] : $opt['page']['404']['www.opencaching.de'][$option]);
}
// get feeds from $feeds array
foreach ($feeds as $feed)
{
if ($isRedirect404)
{
if ($opt404[$feed]['show'])
$tpl->assign($feed, $getNew->feedForSmarty($feed,3,$opt404[$feed]['feedurl']));
}
else
$tpl->assign($feed, $getNew->feedForSmarty($feed,3));
}
// get newest caches
$tpl->assign_rs('newcaches', $getNew->rsForSmarty('cache',array($sUserCountry, $opt['template']['locale'],3)));
if ($isRedirect404)
{
if ($opt404['newcaches']['show'])
$tpl->assign_rs('newcaches', $getNew->rsForSmarty('cache',array($sUserCountry, $opt['template']['locale'],3)));
}
else
$tpl->assign_rs('newcaches', $getNew->rsForSmarty('cache',array($sUserCountry, $opt['template']['locale'],3)));
// assign $opt404
$tpl->assign('opt404', $opt404);
// assign contact
$tpl->assign('contact', $opt['mail']['contact']);
// show page
$tpl->display();
?>
+31
View File
@@ -230,6 +230,37 @@
// require SSL for SOAP access
$opt['page']['nusoap_require_https'] = false;
/*
* configure infos on 404.php
*/
$opt['page']['404']['www.opencaching.de'] = array(
'blog' => array(
'show' => false,
'feedurl' => '',
'url' => '',
'urlname' => '',
),
'forum' => array(
'show' => false,
'feedurl' => '',
'url' => '',
'urlname' => '',
),
'wiki' => array(
'show' => false,
'feedurl' => '',
'url' => '',
'urlname' => '',
),
'newcaches' => array(
'show' => true,
'url' => 'http://www.opencaching.de',
'urlname' => 'www.opencaching.de',
),
);
/* multi-domain settings
*
+13 -10
View File
@@ -3,29 +3,32 @@
*
* Unicode Reminder メモ
***************************************************************************}
{* check if actualpath is set *}
{if !isset($actualpath)}{assign var='actualpath' value=''}{/if}
{strip} {* OCSTYLE *}
{*cachetype=1 status=1 logtype=0 owner=false small=false*}
{if $cachetype==1}
<img src="resource2/{$opt.template.style}/images/cacheicon/unknown.gif" alt="{t}Unknown Geocache{/t}" title="{t}Unknown Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/cacheicon/unknown.gif" alt="{t}Unknown Geocache{/t}" title="{t}Unknown Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
{elseif $cachetype==2}
<img src="resource2/{$opt.template.style}/images/cacheicon/traditional.gif" alt="{t}Traditional Geocache{/t}" title="{t}Traditional Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/cacheicon/traditional.gif" alt="{t}Traditional Geocache{/t}" title="{t}Traditional Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
{elseif $cachetype==3}
<img src="resource2/{$opt.template.style}/images/cacheicon/multi.gif" alt="{t}Multicache{/t}" title="{t}Multicache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/cacheicon/multi.gif" alt="{t}Multicache{/t}" title="{t}Multicache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
{elseif $cachetype==4}
<img src="resource2/{$opt.template.style}/images/cacheicon/virtual.gif" alt="{t}Virtual Geocache{/t}" title="{t}Virtual Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/cacheicon/virtual.gif" alt="{t}Virtual Geocache{/t}" title="{t}Virtual Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
{elseif $cachetype==5}
<img src="resource2/{$opt.template.style}/images/cacheicon/webcam.gif" alt="{t}Webcam Geocache{/t}" title="{t}Webcam Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/cacheicon/webcam.gif" alt="{t}Webcam Geocache{/t}" title="{t}Webcam Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
{elseif $cachetype==6}
<img src="resource2/{$opt.template.style}/images/cacheicon/event.gif" alt="{t}Event Geocache{/t}" title="{t}Event Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/cacheicon/event.gif" alt="{t}Event Geocache{/t}" title="{t}Event Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
{elseif $cachetype==7}
<img src="resource2/{$opt.template.style}/images/cacheicon/mystery.gif" alt="{t}Quizcache{/t}" title="{t}Quizcache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/cacheicon/mystery.gif" alt="{t}Quizcache{/t}" title="{t}Quizcache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
{elseif $cachetype==8}
<img src="resource2/{$opt.template.style}/images/cacheicon/mathe.gif" alt="{t}Math/Physics Geocache{/t}" title="{t}Math/Physics Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/cacheicon/mathe.gif" alt="{t}Math/Physics Geocache{/t}" title="{t}Math/Physics Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
{elseif $cachetype==9}
<img src="resource2/{$opt.template.style}/images/cacheicon/moving.gif" alt="{t}Moving Geocache{/t}" title="{t}Moving Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/cacheicon/moving.gif" alt="{t}Moving Geocache{/t}" title="{t}Moving Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
{elseif $cachetype==10}
<img src="resource2/{$opt.template.style}/images/cacheicon/drivein.gif" alt="{t}Drive-In Geocache{/t}" title="{t}Drive-In Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/cacheicon/drivein.gif" alt="{t}Drive-In Geocache{/t}" title="{t}Drive-In Geocache{/t}" border="0" width="22" height="22" align="left" style="margin-right: 5px;" />
{else}
&nbsp;
{/if}
+5 -2
View File
@@ -3,6 +3,9 @@
*
* Unicode Reminder メモ
***************************************************************************}
{* check if actualpath is set *}
{if !isset($actualpath)}{assign var='actualpath' value=''}{/if}
{if $minimap_enabled}
<div>
<img class="img-minimap" style="margin:16px 20px 16px 16px; width: 220px; height: 220px; float: right;" src="{$minimap_url}{foreach name=newcaches from=$newcaches item=cacheitem}|{$cacheitem.latitude},{$cacheitem.longitude}{/foreach}">
@@ -11,9 +14,9 @@
{foreach name=newcaches from=$newcaches item=cacheitem}
<li class="newcache_list_multi" style="margin-bottom: 8px;">
<table class="null" cellspacing="0" cellpadding="0"><tr>
<td style="vertical-align:top; padding-right:2px; padding-top:2px" rowspan="2">{include file="res_cacheicon_22.tpl" cachetype=$cacheitem.type}</td>
<td style="vertical-align:top; padding-right:2px; padding-top:2px" rowspan="2">{include file="res_cacheicon_22.tpl" cachetype=$cacheitem.type actualpath=$actualpath}</td>
<td style="vertical-align:top; ">{$cacheitem.date_created|date_format:$opt.format.date}&nbsp;&nbsp;</td>
<td style="text-align:left; width:100%"><b><a class="links" href="viewcache.php?cacheid={$cacheitem.cache_id}">{$cacheitem.name|escape}</a></b> {include file="res_oconly.tpl" oconly=$cacheitem.oconly}
<td style="text-align:left; width:100%"><b><a class="links" href="viewcache.php?cacheid={$cacheitem.cache_id}">{$cacheitem.name|escape}</a></b> {include file="res_oconly.tpl" oconly=$cacheitem.oconly actualpath=$actualpath}
{t}by{/t}
<b><a class="links" href="viewprofile.php?userid={$cacheitem.user_id}">{$cacheitem.username|escape}</a></b></td>
</tr>
+4 -1
View File
@@ -3,6 +3,9 @@
*
* Unicode Reminder メモ
***************************************************************************}
{* check if actualpath is set *}
{if !isset($actualpath)}{assign var='actualpath' value=''}{/if}
{if $oconly}
{if $opt.help.oconly != ''}{$opt.help.oconly}{/if}{if $size=='15x21'}<img src="resource2/ocstyle/images/misc/15x21-oc.png" width="15" height="21" >{else}<img src="resource2/ocstyle/images/misc/15x15-oc.png" width="15" height="15" >{/if}{if $opt.help.oconly != ''}</a>{/if}
{if $opt.help.oconly != ''}{$opt.help.oconly}{/if}{if $size=='15x21'}<img src="{$actualpath}resource2/ocstyle/images/misc/15x21-oc.png" width="15" height="21" >{else}<img src="{$actualpath}resource2/ocstyle/images/misc/15x15-oc.png" width="15" height="15" >{/if}{if $opt.help.oconly != ''}</a>{/if}
{/if}
+21 -13
View File
@@ -27,63 +27,71 @@
<meta http-equiv="gallerimg" content="no" />
<meta http-equiv="cache-control" content="no-cache" />
<link rel="SHORTCUT ICON" href="favicon.ico">
<link rel="apple-touch-icon" href="resource2/{$opt.template.style}/images/oclogo/apple-touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="resource2/{$opt.template.style}/images/oclogo/apple-touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="resource2/{$opt.template.style}/images/oclogo/apple-touch-icon-iphone-retina.png" />
<link rel="apple-touch-icon" sizes="144x144" href="resource2/{$opt.template.style}/images/oclogo/apple-touch-icon-ipad-retina.png" />
<link rel="stylesheet" type="text/css" href="resource2/{$opt.template.style}/css/style_screen.css" />
<link rel="stylesheet" type="text/css" href="resource2/{$opt.template.style}/css/style_oc404.css" />
<link rel="apple-touch-icon" href="{$actualpath}resource2/{$opt.template.style}/images/oclogo/apple-touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="{$actualpath}resource2/{$opt.template.style}/images/oclogo/apple-touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="{$actualpath}resource2/{$opt.template.style}/images/oclogo/apple-touch-icon-iphone-retina.png" />
<link rel="apple-touch-icon" sizes="144x144" href="{$actualpath}resource2/{$opt.template.style}/images/oclogo/apple-touch-icon-ipad-retina.png" />
<link rel="stylesheet" type="text/css" href="{$actualpath}resource2/{$opt.template.style}/css/style_screen.css" />
<link rel="stylesheet" type="text/css" href="{$actualpath}resource2/{$opt.template.style}/css/style_oc404.css" />
</head>
<body>
<div id="frame">
<div class="header">
<div class="headerimage">
<img src="resource2/{$opt.template.style}/images/head/rotator.php?path={$opt.page.headimagepath}" class="headerimagecontent" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/head/rotator.php?path={$opt.page.headimagepath}" class="headerimagecontent" />
</div>
<div class="headerlogo">
<img src="resource2/{$opt.template.style}/images/oclogo/oc_head_alpha3.png" class="headerimagecontent" />
<img src="{$actualpath}resource2/{$opt.template.style}/images/oclogo/oc_head_alpha3.png" class="headerimagecontent" />
</div>
</div>
<div id="head">
<p>
<img id="oc404" src="resource2/{$opt.template.style}/images/oc_404.png" title="opencaching.de 404" alt="opencaching.de 404" />
<img id="oc404" src="{$actualpath}resource2/{$opt.template.style}/images/oc_404.png" title="opencaching.de 404" alt="opencaching.de 404" />
<span class="dnf">- {t}Page not found{/t} - DNF</span>
</p>
</div>
<div id="content">
<p class="text">{t 1=$website|escape}The visited website <b>%1</b> does not exists, we found the following suitable pages:{/t}</p>
{if $isRedirect404 === false || $opt404.newcaches.show === true}
<div class="sresult">
<p class="content-title-noshade-size2"><a class="links" href="http://www.opencaching.de" title="{t}Cache database{/t}">www.opencaching.de</a>&nbsp;{t}Here you can find a lot of individual caches.{/t}</p>
<p class="content-title-noshade-size2"><a class="links" href="{$opt404.newcaches.url|escape}" title="{t}Cache database{/t}">{$opt404.newcaches.urlname}</a>&nbsp;{t}Here you can find a lot of individual caches.{/t}</p>
<div>
<p>{t}The newest caches:{/t}</p>
{* newest cache template *}
{include file="res_newcaches.tpl" newcaches=$newcaches}
</div>
</div>
{/if}
{if $isRedirect404 === false || $opt404.forum.show === true}
<div class="sresult">
<p class="content-title-noshade-size2"><a class="links" href="http://forum.opencaching-network.org" title="Opencaching Forum">forum.opencaching-network.org</a>&nbsp;{t}Here you can discuss, improve or ask questions.{/t}</p>
<p class="content-title-noshade-size2"><a class="links" href="{$opt404.forum.url|escape}" title="Opencaching Forum">{$opt404.forum.urlname}</a>&nbsp;{t}Here you can discuss, improve or ask questions.{/t}</p>
<div>
<p>{t}The newest forumposts:{/t}</p>
{* newest forum-entries template (RSSParser) *}
{include file="res_rssparser.tpl" rss=$forum}
</div>
</div>
{/if}
{if $isRedirect404 === false || $opt404.blog.show === true}
<div class="sresult">
<p class="content-title-noshade-size2"><a class="links" href="http://blog.opencaching.de" title="Opencaching Blog">blog.opencaching.de</a>&nbsp;{t}Any time there are news to post, you'll find them here.{/t}</p>
<p class="content-title-noshade-size2"><a class="links" href="{$opt404.blog.url|escape}" title="Opencaching Blog">{$opt404.blog.urlname}</a>&nbsp;{t}Any time there are news to post, you'll find them here.{/t}</p>
<div>
<p>{t}The newest blogposts:{/t}</p>
{* newest blogpost template (RSSParser) *}
{include file="res_rssparser.tpl" rss=$blog}
</div>
</div>
{/if}
{if $isRedirect404 === false || $opt404.wiki.show === true}
<div class="sresult">
<p class="content-title-noshade-size2"><a class="links" href="http://wiki.opencaching.de" title="Opencaching Wiki">wiki.opencaching.de</a>&nbsp;{t}Here you get tutorials, howtos and any information about Geocaching and Opencaching.{/t}</p>
<p class="content-title-noshade-size2"><a class="links" href="{$opt404.wiki.url|escape}" title="Opencaching Wiki">{$opt404.wiki.urlname}</a>&nbsp;{t}Here you get tutorials, howtos and any information about Geocaching and Opencaching.{/t}</p>
<div>
<p>{t}The newest wiki articles:{/t}</p>
{* newest wiki article template (RSSParser) *}
{include file="res_rssparser.tpl" rss=$wiki}
</div>
</div>
{/if}
</div>
<div id="foot">
<p class="text">{t}Not found? Contact us using{/t} <a class="links" href="mailto:contact@opencaching.de" title="{t}Contact{/t}">{$contact}</a>.</p>