forked from devsecopsmaturitymodel/DevSecOps-MaturityModel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbib.php
More file actions
96 lines (82 loc) · 1.67 KB
/
bib.php
File metadata and controls
96 lines (82 loc) · 1.67 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* bib.php
*
* @package default
* @see head.php
* @see spiderwebData.php
*/
require __DIR__ . '/vendor/autoload.php';
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
define('NUMBER_LEVELS', 4);
define('IS_SHOW_EVIDENCE_TODO', false);
/**
*
* @param unknown $filename
* @param unknown $delimiter
* @return unknown
*/
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;
}
/**
*
* @param unknown $activityName
* @return unknown
*/
function elementIsSelected($activityName) {
foreach (getCsv() as $element) {
if ($activityName == $element["element"]) {
return true;
}
}
return false;
}
$csvFile = 'selectedData.csv';
/**
*
* @return unknown
*/
function getCsv() {
$csvFile = 'selectedData.csv';
$csv= readCSV($csvFile, ",");
return $csv;
}
/**
*
* @param unknown $array
* @param unknown $index
* @return unknown
*/
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;
}