|
@@ -1,5 +1,6 @@
|
|
|
<?php
|
|
|
/* For licensing terms, see /license.txt */
|
|
|
+
|
|
|
/**
|
|
|
* Process part of the document sub-process for upload. This script MUST BE included by upload/index.php
|
|
|
* as it prepares most of the variables needed here.
|
|
@@ -31,12 +32,9 @@ if (!DocumentManager::get_document_id($_course, $path)) {
|
|
|
/**
|
|
|
* Header
|
|
|
*/
|
|
|
-
|
|
|
$nameTools = get_lang('UplUploadDocument');
|
|
|
$interbreadcrumb[] = array(
|
|
|
- "url" => "./document.php?curdirpath=" . urlencode(
|
|
|
- $path
|
|
|
- ) . $req_gid,
|
|
|
+ "url" => "./document.php?curdirpath=" . urlencode($path) . '&'.api_get_cidreq(),
|
|
|
"name" => $langDocuments
|
|
|
);
|
|
|
Display::display_header($nameTools, "Doc");
|
|
@@ -69,13 +67,17 @@ if (isset($_FILES['user_upload'])) {
|
|
|
if (($docid = DocumentManager::get_document_id($_course, $new_path))) {
|
|
|
$table_document = Database::get_course_table(TABLE_DOCUMENT);
|
|
|
$ct = '';
|
|
|
- if ($new_comment) $ct .= ", comment='$new_comment'";
|
|
|
- if ($new_title) $ct .= ", title='$new_title'";
|
|
|
+ if ($new_comment) {
|
|
|
+ $ct .= ", comment='$new_comment'";
|
|
|
+ }
|
|
|
+ if ($new_title) {
|
|
|
+ $ct .= ", title='$new_title'";
|
|
|
+ }
|
|
|
Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'");
|
|
|
}
|
|
|
//check for missing images in html files
|
|
|
$missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path);
|
|
|
- if ($missing_files) {
|
|
|
+ if ($missing_files) {
|
|
|
//show a form to upload the missing files
|
|
|
Display::display_normal_message(
|
|
|
build_missing_files_form(
|
|
@@ -94,7 +96,7 @@ if (isset($_POST['submit_image'])) {
|
|
|
if ($number_of_uploaded_images > 0) {
|
|
|
//we could also create a function for this, I'm not sure...
|
|
|
//create a directory for the missing files
|
|
|
- $img_directory = str_replace('.','_',$_POST['related_file']."_files");
|
|
|
+ $img_directory = str_replace('.', '_', $_POST['related_file']."_files");
|
|
|
$folderData = create_unexisting_directory(
|
|
|
$_course,
|
|
|
$_user['user_id'],
|
|
@@ -116,6 +118,7 @@ if (isset($_POST['submit_image'])) {
|
|
|
$to_user_id,
|
|
|
$max_filled_space
|
|
|
);
|
|
|
+
|
|
|
//open the html file and replace the paths
|
|
|
replace_img_path_in_html_file(
|
|
|
$_POST['img_file_path'],
|
|
@@ -123,12 +126,12 @@ if (isset($_POST['submit_image'])) {
|
|
|
$base_work_dir . $_POST['related_file']
|
|
|
);
|
|
|
//update parent folders
|
|
|
- item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
|
|
|
+ item_property_update_on_folder($_course, $_POST['curdirpath'], $_user['user_id']);
|
|
|
}
|
|
|
}
|
|
|
//they want to create a directory
|
|
|
if (isset($_POST['create_dir']) && $_POST['dirname']!='') {
|
|
|
- $added_slash = ($path=='/')?'':'/';
|
|
|
+ $added_slash = ($path == '/') ? '' : '/';
|
|
|
$dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']);
|
|
|
$created_dir = create_unexisting_directory(
|
|
|
$_course,
|
|
@@ -144,7 +147,7 @@ if (isset($_POST['create_dir']) && $_POST['dirname']!='') {
|
|
|
Display::display_normal_message(get_lang('DirCr'));
|
|
|
$path = $created_dir;
|
|
|
} else {
|
|
|
- display_error(get_lang('CannotCreateDir'));
|
|
|
+ Display::addFlash(Display::return_message(get_lang('CannotCreateDir')));
|
|
|
}
|
|
|
}
|
|
|
|