This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Copyright (c) Enalean, 2014. All Rights Reserved. |
||
4 | * |
||
5 | * This file is a part of Tuleap. |
||
6 | * |
||
7 | * Tuleap is free software; you can redistribute it and/or modify |
||
8 | * it under the terms of the GNU General Public License as published by |
||
9 | * the Free Software Foundation; either version 2 of the License, or |
||
10 | * (at your option) any later version. |
||
11 | * |
||
12 | * Tuleap is distributed in the hope that it will be useful, |
||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
15 | * GNU General Public License for more details. |
||
16 | * |
||
17 | * You should have received a copy of the GNU General Public License |
||
18 | * along with Tuleap. If not, see <http://www.gnu.org/licenses/>. |
||
19 | */ |
||
20 | require_once 'constants.php'; |
||
21 | |||
22 | class proftpdPlugin extends Plugin { |
||
23 | const SERVICE_SHORTNAME = 'plugin_proftpd'; |
||
24 | |||
25 | public function __construct($id) { |
||
26 | parent::__construct($id); |
||
27 | $this->addHook('cssfile'); |
||
28 | $this->addHook(Event::SERVICE_CLASSNAMES); |
||
29 | $this->addHook('service_is_used'); |
||
30 | $this->addHook('approve_pending_project'); |
||
31 | $this->addHook(Event::GET_SYSTEM_EVENT_CLASS); |
||
32 | $this->addHook(Event::SYSTEM_EVENT_GET_TYPES_FOR_DEFAULT_QUEUE); |
||
33 | $this->addHook(Event::GET_FTP_INCOMING_DIR); |
||
34 | $this->addHook(Event::SERVICE_ICON); |
||
35 | $this->addHook(Event::SERVICES_ALLOWED_FOR_PROJECT); |
||
36 | $this->addHook('register_project_creation'); |
||
37 | $this->addHook(Event::RENAME_PROJECT); |
||
38 | } |
||
39 | |||
40 | public function getPluginInfo() { |
||
41 | if (! is_a($this->pluginInfo, 'ProftpdPluginInfo')) { |
||
42 | $this->pluginInfo = new ProftpdPluginInfo($this); |
||
43 | } |
||
44 | return $this->pluginInfo; |
||
45 | } |
||
46 | |||
47 | public function process(HTTPRequest $request) { |
||
48 | $this->getRouter()->route($request); |
||
49 | } |
||
50 | |||
51 | private function getRouter() { |
||
52 | return new Tuleap\ProFTPd\ProftpdRouter( |
||
53 | array( |
||
54 | $this->getExplorerController(), |
||
55 | $this->getAdminController(), |
||
56 | ) |
||
57 | ); |
||
58 | } |
||
59 | |||
60 | private function getExplorerController() { |
||
61 | return new Tuleap\ProFTPd\Explorer\ExplorerController( |
||
62 | new Tuleap\ProFTPd\Directory\DirectoryParser($this->getPluginInfo()->getPropVal('proftpd_base_directory')), |
||
0 ignored issues
–
show
|
|||
63 | $this->getPermissionsManager(), |
||
64 | new Tuleap\ProFTPd\Xferlog\Dao() |
||
65 | ); |
||
66 | } |
||
67 | |||
68 | private function getAdminController() { |
||
69 | return new Tuleap\ProFTPd\Admin\AdminController( |
||
70 | $this->getPermissionsManager(), |
||
71 | $this->getProftpdSystemEventManager() |
||
72 | ); |
||
73 | } |
||
74 | |||
75 | private function getPermissionsManager() { |
||
76 | return new Tuleap\ProFTPd\Admin\PermissionsManager( |
||
77 | PermissionsManager::instance(), |
||
78 | new UGroupManager() |
||
79 | ); |
||
80 | } |
||
81 | |||
82 | public function getServiceShortname() { |
||
83 | return self::SERVICE_SHORTNAME; |
||
84 | } |
||
85 | |||
86 | public function register_project_creation($params) { |
||
87 | $project_template = ProjectManager::instance()->getProject($params['template_id']); |
||
88 | $project = ProjectManager::instance()->getProject($params['group_id']); |
||
89 | |||
90 | $this->getPermissionsManager()->duplicatePermissions( |
||
91 | $project_template, |
||
92 | $project, |
||
93 | $params['ugroupsMapping'] |
||
94 | ); |
||
95 | |||
96 | } |
||
97 | |||
98 | public function service_icon($params) { |
||
99 | $params['list_of_icon_unicodes'][$this->getServiceShortname()] = '\e801'; |
||
100 | } |
||
101 | |||
102 | public function service_classnames(array $params) { |
||
103 | $params['classnames'][$this->getServiceShortname()] = 'Tuleap\ProFTPd\ServiceProFTPd'; |
||
104 | } |
||
105 | |||
106 | public function cssfile($params) { |
||
107 | if (strpos($_SERVER['REQUEST_URI'], $this->getPluginPath()) === 0 || |
||
108 | strpos($_SERVER['REQUEST_URI'], '/widgets/') === 0 |
||
109 | ) { |
||
110 | echo '<link rel="stylesheet" type="text/css" href="'.$this->getThemePath().'/css/style.css" />'."\n"; |
||
111 | } |
||
112 | } |
||
113 | |||
114 | public function getHooksAndCallbacks() { |
||
115 | $this->addHook('logs_daily'); |
||
116 | return parent::getHooksAndCallbacks(); |
||
117 | } |
||
118 | |||
119 | public function logs_daily($params) { |
||
120 | $dao = new Tuleap\ProFTPd\Xferlog\Dao(); |
||
121 | |||
122 | $params['logs'][] = array( |
||
123 | 'sql' => $dao->getLogQuery($params['group_id'], $params['logs_cond']), |
||
124 | 'field' => $GLOBALS['Language']->getText('plugin_proftpd', 'log_filepath'), |
||
125 | 'title' => $GLOBALS['Language']->getText('plugin_proftpd', 'log_title') |
||
126 | ); |
||
127 | } |
||
128 | |||
129 | public function service_is_used($params) { |
||
130 | if ($params['shortname'] == self::SERVICE_SHORTNAME && $params['is_used']) { |
||
131 | $project = $this->getProject($params['group_id']); |
||
132 | $this->createDirectory($project); |
||
133 | } |
||
134 | } |
||
135 | |||
136 | public function approve_pending_project($params) { |
||
137 | $project = $this->getProject($params['group_id']); |
||
138 | if ($project->usesService($this->getServiceShortname())) { |
||
139 | $this->createDirectory($project); |
||
140 | } |
||
141 | } |
||
142 | |||
143 | private function getProject($group_id) { |
||
144 | $project_manager = ProjectManager::instance(); |
||
145 | |||
146 | return $project_manager->getProject($group_id); |
||
147 | } |
||
148 | |||
149 | private function createDirectory(Project $project) { |
||
150 | $this->getProftpdSystemEventManager()->queueDirectoryCreate($project->getUnixName()); |
||
151 | $this->getProftpdSystemEventManager()->queueACLUpdate($project->getUnixName()); |
||
152 | } |
||
153 | |||
154 | public function system_event_get_types_for_default_queue($params) { |
||
155 | $params['types'] = array_merge($params['types'], $this->getProftpdSystemEventManager()->getTypes()); |
||
156 | } |
||
157 | |||
158 | public function rename_project ($params) { |
||
159 | $project = $params['project']; |
||
160 | $base_sftp_dir = $this->getPluginInfo()->getPropVal('proftpd_base_directory'); |
||
0 ignored issues
–
show
The method
getPropVal does only exist in ArchiveDeletedItemsPlugi...o and ProftpdPluginInfo , but not in AdminDelegationPluginInf...fo and hudsonPluginInfo .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
161 | $old_repository_path = $base_sftp_dir . DIRECTORY_SEPARATOR . $project->getUnixName(); |
||
162 | $new_repository_path = $base_sftp_dir . DIRECTORY_SEPARATOR . $params['new_name']; |
||
163 | |||
164 | if (is_dir($old_repository_path)) { |
||
165 | rename($old_repository_path, $new_repository_path); |
||
166 | } |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * This callback make SystemEvent manager knows about proftpd plugin System Events |
||
171 | */ |
||
172 | public function get_system_event_class($params) { |
||
173 | $this->getProftpdSystemEventManager()->instanciateEvents( |
||
174 | $params['type'], |
||
175 | $params['dependencies'] |
||
176 | ); |
||
177 | } |
||
178 | |||
179 | private function getProftpdSystemEventManager() { |
||
180 | return new \Tuleap\ProFTPd\SystemEventManager( |
||
181 | SystemEventManager::instance(), |
||
182 | Backend::instance(), |
||
183 | $this->getPermissionsManager(), |
||
184 | ProjectManager::instance(), |
||
185 | $this->getPluginInfo()->getPropVal('proftpd_base_directory') |
||
0 ignored issues
–
show
The method
getPropVal does only exist in ArchiveDeletedItemsPlugi...o and ProftpdPluginInfo , but not in AdminDelegationPluginInf...fo and hudsonPluginInfo .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
186 | ); |
||
187 | } |
||
188 | |||
189 | /** |
||
190 | * @see Event::GET_FTP_INCOMING_DIR |
||
191 | */ |
||
192 | public function get_ftp_incoming_dir($params) { |
||
193 | $project = $params['project']; |
||
194 | |||
195 | if ($project->usesService(self::SERVICE_SHORTNAME)) { |
||
196 | $base_sftp_dir = $this->getPluginInfo()->getPropVal('proftpd_base_directory'); |
||
0 ignored issues
–
show
The method
getPropVal does only exist in ArchiveDeletedItemsPlugi...o and ProftpdPluginInfo , but not in AdminDelegationPluginInf...fo and hudsonPluginInfo .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
197 | $params['src_dir'] = $base_sftp_dir . '/' . $project->getUnixName(); |
||
198 | } |
||
199 | } |
||
200 | } |
||
201 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: