static function getYoutubeData($youtube_id) { if (empty($youtube_id)) { return false; } $html = GWF_HTTP::getFromURL('http://gdata.youtube.com/feeds/api/videos/' . $youtube_id); $xml = simplexml_load_string($html); if ($xml === false) { return false; } $data = array(); $media = $xml->children('http://search.yahoo.com/mrss/'); $data['title'] = (string) $media->group->title; $data['description'] = (string) $media->group->description; $data['category'] = (string) $media->group->category; $data['keywords'] = explode(', ', $media->group->keywords); $data['link'] = (string) $media->group->player->attributes()->url; $data['duration'] = (int) $media->children('http://gdata.youtube.com/schemas/2007')->duration->attributes()->seconds; $data['thumbnails'] = array(); foreach ($media->group->thumbnail as $thumbnail) { array_push($data['thumbnails'], array('url' => (string) $thumbnail->attributes()->url, 'width' => (int) $thumbnail->attributes()->width, 'height' => (int) $thumbnail->attributes()->height)); } $data['published'] = strtotime($xml->published); $data['author'] = (string) $xml->author->name; $gd = $xml->children('http://schemas.google.com/g/2005')->rating->attributes(); $data['rating'] = (double) $gd->average; $data['num_raters'] = (int) $gd->numRaters; $data['views'] = (int) $xml->children('http://gdata.youtube.com/schemas/2007')->statistics->attributes()->viewCount; return $data; }
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); }
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) { $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); }
public static function requestSlay(Module_Slaytags $module) { if (false === ($page = GWF_HTTP::getFromURL(self::URL))) { return false; } if (false === ($data = json_decode($page, true))) { return false; } return $data; }
function www_basic_go(WC_Challenge $chall, $url, $content) { if (false === ($response = GWF_HTTP::getFromURL($url))) { echo GWF_HTML::error('WWW Basics', $chall->lang('err_file_not_found')); } elseif ($response !== $content) { echo GWF_HTML::error('WWW Basics', $chall->lang('err_wrong', array(htmlspecialchars($response), htmlspecialchars($content), strlen($response), strlen($content)))); } else { $chall->onChallengeSolved(GWF_Session::getUserID()); } }
private function sendRequest($gwf_date, $limit) { GWF_HTTP::setTimeout(3); GWF_HTTP::setConnectTimeout(2); $url = $this->getReplacedUrl($this->getDate(), $limit); echo "CHECKING FORUM WITH URL: {$url}\n"; $content = GWF_HTTP::getFromURL($url); GWF_HTTP::setTimeout(); GWF_HTTP::setConnectTimeout(); return $content; }
function www_rewrite_go(WC_Challenge $chall, $url) { $n1 = rand(1000000, 1000000000) . rand(1000000, 1000000000); $n2 = rand(1000000, 1000000000) . rand(1000000, 1000000000); $solution = bcmul($n1, $n2); $url .= $n1 . '_mul_' . $n2 . '.html'; if (false === ($response = GWF_HTTP::getFromURL($url))) { echo GWF_HTML::error('WWW Rewrite', $chall->lang('err_file_not_found')); } elseif ($response !== $solution) { echo GWF_HTML::error('WWW Rewrite', $chall->lang('err_wrong', array(htmlspecialchars($response), htmlspecialchars($solution), strlen($response), strlen($solution)))); } else { $chall->onChallengeSolved(GWF_Session::getUserID()); } }
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()))); } $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) !== 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) { $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()))); } $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); }
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()))); } $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()))); } $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); }
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()))); } $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()))); } $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); }
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); }
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); }
<?php $lang = array('en' => array('help' => 'Usage: %CMD%. Show information of the current song played at http://slayradio.org - mplayer http://relay1.slayradio.org:8000', 'np' => 'Now Playing on http://slayradio.org %s - %s (requested by %s)', 'live' => "There is probably a live show on http://slayradio.org: %s.", 'ki' => 'SlayRadio AI')); $plugin = Dog::getPlugin(); $ki = $plugin->lang('ki'); $url = 'http://slayradio.org/now_playing.php'; if (false === ($result = GWF_HTTP::getFromURL($url))) { return Dog::rply('err_response'); } # <strong>Lagerfeldt</strong><br>R-Type (Doppelganger Summer Remix)<p align="center"><small>Requested by <b><i>zeddan</i></b> <br></small> if (preg_match('#<strong>([^<]+)</strong><br>([^<]+)<p align="center"><small>Requested by <b><i>([^<]+)</i></b> <br></small>#', $result, $matches)) { $plugin->rply('np', array(utf8_encode(html_entity_decode($matches[1], ENT_QUOTES)), utf8_encode(html_entity_decode($matches[2], ENT_QUOTES)), utf8_encode(html_entity_decode($matches[3], ENT_QUOTES)))); } elseif (preg_match('#<strong>([^<]+)</strong><br>([^<]+)<p align="center">#', $result, $matches)) { $plugin->rply('np', array(utf8_encode(html_entity_decode($matches[1], ENT_QUOTES)), utf8_encode(html_entity_decode($matches[2], ENT_QUOTES)), $ki)); } elseif (preg_match('#<strong>([^<]+)</strong><br>([^<]+)<br>#', $result, $matches) && preg_match('#<small>Requested by <b><i>([^<]+)</i></b> <br></small>#', $result, $matches2)) { $plugin->rply('np', array(utf8_encode(html_entity_decode($matches[1], ENT_QUOTES)), utf8_encode(html_entity_decode($matches[2], ENT_QUOTES)), utf8_encode(html_entity_decode($matches2[1], ENT_QUOTES)))); } elseif (1 === preg_match('#<strong>([^<]+)</strong><br>([^<]+)<br>#', $result, $matches)) { $plugin->rply('np', array(utf8_encode(html_entity_decode($matches[1], ENT_QUOTES)), utf8_encode(html_entity_decode($matches[2], ENT_QUOTES)), $ki)); } elseif (true === false) { } elseif (1 === preg_match('#<font size="\\+1">([^<]+)</font>#', $result, $matches)) { $plugin->rply('live', array($matches[1])); Dog::reply(sprintf('', $matches[1])); } else { Dog::rply('err_response'); }
public function flushWarboxConfig() { $url = sprintf('http://%s/cgi-bin/warscore.pullconfig.cgi', $this->cfgWarboxURL()); GWF_HTTP::getFromURL($url); }
<?php $lang = array('en' => array('help' => 'Usage: %CMD%. Get %BOT%´s IP.', 'out' => 'My IP address is %s.', 'down' => '%s seems down!', 'err' => 'Cannot parse 3rd party response for my own IP.')); $plugin = Dog::getPlugin(); $url = 'http://www.wechall.net/myip.php'; if (false === ($ip = GWF_HTTP::getFromURL($url))) { $plugin->rply('down', array($url)); } elseif (!preg_match('/REMOTE_ADDR: ([0-9\\.]+)/', $ip, $matches)) { $plugin->rply('err'); } else { $plugin->rply('out', array($matches[1])); }
/** * This file is part of the Lamb2 IRC Bot. * @author gizmore */ # Date we want to query $date = GWF_Settings::getSetting('WC_FORUM_DATE', date('YmdH0000')); # We already know these threads for the current data stored $known = GWF_Settings::getSetting('WC_FORUM_LAST', ','); # Set output channel $server instanceof Lamb_Server; $channels = $server->getChannels(); $channel = array_shift($channels); $channel = $channel->getVar('chan_name'); # Query URL $url = sprintf('http://www.wechall.net/nimda_forum.php?datestamp=%s&limit=5', $date); if (false === ($content = GWF_HTTP::getFromURL($url))) { return; } # Nothing happened if ($content === '') { return ''; } $latest_date = $date; $new_known = $known; $lines = explode("\n", $content); foreach ($lines as $line) { if ('' === ($line = trim($line))) { continue; } # Fetch line list($threadid, $lastdate, $lock, $url, $username, $title) = explode('::', $line);
function dog_wc_solvers($key, $name, $url, $channels = array(), $max_solvercount = 100, $format) { # Date we want to query $lastdate = GWF_Settings::getSetting('DOG_SOLVERS_DATE_' . $key, ''); if (strlen($lastdate) !== 14) { $lastdate = date('YmdHis'); GWF_Settings::setSetting('DOG_SOLVERS_DATE_' . $key, $lastdate); } $lastpair = GWF_Settings::getSetting('DOG_SOLVERS_PAIR_' . $key, ''); # Query URL $url = str_replace(array('%DATE%'), array($lastdate), $url); // echo $url.PHP_EOL; GWF_HTTP::setTimeout(3); GWF_HTTP::setConnectTimeout(2); if (false === ($content = GWF_HTTP::getFromURL($url))) { return; } GWF_HTTP::setTimeout(); GWF_HTTP::setConnectTimeout(); // echo $content.PHP_EOL; # Nothing happened if ($content === '') { return; } $lines = explode("\n", $content); $changed = false; $badlines = 0; $latestdate = $lastdate; $firstpair = false; foreach ($lines as $line) { // echo "$line\n"; if ('' === ($line = trim($line))) { continue; } $thedata = explode('::', $line); if (count($thedata) !== 12) { $badlines++; echo 'Invalid line in dog_wc_solvers: ' . $line . PHP_EOL; if ($badlines > 3) { echo "BAD URL IS: {$url}\n"; return; } continue; } $badlines = 0; $thedata = array_map('unescape_csv_like', $thedata); # Fetch line # uid::cid::solve_date::1st_look::viewcount::options::time_taken::tries::username::challname::solvecount::url list($uid, $cid, $solvedate, $firstdate, $views, $options, $timetaken, $tries, $username, $challname, $solvercount, $challurl) = $thedata; if (strlen($solvedate) !== 14) { echo "Dateformat in {$url} is invalid: {$solvedate}\n"; return false; } $latestdate = $solvedate; $pair = "{$uid}:{$cid}"; if ($firstpair === false) { $firstpair = $pair; } if ($pair === $lastpair) { break; } if ($solvercount > $max_solvercount) { continue; } $msg = sprintf($format, $name, $username, $challname, $solvercount, $challurl); if (count($channels) === 0) { # To all servers in the main channel foreach (Dog::getServers() as $server) { $server instanceof Dog_Server; $channels = $server->getChannels(); if (count($channels) > 0) { $channel = array_shift($channels); $channel = $channel->getName(); $server->sendPRIVMSG($channel, $msg); } } } else { # To all servers in matching channels foreach (Dog::getServers() as $server) { $server instanceof Dog_Server; $channels_now = $server->getChannels(); foreach ($channels_now as $channel) { $channel instanceof Dog_Channel; $channel = $channel->getName(); echo $channel . PHP_EOL; foreach ($channels as $c) { if (!strcasecmp($c, $channel)) { $server->sendPRIVMSG($channel, $msg); } } } } } $changed = true; } # Save state if ($changed) { GWF_Settings::setSetting('DOG_SOLVERS_DATE_' . $key, $latestdate); GWF_Settings::setSetting('DOG_SOLVERS_PAIR_' . $key, $firstpair); } }
<?php $W instanceof DOGMOD_Warfare; if (false !== GWF_HTTP::getFromURL($ip)) { $W->output(basename(__FILE__) . ": {$host} ({$ip}) has a website: http://{$ip} or http://{$host}"); }