示例#1
0
 public static function isValidCountry($cid, $allow_zero = false)
 {
     $min = $allow_zero === true ? -1 : 0;
     if ($min >= ($cid = (int) $cid)) {
         return false;
     }
     return $cid === 0 ? true : GWF_Country::getByID($cid) !== false;
 }
示例#2
0
文件: PT_Menu.php 项目: sinfocol/gwf3
 private static function displayMenuLang(Module_PoolTool $module)
 {
     switch (GWF_Language::getCurrentISO()) {
         case 'de':
             $country = GWF_Country::getByTLD('gb');
             $to = 'en';
             break;
         case 'en':
         default:
             $country = GWF_Country::getByTLD('de');
             $to = 'de';
             break;
     }
     $href = sprintf('http://%s.%s%s', $to, GWF_DOMAIN, htmlspecialchars($_SERVER['REQUEST_URI']));
     return sprintf('<a href="%s">%s</a>', $href, $country->displayFlag());
 }
示例#3
0
 public static function installCurrencies(Module_Payment $module, $dropTable)
 {
     $path = GWF_CORE_PATH . '/module/Payment/install/_currencies.txt';
     if (false === ($fh = @fopen($path, 'r'))) {
         return GWF_HTML::err('ERR_FILE_NOT_FOUND', array($path));
     }
     $n = 0;
     $errors = array();
     while (false !== ($line = fgets($fh))) {
         $n++;
         if ($line[0] === '#') {
             continue;
         }
         $cols = explode("\t", $line);
         $cols = array_map('trim', $cols);
         if (count($cols) < 6) {
             $errors[] = sprintf('Error in currency file %s line %d.', $path, $n);
             continue;
         }
         list($countryname, $currency, $char, $iso, $fracname, $multi) = $cols;
         if (false === ($c = GWF_Country::getByName($countryname))) {
             $errors[] = sprintf('Unknown Country %s in currency file %s line %d.', $countryname, $path, $n);
         } elseif ($currency == '') {
             $errors[] = sprintf('Unknown Currency for %s in currency file %s line %d.', $countryname, $path, $n);
         } elseif ($char == '') {
             $errors[] = sprintf('No Symbol for %s in currency file %s line %d.', $currency, $path, $n);
         } elseif (strlen($iso) !== 3) {
             continue;
             $errors[] = sprintf('No ISO for %s in currency file %s line %d.', $currency, $path, $n);
         } elseif ($fracname == '') {
             $errors[] = sprintf('No Fraction Name for %s in currency file %s line %d.', $currency, $path, $n);
         } elseif ($multi !== '1,000' && $multi !== '100' && $multi !== '10') {
             $errors[] = sprintf('Invalid Multiplier for %s in currency file %s line %d.', $currency, $path, $n);
         } else {
             $row = new GWF_Currency(array('curr_iso' => $iso === 'None' ? sprintf('%03d', $n) : strtoupper($iso), 'curr_cid' => $c->getID(), 'curr_char' => $char, 'curr_digits' => $multi === '100' ? 2 : ($multi === '1,000' ? 3 : ($multi === '10' ? 2 : 0))));
             if (false === $row->replace()) {
                 $errors[] = GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
                 break;
             }
         }
     }
     fclose($fh);
     return GWF_HTML::error('Install Currencies', $errors);
 }
示例#4
0
 private static function sendMail(Module_Account $module, GWF_User $user, array $data)
 {
     $token = GWF_AccountChange::createToken($user->getID(), 'demo', serialize($data));
     $mail = new GWF_Mail();
     $mail->setSender($module->cfgMailSender());
     $mail->setReceiver($user->getVar('user_email'));
     $mail->setSubject($module->lang('chdemo_subj'));
     $username = $user->display('user_name');
     $timeout = GWF_Time::humanDuration($module->cfgChangeTime());
     $gender = GWF_HTML::display($user->getVar('user_gender'));
     $country = GWF_Country::getByIDOrUnknown($data['user_countryid'])->display('country_name');
     $lang1 = GWF_Language::getByIDOrUnknown($data['user_langid'])->display('lang_nativename');
     $lang2 = GWF_Language::getByIDOrUnknown($data['user_langid2'])->display('lang_nativename');
     $gender = GWF_HTML::lang('gender_' . $data['user_gender']);
     $birthdate = $data['user_birthdate'] > 0 ? GWF_Time::displayDate($data['user_birthdate'], true, 1) : GWF_HTML::lang('unknown');
     $link = self::getChangeLink($user->getID(), $token);
     $mail->setBody($module->lang('chdemo_body', array($username, $timeout, $gender, $country, $lang1, $lang2, $birthdate, $link)));
     return $mail->sendToUser($user) ? $module->message('msg_mail_sent') : GWF_HTML::err('ERR_MAIL_SENT');
 }
