Bläddra i källkod

Adding "api_" in function inside main_api.lib.php

Julio Montoya 11 år sedan
förälder
incheckning
d76b6cc817
55 ändrade filer med 104 tillägg och 106 borttagningar
  1. 2 2
      main/admin/archive_cleanup.php
  2. 2 2
      main/admin/configure_homepage.php
  3. 1 4
      main/admin/configure_inscription.php
  4. 1 1
      main/auth/inscription.php
  5. 1 1
      main/auth/profile.php
  6. 2 1
      main/course_home/course_home.php
  7. 2 2
      main/coursecopy/classes/CourseArchiver.class.php
  8. 2 2
      main/coursecopy/classes/CourseRecycler.class.php
  9. 2 2
      main/coursecopy/classes/CourseRestorer.class.php
  10. 1 1
      main/coursecopy/classes/DummyCourseCreator.class.php
  11. 2 2
      main/document/create_document.php
  12. 1 1
      main/document/document.php
  13. 1 1
      main/document/document_lite.php
  14. 2 2
      main/document/save_pixlr.php
  15. 4 4
      main/dropbox/dropbox_config.inc.php
  16. 1 1
      main/dropbox/dropbox_functions.inc.php
  17. 1 1
      main/dropbox/dropbox_submit.php
  18. 1 1
      main/exercice/hotpotatoes.php
  19. 1 1
      main/gradebook/lib/fe/exportgradebook.php
  20. 2 2
      main/inc/lib/dashboard.lib.php
  21. 1 1
      main/inc/lib/display.lib.php
  22. 1 1
      main/inc/lib/document.lib.php
  23. 1 1
      main/inc/lib/fckeditor/editor/filemanager/connectors/php/io.php
  24. 2 2
      main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php
  25. 2 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php
  26. 5 5
      main/inc/lib/fileManager.lib.php
  27. 1 1
      main/inc/lib/group_portal_manager.lib.php
  28. 1 1
      main/inc/lib/groupmanager.lib.php
  29. 1 1
      main/inc/lib/jpegcam/webcam_receiver.php
  30. 2 2
      main/inc/lib/nanogong/receiver.php
  31. 2 2
      main/inc/lib/pdf.lib.php
  32. 1 1
      main/inc/lib/social.lib.php
  33. 2 2
      main/inc/lib/svg-edit/extensions/fileopen.php
  34. 2 2
      main/inc/lib/svg-edit/extensions/filesave.php
  35. 2 2
      main/inc/lib/template.lib.php
  36. 2 2
      main/inc/lib/usergroup.lib.php
  37. 2 2
      main/inc/lib/wami-recorder/record_document.php
  38. 1 1
      main/inc/local.inc.php
  39. 1 1
      main/install/install.lib.php
  40. 2 2
      main/newscorm/aicc.class.php
  41. 7 7
      main/newscorm/learnpath.class.php
  42. 2 2
      main/newscorm/learnpathItem.class.php
  43. 1 1
      main/newscorm/lp_admin_view.php
  44. 1 1
      main/newscorm/lp_list.php
  45. 1 1
      main/newscorm/lp_move_item.php
  46. 4 4
      main/newscorm/lp_upload.php
  47. 6 6
      main/newscorm/lp_view_item.php
  48. 2 2
      main/newscorm/openoffice_document.class.php
  49. 3 3
      main/newscorm/resourcelinker.inc.php
  50. 2 2
      main/newscorm/scorm.class.php
  51. 1 1
      main/tracking/courseLogCSV.php
  52. 1 1
      main/tracking/userlogCSV.php
  53. 1 1
      main/wiki/wiki.inc.php
  54. 3 3
      main/work/work.lib.php
  55. 3 3
      main/work/work.php

+ 2 - 2
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();
+Display::display_footer();

+ 2 - 2
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)) {

+ 1 - 4
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;

+ 1 - 1
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/';

+ 1 - 1
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)) {

+ 2 - 1
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

+ 2 - 2
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;
     }
 

+ 2 - 2
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);
                     }
                 }
 

+ 2 - 2
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),

+ 1 - 1
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

+ 2 - 2
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

+ 1 - 1
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;
 

+ 1 - 1
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;
 

+ 2 - 2
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 '<script>window.parent.location.href="'.$location.'"</script>';
     unset($_SESSION['exit_pixlr']);
-}
+}

+ 4 - 4
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

+ 1 - 1
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);
 

+ 1 - 1
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)) {

+ 1 - 1
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);

+ 1 - 1
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;
 }
 

+ 2 - 2
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

+ 1 - 1
main/inc/lib/display.lib.php

@@ -1419,7 +1419,7 @@ class Display
         // Show all tool icons where there is something new.
         $retvalue = '&nbsp;';
         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;

+ 1 - 1
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) {

+ 1 - 1
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);
 

+ 2 - 2
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
     }
 }
 
-?>
+?>

+ 2 - 2
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
     }
 }
 
-?>
+?>

+ 5 - 5
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) {

+ 1 - 1
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;
 			}

+ 1 - 1
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,

+ 1 - 1
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);
 

+ 2 - 2
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');
-}
+}

+ 2 - 2
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

+ 1 - 1
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 ? '&nbsp;('.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'));
 

+ 2 - 2
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
 
 <script>
     window.top.window.svgEditor.processFile("<?php echo $prefix.base64_encode($output); ?>", "<?php echo $type ?>");
-</script>
+</script>

+ 2 - 2
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 '</script>';
+echo '</script>';

+ 2 - 2
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

+ 2 - 2
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;
     }
 
-}
+}

+ 2 - 2
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
 );
-?>
+?>

+ 1 - 1
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));

+ 1 - 1
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(

+ 2 - 2
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);

+ 7 - 7
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) {

+ 2 - 2
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.", ";
                         }

+ 1 - 1
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);
 

+ 1 - 1
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);
                 }

+ 1 - 1
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';

+ 4 - 4
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');
     }
-}
+}

+ 6 - 6
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;
     }
-	
+
 }

+ 2 - 2
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';

+ 3 - 3
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 <patrick.cool@UGent.be>, Ghent University
  * @author Yannick Warnier <ywarnier@beeznest.org>, 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 <ywarnier@beeznest.org>, 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)

+ 2 - 2
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);

+ 1 - 1
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 {

+ 1 - 1
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);

+ 1 - 1
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);

+ 3 - 3
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);

+ 3 - 3
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();
-}
+}