Beispiel #1
0
 private function templateEdit()
 {
     $groups = GDO::table('GWF_UserGroup');
     $gid = $this->group->getID();
     $conditions = "ug_groupid={$gid}";
     $ipp = $this->module->cfgUsersPerPage();
     $nItems = $groups->countRows($conditions);
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(Common::getGet('page', 1), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $tVars = array('group' => $this->group, 'form' => $this->getForm()->templateY($this->module->lang('ft_edit_group', array($this->group->display('group_name')))), 'form_add' => $this->getFormAdd()->templateX($this->module->lang('ft_add_to_group'), $this->getMethodHREF('&gid=' . $gid)), 'userids' => $groups->selectColumn('ug_userid', $conditions, '', NULL, $ipp, $from), 'pagemenu' => GWF_PageMenu::display($page, $nPages, $this->getMethodHref(sprintf('&gid=%d&page=%%PAGE%%', $gid))), 'sort_url' => '', 'headers' => GWF_Table::displayHeaders1(array(array($this->module->lang('th_user_name')), array('')), ''));
     return $this->module->template('groupedit.tpl', $tVars);
 }
Beispiel #2
0
 private function templateModules()
 {
     $gdo = GDO::table('GWF_Module');
     $by = $gdo->getWhitelistedBy(Common::getGetString('by'), 'module_name');
     $dir = GDO::getWhitelistedDirS(Common::getGetString('dir', 'ASC'));
     $headers = array(array($this->module->lang('th_priority'), 'module_priority', 'ASC'), array($this->module->lang('th_move')), array($this->module->lang('th_name'), 'module_name', 'ASC'), array($this->module->lang('th_version_db')), array($this->module->lang('th_version_hd')), array($this->module->lang('th_install')), array($this->module->lang('th_basic')), array($this->module->lang('th_adv')));
     $modules = $this->module->getAllModules($by, $dir);
     # Need install?
     $install_all = '';
     foreach ($modules as $name => $d) {
         if (!$d['enabled']) {
             continue;
         }
         if ($d['vdb'] < $d['vfs']) {
             $install_all = $this->module->lang('install_info', array(Module_Admin::getInstallAllURL()));
             break;
         }
     }
     $tVars = array('modules' => $modules, 'install_all' => $install_all, 'tablehead' => GWF_Table::displayHeaders1($headers, Module_Admin::getSortURL('%BY%', '%DIR%'), 'module_name', 'ASC'), 'install' => $this->module->lang('btn_install'), 'configure' => $this->module->lang('btn_config'), 'adminsect' => $this->module->lang('btn_admin_section'));
     return $this->module->template('modules.tpl', $tVars);
 }
Beispiel #3
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 #4
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 #5
0
 private function templateHistory()
 {
     $userid = GWF_Session::getUser()->getID();
     $history = GDO::table('GWF_LoginHistory');
     $conditions = "loghis_uid={$userid}";
     $nItems = $history->countRows($conditions);
     $ipp = 50;
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(Common::getGet('page', 1), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $by = Common::getGet('by');
     $dir = Common::getGet('dir');
     $orderby = $history->getMultiOrderby($by, $dir);
     $form = $this->formDelete();
     $headers = array(array($this->module->lang('th_loghis_time'), 'loghis_time'), array($this->module->lang('th_loghis_ip'), 'loghis_ip'), array($this->module->lang('th_hostname')));
     if (false !== ($c = GWF_LoginCleared::getCleared($userid))) {
         $cleared = $this->module->lang('info_cleared', array($c->displayDate(), $c->displayIP(), $c->displayHost()));
     } else {
         $cleared = '';
     }
     $tVars = array('tablehead' => GWF_Table::displayHeaders2($headers), 'history' => $history->selectObjects('*', $conditions, $orderby, $ipp, $from), 'pagemenu' => GWF_PageMenu::display($page, $nPages, $this->module->getMethodURL('History', '&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=%PAGE%')), 'form' => $form->templateX($this->module->lang('ft_clear')), 'cleared' => $cleared);
     return $this->module->template('history.tpl', $tVars);
 }
Beispiel #6
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 #7
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 #8
0
<p><?php 
echo $tLang->lang('pi_trashcan');
?>
</p>
<?php 
echo $tVars['pagemenu'];
$headers = array(array($tLang->lang('th_pm_options&1'), 'options&1', 'DESC'), array($tLang->lang('th_pm_date'), 'pm_date', 'DESC'), array($tLang->lang('th_pm_from'), 'T_B.user_name', 'ASC'), array($tLang->lang('th_pm_to'), 'T_A.user_name', 'ASC'), array($tLang->lang('th_pm_title'), 'pm_title', 'ASC'), array());
$data = array();
$uid = GWF_Session::getUserID();
echo sprintf('<form id="gwf_pm_form" method="post" action="%s">', $tVars['form_action']);
//echo sprintf('<table>');
foreach ($tVars['pms'] as $pm) {
    $pm instanceof GWF_PM;
    //	$is_read = $pm->isOptionEnabled(GWF_PM::READ);
    //	$is_sender = $pm->getSender()->getID() === $uid;
    //	$is_deleted = $pm->getReceiver()->
    //	$class =  $is_sender ? ($is_read ? 'gwf_pm_read' : 'gwf_pm_unread') : ($is_read ? 'gwf_pm_new' : 'gwf_pm_old');
    $data[] = array(sprintf('<span class="%s" />', $pm->getHTMLClass()), sprintf('%s', GWF_Time::displayDate($pm->getVar('pm_date'))), sprintf('%s', $pm->getSender()->display('user_name')), sprintf('%s', $pm->getReceiver()->display('user_name')), sprintf('%s', GWF_HTML::anchor($pm->getDisplayHREF(), $pm->getVar('pm_title'))), sprintf('<input type="checkbox" name="pm[%s]" />', $pm->getID()));
}
$headers = GWF_Table::getHeaders2($headers, $tVars['sort_url']);
$btns = '<input type="submit" name="restore" value="' . $tLang->lang('btn_restore') . '" />';
$raw_body = '<tr><td colspan="4"></td><td class="ri">' . $btns . '</td><td>' . '<input type="checkbox" onclick="gwfPMToggleAll(this.checked);"/>' . '</td></tr>';
echo GWF_Table::display2($headers, $data, $tVars['sort_url'], '', $raw_body);
//echo sprintf('</table>');
echo sprintf('</form>');
echo $tVars['form_empty'];
Beispiel #9
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 #10
0
$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();
}
echo GWF_Box::box($boxes_out . $tLang->lang('info_warboxes', array($tVars['port'], $tVars['netcat_cmd'], GWF_WEB_ROOT . 'linked_sites', GWF_WEB_ROOT . 'index.php?mo=WeChall&amp;me=JoinUs&amp;section=warbox')), $tLang->lang('title_warboxes'));
echo GWF_Box::box($tLang->lang('info_warcredits', array($epoch)), $tLang->lang('title_warcredits'));
Beispiel #11
0
 private function templateAdmin()
 {
     $headers = array(array($this->module->lang('th_username'), 'username', 'ASC'), array($this->module->lang('th_token'), 'token', 'ASC'), array($this->module->lang('th_email'), 'email', 'ASC'), array($this->module->lang('th_birthdate'), 'birthdate', 'ASC'), array($this->module->lang('th_countryid'), 'countryid', 'ASC'), array($this->module->lang('th_timestamp'), 'timestamp', 'ASC'), array($this->module->lang('th_ip'), 'ip', 'ASC'));
     $tVars = array('headers' => GWF_Table::displayHeaders1($headers, GWF_WEB_ROOT . 'index.php?mo=Register&me=Admin&by=%BY%&dir=%DIR%&page=1'), 'activations' => $this->table->selectAll('*', '', $this->orderby, NULL, $this->ipp, GWF_PageMenu::getFrom($this->page, $this->ipp)), 'pagemenu' => $this->getPageMenu());
     return $this->module->template('admin.tpl', $tVars);
 }
Beispiel #12
0
<?php

echo WC_HTML::accountButtons();
echo GWF_Button::generic($tLang->lang('btn_auto_folder'), $tVars['href_auto_folder']);
echo $tVars['form'];
?>

<?php 
$headers = array(array($tLang->lang('th_user_name')), array($tLang->lang('th_actions')));
$data = array();
foreach ($tVars['ignores'] as $uname) {
    $del_href = GWF_WEB_ROOT . 'index.php?mo=PM&me=Options&unignore=' . urlencode($uname);
    $data[] = array(GWF_HTML::display($uname), GWF_Button::delete($del_href));
}
$headers = GWF_Table::getHeaders2($headers, '');
echo GWF_Table::display2($headers, $data, '');
?>

<?php 
echo $tVars['form_ignore'];
Beispiel #13
0
 private function pmTable()
 {
     $uid = GWF_Session::getUserID();
     $fid = $this->folder->getID();
     $conditions = "(pm_from={$uid} AND pm_from_folder={$fid}) OR (pm_to={$uid} AND pm_to_folder={$fid})";
     $sortURL = GWF_WEB_ROOT . 'pm/folder/' . $fid . '/' . $this->folder->urlencodeSEO('pmf_name') . '/by/%BY%/%DIR%/page-1';
     return GWF_Table::displayGDO2($this->module, GDO::table('GWF_PM'), GWF_Session::getUser(), $sortURL, $conditions, $this->module->cfgPMPerPage());
 }
Beispiel #14
0
# TITLE SELECT
$headers = array(array($tLang->lang('th_title')));
$data = array();
$iso = GWF_Language::getCurrentISO();
foreach ($tVars['titles'] as $d) {
    $newsid = $d[0];
    $title = $d[1];
    $catid = 0;
    $cat = 'FOO';
    //	$catid = (int) $d[1];
    //	$cat = $catid === 0 ? GWF_HTML::lang('no_category') : $d[2];
    //	$cat = Common::urlencodeSEO($cat);
    $url = sprintf(GWF_WEB_ROOT . 'news/%s/%d/%s/%s/%s#newsid%s', $iso, $catid, urlencode($cat), $newsid, Common::urlencodeSEO($title), $newsid);
    $data[] = array(sprintf('<a href="%s">%s</a>', $url, $title));
}
echo GWF_Table::display($headers, '', $data, 'date', 'DESC');
?>
</div>


<div class="gwf_newsbox">
<?php 
foreach ($tVars['news'] as $news) {
    ?>
<div class="gwf_newsbox_item gwf_tr_<?php 
    $id = 1 - $id;
    echo $id;
    ?>
">
	<div><a name="newsid<?php 
    echo $news['news_id'];
Beispiel #15
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 #16
0
    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);
}
function hashgame_longest_two(array $list)
{
    usort($list, 'sort_strlen');
Beispiel #17
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 #18
0
function gwfProfileRow($head, $value)
{
    return GWF_Table::rowStart() . sprintf('<th>%s</th><td>%s</td>', $head, $value) . GWF_Table::rowEnd();
}
Beispiel #19
0
<?php

$headers = array(array($tLang->lang('th_username'), 'username', 'ASC'), array($tLang->lang('th_token'), 'token', 'ASC'), array($tLang->lang('th_email'), 'email', 'ASC'), array($tLang->lang('th_birthdate'), 'birthdate', 'ASC'), array($tLang->lang('th_countryid'), 'countryid', 'ASC'), array($tLang->lang('th_timestamp'), 'timestamp', 'ASC'), array($tLang->lang('th_ip'), 'ip', 'ASC'));
$data = array();
foreach ($tVars['activations'] as $ua) {
    $ua instanceof GWF_UserActivation;
    $data[] = array($ua->display('username'), $ua->getVar('token'), $ua->display('email'), $ua->displayBirthdate(), $ua->displayCountry(), $ua->displayTimestamp(), $ua->displayIP());
}
echo $tVars['pagemenu'];
echo GWF_Table::display($headers, $tVars['sort_url'], $data, $tVars['by'], $tVars['dir']);