示例#5
0
 private function showUser(GWF_User $user, $api_key)
 {
     if (false !== ($error = $this->module->isExcludedFromAPI($user, $api_key))) {
         return $error;
     }
     $private_mode = $this->module->isAPIKeyCorrect($user, $api_key);
     require_once GWF_CORE_PATH . 'module/WeChall/WC_RegAt.php';
     if (false === ($regats = WC_RegAt::getRegats($user->getID(), 'regat_solved ASC'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     require_once GWF_CORE_PATH . 'module/Forum/GWF_ForumOptions.php';
     if (false === ($fopts = GWF_ForumOptions::getUserOptions($user, false))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $unknown = GWF_HTML::lang('unknown');
     if ('0' === ($countryid = $user->getVar('user_countryid'))) {
         $country = false;
         $cname = $unknown;
         $crank = $unknown;
     } else {
         $country = GWF_Country::getByID($countryid);
         $cname = $country->displayName();
         $crank = WC_RegAt::calcExactCountryRank($user);
     }
     $back = '';
     $back .= 'Username:'******'user_name') . PHP_EOL;
     $back .= 'Country:' . $cname . PHP_EOL;
     $back .= 'Totalscore:' . $user->getVar('user_level') . PHP_EOL;
     $back .= 'GlobalRank:' . WC_RegAt::calcExactRank($user) . PHP_EOL;
     $back .= 'CountryRank:' . $crank . PHP_EOL;
     $back .= $this->contactData($user);
     $back .= 'ForumPosts:' . $fopts->getVar('fopt_posts') . PHP_EOL;
     $back .= 'ForumThanks:' . $fopts->getVar('fopt_thanks') . PHP_EOL;
     $back .= 'ForumVoteUp:' . $fopts->getVar('fopt_upvotes') . PHP_EOL;
     $back .= 'ForumVoteDown:' . $fopts->getVar('fopt_downvotes') . PHP_EOL;
     $back .= $this->regatData($user, $regats);
     if ($private_mode === true) {
         $back .= $this->privateData($user);
     }
     return $back;
 }
示例#6
0
 private static function initCountryNames()
 {
     if (self::$COUNTRY_NAMES === true) {
         self::$COUNTRY_NAMES = new GWF_LangTrans(GWF_CORE_PATH . 'lang/country/countries');
     }
 }
示例#7
0
 /**
  * Takes ages.
  * @return string
  * @todo integrate in design but do flushing and error handling
  */
 public static function createLanguage($__langs = true, $__cunts = true, $__ipmap = false)
 {
     $success = true;
     require_once GWF_CORE_PATH . 'inc/install/data/GWF_LanguageData.php';
     set_time_limit(0);
     # This function takes ages!
     $cache = array();
     $cache2 = array();
     # Language
     $i = 1;
     $linguas = GWF_LanguageData::getLanguages();
     $ret = 'Installing ' . count($linguas) . ' Languages';
     //	flush();
     $lang_t = new GWF_Language();
     $supported = explode(';', GWF_SUPPORTED_LANGS);
     foreach ($linguas as $lang) {
         //		$ret .= '.';
         //		flush();
         array_map('trim', $lang);
         list($name, $native, $short, $iso) = $lang;
         if (false !== ($langrow = $lang_t->selectFirst('lang_id', "lang_short='{$short}'"))) {
             #GWF_Language::getByShort($short))) {
             $cache[$short] = $langrow['lang_id'];
             #->getID();
             continue;
         }
         if ($__langs) {
             if (false === $lang_t->insertAssoc(array('lang_id' => $i, 'lang_name' => $name, 'lang_nativename' => $native, 'lang_short' => $short, 'lang_iso' => $iso, 'lang_options' => in_array($iso, $supported, true) ? GWF_Language::SUPPORTED : 0))) {
                 $ret .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
                 $success = false;
                 continue;
             }
         }
         $i++;
         $cache[$short] = $i;
         #langrow['lang_id'];
     }
     $ret .= PHP_EOL;
     # Country and Langmap
     $countries = GWF_LanguageData::getCountries();
     $country_t = new GWF_Country();
     $ret .= 'Installing ' . count($countries) . ' Countries';
     //	flush();
     foreach ($countries as $cid => $c) {
         //		$ret .= '.';
         //		flush();
         if (count($c) !== 5) {
             $ret .= GWF_HTML::error('Country error', sprintf('%s has error.', $c[0]), true, true);
         }
         array_map('trim', $c);
         list($name, $langs, $region, $tld, $pop) = $c;
         $tld = strtolower($tld);
         if ($__cunts) {
             if (false === $country_t->insertAssoc(array('country_id' => $cid, 'country_name' => $name, 'country_tld' => $tld, 'country_pop' => $pop))) {
                 $ret .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__), true, true);
                 $success = false;
                 continue;
             }
         }
         $cache2[$tld] = $cid;
         $langmap_t = new GWF_LangMap();
         if ($__cunts) {
             $langs = explode(':', $langs);
             foreach ($langs as $langshort) {
                 if (!isset($cache[$langshort])) {
                     $ret .= GWF_HTML::error('', 'Unknown iso-3: ' . $langshort . ' in country ' . $name, true, true);
                     $success = false;
                     $ret .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__), true, true);
                     continue;
                 }
                 $langid = $cache[$langshort];
                 if (false === $langmap_t->insertAssoc(array('langmap_cid' => $cid, 'langmap_lid' => $langid))) {
                     $ret .= GWF_HTML::err('ERR_DATABASE', array(array(__FILE__, __LINE__)), true, true);
                     $success = false;
                     continue;
                 }
             }
         }
     }
     $ret .= PHP_EOL;
     if (!$__ipmap) {
         //		return $success;
         return $ret;
     }
     $ret .= 'Installing ip2country' . PHP_EOL;
     # IP2Country
     $max = 89323;
     $now = 0;
     $filename = GWF_CORE_PATH . "inc/install/data/ip-to-country.csv";
     if (false === ($fp = fopen($filename, "r"))) {
         $ret .= GWF_HTML::err('ERR_FILE_NOT_FOUND', array($filename), true, true);
         //		return false;
         return $ret;
     }
     $ip2c = new GWF_IP2Country();
     while (false !== ($line = fgetcsv($fp, 2048))) {
         if (count($line) !== 5) {
             $ret .= GWF_HTML::error('', $filename . ' is corrupt!', true, true);
             $success = false;
             break;
         }
         list($ipstart, $ipend, $tld, $ccode2, $cname) = $line;
         $tld = strtolower($tld);
         if (!isset($cache2[$tld])) {
             $ret .= GWF_HTML::error('', 'Unknown TLD: ' . $tld, true, true);
             $ret .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__), true, true);
             $success = false;
             continue;
         }
         if (false === $ip2c->insertAssoc(array('ip2c_start' => $ipstart, 'ip2c_end' => $ipend, 'ip2c_cid' => $cache2[$tld]))) {
             $ret .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__), true, true);
             $success = false;
             continue;
         }
         $now++;
         if (!($now % 2500)) {
             $msg = sprintf('%d of %d...', $now, $max);
             $ret .= GWF_HTML::message('Progress', $msg, true, true);
             //			flush();
         }
     }
     return $ret;
 }
