示例#1
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $stats = explode(':', $result);
     if (count($stats) !== 7) {
         //			if ($result === '0') {
         //				return array(0, 0);
         //			}
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     # username:rank:score:maxscore:challssolved:challcount:usercount
     $uname = $stats[0];
     $rank = intval($stats[1]);
     $onsitescore = intval($stats[2]);
     $maxscore = intval($stats[3]);
     $challssolved = intval($stats[4]);
     $challcount = intval($stats[5]);
     $usercount = intval($stats[6]);
     if ($maxscore === 0 || $challcount === 0 || $usercount === 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($onsitescore, $rank, $challssolved, $maxscore, $usercount, $challcount);
 }
示例#2
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $result = str_replace("", '', $result);
     # BOM
     $result = trim($result);
     $stats = explode(":", $result);
     if (count($stats) !== 7) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $i = 0;
     $username = $stats[$i++];
     $rank = intval($stats[$i++]);
     $onsitescore = intval($stats[$i++]);
     $onsitescore = Common::clamp($onsitescore, 0);
     $maxscore = intval($stats[$i++]);
     $challssolved = intval($stats[$i++]);
     $challcount = intval($stats[$i++]);
     $usercount = intval($stats[$i++]);
     if ($maxscore === 0 || $challcount === 0 || $usercount === 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($onsitescore, $rank, $challssolved, $maxscore, $usercount, $challcount);
 }
示例#3
0
 public static function insertEntry($siteid, $score, $usercount, $challcount, $comment = '')
 {
     $entry = new self(array('sitehist_sid' => $siteid, 'sitehist_date' => time(), 'sitehist_score' => $score, 'sitehist_usercount' => $usercount, 'sitehist_challcount' => $challcount, 'sitehist_comment' => $comment));
     if (WECHALL_DEBUG_SCORING) {
         echo WC_HTML::message('Inserting Site History Item...');
     }
     return $entry->insert();
 }
示例#4
0
 public function parseStats($url)
 {
     $result2 = GWF_HTTP::getFromURL($url, false);
     $result = explode(':', $result2);
     if (count($result) !== 6) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result2), $this->displayName())));
     }
     list($rank, $score, $maxscore, $challsolved, $challcount, $usercount) = $result;
     return array(intval($score), (int) $rank, $challsolved, $maxscore, $usercount, $challcount);
 }
示例#5
0
 public function execute()
 {
     GWF3::setConfig('log_request', false);
     $back = array();
     $user = GWF_User::getStaticOrGuest();
     $back['news'] = (int) $this->module->getNewsCount();
     $back['pm'] = (int) WC_HTML::getUnreadPMCount($user);
     $back['links'] = (int) WC_HTML::getUnreadLinksCount($user);
     $back['forum'] = (int) WC_HTML::getUnreadThreadCount($user);
     return json_encode($back);
 }
示例#6
0
 public static function insertEntry(GWF_User $user, WC_Site $site, $onsitescore, $comment)
 {
     $user = GWF_User::getByID($user->getID());
     $max = $site->getOnsiteScore();
     $perc = $max <= 0 ? 0 : round($onsitescore / $max * 10000);
     $entry = new self(array('userhist_uid' => $user->getVar('user_id'), 'userhist_date' => time(), 'userhist_sid' => $site->getVar('site_id'), 'userhist_percent' => $perc, 'userhist_onsitescore' => $onsitescore, 'userhist_rank' => WC_RegAt::calcRank($user), 'userhist_totalscore' => $user->getVar('user_level'), 'userhist_comment' => $comment));
     if (WECHALL_DEBUG_SCORING) {
         echo WC_HTML::message('Inserting User History entry...');
     }
     return $entry->insert();
 }
示例#7
0
文件: Challs.php 项目: sinfocol/gwf3
 public function execute()
 {
     Module_WeChall::includeForums();
     if (false !== ($cid = Common::getGet('solver'))) {
         return $this->templateSolvers($cid);
     }
     WC_HTML::$RIGHT_PANEL = WC_HTML::$LEFT_PANEL = -1;
     $for_userid = GWF_Session::getUserID();
     $from_userid = false;
     $tag = Common::getGetString('tag', '');
     $by = $_GET['by'] = Common::getGetString('by', self::DEFAULT_BY);
     $dir = $_GET['dir'] = Common::getGetString('dir', self::DEFAULT_DIR);
     return $this->templateChalls($for_userid, $from_userid, $tag, $by, $dir);
 }
示例#8
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $stats = explode(':', $result);
     if (count($stats) !== 3) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     list($onsitescore, $challcount, $usercount) = $stats;
     if ($challcount == 0 || $usercount == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($onsitescore, -1, -1, $challcount, $usercount, $challcount);
 }
