-
Notifications
You must be signed in to change notification settings - Fork 1
/
tcproxy.php
executable file
·82 lines (55 loc) · 1.81 KB
/
tcproxy.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
80
81
82
<?php
#echo "labas";
function getUrl($url){
$html = file_get_contents($url);
return $html;
}
switch ($_GET['type'])
{
case 'managers':
$html = getUrl("https://cmstags.cern.ch/tc/CategoriesManagersJSON");
$lists = explode("}, {", $html);
echo str_replace("[{", "{", $lists[0]."}");
break;
case 'users':
$html = getUrl("https://cmstags.cern.ch/tc/CategoriesManagersJSON");
$lists = explode("}, {", $html);
echo str_replace("}]", "}", "{".$lists[1]);
break;
case 'packages':
if (isset($_GET['release']) && $_GET['release'] != ""){
$release = $_GET['release'];
$html = getUrl("https://cmstags.cern.ch/tc/CategoriesPackagesJSON?release=".$release);
echo $html;
}
else{
echo "CMSSW release version is not provided";
}
break;
case 'tags':
if (isset($_GET['release']) && $_GET['release'] != ""){
$release = $_GET['release'];
$html = getUrl("https://cmstags.cern.ch/tc/ReleaseTagsXML?release=".$release);
$html = str_replace("\"", "", $html);
$html = str_replace("<tags>\n", "", $html);
$html = str_replace("\n</tags>", "", $html);
$html = str_replace("<tag name=", "", $html);
$html = str_replace("tag=", "", $html);
$html = str_replace(" />", "", $html);
$html = str_replace(" ", "", $html);
$html = str_replace("\n\n", "", $html);
echo $html;
}
else{
echo "CMSSW release version is not provided";
}
break;
default:
echo "How to use?<br/>
Examples:<br/>
<a href=tcproxy.php?type=managers>tcproxy.php?type=managers</a> <br/>
<a href=tcproxy.php?type=users>tcproxy.php?type=users</a> <br/>
<a href=tcproxy.php?type=packages&release=CMSSW_4_4_2>tcproxy.php?type=packages&release=CMSSW_4_4_2</a> (change release) <br/>
<a href=tcproxy.php?type=tags&release=CMSSW_4_4_2>tcproxy.php?type=tags&release=CMSSW_4_4_2</a> (change release)";
}
?>