dav.lib.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /* Copyright (C) 2018 Destailleur Laurent <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/dav/dav.lib.php
  19. * \ingroup dav
  20. * \brief Server DAV
  21. */
  22. // define CDAV_CONTACT_TAG if not
  23. if (!defined('CDAV_CONTACT_TAG')) {
  24. if (isset($conf->global->CDAV_CONTACT_TAG)) {
  25. define('CDAV_CONTACT_TAG', $conf->global->CDAV_CONTACT_TAG);
  26. } else {
  27. define('CDAV_CONTACT_TAG', '');
  28. }
  29. }
  30. // define CDAV_URI_KEY if not
  31. if (!defined('CDAV_URI_KEY')) {
  32. if (isset($conf->global->CDAV_URI_KEY)) {
  33. define('CDAV_URI_KEY', $conf->global->CDAV_URI_KEY);
  34. } else {
  35. define('CDAV_URI_KEY', substr(md5($_SERVER['HTTP_HOST']), 0, 8));
  36. }
  37. }
  38. /**
  39. * Prepare array with list of tabs
  40. *
  41. * @return array Array of tabs to show
  42. */
  43. function dav_admin_prepare_head()
  44. {
  45. global $db, $langs, $conf;
  46. $h = 0;
  47. $head = array();
  48. $head[$h][0] = DOL_URL_ROOT.'/admin/dav.php?id='.$object->id;
  49. $head[$h][1] = $langs->trans("WebDAV");
  50. $head[$h][2] = 'webdav';
  51. $h++;
  52. // Show more tabs from modules
  53. // Entries must be declared in modules descriptor with line
  54. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  55. // $this->tabs = array('entity:-tabname); to remove a tab
  56. complete_head_from_modules($conf, $langs, null, $head, $h, 'admindav');
  57. complete_head_from_modules($conf, $langs, null, $head, $h, 'admindav', 'remove');
  58. return $head;
  59. }