recover oconly81 feature

This commit is contained in:
Nils Bohrs 2014-04-13 16:36:32 +02:00
parent da4e0f2983
commit 37732a729f
3 changed files with 120 additions and 0 deletions
htdocs
doc/sql/static-data
oconly81.php
templates2/ocstyle

@ -902,6 +902,7 @@ INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustrin
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('102', 'MNU_START_NEWFEATURES', 'New features', '2115', 'New features', '2115', '0', 'articles.php?page=changelog', '1', '1', '5', '', '0', NULL);
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('103', 'MNU_MYPROFILE_OWNERLOGS', 'Log history', '2126', 'Log history', '2126', '0', 'ownerlogs.php', '0', '9', '10', '', '1', NULL);
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('104', 'MNU_MYPROFILE_OWNLOGS', 'Log history', '2126', 'Log history', '2126', '0', 'ownlogs.php', '0', '9', '11', '', '1', NULL);
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('105', 'MNU_CACHES_OCONLY81', 'OConly-81', '2139', 'OConly-81', '2139', '0', 'oconly81.php', '1', '10', '5', '', '1', NULL);
-- Table sys_trans
SET NAMES 'utf8';

52
htdocs/oconly81.php Normal file

@ -0,0 +1,52 @@
<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
*
* Display some status information about the server and Opencaching
***************************************************************************/
require 'lib2/web.inc.php';
require 'lib2/logic/oconly81.inc.php';
$showall = (@$_REQUEST['showall'] == 1);
$tpl->name = 'oconly81';
$tpl->menuitem = MNU_CACHES_OCONLY81;
$tpl->caching = true;
$tpl->cache_lifetime = 900;
$tpl->cache_id = $showall ? 1 : 0;
$login->verify();
sql_temp_table('oconly81');
sql("
CREATE TEMPORARY TABLE &oconly81 ENGINE=MEMORY
SELECT DISTINCT `user`.`user_id`, `caches`.`terrain`, `caches`.`difficulty`
FROM `user`
INNER JOIN `cache_logs` ON `cache_logs`.`user_id`=`user`.`user_id` AND `cache_logs`.`type` IN (1,7)
INNER JOIN `caches` ON `caches`.`cache_id`=`cache_logs`.`cache_id`
INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`cache_logs`.`cache_id` AND `caches_attributes`.`attrib_id`=6
INNER JOIN `user_options` ON `user_options`.`user_id`=`user`.`user_id`
WHERE `user_options`.`option_id`=13 AND `user_options`.`option_value`='1'");
// users with 0 OConly founds are filtered out here
$rs = sql("
SELECT `user`.`username`, `user`.`user_id`, COUNT(*) AS `count`
FROM `user`
INNER JOIN &oconly81 ON &oconly81.`user_id`=`user`.`user_id`
GROUP BY `user`.`user_id`
ORDER BY `count` DESC, `username` ASC " .
($showall ? "" : "LIMIT " . sql_escape($opt['logic']['oconly81']['default_maxusers']+1)) );
$tpl->assign_rs('users', $rs);
sql_free_result($rs);
sql_drop_temp_table('oconly81');
set_oconly81_tpldata(0);
$tpl->assign('default_maxusers', $opt['logic']['oconly81']['default_maxusers']);
$tpl->assign('showall', $showall);
$tpl->display();
?>

@ -0,0 +1,67 @@
{***************************************************************************
* You can find the license in the docs directory
*
* Unicode Reminder メモ
***************************************************************************}
{* OCSTYLE *}
<div class="content2-pagetitle">
<img src="resource2/{$opt.template.style}/images/misc/is_oconly_small.png" style="align: left; margin-right: 10px;" />
{t}OConly-81{/t}
</div>
<div class="content-txtbox-noshade" style="padding-right: 25px;">
<p class="article">
{t}<b>OConly-81</b> is a new challenge about finding OConly caches under varying conditions, i.e. with different difficulty and terrain ratings. To participate, you can enable the OConly-81 statistics in your <a href="mydetails.php">user profile settings</a>.{/t}<br />
</p>
<div class="buffer" style="width: 500px;">&nbsp;</div>
<div class="content2-container bg-blue02">
<p class="content-title-noshade-size2">
<img src="resource2/{$opt.template.style}/images/profile/32x22-profile.png" style="align: left; margin-right: 10px;" width="32" height="22" />
{t}Participants{/t}
{if !$showall && ($users|@count > $default_maxusers)}
&nbsp; <span class="content-title-link">[<a href="oconly81.php?showall=1">{t}Show all{/t}</a>]</span>
{/if}
</p>
</div>
<p>
{t}Users with OConly-81 statistics:{/t}
</p>
<ul class="col4">
{foreach from=$users key=n item=user}
{if $showall || ($n < $default_maxusers)}
<li>
<a href="viewprofile.php?userid={$user.user_id}#oconly81">{$user.username}</a> ({$user.count})
</li>
{/if}
{/foreach}
</ul>
<div class="buffer" style="width: 500px;">&nbsp;</div>
<div class="content2-container bg-blue02">
<p class="content-title-noshade-size2">
<img src="resource2/{$opt.template.style}/images/cacheicon/22x20-traditional.png" style="align: left; margin-right: 10px;" width="22" height="20" />
{t}Statistics{/t}
</p>
</div>
<p>
{t}Overall terrain and difficulty distribution of active OConly caches:{/t}
</p>
<table class="table">
<tr>
<td width="1%">
{include file="res_oconly81.tpl" userid=$userid}
</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
</table>
</div>