-
Notifications
You must be signed in to change notification settings - Fork 0
/
ZipManager.php
122 lines (118 loc) · 3.6 KB
/
ZipManager.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
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
<?php
//check user login
session_start();
if(!$_SESSION['logged']){
header("Location: index.php");
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Zip Manager</title>
<meta charset="UTF-8"/>
<link rel="shortcut icon" href="assets/img/favicon.ico"/>
<!-- Stylesheets -->
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap-responsive.min.css" />
</head>
<div class="container">
<body>
<div class="container">
<!-- Title -->
<div class="page-header">
<h1>
Zip Archives Manger
<small>Currently in Development</small>
<div class="btn-group pull-right">
<a class="btn" href=<?php echo "jsoneditor?url=".$_SESSION['patcherConfig'];?>>Update Config</a>
<a class="btn" href="">Packs</a>
<a class="btn" href="OptionChoser.php">Back</a>
</div>
</div>
<div class="alert alert-info">
<strong>Current Zip Manager Options</strong></br>
<?php
echo "[Github Username]: ".$_SESSION['gitUsername']."</br>";
echo "[Github Repo]: ".$_SESSION['gitRepo']."</br>";
echo "[Github Branch]: ".$_SESSION['gitBranch']."</br>";
echo "[Github Directory]: ".$_SESSION['gitDirectory']."</br>";
echo "[Patcher Config]: ".$_SESSION['patcherConfig']."</br>";
echo "[Local Zip Directory]: ".$_SESSION['zipDirectory']."</br>";
?>
</div>
<hr>
<table class="table table-hover">
<thead>
<tr>
<th>File Name</th>
<th>Date Modified</th>
<th>Options</th>
</tr>
</thead>
<tbody>
<?php
//file names data
$filesData = array();
if ($dir_list = opendir($_SESSION['zipDirectory'])){
while(($filename = readdir($dir_list)) !== false){
//add file name
if (substr($filename, 0, 1) !== '.'){
$filesData[]=$filename;
}
}
}
//sort the names
sort($filesData);
//display in the table
foreach($filesData as &$temp) {
?>
<tr>
<td><?php echo $temp; ?></td>
<td><?php echo date("m-d-Y H:i:s", filemtime($_SESSION['zipDirectory'].$temp)); ?></td>
<td>
<div class="btn-group">
<a class="btn btn-mini btn-success" href=<?php echo "UpdateZip.php?fileName=".$temp; ?>>Update Zip</a>
<a class="btn btn-mini btn-danger" onclick="deleteClicked('<?php echo $temp?>')" href="#"><i class="icon-trash icon-white"></i> Delete</a>
<a class="btn btn-mini" href="<?php echo $_SESSION['zipDirectory'].$temp; ?>"><?php echo $temp; ?></a>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<!--Form for adding a new zip-->
<form action="assets/AddFile.php" method="post">
<div class="form-horizontal">
<input type="text" name="newzip" placeholder="Filename.zip">
<button class="btn btn-success" type="submit" name="submit">Add Zip File</button>
</div>
</form>
</div>
<!-- JS dependencies -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/bootbox.min.js"></script>
<script>
//function for delete popup
function deleteClicked(arg0) {
bootbox.confirm("Do you want to delete this: <b>/"+arg0+"</b>", function(result) {
if(result === true){
//redirect to worker
window.location = "assets/DeleteFile.php?fileName="+arg0;
}
});
}
</script>
</body>
<footer>
</br>
<hr>
<ul class="nav nav-pills">
<li class="pull-left"><a href="">© Soartex 2013-2014 (Made for the Soartex Team by Patrick Geneva)</a></li>
</ul>
</footer>
</div>
</html>