forked from Wavyzz/dolibarr
Clean code
This commit is contained in:
@@ -8402,8 +8402,6 @@ abstract class CommonObject
|
||||
$photo = '';
|
||||
$file = $val['name'];
|
||||
|
||||
//if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
|
||||
|
||||
//if (dol_is_file($dir.$file) && image_format_supported($file) >= 0)
|
||||
if (image_format_supported($file) >= 0) {
|
||||
$nbphoto++;
|
||||
|
||||
@@ -42,6 +42,34 @@
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
|
||||
|
||||
if (!function_exists('utf8_encode')) {
|
||||
/**
|
||||
* Implement utf8_encode for PHP that does not support it.
|
||||
*
|
||||
* @param mixed $elements PHP Object to json encode
|
||||
* @return string Json encoded string
|
||||
*/
|
||||
function utf8_encode($elements)
|
||||
{
|
||||
return mb_convert_encoding($elements, 'UTF-8', 'ISO-8859-1');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('utf8_decode')) {
|
||||
/**
|
||||
* Implement utf8_decode for PHP that does not support it.
|
||||
*
|
||||
* @param mixed $elements PHP Object to json encode
|
||||
* @return string Json encoded string
|
||||
*/
|
||||
function utf8_decode($elements)
|
||||
{
|
||||
return mb_convert_encoding($elements, 'ISO-8859-1', 'UTF-8');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return dolibarr global constant string value
|
||||
* @param string $key key to return value, return '' if not set
|
||||
|
||||
@@ -2319,9 +2319,8 @@ class Ticket extends CommonObject
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (!utf8_check($file)) {
|
||||
$file = utf8_encode($file);
|
||||
$file = utf8_encode($file); // To be sure data is stored in UTF8 in memory
|
||||
}
|
||||
// To be sure data is stored in UTF8 in memory
|
||||
if (dol_is_file($dir.$file)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -885,7 +885,6 @@ if ($action == 'addcontainer' && $usercanedit) {
|
||||
} else {
|
||||
// Clean some comment
|
||||
//$tmpgeturl['content'] = dol_string_is_good_iso($tmpgeturl['content'], 1);
|
||||
//$tmpgeturl['content'] = utf8_encode(utf8_decode($tmpgeturl['content']));
|
||||
//$tmpgeturl['content'] = mb_convert_encoding($tmpgeturl['content'], 'UTF-8', 'UTF-8');
|
||||
//$tmpgeturl['content'] = remove_bs($tmpgeturl['content']);
|
||||
//$tmpgeturl['content'] = str_replace('$screen-md-max', 'auto', $tmpgeturl['content']);
|
||||
|
||||
Reference in New Issue
Block a user