public static function getMirrorsBBcode($mirrorList) { $bbcode = ''; // Return variable $mirrorCount = 0; // Used in output (for [mirror 1][mirror 2], etc.) and to give special output on the first mirror foreach ($mirrorList as $mirror) { if (DEVMODE) { echo '(Mirror ' . $mirror->url . ' ' . ($mirror->uptodate === 1 ? 'uptodate' : 'outdated/down') . ")\n"; } if ($mirror->uptodate === 1) { if ($mirrorCount == 0) { $bbcode .= '[url=' . $mirror->url . ']Deze statistieken[/url] [sup]'; } else { $bbcode .= '[[url=' . $mirror->url . ']mirror ' . $mirrorCount . '[/url]]'; } $mirrorCount += 1; } } if (empty($bbcode)) { // Uh-oh. I don't know what is wrong here, but better return all mirrors instead of none. if (DEVMODE) { echo "[b]WARNING:[/b] Something went wrong checking our mirrors. Slow internet perhaps? (The timeout is 1 second.)\n"; } foreach ($mirrorList as $mirror) { $mirror->uptodate = 1; // Let's just pretend they're all available and re-generate. } $bbcode = Mirror::getMirrorsBBcode($mirrorList); } return $bbcode; }
// display totals echo '[b]Totalen[/b]' . ENDL; echo '[table]'; echo '[tr][td]Keys [/td]'; echo '[td]' . Format::StatNumber($totals['keys']) . '[tt] [/tt][/td]'; echo '[td]' . ($totals['keysDiff'] > 0 ? '[green]+' : '[red]-') . Format::StatNumber($totals['keysDiff']) . '[/td][/tr]' . ENDL; echo '[tr][td]Kliks [/td]'; echo '[td]' . Format::StatNumber($totals['clicks']) . '[/td]'; echo '[td]' . ($totals['clicksDiff'] > 0 ? '[green]+' : '[red]-') . Format::StatNumber($totals['clicksDiff']) . '[/td][/tr]' . ENDL; echo '[tr][td]Uptime [/td]'; echo '[td]' . Format::Uptime($totals['uptime']) . '[/td]'; echo '[td]' . ($totals['uptimeDiff'] > 0 ? '[green]+' : '[red]-') . Format::Uptime($totals['uptimeDiff']) . '[/td][/tr]' . ENDL; echo '[tr][td]Download [/td]'; echo '[td]' . Format::Bandwidth($totals['download']) . '[/td]'; echo '[td]' . ($totals['downloadDiff'] > 0 ? '[green]+' : '[red]-') . Format::Bandwidth($totals['downloadDiff']) . '[/td][/tr]' . ENDL; echo '[tr][td]Upload [/td]'; echo '[td]' . Format::Bandwidth($totals['upload']) . '[/td]'; echo '[td]' . ($totals['uploadDiff'] > 0 ? '[green]+' : '[red]-') . Format::Bandwidth($totals['uploadDiff']) . '[/td][/tr]' . ENDL; if ($totals['pulsers'] > 0) { echo '[tr][td]Pulsers[/td][td]' . $totals['pulsers'] . '[/td]'; echo '[td][abbr=Percentage van alle leden]' . round($totals['pulsers'] / $totals['active'] * 100, 2) . '%[/td][/tr]' . ENDL; echo '[tr][td]Spaarders[tt] [/tt][/td][td]' . $totals['savers'] . '[/td]'; echo '[td][abbr=Percentage van de pulsers]' . round($totals['savers'] / $totals['pulsers'] * 100, 2) . '%[/td][/tr]' . ENDL; } echo '[/table]' . ENDL . ENDL; echo Mirror::getMirrorsBBcode($mirrors); echo '[/sup] ([url=https://github.com/goldenice/GMOT-Whatpulse-Parser]Broncode[/url])' . ENDL . ENDL; if (DEVMODE || isset($_GET['devmode']) || isset($_GET['gentime'])) { echo 'Generated in ' . (microtime(true) - $starttime) * 1000 . ' milliseconds.'; echo 'On ' . date('r') . '.'; }