forked from devsecopsmaturitymodel/DevSecOps-MaturityModel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bib.php
59 lines (53 loc) · 1.34 KB
/
bib.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
<?php
error_reporting(E_ERROR);
define(NUMBER_LEVELS, 4);
define(IS_SHOW_EVIDENCE_TODO, false);
function readCSV($filename, $delimiter)
{
if (!file_exists($filename) || !is_readable($filename))
return FALSE;
$header = NULL;
$data = array();
if (($handle = fopen($filename, 'r')) !== FALSE) {
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
if (!$header)
$header = $row;
else
$data[] = array_combine($header, $row);
}
fclose($handle);
}
return $data;
}
function elementIsSelected($activityName)
{
foreach (getCsv() as $element) {
if ($activityName == $element["element"]) {
return true;
}
}
return false;
}
$csvFile = 'selectedData.csv';
function getCsv() {
$csvFile = 'selectedData.csv';
$csv= readCSV($csvFile, ",");
return $csv;
}
function getFlattenedArray($array, $index) {
if(!array_key_exists($index, $array)) {
return "TODO";
}
$return = "";
$potentialArray = $array[$index];
if(is_array($potentialArray)) {
$return .= "<ul>";
foreach($potentialArray as $element => $content) {
$return .= "<li>$content</li>";
}
$return .= "</ul>";
}else {
$return .= $potentialArray;
}
return $return;
}