示例#9
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $result = explode(":", $result);
     if (count($result) !== 4) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     list($rank, $score, $challcount, $usercount) = $result;
     if ($rank < 1 || $challcount == 0 || $usercount == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($score, $rank, $score, $challcount, $usercount, $challcount);
 }
示例#10
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $stats = explode(":", $result);
     if (count($stats) !== 4) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     if ($stats[0] < 0 || $stats[0] > $stats[1] || $stats[3] == 0 || $stats[2] == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $score = round($stats[0] / $stats[1] * 10000);
     return array($score, -1, -1, 10000, $stats[3], $stats[2]);
 }
示例#11
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $data = explode(':', $result);
     if (count($data) !== 5) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     list($rank, $score, $maxscore, $usercount, $challcount) = $data;
     if ($rank == 0 || $maxscore == 0 || $usercount == 0 || $challcount == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array(round($score), $rank, -1, $maxscore, $usercount, $challcount);
 }
示例#12
0
 public function parseStats($url)
 {
     $result = GWF_HTTP::getFromURL($url, false);
     if ($result === false) {
         return false;
     }
     if ($result === "Unknown User") {
         return htmlDisplayError(WC_HTML::lang('err_onsitename', array($this->displayName())));
     }
     $data = explode(":", $result);
     if (count($data) !== 5 || $data[3] < 0 || $data[3] > $data[4] || $data[2] == 0 || $data[4] == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($data[3], Common::clamp($data[1], 0), $data[3], $data[4], $data[2], $data[4]);
 }
示例#13
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $data = explode(":", $result);
     if (count($data) !== 7) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $challcount = isset($data[5]) ? intval($data[5]) : $this->getVar('challcount');
     $usercount = isset($data[6]) ? intval($data[6]) : $this->getVar('usercount');
     if ($data[1] < 0 || $data[1] > $data[2] || $challcount == 0 || $usercount == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($data[1], $data[4], -1, $data[2], $usercount, $challcount);
 }
示例#14
0
 public function execute()
 {
     if (false === ($this->user = GWF_Session::getUser())) {
         return GWF_HTML::err('ERR_LOGIN_REQUIRED');
     }
     $this->module->includeClass('WC_Warbox');
     $this->module->includeClass('WC_Warflag');
     $this->module->includeClass('WC_SiteAdmin');
     $this->module->includeClass('WC_SiteCats');
     $this->module->includeClass('sites/warbox/WCSite_WARBOX');
     if (false === ($this->warbox = WC_Warbox::getByID(Common::getGetString('wbid')))) {
         return WC_HTML::error('err_warbox');
     }
     if (!$this->warbox->hasEditPermission($this->user)) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     if (isset($_GET['edit'])) {
         if (false === ($this->flag = WC_Warflag::getByID(Common::getGetString('edit')))) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         if (isset($_POST['edit'])) {
             return $this->onEdit();
         } else {
             return $this->templateEdit();
         }
     }
     if (isset($_POST['add'])) {
         return $this->onAdd();
     }
     if (isset($_GET['add'])) {
         return $this->templateAdd();
     }
     if (isset($_POST['import'])) {
         return $this->onCSVImport();
     }
     if (isset($_GET['export'])) {
         return $this->onCSVExport();
     }
     if (isset($_GET['up'])) {
         return $this->onUp() . $this->templateOverview();
     } elseif (isset($_GET['down'])) {
         return $this->onDown() . $this->templateOverview();
     }
     return $this->templateOverview();
 }
示例#15
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $stats = explode(':', $result);
     if (count($stats) < 2) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $onsitescore = intval($stats[0]);
     $maxscore = intval($stats[1]);
     $challcount = $maxscore;
     $usercount = intval($stats[2]);
     if ($onsitescore === 0 || $maxscore === 0 || $challcount === 0 || $usercount === 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($onsitescore, -1, $onsitescore, $maxscore, $usercount, $challcount);
 }
示例#16
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $stats = explode(":", $result);
     if (count($stats) < 3) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $challs = $stats[1];
     $done = $stats[0];
     #$usercount = $stats[2];
     if ($challs == 0) {
         # || $usercount == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($done, -1, $done, $challs, 0, $challs);
 }
示例#17
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $data = explode(':', $result);
     $percent = $data[0];
     if (!is_numeric($percent) || $percent < 0 || $percent > 1) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $usercount = isset($data[1]) ? $data[1] : $this->getUsercount();
     if ($usercount == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $maxscore = $this->getOnsiteScore();
     $challcount = $this->getChallcount();
     return array(round($percent * $maxscore), -1, -1, $maxscore, $usercount, $challcount);
 }
示例#18
0
文件: index.php 项目: sinfocol/gwf3
function sidologyRemixCheckAnswer(WC_Challenge $chall, $answer)
{
    if (false !== ($error = $chall->isAnswerBlocked(GWF_User::getStaticOrGuest()))) {
        echo $error;
        return;
    }
    $solution = '726f3a30c8ae485b4f34d5ff0fed05552d3da60b';
    # :) HappyCracking!
    $hash = $answer;
    for ($i = 0; $i < 100000; $i++) {
        $hash = sha1($hash);
    }
    // 	echo "$hash<br/>\n";
    if ($hash === $solution) {
        $chall->onChallengeSolved();
    } else {
        echo WC_HTML::error('err_wrong');
    }
}
示例#19
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $data = explode(":", $result);
     if (count($data) !== 5) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $rank = (int) $data[0];
     $score = (int) ($data[1] * 100);
     $maxscore = (int) ($data[2] * 100);
     $users = (int) $data[3];
     $challs = (int) $data[4];
     if ($score > $maxscore || $score < 0 || $maxscore == 0 || $challs == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($score, $rank, -1, $maxscore, $users, $challs);
 }
示例#20
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $stats = explode(":", $result);
     if (count($stats) < 3) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $onsitescore = intval($stats[0]);
     $onsitescore = Common::clamp($onsitescore, 0);
     $maxscore = intval($stats[1]);
     $usercount = intval($stats[2]);
     $onsiterank = isset($stats[3]) ? intval($stats[3]) : -1;
     $challcount = $maxscore;
     if ($maxscore === 0 || $challcount === 0 || $usercount === 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($onsitescore, $onsiterank, $onsitescore, $maxscore, $usercount, $challcount);
 }
示例#21
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $stats = explode(":", $result);
     if (count($stats) !== 4) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $onsitescore = intval($stats[2]);
     $score = intval($stats[1]);
     $rankname = $stats[0];
     $usercount = 39500;
     $challcount = 102;
     #intval($stats[3]);
     if ($score > $onsitescore * 2 || $challcount <= 2 || $onsitescore < 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($score, -1, -1, $onsitescore, $usercount, $challcount);
 }
示例#22
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $data = explode(':', $result);
     if (count($data) !== 6) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $rank = (int) $data[0];
     $score = (int) $data[1];
     $maxscore = (int) $data[2];
     // on site max score
     $usercount = (int) $data[3];
     $challcount = (int) ($data[4] = (int) $maxscore);
     $onsitename = (int) $data[5];
     if ($score > $maxscore || $score < 0 || $challcount == 0 || $usercount == 0 || $maxscore == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($score, $rank, -1, $maxscore, $usercount, $challcount);
 }
示例#23
0
 public function parseStats($url)
 {
     if (false === ($page = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($page), $this->displayName())));
     }
     $result = explode(':', trim($page));
     if (count($result) !== 6) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($page), $this->displayName())));
     }
     $i = 0;
     $username = $result[$i++];
     $rank = -1;
     $score = $result[$i++];
     $maxscore = $result[$i++];
     $challssolved = $result[$i++];
     $challcount = $result[$i++];
     $usercount = $result[$i++];
     if ($maxscore === 0 || $challcount === 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($score, $rank, $challssolved, $maxscore, $usercount, $challcount);
 }
