-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkResourceLinks.php
79 lines (56 loc) · 1.44 KB
/
checkResourceLinks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/* Copyright 2018 Atos SE and Worldline
* Licensed under MIT (https://github.com/atosorigin/DevOpsMaturityAssessment/blob/master/LICENSE) */
$isForm = FALSE;
$activePage = 'Resources';
require 'header.php';
require 'renderAdvice.php';
function CheckURL($Href)
{
$urlHeaders = @get_headers($Href);
if(!$urlHeaders || $urlHeaders[0] == 'HTTP/1.1 404 Not Found')
{
$exists = false;
}
else
{
$exists = true;
}
return $exists;
}
?>
<div class="container-fluid">
<div class="row">
<div class="col-xl-9 col-lg-11 pt-0 pb-4 rounded text-left mx-auto">
<div class="bg-light rounded p-2 p-sm-4 border-primary border ml-sm-2 ml-xs-2 mb-2 mr-sm-2 mr-xs-2">
<?php
$counter = 0;
foreach ($advice as $adviceIndex=>$adviceSection)
{
if ( $adviceIndex != "//" )
{
foreach ( $adviceSection['Links'] as $link )
{
$counter++;
$testText = '';
if ( CheckURL($link['Href']) )
{
$testText = '<b><font color="green">OK</font></em></b>';
}
else
{
$testText = '<b><font color="red">Not Available</font></b>';
}
?>
<p><?=$counter?>. <a href="<?=$link['Href']?>"><?=$link['Text']?></a> <?=$testText?></p>
<?php
}
}
} ?>
</div>
</div>
</div>
</div>
<?php
require 'footer.php';
?>