function validateURL($url, $outputerror = true) { $url = filter_var(urldecode(trim($url)), FILTER_VALIDATE_URL); if ($url === FALSE) { if (!$outputerror) { return null; } header('HTTP/1.0 400 Bad Request'); ?> <html> <head> <title>Bad Request: ShowSlow beacon</title> </head> <body> <h1>Bad Request: ShowSlow beacon</h1> <p>Invalid URL submitted.</p> </body></html> <?php exit; } if (shouldBeIgnoredAsNonHTTP($url)) { if (!$outputerror) { return null; } header('HTTP/1.0 400 Bad Request'); ?> <html> <head> <title>Bad Request: ShowSlow beacon</title> </head> <body> <h1>Bad Request: ShowSlow beacon</h1> <p>This instance of Show Slow only tracks HTTP(S) URLs.</p> </body></html> <?php exit; } if (isURLIgnored($url)) { if (!$outputerror) { return null; } header('HTTP/1.0 400 Bad Request'); ?> <html> <head> <title>Bad Request: ShowSlow beacon</title> </head> <body> <h1>Bad Request: ShowSlow beacon</h1> <p>This URL matched ignore list for this instance of Show Slow.</p> </body></html> <?php exit; } if (!isURLAllowed($url)) { if (!$outputerror) { return null; } header('HTTP/1.0 400 Bad Request'); ?> <html> <head> <title>Bad Request: ShowSlow beacon</title> </head> <body> <h1>Bad Request: ShowSlow beacon</h1> <p>URL doesn't match any <a href="http://www.showslow.org/Advanced_configuration_options#Limit_URLs_accepted">URLs allowed</a> by this instance.</p> </body></html> <?php exit; } return $url; }
if ($dynatrace) { ?> <th colspan="2">dynaTrace rank</th><?php } ?> <td style="text-align: center">Remove</td> <td style="padding-left: 1em">URL</td> </tr> <?php foreach ($rows as $row) { $link = true; ?> <tr> <?php if (shouldBeIgnoredAsNonHTTP($row['url'])) { $link = false; ?> <td style="color: red; text-align: right; padding-right: 1em"><i title="This instance of Show Slow only allows HTTP(S) URLs">non-HTTP(s) URL</i></td> <td colspan="<?php echo $cols * 2; ?> "/> <?php } else { if (!isURLAllowed($row['url'])) { $link = false; ?> <td style="color: red; text-align: right; padding-right: 1em"><i title="URL is not allowed to be reported to this instance of Show Slow">not allowed</i></td> <td colspan="<?php echo $cols * 2;