Skip to content
Permalink
Browse files

adaptions for national OC sites

- made header logo configurable
- made main country and language configurable
- move German content to bottom of start page for other languages
- made toprating statistics interval configurable and country-dependend
- made "more new caches" link country-dependend
- fixed welcome messages
  • Loading branch information...
following5 committed Aug 5, 2013
1 parent fe78d75 commit 7aca9812a3e933bcfa12697518d19b7ed591ca4d
@@ -112,6 +112,8 @@
// other settings
$opt['page']['showdonations'] = true;
$opt['page']['headoverlay'] = 'oc_head_alpha3';
$opt['logic']['pictures']['dummy']['replacepic'] = $dev_basepath . $dev_codepath . 'htdocs/images/no_image_license.png';
$opt['logic']['license']['disclaimer'] = true;
@@ -179,6 +179,12 @@
*/
$opt['debug'] = DEBUG_DEVELOPER;
/* Main locale and style: The country and language with most content on this site.
*
*/
$opt['page']['main_country'] = 'DE';
$opt['page']['main_locale'] = 'DE';
/* Default locale and style
*
*/
@@ -202,7 +208,6 @@
$opt['page']['develsystem'] = false;
$opt['page']['origin_url'] = 'http://www.opencaching.de/'; // reference productive installation for this OC code fork
/* maximum number of failed logins per hour before that IP address is blocked
* (used to prevent brute-force-attacks)
*/
@@ -221,6 +226,7 @@
// directory of rotator pictures and script, relative to head images dir
$opt['page']['headimagepath'] = '';
$opt['page']['headoverlay'] = 'oc_head_alpha3_generic';
/* disable or enable https access to the main site
* if false and connection is https, redirect to $opt['page']['absolute_url']
@@ -284,6 +290,8 @@
*
*/
$opt['logic']['rating']['percentageOfFounds'] = 10;
$opt['logic']['rating']['topdays_mainCountry'] = 30;
$opt['logic']['rating']['topdays_otherCountry'] = 180;
/*
* count of identical logs (date and text) that shows a warning message on

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -27,7 +27,7 @@
if (isset ($opt['page']['message']))
$tpl->assign('message',$opt['page']['message']);
else
$tpl->assign('message',$translate->t('<p>You can find everything you need to go Geocaching ...</p>', '', '', 0));
$tpl->assign('message',$translate->t('You can find everything you need to go Geocaching ...', '', '', 0));
// pictures
$tpl->assign('pictures', get_logpics(LOGPICS_FOR_STARTPAGE_GALLERY));
@@ -124,13 +124,20 @@
// last 30 days' top ratings
$tpl->assign_rs('topratings', $getNew->rsForSmarty('rating'));
$tpl->assign('toprating_days', $getNew->ratingDays());
// country and language parameters
$sUserCountryName = sql_value("SELECT IFNULL(`sys_trans_text`.`text`, `countries`.`name`)
FROM `countries`
LEFT JOIN `sys_trans` ON `countries`.`trans_id`=`sys_trans`.`id`
LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&2'
WHERE `countries`.`short`='&1'", '', $sUserCountry, $opt['template']['locale']);
$tpl->assign('usercountry', $sUserCountryName);
$tpl->assign('usercountryCode', $sUserCountry);
if ($opt['template']['locale'] == $opt['page']['main_locale'])
$tpl->assign('sections', array('news', 'events', 'logpics', 'recommendations', 'forum', 'newcaches'));
else
$tpl->assign('sections', array('events', 'recommendations', 'newcaches', 'logpics', 'forum', 'news'));
}
$tpl->display();
@@ -55,7 +55,7 @@ functionsbox available function on this site
<head>
<title><?php echo $tpl_subtitle; ?>{title}</title>
<meta name="keywords" content="Geocaching, Geocache, Cache, Geocashing, Schnitzeljagd, Schatzsuche, GPS, Openstreetmap, kostenlos, GPX, GPX download, Koordinaten, Hobby, Natur" />
<meta name="description" content="Geocaching ist ein GPS-Schatzsuche-Spiel: Es werden kleine Behälter versteckt, die anhand der GPS-Koordinaten zu finden sind. Opencaching.de ist das freie Portal, um diese Verstecke mit anderen zu teilen." />
<meta name="description" content="Opencaching.de ist das freie Portal für Geocaching, ein GPS-Schatzsuche-Spiel: Es werden kleine Behälter versteckt, die anhand von GPS-Koordinaten zu finden sind." />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
@@ -186,7 +186,7 @@ function flashbutton(bname)
<img src="resource2/{style}/images/head/rotator.php?path=<?php echo $opt['page']['headimagepath']; ?>" class="headerimagecontent" />
</div>
<div class="headerlogo">
<img src="resource2/{style}/images/oclogo/oc_head_alpha3.png" class="headerimagecontent" />
<img src="resource2/{style}/images/oclogo/<?php echo $opt['page']['headoverlay']; ?>.png" class="headerimagecontent" />
</div>
</div>
@@ -36,6 +36,7 @@
$opt['page']['subtitle1'] = 'Geocaching with Opencaching';
$opt['page']['subtitle2'] = '';
$opt['page']['headimagepath'] = '';
$opt['page']['headoverlay'] = 'oc_head_alpha3';
//id of the node
$oc_nodeid = 4;
@@ -72,6 +72,7 @@
$news_approver_email = 'news-approver@devel.opencaching.de';
$opt['page']['showdonations'] = false;
$opt['page']['headoverlay'] = 'oc_head_alpha3_generic';
//local database settings
$dbusername = 'username';
@@ -163,6 +163,7 @@ function display($dummy1=null, $dummy2=null, $dummy3=null)
$optn['page']['subtitle1'] = isset($opt['locale'][$locale]['page']['subtitle1']) ? $opt['locale'][$locale]['page']['subtitle1'] : $opt['page']['subtitle1'];
$optn['page']['subtitle2'] = isset($opt['locale'][$locale]['page']['subtitle2']) ? $opt['locale'][$locale]['page']['subtitle2'] : $opt['page']['subtitle2'];
$optn['page']['headimagepath'] = $opt['page']['headimagepath'];
$optn['page']['headoverlay'] = $opt['page']['headoverlay'];
$optn['page']['max_logins_per_hour'] = $opt['page']['max_logins_per_hour'];
$optn['page']['absolute_url'] = $opt['page']['absolute_url'];
$optn['page']['absolute_urlpath'] = parse_url($opt['page']['absolute_url'], PHP_URL_PATH);
@@ -139,7 +139,7 @@ private function eventRs($args=null)
// check $args and set defaults
if (is_null($args) || !is_array($args))
{
$args = array($this->get_userCountry(), $opt['template']['locale'],10);
$args = array($this->get_userCountry(), $opt['page']['main_country'], 10);
}
// execute sql
@@ -170,6 +170,26 @@ private function eventRs($args=null)
}
/**
* ratingDays returns the number of days used for top rating calculation
*
* @return days
*/
public function ratingDays()
{
// global
global $opt;
// Calculate days dependend on country selection.
// Todo: make default country configurable and use this also for
// "except of [Germany]" new caches and logs lists
if ($this->get_userCountry() == 'DE')
return $opt['logic']['rating']['topdays_mainCountry'];
else
return $opt['logic']['rating']['topdays_otherCountry'];
}
/**
* ratingRs executes the database statements for type "rating"
*
@@ -184,7 +204,12 @@ private function ratingRs($args=null)
// check $args and set defaults
if (is_null($args) || !is_array($args))
{
$args = array($this->get_userCountry(), $opt['template']['locale'],10);
$args = array(
$this->get_userCountry(),
$opt['template']['locale'],
10,
$this->ratingDays()
);
}
// execute sql
@@ -211,7 +236,7 @@ private function ratingRs($args=null)
LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id`=`countries`.`trans_id` AND `sys_trans_text`.`lang`='&2'
LEFT JOIN `caches_attributes` `ca` ON `ca`.`cache_id`=`caches`.`cache_id` AND `ca`.`attrib_id`=6
WHERE `caches`.`country`='&1' AND
`cache_rating`.`rating_date`>DATE_SUB(NOW(), INTERVAL 30 DAY) AND
`cache_rating`.`rating_date`>DATE_SUB(NOW(), INTERVAL &4 DAY) AND
`caches`.`type`!=6 AND
`caches`.`status`=1
GROUP BY `cache_rating`.`cache_id`
@@ -10,12 +10,14 @@
$tpl->menuitem = MNU_START_NEWCACHES;
$startat = isset($_REQUEST['startat']) ? $_REQUEST['startat']+0 : 0;
$country = isset($_REQUEST['country']) ? $_REQUEST['country'] : '';
$perpage = 100;
$startat -= $startat % $perpage;
if ($startat < 0) $startat = 0;
$tpl->caching = true;
$tpl->cache_id = $startat;
$tpl->cache_id = $startat . $country;
if ($startat > 10 * $perpage)
$tpl->cache_lifetime = 3600;
else
@@ -40,7 +42,7 @@
LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id` = `countries`.`trans_id`
AND `sys_trans_text`.`lang` = '" . sql_escape($opt['template']['locale']) . "'
LEFT JOIN `caches_attributes` `ca` ON `ca`.`cache_id`=`caches`.`cache_id` AND `ca`.`attrib_id`=6
WHERE `caches`.`status` = 1
WHERE `caches`.`status` = 1" . ($country ? " AND `caches`.`country`='" . sql_escape($country) . "'" : "") . "
ORDER BY `caches`.`date_created` DESC
LIMIT " . ($startat+0) . ', ' . ($perpage+0));
// see also write_newcaches_urls() in sitemap.class.php
@@ -50,12 +52,31 @@
$tpl->assign('newCaches', $newCaches);
$startat = isset($_REQUEST['startat']) ? $_REQUEST['startat']+0 : 0;
$count = sql_value_slave('SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1', 0);
$pager = new pager("newcaches.php?startat={offset}");
if ($country == '')
{
$count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1", 0);
$pager = new pager("newcaches.php?startat={offset}");
}
else
{
$count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1 AND `caches`.`country`='&1'", 0, $country);
$pager = new pager("newcaches.php?country=".$country."&startat={offset}");
}
$pager->make_from_offset($startat, $count, 100);
$tpl->assign('defaultcountry', $opt['template']['default']['country']);
$tpl->assign('countryCode', $country);
if ($country != '')
{
$tpl->assign(
'countryName',
sql_value("SELECT IFNULL(`sys_trans_text`.`text`, `countries`.`name`)
FROM `countries`
LEFT JOIN `sys_trans` ON `countries`.`trans_id`=`sys_trans`.`id`
LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&2'
WHERE `countries`.`short`='&1'", '', $country, $opt['template']['locale'])
);
}
}
$tpl->display();
@@ -304,6 +304,7 @@ div.cachedesc p {font-size: 100%;}
div.welcome p {line-height: 1.6em;}
p.inheader {margin:4px; font-size:125%;}
p.spacer_before {margin-top:12px;}
p.startmessage { line-height: 1.4em; }

/* Quote */
p.quote {clear: left; margin: 0em 30px 0.6em 30px; line-height: 120%; font-size: 110%;}
@@ -1489,4 +1490,6 @@ p.editlog { font-weight: 400; display:inline; }
label.disabled { color:grey; }
.formlabel { color:#555; font-weight:bold; line-height:1.5em !important}

.smalltext { font-size:88% !important }
.smalltext { font-size:88% !important }

p.startmessage { line-height: 1.4em; }
Binary file not shown.
@@ -5,8 +5,8 @@
***************************************************************************}
{* OCSTYLE *}
<div class="content2-pagetitle">
<img src="resource2/{$opt.template.style}/images/cacheicon/traditional.gif" style="align: left; margin-right: 10px;" width="32" height="32" alt="{t}Latest caches{/t}" />
{t}Latest caches{/t}
<img src="resource2/{$opt.template.style}/images/cacheicon/traditional.gif" style="align: left; margin-right: 10px;" width="32" height="32" alt="" />
{if $countryCode == ''}{t}Latest caches{/t}{else}{t 1=$countryName|escape}Newest caches in %1{/t}{/if}
</div>