示例#8
0
 public static function imgCountryByIP()
 {
     return GWF_Country::displayFlagS(self::getCountryIDbyIP());
 }
示例#9
0
 private function getDataForCountry(GWF_Country $country, $ipp, $from)
 {
     $cid = $country->getID();
     $deleted = GWF_User::DELETED;
     return GDO::table('GWF_User')->selectObjects('*', "user_countryid={$cid} AND user_options&0x10000002=0 AND user_options&{$deleted}=0", "user_level DESC ", $ipp, $from);
 }
示例#10
0
文件: Form.php 项目: sinfocol/gwf3
 public function validate_countryid(Module_Register $module, $arg)
 {
     $countryid = (int) $arg;
     if ($countryid !== 0) {
         if (GWF_Country::getByID($countryid) === false) {
             return $this->module->lang('err_country');
         }
     }
     return false;
 }
示例#11
0
echo $tVars['form_settings']->templateX($tVars['module']->lang('ft_settings'));
echo '</div>' . PHP_EOL;
echo '<div class="fl">';
echo $tVars['form_add']->templateX($tLang->lang('ft_add_whitelist'));
echo '</div>' . PHP_EOL;
echo '<div class="fl">';
echo $tVars['form_clear']->templateX($tLang->lang('ft_clear_pois'));
echo '</div>' . PHP_EOL;
echo '<div class="cb"></div>' . PHP_EOL;
echo $tVars['page_menu'];
echo '<form method="post" action="' . htmlspecialchars($tVars['form_action']) . '">' . PHP_EOL;
echo sprintf('<div>%s</div>', GWF_CSRF::hiddenForm('poi_whitelisting'));
echo GWF_Table::start('gwf_mass_toggle');
echo GWF_Table::displayHeaders1($headers, $tVars['sort_url']);
$table = $tVars['table'];
$result = $table->select('user_id, user_countryid, country_name, user_name, user_level, pw_date', $tVars['where'], "{$tVars['by']} {$tVars['dir']}", array('userb', 'country'), $tVars['ipp'], $tVars['from']);
while (false !== ($row = $table->fetch($result, GDO::ARRAY_N))) {
    echo GWF_Table::rowStart();
    echo GWF_Table::column('<input type="checkbox" name="user[' . $row[0] . ']" />');
    echo GWF_Table::column(GWF_Country::displayFlagS2($row[1], $row[2]));
    echo GWF_Table::column(sprintf('<a href="%2$sprofile/%1$s">%1$s</a>', htmlspecialchars($row[3]), GWF_WEB_ROOT));
    echo GWF_Table::column($row[4], 'gwf_num');
    echo GWF_Table::column(GWF_Time::displayDate($row[5]), 'gwf_date');
    echo GWF_Table::rowEnd();
}
echo GWF_Table::end();
echo GWF_Button::wrapStart();
printf('<input type="submit" name="delete" value="%s" />', $tLang->lang('btn_rem_whitelist'));
echo GWF_Button::wrapEnd();
echo GWF_Form::end();
echo $tVars['page_menu'];
示例#12
0
文件: groups.php 项目: sinfocol/gwf3
<?php

