From 169a7dcf9a40d7084aab688dc4e9ae900776fff9 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 8 Jun 2012 14:41:03 +0200 Subject: [PATCH] Found a bug when exporting a LP see #4841 (currently the lp export is broken working on it) --- main/document/download.php | 11 +++---- main/newscorm/learnpath.class.php | 37 ++++++++++++++------- main/newscorm/learnpathItem.class.php | 46 +++++++++++++-------------- main/newscorm/lp_upload.php | 13 +++----- main/newscorm/scorm.class.php | 43 ++++++++++++------------- 5 files changed, 80 insertions(+), 70 deletions(-) diff --git a/main/document/download.php b/main/document/download.php index 752b82ec0f..b1e4f02a43 100644 --- a/main/document/download.php +++ b/main/document/download.php @@ -20,10 +20,8 @@ api_protect_course_script(); if (!isset($_course)) { api_not_allowed(true); } -require_once api_get_path(LIBRARY_PATH).'document.lib.php'; $doc_url = $_GET['doc_url']; - // Change the '&' that got rewritten to '///' by mod_rewrite back to '&' $doc_url = str_replace('///', '&', $doc_url); // Still a space present? it must be a '+' (that got replaced by mod_rewrite) @@ -68,15 +66,16 @@ if (substr($refer_script, 0, 15) == '/fillsurvey.php') { // Launch event event_download($doc_url); } - +//var_dump($sys_course_path.$doc_url, $sys_course_path.'/'); +//var_dump(Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')); if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) { - $full_file_name = $sys_course_path.$doc_url; + $full_file_name = $sys_course_path.$doc_url; // Check visibility of document and paths doc_url //var_dump($document_id, api_get_course_id(), api_get_session_id(), api_get_user_id()); $is_visible = false; //$course_info = api_get_course_info(api_get_course_id()); //$document_id = DocumentManager::get_document_id($course_info, $doc_url); - + //HotPotatoes_files //if ($document_id) { // Correct choice for strict security (only show if whole tree visible) @@ -87,7 +86,7 @@ if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) { if (!api_is_allowed_to_edit() && !$is_visible) { Display::display_error_message(get_lang('ProtectedDocument'));//api_not_allowed backbutton won't work. exit; // You shouldn't be here anyway. - } + } DocumentManager::file_send_for_download($full_file_name); } exit; diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 1c1849f402..bcdbf74496 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -121,9 +121,7 @@ class learnpath { } else { // TODO: Make it flexible to use any course_code (still using env course code here). $lp_table = Database::get_course_table(TABLE_LP_MAIN); - - //$id = Database::escape_integer($id); - $lp_id = $this->escape_string($lp_id); + $lp_id = intval($lp_id); $sql = "SELECT * FROM $lp_table WHERE id = '$lp_id' AND c_id = $course_id"; if ($this->debug > 2) { error_log('New LP - learnpath::__construct() '.__LINE__.' - Querying lp: '.$sql, 0); } $res = Database::query($sql); @@ -144,7 +142,7 @@ class learnpath { $this->path = $row['path']; $this->preview_image = $row['preview_image']; $this->author = $row['author']; - $this->hide_toc_frame = $row['hide_toc_frame']; + $this->hide_toc_frame = $row['hide_toc_frame']; $this->lp_session_id = $row['session_id']; $this->use_max_score = $row['use_max_score']; @@ -5486,7 +5484,6 @@ class learnpath { $return .= $msg; $return .= '

'.$row['title'].'