<table width="100%" class="table">
@@ -20,7 +20,7 @@
{foreach name=newCaches from=$newCaches item=newCache}
<tr>
<td style="width:1%; vertical-align:center">{$newCache.date_created|date_format:$opt.format.date}</td>
<td class="listicon"><img src="resource2/{$opt.template.style}/images/cacheicon/16x16-{$newCache.type}.gif" width="16" height="16" border="0" /></td><td style="vertical-align:center"> <a href="viewcache.php?wp={$newCache.wpoc}">{$newCache.cachename|escape}</a> {include file="res_oconly.tpl" oconly=$newCache.oconly} {t}by{/t} <a href="viewprofile.php?userid={$newCache.userid}">{$newCache.username|escape}</a> {if $newCache.country != $defaultcountry}&nbsp;&nbsp;<img src="images/flags/{$newCache.country|lower}.gif" alt="({$newCache.country_name})" title="{$newCache.country_name}" />{/if} </td>
<td class="listicon"><img src="resource2/{$opt.template.style}/images/cacheicon/16x16-{$newCache.type}.gif" width="16" height="16" border="0" /></td><td style="vertical-align:center"> <a href="viewcache.php?wp={$newCache.wpoc}">{$newCache.cachename|escape}</a> {include file="res_oconly.tpl" oconly=$newCache.oconly} {t}by{/t} <a href="viewprofile.php?userid={$newCache.userid}">{$newCache.username|escape}</a> {if $countryCode == '' && $newCache.country != $defaultcountry}&nbsp;&nbsp;<img src="images/flags/{$newCache.country|lower}.gif" alt="({$newCache.country_name})" title="{$newCache.country_name}" />{/if} </td>
</tr>
{/foreach}