$headers = array(array($tLang->lang('th_group_id'), 'group_id', 'ASC'), array($tLang->lang('th_group_memberc'), 'group_memberc', 'ASC'), array($tLang->lang('th_group_name'), 'group_name', 'ASC'), array($tLang->lang('th_group_join'), 'group_options&255', 'ASC'), array($tLang->lang('th_group_view'), 'group_options&0xf00', 'ASC'), array($tLang->lang('th_group_founder'), 'group_founder', 'ASC'), array($tLang->lang('th_group_lang'), 'group_lang', 'ASC'), array($tLang->lang('th_group_country'), 'group_country', 'ASC'));
echo $tVars['pagemenu'];
echo GWF_Table::start();
echo GWF_Table::displayHeaders1($headers, $tVars['sort_url']);
foreach ($tVars['groups'] as $g) {
    echo GWF_Table::rowStart();
    $g instanceof GWF_Group;
    $gid = $g->getID();
    $href_edit = GWF_WEB_ROOT . 'index.php?mo=Admin&me=GroupEdit&gid=' . $gid;
    echo GWF_Table::column(GWF_HTML::anchor($href_edit, $gid));
    echo GWF_Table::column($g->getVar('group_memberc'));
    echo GWF_Table::column(GWF_HTML::anchor($href_edit, $g->getVar('group_name')));
    echo GWF_Table::column($g->displayJoinType($tVars['module']));
    echo GWF_Table::column($g->displayViewType($tVars['module']));
    echo GWF_Table::column($g->getFounder()->displayUsername());
    echo GWF_Table::column(GWF_Language::getByIDOrUnknown($g->getVar('group_lang'))->display('lang_nativename'));
    echo GWF_Table::column(GWF_Country::getByIDOrUnknown($g->getVar('group_country'))->displayName());
    echo GWF_Table::rowEnd();
}
echo GWF_Table::end();
echo $tVars['pagemenu'];
$buttons = GWF_Button::add($tLang->lang('btn_add'), $tVars['href_add']);
echo GWF_Button::wrap($buttons);
示例#13
0
<?php

