index.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. $altCfg = $ubillingConfig->getAlter();
  3. if ($altCfg['PHOTOSTORAGE_ENABLED']) {
  4. if (cfr('PHOTOSTORAGE')) {
  5. if (ubRouting::checkGet(array('scope', 'itemid'))) {
  6. $photoStorage = new PhotoStorage(ubRouting::get('scope'), ubRouting::get('itemid'));
  7. //catch ajax webcam upload request
  8. if (ubRouting::checkGet('uploadcamphoto')) {
  9. $photoStorage->catchWebcamUpload();
  10. }
  11. //catch file upload request
  12. if (ubRouting::checkGet('uploadfilephoto')) {
  13. $customBackLink = ubRouting::get('custombacklink');
  14. $photoStorage->catchFileUpload($customBackLink);
  15. }
  16. //catch file download
  17. if (ubRouting::checkGet('download')) {
  18. $photoStorage->catchDownloadImage(ubRouting::get('download'));
  19. }
  20. //catch file deletion event
  21. if (ubRouting::checkGet('delete')) {
  22. $photoStorage->catchDeleteImage(ubRouting::get('delete'));
  23. }
  24. //show webcam snapshot form
  25. if (ubRouting::checkGet('mode')) {
  26. $modeSet = ubRouting::get('mode');
  27. switch ($modeSet) {
  28. //webcamera snapshot
  29. case 'cam':
  30. show_window(__('Webcamera snapshot'), $photoStorage->renderWebcamForm(false));
  31. break;
  32. //webcamera cropped snapshot
  33. case 'avacam':
  34. show_window(__('Webcamera snapshot') . ' - ' . __('avatar'), $photoStorage->renderWebcamForm(true));
  35. break;
  36. //just file upload interface
  37. case 'loader':
  38. show_window(__('Upload images'), $photoStorage->renderUploadForm());
  39. break;
  40. //listing images for some object
  41. case 'list':
  42. show_window(__('Upload images'), $photoStorage->uploadControlsPanel());
  43. show_window(__('Uploaded images'), $photoStorage->renderImagesList());
  44. break;
  45. }
  46. }
  47. } else {
  48. $photoStorage = new PhotoStorage('GALLERY', 'nope'); //just generic scope here
  49. //catch proxy-mode image request
  50. if (ubRouting::checkGet($photoStorage::ROUTE_PROXY)) {
  51. $photoStorage->proxyImage(ubRouting::get($photoStorage::ROUTE_PROXY));
  52. }
  53. // rendering uploaded images gallery
  54. show_window(__('Uploaded images'), $photoStorage->renderScopesGallery(12, true));
  55. zb_BillingStats(true, 'photogallery');
  56. }
  57. } else {
  58. show_error(__('You cant control this module'));
  59. }
  60. } else {
  61. show_error(__('This module disabled'));
  62. }