'; - //var_dump($row); switch ($row['item_type']) { case TOOL_QUIZ: if (!empty($row['path'])) { @@ -8059,8 +8056,11 @@ class learnpath { } $zip_files = $zip_files_abs = $zip_files_dist = array(); + //Removes ./ at the end of the path + $this->path = str_replace('/.', '', $this->path); + if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) { - // Remove the possible . at the end of the path. + // Remove the possible . at the end of the path $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path; $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp); mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true); @@ -8113,6 +8113,7 @@ class learnpath { $inc_docs = $item->get_resources_from_source(null, api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()); else $inc_docs = $item->get_resources_from_source(); + // Give a child element to the element. $my_item_id = $item->get_id(); $my_item = $xmldoc->createElement('item'); @@ -8152,13 +8153,15 @@ class learnpath { // Get the path of the file(s) from the course directory root. $my_file_path = $item->get_file_path('scorm/'.$this->path.'/'); - - //$my_xml_file_path = api_htmlentities(api_utf8_encode($my_file_path), ENT_QUOTES, 'UTF-8'); - $my_xml_file_path = $my_file_path; + + //$my_xml_file_path = $my_file_path; + $my_xml_file_path = str_replace('/document/learning_path/'.$this->path, '', $my_file_path ); + $my_sub_dir = dirname($my_file_path); $my_sub_dir = str_replace('\\', '/', $my_sub_dir); //$my_xml_sub_dir = api_htmlentities(api_utf8_encode($my_sub_dir), ENT_QUOTES, 'UTF-8'); $my_xml_sub_dir = $my_sub_dir; + // Give a child to the element $my_resource = $xmldoc->createElement('resource'); $my_resource->setAttribute('identifier', 'RESOURCE_'.$item->get_id()); @@ -8180,7 +8183,9 @@ class learnpath { // Dependency to other files - not yet supported. $i = 1; + foreach ($inc_docs as $doc_info) { + if (count($doc_info) < 1 || empty($doc_info[0])) { continue; } $my_dep = $xmldoc->createElement('resource'); $res_id = 'RESOURCE_'.$item->get_id().'_'.$i; @@ -8664,10 +8669,12 @@ class learnpath { } } } + $organizations->appendChild($organization); $root->appendChild($organizations); $root->appendChild($resources); $xmldoc->appendChild($root); + // TODO: Add a readme file here, with a short description and a link to the Reload player // then add the file to the zip, then destroy the file (this is done automatically). // http://www.reload.ac.uk/scormplayer.html - once done, don't forget to close FS#138 @@ -8677,11 +8684,16 @@ class learnpath { if (empty($file_path)) { continue; } //error_log(__LINE__.'getting document from '.$sys_course_path.$_course['path'].'/'.$file_path.' removing '.$sys_course_path.$_course['path'].'/',0); $dest_file = $archive_path.$temp_dir_short.'/'.$file_path; + + $dest_file = str_replace('/document/learning_path/'.$this->path, '', $dest_file); + var_dump($dest_file); + $this->create_path($dest_file); //error_log('copy '.api_get_path(SYS_COURSE_PATH).$_course['path'].'/'.$file_path.' to '.api_get_path(SYS_ARCHIVE_PATH).$temp_dir_short.'/'.$file_path,0); //echo $main_path.$file_path.'
'; @copy($sys_course_path.$_course['path'].'/'.$file_path, $dest_file); - // Check if the file needs a link update. + + // Check if the file needs a link update if (in_array($file_path, array_keys($link_updates))) { $string = file_get_contents($dest_file); unlink($dest_file); @@ -8702,6 +8714,7 @@ class learnpath { file_put_contents($dest_file, $string); } } + foreach ($zip_files_abs as $file_path) { if (empty($file_path)) { continue; } //error_log(__LINE__.'checking existence of '.$main_path.$file_path.'', 0); @@ -8732,6 +8745,7 @@ class learnpath { file_put_contents($dest_file, $string); } } + if (is_array($links_to_create)) { foreach ($links_to_create as $file => $link) { $file_content = ''.$link['title'].' '; - file_put_contents($archive_path.$temp_dir_short.'/'.$file, $file_content); + file_put_contents($archive_path.$temp_dir_short.'/'.$file, $file_content); } } + // Add non exportable message explanation. $lang_not_exportable = get_lang('ThisItemIsNotExportable'); $file_content = ' 0) { error_log('New LP - In learnpathItem constructor: '.$id.','.$user_id, 0); } - + if (empty($course_id)) { $course_id = api_get_course_int_id(); } else { $course_id = intval($course_id); - } - + } + $items_table = Database::get_course_table(TABLE_LP_ITEM); $this->course_id = api_get_course_int_id(); $id = (int) $id; @@ -216,9 +216,9 @@ class learnpathItem { if (self::debug > 0) { error_log('New LP - In learnpath_item::delete() for item '.$this->db_id, 0); } $lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW); $lp_item = Database::get_course_table(TABLE_LP_ITEM); - + $course_id = api_get_course_int_id(); - + $sql_del_view = "DELETE FROM $lp_item_view WHERE c_id = $course_id AND lp_item_id = ".$this->db_id; //error_log('New LP - Deleting from lp_item_view: '.$sql_del_view, 0); $res_del_view = Database::query($sql_del_view); @@ -436,7 +436,7 @@ class learnpathItem { if (self::debug > 1) { error_log('New LP - In learnpathItem::get_interactions_count()', 0); } $return = 0; $course_id = api_get_course_int_id(); - + if ($checkdb) { $tbl = Database::get_course_table(TABLE_LP_ITEM_VIEW); $sql = "SELECT id FROM $tbl " . @@ -661,7 +661,7 @@ class learnpathItem { **/ public function get_seriousgame_mode() { if(self::debug>2){error_log('New LP - In learnpathItem::get_seriousgame_mode()',0);} - + $course_id = api_get_course_int_id(); if(!isset($this->seriousgame_mode)){ if(!empty($this->lp_id)){ @@ -1036,9 +1036,9 @@ class learnpathItem { if (is_object($this)) { if ($query_db === true) { $table = Database::get_course_table(TABLE_LP_ITEM_VIEW); - $sql = "SELECT start_time, total_time FROM $table + $sql = "SELECT start_time, total_time FROM $table WHERE c_id = $course_id AND - id = '".$this->db_item_view_id."' AND + id = '".$this->db_item_view_id."' AND view_count = '".$this->get_attempt_id()."'"; $res = Database::query($sql); $row = Database::fetch_array($res); @@ -1248,7 +1248,7 @@ class learnpathItem { */ public function parse_prereq($prereqs_string, $items, $refs_list, $user_id) { if (self::debug > 0) { error_log('New LP - In learnpathItem::parse_prereq() for learnpath '.$this->lp_id.' with string '.$prereqs_string, 0); } - + $course_id = api_get_course_int_id(); // Deal with &, |, ~, =, <>, {}, ,, X*, () in reverse order. $this->prereq_alert = ''; @@ -1643,7 +1643,7 @@ class learnpathItem { $this->last_scorm_session_time = 0; } $this->save(); - + //For serious game : We reuse same attempt_id if ($this->get_seriousgame_mode() == 1 && $this->type == 'sco') { $this->current_start_time = 0; @@ -1678,7 +1678,7 @@ class learnpathItem { //$this->current_data = ''; //$this->status = $this->possible_status[0]; $this->interactions_count = $this->get_interactions_count(true); - if ($this->type == 'sco') + if ($this->type == 'sco') $this->scorm_init_time(); } return true; @@ -1873,7 +1873,7 @@ class learnpathItem { $course_id = api_get_course_int_id(); } else { $course_id = intval($course_id); - } + } if (self::debug > 0) { error_log('New LP - In learnpathItem::set_lp_view('.$lp_view_id.')', 0); } if (!empty($lp_view_id) and $lp_view_id = intval(strval($lp_view_id))) { $this->view_id = $lp_view_id; @@ -2034,7 +2034,7 @@ class learnpathItem { $new_terms_string = implode(',', $new_terms); $terms_update_sql = ''; // TODO: Validate csv string. - $terms_update_sql = "UPDATE $lp_item SET terms = '". Database::escape_string(api_htmlentities($new_terms_string, ENT_QUOTES, $charset)) . "' + $terms_update_sql = "UPDATE $lp_item SET terms = '". Database::escape_string(api_htmlentities($new_terms_string, ENT_QUOTES, $charset)) . "' WHERE c_id = $course_id AND id=".$this->get_id(); $res = Database::query($terms_update_sql); // Save it to search engine. @@ -2174,24 +2174,24 @@ class learnpathItem { $course_id = api_get_course_int_id(); //Step 1 : get actual total time stored in db $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); - + $course_id = api_get_course_int_id(); - $get_view_sql='SELECT total_time, status FROM '.$item_view_table.' + $get_view_sql='SELECT total_time, status FROM '.$item_view_table.' WHERE c_id = '.$course_id.' AND lp_item_id="'.$this->db_id.'" AND lp_view_id="'.$this->view_id.'" AND view_count="'.$this->attempt_id.'" ;'; $result=Database::query($get_view_sql); $row=Database::fetch_array($result); if (!isset($row['total_time'])) { $total_time = 0; - } else { + } else { $total_time = $row['total_time']; } - + //Step 2.1 : if normal mode total_time = total_time + total_sec if (api_get_setting('scorm_cumulative_session_time') != 'false'){ $total_time +=$total_sec; //$this->last_scorm_session_time = $total_sec; } - //Step 2.2 : if not cumulative mode total_time = total_time - last_update + total_sec + //Step 2.2 : if not cumulative mode total_time = total_time - last_update + total_sec else{ $total_time = $total_time - $this->last_scorm_session_time + $total_sec; $this->last_scorm_session_time = $total_sec; @@ -2199,7 +2199,7 @@ class learnpathItem { //Step 3 update db only if status != completed, passed, browsed or seriousgamemode not activated $case_completed=array('completed','passed','browsed','failed'); //TODO COMPLETE if ($this->seriousgame_mode!=1 || !in_array($row['status'], $case_completed)){ - $update_view_sql='UPDATE '.$item_view_table." SET total_time =$total_time".' + $update_view_sql='UPDATE '.$item_view_table." SET total_time =$total_time".' WHERE c_id = '.$course_id.' AND lp_item_id="'.$this->db_id.'" AND lp_view_id="'.$this->view_id.'" AND view_count="'.$this->attempt_id.'" ;'; $result=Database::query($update_view_sql); } @@ -2210,7 +2210,7 @@ class learnpathItem { public function scorm_init_time(){ $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); $course_id = api_get_course_int_id(); - $update_view_sql='UPDATE '.$item_view_table.' SET total_time = 0, start_time='.time().' + $update_view_sql='UPDATE '.$item_view_table.' SET total_time = 0, start_time='.time().' WHERE c_id = '.$course_id.' AND lp_item_id="'.$this->db_id.'" AND lp_view_id="'.$this->view_id.'" AND view_count="'.$this->attempt_id.'" ;'; $result=Database::query($update_view_sql); } @@ -2290,7 +2290,7 @@ class learnpathItem { $my_verified_status=$this->get_status(false); $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); - $sql_verified = 'SELECT status FROM '.$item_view_table.' + $sql_verified = 'SELECT status FROM '.$item_view_table.' WHERE c_id = '.$course_id.' AND lp_item_id="'.$this->db_id.'" AND lp_view_id="'.$this->view_id.'" AND view_count="'.$this->attempt_id.'" ;'; $rs_verified = Database::query($sql_verified); $row_verified = Database::fetch_array($rs_verified); @@ -2492,7 +2492,7 @@ class learnpathItem { }*/ } - + if ($this->type == 'sco'){ //IF scorm scorm_update_time has already updated total_tim in db $sql = "UPDATE $item_view_table " . " SET ".//start_time = ".$this->get_current_start_time().", " . //scorm_init_time does it diff --git a/main/newscorm/lp_upload.php b/main/newscorm/lp_upload.php index ef70d2e7c2..01668d840f 100644 --- a/main/newscorm/lp_upload.php +++ b/main/newscorm/lp_upload.php @@ -36,7 +36,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES $stopping_error = false; $s = $_FILES['user_file']['name']; - + // Get name of the zip file without the extension. $info = pathinfo($s); $filename = $info['basename']; @@ -44,12 +44,9 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES $file_base_name = str_replace('.'.$extension, '', $filename); $new_dir = replace_dangerous_char(trim($file_base_name), 'strict'); - - require_once 'learnpath.class.php'; $type = learnpath::get_package_type($_FILES['user_file']['tmp_name'], $_FILES['user_file']['name']); - - + $proximity = 'local'; if (!empty($_REQUEST['content_proximity'])) { $proximity = Database::escape_string($_REQUEST['content_proximity']); @@ -58,7 +55,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES if (!empty($_REQUEST['content_maker'])) { $maker = Database::escape_string($_REQUEST['content_maker']); } - + switch ($type) { case 'scorm': require_once 'scorm.class.php'; @@ -69,7 +66,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES } if (!empty($manifest)) { $oScorm->parse_manifest($manifest); - $oScorm->import_manifest(api_get_course_id(),$_REQUEST['use_max_score']); + $oScorm->import_manifest(api_get_course_id(), $_REQUEST['use_max_score']); } else { // Show error message stored in $oScrom->error_msg. } @@ -107,7 +104,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES } } elseif($_SERVER['REQUEST_METHOD'] == 'POST') { // end if is_uploaded_file - + // If file name given to get in claroline/upload/, try importing this way. // A file upload has been detected, now deal with the file... diff --git a/main/newscorm/scorm.class.php b/main/newscorm/scorm.class.php index f9f14b15cf..5a73e1e455 100644 --- a/main/newscorm/scorm.class.php +++ b/main/newscorm/scorm.class.php @@ -33,7 +33,7 @@ class scorm extends learnpath { public $zipname = ''; // Keeps the zipfile safe for the object's life so that we can use it if no title avail. public $lastzipnameindex = 0; // Keeps an index of the number of uses of the zipname so far. public $manifest_encoding = 'UTF-8'; - public $debug = 0; + public $debug = 5; /** * Class constructor. Based on the parent constructor. @@ -263,9 +263,9 @@ class scorm extends learnpath { * @return bool Returns -1 on error */ function import_manifest($course_code, $use_max_score = 1) { - if ($this->debug > 0) { error_log('New LP - Entered import_manifest('.$course_code.')', 0); } + if ($this->debug > 0) { error_log('New LP - Entered import_manifest('.$course_code.')', 0); } $course_info = api_get_course_info($course_code); - $course_id = $course_info['real_id']; + $course_id = $course_info['real_id']; // Get table names. $new_lp = Database::get_course_table(TABLE_LP_MAIN); @@ -363,13 +363,7 @@ class scorm extends learnpath { $identifier = Database::escape_string($item['identifier']); $prereq = Database::escape_string($item['prerequisites']); - $sql_item = "INSERT INTO $new_lp_item " . - "(c_id, lp_id,item_type,ref,title," . - "path,min_score,max_score, $field_add" . - "parent_item_id,previous_item_id,next_item_id," . - "prerequisite,display_order,launch_data," . - "parameters) " . - "VALUES " . + $sql_item = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,launch_data, parameters) VALUES " . "($course_id, $lp_id, '$type','".$identifier."','".$title."'," . "'$path',0,$max_score, $value_add" . "$parent, $previous, 0, " . @@ -462,15 +456,15 @@ class scorm extends learnpath { */ function import_package($zip_file_info, $current_dir = '') { if ($this->debug > 0) { error_log('In scorm::import_package('.print_r($zip_file_info,true).',"'.$current_dir.'") method', 0); } - require_once api_get_path(LIBRARY_PATH).'document.lib.php'; + $maxFilledSpace = DocumentManager :: get_course_quota(); $zip_file_path = $zip_file_info['tmp_name']; $zip_file_name = $zip_file_info['name']; if ($this->debug > 1) { error_log('New LP - import_package() - zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name, 0); } - $course_rel_dir = api_get_course_path().'/scorm'; // scorm dir web path starting from /courses - $course_sys_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // Sbsolute system path for this course. - $current_dir = replace_dangerous_char(trim($current_dir),'strict'); // Current dir we are in, inside scorm/ + $course_rel_dir = api_get_course_path().'/scorm'; // scorm dir web path starting from /courses + $course_sys_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // Absolute system path for this course. + $current_dir = replace_dangerous_char(trim($current_dir),'strict'); // Current dir we are in, inside scorm/ if ($this->debug > 1) { error_log('New LP - import_package() - current_dir = '.$current_dir, 0); } //$uploaded_filename = $_FILES['userFile']['name']; @@ -499,7 +493,7 @@ class scorm extends learnpath { $manifest_list = array(); // The following loop should be stopped as soon as we found the right imsmanifest.xml (how to recognize it?). - foreach($zipContentArray as $thisContent) { + foreach ($zipContentArray as $thisContent) { //error_log('Looking at '.$thisContent['filename'], 0); if (preg_match('~.(php.*|phtml)$~i', $thisContent['filename'])) { $this->set_error_msg("File $file contains a PHP script"); @@ -571,21 +565,23 @@ class scorm extends learnpath { $saved_dir = getcwd(); chdir($course_sys_dir.$new_dir); $unzippingState = $zipFile->extract(); - for($j = 0; $j < count($unzippingState); $j++) { + for ($j = 0; $j < count($unzippingState); $j++) { $state = $unzippingState[$j]; // TODO: Fix relative links in html files (?) $extension = strrchr($state['stored_filename'], '.'); if ($this->debug >= 1) { error_log('New LP - found extension '.$extension.' in '.$state['stored_filename'], 0); } - } if (!empty($new_dir)) { $new_dir = $new_dir.'/'; } // Rename files, for example with \\ in it. + + if ($this->debug >= 1) { error_log('New LP - try to open: '.$course_sys_dir.$new_dir, 0); } + if ($dir = @opendir($course_sys_dir.$new_dir)) { - if ($this->debug == 1) { error_log('New LP - Opened dir '.$course_sys_dir.$new_dir, 0); } + if ($this->debug >= 1) { error_log('New LP - Opened dir '.$course_sys_dir.$new_dir, 0); } while ($file=readdir($dir)) { if ($file != '.' && $file != '..') { $filetype = 'file'; @@ -596,7 +592,10 @@ class scorm extends learnpath { //$safe_file = replace_dangerous_char($file, 'strict'); $find_str = array('\\', '.php', '.phtml'); $repl_str = array('/', '.txt', '.txt'); - $safe_file = str_replace($find_str, $repl_str,$file); + $safe_file = str_replace($find_str, $repl_str, $file); + + if ($this->debug >= 1) { error_log('Comparing: '.$safe_file, 0); } + if ($this->debug >= 1) { error_log('and: '.$file, 0); } if ($safe_file != $file) { //@rename($course_sys_dir.$new_dir, $course_sys_dir.'/'.$safe_file); @@ -609,13 +608,13 @@ class scorm extends learnpath { $mybasedir = $mybasedir.$mysubdir.'/'; if (!is_dir($mybasedir)) { @mkdir($mybasedir, api_get_permissions_for_new_directories()); - if ($this->debug == 1) { error_log('New LP - Dir '.$mybasedir.' doesnt exist. Creating.', 0); } + if ($this->debug >= 1) { error_log('New LP - Dir '.$mybasedir.' doesnt exist. Creating.', 0); } } } } } @rename($course_sys_dir.$new_dir.$file,$course_sys_dir.$new_dir.$safe_file); - if ($this->debug == 1) { error_log('New LP - Renaming '.$course_sys_dir.$new_dir.$file.' to '.$course_sys_dir.$new_dir.$safe_file, 0); } + if ($this->debug >= 1) { error_log('New LP - Renaming '.$course_sys_dir.$new_dir.$file.' to '.$course_sys_dir.$new_dir.$safe_file, 0); } } //set_default_settings($course_sys_dir, $safe_file, $filetype); } @@ -625,7 +624,7 @@ class scorm extends learnpath { chdir($saved_dir); api_chmod_R($course_sys_dir.$new_dir, api_get_permissions_for_new_directories()); - if ($this->debug > 1) { error_log('New LP - changed back to init dir', 0); } + if ($this->debug > 1) { error_log('New LP - changed back to init dir: '.$course_sys_dir.$new_dir, 0); } } } else { return '';