Example #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())));
     }
     $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);
 }
Example #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())));
     }
     $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);
 }
Example #3
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);
 }
Example #4
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);
 }
Example #5
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]);
 }
Example #6
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);
 }
Example #7
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);
 }
Example #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) !== 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]);
 }
Example #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())));
     }
     $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);
 }
Example #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) < 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);
 }
Example #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);
     $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);
 }
Example #12
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);
 }
Example #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) !== 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);
 }
Example #14
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);
 }
Example #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) !== 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);
 }
Example #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())));
     }
     $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);
 }
Example #17
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);
 }
Example #18
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);
 }
Example #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())));
     }
     $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);
 }
Example #20
0
<?php

echo GWF_Button::wrapStart();
echo GWF_Button::generic($tLang->lang('menu_sites'), $tVars['href_site']);
echo GWF_Button::generic($tLang->lang('btn_edit_site_descr'), $tVars['href_descr']);
echo GWF_Button::wrapEnd();
echo GWF_Table::start();
$headers = array(array('EDIT'), array('ID'), array('NAME'), array('HOST'), array('IP'), array('STATUS'));
echo GWF_Table::displayHeaders1($headers);
foreach ($tVars['boxes'] as $box) {
    $box instanceof WC_Warbox;
    echo GWF_Table::rowStart();
    echo GWF_Table::column(GWF_Button::edit($box->hrefEdit()));
    echo GWF_Table::column($box->getID());
    echo GWF_Table::column($box->display('wb_name'));
    echo GWF_Table::column($box->displayLink());
    echo GWF_Table::column($box->getVar('wb_ip'));
    echo GWF_Table::column(WC_HTML::lang('wb_' . $box->getVar('wb_status')));
    echo GWF_Table::rowEnd();
}
echo GWF_Table::end();
echo GWF_Button::wrapStart();
echo GWF_Button::add('Add a new warbox', $tVars['href_add']);
echo GWF_Button::wrapEnd();
Example #21
0
 public function displayComment()
 {
     return WC_HTML::lang('userhist_' . $this->getVar('userhist_type'), array($this->getSite()->displayName(), $this->getVar('userhist_gain_score'), sprintf('%.02f', $this->getVar('userhist_percent') / 100), sprintf('%.02f', $this->getVar('userhist_gain_perc') / 100)));
 }
Example #22
0
<?php

echo WC_HTML::accountButtons();
?>

<?php 
$user = GWF_Session::getUser();
if (false !== ($mod_gb = GWF_Module::getModule('Guestbook'))) {
    $mod_gb->onInclude();
    if (false !== ($gb = $mod_gb->getGuestbook($user->getID()))) {
        echo GWF_Button::generic(WC_HTML::lang('btn_manage_gb'), $gb->hrefEdit());
    } elseif ($mod_gb->canCreateGuestbook($user)) {
        echo GWF_Button::generic(WC_HTML::lang('btn_manage_gb'), Module_WeChall::hrefCreateGB());
    }
}
//
//if (false !== ($mod_ug = GWF_Module::getModule('Usergroups'))) {
//	if ($mod_ug->hasGroup($user)) {
//		echo GWF_Button::generic(WC_HTML::lang('btn_manage_ug'), $mod_ug->hrefEdit($user->getID()));
//	}
//	elseif ($mod_ug->canCreateGroup($user)) {
//		echo GWF_Button::generic(WC_HTML::lang('btn_manage_ug'), $mod_ug->hrefCreate());
//	}
//}
?>
<h1><?php 
echo $tLang->lang('ft_settings');
?>
</h1>
<p><?php 
echo $tLang->lang('pi_help');
Example #23
0
 private function displayBirthdays(array $userdate)
 {
     # more vars
     $today = date('md');
     $tommorow = date('md', time() + GWF_Time::ONE_DAY);
     $yesterday = date('md', time() - GWF_Time::ONE_DAY);
     # Output
     $href = '/index.php?mo=WeChall&me=BirthdayRead';
     $title = $this->lang('bdnews_title');
     $text = $this->lang('bdnews_body_init', array($href));
     $weekdays = GWF_Time::getWeekdaysFromMo();
     $i = -1;
     foreach ($userdate as $date => $data) {
         $i++;
         if (count($data) === 0) {
             continue;
         }
         $day = $weekdays[$i];
         if ($date === $yesterday) {
             $day = WC_HTML::lang('Yesterday');
         } elseif ($date === $today) {
             $day = '[b]' . WC_HTML::lang('Today') . '[/b]';
         } elseif ($date === $tommorow) {
             $day = WC_HTML::lang('Tommorow');
         } elseif ($date < $today) {
             $day = WC_HTML::lang('bd_over', array($day));
         } elseif ($date > $today) {
             $day = WC_HTML::lang('bd_soon', array($day));
         }
         $text .= $day . ': ';
         $app = '';
         foreach ($data as $username) {
             $app .= sprintf(', [url=/profile/%s]%s[/url]', urlencode($username), htmlspecialchars($username));
             //				$text .= $day.': '.implode(', ', $data).PHP_EOL;
         }
         $text .= substr($app, 2) . PHP_EOL;
         //			$text .= $day.': '.implode(', ', $data).PHP_EOL;
     }
     $wechalluser = Module_WeChall::instance()->cfgWeChallUser();
     $english = GWF_Language::getEnglish();
     $news = GWF_News::newNews(GWF_Time::getDate(GWF_Date::LEN_SECOND), 0, $wechalluser->getID(), $english->getID(), $title, $text, true);
     return Module_News::displayItem($news);
 }
