[svn r20525] Switched GARBAGE_PATH to SYS_ARCHIVE_PATH (see FS#4191)

skala
Yannick Warnier 17 years ago
parent 5404db3a90
commit 37e5a3497b
  1. 4
      main/mySpace/access_details.php
  2. 30
      main/newscorm/learnpath.class.php
  3. 2
      main/newscorm/lp_upload.php
  4. 11
      main/upload/form.scorm.php

@ -200,7 +200,7 @@ if (api_is_xml_http_request()) {
// echo 'in cache';
$img_file = $Cache->GetHash($graph_id,$DataSet->GetData());
} else {
// if the image does not exist in the main/garbage/ folder
// if the image does not exist in the archive/ folder
// Initialise the graph
$Test = new pChart(760,230);
@ -245,7 +245,7 @@ if (api_is_xml_http_request()) {
ob_end_clean();
$img_file = $Cache->GetHash($graph_id,$DataSet->GetData());
}
echo '<img src="'.api_get_path(WEB_CODE_PATH).'garbage/'.$img_file.'">';
echo '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
} else {
Display::display_warning_message (get_lang('GraphicNotAvailable'));
}

@ -8118,10 +8118,10 @@ class learnpath {
}
//Create the zip handler (this will remain available throughout the method)
$garbage_path = api_get_path(GARBAGE_PATH);
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$temp_dir_short = uniqid();
$temp_zip_dir = $garbage_path."/".$temp_dir_short;
$temp_zip_dir = $archive_path."/".$temp_dir_short;
$temp_zip_file = $temp_zip_dir."/".md5(time()).".zip";
$zip_folder=new PclZip($temp_zip_file);
$current_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
@ -8597,7 +8597,7 @@ class learnpath {
//write the contents of the exported exercise into a (big) html file
//to later pack it into the exported SCORM. The file will be removed afterwards
$contents = export_exercise($exe_id,true);
$tmp_file_path = $garbage_path.$temp_dir_short.'/'.$my_file_path;
$tmp_file_path = $archive_path.$temp_dir_short.'/'.$my_file_path;
$res = file_put_contents($tmp_file_path,$contents);
if($res === false){error_log('Could not write into file '.$tmp_file_path.' '.__FILE__.' '.__LINE__,0);}
$files_cleanup[] = $tmp_file_path;
@ -8792,9 +8792,9 @@ 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 = $garbage_path.$temp_dir_short.'/'.$file_path;
$dest_file = $archive_path.$temp_dir_short.'/'.$file_path;
$this->create_path($dest_file);
//error_log('copy '.api_get_path('SYS_COURSE_PATH').$_course['path'].'/'.$file_path.' to '.api_get_path('GARBAGE_PATH').$temp_dir_short.'/'.$file_path,0);
//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.'<br>';
@copy($sys_course_path.$_course['path'].'/'.$file_path,$dest_file);
//check if the file needs a link update
@ -8827,10 +8827,10 @@ class learnpath {
//error_log(__LINE__.'checking existence of '.$main_path.$file_path.'',0);
if(!is_file($main_path.$file_path) || !is_readable($main_path.$file_path)){continue;}
//error_log(__LINE__.'getting document from '.$main_path.$file_path.' removing '.api_get_path('SYS_COURSE_PATH').$_course['path'].'/',0);
$dest_file = $garbage_path.$temp_dir_short.'/document/'.$file_path;
$dest_file = $archive_path.$temp_dir_short.'/document/'.$file_path;
$this->create_path($dest_file);
//error_log('Created path '.api_get_path('GARBAGE_PATH').$temp_dir_short.'/document/'.$file_path,0);
//error_log('copy '.api_get_path('SYS_COURSE_PATH').$_course['path'].'/'.$file_path.' to '.api_get_path('GARBAGE_PATH').$temp_dir_short.'/'.$file_path,0);
//error_log('Created path '.api_get_path(SYS_ARCHIVE_PATH).$temp_dir_short.'/document/'.$file_path,0);
//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.' - '.$dest_file.'<br>';
copy($main_path.$file_path,$dest_file);
@ -8860,7 +8860,7 @@ class learnpath {
foreach($links_to_create as $file=>$link)
{
$file_content = '<html><body><div style="text-align:center"><a href="'.$link['url'].'">'.$link['title'].'</a></div></body></html>';
file_put_contents($garbage_path.$temp_dir_short.'/'.$file, $file_content);
file_put_contents($archive_path.$temp_dir_short.'/'.$file, $file_content);
}
}
// add non exportable message explanation
@ -8892,11 +8892,11 @@ class learnpath {
</body>
</html>
EOD;
if(!is_dir($garbage_path.$temp_dir_short.'/document'))
if(!is_dir($archive_path.$temp_dir_short.'/document'))
{
@mkdir($garbage_path.$temp_dir_short.'/document');
@mkdir($archive_path.$temp_dir_short.'/document');
}
file_put_contents($garbage_path.$temp_dir_short.'/document/non_exportable.html', $file_content);
file_put_contents($archive_path.$temp_dir_short.'/document/non_exportable.html', $file_content);
//Add the extra files that go along with a SCORM package
$main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/';
@ -8906,7 +8906,7 @@ EOD;
if(strpos($extra_file,'.')===0) continue;
else
{
$dest_file = $garbage_path.$temp_dir_short.'/'.$extra_file;
$dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
$this->create_path($dest_file);
copy($main_code_path.$extra_file,$dest_file);
}
@ -8914,10 +8914,10 @@ EOD;
//Finalize the imsmanifest structure, add to the zip, then return the zip
$xmldoc->save($garbage_path.'/'.$temp_dir_short.'/imsmanifest.xml');
$xmldoc->save($archive_path.'/'.$temp_dir_short.'/imsmanifest.xml');
$zip_folder->add($garbage_path.'/'.$temp_dir_short, PCLZIP_OPT_REMOVE_PATH, $garbage_path.'/'.$temp_dir_short.'/');
$zip_folder->add($archive_path.'/'.$temp_dir_short, PCLZIP_OPT_REMOVE_PATH, $archive_path.'/'.$temp_dir_short.'/');
//clean possible temporary files
foreach($files_cleanup as $file)

@ -112,7 +112,7 @@ elseif($_SERVER['REQUEST_METHOD'] == 'POST')
$stopping_error = false;
//escape path with basename so it can only be directly into the claroline/upload directory
$s=api_get_path(SYS_CODE_PATH).'garbage/'.basename($_POST['file_name']);
$s=api_get_path(SYS_ARCHIVE_PATH).basename($_POST['file_name']);
//get name of the zip file without the extension
$info = pathinfo($s);
$filename = $info['basename'];

@ -6,11 +6,11 @@
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Small function to list files in garbage/
* Small function to list files in archive/
*/
function get_zip_files_in_garbage(){
$list = array();
$dh = opendir(api_get_path(SYS_CODE_PATH).'garbage/');
$dh = opendir(api_get_path(SYS_ARCHIVE_PATH));
if($dh === false){
//ignore
}else{
@ -71,7 +71,7 @@ if(api_get_setting('search_enabled')=='true')
}
$form->addElement('style_submit_button','submit', get_lang('Send'),'class="save"');
$form->addElement('html', '<br><br><br>');
$form->addElement('html', '<br /><br /><br />');
/*$list = get_zip_files_in_garbage();
if(count($list)>0){
$select_file_name = &$form->addElement('select','file_name',get_lang('Or').' '.strtolower(get_lang('UploadLocalFileFromGarbageDir')));
@ -94,12 +94,11 @@ $form->display();
?>
<br/>
<br />
<?php
/*
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer();
?>
Display::display_footer();
Loading…
Cancel
Save