modFTP.class.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 <http://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 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. 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 = "other";
  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';
  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. // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
  54. $this->special = 1;
  55. // Name of png file (without png) used for this module
  56. $this->picto='dir';
  57. // Data directories to create when module is enabled
  58. $this->dirs = array("/ftp/temp");
  59. // Langs file within the module
  60. $this->langfiles = array("ftp");
  61. // Config pages. Put here list of php page names stored in admmin directory used to setup module
  62. $this->config_page_url = array('ftpclient.php@ftp');
  63. // Dependencies
  64. $this->depends = array(); // List of modules id that must be enabled if this module is enabled
  65. $this->requiredby = array(); // List of modules id to disable if this one is disabled
  66. // Constants
  67. $this->const = array(); // List of parameters
  68. // Boxes
  69. $this->boxes = array(); // List of boxes
  70. $r=0;
  71. // Add here list of php file(s) stored in core/boxes that contains class to show a box.
  72. // Example:
  73. //$this->boxes[$r][1] = "myboxa.php";
  74. //$r++;
  75. //$this->boxes[$r][1] = "myboxb.php";
  76. //$r++;
  77. // Permissions
  78. $this->rights_class = 'ftp'; // Permission key
  79. $this->rights = array(); // Permission array used by this module
  80. $r++;
  81. $this->rights[$r][0] = 2801;
  82. $this->rights[$r][1] = 'Use FTP client in read mode (browse and download only)';
  83. $this->rights[$r][2] = 'r';
  84. $this->rights[$r][3] = 1;
  85. $this->rights[$r][4] = 'read';
  86. $r++;
  87. $this->rights[$r][0] = 2802;
  88. $this->rights[$r][1] = 'Use FTP client in write mode (delete or upload files)';
  89. $this->rights[$r][2] = 'w';
  90. $this->rights[$r][3] = 0;
  91. $this->rights[$r][4] = 'write';
  92. // Menus
  93. //------
  94. $this->menus = array(); // List of menus to add
  95. $r=0;
  96. // Top menu
  97. $this->menu[$r]=array('fk_menu'=>0,
  98. 'type'=>'top',
  99. 'titre'=>'FTP',
  100. 'mainmenu'=>'ftp',
  101. 'url'=>'/ftp/index.php',
  102. 'langs'=>'ftp',
  103. 'position'=>100,
  104. 'enabled'=>'$conf->ftp->enabled',
  105. 'perms'=>'$user->rights->ftp->read || $user->rights->ftp->write || $user->rights->ftp->setup',
  106. 'target'=>'',
  107. 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
  108. $r++;
  109. }
  110. }