Example #24
0
} else {
    echo gwfProfileRow(WC_HTML::lang('th_score'), GWF_HTML::anchor(GWF_WEB_ROOT . 'stats/' . $u->urlencode('user_name'), $u->getVar('user_level')));
}
if (isset($data['WC_HIDE_RANK'])) {
    echo gwfProfileRow(WC_HTML::lang('th_rank2'), $wechall->lang('hidden'));
} else {
    $rank = WC_RegAt::calcRank($u);
    echo gwfProfileRow(WC_HTML::lang('th_rank2'), GWF_HTML::anchor(GWF_WEB_ROOT . 'ranking/player/' . $u->urlencode2('user_name') . '#rank_' . $rank, $rank));
}
if ($u->getVar('user_countryid') !== '0') {
    if (isset($data['WC_HIDE_RANK'])) {
        echo gwfProfileRow(WC_HTML::lang('th_crank'), $wechall->lang('hidden'));
    } else {
        $cRank = WC_Regat::calcCountryRank($u);
        $href_crank = GWF_WEB_ROOT . 'country_ranking/player/' . $u->urlencode2('user_name') . '#rank_' . $cRank;
        echo gwfProfileRow(WC_HTML::lang('th_crank'), GWF_HTML::anchor($href_crank, $cRank));
    }
}
echo gwfProfileRow($tLang->lang('th_registered'), GWF_Time::displayDate($u->getVar('user_regdate')));
if ($u->isOptionEnabled(GWF_User::HIDE_ONLINE)) {
    $lastactivity = GWF_HTML::lang('unknown');
} else {
    $lastactivity = GWF_Time::displayTimestamp($u->getVar('user_lastactivity'));
}
echo gwfProfileRow($tLang->lang('th_last_active'), $lastactivity);
echo gwfProfileRow($tLang->lang('th_views'), $p->getVar('prof_views'));
if ('' !== ($v = $p->display('prof_firstname'))) {
    echo gwfProfileRow($tLang->lang('th_firstname'), $v);
}
if ('' !== ($v = $p->display('prof_lastname'))) {
    echo gwfProfileRow($tLang->lang('th_lastname'), $v);
Example #25
0
function math_pyramid_check(WC_Challenge $chall, $formula, $maxlen, $precision = 4)
{
    error_reporting(E_ERROR);
    GWF_Debug::setDieOnError(false);
    GWF_Debug::setMailOnError(false);
    $len = strlen($formula);
    $tests = array('0' => 0, '1' => 0.2357, '3.14' => 7.2971, '10' => 235.7023, '100' => 235702.2604);
    $eval = new EvalMath();
    $fa = "f(a) = {$formula}";
    if (false === $eval->evaluate($fa)) {
        echo GWF_HTML::error('Math Pyramid', $chall->lang('err_formula', array(htmlspecialchars($fa))));
        return false;
    }
    GWF_Debug::setDieOnError(true);
    GWF_Debug::setMailOnError(true);
    $back = GWF_HTML::message('Math Pyramid', $chall->lang('msg_formula', array(htmlspecialchars($fa))), false);
    $correct = 0;
    foreach ($tests as $a => $result) {
        $result2 = $eval->evaluate("f({$a})");
        $result = sprintf('%.0' . $precision . 'f', $result);
        $result2 = sprintf('%.0' . $precision . 'f', $result2);
        if ($result === $result2) {
            $back .= GWF_HTML::message('Math Pyramid', $chall->lang('msg_correct', array($a, $result2, $result)), false);
            $correct++;
        } else {
            $back .= GWF_HTML::error('Math Pyramid', $chall->lang('err_wrong', array($a, $result2, $result)), false);
        }
    }
    require_once GWF_CORE_PATH . 'module/WeChall/WC_MathChall.php';
    if ($chall->getID() > 0 && $correct === count($tests)) {
        if (false === WC_MathChall::insertSolution($chall->getID(), GWF_Session::getUserID(), $formula)) {
            $back .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
        } else {
            $back .= GWF_HTML::message('Math Pyramid', WC_HTML::lang('msg_wmc_sol_inserted', array($len, WC_MathChall::getLimitedHREF($chall, $len))), false);
        }
    }
    # Check Len
    if ($len > $maxlen) {
        $back .= GWF_HTML::error('Math Pyramid', $chall->lang('err_too_long', array($len, $maxlen)), false);
    }
    echo $back;
    if ($correct === count($tests) && $len <= $maxlen) {
        if ($len < $maxlen) {
            echo GWF_HTML::message('Math Pyramid', $chall->lang('msg_new_record', array($len, $maxlen)), false);
            GWF_Settings::setSetting('WC_MATH_PYRAMID', $len);
        }
        $chall->onChallengeSolved(GWF_Session::getUserID());
    }
}
Example #26
0
function wcProfileUsergroup(GWF_User $user, $is_logged_in)
{
    $ug = GWF_TABLE_PREFIX . 'usergroup';
    $userid = $user->getVar('user_id');
    if (false === gdo_db()->queryFirst("SELECT 1 FROM {$ug} WHERE ug_userid={$userid}")) {
        return '';
    }
    if (false === ($mod_ug = GWF_Module::loadModuleDB('Usergroups'))) {
        return '';
    }
    $mod_ug instanceof Module_Usergroups;
    $groups = $mod_ug->getGroups($user);
    foreach ($groups as $group) {
        if ($group->isAskToJoin()) {
            echo sprintf('<h2>%s</h2>', WC_HTML::lang('pi_ug_info', array($user->displayUsername(), $group->display('group_name'), $group->getVar('group_memberc'))));
            if ($is_logged_in) {
                echo sprintf('<h3>%s</h3>', WC_HTML::lang('pi_ug_join', array(GWF_WEB_ROOT . 'index.php?mo=Usergroups&amp;me=Join&amp;gid=' . $group->getID())));
            } else {
                echo sprintf('<h3>%s</h3>', WC_HTML::lang('pi_ug_register', array(GWF_WEB_ROOT . 'register')));
            }
        } else {
        }
    }
    return '';
}
Example #27
0
<div class="gwf_buttons_outer">
<div class="gwf_buttons">
<?php 
$m = $tVars['module'];
$m instanceof Module_Usergroups;
echo GWF_Button::generic($tLang->lang('btn_users'), $tVars['href_users'], 'generic', '', $m->isMethodSelected('Users'));
echo GWF_Button::generic($tLang->lang('btn_groups'), $tVars['href_groups'], 'generic', '', $m->isMethodSelected('ShowGroups'));
echo GWF_Button::generic($tLang->lang('btn_search'), $tVars['href_search'], 'generic', '', $m->isMethodSelected('Search'));
echo GWF_Button::generic($tLang->lang('btn_gallery'), $tVars['href_gallery'], 'generic', '', $m->isMethodSelected('AvatarGallery'));
echo GWF_Button::generic(WC_HTML::lang('btn_site_masters'), GWF_WEB_ROOT . 'site_masters', 'generic', '', false);
?>
</div>
</div>
Example #28
0
<div class="gwf_buttons_outer">
<div class="gwf_buttons">
<?php 
$m = $tVars['module'];
$m instanceof Module_Usergroups;
echo GWF_Button::generic($tLang->lang('btn_users'), $tVars['href_users'], 'generic', '', $m->isMethodSelected('Users'));
echo GWF_Button::generic($tLang->lang('btn_groups'), $tVars['href_groups'], 'generic', '', $m->isMethodSelected('ShowGroups'));
echo GWF_Button::generic($tLang->lang('btn_search'), $tVars['href_search'], 'generic', '', $m->isMethodSelected('Search'));
echo GWF_Button::generic($tLang->lang('btn_gallery'), $tVars['href_gallery'], 'generic', '', $m->isMethodSelected('AvatarGallery'));
echo GWF_Button::generic(WC_HTML::lang('btn_site_masters'), GWF_WEB_ROOT . 'site_masters', 'generic', '', false);
echo GWF_Button::generic(WC_HTML::lang('btn_hackerspace'), GWF_WEB_ROOT . 'places', 'generic', '', false);
?>
</div>
</div>
Example #29
0
    echo gwfProfileRow($tLang->lang('th_user_avatar'), $u->displayAvatar());
}
if ($u->hasCountry()) {
    echo gwfProfileRow($tLang->lang('th_user_country'), $u->displayCountryFlag(true));
}
echo gwfProfileRow($tLang->lang('th_user_name'), $u->displayUsername());
if (isset($data['WC_HIDE_SCORE'])) {
    echo gwfProfileRow(WC_HTML::lang('th_score'), $wechall->lang('hidden'));
} else {
    echo gwfProfileRow(WC_HTML::lang('th_score'), GWF_HTML::anchor(WC_Site::getWeChall()->hrefRanking(), $u->getVar('user_level')));
}
if (isset($data['WC_HIDE_RANK'])) {
    echo gwfProfileRow(WC_HTML::lang('th_rank2'), $wechall->lang('hidden'));
} else {
    $rank = WC_RegAt::calcRank($u);
    echo gwfProfileRow(WC_HTML::lang('th_rank2'), GWF_HTML::anchor(WC_Site::getWeChall()->hrefRanking(), $rank));
}
// if ($u->getVar('user_countryid') !== '0') {
// 	if (isset($data['WC_HIDE_RANK'])) {
// 		echo gwfProfileRow(WC_HTML::lang('th_crank'), $wechall->lang('hidden'));
// 	} else {
// 		$cRank = WC_Regat::calcCountryRank($u);
// 		$href_crank = GWF_WEB_ROOT.'country_ranking/player/'.$u->urlencode2('user_name').'#rank_'.$cRank;
// 		echo gwfProfileRow(WC_HTML::lang('th_crank'), GWF_HTML::anchor($href_crank, $cRank));
// 	}
// }
echo gwfProfileRow($tLang->lang('th_registered'), GWF_Time::displayDate($u->getVar('user_regdate')));
if ($u->isOptionEnabled(GWF_User::HIDE_ONLINE)) {
    $lastactivity = GWF_HTML::lang('unknown');
} else {
    $lastactivity = GWF_Time::displayTimestamp($u->getVar('user_lastactivity'));
Example #30
0
if (!$tVars['have_cookies']) {
    ?>
	<div class="box"><?php 
    echo $tLang->lang('info_no_cookie');
    ?>
</div>
<?php 
}
?>

<?php 
#echo GWF_Box::box('Just register with fake email. All emails that would have been sent are printed to the screen.<br/>If you get prompted for account data, use 1111222233334444 as Steuernummer, rest can be garbage.<br/>Missing:<br/>- Stats', 'ALPHA NOTE');
?>


<div class="box">
<?php 
echo WC_HTML::lang('register_tos', array(GWF_WEB_ROOT . 'wechall_license'));
?>
</div>

<?php 
echo $tVars['form'];
?>

<div class="box">
<?php 
echo WC_HTML::lang('register_forgot', array(GWF_WEB_ROOT . 'recovery'));
?>
</div>