Skip to content

Commit 07f7954

Browse files
committed
Security: Plugin: VChamilo: Update import logic to handle 'phar://' paths to import config
1 parent 89c67e6 commit 07f7954

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

plugin/vchamilo/views/import.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,20 @@
129129
$coursePath = $values['course_path'];
130130
$homePath = $values['home_path'];
131131
$confFile = $values['configuration_file'];
132+
$uploadPath = $values['upload_path'];
132133

133-
if (is_dir($coursePath) &&
134-
is_dir($homePath) &&
135-
file_exists($confFile) &&
136-
is_readable($confFile)
137-
) {
134+
$isPharFile = str_starts_with($confFile, 'phar://')
135+
|| str_starts_with($coursePath, 'phar://')
136+
|| str_starts_with($homePath, 'phar://')
137+
|| str_starts_with($uploadPath, 'phar://');
138+
139+
$isWritable = is_dir($coursePath)
140+
&& is_dir($homePath)
141+
&& is_dir($uploadPath)
142+
&& file_exists($confFile)
143+
&& is_readable($confFile);
144+
145+
if (!$isPharFile && $isWritable) {
138146
$currentHost = api_get_configuration_value('db_host');
139147
$currentDatabase = api_get_configuration_value('main_database');
140148
$currentUser = api_get_configuration_value('db_user');

0 commit comments

Comments
 (0)