modFTP.class.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \defgroup ftp Module ftp
  20. * \brief Module for FTP client module
  21. * \file htdocs/core/modules/modFTP.class.php
  22. * \ingroup ftp
  23. * \brief Description and activation file for the module FTP
  24. */
  25. include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
  26. /**
  27. * Description and activation class for module FTP
  28. */
  29. class modFTP extends DolibarrModules
  30. {
  31. /**
  32. * Constructor. Define names, constants, directories, boxes, permissions
  33. *
  34. * @param DoliDB $db Database handler
  35. */
  36. public function __construct($db)
  37. {
  38. $this->db = $db;
  39. // Id for module (must be unique).
  40. // Use here a free id.
  41. $this->numero = 2800;
  42. // Family can be 'crm','financial','hr','projects','product','ecm','technic','other'
  43. // It is used to sort modules in module setup page
  44. $this->family = "interface";
  45. // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
  46. $this->name = preg_replace('/^mod/i', '', get_class($this));
  47. // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
  48. $this->description = "FTP Client";
  49. // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
  50. $this->version = 'dolibarr_deprecated';
  51. // Key used in llx_const table to save module status enabled/disabled (XXX is id value)
  52. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  53. // Name of png file (without png) used for this module
  54. $this->picto = 'folder';
  55. // Data directories to create when module is enabled
  56. $this->dirs = array("/ftp/temp");
  57. // Langs file within the module
  58. $this->langfiles = array("ftp");
  59. // Config pages. Put here list of php page names stored in admmin directory used to setup module
  60. $this->config_page_url = array('ftpclient.php@ftp');
  61. // Dependencies
  62. $this->depends = array(); // List of modules id that must be enabled if this module is enabled
  63. $this->requiredby = array(); // List of modules id to disable if this one is disabled
  64. // Constants
  65. $this->const = array(
  66. 1=>array('FTP_CONNECT_WITH_SSL', 'chaine', '0', 'Use FTPS for FTP module', 1, 'current', 1),
  67. 2=>array('FTP_CONNECT_WITH_SFTP', 'chaine', '0', 'Use SFTP for FTP module', 1, 'current', 1)
  68. ); // List of parameters
  69. // Boxes
  70. $this->boxes = array(); // List of boxes
  71. $r = 0;
  72. // Add here list of php file(s) stored in core/boxes that contains class to show a box.
  73. // Example:
  74. //$this->boxes[$r][1] = "myboxa.php";
  75. //$r++;
  76. //$this->boxes[$r][1] = "myboxb.php";
  77. //$r++;
  78. // Permissions
  79. $this->rights_class = 'ftp'; // Permission key
  80. $this->rights = array(); // Permission array used by this module
  81. $r++;
  82. $this->rights[$r][0] = 2801;
  83. $this->rights[$r][1] = 'Use FTP client in read mode (browse and download only)';
  84. $this->rights[$r][2] = 'r';
  85. $this->rights[$r][3] = 0;
  86. $this->rights[$r][4] = 'read';
  87. $r++;
  88. $this->rights[$r][0] = 2802;
  89. $this->rights[$r][1] = 'Use FTP client in write mode (delete or upload files)';
  90. $this->rights[$r][2] = 'w';
  91. $this->rights[$r][3] = 0;
  92. $this->rights[$r][4] = 'write';
  93. // Menus
  94. //-------
  95. $this->menu[$r] = array('fk_menu'=>0,
  96. 'type'=>'top',
  97. 'titre'=>'FTP',
  98. 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth em092"'),
  99. 'mainmenu'=>'ftp',
  100. 'url'=>'/ftp/index.php',
  101. 'langs'=>'ftp',
  102. 'position'=>100,
  103. 'enabled'=>'$conf->ftp->enabled',
  104. 'perms'=>'$user->rights->ftp->read || $user->rights->ftp->write || $user->rights->ftp->setup',
  105. 'target'=>'',
  106. 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
  107. $r++;
  108. }
  109. }