index.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. if (cfr('STORAGES')) {
  3. $storages = new Storages();
  4. //storage creation
  5. if (ubRouting::checkPost(array($storages::PROUTE_PATH, $storages::PROUTE_NAME))) {
  6. $creationResult = $storages->create(ubRouting::post($storages::PROUTE_PATH), ubRouting::post($storages::PROUTE_NAME));
  7. if ($creationResult) {
  8. show_error($creationResult);
  9. } else {
  10. ubRouting::nav($storages::URL_ME);
  11. }
  12. }
  13. //storage deletion
  14. if (ubRouting::checkGet($storages::ROUTE_DEL)) {
  15. $deletionResult = $storages->delete(ubRouting::get($storages::ROUTE_DEL));
  16. if ($deletionResult) {
  17. show_error($deletionResult);
  18. } else {
  19. ubRouting::nav($storages::URL_ME);
  20. }
  21. }
  22. //storage edit
  23. if (ubRouting::checkPost(array($storages::PROUTE_ED_STORAGE, $storages::PROUTE_ED_NAME))) {
  24. $storages->saveName(ubRouting::post($storages::PROUTE_ED_STORAGE), ubRouting::post($storages::PROUTE_ED_NAME));
  25. ubRouting::nav($storages::URL_ME);
  26. }
  27. show_window(__('Create new storage'), $storages->renderCreationForm());
  28. show_window(__('Available storages'), $storages->renderList());
  29. } else {
  30. show_error(__('Access denied'));
  31. }