This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathtools.php
60 lines (49 loc) · 1.65 KB
/
tools.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
<?php
require_once './include_functions.php';
ksess_verify(1);
function stringToColorCode($str) {
$code = dechex(crc32($str));
$code = substr($code, 0, 6);
return $code;
}
if (isset($_GET['highlight'])) {
$highlight = filter_numbers($_GET['highlight']);
} else {
$highlight = "";
}
// Declare variables
$_GET['populate'] = isset($_GET['populate']) ? $_GET['populate'] : '';
$fields = array();
foreach ($_SESSION['all_tools'] as $tool) { // Get tool information based on GET parameter
if ($tool['id'] === $_GET['populate']) {
$fields['id'] = $tool['id'];
$fields['product_name'] = $tool['product_name'];
$fields['hw_version'] = $tool['hw_version'];
$fields['sw_version'] = $tool['sw_version'];
$fields['serialno'] = $tool['serialno'];
$fields['flags'] = $tool['flags'];
$fields['attr_1'] = $tool['attr_1'];
$fields['attr_2'] = explode(",", $tool['attr_2']);
$fields['attr_3'] = $tool['attr_3'];
$fields['attr_4'] = json_decode($tool['attr_4'], true);
}
}
$tool_reservations = array();
foreach ($_SESSION['all_tools'] as $tool) {
$tool_reservations[$tool['id']] = json_decode($tool['attr_4'], true);
}
$i = 0;
while ($i < 100) {
$evcolors[] = "#" . substr(str_shuffle("5566778899AABBCC"), 0, 6);
$i++;
}
$_SESSION['message_set'] = false;
echo $twig->render('tools.twig', array(
'evcolors' => array_unique($evcolors),
'highlight' => $highlight,
'session' => $_SESSION,
'settings' => $prefs['settings'],
'lang' => $_SESSION['lang'],
'fields' => $fields,
'tool_reservations' => $tool_reservations
));