Skip to content

Commit 905a210

Browse files
committed
Disable .htaccess, fix flash messages, fix php warnings, remove errorlog
1 parent d994797 commit 905a210

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

main/admin/course_intro_pdf_import.php

+13-17
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,17 @@
3737
);
3838
} else {
3939
$errors = import_pdfs($subDir);
40-
if (count($errors) == 0) {
41-
error_log('Course intros imported successfully in '.__FILE__.', line '.__LINE__);
42-
}
4340
}
4441
}
4542
}
4643

47-
if (count($errors) != 0) {
44+
if (!empty($errors)) {
4845
$error_message = '<ul>';
4946
foreach ($errors as $index => $error_course) {
5047
$error_message .= '<li>'.get_lang('Course').': '.$error_course['Title'].' ('.$error_course['Code'].')</li>';
5148
}
5249
$error_message .= '</ul>';
5350
Display::addFlash(Display::return_message($error_message, 'normal', false));
54-
} elseif (isset($_POST['formSent'])) {
55-
Display::addFlash(
56-
Display::return_message(
57-
get_lang('CourseIntroductionsAllImportedSuccessfully'),
58-
'confirmation',
59-
false
60-
)
61-
);
6251
}
6352

6453
Display::display_header($tool_name);
@@ -101,7 +90,7 @@
10190
*
10291
* @param string $subDir The subdirectory in which to put the files in each course
10392
*
104-
* @return array List of possible errors found
93+
* @return bool|array List of possible errors found
10594
*/
10695
function import_pdfs($subDir = '/')
10796
{
@@ -112,9 +101,7 @@ function import_pdfs($subDir = '/')
112101
@mkdir($baseDir.$uploadPath);
113102
}
114103
if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024 * 1024 * 1024)) {
115-
error_log('Could not unzip uploaded file in '.__FILE__.', line '.__LINE__);
116-
117-
return $errors;
104+
return false;
118105
}
119106
$list = scandir($baseDir.$uploadPath);
120107
$i = 0;
@@ -174,7 +161,6 @@ function import_pdfs($subDir = '/')
174161
$course_description->insert();
175162
}
176163
} else {
177-
error_log($parts[0].' is not a course, apparently');
178164
$errors[] = ['Line' => 0, 'Code' => $parts[0], 'Title' => $parts[0].' - '.get_lang('CodeDoesNotExists')];
179165
}
180166
$i++; //found at least one entry that is not a dir or a .
@@ -183,5 +169,15 @@ function import_pdfs($subDir = '/')
183169
$errors[] = ['Line' => 0, 'Code' => '.', 'Title' => get_lang('NoPDFFoundAtRoot')];
184170
}
185171

172+
if (empty($errors)) {
173+
Display::addFlash(
174+
Display::return_message(
175+
get_lang('CourseIntroductionsAllImportedSuccessfully'),
176+
'confirmation',
177+
false
178+
)
179+
);
180+
}
181+
186182
return $errors;
187183
}

main/inc/lib/fileUpload.lib.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,12 @@ function unzip_uploaded_file($uploaded_file, $upload_path, $base_work_dir, $max_
10131013
$zip_content_array = $zip_file->listContent();
10141014
$ok_scorm = false;
10151015
$realFileSize = 0;
1016-
foreach ($zip_content_array as &$this_content) {
1017-
if (preg_match('~.(php.*|phtml)$~i', $this_content['filename'])) {
1016+
$ok_plantyn_scorm1 = false;
1017+
$ok_plantyn_scorm2 = false;
1018+
$ok_plantyn_scorm3 = false;
1019+
$ok_aicc_scorm = false;
1020+
foreach ($zip_content_array as $this_content) {
1021+
if (preg_match('~.(php.*|phtml|phar|htaccess)$~i', $this_content['filename'])) {
10181022
Display::addFlash(
10191023
Display::return_message(get_lang('ZipNoPhp'))
10201024
);

0 commit comments

Comments
 (0)