Ejemplo n.º 1
0
 public function execute()
 {
     GWF3::setConfig('log_request', false);
     $_GET['ajax'] = 1;
     $cut = time() - GWF_ONLINE_TIMEOUT;
     $user = new GWF_User();
     $table = GDO::table('GWF_Session');
     $profiles = '';
     if (false === ($result = $table->select('sess_user,user_name,user_options,user_level', "sess_time>={$cut}", 'user_name ASC', array('user')))) {
         return;
     }
     $guest = 0;
     $member = 0;
     $total = 0;
     $u_count = array();
     $u_users = array();
     while (false !== ($row = $table->fetch($result, GDO::ARRAY_A))) {
         $total++;
         $uid = $row['sess_user'];
         if ($uid == 0) {
             $guest++;
             continue;
         }
         $member++;
         $user->setGDOData($row);
         if ($user->isOptionEnabled(GWF_User::HIDE_ONLINE)) {
             continue;
         }
         if (isset($u_count[$uid])) {
             $u_count[$uid]++;
         } else {
             $u_count[$uid] = 1;
             $u_users[$uid] = $user->displayProfileLink();
         }
     }
     $table->free($result);
     foreach ($u_count as $uid => $cnt) {
         $multi = $cnt > 1 ? "(x{$cnt})" : '';
         $profiles .= ', ' . $u_users[$uid] . $multi;
     }
     $profiles = $profiles === '' ? '.' : ': ' . substr($profiles, 2) . '.';
     return sprintf('%s Online%s', $total, $profiles);
 }
Ejemplo n.º 2
0
<?php

Module_WeChall::includeForums();
$chall = $tVars['chall'];
$chall instanceof WC_Challenge;
$headers = array(array($tLang->lang('th_length'), 'wmc_length'), array($tLang->lang('th_csolve_date'), 'wmc_date'), array($tLang->lang('th_user_name'), 'user_name'), array($tLang->lang('th_solution'), 'wmc_solution'));
$chall->showHeader(true);
echo GWF_Box::box($tVars['table_title']);
echo $tVars['page_menu'];
echo GWF_Table::start();
//echo GWF_Table::displayHeaders1($headers, $tVars['sort_url'], 'wmc_date', 'ASC', 'by', 'dir', $tVars['table_title']);
echo GWF_Table::displayHeaders1($headers, $tVars['sort_url']);
$guest = GWF_Guest::getGuest();
$userr = new GWF_User(false);
foreach ($tVars['data'] as $row) {
    if ($row['user_name'] === NULL) {
        $username = GWF_HTML::lang('guest');
    } else {
        $userr->setGDOData($row);
        $username = $userr->displayProfileLink();
    }
    echo GWF_Table::rowStart();
    echo GWF_Table::column($row['wmc_length'], 'gwf_num');
    echo GWF_Table::column(GWF_Time::displayDate($row['wmc_date']), 'gwf_date');
    echo GWF_Table::column($username);
    echo GWF_Table::column($row['wmc_solution']);
    echo GWF_Table::rowEnd();
}
echo GWF_Table::end();
echo $tVars['page_menu'];
Ejemplo n.º 3
0
$orderby = $table->getMultiOrderby($by, $dir);
$ipp = 50;
$nRows = $table->countRows();
$nPages = GWF_PageMenu::getPagecount($ipp, $nRows);
$page = Common::clamp(Common::getGetInt('page', 1), 1, $nPages);
$from = GWF_PageMenu::getFrom($page, $ipp);
$pagemenu = GWF_PageMenu::display($page, $nPages, sprintf('highscore.php?by=%s&dir=%s&page=%%PAGE%%', urlencode($by), urlencode($dir)));
$headers = array(array($chall->lang('th_start'), 'wccc_start'), array($chall->lang('th_user'), 'user_name'), array($chall->lang('th_time'), 'wccc_time'), array($chall->lang('th_count'), 'wccc_count'), array($chall->lang('th_solved'), 'wccc_solved'), array($chall->lang('th_rate'), 'wccc_rate'));
if (false === ($result = $table->select('*', '', $orderby, array('wccc_uid'), $ipp, $from))) {
    die('DB ERROR');
}
echo $pagemenu;
echo GWF_Table::start();
echo GWF_Table::displayHeaders1($headers, sprintf('highscore.php?by=%%BY%%&dir=%%DIR%%&page=1'));
$user = new GWF_User(false);
while (false !== ($row = $table->fetch($result, GDO::ARRAY_A))) {
    $user->setGDOData($row);
    echo GWF_Table::rowStart();
    echo sprintf('<td class="gwf_date">%s</td>', GWF_Time::displayDate($row['wccc_start'])) . PHP_EOL;
    echo sprintf('<td>%s</td>', $user->displayProfileLink()) . PHP_EOL;
    echo sprintf('<td class="gwf_num">%ss</td>', $row['wccc_time']) . PHP_EOL;
    echo sprintf('<td class="gwf_num">%s</td>', $row['wccc_count']) . PHP_EOL;
    echo sprintf('<td class="gwf_num">%s</td>', $row['wccc_solved']) . PHP_EOL;
    echo sprintf('<td class="gwf_num">%.02f%%</td>', $row['wccc_rate']) . PHP_EOL;
    echo GWF_Table::rowEnd();
}
$table->free($result);
echo GWF_Table::end();
echo $pagemenu;
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';
Ejemplo n.º 4
0
}
if (isset($_GET['yahoo'])) {
    $headers[] = array($tLang->lang('th_yahoo'), 'prof_yahoo');
}
if (isset($_GET['aim'])) {
    $headers[] = array($tLang->lang('th_aim'), 'prof_aim');
}
echo $tVars['pagemenu'];
echo GWF_Table::start();
echo GWF_Table::displayHeaders1($headers, $tVars['sort_url']);
$user = new GWF_User(false);
foreach ($tVars['result'] as $row) {
    $user->setGDOData($row);
    echo GWF_Table::rowStart();
    echo GWF_Table::column($user->displayCountryFlag(false));
    echo GWF_Table::column($user->displayProfileLink());
    if (isset($_GET['minlevel'])) {
        echo GWF_Table::column($row['user_level'], 'gwf_num');
    }
    if (isset($_GET['hasmail']) || isset($_GET['email'])) {
        echo GWF_Table::column($user->displayEMail());
    }
    if (isset($_GET['haswww'])) {
        $a = htmlspecialchars($row['prof_website']);
        echo GWF_Table::column(sprintf('<a href="%s">%s</a>', $a, $a));
    }
    if (isset($_GET['icq'])) {
        echo GWF_Table::column(htmlspecialchars($row['prof_icq']), 'gwf_num');
    }
    if (isset($_GET['msn'])) {
        echo GWF_Table::column(htmlspecialchars($row['prof_msn']), 'gwf_num');