示例#24
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $file = explode('<br>', $result);
     if (count($file) !== 5) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     //		$ranking = $file[1];
     list($ranking, $usercount) = explode('/', trim(Common::substrFrom($file[1], ':')));
     //		$usercount = Common::substrFrom($ranking, "/");
     $challstats = $file[3];
     $challcount = Common::substrFrom($challstats, "/");
     $points = $file[2];
     $back = array();
     preg_match('#(\\d*)\\/(\\d*)#', $points, $back);
     if (count($back) !== 3 || $back[1] < 0 || $back[1] > $back[2] || $usercount == 0 || $challcount == 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($back[1], $ranking, -1, $back[2], $usercount, $challcount);
 }
示例#25
0
 public function parseStats($url)
 {
     if (false === ($result = GWF_HTTP::getFromURL($url, false))) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     $stats = explode(':', $result);
     if (count($stats) != 7) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     # username:rank:score:maxscore:challssolved:challcount:usercount
     $i = 0;
     $username = $stats[$i++];
     $onsitesrank = (int) $stats[$i++];
     $onsitescore = (int) $stats[$i++];
     $maxscore = (int) $stats[$i++];
     $challssolved = (int) $stats[$i++];
     $challcount = (int) $stats[$i++];
     $usercount = (int) $stats[$i++];
     if ($maxscore === 0 || $challcount === 0 || $usercount === 0) {
         return htmlDisplayError(WC_HTML::lang('err_response', array(GWF_HTML::display($result), $this->displayName())));
     }
     return array($onsitescore, $onsitesrank, $challssolved, $maxscore, $usercount, $challcount);
 }
