Changeset 518 for trunk/lib/Upload.inc.php
- Timestamp:
- May 1, 2015 1:15:16 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Upload.inc.php
r502 r518 304 304 305 305 // Clean the file name of bad characters. 306 $file_name = $this->cleanFileName($file_name);306 $file_name = cleanFileName($file_name); 307 307 308 308 // FINAL path and file name, lowercase extension. … … 475 475 476 476 /** 477 * Removes non-latin characters from file name, using htmlentities to convert known weirdos into regular squares.478 *479 * @access public480 * @param string $file_name A name of a file.481 * @return string The same name, but cleaned.482 */483 public function cleanFileName($file_name)484 {485 $file_name = preg_replace(array(486 '/&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);/ui',487 '/&(?:amp);/ui',488 '/[&;]+/u',489 '/[^a-zA-Z0-9()@._=+-]+/u',490 '/^_+|_+$/u'491 ), array(492 '$1',493 'and',494 '',495 '_',496 ''497 ), htmlentities($file_name, ENT_NOQUOTES | ENT_IGNORE, 'UTF-8'));498 return mb_substr($file_name, 0, 250);499 }500 501 502 /**503 477 * Returns the extension of a file name, or an empty string if non exists. 504 478 *
Note: See TracChangeset
for help on using the changeset viewer.