From 5b0e21a136c673c686a6ac747fa393952c079fe1 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 25 Jan 2013 14:38:29 +0100 Subject: [PATCH] Removing calls of fileDisplay.lib.php --- main/course_info/infocours.php | 1 - main/document/document.php | 5 - main/document/document_lite.php | 2 - main/document/document_quota.php | 2 - main/dropbox/dropbox_init.inc.php | 6 - main/inc/ajax/document.ajax.php | 29 +- main/inc/course_document.inc.php | 2 - main/inc/lib/document.lib.php | 5 +- main/inc/lib/message.lib.php | 2 - main/inc/lib/nanogong.lib.php | 405 +++++++++--------- .../document_processor.class.php | 5 +- main/newscorm/back_compat.inc.php | 4 +- main/resourcelinker/resourcelinker.inc.php | 8 +- main/social/message_for_group_form.inc.php | 37 +- main/work/work.lib.php | 1 - main/work/work.php | 4 - tests/test_manager.inc.php | 1 - 17 files changed, 239 insertions(+), 280 deletions(-) diff --git a/main/course_info/infocours.php b/main/course_info/infocours.php index 7c472789e4..5c816a6b8e 100644 --- a/main/course_info/infocours.php +++ b/main/course_info/infocours.php @@ -26,7 +26,6 @@ $nameTools = get_lang('ModifInfo'); /* Libraries */ require_once api_get_path(LIBRARY_PATH).'pdf.lib.php'; -require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; api_protect_course_script(true); api_block_anonymous_users(); diff --git a/main/document/document.php b/main/document/document.php index e1aaca5425..aa5fa79f5b 100644 --- a/main/document/document.php +++ b/main/document/document.php @@ -39,11 +39,6 @@ $this_section = SECTION_COURSES; require_once 'document.inc.php'; $lib_path = api_get_path(LIBRARY_PATH); -/* Libraries */ -require_once $lib_path . 'fileUpload.lib.php'; -require_once $lib_path . 'fileDisplay.lib.php'; -require_once $lib_path . 'fileManage.lib.php'; - api_protect_course_script(true); //erase temp nanogons' audio, image edit diff --git a/main/document/document_lite.php b/main/document/document_lite.php index 6e39708c33..06321de671 100644 --- a/main/document/document_lite.php +++ b/main/document/document_lite.php @@ -22,8 +22,6 @@ $lib_path = api_get_path(LIBRARY_PATH); /* Libraries */ require_once $lib_path.'document.lib.php'; -require_once $lib_path.'fileUpload.lib.php'; -require_once $lib_path.'fileDisplay.lib.php'; api_protect_course_script(true); diff --git a/main/document/document_quota.php b/main/document/document_quota.php index 4c02c9bd03..81a429973d 100644 --- a/main/document/document_quota.php +++ b/main/document/document_quota.php @@ -12,8 +12,6 @@ $language_file = array('document'); require_once '../inc/global.inc.php'; -require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; - if (!api_is_allowed_to_edit(null, true)) { api_not_allowed(true); } diff --git a/main/dropbox/dropbox_init.inc.php b/main/dropbox/dropbox_init.inc.php index dca6429ace..582447ce91 100644 --- a/main/dropbox/dropbox_init.inc.php +++ b/main/dropbox/dropbox_init.inc.php @@ -48,23 +48,17 @@ require_once 'dropbox_config.inc.php'; // the dropbox file that contains additional functions require_once 'dropbox_functions.inc.php'; -require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; - // protecting the script api_protect_course_script(); /* Libraries */ -// including the library for the sortable table -//require_once api_get_path(LIBRARY_PATH).'tablesort.lib.php';moved to autoload - // including the library for the dropbox require_once 'dropbox_class.inc.php'; // including some libraries that are also used in the documents tool require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php'; // we use a function build_document_icon_tag -require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; // the function FileManager::choose_image is used require_once api_get_path(LIBRARY_PATH).'document.lib.php'; diff --git a/main/inc/ajax/document.ajax.php b/main/inc/ajax/document.ajax.php index b41413bb13..685beb4aff 100644 --- a/main/inc/ajax/document.ajax.php +++ b/main/inc/ajax/document.ajax.php @@ -1,21 +1,21 @@ '_blank')); $json['type'] = api_htmlentities($file['type']); - $json['size'] = format_file_size($file['size']); + $json['size'] = format_file_size($file['size']); if (!empty($result) && is_array($result)) { - $json['result'] = Display::return_icon('accept.png', get_lang('Uploaded')); + $json['result'] = Display::return_icon('accept.png', get_lang('Uploaded')); } else { $json['result'] = Display::return_icon('exclamation.png', get_lang('Error')); } - echo json_encode($json); + echo json_encode($json); } break; case 'document_preview': - $course_info = api_get_course_info_by_id($_REQUEST['course_id']); + $course_info = api_get_course_info_by_id($_REQUEST['course_id']); if (!empty($course_info) && is_array($course_info)) { echo DocumentManager::get_document_preview($course_info, false, '_blank', $_REQUEST['session_id']); } - break; + break; } exit; \ No newline at end of file diff --git a/main/inc/course_document.inc.php b/main/inc/course_document.inc.php index ba0341c3f2..f6c9bfbeb1 100644 --- a/main/inc/course_document.inc.php +++ b/main/inc/course_document.inc.php @@ -10,9 +10,7 @@ require 'global.inc.php'; require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php'; require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php'; -require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; require_once api_get_path(LIBRARY_PATH).'document.lib.php'; -require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; //if(!$is_in_admin){ if (!api_is_platform_admin()){ diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index 98a029a9f5..79a0b5e061 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -2821,8 +2821,7 @@ class DocumentManager { * @return string The HTML list */ public static function write_resources_tree($course_info, $session_id, $resources_sorted, $num = 0, $lp_id = false, $target = '', $add_move_button = false, $overwrite_url = null) { - require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; - + $img_path = api_get_path(WEB_IMG_PATH); $img_sys_path = api_get_path(SYS_CODE_PATH).'img/'; $web_code_path = api_get_path(WEB_CODE_PATH); @@ -3230,6 +3229,6 @@ class DocumentManager { return $system_folders; } - + } //end class DocumentManager diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php index 053442b183..16e07b62ce 100644 --- a/main/inc/lib/message.lib.php +++ b/main/inc/lib/message.lib.php @@ -9,8 +9,6 @@ /** * Code */ -require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; -require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; /** * Class diff --git a/main/inc/lib/nanogong.lib.php b/main/inc/lib/nanogong.lib.php index e4ee3446e0..d910ed4854 100644 --- a/main/inc/lib/nanogong.lib.php +++ b/main/inc/lib/nanogong.lib.php @@ -1,133 +1,133 @@ -set_parameters($params); } - + function create_user_folder() { - + //COURSE123/exercises/session_id/exercise_id/question_id/user_id if (empty($this->store_path)) { return false; } - + //@todo use an array to create folders $folders_to_create = array(); - + //Trying to create the courses/COURSE123/exercises/ dir just in case if (!is_dir($this->store_path)) { mkdir($this->store_path); - } - + } + if (!is_dir($this->store_path.$this->session_id)) { mkdir($this->store_path.$this->session_id); } - + if (!empty($this->exercise_id) && !is_dir($this->store_path.$this->session_id.'/'.$this->exercise_id)) { mkdir($this->store_path.$this->session_id.'/'.$this->exercise_id); } - + if (!empty($this->question_id) && !is_dir($this->store_path.$this->session_id.'/'.$this->exercise_id.'/'.$this->question_id)) { mkdir($this->store_path.$this->session_id.'/'.$this->exercise_id.'/'.$this->question_id); } - + if (!empty($this->user_id) && !is_dir($this->store_path.$this->session_id.'/'.$this->exercise_id.'/'.$this->question_id.'/'.$this->user_id)) { mkdir($this->store_path.$this->session_id.'/'.$this->exercise_id.'/'.$this->question_id.'/'.$this->user_id); } } - + /** * Setting parameters: course id, session id, etc - * @param array + * @param array */ function set_parameters($params = array()) { - + //Setting course id if (isset($params['course_id'])) { $this->course_id = intval($params['course_id']); } else { $this->course_id = $params['course_id'] = api_get_course_int_id(); } - + //Setting course info if (isset($this->course_id)) { $this->course_info = api_get_course_info_by_id($this->course_id); } - + //Setting session id if (isset($params['session_id'])) { $this->session_id = intval($params['session_id']); } else { $this->session_id = $params['session_id'] = api_get_session_id(); } - + //Setting user ids if (isset($params['user_id'])) { $this->user_id = intval($params['user_id']); } else { $this->user_id = $params['user_id'] = api_get_user_id(); } - + //Setting user ids if (isset($params['exercise_id'])) { $this->exercise_id = intval($params['exercise_id']); } else { $this->exercise_id = 0; } - + //Setting user ids if (isset($params['question_id'])) { $this->question_id = intval($params['question_id']); } else { $this->question_id = 0; } - + $this->can_edit = false; - + if (api_is_allowed_to_edit()) { - $this->can_edit = true; + $this->can_edit = true; } else { if ($this->user_id == api_get_user_id()) { $this->can_edit = true; } } - + //Settings the params array $this->params = $params; - + $this->store_path = api_get_path(SYS_COURSE_PATH).$this->course_info['path'].'/exercises/'; - - $this->create_user_folder(); - + + $this->create_user_folder(); + $this->store_path = $this->store_path.implode('/', array($this->session_id, $this->exercise_id, $this->question_id, $this->user_id)).'/'; $this->filename = $this->generate_filename(); $this->store_filename = $this->store_path.$this->filename; } - + /** * Generates the filename with the next format: * (course_id)/(session_id)/(user_id)/(exercise_id)/(question_id)/(exe_id) @@ -138,160 +138,157 @@ class Nanogong { if (!empty($this->params)) { //filename //course_id/session_id/user_id/exercise_id/question_id/exe_id - $filename_array = array($this->params['course_id'], $this->params['session_id'], $this->params['user_id'], $this->params['exercise_id'], $this->params['question_id'], $this->params['exe_id']); + $filename_array = array($this->params['course_id'], $this->params['session_id'], $this->params['user_id'], $this->params['exercise_id'], $this->params['question_id'], $this->params['exe_id']); return implode('-', $filename_array); } else { return api_get_unique_id(); } } - + /** * Delete audio file * @return number */ function delete_files() { $delete_found = 0; - if ($this->can_edit) { - $file = $this->load_filename_if_exists(); - - $path_info = pathinfo($file); + if ($this->can_edit) { + $file = $this->load_filename_if_exists(); + + $path_info = pathinfo($file); foreach($this->available_extensions as $extension) { $file_to_delete = $path_info['dirname'].'/'.$path_info['filename'].'.'.$extension; if (is_file($file_to_delete)) { unlink($file_to_delete); $delete_found = 1; } - } + } } return $delete_found; } - + /** - * + * * Tricky stuff to deal with the feedback = 0 in exercises (all question per page) * @param unknown_type $exe_id */ function replace_with_real_exe($exe_id) { $filename = null; //@ugly fix - foreach($this->available_extensions as $extension) { + foreach($this->available_extensions as $extension) { $items = explode('-', $this->filename); $items[5] = 'temp_exe'; - $filename = implode('-', $items); - if (is_file($this->store_path.$filename.'.'.$extension)) { - $old_name = $this->store_path.$filename.'.'.$extension; + $filename = implode('-', $items); + if (is_file($this->store_path.$filename.'.'.$extension)) { + $old_name = $this->store_path.$filename.'.'.$extension; $items = explode('-', $this->filename); $items[5] = $exe_id; $filename = $filename = implode('-', $items); $new_name = $this->store_path.$filename.'.'.$extension; //var_dump($old_name, $new_name); - rename($old_name, $new_name); + rename($old_name, $new_name); break; - } + } } } - + function load_filename_if_exists($load_from_database = false) { $filename = null; //@ugly fix - foreach($this->available_extensions as $extension) { - if (is_file($this->store_path.$this->filename.'.'.$extension)) { + foreach($this->available_extensions as $extension) { + if (is_file($this->store_path.$this->filename.'.'.$extension)) { $filename = $this->filename.'.'.$extension; - break; + break; } - } - - //temp_exe + } + + //temp_exe if ($load_from_database) { - + //Load the real filename just if exists if (isset($this->params['exe_id']) && isset($this->params['user_id']) && isset($this->params['question_id']) && isset($this->params['session_id']) && isset($this->params['course_id'])) { $attempt_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $sql = "SELECT filename FROM $attempt_table WHERE exe_id = ".$this->params['exe_id']." AND - user_id = ".$this->params['user_id']." AND + user_id = ".$this->params['user_id']." AND question_id = ".$this->params['question_id']." AND - session_id = ".$this->params['session_id']." AND + session_id = ".$this->params['session_id']." AND course_code = '".$this->course_info['code']."' LIMIT 1"; $result = Database::query($sql); $result = Database::fetch_row($result,'ASSOC'); - + if (isset($result) && isset($result[0]) && !empty($result[0])) { - $filename = $result[0]; + $filename = $result[0]; } } } - + if (is_file($this->store_path.$filename)) { return $this->store_path.$filename; } return null; } - + /** - * + * * Get the URL of the file * path courses/XXX/exercises/(session_id)/(exercise_id)/(question_id)/(user_id)/ - * + * * @return string */ function get_public_url($force_download = 0) { $params = $this->get_params(true); - $url = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=get_file&download='.$force_download.'&'.$params; + $url = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=get_file&download='.$force_download.'&'.$params; $params = $this->get_params(); - $filename = basename($this->load_filename_if_exists()); + $filename = basename($this->load_filename_if_exists()); $url = api_get_path(WEB_COURSE_PATH).$this->course_info['path'].'/exercises/'. - $params['session_id'].'/'.$params['exercise_id'].'/'.$params['question_id'].'/'.$params['user_id'].'/'.$filename; + $params['session_id'].'/'.$params['exercise_id'].'/'.$params['question_id'].'/'.$params['user_id'].'/'.$filename; return $url; } - + /** - * Uploads the nanogong wav file - */ + * Uploads the nanogong wav file + */ public function upload_file($is_nano = false) { - require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; require_once api_get_path(LIBRARY_PATH).'document.lib.php'; - require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; - - if (!empty($_FILES)) { - $upload_ok = process_uploaded_file($_FILES['file'], false); - + if (!empty($_FILES)) { + $upload_ok = process_uploaded_file($_FILES['file'], false); + if (!is_uploaded_file($_FILES['file']['tmp_name'])) { return 0; } - + if ($upload_ok) { // Check if there is enough space to save the file if (!DocumentManager::enough_space($_FILES['file']['size'], DocumentManager::get_course_quota())) { - return 0; - } - + return 0; + } + //first we delete everything before uploading the file $this->delete_files(); - + //Reload the filename variable - $file_name = add_ext_on_mime($_FILES['file']['name'], $_FILES['file']['type']); + $file_name = add_ext_on_mime($_FILES['file']['name'], $_FILES['file']['type']); $file_name = strtolower($file_name); - $file_info = pathinfo($file_name); - + $file_info = pathinfo($file_name); + if ($is_nano == true) { - $file_info['extension'] = 'wav'; + $file_info['extension'] = 'wav'; } - + $file_name = $this->filename.'.'.$file_info['extension']; - - if (in_array($file_info['extension'], $this->available_extensions)) { + + if (in_array($file_info['extension'], $this->available_extensions)) { if (move_uploaded_file($_FILES['file']['tmp_name'], $this->store_path.$file_name)) { - $this->store_filename = $this->store_path.$file_name; + $this->store_filename = $this->store_path.$file_name; //error_log('saved'); return 1; } } - } + } } return 0; } - + /** * Show the audio file + a button to download * @@ -299,26 +296,26 @@ class Nanogong { public function show_audio_file($show_delete_button = false) { $html = ''; $file_path = $this->load_filename_if_exists(); - + if (!empty($file_path)) { $url = $this->get_public_url(true); $actions = Display::url(Display::return_icon('save.png', get_lang('Download'), array(), ICON_SIZE_SMALL), $url, array('target'=>'_blank')); $download_button = Display::url(get_lang('Download'), $url, array('class' =>'btn')); - - if ($show_delete_button) { + + if ($show_delete_button) { $actions .= ' '.Display::url(Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), "#", array('onclick'=>'delete_file();')); } - + $basename = basename($file_path); $path_info = pathinfo($basename); - + if ($path_info['extension'] == 'wav') { - + $html .= ''; - + $html .= '
'; - $html .= '
'.$actions.'
'; - $html .= '
'; + $html .= '
'.$actions.'
'; + $html .= '
'; $html .= ''; - + $html .= ''; // default true $html .= ''; //you can save in local computer | (default true) //echo ''; // default true @@ -343,47 +340,47 @@ class Nanogong { //echo ''; $html .= '';// ImaADPCM (more speed), Speex (more compression)|(default Speex) //$html .= '';// ImaADPCM (more speed), Speex (more compression)|(default Speex) - - //Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100) + + //Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100) //echo ''; //echo ''; $html .= '';//load a file |(default "") - $html .= ''; + $html .= ''; $html .= '
'; $html .= '
'; - - $html .= '
'.Display::return_message(get_lang('BrowserDoesNotSupportNanogongPlayer'),'warning').$download_button.'
'; - + + $html .= '
'.Display::return_message(get_lang('BrowserDoesNotSupportNanogongPlayer'),'warning').$download_button.'
'; + } elseif(in_array($path_info['extension'],array('mp3', 'ogg','wav'))) { $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/'; - + $html .= ''; //$html .= ''; $html .= ''; - + $html .= '
'; $html .= '
'.$actions.'



