app.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /**
  3. * @author Björn Schießle <schiessle@owncloud.com>
  4. * @author Gadzy <dev@gadzy.fr>
  5. * @author Joas Schilling <nickvergessen@owncloud.com>
  6. * @author Michael Gapczynski <GapczynskiM@gmail.com>
  7. * @author Robin Appelman <icewind@owncloud.com>
  8. * @author Vincent Petry <pvince81@owncloud.com>
  9. *
  10. * @copyright Copyright (c) 2015, ownCloud, Inc.
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCA\Files_Sharing\Appinfo;
  27. $l = \OC::$server->getL10N('files_sharing');
  28. \OC::$CLASSPATH['OC_Share_Backend_File'] = 'files_sharing/lib/share/file.php';
  29. \OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php';
  30. \OC::$CLASSPATH['OC\Files\Storage\Shared'] = 'files_sharing/lib/sharedstorage.php';
  31. \OC::$CLASSPATH['OC\Files\Cache\SharedScanner'] = 'files_sharing/lib/scanner.php';
  32. \OC::$CLASSPATH['OC\Files\Cache\Shared_Cache'] = 'files_sharing/lib/cache.php';
  33. \OC::$CLASSPATH['OC\Files\Cache\Shared_Permissions'] = 'files_sharing/lib/permissions.php';
  34. \OC::$CLASSPATH['OC\Files\Cache\Shared_Updater'] = 'files_sharing/lib/updater.php';
  35. \OC::$CLASSPATH['OC\Files\Cache\Shared_Watcher'] = 'files_sharing/lib/watcher.php';
  36. \OC::$CLASSPATH['OCA\Files\Share\Maintainer'] = 'files_sharing/lib/maintainer.php';
  37. \OC::$CLASSPATH['OCA\Files\Share\Proxy'] = 'files_sharing/lib/proxy.php';
  38. // Exceptions
  39. \OC::$CLASSPATH['OCA\Files_Sharing\Exceptions\BrokenPath'] = 'files_sharing/lib/exceptions.php';
  40. $application = new Application();
  41. $application->registerMountProviders();
  42. $application->setupPropagation();
  43. \OCP\App::registerAdmin('files_sharing', 'settings-admin');
  44. \OCP\App::registerPersonal('files_sharing', 'settings-personal');
  45. \OCA\Files_Sharing\Helper::registerHooks();
  46. \OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
  47. \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
  48. \OCP\Util::addScript('files_sharing', 'share');
  49. \OCP\Util::addScript('files_sharing', 'external');
  50. \OCP\Util::addStyle('files_sharing', 'sharetabview');
  51. // FIXME: registering a job here will cause additional useless SQL queries
  52. // when the route is not cron.php, needs a better way
  53. \OC::$server->getJobList()->add('OCA\Files_sharing\Lib\DeleteOrphanedSharesJob');
  54. \OC::$server->getActivityManager()->registerExtension(function() {
  55. return new \OCA\Files_Sharing\Activity(
  56. \OC::$server->query('L10NFactory'),
  57. \OC::$server->getURLGenerator()
  58. );
  59. });
  60. $config = \OC::$server->getConfig();
  61. if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') {
  62. \OCA\Files\App::getNavigationManager()->add(
  63. array(
  64. "id" => 'sharingin',
  65. "appname" => 'files_sharing',
  66. "script" => 'list.php',
  67. "order" => 10,
  68. "name" => $l->t('Shared with you')
  69. )
  70. );
  71. if (\OCP\Util::isSharingDisabledForUser() === false) {
  72. \OCA\Files\App::getNavigationManager()->add(
  73. array(
  74. "id" => 'sharingout',
  75. "appname" => 'files_sharing',
  76. "script" => 'list.php',
  77. "order" => 15,
  78. "name" => $l->t('Shared with others')
  79. )
  80. );
  81. // Check if sharing by link is enabled
  82. if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') {
  83. \OCA\Files\App::getNavigationManager()->add(
  84. array(
  85. "id" => 'sharinglinks',
  86. "appname" => 'files_sharing',
  87. "script" => 'list.php',
  88. "order" => 20,
  89. "name" => $l->t('Shared by link')
  90. )
  91. );
  92. }
  93. }
  94. }