From d76b6cc817326f8c5f4799929f969636064d1adf Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 21 Jun 2013 16:54:16 +0200 Subject: [PATCH] Adding "api_" in function inside main_api.lib.php --- main/admin/archive_cleanup.php | 4 ++-- main/admin/configure_homepage.php | 4 ++-- main/admin/configure_inscription.php | 5 +---- main/auth/inscription.php | 2 +- main/auth/profile.php | 2 +- main/course_home/course_home.php | 3 ++- main/coursecopy/classes/CourseArchiver.class.php | 4 ++-- main/coursecopy/classes/CourseRecycler.class.php | 4 ++-- main/coursecopy/classes/CourseRestorer.class.php | 4 ++-- .../classes/DummyCourseCreator.class.php | 2 +- main/document/create_document.php | 4 ++-- main/document/document.php | 2 +- main/document/document_lite.php | 2 +- main/document/save_pixlr.php | 4 ++-- main/dropbox/dropbox_config.inc.php | 8 ++++---- main/dropbox/dropbox_functions.inc.php | 2 +- main/dropbox/dropbox_submit.php | 2 +- main/exercice/hotpotatoes.php | 2 +- main/gradebook/lib/fe/exportgradebook.php | 2 +- main/inc/lib/dashboard.lib.php | 4 ++-- main/inc/lib/display.lib.php | 2 +- main/inc/lib/document.lib.php | 2 +- .../editor/filemanager/connectors/php/io.php | 2 +- .../plugins/ImageManager/Classes/ImageManager.php | 4 ++-- .../plugins/ajaxfilemanager/inc/class.upload.php | 4 ++-- main/inc/lib/fileManager.lib.php | 10 +++++----- main/inc/lib/group_portal_manager.lib.php | 2 +- main/inc/lib/groupmanager.lib.php | 2 +- main/inc/lib/jpegcam/webcam_receiver.php | 2 +- main/inc/lib/nanogong/receiver.php | 4 ++-- main/inc/lib/pdf.lib.php | 4 ++-- main/inc/lib/social.lib.php | 2 +- main/inc/lib/svg-edit/extensions/fileopen.php | 4 ++-- main/inc/lib/svg-edit/extensions/filesave.php | 4 ++-- main/inc/lib/template.lib.php | 4 ++-- main/inc/lib/usergroup.lib.php | 4 ++-- main/inc/lib/wami-recorder/record_document.php | 4 ++-- main/inc/local.inc.php | 2 +- main/install/install.lib.php | 2 +- main/newscorm/aicc.class.php | 4 ++-- main/newscorm/learnpath.class.php | 14 +++++++------- main/newscorm/learnpathItem.class.php | 4 ++-- main/newscorm/lp_admin_view.php | 2 +- main/newscorm/lp_list.php | 2 +- main/newscorm/lp_move_item.php | 2 +- main/newscorm/lp_upload.php | 8 ++++---- main/newscorm/lp_view_item.php | 12 ++++++------ main/newscorm/openoffice_document.class.php | 4 ++-- main/newscorm/resourcelinker.inc.php | 6 +++--- main/newscorm/scorm.class.php | 4 ++-- main/tracking/courseLogCSV.php | 2 +- main/tracking/userlogCSV.php | 2 +- main/wiki/wiki.inc.php | 2 +- main/work/work.lib.php | 6 +++--- main/work/work.php | 6 +++--- 55 files changed, 104 insertions(+), 106 deletions(-) diff --git a/main/admin/archive_cleanup.php b/main/admin/archive_cleanup.php index c3f3d55a73..e73e91028b 100644 --- a/main/admin/archive_cleanup.php +++ b/main/admin/archive_cleanup.php @@ -29,7 +29,7 @@ $message = null; if ($form->validate()) { $archive_path = api_get_path(SYS_ARCHIVE_PATH); $htaccess = @file_get_contents($archive_path.'.htaccess'); - $result = rmdirr($archive_path, true); + $result = api_rmdirr($archive_path, true); if (!empty($htaccess)) { @file_put_contents($archive_path.'/.htaccess', $htaccess); @@ -63,4 +63,4 @@ if (!empty($message)) { echo $message; } $form->display(); -Display::display_footer(); \ No newline at end of file +Display::display_footer(); diff --git a/main/admin/configure_homepage.php b/main/admin/configure_homepage.php index 0700dc9897..ca0bf54eeb 100644 --- a/main/admin/configure_homepage.php +++ b/main/admin/configure_homepage.php @@ -87,7 +87,7 @@ if (api_is_multiple_url_enabled()) { if ($access_url_id != -1) { $url_info = api_get_access_url($access_url_id); $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); - $clean_url = replace_dangerous_char($url); + $clean_url = api_replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; @@ -318,7 +318,7 @@ if (!empty($action)) { '/' ) || !strstr($filename, '.html') ) { - $filename = replace_dangerous_char($link_name, 'strict').'.html'; + $filename = api_replace_dangerous_char($link_name, 'strict').'.html'; } // "home_" prefix for links are renamed to "user_" prefix (to avoid name clash with existing home page files) if (!empty($filename)) { diff --git a/main/admin/configure_inscription.php b/main/admin/configure_inscription.php index 3947169a96..8e33647533 100644 --- a/main/admin/configure_inscription.php +++ b/main/admin/configure_inscription.php @@ -70,12 +70,9 @@ if (api_is_multiple_url_enabled()) { if ($access_url_id != -1) { $url_info = api_get_access_url($access_url_id); $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); - - $clean_url = replace_dangerous_char($url); + $clean_url = api_replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; - - $homep = api_get_path(SYS_PATH).'home/'; //homep for Home Path $homep_new = api_get_path(SYS_PATH).'home/'.$clean_url; //homep for Home Path added the url $new_url_dir = api_get_path(SYS_PATH).'home/'.$clean_url; diff --git a/main/auth/inscription.php b/main/auth/inscription.php index c5a506e10b..e426d486fc 100644 --- a/main/auth/inscription.php +++ b/main/auth/inscription.php @@ -236,7 +236,7 @@ if (!CustomPages::enabled()) { if ($access_url_id != -1) { $url_info = api_get_access_url($access_url_id); $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); - $clean_url = replace_dangerous_char($url); + $clean_url = api_replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; $home_old = api_get_path(SYS_PATH).'home/'; diff --git a/main/auth/profile.php b/main/auth/profile.php index 422db78215..450026e343 100644 --- a/main/auth/profile.php +++ b/main/auth/profile.php @@ -398,7 +398,7 @@ function upload_user_production($user_id) if (!file_exists($production_repository)) { @mkdir($production_repository, api_get_permissions_for_new_directories(), true); } - $filename = replace_dangerous_char($_FILES['production']['name']); + $filename = api_replace_dangerous_char($_FILES['production']['name']); $filename = FileManager::disable_dangerous_file($filename); if (FileManager::filter_extension($filename)) { diff --git a/main/course_home/course_home.php b/main/course_home/course_home.php index 93fd69eb32..3abccce183 100644 --- a/main/course_home/course_home.php +++ b/main/course_home/course_home.php @@ -102,8 +102,9 @@ if (!isset($coursesAlreadyVisited[$course_code])) { $show_autolaunch_exercise_warning = false; -//Exercise auto-launch +// Exercise auto-launch $auto_launch = api_get_course_setting('enable_exercise_auto_launch'); + if (!empty($auto_launch)) { $session_id = api_get_session_id(); //Exercise list diff --git a/main/coursecopy/classes/CourseArchiver.class.php b/main/coursecopy/classes/CourseArchiver.class.php index fda25bb4f8..1a7a38d59d 100644 --- a/main/coursecopy/classes/CourseArchiver.class.php +++ b/main/coursecopy/classes/CourseArchiver.class.php @@ -23,7 +23,7 @@ class CourseArchiver if ($handle = @ opendir($dir)) { while (($file = readdir($handle)) !== false) { if ($file != "." && $file != ".." && strpos($file, 'CourseArchiver_') === 0 && is_dir($dir . '/' . $file)) { - rmdirr($dir . '/' . $file); + api_rmdirr($dir . '/' . $file); } } closedir($handle); @@ -124,7 +124,7 @@ class CourseArchiver $zip->create($zip_dir . $tmp_dir_name, PCLZIP_OPT_REMOVE_PATH, $zip_dir . $tmp_dir_name . '/'); //$zip->deleteByIndex(0); // Remove the temp-dir. - rmdirr($backup_dir); + api_rmdirr($backup_dir); return $zip_file; } diff --git a/main/coursecopy/classes/CourseRecycler.class.php b/main/coursecopy/classes/CourseRecycler.class.php index 0230ff489a..57f3633ed9 100644 --- a/main/coursecopy/classes/CourseRecycler.class.php +++ b/main/coursecopy/classes/CourseRecycler.class.php @@ -79,7 +79,7 @@ class CourseRecycler if ($this->course->has_resources(RESOURCE_DOCUMENT)) { $table = Database :: get_course_table(TABLE_DOCUMENT); foreach ($this->course->resources[RESOURCE_DOCUMENT] as $id => $document) { - rmdirr($this->course->backup_path.'/'.$document->path); + api_rmdirr($this->course->backup_path.'/'.$document->path); } $ids = implode(',', (array_keys($this->course->resources[RESOURCE_DOCUMENT]))); $sql = "DELETE FROM ".$table." WHERE c_id = ".$this->course_id." AND id IN(".$ids.")"; @@ -446,7 +446,7 @@ class CourseRecycler { // The directory trat contains files of the SCORM package is to be deleted. $scorm_package_dir = realpath($this->course->path . 'scorm/' . $learnpath->path); - rmdirr($scorm_package_dir); + api_rmdirr($scorm_package_dir); } } diff --git a/main/coursecopy/classes/CourseRestorer.class.php b/main/coursecopy/classes/CourseRestorer.class.php index fafdbb0f24..0e0977fa82 100644 --- a/main/coursecopy/classes/CourseRestorer.class.php +++ b/main/coursecopy/classes/CourseRestorer.class.php @@ -564,7 +564,7 @@ class CourseRestorer $path_title = '/'.$new_base_foldername.'/'.$document_path[2]; - copy_folder_course_session( + api_copy_folder_course_session( $basedir_dest_path, $base_path_document, $session_id, @@ -841,7 +841,7 @@ class CourseRestorer if (file_exists($path.$document->path)) { switch ($this->file_option) { case FILE_OVERWRITE : - rmdirr($path.$document->path); + api_rmdirr($path.$document->path); FileManager::copyDirTo( $this->course->backup_path.'/'.$document->path, $path.dirname($document->path), diff --git a/main/coursecopy/classes/DummyCourseCreator.class.php b/main/coursecopy/classes/DummyCourseCreator.class.php index 551885fa32..c2ef7c97c8 100644 --- a/main/coursecopy/classes/DummyCourseCreator.class.php +++ b/main/coursecopy/classes/DummyCourseCreator.class.php @@ -62,7 +62,7 @@ class DummyCourseCreator $cr = new CourseRestorer($this->course); $cr->set_file_option(FILE_OVERWRITE); $cr->restore($course_code); - rmdirr($tmp_path); + api_rmdirr($tmp_path); } /** * Create dummy documents diff --git a/main/document/create_document.php b/main/document/create_document.php index 82922d7e66..ab251116bf 100644 --- a/main/document/create_document.php +++ b/main/document/create_document.php @@ -347,7 +347,7 @@ function document_exists($filename) global $filepath; $filename = addslashes(trim($filename)); $filename = Security::remove_XSS($filename); - $filename = replace_dangerous_char($filename); + $filename = api_replace_dangerous_char($filename); $filename = FileManager::disable_dangerous_file($filename); return !file_exists($filepath.$filename.'.html'); @@ -518,7 +518,7 @@ if ($form->validate()) { $filename = $values['title']; $filename = addslashes(trim($filename)); $filename = Security::remove_XSS($filename); - $filename = replace_dangerous_char($filename); + $filename = api_replace_dangerous_char($filename); $filename = FileManager::disable_dangerous_file($filename); //Setting the title diff --git a/main/document/document.php b/main/document/document.php index 9164c1a689..516abdeadf 100644 --- a/main/document/document.php +++ b/main/document/document.php @@ -892,7 +892,7 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_fold $curdirpath = $document_data['path']; } $added_slash = ($curdirpath == '/') ? '' : '/'; - $dir_name = $curdirpath.$added_slash.replace_dangerous_char($post_dir_name); + $dir_name = $curdirpath.$added_slash.api_replace_dangerous_char($post_dir_name); $dir_name = FileManager::disable_dangerous_file($dir_name); $dir_check = $base_work_dir.$dir_name; diff --git a/main/document/document_lite.php b/main/document/document_lite.php index 58a5859337..f37caf6ee0 100644 --- a/main/document/document_lite.php +++ b/main/document/document_lite.php @@ -632,7 +632,7 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_fold $curdirpath = $document_data['path']; } $added_slash = ($curdirpath == '/') ? '' : '/'; - $dir_name = $curdirpath.$added_slash.replace_dangerous_char($post_dir_name); + $dir_name = $curdirpath.$added_slash.api_replace_dangerous_char($post_dir_name); $dir_name = FileManager::disable_dangerous_file($dir_name); $dir_check = $base_work_dir.$dir_name; diff --git a/main/document/save_pixlr.php b/main/document/save_pixlr.php index 3b8d4357ab..7989be8c38 100644 --- a/main/document/save_pixlr.php +++ b/main/document/save_pixlr.php @@ -70,7 +70,7 @@ $contents = file_get_contents($urlcontents_to_save);//replace line 45. //a bit title security $filename = addslashes(trim($filename)); $filename = Security::remove_XSS($filename); -$filename = replace_dangerous_char($filename, 'strict'); +$filename = api_replace_dangerous_char($filename, 'strict'); $filename = FileManager::disable_dangerous_file($filename); if (strlen(trim($filename)) == 0) { @@ -246,4 +246,4 @@ if (!isset($_SESSION['exit_pixlr'])) { $location = api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']); echo ''; unset($_SESSION['exit_pixlr']); -} \ No newline at end of file +} diff --git a/main/dropbox/dropbox_config.inc.php b/main/dropbox/dropbox_config.inc.php index 295fe7eb03..7793b78f31 100644 --- a/main/dropbox/dropbox_config.inc.php +++ b/main/dropbox/dropbox_config.inc.php @@ -27,10 +27,10 @@ $dropbox_cnf['sysPath'] = api_get_path(SYS_COURSE_PATH) . $_course['path'] . $dropbox_cnf['webPath'] = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/dropbox'; $dropbox_cnf['maxFilesize'] = api_get_setting('dropbox_max_filesize'); //file size limit as imposed by the platform admin (see Chamilo Config Settings on the platform administration section) //$dropbox_cnf['version'] = '1.4'; -$dropbox_cnf['allowOverwrite'] = string_2_boolean(api_get_setting('dropbox_allow_overwrite')); -$dropbox_cnf['allowJustUpload'] = string_2_boolean(api_get_setting('dropbox_allow_just_upload')); -$dropbox_cnf['allowStudentToStudent'] = string_2_boolean(api_get_setting('dropbox_allow_student_to_student')); -$dropbox_cnf['allowGroup'] = string_2_boolean(api_get_setting('dropbox_allow_group')); +$dropbox_cnf['allowOverwrite'] = api_string_2_boolean(api_get_setting('dropbox_allow_overwrite')); +$dropbox_cnf['allowJustUpload'] = api_string_2_boolean(api_get_setting('dropbox_allow_just_upload')); +$dropbox_cnf['allowStudentToStudent'] = api_string_2_boolean(api_get_setting('dropbox_allow_student_to_student')); +$dropbox_cnf['allowGroup'] = api_string_2_boolean(api_get_setting('dropbox_allow_group')); /** * INITIALISE MAILING VARIABLES diff --git a/main/dropbox/dropbox_functions.inc.php b/main/dropbox/dropbox_functions.inc.php index 1800ac883f..dea35ffd8b 100644 --- a/main/dropbox/dropbox_functions.inc.php +++ b/main/dropbox/dropbox_functions.inc.php @@ -908,7 +908,7 @@ function store_add_dropbox() // Try to add an extension to the file if it hasn't got one $dropbox_filename = FileManager::add_ext_on_mime($dropbox_filename, $dropbox_filetype); // Replace dangerous characters - $dropbox_filename = replace_dangerous_char($dropbox_filename); + $dropbox_filename = api_replace_dangerous_char($dropbox_filename); // Transform any .php file in .phps fo security $dropbox_filename = FileManager::php2phps($dropbox_filename); diff --git a/main/dropbox/dropbox_submit.php b/main/dropbox/dropbox_submit.php index dede57675c..4e1d7ec229 100644 --- a/main/dropbox/dropbox_submit.php +++ b/main/dropbox/dropbox_submit.php @@ -91,7 +91,7 @@ if (isset($_POST['submitWork'])) { // Try to add an extension to the file if it hasn't got one $dropbox_filename = FileManager::add_ext_on_mime($dropbox_filename, $dropbox_filetype); // Replace dangerous characters - $dropbox_filename = replace_dangerous_char($dropbox_filename); + $dropbox_filename = api_replace_dangerous_char($dropbox_filename); // Transform any .php file in .phps fo security $dropbox_filename = FileManager::php2phps($dropbox_filename); if (!FileManager::filter_extension($dropbox_filename)) { diff --git a/main/exercice/hotpotatoes.php b/main/exercice/hotpotatoes.php index eb892728ad..ed8fa11130 100644 --- a/main/exercice/hotpotatoes.php +++ b/main/exercice/hotpotatoes.php @@ -113,7 +113,7 @@ if ((api_is_allowed_to_edit(null, true)) && (($finish == 0) || ($finish == 2))) if ($finish == 0) { // Generate new test folder if on first step of file upload. - $filename = replace_dangerous_char(trim($_FILES['userFile']['name']), 'strict'); + $filename = api_replace_dangerous_char(trim($_FILES['userFile']['name']), 'strict'); $fld = GenerateHpFolder($document_sys_path.$uploadPath.'/'); //$doc_id = FileManager::add_document($_course, '/HotPotatoes_files/'.$fld, 'folder', 0, $fld); diff --git a/main/gradebook/lib/fe/exportgradebook.php b/main/gradebook/lib/fe/exportgradebook.php index 293c17bd41..19b7e9912d 100644 --- a/main/gradebook/lib/fe/exportgradebook.php +++ b/main/gradebook/lib/fe/exportgradebook.php @@ -205,7 +205,7 @@ function export_pdf_attendance($headers_table, $data_table, $headers_pdf, $foote } else { $mpdf->WriteHTML($html); } - $mpdf->Output(replace_dangerous_char($title_pdf.'.pdf'), 'D'); + $mpdf->Output(api_replace_dangerous_char($title_pdf.'.pdf'), 'D'); exit; } diff --git a/main/inc/lib/dashboard.lib.php b/main/inc/lib/dashboard.lib.php index d927fa55ed..c755ae9613 100644 --- a/main/inc/lib/dashboard.lib.php +++ b/main/inc/lib/dashboard.lib.php @@ -47,7 +47,7 @@ class DashboardManager { $plugin_info_file = $dashboard_pluginpath.$testplugin."/$testplugin.info"; $plugin_info = array(); if (file_exists($plugin_info_file) && is_readable($plugin_info_file)) { - $plugin_info = parse_info_file($plugin_info_file); + $plugin_info = api_parse_info_file($plugin_info_file); // change index to lower case $plugin_info = array_change_key_case($plugin_info); @@ -207,7 +207,7 @@ class DashboardManager { $plugin_info_file = $dashboard_pluginpath.$testplugin."/$testplugin.info"; $plugin_info = array(); if (file_exists($plugin_info_file)) { - $plugin_info = parse_info_file($plugin_info_file); + $plugin_info = api_parse_info_file($plugin_info_file); } // change keys to lower case diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 243a1b8ec8..1fe8d45753 100644 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -1419,7 +1419,7 @@ class Display // Show all tool icons where there is something new. $retvalue = ' '; while (list($key, $notification) = each($notifications)) { - $lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date'])); + $lastDate = date('d/m/Y H:i', api_convert_sql_date($notification['lastedit_date'])); $type = $notification['lastedit_type']; if (empty($course_info['id_session'])) { $my_course['id_session'] = 0; diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index def88263af..eb510d06b9 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -310,7 +310,7 @@ class DocumentManager if (!is_file($full_file_name)) { return false; } - $filename = ($name == '') ? basename($full_file_name) : replace_dangerous_char($name); + $filename = ($name == '') ? basename($full_file_name) : api_replace_dangerous_char($name); $len = filesize($full_file_name); if ($forced) { diff --git a/main/inc/lib/fckeditor/editor/filemanager/connectors/php/io.php b/main/inc/lib/fckeditor/editor/filemanager/connectors/php/io.php index 8f45f332b1..c5fd4ee16e 100644 --- a/main/inc/lib/fckeditor/editor/filemanager/connectors/php/io.php +++ b/main/inc/lib/fckeditor/editor/filemanager/connectors/php/io.php @@ -322,7 +322,7 @@ function SanitizeFileName($sNewFileName, $sMimeType = null) // Remove \ / | : ? * " < > //$sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ) ; - $sNewFileName = replace_dangerous_char($sNewFileName, 'strict'); + $sNewFileName = api_replace_dangerous_char($sNewFileName, 'strict'); $sNewFileName = FileManager::php2phps($sNewFileName); diff --git a/main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php b/main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php index 6bbacdb627..124f2f47b3 100644 --- a/main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php +++ b/main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php @@ -543,7 +543,7 @@ class ImageManager return false; } - $file['name'] = replace_dangerous_char($file['name'], 'strict'); + $file['name'] = api_replace_dangerous_char($file['name'], 'strict'); $file_name = $file['name']; $extension = explode('.', $file_name); $count = count($extension); @@ -957,4 +957,4 @@ class ImageManager } } -?> \ No newline at end of file +?> diff --git a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php index a7c6fe0fcb..cff102ef7e 100644 --- a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php +++ b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php @@ -196,7 +196,7 @@ class Upload // Juan Carlos RaƱa replace space by _ because fix long names. See: ajaxfilemanager/inc/class.manager.php. //And add cleaning from Chamilo replace_dangerous_char() and FileManage::disable_dangerous_file() $this->fileBaseName = FileManager::disable_dangerous_file( - replace_dangerous_char(str_replace(' ', '_', $this->fileBaseName), 'strict') + api_replace_dangerous_char(str_replace(' ', '_', $this->fileBaseName), 'strict') ); $fileName = $this->fileBaseName.$this->fileExtension; $filePath = $dest.$fileName; @@ -582,4 +582,4 @@ class Upload } } -?> \ No newline at end of file +?> diff --git a/main/inc/lib/fileManager.lib.php b/main/inc/lib/fileManager.lib.php index 895426a4bf..92330667ca 100644 --- a/main/inc/lib/fileManager.lib.php +++ b/main/inc/lib/fileManager.lib.php @@ -215,7 +215,7 @@ class FileManager $path = dirname($file_path); $old_file_name = basename($file_path); - $new_file_name = replace_dangerous_char($new_file_name); + $new_file_name = api_replace_dangerous_char($new_file_name); // If no extension, take the old one if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { @@ -921,7 +921,7 @@ class FileManager return false; } else { // Clean up the name, only ASCII characters should stay. (and strict) - $clean_name = replace_dangerous_char($uploaded_file['name'], 'strict'); + $clean_name = api_replace_dangerous_char($uploaded_file['name'], 'strict'); // No "dangerous" files $clean_name = self::disable_dangerous_file($clean_name); @@ -1525,7 +1525,7 @@ class FileManager foreach ($path_array as $key => & $val) { // We don't want to lose the dots in ././folder/file (cfr. zipfile) if ($val != '.') { - $val = self::disable_dangerous_file(replace_dangerous_char($val)); + $val = self::disable_dangerous_file(api_replace_dangerous_char($val)); } } // Join the "cleaned" path (modified in-place as passed by reference) @@ -2069,7 +2069,7 @@ class FileManager // Directory? if (is_dir($completepath)) { $title = self::get_document_title($file); - $safe_file = replace_dangerous_char($file); + $safe_file = api_replace_dangerous_char($file); @rename($path.'/'.$file, $path.'/'.$safe_file); // If we can't find the file, add it if (!DocumentManager::get_document_id($_course, $current_path.'/'.$safe_file)) { @@ -2098,7 +2098,7 @@ class FileManager ); } else { //Rename - $safe_file = self::disable_dangerous_file(replace_dangerous_char($file, 'strict')); + $safe_file = self::disable_dangerous_file(api_replace_dangerous_char($file, 'strict')); @rename($base_work_dir.$current_path.'/'.$file, $base_work_dir.$current_path.'/'.$safe_file); $document_id = DocumentManager::get_document_id($_course, $current_path.'/'.$safe_file); if (!$document_id) { diff --git a/main/inc/lib/group_portal_manager.lib.php b/main/inc/lib/group_portal_manager.lib.php index c5d520430f..99b77bb002 100644 --- a/main/inc/lib/group_portal_manager.lib.php +++ b/main/inc/lib/group_portal_manager.lib.php @@ -773,7 +773,7 @@ class GroupPortalManager $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file; $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension; } else { - $filename = replace_dangerous_char($filename); + $filename = api_replace_dangerous_char($filename); if (PREFIX_IMAGE_FILENAME_WITH_UID) { $filename = uniqid('').'_'.$filename; } diff --git a/main/inc/lib/groupmanager.lib.php b/main/inc/lib/groupmanager.lib.php index 3c860f7450..e357c6f4bc 100644 --- a/main/inc/lib/groupmanager.lib.php +++ b/main/inc/lib/groupmanager.lib.php @@ -226,7 +226,7 @@ class GroupManager Database::update($table_group, array('id' => $lastId), array('iid = ? ' => $lastId)); if ($lastId) { - $desired_dir_name = '/'.replace_dangerous_char($name, 'strict').'_groupdocs'; + $desired_dir_name = '/'.api_replace_dangerous_char($name, 'strict').'_groupdocs'; $my_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document'; $unique_name = FileManager::create_unexisting_directory( $_course, diff --git a/main/inc/lib/jpegcam/webcam_receiver.php b/main/inc/lib/jpegcam/webcam_receiver.php index 4ecab064c9..eda150dfd4 100644 --- a/main/inc/lib/jpegcam/webcam_receiver.php +++ b/main/inc/lib/jpegcam/webcam_receiver.php @@ -30,7 +30,7 @@ if ($webcamuserid != api_get_user_id() || api_get_user_id() == 0 || $webcamuseri $webcamname = Security::remove_XSS($webcamname); $webcamname = Database::escape_string($webcamname); $webcamname = addslashes(trim($webcamname)); -$webcamname = replace_dangerous_char($webcamname, 'strict'); +$webcamname = api_replace_dangerous_char($webcamname, 'strict'); $webcamname = FileManager::disable_dangerous_file($webcamname); $webcamdir = Security::remove_XSS($webcamdir); diff --git a/main/inc/lib/nanogong/receiver.php b/main/inc/lib/nanogong/receiver.php index a7dfd7af58..222b1eec22 100644 --- a/main/inc/lib/nanogong/receiver.php +++ b/main/inc/lib/nanogong/receiver.php @@ -41,7 +41,7 @@ $_course = api_get_course_info($course_code); $filename = trim($_GET['filename']); $filename = Security::remove_XSS($filename); $filename = Database::escape_string($filename); -$filename = replace_dangerous_char($filename, $strict = 'loose'); // or strict +$filename = api_replace_dangerous_char($filename, $strict = 'loose'); // or strict $filename = FileManager::disable_dangerous_file($filename); $title = trim(str_replace('_chnano_.', '.', $filename)); //hide nanogong wav tag at title @@ -87,4 +87,4 @@ if (!file_exists($documentPath)) { ); } else { return get_lang('FileExistRename'); -} \ No newline at end of file +} diff --git a/main/inc/lib/pdf.lib.php b/main/inc/lib/pdf.lib.php index 22098df3d9..92c4f22b81 100644 --- a/main/inc/lib/pdf.lib.php +++ b/main/inc/lib/pdf.lib.php @@ -254,7 +254,7 @@ class PDF { if (empty($pdf_name)) { $output_file = 'pdf_'.date('Y-m-d-his').'.pdf'; } else { - $pdf_name = replace_dangerous_char($pdf_name); + $pdf_name = api_replace_dangerous_char($pdf_name); $output_file = $pdf_name.'.pdf'; } $result = $this->pdf->Output($output_file, 'D'); /// F to save the pdf in a file @@ -346,7 +346,7 @@ class PDF { if (empty($pdf_name)) { $output_file = 'pdf_'.date('Y-m-d-his').'.pdf'; } else { - $pdf_name = replace_dangerous_char($pdf_name); + $pdf_name = api_replace_dangerous_char($pdf_name); $output_file = $pdf_name.'.pdf'; } $result = $this->pdf->Output($output_file, 'D'); // F to save the pdf in a file diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index 2073ae8571..13e60dca63 100644 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -744,7 +744,7 @@ class SocialManager extends UserManager { $user_object = Database::fetch_object($result); $alt = $userInfo['complete_name'].($curretUserId == $user_id ? ' ('.get_lang('Me').')' : ''); - $status = get_status_from_code($user_object->status); + $status = api_get_status_from_code($user_object->status); $interbreadcrumb[] = array('url' => SocialManager::getUserOnlineLink(), 'name' => get_lang('UsersOnLineList')); diff --git a/main/inc/lib/svg-edit/extensions/fileopen.php b/main/inc/lib/svg-edit/extensions/fileopen.php index 2960fc2bca..ab30f23999 100644 --- a/main/inc/lib/svg-edit/extensions/fileopen.php +++ b/main/inc/lib/svg-edit/extensions/fileopen.php @@ -50,7 +50,7 @@ $extension = strtolower($extension[sizeof($extension) - 1]); //a bit title security $filename = addslashes(trim($file)); $filename = Security::remove_XSS($filename); -$filename = replace_dangerous_char($filename, 'strict'); +$filename = api_replace_dangerous_char($filename, 'strict'); $filename = FileManager::disable_dangerous_file($filename); //a bit mime security @@ -66,4 +66,4 @@ if (strpos($current_mime, $mime_svg) === false && strpos($current_mime, $mime_xm \ No newline at end of file + diff --git a/main/inc/lib/svg-edit/extensions/filesave.php b/main/inc/lib/svg-edit/extensions/filesave.php index eaadaefe00..d75700c2c8 100644 --- a/main/inc/lib/svg-edit/extensions/filesave.php +++ b/main/inc/lib/svg-edit/extensions/filesave.php @@ -70,7 +70,7 @@ $saveDir = $dirBaseDocuments.$_SESSION['draw_dir']; $filename = addslashes(trim($filename)); $filename = Security::remove_XSS($filename); -$filename = replace_dangerous_char($filename, 'strict'); +$filename = api_replace_dangerous_char($filename, 'strict'); $filename = FileManager::disable_dangerous_file($filename); // a bit extension @@ -211,4 +211,4 @@ if ($suffix != 'png') { } else { echo 'alert("'.get_lang('FileExportAs').': '.$title.'");'; } -echo ''; \ No newline at end of file +echo ''; diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 106189700d..355f1d3a86 100644 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -603,7 +603,7 @@ class Template if ($access_url_id != -1) { $url_info = api_get_current_access_url_info(); $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); - $clean_url = replace_dangerous_char($url); + $clean_url = api_replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; $homep = api_get_path(REL_PATH).'home/'.$clean_url; //homep for Home Path @@ -806,7 +806,7 @@ class Template if ($access_url_id != -1) { $url_info = api_get_current_access_url_info(); $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); - $clean_url = replace_dangerous_char($url); + $clean_url = api_replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; $homep = api_get_path(SYS_DATA_PATH).'home/'.$clean_url; //homep for Home Path diff --git a/main/inc/lib/usergroup.lib.php b/main/inc/lib/usergroup.lib.php index c871457055..c0eb9b9e56 100644 --- a/main/inc/lib/usergroup.lib.php +++ b/main/inc/lib/usergroup.lib.php @@ -533,7 +533,7 @@ class UserGroup extends Model $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file; $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension; } else { - $filename = replace_dangerous_char($filename); + $filename = api_replace_dangerous_char($filename); if (PREFIX_IMAGE_FILENAME_WITH_UID) { $filename = uniqid('').'_'.$filename; } @@ -1534,4 +1534,4 @@ class UserGroup extends Model return $list; } -} \ No newline at end of file +} diff --git a/main/inc/lib/wami-recorder/record_document.php b/main/inc/lib/wami-recorder/record_document.php index 64cc51bb74..6962ecfeae 100644 --- a/main/inc/lib/wami-recorder/record_document.php +++ b/main/inc/lib/wami-recorder/record_document.php @@ -26,7 +26,7 @@ if ($wamiuserid != api_get_user_id() || api_get_user_id() == 0 || $wamiuserid == $waminame = Security::remove_XSS($waminame); $waminame = Database::escape_string($waminame); $waminame = addslashes(trim($waminame)); -$waminame = replace_dangerous_char($waminame, 'strict'); +$waminame = api_replace_dangerous_char($waminame, 'strict'); $waminame = FileManager::disable_dangerous_file($waminame); $wamidir = Security::remove_XSS($wamidir); @@ -103,4 +103,4 @@ api_item_property_update( null, $current_session_id ); -?> \ No newline at end of file +?> diff --git a/main/inc/local.inc.php b/main/inc/local.inc.php index 3ce0208cbf..ab15d13ede 100644 --- a/main/inc/local.inc.php +++ b/main/inc/local.inc.php @@ -490,7 +490,7 @@ if (isset($uidReset) && $uidReset) { // session data refresh requested // Extracting the user data $uData = Database::fetch_array($result); - $_user = _api_format_user($uData, false); + $_user = api_format_user($uData, false); $_user['lastLogin'] = api_strtotime($uData['login_date'], 'UTC'); $is_platformAdmin = (bool) (! is_null( $uData['is_admin'])); $is_allowedCreateCourse = (bool) (($uData ['status'] == COURSEMANAGER) or (api_get_setting('drhCourseManagerRights') and $uData['status'] == DRH)); diff --git a/main/install/install.lib.php b/main/install/install.lib.php index 59f21a0120..eea3426452 100755 --- a/main/install/install.lib.php +++ b/main/install/install.lib.php @@ -1801,7 +1801,7 @@ function display_database_settings_form( //Database Name fix replace weird chars if ($installType != INSTALL_TYPE_UPDATE) { $dbNameForm = str_replace(array('-', '*', '$', ' ', '.'), '', $dbNameForm); - $dbNameForm = replace_dangerous_char($dbNameForm); + $dbNameForm = api_replace_dangerous_char($dbNameForm); } display_database_parameter( diff --git a/main/newscorm/aicc.class.php b/main/newscorm/aicc.class.php index 2a78e66362..023c487824 100644 --- a/main/newscorm/aicc.class.php +++ b/main/newscorm/aicc.class.php @@ -398,7 +398,7 @@ class aicc extends learnpath } $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; // The absolute system path of this course. - $current_dir = replace_dangerous_char(trim($current_dir), 'strict'); // Current dir we are in, inside scorm/ + $current_dir = api_replace_dangerous_char(trim($current_dir), 'strict'); // Current dir we are in, inside scorm/ if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = '.$current_dir, 0); } @@ -417,7 +417,7 @@ class aicc extends learnpath if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Base file name is : '.$file_base_name, 0); } - $new_dir = replace_dangerous_char(trim($file_base_name), 'strict'); + $new_dir = api_replace_dangerous_char(trim($file_base_name), 'strict'); $this->subdir = $new_dir; if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Subdir is first set to : '.$this->subdir, 0); diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index ca9004fc9a..5c089cf7a9 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -1046,7 +1046,7 @@ class learnpath $path = substr($path, 0, -1); // Remove "." at the end. } //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way. - rmdirr($course_scorm_dir.$path); + api_rmdirr($course_scorm_dir.$path); } } } @@ -6198,7 +6198,7 @@ class learnpath //Creating LP folder if ($folder) { //Limits title size - $title = api_substr(replace_dangerous_char($lp_name), 0, 80); + $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80); $dir = $dir.$title; $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'; if (!is_dir($filepath.'/'.$dir)) { @@ -6262,9 +6262,9 @@ class learnpath $dir = '/'; } - // stripslashes() before calling replace_dangerous_char() because $_POST['title'] + // stripslashes() before calling api_replace_dangerous_char() because $_POST['title'] // is already escaped twice when it gets here. - $title = replace_dangerous_char(stripslashes($_POST['title'])); + $title = api_replace_dangerous_char(stripslashes($_POST['title'])); $title = FileManager::disable_dangerous_file($title); $filename = $title; @@ -9299,7 +9299,7 @@ class learnpath $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); - $zip_files_dist = copyr( + $zip_files_dist = api_copyr( $current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), @@ -10211,7 +10211,7 @@ EOD; } } // Send file to client - $name = replace_dangerous_char($this->get_name()).'.zip'; + $name = api_replace_dangerous_char($this->get_name()).'.zip'; DocumentManager::file_send_for_download($temp_zip_file, true, $name); } @@ -10270,7 +10270,7 @@ EOD; { $path_bits = explode('/', dirname($path)); - // IS_WINDOWS_OS has been defined in main_api.lib.php + // IS_WINDOWS_OS has been defined in api.lib.php $path_built = IS_WINDOWS_OS ? '' : '/'; foreach ($path_bits as $bit) { diff --git a/main/newscorm/learnpathItem.class.php b/main/newscorm/learnpathItem.class.php index 1a5c468b5a..957099e7dd 100644 --- a/main/newscorm/learnpathItem.class.php +++ b/main/newscorm/learnpathItem.class.php @@ -3089,8 +3089,8 @@ class learnpathItem $res = Database::query($sql); $row_dates = Database::fetch_array($res); - $time_start_date = convert_sql_date($row_dates['start_date']); - $time_exe_date = convert_sql_date($row_dates['exe_date']); + $time_start_date = api_convert_sql_date($row_dates['start_date']); + $time_exe_date = api_convert_sql_date($row_dates['exe_date']); $mytime = ((int)$time_exe_date - (int)$time_start_date); $total_time = " total_time = ".$mytime.", "; } diff --git a/main/newscorm/lp_admin_view.php b/main/newscorm/lp_admin_view.php index 81fd915548..3b8cbddf2f 100644 --- a/main/newscorm/lp_admin_view.php +++ b/main/newscorm/lp_admin_view.php @@ -144,7 +144,7 @@ if (isset($_POST['save_audio'])) { // Add extension to files without one (if possible). $file_name = FileManager::add_ext_on_mime($file_name, $_FILES[$key]['type']); - $clean_name = replace_dangerous_char($file_name); + $clean_name = api_replace_dangerous_char($file_name); // No "dangerous" files. $clean_name = FileManager::disable_dangerous_file($clean_name); diff --git a/main/newscorm/lp_list.php b/main/newscorm/lp_list.php index b809beaa38..2060d2d3bd 100644 --- a/main/newscorm/lp_list.php +++ b/main/newscorm/lp_list.php @@ -408,7 +408,7 @@ foreach ($categories as $item) { if ($details['lp_type'] == 1) { $dsp_disk = Display::url(Display::return_icon('cd.gif', get_lang('Export'), array(), ICON_SIZE_SMALL), api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id"); } elseif ($details['lp_type'] == 2) { - $dsp_disk = Display::url(Display::return_icon('cd.gif', get_lang('Export'), array(), ICON_SIZE_SMALL), api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name, 'strict').".zip"); + $dsp_disk = Display::url(Display::return_icon('cd.gif', get_lang('Export'), array(), ICON_SIZE_SMALL), api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".api_replace_dangerous_char($name, 'strict').".zip"); } else { $dsp_disk = Display::return_icon('cd_gray.gif', get_lang('Export'), array(), ICON_SIZE_SMALL); } diff --git a/main/newscorm/lp_move_item.php b/main/newscorm/lp_move_item.php index f9aa4eea46..92d34082b6 100644 --- a/main/newscorm/lp_move_item.php +++ b/main/newscorm/lp_move_item.php @@ -21,7 +21,7 @@ api_protect_course_script(); /* Libraries */ -// The main_api.lib.php, database.lib.php and display.lib.php +// The api.lib.php, database.lib.php and display.lib.php // libraries are included by default. include 'learnpath_functions.inc.php'; diff --git a/main/newscorm/lp_upload.php b/main/newscorm/lp_upload.php index 6ddc678bd6..4a4c02f145 100644 --- a/main/newscorm/lp_upload.php +++ b/main/newscorm/lp_upload.php @@ -16,7 +16,7 @@ $course_sys_dir = api_get_path(SYS_COURSE_PATH).$course_dir; if (empty($_POST['current_dir'])) { $current_dir = ''; } else { - $current_dir = replace_dangerous_char(trim($_POST['current_dir']), 'strict'); + $current_dir = api_replace_dangerous_char(trim($_POST['current_dir']), 'strict'); } $uncompress = 1; @@ -49,7 +49,7 @@ if( Request::is_post() && $is_error){ $extension = $info['extension']; $file_base_name = str_replace('.'.$extension, '', $filename); - $new_dir = replace_dangerous_char(trim($file_base_name), 'strict'); + $new_dir = api_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']); @@ -126,7 +126,7 @@ if( Request::is_post() && $is_error){ $filename = $info['basename']; $extension = $info['extension']; $file_base_name = str_replace('.'.$extension, '', $filename); - $new_dir = replace_dangerous_char(trim($file_base_name), 'strict'); + $new_dir = api_replace_dangerous_char(trim($file_base_name), 'strict'); require_once 'learnpath.class.php'; @@ -178,4 +178,4 @@ if( Request::is_post() && $is_error){ default: return api_failure::set_failure('not_a_learning_path'); } -} \ No newline at end of file +} diff --git a/main/newscorm/lp_view_item.php b/main/newscorm/lp_view_item.php index c4da139d1f..938b57a6d5 100644 --- a/main/newscorm/lp_view_item.php +++ b/main/newscorm/lp_view_item.php @@ -15,7 +15,7 @@ */ // Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP -// The main_api.lib.php, database.lib.php and display.lib.php +// The api.lib.php, database.lib.php and display.lib.php // libraries are included by default. require_once '../inc/global.inc.php'; @@ -34,17 +34,17 @@ if (isset($_GET['lp_item_id'])) { $lp_item_id = intval($_GET['lp_item_id']); if (isset($_SESSION['lpobject'])) { $oLP = unserialize($_SESSION['lpobject']); - } + } if (is_object($oLP)) { $src = $oLP->get_link('http', $lp_item_id); } - + $url_info = parse_url($src); $real_url_info = parse_url(api_get_path(WEB_PATH)); // The host must be the same. if ($url_info['host'] == $real_url_info['host']) { - $url = Security::remove_XSS($src); + $url = Security::remove_XSS($src); header("Location: ".$url); exit; } else { @@ -159,7 +159,7 @@ if (is_object($_SESSION['oLP'])) { break; case 'preview_document': echo $_SESSION['oLP']->display_item($id, null, false); - break; + break; } - + } diff --git a/main/newscorm/openoffice_document.class.php b/main/newscorm/openoffice_document.class.php index d31e1a7fc6..169773fcf6 100644 --- a/main/newscorm/openoffice_document.class.php +++ b/main/newscorm/openoffice_document.class.php @@ -49,7 +49,7 @@ abstract class OpenofficeDocument extends learnpath $this->base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; ///learning_path/ppt_dirname directory $this->created_dir = substr($result['dir'], 0, strlen($result['dir']) - 1); - $this->file_path = $this->created_dir.'/'.replace_dangerous_char($file['name'], 'strict'); + $this->file_path = $this->created_dir.'/'.api_replace_dangerous_char($file['name'], 'strict'); //var_dump($this->file_name, $this->file_path, $this->base_work_dir, $this->created_dir); @@ -84,7 +84,7 @@ abstract class OpenofficeDocument extends learnpath //var_dump( $this->base_work_dir.$this->created_dir.$this->file_path); $perm = api_get_setting('permissions_for_new_files'); - if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php + if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in api.lib.php $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); $class_path = $converter_path.';'.$converter_path.'/jodconverter-2.2.2.jar;'.$converter_path.'/jodconverter-cli-2.2.2.jar'; //$cmd = 'java -cp "'.$class_path.'" DokeosConverter'; diff --git a/main/newscorm/resourcelinker.inc.php b/main/newscorm/resourcelinker.inc.php index 276cd84963..bd61bbf722 100644 --- a/main/newscorm/resourcelinker.inc.php +++ b/main/newscorm/resourcelinker.inc.php @@ -368,7 +368,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ $type = 'Link'; } - // YW switched litteral tool names to use of constants declared in main_api.lib.php + // YW switched litteral tool names to use of constants declared in api.lib.php switch ($type) { case TOOL_CALENDAR_EVENT: case 'Agenda': @@ -2078,7 +2078,7 @@ function showorhide_addresourcelink($type, $id) * @author Patrick Cool , Ghent University * @author Yannick Warnier , Dokeos - rebranding * @param string Course code - * @param string The tool type (using constants declared in main_api.lib.php) + * @param string The tool type (using constants declared in api.lib.php) * @param integer The resource ID * @param string Resource style (e.g. when a resource is hidden => the added resources should also be styled like they are hidden) * @param boolean Open in a new window (true) or in the current frame/window (false)? @@ -2327,7 +2327,7 @@ function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_pa * * @author Yannick Warnier , Dokeos - rebranding * @param string Course code - * @param string The tool type (using constants declared in main_api.lib.php) + * @param string The tool type (using constants declared in api.lib.php) * @param integer The resource ID */ function rl_get_resource_name($course_code, $learnpath_id, $id_in_path) diff --git a/main/newscorm/scorm.class.php b/main/newscorm/scorm.class.php index c7375b8801..affd3ae5ca 100644 --- a/main/newscorm/scorm.class.php +++ b/main/newscorm/scorm.class.php @@ -544,7 +544,7 @@ class scorm extends learnpath mkdir($course_sys_dir, api_get_permissions_for_new_directories()); } - $current_dir = replace_dangerous_char(trim($current_dir), 'strict'); // Current dir we are in, inside scorm/ + $current_dir = api_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); } @@ -563,7 +563,7 @@ class scorm extends learnpath if ($this->debug > 1) { error_log("New LP - base file name is : ".$file_base_name, 0); } - $new_dir = replace_dangerous_char(trim($file_base_name), 'strict'); + $new_dir = api_replace_dangerous_char(trim($file_base_name), 'strict'); $this->subdir = $new_dir; if ($this->debug > 1) { error_log("New LP - subdir is first set to : ".$this->subdir, 0); diff --git a/main/tracking/courseLogCSV.php b/main/tracking/courseLogCSV.php index 1e4e145240..3db48e2bd4 100644 --- a/main/tracking/courseLogCSV.php +++ b/main/tracking/courseLogCSV.php @@ -404,7 +404,7 @@ if ($is_allowedToTrack) { //header('Content-Type: application/force-download'); header('Content-length: ' . $len); $filename = api_html_entity_decode(str_replace(":", "", str_replace(" ", "_", $title[0] . '_' . $title[1] . '.csv'))); - $filename = replace_dangerous_char($filename); + $filename = api_replace_dangerous_char($filename); if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { header('Content-Disposition: filename= ' . $filename); } else { diff --git a/main/tracking/userlogCSV.php b/main/tracking/userlogCSV.php index bb6a485eb2..def613babb 100644 --- a/main/tracking/userlogCSV.php +++ b/main/tracking/userlogCSV.php @@ -306,7 +306,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) //header('Content-Type: application/force-download'); header('Content-length: '.$len); $filename = html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv'))); - $filename = replace_dangerous_char($filename); + $filename = api_replace_dangerous_char($filename); if(preg_match("/MSIE 5.5/",$_SERVER['HTTP_USER_AGENT'])) { header('Content-Disposition: filename= '.$filename); diff --git a/main/wiki/wiki.inc.php b/main/wiki/wiki.inc.php index 7a63a5093d..a7389df283 100644 --- a/main/wiki/wiki.inc.php +++ b/main/wiki/wiki.inc.php @@ -1935,7 +1935,7 @@ function export2doc($doc_id) } $exportDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document'.$groupPath; - $exportFile = replace_dangerous_char($wikiTitle, 'strict').$groupPart; + $exportFile = api_replace_dangerous_char($wikiTitle, 'strict').$groupPart; //$clean_wikiContents = trim(preg_replace("/\[\[|\]\]/", " ", $wikiContents)); //$array_clean_wikiContents= explode('|', $clean_wikiContents); diff --git a/main/work/work.lib.php b/main/work/work.lib.php index b7f16e86a9..9e9e924f64 100644 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -824,7 +824,7 @@ function display_student_publications_list( $values = $form_folder->exportValues(); $work_id = $values['work_id']; - $dir_name = replace_dangerous_char($values['dir_name']); + $dir_name = api_replace_dangerous_char($values['dir_name']); $dir_name = FileManager::disable_dangerous_file($dir_name); $edit_check = false; @@ -1174,7 +1174,7 @@ function get_subdirs_list($basedir = '', $recurse = 0) $dirs_list = array(); $dh = opendir($basedir); while ($entry = readdir($dh)) { - $entry = replace_dangerous_char($entry); + $entry = api_replace_dangerous_char($entry); $entry = FileManager::disable_dangerous_file($entry); if (is_dir($basedir.$entry) && $entry != '..' && $entry != '.') { $dirs_list[] = $entry; @@ -1484,7 +1484,7 @@ function update_dir_name($work_data, $new_name, $title) global $base_work_dir; $new_name = Security::remove_XSS($new_name); - $new_name = replace_dangerous_char($new_name); + $new_name = api_replace_dangerous_char($new_name); $new_name = FileManager::disable_dangerous_file($new_name); FileManager::my_rename($base_work_dir.'/'.$path, $new_name); $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); diff --git a/main/work/work.php b/main/work/work.php index d01a15b898..9c83141ddf 100644 --- a/main/work/work.php +++ b/main/work/work.php @@ -597,7 +597,7 @@ switch ($action) { ); // Replace dangerous characters - $new_file_name = replace_dangerous_char($new_file_name, 'strict'); + $new_file_name = api_replace_dangerous_char($new_file_name, 'strict'); // Transform any .php file in .phps fo security $new_file_name = FileManager::php2phps($new_file_name); @@ -906,7 +906,7 @@ switch ($action) { if ($form->validate()) { $directory = Security::remove_XSS($_POST['new_dir']); - $directory = replace_dangerous_char($directory); + $directory = api_replace_dangerous_char($directory); $directory = FileManager::disable_dangerous_file($directory); $dir_name = $curdirpath.$directory; $created_dir = create_unexisting_work_directory($base_work_dir, $dir_name); @@ -1448,4 +1448,4 @@ switch ($action) { if ($origin != 'learnpath') { //we are not in the learning path tool Display :: display_footer(); -} \ No newline at end of file +}