-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
91 lines (91 loc) · 2.89 KB
/
index.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
83
84
85
86
87
88
89
90
91
<?php
session_start();
require('config.php');
require('functions.php');
$orderBy = "addonName";
$orderDir = "asc";
$query = "SELECT id, curseAddonID, addonName, version, lastDownloadID, lastDownloadDateTime, lastDownloadDateTimeHuman, addonURL FROM amz_addonsList ORDER BY ".$orderBy." ".$orderDir;
$result = mysql_query($query);
if($_POST['formSubmitted']){
$filename = "AddonPack-".date('Ymd-His');
if(file_exists($filename))
$filename .= "-".rand().".zip";
else
$filename .= ".zip";
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
if($_POST[$row['id']] == "on"){
$checkQuery = "SELECT curseAddonID, addonName, lastDownloadID from amz_addonsList WHERE id=".$row['id'];
$checkResult = mysql_query($checkQuery);
while($checkRow = mysql_fetch_array($checkResult, MYSQL_ASSOC)){
$curseAddonID = trim($checkRow['curseAddonID']);
$addonName = trim($checkRow['addonName']);
}
if(updateNeeded($curseAddonID)){
if(updateAddon($curseAddonID)){
while(!checkForUpdateCompletion($curseAddonID)) sleep(2);
}else{
die(stripslashes($addonName)." could not be added.");
}
}
if($_POST['onWindows'] == "on"){
shell_exec('cd "cachedZips/'.$row['addonName'].'.dir" && zip -r "../../customZips/'.$filename.'" * && cd ../..');
}else{
shell_exec('cat cachedZips/'.$row['addonName'].'.zip >> customZips/'.$filename);
}
}
}
header("Location: customZips/$filename");
}
?>
<html>
<head>
<title>List Addons</title>
<style type="text/css">
@import url("style.css");
</style>
</head>
<body>
<?php
if (isset($_SESSION['message'])){
echo "<font color=\"blue\">".$_SESSION['message']."</font>";
unset($_SESSION['message']);
}
?>
<p>This page will create a zip file with all of the Addons you select below. One zip file, one download, one extract, every addon updated.</p>
<p> </p>
<p>Check each addon you want to include in your pack.</p>
<p> </p>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table summary="WoW Addon Manager">
<caption>WoW Addon Manager</caption>
<thead>
<th scope="col" class="checkbox">Add</th>
<th scope="col" class="addonName">Addon Name</th>
<th scope="col" class="version">Version</th>
<th scope="col" class="download">Dld</th>
</thead>
<?php
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
if($i%2){
echo ' <tr class="odd">';
}else{
echo ' <tr>';
}
echo '
<td><input type="checkbox" name="'.$row['id'].'" /></td>
<td><a href="'.$row['addonURL'].'">'.$row['addonName'].'</a></td>
<td>'.$row['version'].'</td>
<td><a href="cachedZips/'.$row['addonName'].'.zip"><img src="images/download.gif" width="25" height="25" border="0"></a></td>
</tr>
';
$i++;
}
?>
</table>
<br />
<input type="hidden" name="formSubmitted" value="true" />
<input type="checkbox" name="onWindows" checked /> Using Windows? <br />
<input type="submit" name="submit" value="Download Selected" />
</form>
</body>
</html>