@@ -6,12 +6,15 @@

<div class="content-txtbox-noshade">
<div class="content-txtbox-noshade">
<p style="line-height: 1.5em;">{$message}</p>
<p class="startmessage">{$message}</p>
<div class="buffer" style="width: 500px;">&nbsp;</div>
</div>
</div>

{foreach from=$sections item=section}

{* news or blog *}
{if $section == 'news'}
<div>
<div class="content2-container bg-blue02">
<table class="none" cellspacing="0" cellpadding="0" width="100%">
@@ -60,6 +63,7 @@
{/if}

{* next events *}
{elseif $section == 'events'}
<div class="content2-container bg-blue02">
<p class="content-title-noshade-size3">
<img src="resource2/{$opt.template.style}/images/cacheicon/event.gif" style="align: left; margin-right: 10px;" width="24" height="24" alt="" />
@@ -71,6 +75,7 @@
</div>

{* new logpix *}
{elseif $section == 'logpics'}
<div class="content2-container bg-blue02" style="margin-bottom:6px">
<p class="content-title-noshade-size3">
<img src="resource2/{$opt.template.style}/images/misc/32x32-pictures.gif" style="align: left; margin-right: 10px;" width="24" height="24" />
@@ -81,19 +86,21 @@
{include file="res_logpictures.tpl" logdate=true loguser=true}