'; - + $params = array('url' => $url, 'extension' =>$path_info['extension'], - 'count'=> 1 + 'count'=> 1 ); $jquery = DocumentManager::generate_jplayer_jquery($params); - - + + $html .= ''; + '; $html .= DocumentManager::generate_media_preview(1, 'advanced'); } } return $html; } - - + + /* var filename = document.getElementById("audio_title").value+".wav"; var filename = filename.replace(/\s/g, "_");//replace spaces by _ @@ -393,7 +390,7 @@ class Nanogong { var course_code="'.urlencode($course_code).'"; var urlnanogong="'.$url.'?filename="+filename+"&filepath="+filepath+"&dir="+dir+"&course_code="+course_code; */ - + /** * Returns the nanogong javascript code * @return string @@ -402,13 +399,13 @@ class Nanogong { $params = $this->get_params(true); $url = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=save_file&'.$params.'&is_nano=1'; $url_load_file = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=show_audio&'.$params; - + $url_delete = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=delete&'.$params; - + $js = ''; return $js; } - + /** - * Returns the HTML form to upload a nano file or upload a file + * Returns the HTML form to upload a nano file or upload a file */ function return_form($message = null) { - + $params = $this->get_params(true); $url = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=save_file&'.$params; - + //check browser support and load form $array_browser = api_browser_support('check_browser'); - - $preview_file = $this->show_audio_file(true, true); - + + $preview_file = $this->show_audio_file(true, true); + $preview_file = Display::div($preview_file, array('id' => 'preview', 'style' => 'text-align:center; padding-left: 25px;')); - + $html .= '
'; - + //Use normal upload file $html .= Display::return_icon('microphone.png', get_lang('PressRecordButton'),'', ICON_SIZE_BIG); $html .='
'; - + $html .= '
'; - + $html .= ''; //echo ''; // default true // echo ''; //you can save in local computer | (default true) @@ -558,69 +555,69 @@ class Nanogong { //echo ''; $html .= '';// ImaADPCM (more speed), Speex (more compression)|(default Speex) //$html .= '';// ImaADPCM (more speed), Speex (more compression)|(default Speex) - + //echo '';//Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100) //echo ''; //echo '';//load a file |(default "") $html .= ''; - - $html .= '


'; - + + $html .= '


'; + $html .= '
'; $html .= ''; $html .= ''.get_lang('SendRecord').''; - $html .= '
'; - - + $html .= '
'; + + $html .= Display::url(get_lang('ProblemsRecordingUploadYourOwnAudioFile'), 'javascript:void(0)', array('onclick' => 'show_simple_upload_form();')); - + $html .= '

'; - //$html .= Display::return_message(get_lang('BrowserNotSupportNanogongSend'), 'warning'); + //$html .= Display::return_message(get_lang('BrowserNotSupportNanogongSend'), 'warning'); $html .= ''; - $html .= '
'; - - + $html .= ''; + $html .= ''; + + $html .= ''; - - + + $html .= ''; - + $html .= '
'.$message.'
'; - + $html .= $preview_file; - - + + return $html; } - + function get_params($return_as_query = false) { if (empty($this->params)) { return false; - } + } if ($return_as_query) { return http_build_query($this->params); } - return $this->params; + return $this->params; } - + function get_param_value($attribute) { if (isset($this->params[$attribute])) { return $this->params[$attribute]; } } - + /** * Show a button to load the form * @return string */ - function show_button() { - $params_string = $this->get_params(true); - $html .= '
'.Display::url(get_lang('RecordAnswer'),api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=show_form&'.$params_string.'&TB_iframe=true&height=400&width=500', + function show_button() { + $params_string = $this->get_params(true); + $html .= '
'.Display::url(get_lang('RecordAnswer'),api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=show_form&'.$params_string.'&TB_iframe=true&height=400&width=500', array('class'=>'btn thickbox')); - $html .= '

'.Display::return_message(get_lang('UseTheMessageBelowToAddSomeComments')); + $html .= '

'.Display::return_message(get_lang('UseTheMessageBelowToAddSomeComments')); return $html; - } -} + } +} diff --git a/main/inc/lib/search/tool_processors/document_processor.class.php b/main/inc/lib/search/tool_processors/document_processor.class.php index dcf7e5fd17..6e681b03c4 100644 --- a/main/inc/lib/search/tool_processors/document_processor.class.php +++ b/main/inc/lib/search/tool_processors/document_processor.class.php @@ -77,12 +77,12 @@ class document_processor extends search_processor { $doc_id = Database::escape_string($doc_id); $sql = "SELECT * FROM $doc_table - WHERE $doc_table.id = $doc_id AND c_id = $course_id + WHERE $doc_table.id = $doc_id AND c_id = $course_id LIMIT 1"; $dk_result = Database::query($sql); $sql = "SELECT insert_user_id FROM $item_property_table - WHERE ref = $doc_id AND tool = '" . TOOL_DOCUMENT . "' AND c_id = $course_id + WHERE ref = $doc_id AND tool = '" . TOOL_DOCUMENT . "' AND c_id = $course_id LIMIT 1"; $name = ''; if ($row = Database::fetch_array($dk_result)) { @@ -90,7 +90,6 @@ class document_processor extends search_processor { $url = api_get_path(WEB_PATH) . 'courses/%s/document%s'; $url = sprintf($url, $course_path, $row['path']); // Get the image path - include_once api_get_path(LIBRARY_PATH) . 'fileDisplay.lib.php'; $icon = FileManager::choose_image(basename($row['path'])); $thumbnail = api_get_path(WEB_CODE_PATH) . 'img/' . $icon; $image = $thumbnail; diff --git a/main/newscorm/back_compat.inc.php b/main/newscorm/back_compat.inc.php index 113af38582..fd7cf7062c 100644 --- a/main/newscorm/back_compat.inc.php +++ b/main/newscorm/back_compat.inc.php @@ -10,6 +10,4 @@ /** * Code */ -require_once '../inc/global.inc.php'; -require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; -require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; // replace_dangerous_char() \ No newline at end of file +require_once '../inc/global.inc.php'; \ No newline at end of file diff --git a/main/resourcelinker/resourcelinker.inc.php b/main/resourcelinker/resourcelinker.inc.php index 73fab7fd1e..471cf425f2 100644 --- a/main/resourcelinker/resourcelinker.inc.php +++ b/main/resourcelinker/resourcelinker.inc.php @@ -17,12 +17,6 @@ use \ChamiloSession as Session; * INIT SECTION */ -// name of the language file that needs to be included -//$language_file = "resourcelinker";// TODO: Repeated deleting and moving the rest of this lang file to trad4all - -//include(api_get_path(SYS_CODE_PATH).'lang/english/resourcelinker.inc.php'); // TODO: Repeated deleting and moving the rest of this lang file to trad4all -//include(api_get_path(SYS_CODE_PATH).'lang/'.$_course['language'].'/resourcelinker.inc.php'); // TODO: Repeated deleting and moving the rest of this lang file to trad4all -include_once(api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'); include(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'); /** @@ -246,7 +240,7 @@ function display_addedresource_link($type, $id, $style='') { $styling = ' class="'.$style.'"'; } - + $course_id = api_get_course_int_id(); switch ($type) diff --git a/main/social/message_for_group_form.inc.php b/main/social/message_for_group_form.inc.php index cc96e3088f..2422d86217 100644 --- a/main/social/message_for_group_form.inc.php +++ b/main/social/message_for_group_form.inc.php @@ -17,7 +17,6 @@ if (api_get_setting('allow_social_tool') !='true') { } require_once api_get_path(LIBRARY_PATH).'fckeditor/fckeditor.php'; -require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; $tok = Security::get_token(); @@ -43,24 +42,24 @@ $to_group = ''; $subject = ''; $message = ''; if (!empty($group_id) && $allowed_action) { - $group_info = GroupPortalManager::get_group_data($group_id); + $group_info = GroupPortalManager::get_group_data($group_id); $is_member = GroupPortalManager::is_group_member($group_id); - + if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED && !$is_member) { - api_not_allowed(true); + api_not_allowed(true); } $to_group = $group_info['name']; if (!empty($message_id)) { - $message_info = MessageManager::get_message_by_id($message_id); - if ($allowed_action == 'reply_message_group') { + $message_info = MessageManager::get_message_by_id($message_id); + if ($allowed_action == 'reply_message_group') { $subject = get_lang('Reply').': '.api_xml_http_response_encode($message_info['title']); //$message = api_xml_http_response_encode($message_info['content']); } else { $subject = api_xml_http_response_encode($message_info['title']); $message = api_xml_http_response_encode($message_info['content']); - } - } + } + } } $page_item = !empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1; @@ -84,27 +83,27 @@ $page_topic = !empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1 if (api_get_setting('allow_message_tool')=='true') { //normal message $user_info = api_get_user_info($userfriend_id); - //echo api_xml_http_response_encode(get_lang('To')).":  ".api_xml_http_response_encode($to_group); + //echo api_xml_http_response_encode(get_lang('To')).":  ".api_xml_http_response_encode($to_group); $height = 180; if ($allowed_action == 'add_message_group') { $height = 140; echo '* '.api_xml_http_response_encode(get_lang('Title')).' :
'; - echo '

'; + echo '

'; } - //echo api_xml_http_response_encode(get_lang('Description')).' :
'; - + //echo api_xml_http_response_encode(get_lang('Description')).' :
'; + $oFCKeditor = new FCKeditor('content') ; $oFCKeditor->ToolbarSet = 'messages'; $oFCKeditor->Width = '95%'; $oFCKeditor->Height = $height; $oFCKeditor->Value = $message; - - $return = $oFCKeditor->CreateHtml(); + + $return = $oFCKeditor->CreateHtml(); echo $return; if ($allowed_action == 'add_message_group') { - echo '
* '.get_lang('FieldRequired').'
'; + echo '
* '.get_lang('FieldRequired').'
'; } - ?> + ?>

:
@@ -112,15 +111,15 @@ $page_topic = !empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1 - () + ()

- + - + diff --git a/main/work/work.lib.php b/main/work/work.lib.php index 0c470f8975..7eb23808fb 100644 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -14,7 +14,6 @@ * Initialization */ require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php'; -require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php'; /** diff --git a/main/work/work.php b/main/work/work.php index eee1da2fe2..3bdc0ea20b 100644 --- a/main/work/work.php +++ b/main/work/work.php @@ -55,10 +55,6 @@ api_protect_course_script(true); // Including necessary files require_once 'work.lib.php'; -include_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; -require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; -require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; - $course_id = api_get_course_int_id(); $course_info = api_get_course_info(); $user_id = api_get_user_id(); diff --git a/tests/test_manager.inc.php b/tests/test_manager.inc.php index f72d7e09e3..e90722be91 100755 --- a/tests/test_manager.inc.php +++ b/tests/test_manager.inc.php @@ -68,7 +68,6 @@ require_once $maindir.'course_info/download.lib.php'; /**Files inside '/../main/lib/' */ require_once $libdir.'urlmanager.lib.php'; -require_once $libdir.'fileDisplay.lib.php'; require_once $libdir.'groupmanager.lib.php'; require_once $libdir.'usermanager.lib.php'; require_once $libdir.'social.lib.php';