function displayWarnings($context) { // 1. Check which browser the user is using... $bad_browsers = array('MSIE'); $tested_browsers = array('Firefox', 'Safari'); $br = recognizeUserAgent(); if (in_array($br['browser'], $bad_browsers)) { $err = "has bugs that keep it from working well with MolProbity"; } //elseif(! in_array($br['browser'], $tested_browsers)) $err = "has not been tested with MolProbity"; if ($err) { echo "<br><div class='alert'>\n"; echo "Your browser, {$br['browser']} {$br['version']}, {$err}.\n"; echo "If pages display incorrectly or you experience other problems, you may want to \n"; echo "try a browser like <a href='http://www.mozilla.org/' target='_blank'>Firefox</a> instead.\n"; echo "</div><br>\n"; } // 2. Check for Java being enabled. // This doesn't verify the version, but is better than nothing... // javaEnabled() doesn't work in Mozilla-type browsers on OS X, so we exclude them $bad_platforms = array('Apple Macintosh'); $bad_browsers = array('Firefox', 'Mozilla', 'Netscape'); if (!(in_array($br['platform'], $bad_platforms) && in_array($br['browser'], $bad_browsers))) { ?> <script language='JavaScript'> <!-- if(!navigator.javaEnabled()) { document.writeln("<br><div class='alert'>"); document.writeln("It appears that Java is not enabled in your browser, so you may not be able to use KiNG interactive graphics."); document.writeln("<br><a href='help/java.html' target='_blank'>Click here for help.</a>"); document.writeln("</div>"); } // --> </script> <?php } }
function listBots() { if (!$GLOBALS['LogIter_allBotIDs']) { $bots = array(); $in = fopen(MP_BASE_DIR . '/feedback/molprobity.log', 'rb'); if ($in) { while (!feof($in)) { $s = trim(fgets($in, 4096)); if ($s == "") { continue; } // 5 forces $msgtext to not split on internal colons // $ip:$sess:$time:$msgcode[:$msgtext] $f = explode(':', $s, 5); // Assume IP addr. + sess. ID = globally unique ID $uid = $f[0] . ':' . $f[1]; if ($f[3] == "browser-detect") { $br = recognizeUserAgent($f[4]); if ($br['platform'] == "Bot/Crawler" || $br['platform'] == "Java" || $br['platform'] == "Unknown") { $bots[$uid] = 1; } } } } fclose($in); $GLOBALS['LogIter_allBotIDs'] =& $bots; } return $GLOBALS['LogIter_allBotIDs']; }