-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
126 lines (100 loc) · 2.31 KB
/
index.php
File metadata and controls
126 lines (100 loc) · 2.31 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
namespace CFPropertyList;
$basepath = 'http://localhost:8888/munki'; // Path to the munkirepo
$catalog = 'production'; // Catalog name
$apps = array();
error_reporting( E_ALL );
ini_set( 'display_errors', 'on' );
require_once('CFPropertyList/classes/CFPropertyList/CFPropertyList.php');
// Parse catalog
$production_cat = new CFPropertyList();
$production_cat->parse(file_get_contents("$basepath/catalogs/$catalog"));
// Fill apps array
foreach($production_cat->toArray() AS $key => $val)
{
if(isset($apps[$val['name']]) && $apps[$val['name']]['version'] > $val['version'])
{
continue; // Item with higher version already in list
}
$apps[$val['name']] = array('version' => $val['version']);
$apps[$val['name']]['display_name'] = isset($val['display_name']) ? $val['display_name'] : $val['name'];
$apps[$val['name']]['desc'] = isset($val['description']) ? $val['description'] : '';
}
sort($apps);
?>
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Mac OSX Applications</title>
<style type="text/css" media="screen">
body
{
margin: 0 0 40px 0;
padding: 0;
background: #fff;
font-family: Arial, Helvetica, sans-serif;
font-size: 1em;
line-height: 1.4;
}
h1, p, h2
{
margin-left: 20px;
margin-right: 20px;
}
.wrapper
{
width: 966px;
padding: 0 0 20px 0;
margin: auto;
box-shadow:0px 0px 12px #333;
}
.logo
{
display: block;
height: 96px;
background:rgb(25, 148, 212);
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
}
.error
{
padding: 4px;
background: #fee;
color: #f33;
border: 1px solid #f00;
}
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
/*
* For IE 6/7 only
* Include this rule to trigger hasLayout and contain floats.
*/
.clearfix {
*zoom: 1;
}
</style>
</head>
<body>
<div class="wrapper clearfix">
<a class="logo" href="#">To the company website</a>
<h1>Catalog <?=$catalog?></h1>
<?php foreach($apps AS $app):?>
<h2><?php echo $app['display_name'].' ('.$app['version'].')'?></h2>
<?if(strpos($app['desc'], 'html>')):?>
<?php echo str_replace("html>", "p>", $app['desc'])?>
<?else:?>
<p><?php echo str_replace("\n", "<br>\n", $app['desc'])?></p>
<?endif?>
<?php endforeach?>
</div>
</body>
</html>