Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
            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;
                ?>
"/>
		<?php 
            } else {
                if (isURLIgnored($row['url'])) {
                    $link = false;
                    ?>
			<td style="color: red; text-align: right; padding-right: 1em"><i title="This URL is ignored by this instance of Show Slow">ignored</i></td>
			<td colspan="<?php 
                    echo $cols * 2;
                    ?>
"/>
		<?php 
                } else {
                    if (!is_null($row['o']) || !is_null($row['ps_o']) || !is_null($row['dt_o'])) {
                        ?>
			<td style="text-align: right; padding-right: 1em"><a title="Time of last check for this URL" href="details/?url=<?php 
                        echo urlencode($row['url']);
                        ?>
"><?php