{* recommendations *}
{elseif $section == 'recommendations'}
<div class="content2-container bg-blue02">
<p class="content-title-noshade-size3">
<img src="resource2/{$opt.template.style}/images/misc/32x32-winner.png" style="align: left; margin-right: 10px;" width="24" height="24" alt="" />
<a href="tops.php" style="color:rgb(88,144,168); text-decoration: none;">{t}Current top ratings{/t}</a>
</p>
</div>
<p style="line-height: 1.6em;">{t 1=$usercountry|escape}Geocaches with most ratings in the last 30 days in %1.{/t}</p>
<p style="line-height: 1.6em;">{t 1=$usercountry|escape 2=$toprating_days}Geocaches with most ratings in the last %2 days in %1.{/t}</p>

<div style="margin-bottom:16px">
{include file="res_newratings.tpl" topratings=$topratings}
</div>

{* forum news *}
{elseif $section == 'forum'}
{if $phpbb_enabled==true}
<div class="buffer" style="width: 500px;height: 2px;">&nbsp;</div>
<div class="content2-container bg-blue02">
@@ -131,14 +138,17 @@
{/if}

{* new caches *}
{elseif $section == 'newcaches'}
<div class="content2-container bg-blue02">
<p class="content-title-noshade-size3">
<img src="resource2/{$opt.template.style}/images/cacheicon/traditional.gif" style="align: left; margin-right: 10px;" width="24" height="24" alt="" />
<a href="newcaches.php" style="color:rgb(88,144,168); text-decoration: none;">{t 1=$usercountry|escape}Newest caches in %1{/t}</a>
&nbsp; <span style="color:black; font-size:0.8em; font-weight:normal">[<a href="newcaches.php">{t}more{/t}...</a>]</span>
&nbsp; <span style="color:black; font-size:0.8em; font-weight:normal">[<a href="newcaches.php?country={$usercountryCode}">{t}more{/t}...</a>]</span>
</p>
</div>
<p style="line-height: 1.6em;">({t 1=$count_hiddens 2=$count_founds 3=$count_users}Total of %1 active Caches and %2 founds by %3 users{/t})</p>
{include file="res_newcaches.tpl" newcaches=$newcaches}


{/if}
{/foreach}

@@ -18,7 +18,7 @@
</title>
<meta name="keywords" content="Geocaching, Geocache, Cache, Geocashing, Schnitzeljagd, Schatzsuche, GPS, Openstreetmap, kostenlos, GPX, GPX download, Koordinaten, Hobby, Natur" />
{* siehe http://forum.opencaching-network.org/index.php?topic=3065.0 *}
<meta name="description" content="Geocaching ist ein GPS-Schatzsuche-Spiel: Es werden kleine Behälter versteckt, die anhand der GPS-Koordinaten zu finden sind. Opencaching.de ist das freie Portal, um diese Verstecke mit anderen zu teilen." />
<meta name="description" content="Opencaching.de ist das freie Portal für Geocaching, ein GPS-Schatzsuche-Spiel: Es werden kleine Behälter versteckt, die anhand von GPS-Koordinaten zu finden sind." />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
@@ -183,7 +183,7 @@
<img src="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="resource2/{$opt.template.style}/images/oclogo/{$opt.page.headoverlay}.png" class="headerimagecontent" />
</div>
</div> <!-- header -->

0 comments on commit 7aca981

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