private function sanitize() { $this->quoted = Common::getGet('quote') !== false; if (false === ($pid = Common::getGet('pid'))) { if (false === ($this->thread = $this->module->getCurrentThread())) { return $this->module->error('err_post'); } if (false === ($this->post = $this->thread->getLastPost())) { // return $this->module->error('err_post'); } $this->replyThread = true; } elseif (false === ($this->post = $this->module->getCurrentPost())) { return $this->module->error('err_post'); } else { if (false === ($this->thread = $this->post->getThread())) { return $this->module->error('err_post'); } } # Check Permission $user = GWF_Session::getUser(); if (!$this->thread->hasReplyPermission($user, $this->module)) { $a = GWF_HTML::display($this->post->getShowHREF()); return $this->module->error('err_reply_perm', array($a)); } if (false !== ($last_post = $this->thread->getLastPost())) { if ($last_post->getPosterID() === GWF_Session::getUserID()) { if (!$this->module->cfgDoublePost()) { $a = GWF_HTML::display($this->post->getShowHREF()); return $this->module->error('err_better_edit', array($a)); } } } return false; }
public static function validate_tags(Module_Links $module, $arg) { $errors = array(); $new = 0; $arg = explode(',', trim($arg)); $taken = array(); $minlen = 3; $maxlen = $module->cfgMaxTagLen(); foreach ($arg as $tag) { $tag = trim($tag); if (strlen($tag) === 0) { continue; } if (false === GWF_LinksTag::getByName($tag)) { if (self::isValidTagName($tag, $minlen, $maxlen)) { $taken[] = $tag; $new++; } else { $errors[] = $module->lang('err_tag', array(GWF_HTML::display($tag), $minlen, $maxlen)); } } else { $taken[] = $tag; } } if (count($taken) === 0) { $errors[] = $module->lang('err_no_tag'); } $_POST['link_tags'] = implode(',', $taken); if (count($errors) === 0) { return false; } return implode('<br/>', $errors); }
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); }
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); }
private function send(GWF_User $user) { $form = $this->form($user); if (false !== ($errors = $form->validate($this->module))) { return $errors . $this->template($user); } $u = GWF_User::getStaticOrGuest(); $sendermail = $u->getValidMail(); if ($sendermail === '') { $sendermail = Common::getPost('email'); } if ($sendermail === '') { $sendermail = GWF_HTML::lang('unknown'); } $sendermail = GWF_HTML::display($sendermail); $mail = new GWF_Mail(); $mail->setSender(GWF_BOT_EMAIL); $mail->setReceiver($user->getValidMail()); $mail->setReply($sendermail); $mail->setSubject($this->module->langUser($user, 'mail_subj_mail', $sendermail)); $mail->setBody($this->module->langUser($user, 'mail_subj_body', array($user->displayUsername(), $sendermail, GWF_Message::display($_POST['message'])))); if (false === $mail->sendToUser($user)) { return GWF_HTML::err('ERR_MAIL_SENT'); } return $this->module->message('msg_mailed', array($user->displayUsername())); }
public function displayUsername() { $uname = $this->getVar('shout_uname'); if ($this->isGuestShout()) { return $uname; // return GWF_HTML::lang('guest').'_'.$uname; } return GWF_HTML::anchor(GWF_WEB_ROOT . 'profile/' . urlencode($uname), GWF_HTML::display($uname)); }
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); }
private function templateFile($filename) { if (false === ($file = $this->gatherFile($filename))) { return GWF_HTML::err('ERR_FILE_NOT_FOUND', array(GWF_HTML::display($filename))); } $fileclass = GWF_LangFile::getByPath($file[0]); $form = $this->getFileForm($file); $tVars = array('file' => $file, 'class' => $fileclass, 'form' => $form->templateY($this->module->lang('ft_edit_file', array(GWF_HTML::display($filename))))); return $this->module->templatePHP('file.php', $tVars); }
public function templateShow() { if (false === ($news = GWF_News::getNewsQuick($this->module->getNewsPerPage(), $this->catid, $this->page, GWF_Language::getCurrentID()))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $date = count($news) > 0 ? $news[0]['news_date'] : GWF_Settings::getSetting('gwf_site_birthday') . '090000'; $date = GWF_Time::displayDate($date); GWF_Website::setPageTitle($this->module->lang('pt_news', array($date))); GWF_Website::setMetaTags($this->module->lang('mt_news', array($date))); GWF_Website::setMetaDescr($this->module->lang('md_news', array($this->page, $this->nPages))); // $mod_forum = GWF_Module::getModule('Forum', true); $tVars = array('news' => $news, 'titles' => GWF_News::getTitlesQuick($this->catid, GWF_Language::getCurrentID()), 'cats' => GWF_News::getCategories(), 'catid' => $this->catid, 'cat' => GWF_HTML::display($this->catTitle), 'page_menu' => $this->getPageMenu(), 'page' => $this->page, 'can_sign' => $this->module->canSignNewsletter(GWF_Session::getUser()), 'href_sign_news' => $this->module->hrefSignNewsletter(), 'may_add' => GWF_User::isAdminS() || GWF_User::isStaffS(), 'href_add' => $this->module->hrefAddNews()); return $this->module->templatePHP('show.php', $tVars); }
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]); }
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); }
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); }
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); }
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]); }
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); }
private function getAdminProfiles() { $admin = GWF_Group::getByName('admin')->getID(); $u = GWF_TABLE_PREFIX . 'user'; $ug = GWF_TABLE_PREFIX . 'usergroup'; $db = gdo_db(); $query = "SELECT user_name FROM {$ug} AS ug INNER JOIN {$u} AS u ON u.user_id=ug_userid WHERE ug_groupid={$admin}"; if (false === ($result = $db->queryRead($query))) { return ''; } $back = ''; while (false !== ($row = $db->fetchRow($result))) { $name = $row[0]; $back .= sprintf(', <a href="%s">%s</a>', GWF_WEB_ROOT . 'profile/' . urlencode($name), GWF_HTML::display($name)); } $db->free($result); return substr($back, 2); }
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); }
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); }
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); }
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); }
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'); }
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); }
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); }
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); }
private function setPageDescr($for_userid, $from_userid, $tag, $challcount) { $dtag = GWF_HTML::display($tag); GWF_Website::setPageTitle($this->getTableTitle($for_userid, $from_userid, $tag, $challcount), false); if ($for_userid != 0) { $for_user = GWF_User::getByIDOrGuest($for_userid); $for_username = $for_user->displayUsername(); GWF_Website::setMetaTags($this->module->lang('mt_challs_for', array($dtag, $for_username)), false); GWF_Website::setMetaDescr($this->module->lang('md_challs_for', array($dtag, $for_username)), false); } else { if ($from_userid != 0) { $from_user = GWF_User::getByIDOrGuest($from_userid); $from_username = $from_user->displayUsername(); GWF_Website::setMetaTags($this->module->lang('mt_challs_from', array($dtag, $from_username)), false); GWF_Website::setMetaDescr($this->module->lang('md_challs_from', array($dtag, $from_username)), false); } else { GWF_Website::setMetaTags($this->module->lang('mt_challs', array($dtag, GWF_HTML::display($tag))), false); GWF_Website::setMetaDescr($this->module->lang('md_challs', array($dtag, GWF_HTML::display($tag))), false); } } }
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); }
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); }
private function templateRanking() { require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteCats.php'; $tag = Common::getGet('tag', self::DEFAULT_TAG); if (0 === ($bit = WC_SiteCats::getBitForCat($tag))) { $bit = 1; $tag = $_GET['tag'] = WC_SiteCats::getCatForBit($bit); } $ipp = 50; $nItems = $this->countItems($bit); list($page, $hlrank) = $this->getPageNum($ipp, $bit); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp($page, 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $rank = ($page - 1) * $ipp + 1; $data = $bit === 0 ? array() : $this->selectPage($bit, $from, $ipp); $dtag = GWF_HTML::display($tag); GWF_Website::setPageTitle($this->module->lang('pt_tagrank', array($dtag))); GWF_Website::setMetaTags($this->module->lang('mt_tagrank', array($dtag, $dtag))); GWF_Website::setMetaDescr($this->module->lang('md_tagrank', array($dtag, $page, $nPages))); $tVars = array('rank' => $rank, 'hlrank' => $hlrank, 'sites' => WC_Site::getSimilarSitesS($bit, true), 'data' => $data, 'tag' => $dtag, 'form_action' => GWF_WEB_ROOT . 'category_ranking', 'page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . sprintf('category_ranking/%s/page-%%PAGE%%', urlencode($tag))), 'select' => $this->getTagSelect()); return $this->module->templatePHP('ranking_tag.php', $tVars); }
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); }
public function execute() { $gwf_token = Common::getGet('gwf_token'); if (false === ($order = GWF_Order::getByToken($gwf_token))) { return $this->module->error('err_token'); } if (!$order->isCreated()) { return $this->module->error('err_order'); } if (false === ($paypaltoken = Common::getGet("token"))) { return Module_Payment::instance()->error("err_xtoken", array(GWF_HTML::display($this->module->getSiteName()))); } if ($order->getOrderXToken() !== $paypaltoken) { return Module_Payment::instance()->error("err_xtoken", array(GWF_HTML::display($this->module->getSiteName()))); } /* Build a second API request to PayPal, using the token as the ID to get the details on the payment authorization */ $nvpstr = "&TOKEN=" . urlencode($paypaltoken); /* Make the API call and store the results in an array. If the call was a success, show the authorization details, and provide an action to complete the payment. If failed, show the error */ $resArray = Paypal_Util::hash_call('GetExpressCheckoutDetails', $nvpstr); $ack = strtoupper($resArray["ACK"]); if ($ack == "SUCCESS") { $order->saveVar('order_xtoken', serialize($resArray)); $module2 = $order->getOrderModule(); $module2->onLoadLanguage(); $gdo = $order->getOrderData(); $user = $order->getOrderUser(); $button = $this->module->displayPaysiteButton3($module2, $order, $gdo, $user); return Module_Payment::displayOrder3S($module2, $order, $gdo, $user, $order->getOrderPaySite(), $button); } else { return Paypal_Util::paypalError($resArray); } }