示例#26
0
文件: form.php 项目: sinfocol/gwf3
<?php

echo WC_HTML::accountButtons();
echo $tVars['form'];
echo $tVars['form_gpg'];
示例#27
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'));
示例#28
0
        echo $btn_boxes;
        echo WC_HTML::button('btn_ranking', $SITE->hrefRanking(true));
        break;
    default:
        echo WC_HTML::button('btn_site_details', $SITE->hrefDetail());
        echo $btn_boxes;
        echo WC_HTML::button('btn_ranking', $SITE->hrefRanking(true));
        echo WC_HTML::button('btn_site_history', $SITE->hrefHistory());
        break;
}
echo '&nbsp;|&nbsp;' . PHP_EOL;
echo WC_HTML::button('btn_all_sites', GWF_WEB_ROOT . 'all_sites', $which === '5');
echo WC_HTML::button('btn_active_sites', GWF_WEB_ROOT . 'active_sites', $which === '1');
echo WC_HTML::button('btn_graveyard', GWF_WEB_ROOT . 'graveyard', $which === '2');
echo WC_HTML::button('btn_not_ranked', GWF_WEB_ROOT . 'not_ranked', $which === '4');
echo WC_HTML::button('btn_coming_soon', GWF_WEB_ROOT . 'coming_soon', $which === '3');
echo '</div>' . PHP_EOL;
### Helper
# Output 1 select
function wcSiteQJSel($text, $sites, $mode, $nqj)
{
    echo '<select name="quickjumps[' . $nqj . ']" onchange="wcSiteQuickqump(this, \'' . $mode . '\', 1);">' . PHP_EOL;
    echo '<option value="0">' . $text . '</option>';
    foreach ($sites as $site) {
        $site instanceof WC_Site;
        // 		switch ($mode)
        // 		{
        // 			case 'detail':
        // 				$href = $site->hrefDetail();
        // 				break;
        // 			case 'ranking':
示例#29
0
 public static function insertEntry(GWF_User $user, WC_Site $site, $type, $onsitescore_new = 0, $onsitescore_old = 0, $scoregain = 0, $onsiterank = 0)
 {
     $uid = $user->getID();
     $user = GWF_User::getByID($uid);
     $max = $site->getOnsiteScore();
     $perc_new = $max <= 0 ? 0 : round($onsitescore_new / $max * 10000);
     $perc_old = $max <= 0 ? 0 : round($onsitescore_old / $max * 10000);
     $perc_gain = $perc_new - $perc_old;
     $options = 0;
     $data = $user->getUserData();
     if (isset($data['WC_NO_XSS'])) {
         $options |= self::NO_XSS;
     }
     $entry = new self(array('userhist_uid' => $uid, 'userhist_date' => time(), 'userhist_sid' => $site->getID(), 'userhist_percent' => $perc_new, 'userhist_onsitescore' => $onsitescore_new, 'userhist_rank' => WC_RegAt::calcExactRank($user), 'userhist_totalscore' => $user->getVar('user_level'), 'userhist_gain_perc' => $perc_gain, 'userhist_gain_score' => $scoregain, 'userhist_type' => $type, 'userhist_onsiterank' => $onsiterank, 'userhist_options' => $options));
     if (WECHALL_DEBUG_SCORING) {
         echo WC_HTML::message('Inserting User History entry...');
     }
     return $entry->insert();
 }
示例#30
0
</th>
	</tr>
<?php 
for ($i = 0; $i <= 11; $i++) {
    ?>
	<?php 
    echo GWF_Table::rowStart();
    ?>
		<?php 
    echo sprintf('<th>%s</th>', $i === 11 ? $tLang->lang('th_avg') : $i);
    ?>
		<?php 
    echo sprintf('<td><div style="width: %s%%; background-color: #%s;">%s%% (%d votes)</div></td>', round($dif[$i][1]), WC_HTML::getColorForPercent($dif[$i][1]), $dif[$i][1], $dif[$i][0]);
    ?>
		<?php 
    echo sprintf('<td><div style="width: %s%%; background-color: #%s;">%s%% (%d votes)</div></td>', round($edu[$i][1]), WC_HTML::getColorForPercent($edu[$i][1]), $edu[$i][1], $edu[$i][0]);
    ?>
		<?php 
    echo sprintf('<td><div style="width: %s%%; background-color: #%s;">%s%% (%d votes)</div></td>', round($fun[$i][1]), WC_HTML::getColorForPercent($fun[$i][1]), $fun[$i][1], $fun[$i][0]);
    ?>
	<?php 
    echo GWF_Table::rowEnd();
}
?>
</table>
</div>

<?php 
if ($tVars['has_solved']) {
    echo $tVars['form_vote'];
}