$headers = array(array('#'), array($tLang->lang('th_user_name')), array($tLang->lang('th_score')));
echo GWF_Box::box($tLang->lang('pi_crank', array($tVars['cname'])), GWF_Country::displayFlagS($tVars['cid']) . ' ' . $tLang->lang('pt_crank', array($tVars['cname'], $tVars['page'])));
WC_HTML::rankingPageButtons();
echo $tVars['page_menu'];
echo GWF_Table::start();
echo GWF_Table::displayHeaders2($headers);
$rank = $tVars['rank'];
$hlrank = $tVars['hl_rank'];
foreach ($tVars['data'] as $user) {
    //	$user instanceof GWF_User;
    $style = $hlrank == $rank ? WC_HTML::styleSelected() : '';
    echo GWF_Table::rowStart(true, '', '', $style);
    echo sprintf('<td class="gwf_num"><a name="rank_%s">%s</a></td>', $rank, $rank);
    echo sprintf('<td>%s</td>', $user->displayProfileLink());
    echo sprintf('<td class="gwf_num">%s</td>', $user->getVar('user_level'));
    echo GWF_Table::rowEnd();
    $rank++;
}
echo GWF_Table::end();
echo $tVars['page_menu'];
echo GWF_Box::box($tLang->lang('scorefaq_box', array(GWF_WEB_ROOT . 'scoring_faq')));
示例#14
0
<?php

$headers = array(array('Rank'), array(''), array('Points'), array('Username'), array('Solved'), array('Last Activity'));
$box = $tVars['box'];
$box instanceof WC_Warbox;
$site = $box->getSite();
echo $tVars['site_quickjump'];
echo $tVars['pagemenu'];
$vars = array($tVars['playercount'], $box->displayName(), $site->displayName());
echo GWF_Box::box($tLang->lang('info_warbox_players', $vars), $tLang->lang('title_warbox_players', $vars));
echo GWF_Table::start();
echo GWF_Table::displayHeaders1($headers);
$rank = $tVars['rank'];
foreach ($tVars['data'] as $row) {
    echo GWF_Table::rowStart();
    echo GWF_Table::column($rank++, 'gwf_num');
    echo GWF_Table::column(GWF_Country::displayFlagS($row['country']));
    echo GWF_Table::column($row['score'], 'gwf_num');
    echo GWF_Table::column(GWF_User::displayProfileLinkS($row['user_name']));
    echo GWF_Table::column(sprintf('%s (%.02f%%)', $row['solved'], $row['percent']), 'gwf_num');
    echo GWF_Table::column(GWF_Time::displayDate($row['solvedate']), 'gwf_date');
    echo GWF_Table::rowEnd();
}
echo GWF_Table::end();
echo $tVars['pagemenu'];
示例#15
0
 public function displayCountryFlag($unknown = true)
 {
     if ('0' === ($cid = $this->getCountryID()) && $unknown === false) {
         return '';
     }
     return GWF_Country::displayFlagS($cid);
 }
