-
Notifications
You must be signed in to change notification settings - Fork 36
/
catalogdump.php
52 lines (46 loc) · 1.93 KB
/
catalogdump.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
<?php
include("inc/header.php");
$arr = $pdo->query("SELECT * FROM catalogs_buildconfig ORDER BY description DESC")->fetchAll();
?>
<div class='container-fluid'>
<form action='catalogdump.php' method='GET'>
<select name='build'>
<?php foreach($arr as $row){?>
<option value='<?=$row['hash']?>'<? if(!empty($_GET['build']) && $row['hash'] == $_GET['build']){ echo " SELECTED"; }?>><?=$row['description']?></option>
<?php }?>
</select>
<input type='submit'>
</form>
<?php
if(!empty($_GET['build'])){
foreach($arr as $row){
if($row['hash'] == $_GET['build']){
$build = $row;
break;
}
}
}
if(empty($build)) die("No valid build selected");
echo "<pre>";
// Merge fragment catalogs into main catalogs
$json = json_decode(file_get_contents("/var/www/wow.tools/tpr/catalogs/data/" . $build['root_cdn'][0] . $build['root_cdn'][1] . "/" . $build['root_cdn'][2] . $build['root_cdn'][3] . "/" . $build['root_cdn']), true);
if(!empty($json['fragments'])){
for($i = 0; $i < count($json['fragments']); $i++){
$fragment = $json['fragments'][$i];
if (doesFileExist("data", $fragment['hash'], "catalogs")) {
$fragmentjson = json_decode(file_get_contents("/var/www/wow.tools/tpr/catalogs/data/" . $fragment['hash'][0] . $fragment['hash'][1] . "/" . $fragment['hash'][2] . $fragment['hash'][3] . "/" . $fragment['hash']), true);
$json['fragments'][$i]['content'] = $fragmentjson;
}
}
}
if(!empty($json['files']['default'])){
$curr = current($json['files']['default']);
if(doesFileExist("data", $curr['hash'], "catalogs")){
$resourcejson = json_decode(file_get_contents("/var/www/wow.tools/tpr/catalogs/data/" . $curr['hash'][0] . $curr['hash'][1] . "/" . $curr['hash'][2] . $curr['hash'][3] . "/" . $curr['hash']), true);
$json['files']['default']['content'] = $resourcejson;
}
}
print_r($json);
?>
</div>
<?php include "inc/footer.php"; ?>