YaWK  24.1
Yet another WebKit
filemanager.php
Go to the documentation of this file.
1 <!-- TAB collapse -->
2 <script type="text/javascript" src="../system/engines/jquery/bootstrap-tabcollapse.js"></script>
3 <!-- data tables JS -->
4 <script type="text/javascript">
5  $(document).ready(function() {
6  /*
7  $('#table-sort').dataTable( {
8  "bPaginate": false,
9  "bLengthChange": false,
10  "bFilter": true,
11  "bSort": true,
12  "bInfo": true,
13  "bAutoWidth": false
14  });
15  */
16 
17  // make bootstrap tabs responsive to improve handheld experience
18  $('#myTab').tabCollapse({
19  tabsClass: 'hidden-sm hidden-xs',
20  accordionClass: 'visible-sm visible-xs'
21  });
22 
23  });
24  /** MAKE SURE THAT THE LAST USED TAB STAYS ACTIVE
25  * thanks to http://stackoverflow.com/users/463906/ricsrock
26  * http://stackoverflow.com/questions/10523433/how-do-i-keep-the-current-tab-active-with-twitter-bootstrap-after-a-page-reload
27  */
28  $(function() {
29  // for bootstrap 3 use 'shown.bs.tab', for bootstrap 2 use 'shown' in the next line
30  $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
31  // save the latest tab; use cookies if you like 'em better:
32  localStorage.setItem('lastTab', $(this).attr('href'));
33  });
34  // go to the latest tab, if it exists:
35  var lastTab = localStorage.getItem('lastTab');
36  if (lastTab) {
37  $('[href="' + lastTab + '"]').tab('show');
38  // to work correctly, we need to lowercase
39  var activeTab = lastTab.toLowerCase();
40  // and remove the first char (#)
41  var activeFolder = activeTab.slice(1);
42  // all done: set select default selected option
43  $('select option[value="'+activeFolder+'"]').prop('selected', true);
44  }
45  });
46 
47 
48  /**
49  * setRenameFieldState(path, itemName)
50  * Update the rename input text field with current content (file or folder)
51  * Set focus on input text field and select all it's content for better usability.
52  * path string contains the current working path
53  * itemName string contains the current item name to be processed (renamed)
54  * itemType string contains the current item type (folder or file)
55  * */
56  function setRenameFieldState(path, itemName, itemType)
57  {
58  // store input field
59  inputField = $("#newItemName");
60  // when rename modal is shown
61  $('#renameModal').on('shown.bs.modal', function () {
62  // set focus on input field and select it
63  $(inputField).focus().select();
64  });
65  // add the current itemName to var
66  inputField.val(itemName);
67  // set path hidden field with value from php function getFilesFromFolder();
68  $("#path").val(path);
69  // set old item name hidden field with value from php
70  $("#oldItemName").val(itemName);
71  // set item type (folder or file) with value from php
72  $("#itemType").val(itemType);
73  // set text of heading div (folder or file) w. value from php
74  $("#fileTypeHeading").text(itemType);
75  // set text of label (folder or file) w. value from php
76  $("#newItemNameLabel").text(itemType);
77  }
78 
79 
80  /**
81  * setChmodFieldState(path, chmodCode)
82  * Update the chmod input text field with current content (eg 0755)
83  * Set focus on the custom input text field and select all it's content for better usability.
84  * path string contains the current working path
85  * chmodCode string contains the current chmod octal number to be processed
86  * */
87  function setChmodCode(item, chmodCode)
88  {
89  // store input field
90  inputField = $("#customChmodCode");
91  // when rename modal is shown
92  $('#chmodModal').on('shown.bs.modal', function () {
93  // set focus on input field and select it
94  $(inputField).focus().select();
95  });
96  // add the folderName to input field
97  inputField.val(chmodCode);
98  $("#item").val(item);
99  }
100 
101  /**
102  * If user switch a folder (tab), the upload folder select option automatically gets set to this folder
103  * called by clicking on <li>TAB links</li> onclick(flipTheSwitch(folder));
104  * @param folder string the folder to switch
105  */
106  function flipTheSwitch(folder)
107  {
108  // get folder and set this option selected to all select fields on that page
109  $('select option[value="'+folder+'"]').prop('selected', true);
110  }
111 // EOF JAVASCRIPT
112 </script>
113 
114 <?php
115 /**
116  * THE PHP PART
117  * cares about all the logic handling. Stuff like
118  * - upload
119  * - delete
120  * - rename
121  * - chmod
122  *
123  */
124 
125 /* UPLOAD FILE PROCESSING */
126 
127 use YAWK\alert;
128 use YAWK\backend;
129 use YAWK\db;
130 use YAWK\filemanager;
131 use YAWK\language;
132 use YAWK\settings;
133 use YAWK\sys;
134 
135 /** @var $db db */
136 /** @var $lang language */
137 
138 if (isset($_POST['upload']))
139 { // folder was selected
140  if (isset($_POST['folderselect']))
141  { // prepare upload folder vars
142  $upload_folder = $_POST['folderselect'];
143  $upload_folder = "../media/$upload_folder/";
144  }
145  else
146  { // no folder selected - set default upload folder
147  $upload_folder = "../media/uploads/";
148  }
149  // check if upload was sent...
150  switch ($_POST['upload'])
151  { // upload is sent
152  case "sent":
153  // set full target path including filename
154  $target_path = $upload_folder . basename( $_FILES['file']['name']);
155  // move file to target path
156  if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path))
157  { // store uploaded file
158  $file = basename( $_FILES['file']['name']);
159  // ok, set syslog entry
160  sys::setSyslog($db, 25, 0, "uploaded <b>$file</b>", 0, 0, 0, 0);
161  // upload OK, throw alert msg
162  print alert::draw("success", "$lang[SUCCESS]", "$lang[UPLOAD_SUCCESSFUL]: $lang[FILE] <strong>".$file."</strong>", "", 800);
163  }
164  else
165  { // could not upload file, throw error
166  $file = basename( $_FILES['file']['name']);
167  // failed - set syslog entry
168  sys::setSyslog($db, 28, 1, "failed to upload <b>$file</b>", 0, 0, 0, 0);
169  // throw error msg
170  print alert::draw("danger", "$lang[ERROR]", "$lang[UPLOAD_FAILED]: ".$_FILES['file']['name']."", "", 5800);
171  }
172  break;
173  }
174 }
175 
176 /* DELETE ITEM PROCESSING */
177 if (isset($_GET['delete']))
178 { // user clicked on delete
179  if ($_GET['delete']==1 AND (isset($_GET['item'])))
180  { // prepare vars
181  if (isset($_GET['path']))
182  {
183  $path = $_GET['path'];
184  }
185  else
186  {
187  $path = '';
188  }
189  $path=$_GET['path'];
190  $item=$_GET['item'];
191  $file="$path"."/"."$item";
192  // execute delete command
193  if (YAWK\filemanager::deleteItem($file) === true)
194  { // DELETE SUCCESSFUL, set syslog entry
195  sys::setSyslog($db, 25, 0, "deleted $file", 0, 0, 0, 0);
196  // throw success msg
197  print alert::draw("success", "$lang[SUCCESS]", "$lang[FILE] $file $lang[DELETE_SUCCESSFUL]","","1200");
198  }
199  else
200  { // DELETE FAILED, set syslog entry
201  sys::setSyslog($db, 28, 1, "failed to delete $file", 0, 0, 0, 0);
202  // throw error msg
203  print alert::draw("danger", "$lang[ERROR]", "$lang[FILE] $file $lang[DELETE_FAILED]","","2400");
204  }
205  }
206 }
207 
208 /* RENAME ITEM PROCESSING */
209 if (isset($_POST['renameItem']) && ($_POST['renameItem'] === "true"))
210 {
211  // check if new item name is set...
212  if (isset($_POST['newItemName']) && (!empty($_POST['newItemName'])))
213  {
214  if (isset($_POST['path']) && (!empty($_POST['path'])))
215  {
216  // remove special chars from folder name
217  $newItemName = filemanager::removeSpecialChars($_POST['newItemName']);
218  // rename from
219  $from = "$_POST[path]/$_POST[oldItemName]";
220  // rename to
221  $to = "$_POST[path]/$newItemName";
222  }
223  // check if item type is set
224  if (isset($_POST['itemType']) && (!empty($_POST['itemType'])))
225  { // set item type var for output in syslog and alert message
226  $itemType = $_POST['itemType'];
227  }
228  else
229  { // item type unknown - leave empty
230  $itemType = 'ITEM';
231  }
232 
233  // rename folder
234  if (rename($from, $to))
235  {
236  sys::setSyslog($db, 25, 0,"folder renamed: $_POST[oldItemName] file to $_POST[newItemName]", 0, 0, 0, 0);
237  echo alert::draw("success", "$lang[SUCCESS]", "$lang[$itemType] $lang[RENAMED]: <i>$_POST[oldItemName]</i> $lang[FILEMAN_TO] <b>$_POST[newItemName]</b>","","1200");
238 
239  }
240  else
241  {
242  sys::setSyslog($db, 28, 0, "failed to rename $_POST[oldItemName] file to $_POST[newItemName]", 0, 0, 0, 0);
243  echo alert::draw("danger", "$lang[ERROR]", "$lang[$itemType] $lang[RENAMED] $_POST[oldFolderName] $lang[FILEMAN_TO] $_POST[newFolderName] $lang[FAILED]","","4800");
244  }
245  }
246 }
247 /* CHMOD ITEM PROCESSING */
248 // check if user clicked on chmod icon
249 if (isset($_POST['chmod']) && ($_POST['chmod'] === "true"))
250 { // check if item is set
251  if (isset($_POST['item']) && (!empty($_POST['item'])))
252  { // check if chmod code is set
253  if (isset($_POST['chmodCode']) && (!empty($_POST['chmodCode'])))
254  { // check if chmod code is selected or not
255  if ($_POST['chmodCode'] === "false")
256  { // check if a custom chmod code is set
257  if (isset($_POST['customChmodCode']))
258  { // overwrite chmodcode with custom code
259  $_POST['chmodCode'] = $_POST['customChmodCode'];
260  }
261  }
262  // do chmod on item...
263  if (chmod($_POST['item'], octdec($_POST['chmodCode'])))
264  { // chmod successful
265  print alert::draw("success", "$lang[SUCCESS]", "$lang[FILEMAN_CHANGED_CHMOD] $lang[TO] $_POST[chmodCode]","","1200");
266  }
267  else
268  { // chmod failed, throw error
269  print alert::draw("success", "$lang[DANGER]", "$lang[FILEMAN_CHANGED_CHMOD] $_POST[item] $lang[TO] $_POST[chmodCode] $_POST[FAILED]","","1200");
270  }
271  }
272  }
273 }
274 
275 /* NEW FOLDER PROCESSING */
276 if (isset($_POST['addFolder']) && ($_POST['addFolder'] === "true"))
277 {
278  // check if new folder is set
279  if (isset($_POST['newFolder']) && (!empty($_POST['newFolder'])))
280  { // remove special chars from new folder
281  $newFolder = filemanager::removeSpecialChars($_POST['newFolder']);
282  }
283  else
284  {
285  $newFolder = '';
286  }
287 
288  if (isset($_POST['folderselect']))
289  { // prepare upload folder vars
290  $selectedFolder = $_POST['folderselect'];
291  $selectedFolder = "../media/$selectedFolder/";
292  }
293  else
294  { // no folder selected - set default upload folder
295  $selectedFolder = "../media/uploads/";
296  }
297 
298  // ok... newFolder is set + checked, store folder is selected...
299  // now merge selectedFolder and newFolder to path used by mkdir
300  $newDirectory = "$selectedFolder$newFolder";
301  // create new folder...
302  if (mkdir($newDirectory))
303  { // CREATE DIR SUCCESSFUL, set syslog entry
304  sys::setSyslog($db, 25, 0, "created new folder: $newDirectory", 0, 0, 0, 0);
305  // throw success msg
306  print alert::draw("success", "$lang[SUCCESS]", "$lang[FOLDER] $newDirectory $lang[CREATED]","","1200");
307  }
308  else
309  { // failed to create directory, set syslog entry
310  sys::setSyslog($db, 28, 1,"failed to create new folder: $newDirectory", 0, 0, 0, 0);
311  // throw success msg
312  print alert::draw("success", "$lang[SUCCESS]", "$lang[FOLDER] $newDirectory $lang[CREATED]","","1200");
313  }
314 }
315 
316 /* when a path is set, user is in a subdirectory.
317  disable all other tabs in that case... */
318 if (isset($_GET['path']) && (!empty($_GET['path'])))
319 {
320  // check, if user is in allowed path
321  if ($_GET['path'] = strstr($_GET['path'], "../media"))
322  { // prepare vars with html content for tabs
323  $firstTabStatus = "class=\"active disabled\"";
324  $disabledStatus = "class=\"disabled\"";
325  $dataToggle = '';
326  }
327  else
328  { // if not - user maybe manipulated $path variable, to see files above ../media - throw error
329  alert::draw("danger", "$lang[ERROR]", "$lang[ACTION_FORBIDDEN]", 0, 6000);
330  }
331 }
332 else
333  { // prepare vars with html content for tabs
334  $firstTabStatus = "class=\"active\"";
335  $dataToggle = " data-toggle=\"tab\"";
337  }
338 ?>
339 <script src="../system/engines/jquery/dropzone/dropzone.js"></script>
340 <link href="../system/engines/jquery/dropzone/dropzone.css" rel="stylesheet">
341 <?php
343 if ($backendSkin == "skin-wp-dark-style")
344 { // if dark backend skin is active, set dropzone background to dark1
345  echo '
346 <style>
347  .dropzone {
348  min-height: 150px;
349  border: 1px dashed #3c8dbc;
350  background: #23282d; !important;
351  padding: 20px 20px;
352  }
353 </style>';
354 }
355 
356 ?>
357 <!-- Content Wrapper. Contains page content -->
358 <div class="content-wrapper" id="content-FX">
359  <!-- Content Header (Page header) -->
360  <section class="content-header">
361  <!-- draw title on top-->
362  <?php echo backend::getTitle($lang['FILEMAN_TITLE'], $lang['FILEMAN_SUBTEXT']); ?>
363  <ol class="breadcrumb">
364  <li><a href="index.php?page=dashboard" title="<?php echo $lang['DASHBOARD']; ?>"><i class="fa fa-dashboard"></i> <?php echo $lang['DASHBOARD']; ?></a></li>
365  <li class="active"><a href="index.php?page=filemanager" title="<?php echo $lang['FILEMANAGER']; ?>"> <?php echo $lang['FILEMANAGER']; ?></a></li>
366  </ol>
367  </section>
368  <!-- Main content -->
369  <section class="content">
370  <div class="row">
371  <div class="col-md-8">
372  <!-- START CONTENT HERE -->
373 <div class="box box-default">
374  <div class="box-body">
375 
376 <?php $maxFileSize = filemanager::getPhpMaxUploadSize(); ?>
377 <!-- FILE UPLOAD MODAL DIALOG -->
378 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
379  <div class="modal-dialog" role="document">
380  <div class="modal-content">
381  <div class="modal-header">
382  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
383  <br>
384  <div class="col-md-1"><h3 class="modal-title"><i class="fa fa-folder-open-o"></i></h3></div>
385  <div class="col-md-11"><h3 class="modal-title"><?php print $lang['FILEMAN_UPLOAD']; ?> (max <?php print $maxFileSize; ?>B)</h3></div>
386  </div>
387  <div class="modal-body">
388  <form enctype="multipart/form-data" class="dropzone" action="index.php?page=filemanager" method="POST">
389  <input type="hidden" name="MAX_FILE_SIZE" value="">
390  <input type="hidden" name="upload" value="sent">
391  <!-- <label for="uploadedfile"></label>
392  <input class="btn btn-default btn-file" id="uploadedfile" name="uploadedfile" type="file" multiple><br> !-->
393 
394  <label for="folderselect"><?php echo $lang['UPLOAD_TO']; ?>: </label>
395  <select id="folderselect" name="folderselect" class="form-control">
396  <option value="audio"><?php echo $lang['FILEMAN_AUDIO']; ?></option>
397  <option value="backup"><?php echo $lang['FILEMAN_BACKUP']; ?></option>
398  <option value="documents"><?php echo $lang['FILEMAN_DOCUMENTS']; ?></option>
399  <option value="downloads"><?php echo $lang['FILEMAN_DOWNLOADS']; ?></option>
400  <option value="images" selected><?php echo $lang['FILEMAN_IMAGES']; ?></option>
401  <option value="uploads"><?php echo $lang['FILEMAN_UPLOADS']; ?></option>
402  <option value="video"><?php echo $lang['FILEMAN_VIDEOS']; ?></option>
403  </select>
404  <br>
405  <div class="modal-footer">
406  <input class="btn btn-large btn-success pull-right" type="submit" value="Datei&nbsp;hochladen" />
407  </div>
408  </form>
409  </div>
410  </div>
411  </div>
412 </div>
413 
414 <!-- Modal --ADD FOLDER -- -->
415 <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModal2Label" aria-hidden="true">
416  <div class="modal-dialog">
417  <div class="modal-content">
418  <form enctype="multipart/form-data" action="index.php?page=filemanager" method="POST">
419  <div class="modal-header">
420  <!-- modal header with close controls -->
421  <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
422  <br>
423  <div class="col-md-1"><h3 class="modal-title"><i class="fa fa-folder-open-o"></i></h3></div>
424  <div class="col-md-11"><h3 class="modal-title"><?php print $lang['FILEMAN_ADD_FOLDER']; ?></h3></div>
425  </div>
426  <div class="modal-body">
427  <input type="hidden" name="addFolder" value="true">
428  <!-- save to... folder select options -->
429  <label for="folderselect"><?php echo $lang['SAVE_TO']; ?> </label>
430  <select id="folderselect" name="folderselect" class="form-control">
431  <optgroup label="Media Folder">
432  <option value="audio"><?php echo $lang['FILEMAN_AUDIO']; ?></option>
433  <option value="backup"><?php echo $lang['FILEMAN_BACKUP']; ?></option>
434  <option value="documents"><?php echo $lang['FILEMAN_DOCUMENTS']; ?></option>
435  <option value="downloads"><?php echo $lang['FILEMAN_DOWNLOADS']; ?></option>
436  <option value="images" selected><?php echo $lang['FILEMAN_IMAGES']; ?></option>
437  <option value="uploads"><?php echo $lang['FILEMAN_UPLOADS']; ?></option>
438  <option value="video"><?php echo $lang['FILEMAN_VIDEOS']; ?></option>
439  <?php
440  // if all subdirectories should be drawn, uncomment the following line
441  filemanager::subdirToOptions("../media/");
442  ?>
443  </select>
444  <!-- new folder -->
445  <label for="newFolder"><?php print $lang['FILEMAN_ADD_FOLDER_LABEL']; ?></label>
446  <input id="newFolder" name="newFolder" class="form-control" placeholder="<?php print $lang['FILEMAN_ADD_FOLDER_PLACEHOLDER']; ?>">
447  </div>
448  <!-- modal footer /w submit btn -->
449  <div class="modal-footer">
450  <input type="hidden" name="move" value="sent">
451  <input class="btn btn-large btn-success" type="submit" value="<?php echo $lang['FILEMAN_ADD_FOLDER_BTN']; ?>">
452  <br><br>
453  </div>
454  </form>
455  </div> <!-- modal content -->
456  </div> <!-- modal dialog -->
457  </div>
458 
459 
460 <!-- Modal --RENAME FOLDER -- -->
461 <div class="modal fade" id="renameModal" tabindex="-1" role="dialog" aria-labelledby="myModal2Label" aria-hidden="true">
462  <div class="modal-dialog">
463  <div class="modal-content">
464  <form enctype="multipart/form-data" action="index.php?page=filemanager" method="POST">
465  <div class="modal-header">
466  <!-- modal header with close controls -->
467  <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> </button>
468  <br>
469  <div class="col-md-1"><h3 class="modal-title"><i class="fa fa-pencil"></i></h3></div>
470  <div class="col-md-11"><h3 class="modal-title"><div id="fileTypeHeading"> <!-- gets filled via JS setRenameFieldState--></div></h3></div>
471  </div>
472 
473  <!-- modal body -->
474  <div class="modal-body">
475  <input type="hidden" id="renameItem" name="renameItem" value="true">
476  <input type="hidden" id="oldItemName" name="oldItemName">
477  <input type="hidden" id="itemType" name="itemType">
478  <input type="hidden" id="path" name="path">
479  <!-- save to... folder select options -->
480  <label id="newItemNameLabel" for="newItemName"><!-- gets filled via JS setRenameFieldState --> </label>
481  <input id="newItemName" class="form-control" name="newItemName" value="" autofocus>
482  </div>
483 
484  <!-- modal footer /w submit btn -->
485  <div class="modal-footer">
486  <input class="btn btn-large btn-success" type="submit" value="<?php echo $lang['RENAME']; ?>">
487  <br><br>
488  </div>
489  </form>
490  </div> <!-- modal content -->
491  </div> <!-- modal dialog -->
492 </div>
493 
494 <!-- Modal --CHMOD WINDOW-- -->
495 <div class="modal fade" id="chmodModal" tabindex="-1" role="dialog" aria-labelledby="myModal2Label" aria-hidden="true">
496  <div class="modal-dialog">
497  <div class="modal-content">
498  <form enctype="multipart/form-data" action="index.php?page=filemanager" method="POST">
499  <div class="modal-header">
500  <!-- modal header with close controls -->
501  <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
502  <br>
503  <div class="col-md-1"><h3 class="modal-title"><i class="fa fa-edit"></i></h3></div>
504  <div class="col-md-11"><h3 class="modal-title"><?php echo $lang['FILEMAN_CHMOD']; ?></h3></div>
505  </div>
506  <!-- modal body -->
507  <div class="modal-body">
508  <input type="hidden" id="chmod" name="chmod" value="true">
509  <input type="hidden" id="item" name="item">
510  <input type="hidden" id="path" name="path">
511 
512  <!-- chmod select field -->
513  <label for="chmodCode"><?php echo $lang['FILEMAN_CHMOD']; ?></label>
514  <select id="chmodCode" name="chmodCode" class="form-control">
515  <option value="false"><?php echo $lang['FILEMAN_CHMOD_SELECT']; ?></option>
516  <optgroup label="<?php echo $lang['FILEMAN_HIGH_SEC_LVL']; ?>"></optgroup>
517  <option value="0600"><?php echo $lang['FILEMAN_0600']; ?></option>
518  <option value="0644"><?php echo $lang['FILEMAN_0644']; ?></option>
519  <optgroup label="<?php echo $lang['FILEMAN_CASUAL_SEC_LVL']; ?>"></optgroup>
520  <option value="0750"><?php echo $lang['FILEMAN_0750']; ?></option>
521  <option value="0755"><?php echo $lang['FILEMAN_0755']; ?></option>
522  <optgroup label="<?php echo $lang['FILEMAN_LOW_SEC_LVL']; ?>"></optgroup>
523  <option value="0777"><?php echo $lang['FILEMAN_0777']; ?></option>
524  </select>
525 
526  <!-- chmod custom field -->
527  <label for="customChmodCode"><?php echo $lang['FILEMAN_CHMOD_CUSTOM']; ?> </label>
528  <input id="customChmodCode" class="form-control" name="customChmodCode" value="">
529  </div>
530 
531  <!-- modal footer /w submit btn -->
532  <div class="modal-footer">
533  <input type="hidden" name="move" value="sent">
534  <input class="btn btn-large btn-success" type="submit" value="<?php echo $lang['FILEMAN_CHMOD']; ?>">
535  <br><br>
536  </div>
537  </form>
538  </div> <!-- modal content -->
539  </div> <!-- modal dialog -->
540 </div>
541 <!-- START FILEMANAGER CONTENT -->
542 <!-- Tabs -->
543 <ul id="myTab" class="nav nav-tabs">
544  <li <?php echo $firstTabStatus; ?>><a href="#images" onclick="flipTheSwitch('images');"<?php echo $dataToggle; ?>><i class="fa fa-picture-o"></i> &nbsp;<?php echo $lang['FILEMAN_IMAGES']; ?></a></li>
545  <li <?php echo $disabledStatus; ?>><a href="#audio" onclick="flipTheSwitch('audio');"<?php echo $dataToggle; ?>><i class="fa fa-music"></i> &nbsp;<?php echo $lang['FILEMAN_AUDIO']; ?></a></li>
546  <li <?php echo $disabledStatus; ?>><a href="#video" onclick="flipTheSwitch('video');"<?php echo $dataToggle; ?>><i class="fa fa-video-camera"></i> &nbsp;<?php echo $lang['FILEMAN_VIDEOS']; ?></a></li>
547  <li <?php echo $disabledStatus; ?>><a href="#documents" onclick="flipTheSwitch('documents');"<?php echo $dataToggle; ?>><i class="fa fa-file-text-o"></i> &nbsp;<?php echo $lang['FILEMAN_DOCUMENTS']; ?></a></li>
548  <li <?php echo $disabledStatus; ?>><a href="#downloads" onclick="flipTheSwitch('downloads');"<?php echo $dataToggle; ?>><i class="fa fa-download"></i> &nbsp;<?php echo $lang['FILEMAN_DOWNLOADS']; ?></a></li>
549  <li <?php echo $disabledStatus; ?>><a href="#uploads" onclick="flipTheSwitch('uploads');"<?php echo $dataToggle; ?>><i class="fa fa-upload"></i> &nbsp;<?php echo $lang['FILEMAN_UPLOADS']; ?></a></li>
550  <li <?php echo $disabledStatus; ?>><a href="#backup" onclick="flipTheSwitch('backup');"<?php echo $dataToggle; ?>><i class="fa fa-file-zip-o"></i> &nbsp;<?php echo $lang['FILEMAN_BACKUP']; ?></a></li>
551  <?php
552  $webmail_active = settings::getSetting($db, "webmail_active");
553  if ($webmail_active == true)
554  {
555  echo '<li '.$disabledStatus.'><a href="#mailbox" '.$dataToggle.'><i class="fa fa-envelope-o"></i> &nbsp;'.$lang["WEBMAIL"].'</a></li>';
556  }
557  ?>
558 </ul>
559 
560 <!-- content start -->
561 <div id="myTabContent" class="tab-content">
562  <!-- images folder -->
563  <div class="tab-pane fade in active" id="images">
564  <br>
566  <?php YAWK\filemanager::getFilesFromFolder("../media/images", $lang); ?>
568  </div>
569  <!-- audio folder -->
570  <div class="tab-pane fade in" id="audio">
571  <br>
573  <?php YAWK\filemanager::getFilesFromFolder("../media/audio", $lang); ?>
575  </div>
576  <!-- video folder -->
577  <div class="tab-pane fade in" id="video">
578  <br>
580  <?php YAWK\filemanager::getFilesFromFolder("../media/video", $lang); ?>
582  </div>
583  <!-- documents folder -->
584  <div class="tab-pane fade in" id="documents">
585  <br>
587  <?php YAWK\filemanager::getFilesFromFolder("../media/documents", $lang); ?>
589  </div>
590  <!-- downloads folder -->
591  <div class="tab-pane fade in" id="downloads">
592  <br>
594  <?php YAWK\filemanager::getFilesFromFolder("../media/downloads", $lang); ?>
596  </div>
597  <!-- upload folder -->
598  <div class="tab-pane fade in" id="uploads">
599  <br>
601  <?php YAWK\filemanager::getFilesFromFolder("../media/uploads", $lang); ?>
603  </div>
604  <!-- backup folder -->
605  <div class="tab-pane fade in" id="backup">
606  <br>
608  <?php YAWK\filemanager::getFilesFromFolder("../media/backup", $lang); ?>
610  </div>
611  <!-- webmail folder (mailbox attachments) -->
612  <?php
613  if ($webmail_active == true)
614  {
615  echo "
616  <div class=\"tab-pane fade in\" id=\"mailbox\">
617  <br>";
619  YAWK\filemanager::getFilesFromFolder("../media/mailbox", $lang);
621  echo"</div>";
622  }
623  ?>
624 </div>
625 
626  </div>
627 </div>
628  </div>
629  <div class="col-md-4">
630  <div class="box box-default">
631  <div class="box-header">
632  <h3 class="box-title"><?php print $lang['FILEMAN_UPLOADS']; ?></h3>
633  <!-- add folder btn -->
634  <a class="btn btn-success" data-toggle="modal" data-target="#myModal2" href="#myModal" style="float:right;">
635  <i class="fa fa-folder-open-o"></i> &nbsp;<?php print $lang['FILEMAN_NEW_FOLDER']; ?></a>
636  </div>
637  <div class="box-body">
638  <form action="index.php?page=filemanager" method="POST" class="dropzone" enctype="multipart/form-data">
639  <input type="hidden" name="MAX_FILE_SIZE" value="">
640  <input type="hidden" name="upload" value="sent">
641  <!-- <label for="uploadedfile"></label>
642  <input class="btn btn-default btn-file" id="uploadedfile" name="uploadedfile" type="file" multiple> -->
643 
644  <label for="folderselect"><?php echo $lang['UPLOAD_TO']; ?> </label>
645  <select id="folderselect" name="folderselect" class="form-control">
646  <optgroup label="Media Folder">
647  <option value="audio"><?php echo $lang['FILEMAN_AUDIO']; ?></option>
648  <option value="backup"><?php echo $lang['FILEMAN_BACKUP']; ?></option>
649  <option value="documents"><?php echo $lang['FILEMAN_DOCUMENTS']; ?></option>
650  <option value="downloads"><?php echo $lang['FILEMAN_DOWNLOADS']; ?></option>
651  <option value="images" selected><?php echo $lang['FILEMAN_IMAGES']; ?></option>
652  <option value="uploads"><?php echo $lang['FILEMAN_UPLOADS']; ?></option>
653  <option value="video"><?php echo $lang['FILEMAN_VIDEOS']; ?></option>
654  <?php
655  filemanager::subdirToOptions("../media/");
656  ?>
657  </select>
658  </form>
659  </div>
660  </div>
661  </div>
662 </div>
$disabledStatus
$webmail_active
$maxFileSize
print $lang['FILEMAN_UPLOAD']
$backendSkin
$dataToggle
if(!isset($language)||(!isset($lang))) $item
Throws a fancy Bootstrap Alert (success, info, warning or danger)
Definition: alert.php:19
Backend class serves a few useful functions for the admin backend.
Definition: backend.php:27
Mysqli database class; returns db connection object.
Definition: db.php:16
Basic File Manager (Backend)
Definition: filemanager.php:17
static getFilesFromFolder($folder, $lang)
returns a list of all files in given folder. expect $folder as string
static drawTableFooter()
draw: output html end table body, end table
Definition: filemanager.php:81
static drawTableHeader($lang, $i)
draw the table header with labeling
Definition: filemanager.php:53
The language class - support multilingual backend.
Definition: language.php:17
Settings class: get and set YaWK system settings.
Definition: settings.php:9
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470
The sys class - handles yawk's system core functions.
Definition: sys.php:17
FuckAdBlock prototype on
Definition: fuckAdBlock.js:227
function a
Definition: browser.js:14
type
Definition: menu-new.php:35
This class serves methods to create backup from files.
Definition: AdminLTE.php:2
print $page title
Definition: page-edit.php:377
print $_GET['id']
Definition: page-edit.php:357
function e
Definition: plyr.js:1
function i(e, t)
Definition: plyr.js:1
function w(e, t)
Definition: plyr.js:1
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
$target_path
$template name
document ready(function() { $('a[data-confirm]').click(function(ev) { modal='#dataConfirmModal';var href=$(this).attr('href');var title=$(this).attr('title');var icon=$(this).attr('data-icon');if(!icon) { icon='fa fa-trash-o';} if(!$(modal).length) { $('body').append('< div id="dataConfirmModal" class="modal fade" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true">< div class="modal-dialog">< div class="modal-content">< div class="modal-header">< button type="button" class="close" data-dismiss="modal" aria-hidden="true">< i class="fa fa-times"></i ></button >< br >< div class="col-md-1">< h3 class="modal-title">< i class="'+icon+'"></i ></h3 ></div >< div class="col-md-11">< h3 class="modal-title" id="dataConfirmLabel">'+title+'</h3 ></div ></h3 ></div >< div class="modal-body"></div >< div class="modal-footer">< button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Abbrechen</button >< a type="button" class="btn btn-danger" id="dataConfirmOK">< i class="'+icon+'"></i > L &ouml;schen</a ></div ></div ></div ></div >');} $(modal).find('.modal-body').text($(this).attr('data-confirm'));$('#dataConfirmOK').attr('href', href);$(modal).modal({show:true});return false;});$('#terminateUser').click(function() { var terminate=window.confirm("ACHTUNG!\nDas wird Deinen Account permanent deaktivieren.\n"+"Bist Du Dir sicher, dass Du das tun willst?");if(terminate===true) { var terminateUser=window.confirm("Bist Du Dir wirklich ganz sicher?\n"+"Diese Aktion kann nicht rueckgaengig gemacht werden.");if(terminateUser===true) { $.get('system/templates/YaWK-bootstrap3/js/terminate-user.php', function(data) { if(data==="true") { setTimeout("window.location='logout.html'", 0);} else { alert("Fehler: "+data);} });} } });function dismissNotifications() { $.ajax({ url:'js/dismiss-notifications.php', type:'POST', success:function(data) { if(!data) { alert('Something went wrong!');return false;} } });$("#bell-label").fadeOut();$('#notification-header').html('You have 0 notifications');$('#notification-menu').fadeOut();} $("#dismiss").click(function() { dismissNotifications();});function disableButtons(delay) { $('#loginButton').removeClass().addClass('btn btn-success disabled').attr('id', 'LOGIN_FORBIDDEN');$('#resetPasswordButton').removeClass().addClass('btn btn-danger disabled');setTimeout(function() { $('#LOGIN_FORBIDDEN').attr('id', 'loginButton').removeClass().addClass('btn btn-success');$('#resetPasswordButton').removeClass().addClass('btn btn-danger');}, delay);} $("#loginButton").click(function(){ if($('#loginButton').length > 0) { if($('#loginButton').hasClass('btn') &&$('#loginButton').hasClass('btn-success') &&$('#loginButton').hasClass('disabled')) { } else { $("#loginForm").submit();disableButtons(10000);} } else if($('#LOGIN_FORBIDDEN').length > 0) { if($('#LOGIN_FORBIDDEN').hasClass('btn') &&$('#LOGIN_FORBIDDEN').hasClass('btn-success') &&$('#LOGIN_FORBIDDEN').hasClass('disabled')) { } else { } } });$("#blockedBtn").hover(function() { $("#blockedBtn").hide();$("#askBtn").fadeIn(820);});})