dolibarr  20.0.0-alpha
modFTP.class.php
Go to the documentation of this file.
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 
27 include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28 
29 
33 class modFTP extends DolibarrModules
34 {
40  public function __construct($db)
41  {
42  $this->db = $db;
43 
44  // Id for module (must be unique).
45  // Use here a free id.
46  $this->numero = 2800;
47 
48  // Family can be 'crm','financial','hr','projects','product','ecm','technic','other'
49  // It is used to sort modules in module setup page
50  $this->family = "interface";
51  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
52  $this->name = preg_replace('/^mod/i', '', get_class($this));
53  // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
54  $this->description = "FTP Client";
55  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
56  $this->version = 'dolibarr_deprecated';
57  // Key used in llx_const table to save module status enabled/disabled (XXX is id value)
58  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
59  // Name of png file (without png) used for this module
60  $this->picto = 'folder';
61 
62  // Data directories to create when module is enabled
63  $this->dirs = array("/ftp/temp");
64 
65  // Langs file within the module
66  $this->langfiles = array("ftp");
67 
68  // Config pages. Put here list of php page names stored in admmin directory used to setup module
69  $this->config_page_url = array('ftpclient.php@ftp');
70 
71  // Dependencies
72  $this->depends = array(); // List of modules id that must be enabled if this module is enabled
73  $this->requiredby = array(); // List of modules id to disable if this one is disabled
74 
75  // Constants
76  $this->const = array(
77  1=>array('FTP_CONNECT_WITH_SSL', 'chaine', '0', 'Use FTPS for FTP module', 1, 'current', 1),
78  2=>array('FTP_CONNECT_WITH_SFTP', 'chaine', '0', 'Use SFTP for FTP module', 1, 'current', 1)
79  ); // List of parameters
80 
81  // Boxes
82  $this->boxes = array(); // List of boxes
83  $r = 0;
84 
85  // Add here list of php file(s) stored in core/boxes that contains class to show a box.
86  // Example:
87  //$this->boxes[$r][1] = "myboxa.php";
88  //$r++;
89  //$this->boxes[$r][1] = "myboxb.php";
90  //$r++;
91 
92  // Permissions
93  $this->rights_class = 'ftp'; // Permission key
94  $this->rights = array(); // Permission array used by this module
95 
96  $r++;
97  $this->rights[$r][0] = 2801;
98  $this->rights[$r][1] = 'Use FTP client in read mode (browse and download only)';
99  $this->rights[$r][2] = 'r';
100  $this->rights[$r][3] = 0;
101  $this->rights[$r][4] = 'read';
102 
103  $r++;
104  $this->rights[$r][0] = 2802;
105  $this->rights[$r][1] = 'Use FTP client in write mode (delete or upload files)';
106  $this->rights[$r][2] = 'w';
107  $this->rights[$r][3] = 0;
108  $this->rights[$r][4] = 'write';
109 
110 
111  // Menus
112  //-------
113  $this->menu[$r] = array('fk_menu'=>0,
114  'type'=>'top',
115  'titre'=>'FTP',
116  'prefix' => img_picto('', $this->picto, 'class="pictofixedwidth em092"'),
117  'mainmenu'=>'ftp',
118  'url'=>'/ftp/index.php',
119  'langs'=>'ftp',
120  'position'=>100,
121  'enabled'=>'$conf->ftp->enabled',
122  'perms'=>'$user->rights->ftp->read || $user->rights->ftp->write || $user->rights->ftp->setup',
123  'target'=>'',
124  'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
125  $r++;
126  }
127 }
Class DolibarrModules.
Description and activation class for module FTP.
__construct($db)
Constructor.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:125