}
 $ars = sql("SELECT\n                    `user`.`hidden_count` AS    `ukryte`,\n                    `user`.`founds_count` AS    `znalezione`,\n                    `user`.`notfounds_count` AS `nieznalezione`\n                FROM `user` WHERE `user_id`='&1'", $user_id);
 $record = sql_fetch_array($ars);
 $act = $record['ukryte'] + $record['znalezione'] + $record['nieznalezione'];
 if (date('m') == 4 and date('d') == 1) {
     $act = rand(-10, 10);
 }
 $content .= '<br /><p>&nbsp;</p><div class="content2-container bg-blue02"><p class="content-title-noshade-size1">&nbsp;<img src="tpl/stdstyle/images/blue/event.png" class="icon32" alt="Caches Find" title="Caches Find" />&nbsp;&nbsp;&nbsp;' . tr('user_activity01') . '</p></div><br /><p><span class="content-title-noshade txt-blue08">' . tr('user_activity02') . '</span>:&nbsp;<strong>' . $act . '</strong></p>';
 // PowerTrails stats
 if ($powerTrailModuleSwitchOn) {
     $content .= '<div class="content2-container bg-blue02">
                     <p class="content-title-noshade-size1">
                     <img src="tpl/stdstyle/images/blue/powerTrailGenericLogo.png" width="33" class="icon32" alt="geoPaths" title="geoPaths" />&nbsp' . tr('pt001') . '</div>';
     //geoPaths medals
     $content .= getPowerTrailsCompletedByUser($user_id);
     $content .= '<p><span class="content-title-noshade txt-blue08">' . tr('pt140') . '</span>:&nbsp;<strong>' . powerTrailBase::getUserPoints($user_id) . '</strong> (' . tr('pt093') . ' ' . powerTrailBase::getPoweTrailCompletedCountByUser($user_id) . ')</p>';
     $pointsEarnedForPlacedCaches = powerTrailBase::getOwnerPoints($user_id);
     $content .= '<p><span class="content-title-noshade txt-blue08">' . tr('pt224') . '</span>:&nbsp;<strong>' . $pointsEarnedForPlacedCaches['totalPoints'] . '</strong> (' . tr('pt222') . ' ' . $pointsEarnedForPlacedCaches['geoPathCount'] . ' ' . tr('pt223') . ')</p>';
     //var_dump($a);
     db_connect();
     // db mysql_* connection is switched off in geoPatch module, so re-open it.
 }
 //$content .= '</div>';
 // -----------  begin Find section -------------------------------------
 $rs_seek = sql("SELECT COUNT(*) FROM cache_logs WHERE (type=1 OR type=2) AND cache_logs.deleted='0' AND user_id=&1 GROUP BY YEAR(`date`), MONTH(`date`), DAY(`date`)", $user_id);
 $seek = mysql_num_rows($rs_seek);
 $content .= '<p>&nbsp;</p><div class="content2-container bg-blue02"><p class="content-title-noshade-size1">&nbsp;<img src="tpl/stdstyle/images/blue/cache-open.png" class="icon32" alt="Caches Find" title="Caches Find" />&nbsp;&nbsp;&nbsp;' . tr('stat_number_found') . '</p></div><br />';
 if ($seek == 0) {
     $content .= '<br /><p> <b>' . tr('not_found_caches') . '</b></p>';
 } else {
     $sql = "SELECT COUNT(*) events_count\n                            FROM cache_logs\n                            WHERE user_id={$user_id} AND type=7 AND deleted=0";
示例#2
0
<?php

use Utils\Database\OcDb;
$rootpath = __DIR__ . '/../';
require_once __DIR__ . '/../lib/common.inc.php';
$db = OcDb::instance();
$query = 'SELECT user.username, `userId`
FROM `PowerTrail_comments` , user
WHERE `commentType` =2
AND `deleted` =0
AND `PowerTrail_comments`.`userId` = user.user_id
GROUP BY `userId` ';
$s = $db->simpleQuery($query);
$result = $db->dbResultFetchAll($s);
foreach ($result as $user) {
    $resArr[$user['userId']] = array('username' => $user['username'], 'userPoints' => powerTrailBase::getUserPoints($user['userId']));
}
echo '<pre>';
print_r($resArr);