$tpl->assign('oconly_found', $oconly_found);
$tpl->assign('oconly_dnf', $oconly_dnf);
$tpl->assign('oconly_note', $oconly_note);
$tpl->assign('oconly_maint', $oconly_maint);
// OConly detail statistics
if ($show_statistics) {
    $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`\n\t\t\t           FROM `caches` AS `c`\n\t\t\t      LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`\n\t\t\t      LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`\n\t\t\t      LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'\n\t\t\t      LEFT JOIN `cache_status` ON `cache_status`.`id`=`c`.`status`\n\t\t\t     INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`c`.`cache_id` AND `caches_attributes`.`attrib_id`=6\n\t\t\t          WHERE `c`.`user_id`='&1' AND `allow_user_view`='1'\n\t\t\t       GROUP BY `t`.`id`\n\t\t\t       ORDER BY `anzahl` DESC, `t`.`ordinal` ASC", $userid, $opt['template']['locale']);
    $tpl->assign_rs('oconly_userstatshidden', $rs);
    sql_free_result($rs);
    $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`\n\t\t\t           FROM `cache_logs` AS `l`\n\t\t\t      LEFT JOIN `caches` AS `c` ON `l`.`cache_id`=`c`.`cache_id`\n\t\t\t      LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`\n\t\t\t      LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`\n\t\t\t      LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'\n\t\t\t     INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`c`.`cache_id` AND `caches_attributes`.`attrib_id`=6\n\t\t\t          WHERE `l`.`user_id`='&1' AND (`l`.`type`=1 OR `l`.`type`=7)\n\t\t\t       GROUP BY `t`.`id`\n\t\t\t       ORDER BY `anzahl` DESC, `t`.`ordinal` ASC", $userid, $opt['template']['locale']);
    $tpl->assign_rs('oconly_userstatsfound', $rs);
    sql_free_result($rs);
}
if ($show_oconly81) {
    require 'lib2/logic/oconly81.inc.php';
    set_oconly81_tpldata($userid);
}
//Titel
$menu->SetSelectItem($tpl->menuitem);
$tpl->title = $menu->GetMenuTitle() . " " . $record['username'];
$tpl->assign('username', $record['username']);
$tpl->assign('userid', $userid);
$tpl->assign('uuid', $record['uuid']);
$tpl->assign('founds', $record['found'] <= 0 ? '0' : $record['found']);
$tpl->assign('notfound', $record['notfound'] <= 0 ? '0' : $record['notfound']);
$tpl->assign('note', $record['note'] <= 0 ? '0' : $record['note']);
$tpl->assign('maintenance', $record['maintenance'] <= 0 ? '0' : $record['maintenance']);
$tpl->assign('hidden', $record['hidden'] <= 0 ? '0' : $record['hidden']);
$tpl->assign('active', $active);
$tpl->assign('recommended', sql_value("SELECT COUNT(*) FROM `cache_rating` WHERE `user_id`='&1'", 0, $userid));
$tpl->assign('maxrecommended', floor($record['found'] * $opt['logic']['rating']['percentageOfFounds'] / 100));
Example #2
0
<?php

/***************************************************************************
 *  For license information see doc/license.txt
 *
 *  Unicode Reminder メモ
 ***************************************************************************/
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("\n\t\tCREATE TEMPORARY TABLE &oconly81 ENGINE=MEMORY\n\t\tSELECT DISTINCT `user`.`user_id`, `caches`.`terrain`, `caches`.`difficulty`\n\t\tFROM `user`\n\t\tINNER JOIN `cache_logs` ON `cache_logs`.`user_id`=`user`.`user_id` AND `cache_logs`.`type` IN (1,7)\n\t\tINNER JOIN `caches` ON `caches`.`cache_id`=`cache_logs`.`cache_id`\n\t\tINNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`cache_logs`.`cache_id` AND `caches_attributes`.`attrib_id`=6\n\t\tINNER JOIN `user_options` ON `user_options`.`user_id`=`user`.`user_id`\n\t\tWHERE `user_options`.`option_id`=13 AND `user_options`.`option_value`='1'");
// users with 0 OConly founds are filtered out here
$rs = sql("\n\t\tSELECT `user`.`username`, `user`.`user_id`, COUNT(*) AS `count`\n\t\tFROM `user`\n\t\tINNER JOIN &oconly81 ON &oconly81.`user_id`=`user`.`user_id`\n\t\tGROUP BY `user`.`user_id`\n\t\tORDER 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();