|
3 | 3 | * The Unzipper extracts .zip or .rar archives and .gz files on webservers. |
4 | 4 | * It's handy if you do not have shell access. E.g. if you want to upload a lot |
5 | 5 | * of files (php framework or image collection) as an archive to save time. |
6 | | - * As of version 0.1.0 it also supports creating archives. |
7 | 6 | * |
8 | 7 | * @author Andreas Tasch, at[tec], attec.at; Stefan Boguth, Boguth.org |
9 | 8 | * @license GNU GPL v3 |
10 | | - * @version 0.2.4 |
| 9 | + * @version 0.2.8 |
11 | 10 | */ |
12 | | -define('VERSION', '0.2.4'); |
13 | | -$GLOBALS['status'] = array(); |
| 11 | +define('VERSION', '0.2.8'); |
| 12 | + |
14 | 13 | include 'resources/classes/unzip.php'; |
15 | | -$unzipper = new Unzipper; |
| 14 | +$unzipper = new Unzipper(); |
| 15 | +session_start(); |
| 16 | +$_SESSION['status'] = array(); |
| 17 | +$_SESSION['status'] = array('info' => 'Zippy erfolgreich gestartet. Bereit für weitere Aufgaben.'); |
16 | 18 |
|
17 | 19 | if (isset($_POST['dounzip'])) { |
18 | | - $postcont = "unzip"; |
| 20 | + $postcont = 'unzip'; |
19 | 21 | } |
20 | 22 | if (isset($_POST['dozip'])) { |
21 | | - $postcont = "zip"; |
| 23 | + $postcont = 'zip'; |
22 | 24 | } |
23 | 25 | if (isset($_POST['upload'])) { |
24 | | - $postcont = "upload"; |
| 26 | + $postcont = 'upload'; |
25 | 27 | } |
26 | 28 | if (isset($_POST['explorer'])) { |
27 | | - $postcont = "explorer"; |
| 29 | + $postcont = 'explorer'; |
28 | 30 | } else { |
29 | | - $setexp = false; |
| 31 | + $setexp = false; |
30 | 32 | } |
31 | 33 |
|
32 | 34 | switch ($postcont) { |
|
38 | 40 | include 'resources/classes/explorer.php'; |
39 | 41 | $exppath = !empty($_POST['exppath']) ? strip_tags($_POST['exppath']) : '.'; |
40 | 42 | $setexp = true; |
41 | | - if (!empty($_POST['exppath'])) { |
42 | | - $GLOBALS['status'] = array('success' => 'Verzeichnis erfolgreich geöffnet.'); |
43 | | - } |
44 | | - else { |
45 | | - $GLOBALS['status'] = array('error' => 'Kein Pfad angegeben!'); |
| 43 | + if (empty($_POST['exppath'])) { |
| 44 | + $_SESSION['status'] = array('error' => 'Kein Pfad angegeben!'); |
46 | 45 | } |
47 | 46 | break; |
48 | 47 | case zip: |
49 | 48 | include 'resources/classes/zipper.php'; |
50 | 49 | $zippath = !empty($_POST['zippath']) ? strip_tags($_POST['zippath']) : '.'; |
51 | 50 | // Resulting zipfile e.g. zipper--2016-07-23--11-55.zip |
52 | | - $zipfile = 'zipper-' . date("Y-m-d--H-i") . '.zip'; |
| 51 | + $zipfile = 'zipper-'.date('Y-m-d--H-i').'.zip'; |
53 | 52 | Zipper::zipDir($zippath, $zipfile); |
54 | 53 | break; |
55 | 54 | case unzip: |
|
87 | 86 | <body> |
88 | 87 | <div class="animated zoomIn wrapper"> |
89 | 88 | <div class="innerwrapper"> |
90 | | - <p class="status status--<?php echo strtoupper(key($GLOBALS['status'])); ?>"> |
91 | | - <b>Status:</b> <?php echo reset($GLOBALS['status']); ?><br/> |
| 89 | + <p class="status status--<?php echo strtoupper(key($_SESSION['status'])); ?>"> |
| 90 | + <b>Status:</b> <?php echo reset($_SESSION['status']); ?><br/> |
92 | 91 | </p> |
93 | 92 | <div id="logo"> |
94 | 93 | <img src="resources/gfx/logo.png" alt="Logo" /> |
|
100 | 99 | <label for="zipfile">Wählen Sie ein .rar, .zip oder .gz-Archiv das sie entpacken wollen:</label> |
101 | 100 | <select name="zipfile" size="1" class="select"> |
102 | 101 | <?php foreach ($unzipper->zipfiles as $zip) { |
103 | | - echo "<option>$zip</option>"; |
104 | | - } |
| 102 | + echo "<option>$zip</option>"; |
| 103 | + } |
105 | 104 | ?> |
106 | 105 | </select> |
107 | 106 | <?php if (count($unzipper->zipfiles) == 0) { |
108 | | - echo "<b>Keine Dateien zum entpacken vorhanden!</b>"; |
109 | | - }; |
| 107 | + echo '<b>Keine Dateien zum entpacken vorhanden!</b>'; |
| 108 | + } |
110 | 109 | ?> |
111 | 110 | <p class="info">Die zu entpackenden Archive müssen sich in folgendem Pfad befinden: <?php echo __DIR__ ?></p> |
112 | 111 | <label for="extpath">Pfad zum Entpacken (Optional):</label> |
|
133 | 132 | <label for="uploader">Hochzuladende Datei:</label> |
134 | 133 | <input type="file" name="uploaded" class="form-field" id="fileinput" /> |
135 | 134 | <output id="list"></output> |
136 | | - <p class="info">Der Uploader benötigt Schreibrechte im Verzeichnis! Die Dateien werden in den Pfad Upload verschoben.<br> <b>Der Uploader akzeptiert nur .rar, .zip und .gz-Dateien mit maximal 10MB.</b></p> |
| 135 | + <p class="info">Der Uploader benötigt Schreibrechte im Verzeichnis! Die Dateien werden in den Pfad Upload verschoben.<br> <b>Der Uploader akzeptiert nur .rar, .zip und .gz-Dateien mit maximal <?php echo ("<span id='maxsize' value='" . ini_get('upload_max_filesize') . "'</span>" . ini_get('upload_max_filesize') . "B.") ?></b></p> |
137 | 136 | <input type="submit" name="upload" class="submit" value="Hochladen" id="uploadclick"/> |
138 | | - |
139 | 137 | </div> |
140 | 138 | </fieldset> |
141 | 139 | </form> |
142 | 140 | <form action="" method="POST"> |
143 | 141 | <fieldset class="field"> |
144 | | - <h1>Datei-Explorer (beta)</h1><div class="<?php |
145 | | - if($setexp == true) { |
146 | | - echo ('icon icon-up'); |
147 | | - } |
148 | | - else { |
149 | | - echo ('icon'); |
| 142 | + <h1>Datei-Explorer (alpha)</h1><div class="<?php |
| 143 | + if ($setexp == true) { |
| 144 | + echo 'icon icon-up'; |
| 145 | + } else { |
| 146 | + echo 'icon'; |
150 | 147 | } ?>"></div> |
151 | 148 | <div class="innercont<?php |
152 | | - if($setexp == true) { |
153 | | - echo (''); |
154 | | - } |
155 | | - else { |
156 | | - echo (' hide'); |
| 149 | + if ($setexp == true) { |
| 150 | + echo ''; |
| 151 | + } else { |
| 152 | + echo ' hide'; |
157 | 153 | } ?> animated fadeIn"> |
158 | 154 | <label for="exppath">Anzuzeigender Pfad:</label> |
159 | 155 | <input type="text" name="exppath" class="form-field" /> |
160 | 156 | <p class="info">Sie navigieren vom Verzeichnis des Scriptes aus, verwenden sie also z.B. ../ um eine Ebene höher zu springen.</p> |
161 | 157 | <input type="submit" name="explorer" class="submit" value="Anzeigen"/> |
162 | 158 | <?php |
163 | 159 | if ($setexp == true && strlen($exppath) > 1) { |
164 | | - echo ("<p>Geöffneter Pfad: " . $exppath . " </p>"); |
165 | | - Explorer::createExplorer($exppath); |
| 160 | + echo '<p>Geöffneter Pfad: '.$exppath.' </p>'; |
| 161 | + Explorer::createExplorer($exppath); |
166 | 162 | } |
167 | 163 | ?> |
168 | 164 | </div> |
169 | 165 | </fieldset> |
170 | 166 | </form> |
171 | | - |
172 | 167 | <p class="version">Unzipper Version: <?php echo VERSION; ?></p> |
173 | 168 | </div> |
174 | 169 | </div> |
|
0 commit comments