routes.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /**
  3. * Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. use OC\Core\Application;
  9. $application = new Application();
  10. $application->registerRoutes($this, array('routes' => array(
  11. array('name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'),
  12. array('name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'),
  13. array('name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'),
  14. array('name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'),
  15. )
  16. ));
  17. // Post installation check
  18. /** @var $this OCP\Route\IRouter */
  19. // Core ajax actions
  20. // Search
  21. $this->create('search_ajax_search', '/core/search')
  22. ->actionInclude('core/search/ajax/search.php');
  23. // AppConfig
  24. $this->create('core_ajax_appconfig', '/core/ajax/appconfig.php')
  25. ->actionInclude('core/ajax/appconfig.php');
  26. // Share
  27. $this->create('core_ajax_share', '/core/ajax/share.php')
  28. ->actionInclude('core/ajax/share.php');
  29. // Tags
  30. $this->create('core_tags_tags', '/tags/{type}')
  31. ->get()
  32. ->action('OC\Core\Tags\Controller', 'getTags')
  33. ->requirements(array('type'));
  34. $this->create('core_tags_favorites', '/tags/{type}/favorites')
  35. ->get()
  36. ->action('OC\Core\Tags\Controller', 'getFavorites')
  37. ->requirements(array('type'));
  38. $this->create('core_tags_ids_for_tag', '/tags/{type}/ids')
  39. ->get()
  40. ->action('OC\Core\Tags\Controller', 'getIdsForTag')
  41. ->requirements(array('type'));
  42. $this->create('core_tags_favorite', '/tags/{type}/favorite/{id}/')
  43. ->post()
  44. ->action('OC\Core\Tags\Controller', 'favorite')
  45. ->requirements(array('type', 'id'));
  46. $this->create('core_tags_unfavorite', '/tags/{type}/unfavorite/{id}/')
  47. ->post()
  48. ->action('OC\Core\Tags\Controller', 'unFavorite')
  49. ->requirements(array('type', 'id'));
  50. $this->create('core_tags_tag', '/tags/{type}/tag/{id}/')
  51. ->post()
  52. ->action('OC\Core\Tags\Controller', 'tagAs')
  53. ->requirements(array('type', 'id'));
  54. $this->create('core_tags_untag', '/tags/{type}/untag/{id}/')
  55. ->post()
  56. ->action('OC\Core\Tags\Controller', 'unTag')
  57. ->requirements(array('type', 'id'));
  58. $this->create('core_tags_add', '/tags/{type}/add')
  59. ->post()
  60. ->action('OC\Core\Tags\Controller', 'addTag')
  61. ->requirements(array('type'));
  62. $this->create('core_tags_delete', '/tags/{type}/delete')
  63. ->post()
  64. ->action('OC\Core\Tags\Controller', 'deleteTags')
  65. ->requirements(array('type'));
  66. // oC JS config
  67. $this->create('js_config', '/core/js/oc.js')
  68. ->actionInclude('core/js/config.php');
  69. // Routing
  70. $this->create('core_ajax_preview', '/core/preview')
  71. ->actionInclude('core/ajax/preview.php');
  72. $this->create('core_ajax_preview', '/core/preview.png')
  73. ->actionInclude('core/ajax/preview.php');
  74. $this->create('core_ajax_update', '/core/ajax/update.php')
  75. ->actionInclude('core/ajax/update.php');
  76. // Avatar routes
  77. $this->create('core_avatar_get_tmp', '/avatar/tmp')
  78. ->get()
  79. ->action('OC\Core\Avatar\Controller', 'getTmpAvatar');
  80. $this->create('core_avatar_get', '/avatar/{user}/{size}')
  81. ->get()
  82. ->action('OC\Core\Avatar\Controller', 'getAvatar');
  83. $this->create('core_avatar_post', '/avatar/')
  84. ->post()
  85. ->action('OC\Core\Avatar\Controller', 'postAvatar');
  86. $this->create('core_avatar_delete', '/avatar/')
  87. ->delete()
  88. ->action('OC\Core\Avatar\Controller', 'deleteAvatar');
  89. $this->create('core_avatar_post_cropped', '/avatar/cropped')
  90. ->post()
  91. ->action('OC\Core\Avatar\Controller', 'postCroppedAvatar');
  92. // Sharing routes
  93. $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) {
  94. $app = new \OCA\Files_Sharing\Application($urlParams);
  95. $app->dispatch('ShareController', 'showShare');
  96. });
  97. $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate')->post()->action(function($urlParams) {
  98. $app = new \OCA\Files_Sharing\Application($urlParams);
  99. $app->dispatch('ShareController', 'authenticate');
  100. });
  101. $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate')->get()->action(function($urlParams) {
  102. $app = new \OCA\Files_Sharing\Application($urlParams);
  103. $app->dispatch('ShareController', 'showAuthenticate');
  104. });
  105. $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) {
  106. $app = new \OCA\Files_Sharing\Application($urlParams);
  107. $app->dispatch('ShareController', 'downloadShare');
  108. });
  109. // used for heartbeat
  110. $this->create('heartbeat', '/heartbeat')->action(function(){
  111. // do nothing
  112. });