Beispiel #1
0
function smarty_function_gwftable($params, $template)
{
    $a = isset($params['action']) ? $params['action'] : '';
    switch ($a) {
        case 'start':
            $cl = isset($params['class']) ? " class=\"{$params['class']}\"" : '';
            $id = isset($params['id']) ? " id=\"{$params['id']}\"" : '';
            return sprintf('<div class="gwf_table"><table%s%s>' . PHP_EOL, $cl, $id);
        case 'end':
            return '</table></div>' . PHP_EOL;
        case 'rowStart':
            $cl = isset($params['class']) ? $params['class'] : '';
            $id = isset($params['id']) ? $params['id'] : '';
            $style = isset($params['style']) ? $params['style'] : '';
            return GWF_Table::rowStart(isset($params['flip']), $cl, $id, $style);
        case 'rowEnd':
            return '</tr>' . PHP_EOL;
        case 'column':
            $text = isset($params['text']) ? $params['text'] : '';
            $cl = isset($params['class']) ? $params['class'] : '';
            $colspan = isset($params['colspan']) ? (int) $params['colspan'] : 1;
            return GWF_Table::column($text, $cl, $colspan);
        case 'displayHeaders1':
        case 'displayHeaders2':
            $headers = isset($params['headers']) ? (array) $params['headers'] : array();
            $sortURL = isset($params['sortURL']) ? $params['sortURL'] : NULL;
            $default = isset($params['default']) ? $params['default'] : '';
            $defdir = isset($params['defdir']) ? $params['defdir'] : 'ASC';
            $by = isset($params['by']) ? $params['by'] : 'by';
            $dir = isset($params['dir']) ? $params['dir'] : 'dir';
            $raw = isset($params['raw']) ? $params['raw'] : '';
            if ($a === 'displayHeaders1') {
                return GWF_Table::displayHeaders1($headers, $sortURL, $default, $defdir, $by, $dir, $raw);
            } else {
                return GWF_Table::displayHeaders2($headers, $sortURL, $default, $defdir, $by, $dir, $raw);
            }
        default:
            return '';
    }
}
Beispiel #2
0
function wcProfileLastActivity(GWF_User $user, $ipp, $priv = false)
{
    $uid = $user->getID();
    $uh = GDO::table('WC_HistoryUser2');
    $entries = $uh->selectObjects('*', "userhist_uid={$uid}", 'userhist_date DESC', $ipp);
    //	$entries = array_reverse($entries);
    $back = '';
    $back .= '<table class="cl">';
    $href_txt_history = GWF_WEB_ROOT . 'history/for/' . $user->urlencode2('user_name');
    $anchor = GWF_HTML::anchor($href_txt_history, WC_HTML::lang('th_last_activites', array($user->displayUsername())));
    $back .= sprintf('<thead><tr><th colspan="2">%s</th></tr></thead>', $anchor);
    $unknown = GWF_HTML::lang('unknown');
    foreach ($entries as $entry) {
        $entry instanceof WC_HistoryUser2;
        $back .= GWF_Table::rowStart();
        $back .= sprintf('<td class="gwf_date">%s</td>', $priv ? $unknown : $entry->displayDate());
        $back .= sprintf('<td>%s</td>', $entry->displayComment());
        $back .= GWF_Table::rowEnd();
    }
    $back .= '</table>';
    return $back;
}
Beispiel #3
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'];
Beispiel #4
0
}
if (Common::getGetString('list') === 'wc3') {
    $content = '';
    $content .= GWF_Table::start();
    foreach ($list1 as $plaintext) {
        $content .= GWF_Table::rowStart();
        $content .= sprintf('<td style="font-family:monospace;">%s</td>', hashgame_wc3($plaintext));
        $content .= GWF_Table::rowEnd();
    }
    $content .= GWF_Table::end();
    echo GWF_Box::box($content, $chall->lang('tt_list_wc3', array('index.php?algo=wc3&list=wc3')));
} elseif (Common::getGetString('list') === 'wc4') {
    $content = '';
    $content .= GWF_Table::start();
    foreach ($list2 as $plaintext) {
        $content .= GWF_Table::rowStart();
        $content .= sprintf('<td style="font-family:monospace;">%s</td>', hashgame_wc4($plaintext));
        $content .= GWF_Table::rowEnd();
    }
    $content .= GWF_Table::end();
    echo GWF_Box::box($content, $chall->lang('tt_list_wc4', array('index.php?algo=wc4&list=wc4')));
}
formSolutionbox($chall);
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';
####################
### Check answer ###
####################
function sort_strlen($a, $b)
{
    return strlen($b) - strlen($a);
Beispiel #5
0
<?php

echo sprintf('<h1><a href="%s">%s</a></h1>', $tVars['href_history'], $tLang->lang('box_title')) . PHP_EOL;
echo '<table id="gwf_shout_table">' . PHP_EOL;
foreach ($tVars['msgs'] as $msg) {
    $msg instanceof GWF_Shoutbox;
    $user = $msg->getUser();
    $style = wcStyleForUser($user);
    //	$style = 'background: #'.$color.'!important;';
    echo GWF_Table::rowStart(false, '', '', $style);
    echo sprintf('<td>%s</td>', $msg->displayUsername()) . PHP_EOL;
    echo sprintf('<td>%s</td>', $msg->displayMessage()) . PHP_EOL;
    echo GWF_Table::rowEnd();
}
echo '</table>' . PHP_EOL;
require_once '_shout.php';
function wcStyleForUser($user)
{
    static $swap = 1;
    $swap = 1 - $swap;
    if ($user === false || $user->getID() == 0) {
        $color = $swap ? 'eee' : 'fff';
        return "background: #{$color}!important; color #000";
    }
    $user instanceof GWF_User;
    //	var_dump($user);
    $user->loadGroups();
    if ($user->isAdmin()) {
        $color = $swap ? 'FF8' : 'EE7';
        return "background-color: #{$color}!important; font-weight: bold;";
    }
Beispiel #6
0
<?php

echo GWF_Box::box($tLang->lang('pi_csrank'), $tLang->lang('pt_csrank'));
WC_HTML::rankingPageButtons();
$headers = array(array('#', null, null, 2), array('', null, null, 1), array($tLang->lang('th_user_countryid'), 'countryname', 'ASC', 3), array($tLang->lang('th_players'), 'users', 'DESC', 6), array($tLang->lang('th_score'), 'totalscore', 'DESC', 4), array($tLang->lang('th_spc'), 'spc', 'DESC', 7), array($tLang->lang('th_avg'), 'avg', 'DESC', 8), array($tLang->lang('th_sumtop3'), 'top3', 'DESC', 9), array($tLang->lang('th_top_player'), 'topuser', 'ASC', 5));
$rank = 1;
$hlc = $tVars['highlight_country'];
echo GWF_Table::start();
echo GWF_Table::displayHeaders1($headers, $tVars['sort_url']);
$sl = WC_HTML::styleSelected();
foreach ($tVars['data'] as $row) {
    $cid = $row['country_id'];
    $topuser = $row['topuser'];
    $style = $hlc == $cid ? $sl : '';
    $href = GWF_WEB_ROOT . 'country_ranking/for/' . $cid . '/' . Common::urlencodeSEO($row['countryname']);
    echo GWF_Table::rowStart(true, '', '', $style);
    echo sprintf('<td class="gwf_num">%d</td>', $rank++);
    echo sprintf('<td>%s</td>', GWF_Country::displayFlagS2($cid, $row['countryname']));
    echo sprintf('<td><a href="%s">%s</a></td>', $href, GWF_HTML::display($row['countryname']));
    echo sprintf('<td class="gwf_num">%d</td>', $row['users']);
    echo sprintf('<td class="gwf_num">%d</td>', $row['totalscore']);
    echo sprintf('<td class="gwf_num">%s</td>', $row['spc']);
    echo sprintf('<td class="gwf_num">%d</td>', $row['avg']);
    echo sprintf('<td class="gwf_num">%d</td>', $row['top3']);
    echo sprintf('<td><a href="%s" title="%s">%s</a></td>', GWF_WEB_ROOT . 'profile/' . urlencode($topuser), $tLang->lang('a_title', array($row['topscore'])), GWF_HTML::display($topuser));
    echo GWF_Table::rowEnd();
}
echo GWF_Table::end();
echo GWF_Box::box($tLang->lang('scorefaq_box', GWF_WEB_ROOT . 'scoring_faq'));
Beispiel #7
0
<?php

$box_c = '';
if (!isset($tVars['no_info'])) {
    $box_c .= sprintf('<p>%s</p>', $tLang->lang('payment_info'));
}
if (isset($tVars['paymodule_info']) && $tVars['paymodule_info'] !== '') {
    $box_c .= sprintf('<p>%s</p>', $tVars['paymodule_info']);
}
echo GWF_Box::box($box_c);
echo sprintf('<p>%s</p>', $tVars['order']);
?>
<table>
<?php 
echo sprintf('%s<td colspan="2">%s</td><td>%s</td>%s', GWF_Table::rowStart(), $tLang->lang('th_price'), $tVars['price'], GWF_Table::rowEnd());
if ($tVars['has_fee']) {
    echo sprintf('%s<td>%s</td><td>%s</td><td>%s</td>%s', GWF_Table::rowStart(), $tLang->lang('th_fee_per'), $tVars['fee_percent'], $tVars['fee'], GWF_Table::rowEnd());
    echo sprintf('%s<td colspan="2">%s</td><td>%s</td>%s', GWF_Table::rowStart(), $tLang->lang('th_price_total'), $tVars['price_total'], GWF_Table::rowEnd());
}
echo sprintf('<tr><td colspan="3">%s</td></tr>', $tVars['buttons']);
?>
</table>
Beispiel #8
0
 public static function tableRowForm($th, $td)
 {
     if ($td === '') {
         return '';
     }
     return GWF_Table::rowStart() . '<th>' . $th . '</th>' . PHP_EOL . '<td>' . $td . '</td>' . PHP_EOL . GWF_Table::rowEnd();
 }
Beispiel #9
0
function gwfProfileRow($head, $value)
{
    return GWF_Table::rowStart() . sprintf('<th>%s</th><td>%s</td>', $head, $value) . GWF_Table::rowEnd();
}
Beispiel #10
0
<?php

echo sprintf('<h1><a href="%s">%s</a></h1>', $tVars['href_history'], $tLang->lang('box_title')) . PHP_EOL;
echo '<table id="gwf_shout_table">' . PHP_EOL;
foreach ($tVars['msgs'] as $msg) {
    $msg instanceof GWF_Shoutbox;
    $user = $msg->getUser();
    $color = wcShoutColorForUser($user);
    $style = 'background: #' . $color . ';';
    echo GWF_Table::rowStart($style);
    echo sprintf('<td>%s</td>', $msg->displayUsername()) . PHP_EOL;
    echo sprintf('<td>%s</td>', $msg->displayMessage()) . PHP_EOL;
    echo GWF_Table::rowEnd();
}
echo '</table>' . PHP_EOL;
require_once '_shout.php';
?>


<?php 
function wcShoutColorForUser($user)
{
    if ($user === false) {
        return '#fff';
    }
    $user->loadGroups();
    if ($user->isAdmin()) {
        return 'ff8';
    }
    if ($user->isInGroupName('moderator')) {
        return 'f88';
Beispiel #11
0
$samescore = 0;
echo $tVars['pagemenu'];
echo '<table>' . PHP_EOL;
// echo '<thead>'.PHP_EOL;
echo GWF_Table::displayHeaders2($headers);
// echo '</thead>'.PHP_EOL;
foreach ($tVars['userdata'] as $user) {
    $user instanceof GWF_User;
    //	var_dump($user->getGDOData());
    $score = $user->getLevel();
    if ($score !== $samescore) {
        $samerank = $rank;
        $samescore = $score;
    }
    $style = $samerank === $highlight_rank ? WC_HTML::styleSelected() : '';
    echo GWF_Table::rowStart(true, '', 'rank_' . $rank, $style);
    echo sprintf('<td>%s</td>', $samerank) . PHP_EOL;
    echo sprintf('<td>%s</td>', $user->displayCountryFlag()) . PHP_EOL;
    echo sprintf('<td>%s</td>', $user->displayProfileLink()) . PHP_EOL;
    echo sprintf('<td class="gwf_num">%s</td>', $user->getVar('nlinks'));
    echo sprintf('<td class="gwf_num">%s</td>', $user->getLevel()) . PHP_EOL;
    foreach ($tVars['langs'] as $i => $lang) {
        if ($user->hasVar('grank_' . $lang)) {
            $anchor = GWF_HTML::anchor(GWF_WEB_ROOT . 'lang_ranking/' . $isos[$i] . '/for/' . $user->urlencode2('user_name'), $user->getVar('grank_' . $lang, ''));
        } else {
            $anchor = '';
        }
        echo sprintf('<td class="gwf_num">%s</td>', $anchor) . PHP_EOL;
    }
    echo GWF_Table::rowEnd();
    $rank++;
Beispiel #12
0
    echo WC_HTML::tableRowForm($tLang->lang('th_site_usercount'), $site->getUsercount());
    echo WC_HTML::tableRowForm($tLang->lang('th_site_challcount'), $site->getChallcount());
    echo WC_HTML::tableRowForm($tLang->lang('th_site_linkcount'), $site->getLinkCount());
    echo WC_HTML::tableRowForm($tLang->lang('th_site_avg'), $site->displayAvg());
} else {
    echo WC_HTML::tableRowForm($tLang->lang('btn_warboxes'), $warboxes);
}
# Diff Votes
$vdif = $site->getVotesDif();
echo GWF_Table::rowStart() . '<th>' . $tLang->lang('th_site_dif') . '</th>' . PHP_EOL . '<td><span id="gwf_vsba_' . $vdif->getID() . '">' . $vdif->displayPercent() . '</span></td>' . PHP_EOL . GWF_Table::rowEnd();
if ($tVars['can_vote']) {
    echo WC_HTML::tableRowForm($tLang->lang('th_site_vote_dif'), $site->getVotesDif()->displayButtons());
}
# Fun Votes
$vfun = $site->getVotesFun();
echo GWF_Table::rowStart() . '<th>' . $tLang->lang('th_site_fun') . '</th>' . PHP_EOL . '<td><span id="gwf_vsba_' . $vfun->getID() . '">' . $vfun->displayPercent() . '</span></td>' . PHP_EOL . GWF_Table::rowEnd();
if ($tVars['can_vote']) {
    echo WC_HTML::tableRowForm($tLang->lang('th_site_vote_fun'), $site->getVotesFun()->displayButtons());
}
echo WC_HTML::tableRowForm($tLang->lang('th_site_irc'), $site->displayIRC());
?>
</table>

<?php 
if ($tVars['jquery']) {
    return;
}
?>

<?php 
$count = count($tVars['latest_players']);
Beispiel #13
0
$epoch = $tVars['epoch'] === false ? '<i><b>epoch</b></i>' : $tVars['epoch']->displayProfileLink();
echo GWF_Box::box($tLang->lang('info_wartoken', array($epoch, '___RTB_LINK___')), $tLang->lang('title_wartoken'));
echo GWF_Box::box($tVars['token'], $tLang->lang('title_your_wartoken'));
$boxes_out = '';
if (count($tVars['warboxes']) > 0) {
    $boxes_out .= GWF_Table::start();
    $old_id = '0';
    foreach ($tVars['warboxes'] as $box) {
        $box instanceof WC_Warbox;
        $site = $box->getSite();
        if ($old_id !== $site->getID()) {
            $old_id = $site->getID();
            $headers = array(array($site->displayLogo(16)), array($site->displayLink()), array('IP'), array('Login'), array('Password'), array('Levels'), array('Status'), array('Flags'));
            $boxes_out .= GWF_Table::displayHeaders1($headers);
        }
        $boxes_out .= GWF_Table::rowStart();
        $boxes_out .= GWF_Table::column($box->getID());
        $boxes_out .= GWF_Table::column($box->displayLink());
        $boxes_out .= GWF_Table::column($box->getVar('wb_ip'), 'gwf_num');
        $boxes_out .= GWF_Table::column($box->display('wb_user'));
        $boxes_out .= GWF_Table::column($box->display('wb_pass'));
        $boxes_out .= GWF_Table::column($box->displayLevels(), 'gwf_num');
        $boxes_out .= GWF_Table::column(WC_HTML::lang('wb_' . $box->getVar('wb_status')), 'gwf_num');
        if ($box->hasWarFlags()) {
            $boxes_out .= GWF_Table::column(GWF_Button::forward($box->hrefFlags()));
        } else {
            $boxes_out .= GWF_Table::column();
        }
        $boxes_out .= GWF_Table::rowEnd();
    }
    $boxes_out .= GWF_Table::end();