[svn r21249] FS#306 - Introducing a new library that will re-implement some PHP file system related functions. These replacement functions will deal with the diffenrent encodings that are used by the Dokeos platform and the server's file system.

skala
Ivan Tcholakov 16 years ago
parent 3efbdbf6e8
commit 1726ed6060
  1. 36
      main/inc/lib/filesystem_api.lib.php
  2. 4
      main/inc/lib/main_api.lib.php

@ -0,0 +1,36 @@
<?php
/**
* ==============================================================================
* File: filesystem_api.lib.php
* Main API extension library for Dokeos 1.8.6.1+ LMS
* A common purpose library for supporting filesystem functions
* with encoding management.
* License: GNU/GPL version 2 or later (Free Software Foundation)
* @author: Ivan Tcholakov, ivantcholakov@gmail.com
* June 2009
* @package dokeos.library
* ==============================================================================
*/
/**
* The original PHP5 file system function do not convert file/folder
* names into proper encoding. The encoding which site uses and the
* encoding of the server's file system might be different.
*
* The major difference in the following functions is that they work
* with file/folder names that are encoded using the platform
* character set.
*/
/**
* Returns the MIME content type for a file as determined by using information from the magic.mime file.
* @param string $filename Path to the tested file.
* @return Returns the content type in MIME format.
* Note: As of PHP 5.3.0 this function is considered as deprecated. The PECL extension Fileinfo provides the same functionality.
* @link http://php.net/mime_content_type
*/
function api_mime_content_type ($filename) {
return mime_content_type (api_file_system_encode($filename));
}
?>

@ -179,9 +179,11 @@ define ('IS_WINDOWS_OS', api_is_windows_os());
if (api_get_path(LIBRARY_PATH) == '/lib/') {
// when we are running the installer script.
require_once 'multibyte_string_functions.lib.php';
require_once 'filesystem_api.lib.php';
} else {
// when the system has been already installed, this is the usual way.
require_once api_get_path(LIBRARY_PATH).'multibyte_string_functions.lib.php';
require_once api_get_path(LIBRARY_PATH).'filesystem_api.lib.php';
}
/*
@ -3608,4 +3610,4 @@ function api_get_tools_lists ($my_tool=null) {
return '';
}
}
}

Loading…
Cancel
Save