Skip to content

Commit

Permalink
Set user id from function see BT#10936
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Apr 1, 2016
1 parent a231628 commit 615a122
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions main/inc/lib/fileUpload.lib.php
Expand Up @@ -1489,7 +1489,7 @@ function create_unexisting_directory(
$to_group_id
);

if ($folderExists == true) {
if ($folderExists === true) {
if ($generateNewNameIfExists) {
$counter = 1;
while (1) {
Expand All @@ -1500,7 +1500,7 @@ function create_unexisting_directory(
$to_group_id
);

if ($folderExists == false) {
if ($folderExists === false) {
break;
}
$counter++;
Expand Down Expand Up @@ -1529,7 +1529,7 @@ function create_unexisting_directory(

if (!is_dir($base_work_dir.$systemFolderName)) {
$result = mkdir(
$base_work_dir.$systemFolderName,
$base_work_dir . $systemFolderName,
api_get_permissions_for_new_directories(),
true
);
Expand All @@ -1548,7 +1548,7 @@ function create_unexisting_directory(

$rs = Database::query($sql);
if (Database::num_rows($rs) == 0) {

$document_id = add_document(
$_course,
$systemFolderName,
Expand All @@ -1558,7 +1558,9 @@ function create_unexisting_directory(
null,
0,
true,
$to_group_id
$to_group_id,
$session_id,
$user_id
);

if ($document_id) {
Expand Down
4 changes: 2 additions & 2 deletions main/newscorm/learnpath.class.php
Expand Up @@ -5930,7 +5930,7 @@ public function generate_lp_folder($course, $lp_name = '', $creatorId = 0)
if (!is_dir($filepath.'/'.$dir)) {
$folderData = create_unexisting_directory(
$course,
api_get_user_id(),
$creatorId,
0,
0,
0,
Expand Down Expand Up @@ -5997,7 +5997,7 @@ public function create_document($courseInfo, $content = '', $title = '', $extens

if (empty($_POST['dir']) && empty($_GET['dir'])) {
//Generates folder
$result = $this->generate_lp_folder($courseInfo, $creatorId);
$result = $this->generate_lp_folder($courseInfo, '', $creatorId);
$dir = $result['dir'];
$filepath = $result['filepath'];
}
Expand Down

0 comments on commit 615a122

Please sign in to comment.