示例#16
0
 public function onEdit(WC_Site $site, $is_admin)
 {
     $form = $this->getForm($site, $is_admin);
     if (false !== ($errors = $form->validate($this->module))) {
         return $errors;
     }
     $basescore_changed = $language_changed = $status_changed = $spc_changed = $powarg_changed = false;
     if ($is_admin) {
         $basescore_changed = $form->getVar('site_basescore') != $site->getBasescore();
         $language_changed = $form->getVar('site_language') !== $site->getLangID();
         $status_changed = $form->getVar('site_status') !== $site->getStatus();
         $spc_changed = $form->getVar('site_spc') !== $site->getVar('site_spc');
         $powarg_changed = $form->getVar('site_powarg') !== $site->getVar('site_powarg');
         $site->saveVars(array('site_classname' => $form->getVar('site_classname'), 'site_basescore' => $form->getVar('site_basescore'), 'site_usercount' => $form->getVar('site_usercount'), 'site_challcount' => $form->getVar('site_challcount'), 'site_joindate' => $form->getVar('site_joindate'), 'site_authkey' => $form->getVar('site_authkey'), 'site_status' => $form->getVar('site_status'), 'site_language' => $form->getVar('site_language'), 'site_spc' => $form->getVar('site_spc'), 'site_powarg' => $form->getVar('site_powarg'), 'site_color' => $form->getVar('site_color')));
     }
     $site->saveVars(array('site_name' => $form->getVar('site_name'), 'site_country' => $form->getVar('site_country'), 'site_launchdate' => $form->getVar('site_launchdate'), 'site_xauthkey' => $form->getVar('site_xauthkey'), 'site_irc' => $form->getVar('site_irc'), 'site_url' => $form->getVar('site_url'), 'site_url_mail' => $form->getVar('site_url_mail'), 'site_url_score' => $form->getVar('site_url_score'), 'site_url_profile' => $form->getVar('site_url_profile')));
     $site->setVar('site_country', GWF_Country::getByID($form->getVar('site_country')));
     $site->setVar('site_language', GWF_Language::getByID($form->getVar('site_language')));
     # Update tags if Admin
     if ($is_admin) {
         $new_tags = $form->getVar('site_tags');
         if ($site->getTags() !== $new_tags) {
             echo GWF_HTML::message('WeChall', 'Fixing challenge site tags..');
             $site->saveVar('site_tags', str_replace(' ', '', $new_tags));
             require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteCats.php';
             WC_SiteCats::fixCatBits();
         }
     }
     // 		$out = $this->onEditWarflag($site, isset($_POST['warenbl']));
     $old_linear = $site->isLinear();
     $site->saveOption(WC_Site::LINEAR, isset($_POST['linear']));
     $linear_changed = $old_linear !== $site->isLinear();
     $site->saveOption(WC_Site::NO_URLENCODE, isset($_POST['no_urlencode']));
     $site->saveOption(WC_Site::AUTO_UPDATE, isset($_POST['auto_update']));
     $site->saveOption(WC_Site::HIDE_BY_DEFAULT, isset($_POST['default_hide']));
     $site->saveOption(WC_Site::ONSITE_RANK, isset($_POST['onsite_rank']));
     $site->saveOption(WC_Site::NO_V1_SCRIPTS, isset($_POST['no_v1']));
     # Trigger warbox config parsing.
     // 		if ($site->isWarBox())
     // 		{
     // // 			$site->getWarIP();
     // 			Module_WeChall::instance()->flushWarboxConfig();
     // 		}
     # Recalculate in case of a change
     //		if ($site->isScored())
     //		{
     if ($basescore_changed || $language_changed || $status_changed || $powarg_changed || $spc_changed || $linear_changed) {
         $site->recalcSite();
         WC_RegAt::calcTotalscores();
     }
     //		}
     return $this->module->message('msg_site_edited', array($site->displayName()));
     #.$out;
 }
示例#17
0
 public static function detectCountry()
 {
     return GWF_Country::getByID(self::detectCountryID());
 }
示例#18
0
 public function displayCountry()
 {
     return GWF_HTML::display(GWF_Country::getByID($this->getVar('countryid')));
 }
示例#19
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'));
示例#20
0
<?php

$headers = array(array('Rank'), array(), array('Username', 'user_name'), array('SolvedAt', 'wf_solved_at'));
$flag = $tVars['flag'];
$flag instanceof WC_Warflag;
$box = $flag->getWarbox();
$site = $box->getSite();
echo $tVars['site_quickjump'];
echo $tVars['pagemenu'];
$vars = array($tVars['solvercount'], $flag->displayName(), $box->displayName(), $site->displayName());
echo GWF_Box::box($tLang->lang('info_warflag_solvers', $vars), $tLang->lang('title_warflag_solvers', $vars));
$pos = $tVars['rank'];
echo GWF_Table::start();
echo GWF_Table::displayHeaders1($headers, $tVars['sort_url']);
foreach ($tVars['solvers'] as $row) {
    echo GWF_Table::rowStart();
    echo GWF_Table::column($pos, 'gwf_num');
    echo GWF_Table::column(GWF_Country::displayFlagS($row['user_countryid']));
    echo GWF_Table::column(GWF_User::displayProfileLinkS($row['user_name']));
    echo GWF_Table::column(GWF_Time::displayDate($row['wf_solved_at']), 'gwf_date');
    echo GWF_Table::rowEnd();
    $pos++;
}
echo GWF_Table::end();
echo $tVars['pagemenu'];